@chefuicore/core 0.1.0 → 0.3.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-accordion.d.ts +33 -0
- package/dist/components/chef-ui-accordion.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 +554 -13
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +556 -15
- package/dist/index.js.map +1 -0
- package/dist/utils/icon-resolver.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,50 +1,66 @@
|
|
|
1
|
-
function
|
|
1
|
+
function e(e,t,i,o){var r,s=arguments.length,n=s<3?t:null===o?o=Object.getOwnPropertyDescriptor(t,i):o;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)n=Reflect.decorate(e,t,i,o);else for(var a=e.length-1;a>=0;a--)(r=e[a])&&(n=(s<3?r(n):s>3?r(t,i,n):r(t,i))||n);return s>3&&n&&Object.defineProperty(t,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
|
|
7
|
+
const t=globalThis,i=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,o=Symbol(),r=new WeakMap;let s=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==o)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o;const t=this.t;if(i&&void 0===e){const i=void 0!==t&&1===t.length;i&&(e=r.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&r.set(t,e))}return e}toString(){return this.cssText}};const n=(e,...t)=>{const i=1===e.length?e[0]:t.reduce((t,i,o)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+e[o+1],e[0]);return new s(i,e,o)},a=i?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const i of e.cssRules)t+=i.cssText;return(e=>new s("string"==typeof e?e:e+"",void 0,o))(t)})(e):e,{is:c,defineProperty:l,getOwnPropertyDescriptor:h,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,f=globalThis,v=f.trustedTypes,g=v?v.emptyScript:"",b=f.reactiveElementPolyfillSupport,y=(e,t)=>e,m={toAttribute(e,t){switch(t){case Boolean:e=e?g:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let i=e;switch(t){case Boolean:i=null!==e;break;case Number:i=null===e?null:Number(e);break;case Object:case Array:try{i=JSON.parse(e)}catch(e){i=null}}return i}},$=(e,t)=>!c(e,t),x={attribute:!0,type:String,converter:m,reflect:!1,useDefault:!1,hasChanged:$};
|
|
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(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=x){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){const i=Symbol(),o=this.getPropertyDescriptor(e,i,t);void 0!==o&&l(this.prototype,e,o)}}static getPropertyDescriptor(e,t,i){const{get:o,set:r}=h(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:o,set(t){const s=o?.call(this);r?.call(this,t),this.requestUpdate(e,s,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??x}static _$Ei(){if(this.hasOwnProperty(y("elementProperties")))return;const e=u(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(y("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(y("properties"))){const e=this.properties,t=[...d(e),...p(e)];for(const i of t)this.createProperty(i,e[i])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,i]of t)this.elementProperties.set(e,i)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const i=this._$Eu(e,t);void 0!==i&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const i=new Set(e.flat(1/0).reverse());for(const e of i)t.unshift(a(e))}else void 0!==e&&t.push(a(e));return t}static _$Eu(e,t){const i=t.attribute;return!1===i?void 0:"string"==typeof i?i:"string"==typeof e?e.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(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){const e=new Map,t=this.constructor.elementProperties;for(const i of t.keys())this.hasOwnProperty(i)&&(e.set(i,this[i]),delete this[i]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,o)=>{if(i)e.adoptedStyleSheets=o.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const i of o){const o=document.createElement("style"),r=t.litNonce;void 0!==r&&o.setAttribute("nonce",r),o.textContent=i.cssText,e.appendChild(o)}})(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$ET(e,t){const i=this.constructor.elementProperties.get(e),o=this.constructor._$Eu(e,i);if(void 0!==o&&!0===i.reflect){const r=(void 0!==i.converter?.toAttribute?i.converter:m).toAttribute(t,i.type);this._$Em=e,null==r?this.removeAttribute(o):this.setAttribute(o,r),this._$Em=null}}_$AK(e,t){const i=this.constructor,o=i._$Eh.get(e);if(void 0!==o&&this._$Em!==o){const e=i.getPropertyOptions(o),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:m;this._$Em=o;const s=r.fromAttribute(t,e.type);this[o]=s??this._$Ej?.get(o)??s,this._$Em=null}}requestUpdate(e,t,i){if(void 0!==e){const o=this.constructor,r=this[e];if(i??=o.getPropertyOptions(e),!((i.hasChanged??$)(r,t)||i.useDefault&&i.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(o._$Eu(e,i))))return;this.C(e,t,i)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:i,reflect:o,wrapped:r},s){i&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==r||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||i||(t=void 0),this._$AL.set(e,t)),!0===o&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}const e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}const e=this.constructor.elementProperties;if(e.size>0)for(const[t,i]of e){const{wrapped:e}=i,o=this[t];!0!==e||this._$AL.has(t)||void 0===o||this.C(t,void 0,i,o)}}let e=!1;const t=this._$AL;try{e=this.shouldUpdate(t),e?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}};_.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 w=globalThis,A=w.trustedTypes,E=A?A.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",k=`lit$${Math.random().toFixed(9).slice(2)}$`,C="?"+k,M=`<${C}>`,O=document,P=()=>O.createComment(""),H=e=>null===e||"object"!=typeof e&&"function"!=typeof e,U=Array.isArray,z="[ \t\n\f\r]",T=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,D=/-->/g,L=/>/g,R=RegExp(`>|${z}(?:([^\\s"'>=/]+)(${z}*=${z}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),N=/'/g,j=/"/g,I=/^(?:script|style|textarea|title)$/i,B=e=>(t,...i)=>({_$litType$:e,strings:t,values:i}),V=B(1),Z=B(2),q=Symbol.for("lit-noChange"),F=Symbol.for("lit-nothing"),W=new WeakMap,Q=O.createTreeWalker(O,129);function K(e,t){if(!U(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==E?E.createHTML(t):t}const Y=(e,t)=>{const i=e.length-1,o=[];let r,s=2===t?"<svg>":3===t?"<math>":"",n=T;for(let t=0;t<i;t++){const i=e[t];let a,c,l=-1,h=0;for(;h<i.length&&(n.lastIndex=h,c=n.exec(i),null!==c);)h=n.lastIndex,n===T?"!--"===c[1]?n=D:void 0!==c[1]?n=L:void 0!==c[2]?(I.test(c[2])&&(r=RegExp("</"+c[2],"g")),n=R):void 0!==c[3]&&(n=R):n===R?">"===c[0]?(n=r??T,l=-1):void 0===c[1]?l=-2:(l=n.lastIndex-c[2].length,a=c[1],n=void 0===c[3]?R:'"'===c[3]?j:N):n===j||n===N?n=R:n===D||n===L?n=T:(n=R,r=void 0);const d=n===R&&e[t+1].startsWith("/>")?" ":"";s+=n===T?i+M:l>=0?(o.push(a),i.slice(0,l)+S+i.slice(l)+k+d):i+k+(-2===l?t:d)}return[K(e,s+(e[i]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),o]};class J{constructor({strings:e,_$litType$:t},i){let o;this.parts=[];let r=0,s=0;const n=e.length-1,a=this.parts,[c,l]=Y(e,t);if(this.el=J.createElement(c,i),Q.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(o=Q.nextNode())&&a.length<n;){if(1===o.nodeType){if(o.hasAttributes())for(const e of o.getAttributeNames())if(e.endsWith(S)){const t=l[s++],i=o.getAttribute(e).split(k),n=/([.?@])?(.*)/.exec(t);a.push({type:1,index:r,name:n[2],strings:i,ctor:"."===n[1]?ie:"?"===n[1]?oe:"@"===n[1]?re:te}),o.removeAttribute(e)}else e.startsWith(k)&&(a.push({type:6,index:r}),o.removeAttribute(e));if(I.test(o.tagName)){const e=o.textContent.split(k),t=e.length-1;if(t>0){o.textContent=A?A.emptyScript:"";for(let i=0;i<t;i++)o.append(e[i],P()),Q.nextNode(),a.push({type:2,index:++r});o.append(e[t],P())}}}else if(8===o.nodeType)if(o.data===C)a.push({type:2,index:r});else{let e=-1;for(;-1!==(e=o.data.indexOf(k,e+1));)a.push({type:7,index:r}),e+=k.length-1}r++}}static createElement(e,t){const i=O.createElement("template");return i.innerHTML=e,i}}function G(e,t,i=e,o){if(t===q)return t;let r=void 0!==o?i._$Co?.[o]:i._$Cl;const s=H(t)?void 0:t._$litDirective$;return r?.constructor!==s&&(r?._$AO?.(!1),void 0===s?r=void 0:(r=new s(e),r._$AT(e,i,o)),void 0!==o?(i._$Co??=[])[o]=r:i._$Cl=r),void 0!==r&&(t=G(e,r._$AS(e,t.values),r,o)),t}class X{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){const{el:{content:t},parts:i}=this._$AD,o=(e?.creationScope??O).importNode(t,!0);Q.currentNode=o;let r=Q.nextNode(),s=0,n=0,a=i[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new ee(r,r.nextSibling,this,e):1===a.type?t=new a.ctor(r,a.name,a.strings,this,e):6===a.type&&(t=new se(r,this,e)),this._$AV.push(t),a=i[++n]}s!==a?.index&&(r=Q.nextNode(),s++)}return Q.currentNode=O,o}p(e){let t=0;for(const i of this._$AV)void 0!==i&&(void 0!==i.strings?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}}class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,i,o){this.type=2,this._$AH=F,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=o,this._$Cv=o?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode;const t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=G(this,e,t),H(e)?e===F||null==e||""===e?(this._$AH!==F&&this._$AR(),this._$AH=F):e!==this._$AH&&e!==q&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>U(e)||"function"==typeof e?.[Symbol.iterator])(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==F&&H(this._$AH)?this._$AA.nextSibling.data=e:this.T(O.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:i}=e,o="number"==typeof i?this._$AC(e):(void 0===i.el&&(i.el=J.createElement(K(i.h,i.h[0]),this.options)),i);if(this._$AH?._$AD===o)this._$AH.p(t);else{const e=new X(o,this),i=e.u(this.options);e.p(t),this.T(i),this._$AH=e}}_$AC(e){let t=W.get(e.strings);return void 0===t&&W.set(e.strings,t=new J(e)),t}k(e){U(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let i,o=0;for(const r of e)o===t.length?t.push(i=new ee(this.O(P()),this.O(P()),this,this.options)):i=t[o],i._$AI(r),o++;o<t.length&&(this._$AR(i&&i._$AB.nextSibling,o),t.length=o)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e!==this._$AB;){const t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,i,o,r){this.type=1,this._$AH=F,this._$AN=void 0,this.element=e,this.name=t,this._$AM=o,this.options=r,i.length>2||""!==i[0]||""!==i[1]?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=F}_$AI(e,t=this,i,o){const r=this.strings;let s=!1;if(void 0===r)e=G(this,e,t,0),s=!H(e)||e!==this._$AH&&e!==q,s&&(this._$AH=e);else{const o=e;let n,a;for(e=r[0],n=0;n<r.length-1;n++)a=G(this,o[i+n],t,n),a===q&&(a=this._$AH[n]),s||=!H(a)||a!==this._$AH[n],a===F?e=F:e!==F&&(e+=(a??"")+r[n+1]),this._$AH[n]=a}s&&!o&&this.j(e)}j(e){e===F?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class ie extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===F?void 0:e}}class oe extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==F)}}class re extends te{constructor(e,t,i,o,r){super(e,t,i,o,r),this.type=5}_$AI(e,t=this){if((e=G(this,e,t,0)??F)===q)return;const i=this._$AH,o=e===F&&i!==F||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,r=e!==F&&(i===F||o);o&&this.element.removeEventListener(this.name,this,i),r&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class se{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){G(this,e)}}const ne=w.litHtmlPolyfillSupport;ne?.(J,ee),(w.litHtmlVersions??=[]).push("3.3.1");const ae=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/class
|
|
23
|
+
*/class ce extends _{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){const t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=((e,t,i)=>{const o=i?.renderBefore??t;let r=o._$litPart$;if(void 0===r){const e=i?.renderBefore??null;o._$litPart$=r=new ee(t.insertBefore(P(),e),e,void 0,i??{})}return r._$AI(e),r})(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return q}}ce._$litElement$=!0,ce.finalized=!0,ae.litElementHydrateSupport?.({LitElement:ce});const le=ae.litElementPolyfillSupport;le?.({LitElement:ce}),(ae.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
|
|
29
|
+
const he=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},de={attribute:!0,type:String,converter:m,reflect:!1,hasChanged:$},pe=(e=de,t,i)=>{const{kind:o,metadata:r}=i;let s=globalThis.litPropertyMetadata.get(r);if(void 0===s&&globalThis.litPropertyMetadata.set(r,s=new Map),"setter"===o&&((e=Object.create(e)).wrapped=!0),s.set(i.name,e),"accessor"===o){const{name:o}=i;return{set(i){const r=t.get.call(this);t.set.call(this,i),this.requestUpdate(o,r,e)},init(t){return void 0!==t&&this.C(o,void 0,e,t),t}}}if("setter"===o){const{name:o}=i;return function(i){const r=this[o];t.call(this,i),this.requestUpdate(o,r,e)}}throw Error("Unsupported decorator location: "+o)};
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2017 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/function
|
|
34
|
+
*/function ue(e){return(t,i)=>"object"==typeof i?pe(e,t,i):((e,t,i)=>{const o=t.hasOwnProperty(i);return t.constructor.createProperty(i,e),o?Object.getOwnPropertyDescriptor(t,i):void 0})(e,t,i)}
|
|
35
|
+
/**
|
|
36
|
+
* @license
|
|
37
|
+
* Copyright 2017 Google LLC
|
|
38
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
39
|
+
*/function fe(e){return ue({...e,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 ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,i),i))(t,i,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}class ge{constructor(){this.registry=new Map}register(e,t){this.registry.set(e,t)}resolve(e){return this.registry.get(e)}has(e){return this.registry.has(e)}list(){return Array.from(this.registry.keys()).sort()}}const be=new ge;be.register("plus",{outline:"M12 4v16M4 12h16",solid:"M11 4h2v7h7v2h-7v7h-2v-7H4v-2h7z"}),be.register("check",{outline:"m5 13 4 4L19 7",solid:"M10 15.172 5.414 10.586 4 12l6 6L20 8l-1.414-1.414z"}),be.register("x",{outline:"M6 6l12 12M6 18L18 6",solid:"M6 6l12 12M6 18L18 6"}),be.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"}),be.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"}),be.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"}),be.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"}),be.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"}),be.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"}),be.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"}),be.register("arrow-right",{outline:"M5 12h14M13 5l7 7-7 7",solid:"M10 5l7 7-7 7V5z"}),be.register("arrow-left",{outline:"M19 12H5m6 7-7-7 7-7",solid:"M14 19l-7-7 7-7v14z"});let ye=class extends ce{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 e=be.resolve(this.name);if(!e)return null;const t="solid"===this.styleVariant&&!!e.solid?e.solid:e.outline;return Z`<path d="${t}" />`}render(){const e=be.resolve(this.name),t="solid"===this.styleVariant&&!!e?.solid;return V`
|
|
35
51
|
<svg
|
|
36
52
|
part="icon"
|
|
37
53
|
xmlns="http://www.w3.org/2000/svg"
|
|
38
54
|
viewBox="0 0 24 24"
|
|
39
|
-
fill=${
|
|
40
|
-
stroke=${
|
|
41
|
-
stroke-width=${
|
|
55
|
+
fill=${t?"var(--chefui-icon-color)":"none"}
|
|
56
|
+
stroke=${t?"none":"var(--chefui-icon-color)"}
|
|
57
|
+
stroke-width=${t?"0":"2"}
|
|
42
58
|
role="img"
|
|
43
59
|
aria-label=${this.ariaLabel||this.name}
|
|
44
60
|
>
|
|
45
61
|
${this.renderPath()}
|
|
46
62
|
</svg>
|
|
47
|
-
`}}
|
|
63
|
+
`}};ye.styles=n`
|
|
48
64
|
:host {
|
|
49
65
|
display: inline-flex;
|
|
50
66
|
--chefui-icon-size: 1.1em;
|
|
@@ -52,7 +68,7 @@ const ct=t=>(e,i)=>{void 0!==i?i.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
|
-
`,
|
|
71
|
+
`,e([ue({type:String,reflect:!0})],ye.prototype,"name",void 0),e([ue({type:String,reflect:!0})],ye.prototype,"styleVariant",void 0),e([ue({type:String,reflect:!0})],ye.prototype,"size",void 0),e([ue({type:String,reflect:!0})],ye.prototype,"color",void 0),e([ue({type:String,attribute:"aria-label"})],ye.prototype,"ariaLabel",void 0),ye=e([he("chef-icon")],ye);let me=class extends ce{constructor(){super(...arguments),this.disabled=!1,this.variant="solid",this.type="button"}findAssociatedForm(){if(this.form){const e=this.ownerDocument.getElementById(this.form);if(e&&e instanceof HTMLFormElement)return e}return this.closest("form")}handleClick(e){if(this.disabled)return e.stopImmediatePropagation(),void e.preventDefault();this.dispatchEvent(new CustomEvent("chef-click",{bubbles:!0,composed:!0}));const t=this.findAssociatedForm();if(t)if("submit"===this.type){const e=document.createElement("button");e.type="submit",this.name&&(e.name=this.name),null!=this.value&&(e.value=this.value),e.hidden=!0,t.appendChild(e),e.click(),t.removeChild(e)}else"reset"===this.type&&t.reset()}render(){return V`
|
|
56
72
|
<button
|
|
57
73
|
type="button"
|
|
58
74
|
?disabled=${this.disabled}
|
|
@@ -62,11 +78,11 @@ const ct=t=>(e,i)=>{void 0!==i?i.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>
|
|
69
|
-
`}};
|
|
85
|
+
`}};me.styles=n`
|
|
70
86
|
:host {
|
|
71
87
|
display: inline-block;
|
|
72
88
|
--chefui-color: #1976d2;
|
|
@@ -146,5 +162,530 @@ const ct=t=>(e,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(t,e)}
|
|
|
146
162
|
height: 1.1em;
|
|
147
163
|
display: inline-flex;
|
|
148
164
|
}
|
|
149
|
-
`,
|
|
165
|
+
`,e([ue({type:Boolean,reflect:!0})],me.prototype,"disabled",void 0),e([ue({type:String,reflect:!0})],me.prototype,"variant",void 0),e([ue({type:String,reflect:!0})],me.prototype,"type",void 0),e([ue({type:String})],me.prototype,"name",void 0),e([ue({type:String})],me.prototype,"value",void 0),e([ue({type:String,reflect:!0})],me.prototype,"form",void 0),e([ue({type:String,reflect:!0})],me.prototype,"icon",void 0),me=e([he("chef-button")],me);let $e=class extends ce{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=e=>{this.contains(e.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(e){e.stopPropagation(),this.disabled||(this.isOpen=!this.isOpen,this.isOpen&&this.searchable&&setTimeout(()=>{this.searchInputEl?.focus()},100))}selectOption(e,t){if(t.stopPropagation(),this.disabled)return;const i=this.value;this.value=e,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(e){if(!this.disabled)switch(e.key){case"Enter":case" ":if(e.target.classList.contains("search-input"))return;e.preventDefault(),this.toggleDropdown(e);break;case"Escape":e.preventDefault(),this.closeDropdown();break;case"ArrowDown":if(e.preventDefault(),this.isOpen){const e=this.getFilteredOptions(),t=e.findIndex(e=>e.value===this.value),i=Math.min(t+1,e.length-1);i>=0&&e[i]&&(this.value=e[i].value)}else this.isOpen=!0;break;case"ArrowUp":if(e.preventDefault(),this.isOpen){const e=this.getFilteredOptions(),t=e.findIndex(e=>e.value===this.value),i=Math.max(t-1,0);i>=0&&e[i]&&(this.value=e[i].value)}else this.isOpen=!0}}handleSearchInput(e){const t=e.target;this.searchQuery=t.value.toLowerCase()}getFilteredOptions(){return this.searchQuery?this.options.filter(e=>e.label.toLowerCase().includes(this.searchQuery)||e.value.toLowerCase().includes(this.searchQuery)):this.options}getSelectedOption(){return this.options.find(e=>e.value===this.value)}render(){const e=this.getSelectedOption(),t=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 ${e?"":"placeholder"}">
|
|
182
|
+
${this.prefixIcon?V`
|
|
183
|
+
<chef-icon class="prefix-icon" name=${this.prefixIcon}></chef-icon>
|
|
184
|
+
`:null}
|
|
185
|
+
${e?.icon?V`
|
|
186
|
+
<chef-icon class="option-icon" name=${e.icon}></chef-icon>
|
|
187
|
+
`:null}
|
|
188
|
+
<span>${e?.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=${e=>{"Enter"===e.key&&e.preventDefault()}}
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
</div>
|
|
207
|
+
`:null}
|
|
208
|
+
|
|
209
|
+
${t.length>0?V`
|
|
210
|
+
${t.map(e=>V`
|
|
211
|
+
<div
|
|
212
|
+
class="option"
|
|
213
|
+
role="option"
|
|
214
|
+
aria-selected=${e.value===this.value}
|
|
215
|
+
@click=${t=>this.selectOption(e.value,t)}
|
|
216
|
+
part="option"
|
|
217
|
+
>
|
|
218
|
+
${e.icon?V`
|
|
219
|
+
<chef-icon class="option-icon" name=${e.icon}></chef-icon>
|
|
220
|
+
`:null}
|
|
221
|
+
<span>${e.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
|
+
`}};$e.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
|
+
`,e([ue({type:String})],$e.prototype,"label",void 0),e([ue({type:String,reflect:!0})],$e.prototype,"placeholder",void 0),e([ue({type:String,reflect:!0})],$e.prototype,"value",void 0),e([ue({type:Boolean,reflect:!0})],$e.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0})],$e.prototype,"invalid",void 0),e([ue({type:String})],$e.prototype,"name",void 0),e([ue({type:Array})],$e.prototype,"options",void 0),e([ue({type:Boolean,reflect:!0})],$e.prototype,"required",void 0),e([ue({type:Boolean,reflect:!0})],$e.prototype,"searchable",void 0),e([ue({type:String})],$e.prototype,"prefixIcon",void 0),e([ue({type:String})],$e.prototype,"searchPlaceholder",void 0),e([fe()],$e.prototype,"isOpen",void 0),e([fe()],$e.prototype,"searchQuery",void 0),e([ve(".dropdown")],$e.prototype,"dropdownEl",void 0),e([ve(".search-input")],$e.prototype,"searchInputEl",void 0),$e=e([he("chef-ui-select")],$e);let xe=class extends ce{constructor(){super(...arguments),this.variant="default",this.multiple=!1,this.collapsible=!0}handleItemToggle(e){if(!this.multiple&&e.detail.expanded){this.querySelectorAll("chef-ui-accordion-item").forEach(t=>{t!==e.target&&(t.expanded=!1)})}}connectedCallback(){super.connectedCallback(),this.addEventListener("accordion-item-toggle",this.handleItemToggle)}disconnectedCallback(){this.removeEventListener("accordion-item-toggle",this.handleItemToggle),super.disconnectedCallback()}render(){return V`
|
|
447
|
+
<div class="accordion-container" role="region">
|
|
448
|
+
<slot></slot>
|
|
449
|
+
</div>
|
|
450
|
+
`}};xe.styles=n`
|
|
451
|
+
:host {
|
|
452
|
+
display: block;
|
|
453
|
+
--chefui-accordion-bg: #1e293b;
|
|
454
|
+
--chefui-accordion-border: #334155;
|
|
455
|
+
--chefui-accordion-header-bg: #1e293b;
|
|
456
|
+
--chefui-accordion-header-hover: rgba(124, 58, 237, 0.08);
|
|
457
|
+
--chefui-accordion-header-active: rgba(124, 58, 237, 0.15);
|
|
458
|
+
--chefui-accordion-content-bg: #0f172a;
|
|
459
|
+
--chefui-accordion-text: #e2e8f0;
|
|
460
|
+
--chefui-accordion-text-muted: #94a3b8;
|
|
461
|
+
--chefui-accordion-accent: #7c3aed;
|
|
462
|
+
--chefui-accordion-radius: 12px;
|
|
463
|
+
--chefui-accordion-spacing: 8px;
|
|
464
|
+
--chefui-accordion-transition: 250ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
465
|
+
--chefui-accordion-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
|
466
|
+
--chefui-accordion-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
.accordion-container {
|
|
470
|
+
display: flex;
|
|
471
|
+
flex-direction: column;
|
|
472
|
+
gap: var(--chefui-accordion-spacing);
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
:host([variant="bordered"]) .accordion-container {
|
|
476
|
+
border: 1px solid var(--chefui-accordion-border);
|
|
477
|
+
border-radius: var(--chefui-accordion-radius);
|
|
478
|
+
overflow: hidden;
|
|
479
|
+
gap: 0;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
:host([variant="separated"]) .accordion-container {
|
|
483
|
+
gap: calc(var(--chefui-accordion-spacing) * 1.5);
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
::slotted(chef-ui-accordion-item) {
|
|
487
|
+
display: block;
|
|
488
|
+
}
|
|
489
|
+
`,e([ue({type:String,reflect:!0})],xe.prototype,"variant",void 0),e([ue({type:Boolean,reflect:!0})],xe.prototype,"multiple",void 0),e([ue({type:Boolean,reflect:!0})],xe.prototype,"collapsible",void 0),xe=e([he("chef-ui-accordion")],xe);let _e=class extends ce{constructor(){super(...arguments),this.expanded=!1,this.disabled=!1,this.title=""}toggle(){this.disabled||(this.expanded=!this.expanded,this.dispatchEvent(new CustomEvent("accordion-item-toggle",{detail:{expanded:this.expanded},bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("chef-toggle",{detail:{expanded:this.expanded},bubbles:!0,composed:!0})))}handleKeyDown(e){"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),this.toggle())}render(){return V`
|
|
490
|
+
<button
|
|
491
|
+
class="header"
|
|
492
|
+
role="button"
|
|
493
|
+
aria-expanded=${this.expanded}
|
|
494
|
+
aria-disabled=${this.disabled}
|
|
495
|
+
@click=${this.toggle}
|
|
496
|
+
@keydown=${this.handleKeyDown}
|
|
497
|
+
part="header"
|
|
498
|
+
>
|
|
499
|
+
<div class="header-content">
|
|
500
|
+
${this.icon?V`
|
|
501
|
+
<chef-icon class="icon-prefix" name=${this.icon}></chef-icon>
|
|
502
|
+
`:V`
|
|
503
|
+
<slot name="icon"></slot>
|
|
504
|
+
`}
|
|
505
|
+
<div>
|
|
506
|
+
<div class="title">
|
|
507
|
+
<slot name="title">${this.title}</slot>
|
|
508
|
+
</div>
|
|
509
|
+
${this.subtitle?V`
|
|
510
|
+
<div class="subtitle">
|
|
511
|
+
<slot name="subtitle">${this.subtitle}</slot>
|
|
512
|
+
</div>
|
|
513
|
+
`:null}
|
|
514
|
+
</div>
|
|
515
|
+
</div>
|
|
516
|
+
<div class="header-end">
|
|
517
|
+
${this.badge?V`
|
|
518
|
+
<span class="badge">${this.badge}</span>
|
|
519
|
+
`:null}
|
|
520
|
+
<slot name="badge"></slot>
|
|
521
|
+
<chef-icon class="chevron" name="chevron-down"></chef-icon>
|
|
522
|
+
</div>
|
|
523
|
+
</button>
|
|
524
|
+
<div class="content-wrapper" part="content-wrapper">
|
|
525
|
+
<div class="content">
|
|
526
|
+
<div class="content-inner" part="content">
|
|
527
|
+
<slot></slot>
|
|
528
|
+
</div>
|
|
529
|
+
</div>
|
|
530
|
+
</div>
|
|
531
|
+
`}};_e.styles=n`
|
|
532
|
+
:host {
|
|
533
|
+
display: block;
|
|
534
|
+
background: var(--chefui-accordion-bg, #1e293b);
|
|
535
|
+
border-radius: var(--chefui-accordion-radius, 12px);
|
|
536
|
+
overflow: hidden;
|
|
537
|
+
transition: box-shadow var(--chefui-accordion-transition, 250ms);
|
|
538
|
+
box-shadow: var(--chefui-accordion-shadow, 0 1px 3px rgba(0, 0, 0, 0.1));
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
:host(:hover) {
|
|
542
|
+
box-shadow: var(--chefui-accordion-shadow-hover, 0 4px 12px rgba(0, 0, 0, 0.15));
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
:host([variant="bordered"]) {
|
|
546
|
+
border-radius: 0;
|
|
547
|
+
box-shadow: none;
|
|
548
|
+
border-bottom: 1px solid var(--chefui-accordion-border, #334155);
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
:host([variant="bordered"]:last-child) {
|
|
552
|
+
border-bottom: none;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
:host([variant="flat"]) {
|
|
556
|
+
background: transparent;
|
|
557
|
+
box-shadow: none;
|
|
558
|
+
border-radius: 0;
|
|
559
|
+
border-bottom: 1px solid var(--chefui-accordion-border, #334155);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
:host([disabled]) {
|
|
563
|
+
opacity: 0.5;
|
|
564
|
+
cursor: not-allowed;
|
|
565
|
+
pointer-events: none;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.header {
|
|
569
|
+
display: flex;
|
|
570
|
+
align-items: center;
|
|
571
|
+
justify-content: space-between;
|
|
572
|
+
padding: 16px 20px;
|
|
573
|
+
background: var(--chefui-accordion-header-bg, #1e293b);
|
|
574
|
+
cursor: pointer;
|
|
575
|
+
user-select: none;
|
|
576
|
+
transition: background-color var(--chefui-accordion-transition, 250ms);
|
|
577
|
+
border: none;
|
|
578
|
+
width: 100%;
|
|
579
|
+
text-align: left;
|
|
580
|
+
color: inherit;
|
|
581
|
+
font: inherit;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
.header:hover {
|
|
585
|
+
background: var(--chefui-accordion-header-hover, rgba(124, 58, 237, 0.08));
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.header:active {
|
|
589
|
+
background: var(--chefui-accordion-header-active, rgba(124, 58, 237, 0.15));
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
.header:focus-visible {
|
|
593
|
+
outline: 2px solid var(--chefui-accordion-accent, #7c3aed);
|
|
594
|
+
outline-offset: -2px;
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
.header-content {
|
|
598
|
+
display: flex;
|
|
599
|
+
align-items: center;
|
|
600
|
+
gap: 12px;
|
|
601
|
+
flex: 1;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.icon-prefix {
|
|
605
|
+
width: 20px;
|
|
606
|
+
height: 20px;
|
|
607
|
+
display: flex;
|
|
608
|
+
align-items: center;
|
|
609
|
+
justify-content: center;
|
|
610
|
+
color: var(--chefui-accordion-accent, #7c3aed);
|
|
611
|
+
flex-shrink: 0;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
.title {
|
|
615
|
+
font-size: 16px;
|
|
616
|
+
font-weight: 600;
|
|
617
|
+
color: var(--chefui-accordion-text, #e2e8f0);
|
|
618
|
+
line-height: 1.5;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
.subtitle {
|
|
622
|
+
font-size: 13px;
|
|
623
|
+
color: var(--chefui-accordion-text-muted, #94a3b8);
|
|
624
|
+
margin-top: 2px;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
.header-end {
|
|
628
|
+
display: flex;
|
|
629
|
+
align-items: center;
|
|
630
|
+
gap: 12px;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.badge {
|
|
634
|
+
padding: 4px 10px;
|
|
635
|
+
border-radius: 12px;
|
|
636
|
+
font-size: 12px;
|
|
637
|
+
font-weight: 500;
|
|
638
|
+
background: rgba(124, 58, 237, 0.15);
|
|
639
|
+
color: var(--chefui-accordion-accent, #7c3aed);
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.chevron {
|
|
643
|
+
width: 20px;
|
|
644
|
+
height: 20px;
|
|
645
|
+
display: flex;
|
|
646
|
+
align-items: center;
|
|
647
|
+
justify-content: center;
|
|
648
|
+
transition: transform var(--chefui-accordion-transition, 250ms);
|
|
649
|
+
color: var(--chefui-accordion-text-muted, #94a3b8);
|
|
650
|
+
flex-shrink: 0;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
:host([expanded]) .chevron {
|
|
654
|
+
transform: rotate(180deg);
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
.content-wrapper {
|
|
658
|
+
display: grid;
|
|
659
|
+
grid-template-rows: 0fr;
|
|
660
|
+
transition: grid-template-rows var(--chefui-accordion-transition, 250ms);
|
|
661
|
+
overflow: hidden;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
:host([expanded]) .content-wrapper {
|
|
665
|
+
grid-template-rows: 1fr;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
.content {
|
|
669
|
+
min-height: 0;
|
|
670
|
+
overflow: hidden;
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
.content-inner {
|
|
674
|
+
padding: 20px;
|
|
675
|
+
background: var(--chefui-accordion-content-bg, #0f172a);
|
|
676
|
+
color: var(--chefui-accordion-text, #e2e8f0);
|
|
677
|
+
line-height: 1.6;
|
|
678
|
+
}
|
|
679
|
+
|
|
680
|
+
:host([variant="flat"]) .content-inner {
|
|
681
|
+
background: transparent;
|
|
682
|
+
padding-left: 52px;
|
|
683
|
+
padding-right: 20px;
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
::slotted([slot="icon"]) {
|
|
687
|
+
width: 20px;
|
|
688
|
+
height: 20px;
|
|
689
|
+
}
|
|
690
|
+
`,e([ue({type:Boolean,reflect:!0})],_e.prototype,"expanded",void 0),e([ue({type:Boolean,reflect:!0})],_e.prototype,"disabled",void 0),e([ue({type:String})],_e.prototype,"title",void 0),e([ue({type:String})],_e.prototype,"subtitle",void 0),e([ue({type:String})],_e.prototype,"badge",void 0),e([ue({type:String})],_e.prototype,"icon",void 0),e([ue({type:String,reflect:!0})],_e.prototype,"variant",void 0),_e=e([he("chef-ui-accordion-item")],_e);export{me as ChefButton,ye as ChefIcon,xe as ChefUiAccordion,_e as ChefUiAccordionItem,$e as ChefUiSelect,ge as IconResolver,be as iconResolver};
|
|
150
691
|
//# sourceMappingURL=index.js.map
|