@chefuicore/core 0.3.0 → 0.5.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-ui-calendar.d.ts +61 -0
- package/dist/components/chef-ui-calendar.d.ts.map +1 -0
- package/dist/components/chef-ui-checkbox.d.ts +34 -0
- package/dist/components/chef-ui-checkbox.d.ts.map +1 -0
- package/dist/components/chef-ui-reaction.d.ts +23 -0
- package/dist/components/chef-ui-reaction.d.ts.map +1 -0
- package/dist/icons/bookmark-outline.d.ts +5 -0
- package/dist/icons/bookmark-outline.d.ts.map +1 -0
- package/dist/icons/bookmark.d.ts +6 -0
- package/dist/icons/bookmark.d.ts.map +1 -0
- package/dist/icons/heart-outline.d.ts +5 -0
- package/dist/icons/heart-outline.d.ts.map +1 -0
- package/dist/icons/heart.d.ts +6 -0
- package/dist/icons/heart.d.ts.map +1 -0
- package/dist/icons/minus.d.ts +6 -0
- package/dist/icons/minus.d.ts.map +1 -0
- package/dist/icons/star-outline.d.ts +5 -0
- package/dist/icons/star-outline.d.ts.map +1 -0
- package/dist/icons/star.d.ts +6 -0
- package/dist/icons/star.d.ts.map +1 -0
- package/dist/icons/thumbs-up-outline.d.ts +5 -0
- package/dist/icons/thumbs-up-outline.d.ts.map +1 -0
- package/dist/icons/thumbs-up.d.ts +6 -0
- package/dist/icons/thumbs-up.d.ts.map +1 -0
- package/dist/index.cjs +833 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +832 -17
- package/dist/index.js.map +1 -1
- package/dist/utils/icon-resolver.d.ts +1 -1
- package/dist/utils/icon-resolver.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";function e(e,t,i
|
|
1
|
+
"use strict";function e(e,t,o,i){var r,a=arguments.length,s=a<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,o):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,o,i);else for(var n=e.length-1;n>=0;n--)(r=e[n])&&(s=(a<3?r(s):a>3?r(t,o,s):r(t,o))||s);return a>3&&s&&Object.defineProperty(t,o,s),s}"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 t=globalThis,
|
|
7
|
+
const t=globalThis,o=t.ShadowRoot&&(void 0===t.ShadyCSS||t.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,i=Symbol(),r=new WeakMap;let a=class{constructor(e,t,o){if(this._$cssResult$=!0,o!==i)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(o&&void 0===e){const o=void 0!==t&&1===t.length;o&&(e=r.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),o&&r.set(t,e))}return e}toString(){return this.cssText}};const s=(e,...t)=>{const o=1===e.length?e[0]:t.reduce((t,o,i)=>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.")})(o)+e[i+1],e[0]);return new a(o,e,i)},n=o?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(const o of e.cssRules)t+=o.cssText;return(e=>new a("string"==typeof e?e:e+"",void 0,i))(t)})(e):e,{is:c,defineProperty:h,getOwnPropertyDescriptor:l,getOwnPropertyNames:d,getOwnPropertySymbols:p,getPrototypeOf:u}=Object,f=globalThis,b=f.trustedTypes,v=b?b.emptyScript:"",g=f.reactiveElementPolyfillSupport,x=(e,t)=>e,y={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let o=e;switch(t){case Boolean:o=null!==e;break;case Number:o=null===e?null:Number(e);break;case Object:case Array:try{o=JSON.parse(e)}catch(e){o=null}}return o}},m=(e,t)=>!c(e,t),k={attribute:!0,type:String,converter:y,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(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=k){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 o=Symbol(),i=this.getPropertyDescriptor(e,o,t);void 0!==i&&h(this.prototype,e,i)}}static getPropertyDescriptor(e,t,o){const{get:i,set:r}=l(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){const a=i?.call(this);r?.call(this,t),this.requestUpdate(e,a,o)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??k}static _$Ei(){if(this.hasOwnProperty(x("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(x("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(x("properties"))){const e=this.properties,t=[...d(e),...p(e)];for(const o of t)this.createProperty(o,e[o])}const e=this[Symbol.metadata];if(null!==e){const t=litPropertyMetadata.get(e);if(void 0!==t)for(const[e,o]of t)this.elementProperties.set(e,o)}this._$Eh=new Map;for(const[e,t]of this.elementProperties){const o=this._$Eu(e,t);void 0!==o&&this._$Eh.set(o,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){const t=[];if(Array.isArray(e)){const o=new Set(e.flat(1/0).reverse());for(const e of o)t.unshift(n(e))}else void 0!==e&&t.push(n(e));return t}static _$Eu(e,t){const o=t.attribute;return!1===o?void 0:"string"==typeof o?o:"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 o of t.keys())this.hasOwnProperty(o)&&(e.set(o,this[o]),delete this[o]);e.size>0&&(this._$Ep=e)}createRenderRoot(){const e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((e,i)=>{if(o)e.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(const o of i){const i=document.createElement("style"),r=t.litNonce;void 0!==r&&i.setAttribute("nonce",r),i.textContent=o.cssText,e.appendChild(i)}})(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,o){this._$AK(e,o)}_$ET(e,t){const o=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,o);if(void 0!==i&&!0===o.reflect){const r=(void 0!==o.converter?.toAttribute?o.converter:y).toAttribute(t,o.type);this._$Em=e,null==r?this.removeAttribute(i):this.setAttribute(i,r),this._$Em=null}}_$AK(e,t){const o=this.constructor,i=o._$Eh.get(e);if(void 0!==i&&this._$Em!==i){const e=o.getPropertyOptions(i),r="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:y;this._$Em=i;const a=r.fromAttribute(t,e.type);this[i]=a??this._$Ej?.get(i)??a,this._$Em=null}}requestUpdate(e,t,o){if(void 0!==e){const i=this.constructor,r=this[e];if(o??=i.getPropertyOptions(e),!((o.hasChanged??m)(r,t)||o.useDefault&&o.reflect&&r===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,o))))return;this.C(e,t,o)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:o,reflect:i,wrapped:r},a){o&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,a??t??this[e]),!0!==r||void 0!==a)||(this._$AL.has(e)||(this.hasUpdated||o||(t=void 0),this._$AL.set(e,t)),!0===i&&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,o]of e){const{wrapped:e}=o,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,o,i)}}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"},$[x("elementProperties")]=new Map,$[x("finalized")]=new Map,g?.({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 C=globalThis,w=C.trustedTypes,A=w?w.createPolicy("lit-html",{createHTML:e=>e}):void 0,S="$lit$",_=`lit$${Math.random().toFixed(9).slice(2)}$`,M="?"+_,U=`<${M}>`,E=document,z=()=>E.createComment(""),D=e=>null===e||"object"!=typeof e&&"function"!=typeof e,O=Array.isArray,P="[ \t\n\f\r]",I=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,T=/-->/g,H=/>/g,R=RegExp(`>|${P}(?:([^\\s"'>=/]+)(${P}*=${P}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),L=/'/g,B=/"/g,N=/^(?:script|style|textarea|title)$/i,j=e=>(t,...o)=>({_$litType$:e,strings:t,values:o}),V=j(1),Y=j(2),F=Symbol.for("lit-noChange"),q=Symbol.for("lit-nothing"),W=new WeakMap,Z=E.createTreeWalker(E,129);function J(e,t){if(!O(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==A?A.createHTML(t):t}const Q=(e,t)=>{const o=e.length-1,i=[];let r,a=2===t?"<svg>":3===t?"<math>":"",s=I;for(let t=0;t<o;t++){const o=e[t];let n,c,h=-1,l=0;for(;l<o.length&&(s.lastIndex=l,c=s.exec(o),null!==c);)l=s.lastIndex,s===I?"!--"===c[1]?s=T:void 0!==c[1]?s=H:void 0!==c[2]?(N.test(c[2])&&(r=RegExp("</"+c[2],"g")),s=R):void 0!==c[3]&&(s=R):s===R?">"===c[0]?(s=r??I,h=-1):void 0===c[1]?h=-2:(h=s.lastIndex-c[2].length,n=c[1],s=void 0===c[3]?R:'"'===c[3]?B:L):s===B||s===L?s=R:s===T||s===H?s=I:(s=R,r=void 0);const d=s===R&&e[t+1].startsWith("/>")?" ":"";a+=s===I?o+U:h>=0?(i.push(n),o.slice(0,h)+S+o.slice(h)+_+d):o+_+(-2===h?t:d)}return[J(e,a+(e[o]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class K{constructor({strings:e,_$litType$:t},o){let i;this.parts=[];let r=0,a=0;const s=e.length-1,n=this.parts,[c,h]=Q(e,t);if(this.el=K.createElement(c,o),Z.currentNode=this.el.content,2===t||3===t){const e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=Z.nextNode())&&n.length<s;){if(1===i.nodeType){if(i.hasAttributes())for(const e of i.getAttributeNames())if(e.endsWith(S)){const t=h[a++],o=i.getAttribute(e).split(_),s=/([.?@])?(.*)/.exec(t);n.push({type:1,index:r,name:s[2],strings:o,ctor:"."===s[1]?oe:"?"===s[1]?ie:"@"===s[1]?re:te}),i.removeAttribute(e)}else e.startsWith(_)&&(n.push({type:6,index:r}),i.removeAttribute(e));if(N.test(i.tagName)){const e=i.textContent.split(_),t=e.length-1;if(t>0){i.textContent=w?w.emptyScript:"";for(let o=0;o<t;o++)i.append(e[o],z()),Z.nextNode(),n.push({type:2,index:++r});i.append(e[t],z())}}}else if(8===i.nodeType)if(i.data===M)n.push({type:2,index:r});else{let e=-1;for(;-1!==(e=i.data.indexOf(_,e+1));)n.push({type:7,index:r}),e+=_.length-1}r++}}static createElement(e,t){const o=E.createElement("template");return o.innerHTML=e,o}}function G(e,t,o=e,i){if(t===F)return t;let r=void 0!==i?o._$Co?.[i]:o._$Cl;const a=D(t)?void 0:t._$litDirective$;return r?.constructor!==a&&(r?._$AO?.(!1),void 0===a?r=void 0:(r=new a(e),r._$AT(e,o,i)),void 0!==i?(o._$Co??=[])[i]=r:o._$Cl=r),void 0!==r&&(t=G(e,r._$AS(e,t.values),r,i)),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:o}=this._$AD,i=(e?.creationScope??E).importNode(t,!0);Z.currentNode=i;let r=Z.nextNode(),a=0,s=0,n=o[0];for(;void 0!==n;){if(a===n.index){let t;2===n.type?t=new ee(r,r.nextSibling,this,e):1===n.type?t=new n.ctor(r,n.name,n.strings,this,e):6===n.type&&(t=new ae(r,this,e)),this._$AV.push(t),n=o[++s]}a!==n?.index&&(r=Z.nextNode(),a++)}return Z.currentNode=E,i}p(e){let t=0;for(const o of this._$AV)void 0!==o&&(void 0!==o.strings?(o._$AI(e,o,t),t+=o.strings.length-2):o._$AI(e[t])),t++}}class ee{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(e,t,o,i){this.type=2,this._$AH=q,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=o,this.options=i,this._$Cv=i?.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),D(e)?e===q||null==e||""===e?(this._$AH!==q&&this._$AR(),this._$AH=q):e!==this._$AH&&e!==F&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):(e=>O(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!==q&&D(this._$AH)?this._$AA.nextSibling.data=e:this.T(E.createTextNode(e)),this._$AH=e}$(e){const{values:t,_$litType$:o}=e,i="number"==typeof o?this._$AC(e):(void 0===o.el&&(o.el=K.createElement(J(o.h,o.h[0]),this.options)),o);if(this._$AH?._$AD===i)this._$AH.p(t);else{const e=new X(i,this),o=e.u(this.options);e.p(t),this.T(o),this._$AH=e}}_$AC(e){let t=W.get(e.strings);return void 0===t&&W.set(e.strings,t=new K(e)),t}k(e){O(this._$AH)||(this._$AH=[],this._$AR());const t=this._$AH;let o,i=0;for(const r of e)i===t.length?t.push(o=new ee(this.O(z()),this.O(z()),this,this.options)):o=t[i],o._$AI(r),i++;i<t.length&&(this._$AR(o&&o._$AB.nextSibling,i),t.length=i)}_$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,o,i,r){this.type=1,this._$AH=q,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=r,o.length>2||""!==o[0]||""!==o[1]?(this._$AH=Array(o.length-1).fill(new String),this.strings=o):this._$AH=q}_$AI(e,t=this,o,i){const r=this.strings;let a=!1;if(void 0===r)e=G(this,e,t,0),a=!D(e)||e!==this._$AH&&e!==F,a&&(this._$AH=e);else{const i=e;let s,n;for(e=r[0],s=0;s<r.length-1;s++)n=G(this,i[o+s],t,s),n===F&&(n=this._$AH[s]),a||=!D(n)||n!==this._$AH[s],n===q?e=q:e!==q&&(e+=(n??"")+r[s+1]),this._$AH[s]=n}a&&!i&&this.j(e)}j(e){e===q?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class oe extends te{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===q?void 0:e}}class ie extends te{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==q)}}class re extends te{constructor(e,t,o,i,r){super(e,t,o,i,r),this.type=5}_$AI(e,t=this){if((e=G(this,e,t,0)??q)===F)return;const o=this._$AH,i=e===q&&o!==q||e.capture!==o.capture||e.once!==o.once||e.passive!==o.passive,r=e!==q&&(o===q||i);i&&this.element.removeEventListener(this.name,this,o),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 ae{constructor(e,t,o){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=o}get _$AU(){return this._$AM._$AU}_$AI(e){G(this,e)}}const se=C.litHtmlPolyfillSupport;se?.(K,ee),(C.litHtmlVersions??=[]).push("3.3.1");const ne=globalThis;
|
|
19
19
|
/**
|
|
20
20
|
* @license
|
|
21
21
|
* Copyright 2017 Google LLC
|
|
22
22
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
23
|
-
*/class ce extends
|
|
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,o)=>{const i=o?.renderBefore??t;let r=i._$litPart$;if(void 0===r){const e=o?.renderBefore??null;i._$litPart$=r=new ee(t.insertBefore(z(),e),e,void 0,o??{})}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 F}}ce._$litElement$=!0,ce.finalized=!0,ne.litElementHydrateSupport?.({LitElement:ce});const he=ne.litElementPolyfillSupport;he?.({LitElement:ce}),(ne.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 le=e=>(t,o)=>{void 0!==o?o.addInitializer(()=>{customElements.define(e,t)}):customElements.define(e,t)},de={attribute:!0,type:String,converter:y,reflect:!1,hasChanged:m},pe=(e=de,t,o)=>{const{kind:i,metadata:r}=o;let a=globalThis.litPropertyMetadata.get(r);if(void 0===a&&globalThis.litPropertyMetadata.set(r,a=new Map),"setter"===i&&((e=Object.create(e)).wrapped=!0),a.set(o.name,e),"accessor"===i){const{name:i}=o;return{set(o){const r=t.get.call(this);t.set.call(this,o),this.requestUpdate(i,r,e)},init(t){return void 0!==t&&this.C(i,void 0,e,t),t}}}if("setter"===i){const{name:i}=o;return function(o){const r=this[i];t.call(this,o),this.requestUpdate(i,r,e)}}throw Error("Unsupported decorator location: "+i)};
|
|
30
30
|
/**
|
|
31
31
|
* @license
|
|
32
32
|
* Copyright 2017 Google LLC
|
|
33
33
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
34
|
-
*/function ue(e){return(t,
|
|
34
|
+
*/function ue(e){return(t,o)=>"object"==typeof o?pe(e,t,o):((e,t,o)=>{const i=t.hasOwnProperty(o);return t.constructor.createProperty(o,e),i?Object.getOwnPropertyDescriptor(t,o):void 0})(e,t,o)}
|
|
35
35
|
/**
|
|
36
36
|
* @license
|
|
37
37
|
* Copyright 2017 Google LLC
|
|
@@ -47,7 +47,7 @@ const he=e=>(t,i)=>{void 0!==i?i.addInitializer(()=>{customElements.define(e,t)}
|
|
|
47
47
|
* Copyright 2017 Google LLC
|
|
48
48
|
* SPDX-License-Identifier: BSD-3-Clause
|
|
49
49
|
*/
|
|
50
|
-
function
|
|
50
|
+
function be(e,t){return(t,o,i)=>((e,t,o)=>(o.configurable=!0,o.enumerable=!0,Reflect.decorate&&"object"!=typeof t&&Object.defineProperty(e,t,o),o))(t,o,{get(){return(t=>t.renderRoot?.querySelector(e)??null)(this)}})}class ve{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 ge=new ve;ge.register("plus",{outline:"M12 4v16M4 12h16",solid:"M11 4h2v7h7v2h-7v7h-2v-7H4v-2h7z"}),ge.register("check",{outline:"m5 13 4 4L19 7",solid:"M10 15.172 5.414 10.586 4 12l6 6L20 8l-1.414-1.414z"}),ge.register("x",{outline:"M6 6l12 12M6 18L18 6",solid:"M6 6l12 12M6 18L18 6"}),ge.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"}),ge.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"}),ge.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"}),ge.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"}),ge.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"}),ge.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"}),ge.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"}),ge.register("arrow-right",{outline:"M5 12h14M13 5l7 7-7 7",solid:"M10 5l7 7-7 7V5z"}),ge.register("arrow-left",{outline:"M19 12H5m6 7-7-7 7-7",solid:"M14 19l-7-7 7-7v14z"}),ge.register("heart",{outline:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z",solid:"M11.645 20.91l-.007-.003-.022-.012a15.247 15.247 0 01-.383-.218 25.18 25.18 0 01-4.244-3.17C4.688 15.36 2.25 12.174 2.25 8.25 2.25 5.322 4.714 3 7.688 3A5.5 5.5 0 0112 5.052 5.5 5.5 0 0116.313 3c2.973 0 5.437 2.322 5.437 5.25 0 3.925-2.438 7.111-4.739 9.256a25.175 25.175 0 01-4.244 3.17 15.247 15.247 0 01-.383.219l-.022.012-.007.004-.003.001a.752.752 0 01-.704 0l-.003-.001z"}),ge.register("heart-outline",{outline:"M21 8.25c0-2.485-2.099-4.5-4.688-4.5-1.935 0-3.597 1.126-4.312 2.733-.715-1.607-2.377-2.733-4.313-2.733C5.1 3.75 3 5.765 3 8.25c0 7.22 9 12 9 12s9-4.78 9-12z"}),ge.register("star",{outline:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z",solid:"M10.788 3.21c.448-1.077 1.976-1.077 2.424 0l2.082 5.007 5.404.433c1.164.093 1.636 1.545.749 2.305l-4.117 3.527 1.257 5.273c.271 1.136-.964 2.033-1.96 1.425L12 18.354 7.373 21.18c-.996.608-2.231-.29-1.96-1.425l1.257-5.273-4.117-3.527c-.887-.76-.415-2.212.749-2.305l5.404-.433 2.082-5.006z"}),ge.register("star-outline",{outline:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"}),ge.register("bookmark",{outline:"M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0z",solid:"M6.32 2.577a49.255 49.255 0 0111.36 0c1.497.174 2.57 1.46 2.57 2.93V21a.75.75 0 01-1.085.67L12 18.089l-7.165 3.583A.75.75 0 013.75 21V5.507c0-1.47 1.073-2.756 2.57-2.93z"}),ge.register("bookmark-outline",{outline:"M17.593 3.322c1.1.128 1.907 1.077 1.907 2.185V21L12 17.25 4.5 21V5.507c0-1.108.806-2.057 1.907-2.185a48.507 48.507 0 0111.186 0z"}),ge.register("thumbs-up",{outline:"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-.937a6.5 6.5 0 00-1.893-.26H4.5A2.25 2.25 0 012.25 16.5v-5.25A2.25 2.25 0 014.5 9h2.133z",solid:"M7.493 18.75c-.425 0-.82-.236-.975-.632A7.48 7.48 0 016 15.375c0-1.75.599-3.358 1.602-4.634.151-.192.373-.309.6-.397.473-.183.89-.514 1.212-.924a9.042 9.042 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75 2.25 2.25 0 012.25 2.25c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H14.23c-.483 0-.964-.078-1.423-.23l-3.114-.937a6.5 6.5 0 00-1.893-.26H5.5z M2.331 10.727a11.969 11.969 0 00-.831 4.398 12 12 0 00.52 3.507c.26.85 1.084 1.368 1.973 1.368H4.9c.445 0 .72-.498.523-.898a8.963 8.963 0 01-.924-3.977c0-1.708.476-3.305 1.302-4.666.245-.403-.028-.959-.5-.959H4.25c-.832 0-1.612.453-1.918 1.227z"}),ge.register("thumbs-up-outline",{outline:"M6.633 10.5c.806 0 1.533-.446 2.031-1.08a9.041 9.041 0 012.861-2.4c.723-.384 1.35-.956 1.653-1.715a4.498 4.498 0 00.322-1.672V3a.75.75 0 01.75-.75A2.25 2.25 0 0116.5 4.5c0 1.152-.26 2.243-.723 3.218-.266.558.107 1.282.725 1.282h3.126c1.026 0 1.945.694 2.054 1.715.045.422.068.85.068 1.285a11.95 11.95 0 01-2.649 7.521c-.388.482-.987.729-1.605.729H13.48c-.483 0-.964-.078-1.423-.23l-3.114-.937a6.5 6.5 0 00-1.893-.26H4.5A2.25 2.25 0 012.25 16.5v-5.25A2.25 2.25 0 014.5 9h2.133z"}),ge.register("minus",{outline:"M19.5 12h-15",solid:"M4.25 12a.75.75 0 01.75-.75h14a.75.75 0 010 1.5H5a.75.75 0 01-.75-.75z"}),exports.ChefIcon=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=ge.resolve(this.name);if(!e)return null;const t="solid"===this.styleVariant&&!!e.solid?e.solid:e.outline;return Y`<path d="${t}" />`}render(){const e=ge.resolve(this.name),t="solid"===this.styleVariant&&!!e?.solid;return V`
|
|
51
51
|
<svg
|
|
52
52
|
part="icon"
|
|
53
53
|
xmlns="http://www.w3.org/2000/svg"
|
|
@@ -60,7 +60,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
60
60
|
>
|
|
61
61
|
${this.renderPath()}
|
|
62
62
|
</svg>
|
|
63
|
-
`}},exports.ChefIcon.styles=
|
|
63
|
+
`}},exports.ChefIcon.styles=s`
|
|
64
64
|
:host {
|
|
65
65
|
display: inline-flex;
|
|
66
66
|
--chefui-icon-size: 1.1em;
|
|
@@ -68,7 +68,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
68
68
|
line-height: 0;
|
|
69
69
|
}
|
|
70
70
|
svg { width: var(--chefui-icon-size); height: var(--chefui-icon-size); stroke-linecap: round; stroke-linejoin: round; }
|
|
71
|
-
`,e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"name",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"styleVariant",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"size",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"color",void 0),e([ue({type:String,attribute:"aria-label"})],exports.ChefIcon.prototype,"ariaLabel",void 0),exports.ChefIcon=e([
|
|
71
|
+
`,e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"name",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"styleVariant",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"size",void 0),e([ue({type:String,reflect:!0})],exports.ChefIcon.prototype,"color",void 0),e([ue({type:String,attribute:"aria-label"})],exports.ChefIcon.prototype,"ariaLabel",void 0),exports.ChefIcon=e([le("chef-icon")],exports.ChefIcon),exports.ChefButton=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`
|
|
72
72
|
<button
|
|
73
73
|
type="button"
|
|
74
74
|
?disabled=${this.disabled}
|
|
@@ -82,7 +82,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
82
82
|
</slot>
|
|
83
83
|
<slot></slot>
|
|
84
84
|
</button>
|
|
85
|
-
`}},exports.ChefButton.styles=
|
|
85
|
+
`}},exports.ChefButton.styles=s`
|
|
86
86
|
:host {
|
|
87
87
|
display: inline-block;
|
|
88
88
|
--chefui-color: #1976d2;
|
|
@@ -162,7 +162,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
162
162
|
height: 1.1em;
|
|
163
163
|
display: inline-flex;
|
|
164
164
|
}
|
|
165
|
-
`,e([ue({type:Boolean,reflect:!0})],exports.ChefButton.prototype,"disabled",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"variant",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"type",void 0),e([ue({type:String})],exports.ChefButton.prototype,"name",void 0),e([ue({type:String})],exports.ChefButton.prototype,"value",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"form",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"icon",void 0),exports.ChefButton=e([
|
|
165
|
+
`,e([ue({type:Boolean,reflect:!0})],exports.ChefButton.prototype,"disabled",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"variant",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"type",void 0),e([ue({type:String})],exports.ChefButton.prototype,"name",void 0),e([ue({type:String})],exports.ChefButton.prototype,"value",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"form",void 0),e([ue({type:String,reflect:!0})],exports.ChefButton.prototype,"icon",void 0),exports.ChefButton=e([le("chef-button")],exports.ChefButton),exports.ChefUiSelect=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 o=this.value;this.value=e,this.closeDropdown(),this.dispatchEvent(new CustomEvent("chef-change",{detail:{value:this.value,oldValue:o},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),o=Math.min(t+1,e.length-1);o>=0&&e[o]&&(this.value=e[o].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),o=Math.max(t-1,0);o>=0&&e[o]&&(this.value=e[o].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
166
|
<div class="wrapper">
|
|
167
167
|
${this.label?V`<label class="label">${this.label}</label>`:null}
|
|
168
168
|
|
|
@@ -230,7 +230,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
230
230
|
<slot name="validation-message"></slot>
|
|
231
231
|
</div>
|
|
232
232
|
</div>
|
|
233
|
-
`}},exports.ChefUiSelect.styles=
|
|
233
|
+
`}},exports.ChefUiSelect.styles=s`
|
|
234
234
|
:host {
|
|
235
235
|
display: block;
|
|
236
236
|
--chefui-color: #7c3aed;
|
|
@@ -443,11 +443,11 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
443
443
|
margin-top: 6px;
|
|
444
444
|
font-size: 13px;
|
|
445
445
|
}
|
|
446
|
-
`,e([ue({type:String})],exports.ChefUiSelect.prototype,"label",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"placeholder",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"value",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"invalid",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"name",void 0),e([ue({type:Array})],exports.ChefUiSelect.prototype,"options",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"required",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"searchable",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"prefixIcon",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"searchPlaceholder",void 0),e([fe()],exports.ChefUiSelect.prototype,"isOpen",void 0),e([fe()],exports.ChefUiSelect.prototype,"searchQuery",void 0),e([
|
|
446
|
+
`,e([ue({type:String})],exports.ChefUiSelect.prototype,"label",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"placeholder",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiSelect.prototype,"value",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"invalid",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"name",void 0),e([ue({type:Array})],exports.ChefUiSelect.prototype,"options",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"required",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiSelect.prototype,"searchable",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"prefixIcon",void 0),e([ue({type:String})],exports.ChefUiSelect.prototype,"searchPlaceholder",void 0),e([fe()],exports.ChefUiSelect.prototype,"isOpen",void 0),e([fe()],exports.ChefUiSelect.prototype,"searchQuery",void 0),e([be(".dropdown")],exports.ChefUiSelect.prototype,"dropdownEl",void 0),e([be(".search-input")],exports.ChefUiSelect.prototype,"searchInputEl",void 0),exports.ChefUiSelect=e([le("chef-ui-select")],exports.ChefUiSelect),exports.ChefUiAccordion=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
447
|
<div class="accordion-container" role="region">
|
|
448
448
|
<slot></slot>
|
|
449
449
|
</div>
|
|
450
|
-
`}},exports.ChefUiAccordion.styles=
|
|
450
|
+
`}},exports.ChefUiAccordion.styles=s`
|
|
451
451
|
:host {
|
|
452
452
|
display: block;
|
|
453
453
|
--chefui-accordion-bg: #1e293b;
|
|
@@ -486,7 +486,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
486
486
|
::slotted(chef-ui-accordion-item) {
|
|
487
487
|
display: block;
|
|
488
488
|
}
|
|
489
|
-
`,e([ue({type:String,reflect:!0})],exports.ChefUiAccordion.prototype,"variant",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordion.prototype,"multiple",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordion.prototype,"collapsible",void 0),exports.ChefUiAccordion=e([
|
|
489
|
+
`,e([ue({type:String,reflect:!0})],exports.ChefUiAccordion.prototype,"variant",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordion.prototype,"multiple",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordion.prototype,"collapsible",void 0),exports.ChefUiAccordion=e([le("chef-ui-accordion")],exports.ChefUiAccordion),exports.ChefUiAccordionItem=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
490
|
<button
|
|
491
491
|
class="header"
|
|
492
492
|
role="button"
|
|
@@ -528,7 +528,7 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
528
528
|
</div>
|
|
529
529
|
</div>
|
|
530
530
|
</div>
|
|
531
|
-
`}},exports.ChefUiAccordionItem.styles=
|
|
531
|
+
`}},exports.ChefUiAccordionItem.styles=s`
|
|
532
532
|
:host {
|
|
533
533
|
display: block;
|
|
534
534
|
background: var(--chefui-accordion-bg, #1e293b);
|
|
@@ -687,5 +687,820 @@ function ve(e,t){return(t,i,o)=>((e,t,i)=>(i.configurable=!0,i.enumerable=!0,Ref
|
|
|
687
687
|
width: 20px;
|
|
688
688
|
height: 20px;
|
|
689
689
|
}
|
|
690
|
-
`,e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordionItem.prototype,"expanded",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordionItem.prototype,"disabled",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"title",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"subtitle",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"badge",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"icon",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiAccordionItem.prototype,"variant",void 0),exports.ChefUiAccordionItem=e([
|
|
690
|
+
`,e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordionItem.prototype,"expanded",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiAccordionItem.prototype,"disabled",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"title",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"subtitle",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"badge",void 0),e([ue({type:String})],exports.ChefUiAccordionItem.prototype,"icon",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiAccordionItem.prototype,"variant",void 0),exports.ChefUiAccordionItem=e([le("chef-ui-accordion-item")],exports.ChefUiAccordionItem),exports.ChefUiCalendar=class extends ce{constructor(){super(...arguments),this.value="",this.disabledDates=[],this.highlightedDates=[],this.showToday=!0,this.showClear=!1,this.showFooter=!0,this.showLegend=!1,this.mode="single",this.weekdays=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],this.firstDayOfWeek=0,this.showMonthYearDropdowns=!0,this.currentMonth=new Date,this.today=this.formatDate(new Date)}connectedCallback(){super.connectedCallback(),this.focusDate?this.currentMonth=this.parseDate(this.focusDate):this.value&&(this.currentMonth=this.parseDate(this.value))}formatDate(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}`}parseDate(e){const[t,o,i]=e.split("-").map(Number);return new Date(t,o-1,i)}isSameDay(e,t){return this.formatDate(e)===this.formatDate(t)}isDateDisabled(e){return!!this.disabledDates.includes(e)||(!!(this.min&&e<this.min)||(!!(this.max&&e>this.max)||!!(this.availableDates&&this.availableDates.length>0)&&!this.availableDates.includes(e)))}isDateInRange(e){return!("range"!==this.mode||!this.rangeStart||!this.rangeEnd)&&(e>this.rangeStart&&e<this.rangeEnd)}previousMonth(){this.currentMonth=new Date(this.currentMonth.getFullYear(),this.currentMonth.getMonth()-1),this.requestUpdate()}nextMonth(){this.currentMonth=new Date(this.currentMonth.getFullYear(),this.currentMonth.getMonth()+1),this.requestUpdate()}selectDate(e,t){if(!t)if("range"===this.mode)!this.rangeStart||this.rangeStart&&this.rangeEnd?(this.rangeStart=e,this.rangeEnd=void 0):(e<this.rangeStart?(this.rangeEnd=this.rangeStart,this.rangeStart=e):this.rangeEnd=e,this.dispatchEvent(new CustomEvent("chef-range-change",{detail:{rangeStart:this.rangeStart,rangeEnd:this.rangeEnd},bubbles:!0,composed:!0})));else{const t=this.value;this.value=e,this.dispatchEvent(new CustomEvent("chef-change",{detail:{value:this.value,oldValue:t,date:this.parseDate(e)},bubbles:!0,composed:!0}))}}goToToday(){this.currentMonth=new Date,"single"===this.mode&&(this.value=this.today,this.dispatchEvent(new CustomEvent("chef-change",{detail:{value:this.value,date:new Date},bubbles:!0,composed:!0})))}clearSelection(){this.value="",this.rangeStart=void 0,this.rangeEnd=void 0,this.dispatchEvent(new CustomEvent("chef-clear",{bubbles:!0,composed:!0}))}getDaysInMonth(){const e=this.currentMonth.getFullYear(),t=this.currentMonth.getMonth(),o=(new Date(e,t,1).getDay()-this.firstDayOfWeek+7)%7,i=new Date(e,t+1,0).getDate(),r=[],a=new Date(e,t,0).getDate();for(let i=o-1;i>=0;i--){const o=new Date(e,t-1,a-i);r.push({date:o,dateString:this.formatDate(o),outOfMonth:!0})}for(let o=1;o<=i;o++){const i=new Date(e,t,o);r.push({date:i,dateString:this.formatDate(i),outOfMonth:!1})}const s=42-r.length;for(let o=1;o<=s;o++){const i=new Date(e,t+1,o);r.push({date:i,dateString:this.formatDate(i),outOfMonth:!0})}return r}getMonthYearLabel(){return`${["January","February","March","April","May","June","July","August","September","October","November","December"][this.currentMonth.getMonth()]} ${this.currentMonth.getFullYear()}`}getAvailableYears(){if(this.availableYears&&this.availableYears.length>0)return this.availableYears;const e=(new Date).getFullYear(),t=this.startYear||e-10,o=this.endYear||e+10,i=[];for(let e=t;e<=o;e++)i.push(e);return i}getAvailableMonthsForDisplay(){if(this.availableMonths&&this.availableMonths.length>0)return this.availableMonths;const e=[];for(let t=0;t<12;t++)e.push(t);return e}isMonthAvailable(e,t){if(this.availableMonths&&this.availableMonths.length>0&&!this.availableMonths.includes(e))return!1;if(void 0!==this.startMonth||void 0!==this.endMonth){if(t===this.currentMonth.getFullYear()){if(void 0!==this.startMonth&&e<this.startMonth)return!1;if(void 0!==this.endMonth&&e>this.endMonth)return!1}}return!0}handleMonthChange(e){const t=e.target,o=parseInt(t.value);this.currentMonth=new Date(this.currentMonth.getFullYear(),o,1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("chef-month-change",{detail:{month:o,year:this.currentMonth.getFullYear()},bubbles:!0,composed:!0}))}handleYearChange(e){const t=e.target,o=parseInt(t.value);this.currentMonth=new Date(o,this.currentMonth.getMonth(),1),this.requestUpdate(),this.dispatchEvent(new CustomEvent("chef-year-change",{detail:{year:o,month:this.currentMonth.getMonth()},bubbles:!0,composed:!0}))}getMonthNames(){return["January","February","March","April","May","June","July","August","September","October","November","December"]}getWeekdaysAdjusted(){const e=[...this.weekdays];for(let t=0;t<this.firstDayOfWeek;t++)e.push(e.shift());return e}render(){const e=this.getDaysInMonth(),t=this.getWeekdaysAdjusted(),o=this.getMonthNames(),i=this.getAvailableYears(),r=this.getAvailableMonthsForDisplay(),a=this.currentMonth.getFullYear(),s=this.currentMonth.getMonth();return V`
|
|
691
|
+
<div class="calendar-container" role="application" aria-label="Calendar">
|
|
692
|
+
<div class="header">
|
|
693
|
+
<button
|
|
694
|
+
class="nav-button"
|
|
695
|
+
@click=${this.previousMonth}
|
|
696
|
+
aria-label="Previous month"
|
|
697
|
+
part="nav-button"
|
|
698
|
+
>
|
|
699
|
+
<chef-icon name="chevron-left"></chef-icon>
|
|
700
|
+
</button>
|
|
701
|
+
|
|
702
|
+
<div class="header-title" part="header-title">
|
|
703
|
+
${this.showMonthYearDropdowns?V`
|
|
704
|
+
<select
|
|
705
|
+
class="month-select"
|
|
706
|
+
@change=${this.handleMonthChange}
|
|
707
|
+
.value=${s.toString()}
|
|
708
|
+
aria-label="Select month"
|
|
709
|
+
part="month-select"
|
|
710
|
+
>
|
|
711
|
+
${r.map(e=>V`
|
|
712
|
+
<option
|
|
713
|
+
value=${e}
|
|
714
|
+
?selected=${e===s}
|
|
715
|
+
?disabled=${!this.isMonthAvailable(e,a)}
|
|
716
|
+
>
|
|
717
|
+
${o[e]}
|
|
718
|
+
</option>
|
|
719
|
+
`)}
|
|
720
|
+
</select>
|
|
721
|
+
|
|
722
|
+
<select
|
|
723
|
+
class="year-select"
|
|
724
|
+
@change=${this.handleYearChange}
|
|
725
|
+
.value=${a.toString()}
|
|
726
|
+
aria-label="Select year"
|
|
727
|
+
part="year-select"
|
|
728
|
+
>
|
|
729
|
+
${i.map(e=>V`
|
|
730
|
+
<option value=${e} ?selected=${e===a}>
|
|
731
|
+
${e}
|
|
732
|
+
</option>
|
|
733
|
+
`)}
|
|
734
|
+
</select>
|
|
735
|
+
`:V`
|
|
736
|
+
${this.getMonthYearLabel()}
|
|
737
|
+
`}
|
|
738
|
+
</div>
|
|
739
|
+
|
|
740
|
+
<button
|
|
741
|
+
class="nav-button"
|
|
742
|
+
@click=${this.nextMonth}
|
|
743
|
+
aria-label="Next month"
|
|
744
|
+
part="nav-button"
|
|
745
|
+
>
|
|
746
|
+
<chef-icon name="chevron-right"></chef-icon>
|
|
747
|
+
</button>
|
|
748
|
+
</div>
|
|
749
|
+
|
|
750
|
+
<div class="weekdays">
|
|
751
|
+
${t.map(e=>V`
|
|
752
|
+
<div class="weekday">${e}</div>
|
|
753
|
+
`)}
|
|
754
|
+
</div>
|
|
755
|
+
|
|
756
|
+
<div class="days" role="grid">
|
|
757
|
+
${e.map(({date:e,dateString:t,outOfMonth:o})=>{const i=t===this.today,r=t===this.value,a=this.isDateDisabled(t),s=this.availableDates?.includes(t),n=this.highlightedDates.includes(t),c=t===this.focusDate,h=this.isDateInRange(t),l=t===this.rangeStart,d=t===this.rangeEnd,p=["day",o&&"out-of-month",i&&"today",r&&"selected",a&&"disabled",s&&"available",c&&"focused",h&&"in-range",l&&"range-start",d&&"range-end"].filter(Boolean).join(" ");return V`
|
|
758
|
+
<button
|
|
759
|
+
class=${p}
|
|
760
|
+
@click=${()=>this.selectDate(t,a)}
|
|
761
|
+
aria-label=${`${e.getDate()} ${this.getMonthYearLabel()}`}
|
|
762
|
+
aria-selected=${r}
|
|
763
|
+
aria-disabled=${a}
|
|
764
|
+
role="gridcell"
|
|
765
|
+
part="day"
|
|
766
|
+
>
|
|
767
|
+
${e.getDate()}
|
|
768
|
+
${n?V`<span class="day-indicator"></span>`:null}
|
|
769
|
+
</button>
|
|
770
|
+
`})}
|
|
771
|
+
</div>
|
|
772
|
+
|
|
773
|
+
${this.showFooter?V`
|
|
774
|
+
<div class="footer">
|
|
775
|
+
${this.showToday?V`
|
|
776
|
+
<button class="footer-button" @click=${this.goToToday}>
|
|
777
|
+
Today
|
|
778
|
+
</button>
|
|
779
|
+
`:null}
|
|
780
|
+
${this.showClear?V`
|
|
781
|
+
<button class="footer-button" @click=${this.clearSelection}>
|
|
782
|
+
Clear
|
|
783
|
+
</button>
|
|
784
|
+
`:null}
|
|
785
|
+
</div>
|
|
786
|
+
`:null}
|
|
787
|
+
|
|
788
|
+
${this.showLegend?V`
|
|
789
|
+
<div class="legend">
|
|
790
|
+
<div class="legend-item">
|
|
791
|
+
<div class="legend-box" style="background: var(--chefui-calendar-selected-bg);"></div>
|
|
792
|
+
<span>Selected</span>
|
|
793
|
+
</div>
|
|
794
|
+
<div class="legend-item">
|
|
795
|
+
<div class="legend-box" style="background: var(--chefui-calendar-today-bg); border-color: var(--chefui-calendar-today-border);"></div>
|
|
796
|
+
<span>Today</span>
|
|
797
|
+
</div>
|
|
798
|
+
${this.availableDates?V`
|
|
799
|
+
<div class="legend-item">
|
|
800
|
+
<div class="legend-box" style="background: var(--chefui-calendar-available-bg); border-color: var(--chefui-calendar-available-border);"></div>
|
|
801
|
+
<span>Available</span>
|
|
802
|
+
</div>
|
|
803
|
+
`:null}
|
|
804
|
+
</div>
|
|
805
|
+
`:null}
|
|
806
|
+
</div>
|
|
807
|
+
`}},exports.ChefUiCalendar.styles=s`
|
|
808
|
+
:host {
|
|
809
|
+
display: block;
|
|
810
|
+
--chefui-calendar-bg: #1e293b;
|
|
811
|
+
--chefui-calendar-border: #334155;
|
|
812
|
+
--chefui-calendar-text: #e2e8f0;
|
|
813
|
+
--chefui-calendar-text-muted: #94a3b8;
|
|
814
|
+
--chefui-calendar-accent: #7c3aed;
|
|
815
|
+
--chefui-calendar-accent-hover: #6d28d9;
|
|
816
|
+
--chefui-calendar-today-bg: rgba(59, 130, 246, 0.15);
|
|
817
|
+
--chefui-calendar-today-border: #3b82f6;
|
|
818
|
+
--chefui-calendar-selected-bg: var(--chefui-calendar-accent);
|
|
819
|
+
--chefui-calendar-selected-text: #ffffff;
|
|
820
|
+
--chefui-calendar-disabled-text: #475569;
|
|
821
|
+
--chefui-calendar-disabled-bg: transparent;
|
|
822
|
+
--chefui-calendar-available-bg: rgba(16, 185, 129, 0.15);
|
|
823
|
+
--chefui-calendar-available-border: #10b981;
|
|
824
|
+
--chefui-calendar-radius: 12px;
|
|
825
|
+
--chefui-calendar-cell-size: 40px;
|
|
826
|
+
--chefui-calendar-transition: 150ms ease;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.calendar-container {
|
|
830
|
+
background: var(--chefui-calendar-bg);
|
|
831
|
+
border: 1px solid var(--chefui-calendar-border);
|
|
832
|
+
border-radius: var(--chefui-calendar-radius);
|
|
833
|
+
padding: 16px;
|
|
834
|
+
max-width: 100%;
|
|
835
|
+
box-sizing: border-box;
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
.header {
|
|
839
|
+
display: flex;
|
|
840
|
+
align-items: center;
|
|
841
|
+
justify-content: space-between;
|
|
842
|
+
margin-bottom: 16px;
|
|
843
|
+
gap: 12px;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
.header-title {
|
|
847
|
+
font-size: 16px;
|
|
848
|
+
font-weight: 600;
|
|
849
|
+
color: var(--chefui-calendar-text);
|
|
850
|
+
flex: 1;
|
|
851
|
+
text-align: center;
|
|
852
|
+
display: flex;
|
|
853
|
+
align-items: center;
|
|
854
|
+
justify-content: center;
|
|
855
|
+
gap: 8px;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
.month-select,
|
|
859
|
+
.year-select {
|
|
860
|
+
all: unset;
|
|
861
|
+
padding: 6px 10px;
|
|
862
|
+
border-radius: 6px;
|
|
863
|
+
background: rgba(124, 58, 237, 0.1);
|
|
864
|
+
cursor: pointer;
|
|
865
|
+
transition: background-color var(--chefui-calendar-transition);
|
|
866
|
+
font-size: 15px;
|
|
867
|
+
font-weight: 600;
|
|
868
|
+
color: var(--chefui-calendar-text);
|
|
869
|
+
border: 1px solid transparent;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
.month-select:hover,
|
|
873
|
+
.year-select:hover {
|
|
874
|
+
background: rgba(124, 58, 237, 0.2);
|
|
875
|
+
border-color: rgba(124, 58, 237, 0.3);
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
.month-select:focus,
|
|
879
|
+
.year-select:focus {
|
|
880
|
+
outline: none;
|
|
881
|
+
border-color: var(--chefui-calendar-accent);
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
.month-select option,
|
|
885
|
+
.year-select option {
|
|
886
|
+
background: var(--chefui-calendar-bg);
|
|
887
|
+
color: var(--chefui-calendar-text);
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
.nav-button {
|
|
891
|
+
all: unset;
|
|
892
|
+
width: 32px;
|
|
893
|
+
height: 32px;
|
|
894
|
+
display: flex;
|
|
895
|
+
align-items: center;
|
|
896
|
+
justify-content: center;
|
|
897
|
+
border-radius: 8px;
|
|
898
|
+
cursor: pointer;
|
|
899
|
+
transition: background-color var(--chefui-calendar-transition);
|
|
900
|
+
color: var(--chefui-calendar-text);
|
|
901
|
+
}
|
|
902
|
+
|
|
903
|
+
.nav-button:hover {
|
|
904
|
+
background: rgba(124, 58, 237, 0.15);
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
.nav-button:active {
|
|
908
|
+
background: rgba(124, 58, 237, 0.25);
|
|
909
|
+
}
|
|
910
|
+
|
|
911
|
+
.nav-button:disabled {
|
|
912
|
+
opacity: 0.3;
|
|
913
|
+
cursor: not-allowed;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
.weekdays {
|
|
917
|
+
display: grid;
|
|
918
|
+
grid-template-columns: repeat(7, 1fr);
|
|
919
|
+
gap: 4px;
|
|
920
|
+
margin-bottom: 8px;
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
.weekday {
|
|
924
|
+
text-align: center;
|
|
925
|
+
font-size: 12px;
|
|
926
|
+
font-weight: 600;
|
|
927
|
+
color: var(--chefui-calendar-text-muted);
|
|
928
|
+
padding: 8px 0;
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
.days {
|
|
932
|
+
display: grid;
|
|
933
|
+
grid-template-columns: repeat(7, 1fr);
|
|
934
|
+
gap: 4px;
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
.day {
|
|
938
|
+
all: unset;
|
|
939
|
+
aspect-ratio: 1;
|
|
940
|
+
min-height: var(--chefui-calendar-cell-size);
|
|
941
|
+
display: flex;
|
|
942
|
+
align-items: center;
|
|
943
|
+
justify-content: center;
|
|
944
|
+
font-size: 14px;
|
|
945
|
+
border-radius: 8px;
|
|
946
|
+
cursor: pointer;
|
|
947
|
+
transition: all var(--chefui-calendar-transition);
|
|
948
|
+
color: var(--chefui-calendar-text);
|
|
949
|
+
position: relative;
|
|
950
|
+
box-sizing: border-box;
|
|
951
|
+
border: 2px solid transparent;
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
.day:hover:not(.disabled):not(.out-of-month) {
|
|
955
|
+
background: rgba(124, 58, 237, 0.1);
|
|
956
|
+
}
|
|
957
|
+
|
|
958
|
+
.day.out-of-month {
|
|
959
|
+
color: var(--chefui-calendar-text-muted);
|
|
960
|
+
opacity: 0.3;
|
|
961
|
+
cursor: default;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.day.today {
|
|
965
|
+
background: var(--chefui-calendar-today-bg);
|
|
966
|
+
border-color: var(--chefui-calendar-today-border);
|
|
967
|
+
font-weight: 600;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
.day.selected {
|
|
971
|
+
background: var(--chefui-calendar-selected-bg);
|
|
972
|
+
color: var(--chefui-calendar-selected-text);
|
|
973
|
+
font-weight: 600;
|
|
974
|
+
border-color: var(--chefui-calendar-selected-bg);
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
.day.disabled {
|
|
978
|
+
color: var(--chefui-calendar-disabled-text);
|
|
979
|
+
background: var(--chefui-calendar-disabled-bg);
|
|
980
|
+
cursor: not-allowed;
|
|
981
|
+
opacity: 0.4;
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
.day.available:not(.selected):not(.disabled) {
|
|
985
|
+
background: var(--chefui-calendar-available-bg);
|
|
986
|
+
border-color: var(--chefui-calendar-available-border);
|
|
987
|
+
}
|
|
988
|
+
|
|
989
|
+
.day.in-range:not(.selected):not(.disabled) {
|
|
990
|
+
background: rgba(124, 58, 237, 0.1);
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
.day.range-start,
|
|
994
|
+
.day.range-end {
|
|
995
|
+
background: var(--chefui-calendar-selected-bg);
|
|
996
|
+
color: var(--chefui-calendar-selected-text);
|
|
997
|
+
font-weight: 600;
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
.day-indicator {
|
|
1001
|
+
position: absolute;
|
|
1002
|
+
bottom: 3px;
|
|
1003
|
+
width: 4px;
|
|
1004
|
+
height: 4px;
|
|
1005
|
+
border-radius: 50%;
|
|
1006
|
+
background: var(--chefui-calendar-accent);
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
.footer {
|
|
1010
|
+
margin-top: 12px;
|
|
1011
|
+
padding-top: 12px;
|
|
1012
|
+
border-top: 1px solid var(--chefui-calendar-border);
|
|
1013
|
+
display: flex;
|
|
1014
|
+
gap: 8px;
|
|
1015
|
+
flex-wrap: wrap;
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
.footer-button {
|
|
1019
|
+
all: unset;
|
|
1020
|
+
padding: 6px 12px;
|
|
1021
|
+
border-radius: 6px;
|
|
1022
|
+
font-size: 13px;
|
|
1023
|
+
cursor: pointer;
|
|
1024
|
+
transition: all var(--chefui-calendar-transition);
|
|
1025
|
+
color: var(--chefui-calendar-text);
|
|
1026
|
+
background: rgba(124, 58, 237, 0.1);
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
.footer-button:hover {
|
|
1030
|
+
background: rgba(124, 58, 237, 0.2);
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
.legend {
|
|
1034
|
+
margin-top: 12px;
|
|
1035
|
+
padding-top: 12px;
|
|
1036
|
+
border-top: 1px solid var(--chefui-calendar-border);
|
|
1037
|
+
display: flex;
|
|
1038
|
+
flex-wrap: wrap;
|
|
1039
|
+
gap: 12px;
|
|
1040
|
+
font-size: 12px;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
.legend-item {
|
|
1044
|
+
display: flex;
|
|
1045
|
+
align-items: center;
|
|
1046
|
+
gap: 6px;
|
|
1047
|
+
color: var(--chefui-calendar-text-muted);
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
.legend-box {
|
|
1051
|
+
width: 16px;
|
|
1052
|
+
height: 16px;
|
|
1053
|
+
border-radius: 4px;
|
|
1054
|
+
border: 2px solid transparent;
|
|
1055
|
+
}
|
|
1056
|
+
`,e([ue({type:String})],exports.ChefUiCalendar.prototype,"value",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"min",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"max",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"disabledDates",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"availableDates",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"highlightedDates",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"focusDate",void 0),e([ue({type:Boolean})],exports.ChefUiCalendar.prototype,"showToday",void 0),e([ue({type:Boolean})],exports.ChefUiCalendar.prototype,"showClear",void 0),e([ue({type:Boolean})],exports.ChefUiCalendar.prototype,"showFooter",void 0),e([ue({type:Boolean})],exports.ChefUiCalendar.prototype,"showLegend",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"mode",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"rangeStart",void 0),e([ue({type:String})],exports.ChefUiCalendar.prototype,"rangeEnd",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"weekdays",void 0),e([ue({type:Number})],exports.ChefUiCalendar.prototype,"firstDayOfWeek",void 0),e([ue({type:Number})],exports.ChefUiCalendar.prototype,"startYear",void 0),e([ue({type:Number})],exports.ChefUiCalendar.prototype,"endYear",void 0),e([ue({type:Number})],exports.ChefUiCalendar.prototype,"startMonth",void 0),e([ue({type:Number})],exports.ChefUiCalendar.prototype,"endMonth",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"availableMonths",void 0),e([ue({type:Array})],exports.ChefUiCalendar.prototype,"availableYears",void 0),e([ue({type:Boolean})],exports.ChefUiCalendar.prototype,"showMonthYearDropdowns",void 0),e([fe()],exports.ChefUiCalendar.prototype,"currentMonth",void 0),e([fe()],exports.ChefUiCalendar.prototype,"today",void 0),exports.ChefUiCalendar=e([le("chef-ui-calendar")],exports.ChefUiCalendar),exports.ChefUiCheckbox=class extends ce{constructor(){super(...arguments),this.checked=!1,this.indeterminate=!1,this.disabled=!1,this.required=!1,this.error=!1,this.value="on",this.size="medium",this.color="primary",this.labelPlacement="end",this.iconOnly=!1}updated(e){e.has("checkboxType")&&this.checkboxType&&(this.iconOnly=!0)}handleChange(e){if(this.disabled)return void e.preventDefault();const t=e.target,o=this.checked;this.indeterminate?(this.indeterminate=!1,this.checked=!0):this.checked=t.checked,this.dispatchEvent(new CustomEvent("chef-change",{detail:{checked:this.checked,indeterminate:this.indeterminate,value:this.value,oldValue:o},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}handleClick(e){e.target.classList.contains("label")&&e.preventDefault()}getIcon(){return this.indeterminate?this.indeterminateIcon||"minus":this.checkboxType?this.checkboxType:this.iconOnly&&this.checkedIcon?this.checkedIcon:this.checked?this.checkedIcon||"check":this.uncheckedIcon||""}render(){const e=this.getIcon(),t=(this.iconOnly||!!this.checkboxType)&&this.checked?"solid":"outline";return V`
|
|
1057
|
+
<label class="checkbox-wrapper" @click=${this.handleClick} part="wrapper">
|
|
1058
|
+
<div class="checkbox-container" part="container">
|
|
1059
|
+
<input
|
|
1060
|
+
type="checkbox"
|
|
1061
|
+
class="checkbox-input"
|
|
1062
|
+
.checked=${this.checked&&!this.indeterminate}
|
|
1063
|
+
.indeterminate=${this.indeterminate}
|
|
1064
|
+
?disabled=${this.disabled}
|
|
1065
|
+
?required=${this.required}
|
|
1066
|
+
name=${this.name||""}
|
|
1067
|
+
value=${this.value}
|
|
1068
|
+
@change=${this.handleChange}
|
|
1069
|
+
aria-checked=${this.indeterminate?"mixed":this.checked?"true":"false"}
|
|
1070
|
+
aria-disabled=${this.disabled}
|
|
1071
|
+
part="input"
|
|
1072
|
+
/>
|
|
1073
|
+
<div class="checkbox-box" part="box">
|
|
1074
|
+
${e?V`
|
|
1075
|
+
<chef-icon class="checkbox-icon" name=${e} styleVariant=${t}></chef-icon>
|
|
1076
|
+
`:null}
|
|
1077
|
+
<slot name="icon"></slot>
|
|
1078
|
+
</div>
|
|
1079
|
+
</div>
|
|
1080
|
+
|
|
1081
|
+
${this.label?V`
|
|
1082
|
+
<span class="label" part="label">
|
|
1083
|
+
<slot>${this.label}</slot>
|
|
1084
|
+
</span>
|
|
1085
|
+
`:V`
|
|
1086
|
+
<span class="label" part="label">
|
|
1087
|
+
<slot></slot>
|
|
1088
|
+
</span>
|
|
1089
|
+
`}
|
|
1090
|
+
</label>
|
|
1091
|
+
|
|
1092
|
+
${this.helperText?V`
|
|
1093
|
+
<span class="helper-text" part="helper-text">${this.helperText}</span>
|
|
1094
|
+
`:null}
|
|
1095
|
+
`}},exports.ChefUiCheckbox.styles=s`
|
|
1096
|
+
:host {
|
|
1097
|
+
display: inline-flex;
|
|
1098
|
+
--chefui-checkbox-size: 20px;
|
|
1099
|
+
--chefui-checkbox-border: #64748b;
|
|
1100
|
+
--chefui-checkbox-bg: transparent;
|
|
1101
|
+
--chefui-checkbox-checked-bg: #7c3aed;
|
|
1102
|
+
--chefui-checkbox-checked-border: #7c3aed;
|
|
1103
|
+
--chefui-checkbox-hover: rgba(124, 58, 237, 0.08);
|
|
1104
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(124, 58, 237, 0.2);
|
|
1105
|
+
--chefui-checkbox-disabled-opacity: 0.5;
|
|
1106
|
+
--chefui-checkbox-text: #e2e8f0;
|
|
1107
|
+
--chefui-checkbox-radius: 4px;
|
|
1108
|
+
--chefui-checkbox-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.checkbox-wrapper {
|
|
1112
|
+
display: inline-flex;
|
|
1113
|
+
align-items: flex-start;
|
|
1114
|
+
gap: 8px;
|
|
1115
|
+
cursor: pointer;
|
|
1116
|
+
user-select: none;
|
|
1117
|
+
position: relative;
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
:host([disabled]) .checkbox-wrapper {
|
|
1121
|
+
cursor: not-allowed;
|
|
1122
|
+
opacity: var(--chefui-checkbox-disabled-opacity);
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1125
|
+
.checkbox-container {
|
|
1126
|
+
position: relative;
|
|
1127
|
+
display: inline-flex;
|
|
1128
|
+
align-items: center;
|
|
1129
|
+
justify-content: center;
|
|
1130
|
+
width: var(--chefui-checkbox-size);
|
|
1131
|
+
height: var(--chefui-checkbox-size);
|
|
1132
|
+
flex-shrink: 0;
|
|
1133
|
+
}
|
|
1134
|
+
|
|
1135
|
+
.checkbox-input {
|
|
1136
|
+
position: absolute;
|
|
1137
|
+
opacity: 0;
|
|
1138
|
+
width: 100%;
|
|
1139
|
+
height: 100%;
|
|
1140
|
+
margin: 0;
|
|
1141
|
+
cursor: pointer;
|
|
1142
|
+
z-index: 1;
|
|
1143
|
+
}
|
|
1144
|
+
|
|
1145
|
+
:host([disabled]) .checkbox-input {
|
|
1146
|
+
cursor: not-allowed;
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
.checkbox-box {
|
|
1150
|
+
width: 100%;
|
|
1151
|
+
height: 100%;
|
|
1152
|
+
border: 2px solid var(--chefui-checkbox-border);
|
|
1153
|
+
border-radius: var(--chefui-checkbox-radius);
|
|
1154
|
+
background: var(--chefui-checkbox-bg);
|
|
1155
|
+
display: flex;
|
|
1156
|
+
align-items: center;
|
|
1157
|
+
justify-content: center;
|
|
1158
|
+
transition: all var(--chefui-checkbox-transition);
|
|
1159
|
+
position: relative;
|
|
1160
|
+
}
|
|
1161
|
+
|
|
1162
|
+
.checkbox-input:hover ~ .checkbox-box {
|
|
1163
|
+
background: var(--chefui-checkbox-hover);
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
.checkbox-input:focus-visible ~ .checkbox-box {
|
|
1167
|
+
box-shadow: var(--chefui-checkbox-focus-ring);
|
|
1168
|
+
}
|
|
1169
|
+
|
|
1170
|
+
:host([checked]) .checkbox-box,
|
|
1171
|
+
:host([indeterminate]) .checkbox-box {
|
|
1172
|
+
background: var(--chefui-checkbox-checked-bg);
|
|
1173
|
+
border-color: var(--chefui-checkbox-checked-border);
|
|
1174
|
+
}
|
|
1175
|
+
|
|
1176
|
+
.checkbox-icon {
|
|
1177
|
+
width: 14px;
|
|
1178
|
+
height: 14px;
|
|
1179
|
+
color: white;
|
|
1180
|
+
opacity: 0;
|
|
1181
|
+
transform: scale(0.5);
|
|
1182
|
+
transition: all var(--chefui-checkbox-transition);
|
|
1183
|
+
}
|
|
1184
|
+
|
|
1185
|
+
:host([checked]) .checkbox-icon,
|
|
1186
|
+
:host([indeterminate]) .checkbox-icon {
|
|
1187
|
+
opacity: 1;
|
|
1188
|
+
transform: scale(1);
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
.label {
|
|
1192
|
+
color: var(--chefui-checkbox-text);
|
|
1193
|
+
font-size: 14px;
|
|
1194
|
+
line-height: 20px;
|
|
1195
|
+
display: flex;
|
|
1196
|
+
align-items: center;
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
/* Size variants */
|
|
1200
|
+
:host([size="small"]) {
|
|
1201
|
+
--chefui-checkbox-size: 16px;
|
|
1202
|
+
}
|
|
1203
|
+
|
|
1204
|
+
:host([size="small"]) .checkbox-icon {
|
|
1205
|
+
width: 11px;
|
|
1206
|
+
height: 11px;
|
|
1207
|
+
}
|
|
1208
|
+
|
|
1209
|
+
:host([size="small"]) .label {
|
|
1210
|
+
font-size: 13px;
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
:host([size="large"]) {
|
|
1214
|
+
--chefui-checkbox-size: 24px;
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
:host([size="large"]) .checkbox-icon {
|
|
1218
|
+
width: 16px;
|
|
1219
|
+
height: 16px;
|
|
1220
|
+
}
|
|
1221
|
+
|
|
1222
|
+
:host([size="large"]) .label {
|
|
1223
|
+
font-size: 15px;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
/* Color variants */
|
|
1227
|
+
:host([color="primary"]) {
|
|
1228
|
+
--chefui-checkbox-checked-bg: #7c3aed;
|
|
1229
|
+
--chefui-checkbox-checked-border: #7c3aed;
|
|
1230
|
+
--chefui-checkbox-hover: rgba(124, 58, 237, 0.08);
|
|
1231
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(124, 58, 237, 0.2);
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
:host([color="secondary"]) {
|
|
1235
|
+
--chefui-checkbox-checked-bg: #ec4899;
|
|
1236
|
+
--chefui-checkbox-checked-border: #ec4899;
|
|
1237
|
+
--chefui-checkbox-hover: rgba(236, 72, 153, 0.08);
|
|
1238
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(236, 72, 153, 0.2);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
:host([color="success"]) {
|
|
1242
|
+
--chefui-checkbox-checked-bg: #10b981;
|
|
1243
|
+
--chefui-checkbox-checked-border: #10b981;
|
|
1244
|
+
--chefui-checkbox-hover: rgba(16, 185, 129, 0.08);
|
|
1245
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(16, 185, 129, 0.2);
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
:host([color="error"]) {
|
|
1249
|
+
--chefui-checkbox-checked-bg: #ef4444;
|
|
1250
|
+
--chefui-checkbox-checked-border: #ef4444;
|
|
1251
|
+
--chefui-checkbox-hover: rgba(239, 68, 68, 0.08);
|
|
1252
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(239, 68, 68, 0.2);
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
:host([color="warning"]) {
|
|
1256
|
+
--chefui-checkbox-checked-bg: #f59e0b;
|
|
1257
|
+
--chefui-checkbox-checked-border: #f59e0b;
|
|
1258
|
+
--chefui-checkbox-hover: rgba(245, 158, 11, 0.08);
|
|
1259
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(245, 158, 11, 0.2);
|
|
1260
|
+
}
|
|
1261
|
+
|
|
1262
|
+
:host([color="info"]) {
|
|
1263
|
+
--chefui-checkbox-checked-bg: #3b82f6;
|
|
1264
|
+
--chefui-checkbox-checked-border: #3b82f6;
|
|
1265
|
+
--chefui-checkbox-hover: rgba(59, 130, 246, 0.08);
|
|
1266
|
+
--chefui-checkbox-focus-ring: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
1267
|
+
}
|
|
1268
|
+
|
|
1269
|
+
/* Error state */
|
|
1270
|
+
:host([error]) .checkbox-box {
|
|
1271
|
+
border-color: #ef4444;
|
|
1272
|
+
}
|
|
1273
|
+
|
|
1274
|
+
.helper-text {
|
|
1275
|
+
display: block;
|
|
1276
|
+
font-size: 12px;
|
|
1277
|
+
color: var(--chefui-checkbox-text);
|
|
1278
|
+
opacity: 0.7;
|
|
1279
|
+
margin-top: 4px;
|
|
1280
|
+
margin-left: calc(var(--chefui-checkbox-size) + 8px);
|
|
1281
|
+
}
|
|
1282
|
+
|
|
1283
|
+
:host([error]) .helper-text {
|
|
1284
|
+
color: #ef4444;
|
|
1285
|
+
opacity: 1;
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
/* Label position */
|
|
1289
|
+
:host([label-placement="start"]) .checkbox-wrapper {
|
|
1290
|
+
flex-direction: row-reverse;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
:host([label-placement="top"]) .checkbox-wrapper {
|
|
1294
|
+
flex-direction: column-reverse;
|
|
1295
|
+
align-items: flex-start;
|
|
1296
|
+
}
|
|
1297
|
+
|
|
1298
|
+
:host([label-placement="bottom"]) .checkbox-wrapper {
|
|
1299
|
+
flex-direction: column;
|
|
1300
|
+
align-items: flex-start;
|
|
1301
|
+
}
|
|
1302
|
+
|
|
1303
|
+
/* Custom icon support */
|
|
1304
|
+
.checkbox-custom-icon {
|
|
1305
|
+
width: 100%;
|
|
1306
|
+
height: 100%;
|
|
1307
|
+
display: flex;
|
|
1308
|
+
align-items: center;
|
|
1309
|
+
justify-content: center;
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
/* Icon-only mode */
|
|
1313
|
+
:host([icon-only]) .checkbox-box {
|
|
1314
|
+
border: none;
|
|
1315
|
+
background: transparent !important;
|
|
1316
|
+
}
|
|
1317
|
+
|
|
1318
|
+
:host([icon-only]) .checkbox-container {
|
|
1319
|
+
width: auto;
|
|
1320
|
+
height: auto;
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
:host([icon-only]) .checkbox-icon {
|
|
1324
|
+
width: 24px;
|
|
1325
|
+
height: 24px;
|
|
1326
|
+
opacity: 1;
|
|
1327
|
+
transform: scale(1);
|
|
1328
|
+
color: #64748b;
|
|
1329
|
+
transition: color var(--chefui-checkbox-transition), transform var(--chefui-checkbox-transition);
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
:host([icon-only][checked]) .checkbox-icon {
|
|
1333
|
+
color: var(--chefui-checkbox-checked-bg);
|
|
1334
|
+
transform: scale(1.1);
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
:host([icon-only]) .checkbox-input:hover ~ .checkbox-box .checkbox-icon {
|
|
1338
|
+
transform: scale(1.15);
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
:host([icon-only]) .checkbox-box::before {
|
|
1342
|
+
display: none;
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
:host([icon-only]) .label {
|
|
1346
|
+
display: none;
|
|
1347
|
+
}
|
|
1348
|
+
`,e([ue({type:Boolean,reflect:!0})],exports.ChefUiCheckbox.prototype,"checked",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiCheckbox.prototype,"indeterminate",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiCheckbox.prototype,"disabled",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiCheckbox.prototype,"required",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiCheckbox.prototype,"error",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"name",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"value",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiCheckbox.prototype,"size",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiCheckbox.prototype,"color",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"label",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"helperText",void 0),e([ue({type:String,reflect:!0,attribute:"label-placement"})],exports.ChefUiCheckbox.prototype,"labelPlacement",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"checkedIcon",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"uncheckedIcon",void 0),e([ue({type:String})],exports.ChefUiCheckbox.prototype,"indeterminateIcon",void 0),e([ue({type:Boolean,reflect:!0,attribute:"icon-only"})],exports.ChefUiCheckbox.prototype,"iconOnly",void 0),e([ue({type:String,reflect:!0,attribute:"checkbox-type"})],exports.ChefUiCheckbox.prototype,"checkboxType",void 0),exports.ChefUiCheckbox=e([le("chef-ui-checkbox")],exports.ChefUiCheckbox),exports.ChefUiReaction=class extends ce{constructor(){super(...arguments),this.active=!1,this.disabled=!1,this.count=0,this.showCount=!0,this.type="like",this.size="medium",this.variant="outlined",this.value="on"}getIcon(){return{like:"heart","thumbs-up":"thumbs-up",star:"star",bookmark:"bookmark"}[this.type]}handleClick(){if(this.disabled)return;const e=this.active,t=this.count;this.active=!this.active,this.showCount&&(this.count=this.active?t+1:Math.max(0,t-1)),this.dispatchEvent(new CustomEvent("chef-reaction-change",{detail:{active:this.active,count:this.count,type:this.type,oldActive:e,oldCount:t},bubbles:!0,composed:!0})),this.dispatchEvent(new Event("change",{bubbles:!0,composed:!0}))}render(){const e=this.getIcon();return V`
|
|
1349
|
+
<div class="reaction-wrapper" @click=${this.handleClick} part="wrapper">
|
|
1350
|
+
<button
|
|
1351
|
+
class="reaction-button"
|
|
1352
|
+
type="button"
|
|
1353
|
+
?disabled=${this.disabled}
|
|
1354
|
+
aria-pressed=${this.active}
|
|
1355
|
+
aria-label="${this.type} button"
|
|
1356
|
+
part="button"
|
|
1357
|
+
>
|
|
1358
|
+
<chef-icon class="reaction-icon" name=${e}></chef-icon>
|
|
1359
|
+
</button>
|
|
1360
|
+
|
|
1361
|
+
${this.showCount?V`
|
|
1362
|
+
<span class="reaction-count" part="count">
|
|
1363
|
+
${this.count>0?this.count:""}
|
|
1364
|
+
</span>
|
|
1365
|
+
`:null}
|
|
1366
|
+
</div>
|
|
1367
|
+
`}},exports.ChefUiReaction.styles=s`
|
|
1368
|
+
:host {
|
|
1369
|
+
display: inline-flex;
|
|
1370
|
+
--chefui-reaction-size: 40px;
|
|
1371
|
+
--chefui-reaction-icon-size: 20px;
|
|
1372
|
+
--chefui-reaction-color: #64748b;
|
|
1373
|
+
--chefui-reaction-active-color: #ef4444;
|
|
1374
|
+
--chefui-reaction-bg: transparent;
|
|
1375
|
+
--chefui-reaction-hover-bg: rgba(239, 68, 68, 0.1);
|
|
1376
|
+
--chefui-reaction-active-bg: rgba(239, 68, 68, 0.15);
|
|
1377
|
+
--chefui-reaction-transition: 150ms cubic-bezier(0.4, 0, 0.2, 1);
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
.reaction-wrapper {
|
|
1381
|
+
display: inline-flex;
|
|
1382
|
+
align-items: center;
|
|
1383
|
+
gap: 6px;
|
|
1384
|
+
cursor: pointer;
|
|
1385
|
+
user-select: none;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
:host([disabled]) .reaction-wrapper {
|
|
1389
|
+
cursor: not-allowed;
|
|
1390
|
+
opacity: 0.5;
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1393
|
+
.reaction-button {
|
|
1394
|
+
all: unset;
|
|
1395
|
+
width: var(--chefui-reaction-size);
|
|
1396
|
+
height: var(--chefui-reaction-size);
|
|
1397
|
+
display: inline-flex;
|
|
1398
|
+
align-items: center;
|
|
1399
|
+
justify-content: center;
|
|
1400
|
+
border-radius: 50%;
|
|
1401
|
+
background: var(--chefui-reaction-bg);
|
|
1402
|
+
cursor: pointer;
|
|
1403
|
+
transition: all var(--chefui-reaction-transition);
|
|
1404
|
+
position: relative;
|
|
1405
|
+
}
|
|
1406
|
+
|
|
1407
|
+
.reaction-button:hover {
|
|
1408
|
+
background: var(--chefui-reaction-hover-bg);
|
|
1409
|
+
transform: scale(1.1);
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
.reaction-button:active {
|
|
1413
|
+
transform: scale(0.95);
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
:host([disabled]) .reaction-button {
|
|
1417
|
+
cursor: not-allowed;
|
|
1418
|
+
transform: none;
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1421
|
+
:host([active]) .reaction-button {
|
|
1422
|
+
background: var(--chefui-reaction-active-bg);
|
|
1423
|
+
}
|
|
1424
|
+
|
|
1425
|
+
.reaction-icon {
|
|
1426
|
+
width: var(--chefui-reaction-icon-size);
|
|
1427
|
+
height: var(--chefui-reaction-icon-size);
|
|
1428
|
+
color: var(--chefui-reaction-color);
|
|
1429
|
+
transition: all var(--chefui-reaction-transition);
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
:host([active]) .reaction-icon {
|
|
1433
|
+
color: var(--chefui-reaction-active-color);
|
|
1434
|
+
animation: heartbeat 0.3s ease-in-out;
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
@keyframes heartbeat {
|
|
1438
|
+
0%, 100% { transform: scale(1); }
|
|
1439
|
+
25% { transform: scale(1.3); }
|
|
1440
|
+
50% { transform: scale(0.9); }
|
|
1441
|
+
75% { transform: scale(1.1); }
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
.reaction-count {
|
|
1445
|
+
font-size: 14px;
|
|
1446
|
+
font-weight: 500;
|
|
1447
|
+
color: var(--chefui-reaction-color);
|
|
1448
|
+
transition: color var(--chefui-reaction-transition);
|
|
1449
|
+
min-width: 20px;
|
|
1450
|
+
text-align: left;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
:host([active]) .reaction-count {
|
|
1454
|
+
color: var(--chefui-reaction-active-color);
|
|
1455
|
+
}
|
|
1456
|
+
|
|
1457
|
+
/* Type variants */
|
|
1458
|
+
:host([type="like"]) {
|
|
1459
|
+
--chefui-reaction-active-color: #ef4444;
|
|
1460
|
+
--chefui-reaction-hover-bg: rgba(239, 68, 68, 0.1);
|
|
1461
|
+
--chefui-reaction-active-bg: rgba(239, 68, 68, 0.15);
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1464
|
+
:host([type="thumbs-up"]) {
|
|
1465
|
+
--chefui-reaction-active-color: #3b82f6;
|
|
1466
|
+
--chefui-reaction-hover-bg: rgba(59, 130, 246, 0.1);
|
|
1467
|
+
--chefui-reaction-active-bg: rgba(59, 130, 246, 0.15);
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
:host([type="star"]) {
|
|
1471
|
+
--chefui-reaction-active-color: #f59e0b;
|
|
1472
|
+
--chefui-reaction-hover-bg: rgba(245, 158, 11, 0.1);
|
|
1473
|
+
--chefui-reaction-active-bg: rgba(245, 158, 11, 0.15);
|
|
1474
|
+
}
|
|
1475
|
+
|
|
1476
|
+
:host([type="bookmark"]) {
|
|
1477
|
+
--chefui-reaction-active-color: #10b981;
|
|
1478
|
+
--chefui-reaction-hover-bg: rgba(16, 185, 129, 0.1);
|
|
1479
|
+
--chefui-reaction-active-bg: rgba(16, 185, 129, 0.15);
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
/* Size variants */
|
|
1483
|
+
:host([size="small"]) {
|
|
1484
|
+
--chefui-reaction-size: 32px;
|
|
1485
|
+
--chefui-reaction-icon-size: 16px;
|
|
1486
|
+
}
|
|
1487
|
+
|
|
1488
|
+
:host([size="small"]) .reaction-count {
|
|
1489
|
+
font-size: 13px;
|
|
1490
|
+
}
|
|
1491
|
+
|
|
1492
|
+
:host([size="large"]) {
|
|
1493
|
+
--chefui-reaction-size: 48px;
|
|
1494
|
+
--chefui-reaction-icon-size: 24px;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
:host([size="large"]) .reaction-count {
|
|
1498
|
+
font-size: 16px;
|
|
1499
|
+
}
|
|
1500
|
+
|
|
1501
|
+
/* Filled variant */
|
|
1502
|
+
:host([variant="filled"]) .reaction-icon {
|
|
1503
|
+
fill: currentColor;
|
|
1504
|
+
}
|
|
1505
|
+
`,e([ue({type:Boolean,reflect:!0})],exports.ChefUiReaction.prototype,"active",void 0),e([ue({type:Boolean,reflect:!0})],exports.ChefUiReaction.prototype,"disabled",void 0),e([ue({type:Number})],exports.ChefUiReaction.prototype,"count",void 0),e([ue({type:Boolean})],exports.ChefUiReaction.prototype,"showCount",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiReaction.prototype,"type",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiReaction.prototype,"size",void 0),e([ue({type:String,reflect:!0})],exports.ChefUiReaction.prototype,"variant",void 0),e([ue({type:String})],exports.ChefUiReaction.prototype,"name",void 0),e([ue({type:String})],exports.ChefUiReaction.prototype,"value",void 0),exports.ChefUiReaction=e([le("chef-ui-reaction")],exports.ChefUiReaction),exports.IconResolver=ve,exports.iconResolver=ge;
|
|
691
1506
|
//# sourceMappingURL=index.cjs.map
|