@warp-ds/elements 2.3.0-next.29 → 2.3.0-next.30

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.
@@ -1,12 +1,11 @@
1
1
  import { LitElement } from 'lit';
2
- type ButtonVariant = 'primary' | 'secondary' | 'negative' | 'negativeQuiet' | 'utility' | 'pill' | 'link' | 'quiet' | 'utilityQuiet';
3
- declare const WarpLink_base: import("@open-wc/form-control").Constructor<import("@open-wc/form-control").FormControlInterface> & typeof LitElement;
2
+ type ButtonVariant = 'primary' | 'secondary' | 'negative' | 'negativeQuiet' | 'utility' | 'link' | 'quiet' | 'utilityQuiet' | 'overlay' | 'overlayInverted' | 'overlayQuiet' | 'overlayInvertedQuiet';
4
3
  /**
5
4
  * Buttons are used to perform actions, with different visuals for different needs.
6
5
  *
7
6
  * [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/buttons-link--docs)
8
7
  */
9
- declare class WarpLink extends WarpLink_base {
8
+ declare class WarpLink extends LitElement {
10
9
  static shadowRootOptions: {
11
10
  delegatesFocus: boolean;
12
11
  mode: ShadowRootMode;
@@ -15,18 +14,13 @@ declare class WarpLink extends WarpLink_base {
15
14
  };
16
15
  autofocus: boolean;
17
16
  variant: ButtonVariant;
18
- quiet: boolean;
19
17
  small: boolean;
20
18
  href: string;
21
19
  disabled: boolean;
22
20
  target: string;
23
21
  rel: string;
24
22
  fullWidth: boolean;
25
- buttonClass: string;
26
- name: string;
27
- classes: string;
28
23
  static styles: import("lit").CSSResult[];
29
- constructor();
30
24
  connectedCallback(): void;
31
25
  firstUpdated(): void;
32
26
  render(): import("lit").TemplateResult<1>;
@@ -1,4 +1,4 @@
1
- var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a)=>{for(var i=a>1?void 0:a?O(e,l):e,u=b.length-1,m;u>=0;u--)(m=b[u])&&(i=(a?m(e,l,i):m(i))||i);return a&&i&&N(e,l,i),i};var t=function(b,e,l,a){if(l==="a"&&!a)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?b!==e||!a:!e.has(b))throw new TypeError("Cannot read private member from an object whose class did not declare it");return l==="m"?a:l==="a"?a.call(b):a?a.value:e.get(b)},s=function(b,e,l,a,i){if(a==="m")throw new TypeError("Private method is not writable");if(a==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?b!==e||!i:!e.has(b))throw new TypeError("Cannot write private member to an object whose class did not declare it");return a==="a"?i.call(b,l):i?i.value=l:e.set(b,l),l};function Z(b){var e,l,a,i,u,m,f,W,x,Y,E,j,V,y,M,w,S,T,P;class G extends b{constructor(...r){var o,n,d;super(...r),e.add(this),this.internals=this.attachInternals(),l.set(this,!1),a.set(this,!1),i.set(this,!1),u.set(this,void 0),m.set(this,void 0),f.set(this,!0),x.set(this,""),Y.set(this,()=>{s(this,i,!0,"f"),s(this,l,!0,"f"),t(this,e,"m",w).call(this)}),E.set(this,()=>{s(this,l,!1,"f"),t(this,e,"m",S).call(this,this.shouldFormValueUpdate()?t(this,x,"f"):""),!this.validity.valid&&t(this,i,"f")&&s(this,a,!0,"f");let p=t(this,e,"m",w).call(this);this.validationMessageCallback&&this.validationMessageCallback(p?this.internals.validationMessage:"")}),j.set(this,()=>{var p;t(this,f,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),s(this,f,!1,"f")),s(this,i,!0,"f"),s(this,a,!0,"f"),t(this,e,"m",w).call(this),(p=this===null||this===void 0?void 0:this.validationMessageCallback)===null||p===void 0||p.call(this,this.showError?this.internals.validationMessage:"")}),V.set(this,void 0),y.set(this,!1),M.set(this,Promise.resolve()),(o=this.addEventListener)===null||o===void 0||o.call(this,"focus",t(this,Y,"f")),(n=this.addEventListener)===null||n===void 0||n.call(this,"blur",t(this,E,"f")),(d=this.addEventListener)===null||d===void 0||d.call(this,"invalid",t(this,j,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let r=this.validators.map(d=>d.attribute).flat(),o=super.observedAttributes||[];return[...new Set([...o,...r])]}static getValidator(r){return this.validators.find(o=>o.attribute===r)||null}static getValidators(r){return this.validators.filter(o=>{var n;if(o.attribute===r||!((n=o.attribute)===null||n===void 0)&&n.includes(r))return!0})}get form(){return this.internals.form}get showError(){return t(this,e,"m",w).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(r,o,n){var d;(d=super.attributeChangedCallback)===null||d===void 0||d.call(this,r,o,n);let z=this.constructor.getValidators(r);z!=null&&z.length&&this.validationTarget&&this.setValue(t(this,x,"f"))}setValue(r){var o;s(this,a,!1,"f"),(o=this.validationMessageCallback)===null||o===void 0||o.call(this,""),s(this,x,r,"f");let d=this.shouldFormValueUpdate()?r:null;this.internals.setFormValue(d),t(this,e,"m",S).call(this,d),this.valueChangedCallback&&this.valueChangedCallback(d),t(this,e,"m",w).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(r=>r(t(this,M,"f")))}formResetCallback(){var r,o;s(this,i,!1,"f"),s(this,a,!1,"f"),t(this,e,"m",w).call(this),(r=this.resetFormControl)===null||r===void 0||r.call(this),(o=this.validationMessageCallback)===null||o===void 0||o.call(this,t(this,e,"m",w).call(this)?this.validationMessage:"")}}return l=new WeakMap,a=new WeakMap,i=new WeakMap,u=new WeakMap,m=new WeakMap,f=new WeakMap,x=new WeakMap,Y=new WeakMap,E=new WeakMap,j=new WeakMap,V=new WeakMap,y=new WeakMap,M=new WeakMap,e=new WeakSet,W=function(){let r=this.getRootNode(),o=`${this.localName}[name="${this.getAttribute("name")}"]`;return r.querySelectorAll(o)},w=function(){if(this.hasAttribute("disabled"))return!1;let r=t(this,a,"f")||t(this,i,"f")&&!this.validity.valid&&!t(this,l,"f");return r&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),r},S=function(r){let o=this.constructor,n={},d=o.validators,p=[],z=d.some(v=>v.isValid instanceof Promise);t(this,y,"f")||(s(this,M,new Promise(v=>{s(this,V,v,"f")}),"f"),s(this,y,!0,"f")),t(this,u,"f")&&(t(this,u,"f").abort(),s(this,m,t(this,u,"f"),"f"));let C=new AbortController;s(this,u,C,"f");let F,A=!1;d.length&&(d.forEach(v=>{let X=v.key||"customError",k=v.isValid(this,r,C.signal);k instanceof Promise?(p.push(k),k.then(q=>{q!=null&&(n[X]=!q,F=t(this,e,"m",P).call(this,v,r),t(this,e,"m",T).call(this,n,F))})):(n[X]=!k,this.validity[X]!==!k&&(A=!0),!k&&!F&&(F=t(this,e,"m",P).call(this,v,r)))}),Promise.allSettled(p).then(()=>{var v;C!=null&&C.signal.aborted||(s(this,y,!1,"f"),(v=t(this,V,"f"))===null||v===void 0||v.call(this))}),(A||!z)&&t(this,e,"m",T).call(this,n,F))},T=function(r,o){if(this.validationTarget)this.internals.setValidity(r,o,this.validationTarget),s(this,f,!1,"f");else{if(this.internals.setValidity(r,o),this.internals.validity.valid)return;s(this,f,!0,"f")}},P=function(r,o){if(this.validityCallback){let n=this.validityCallback(r.key||"customError");if(n)return n}return r.message instanceof Function?r.message(this,o):r.message},G}import{html as H,LitElement as Q}from"lit";import{property as g}from"lit/decorators.js";import{classMap as D}from"lit/directives/class-map.js";import{css as B}from"lit";var U=B`
1
+ var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var e=(d,a,i,n)=>{for(var t=n>1?void 0:n?h(a,i):a,c=d.length-1,l;c>=0;c--)(l=d[c])&&(t=(n?l(a,i,t):l(t))||t);return n&&t&&u(a,i,t),t};import{html as m,LitElement as g}from"lit";import{property as o}from"lit/decorators.js";import{classMap as f}from"lit/directives/class-map.js";import{css as s}from"lit";var b=s`
2
2
  *,
3
3
  :before,
4
4
  :after {
@@ -271,7 +271,7 @@ var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a
271
271
  svg {
272
272
  pointer-events: none;
273
273
  }
274
- `,er=B`*, :before, :after {
274
+ `,y=s`*, :before, :after {
275
275
  --w-rotate: 0;
276
276
  --w-rotate-x: 0;
277
277
  --w-rotate-y: 0;
@@ -2437,7 +2437,7 @@ var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a
2437
2437
  display: none
2438
2438
  }
2439
2439
  }
2440
- `;import{css as I}from"lit";var $=I`.w-button,
2440
+ `;import{css as w}from"lit";var v=w`.w-button,
2441
2441
  .w-button--secondary {
2442
2442
  /* Local scoped variables, given the default button (the secondary variant) as a default */
2443
2443
  --_background: var(--background, var(--w-s-color-background));
@@ -2529,6 +2529,10 @@ var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a
2529
2529
  --color: var(--w-s-color-text);
2530
2530
  --border-width: 0px;
2531
2531
  }
2532
+ .w-button--quiet {
2533
+ --background: transparent;
2534
+ --border-width: 0px;
2535
+ }
2532
2536
  .w-button--overlay {
2533
2537
  --background: var(--w-color-background);
2534
2538
  --background-hover: var(--w-color-background-hover);
@@ -2570,6 +2574,38 @@ var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a
2570
2574
  --font-weight: normal;
2571
2575
  display: inline;
2572
2576
  }
2577
+ .w-button--overlay {
2578
+ --background: var(--w-color-background);
2579
+ --background-hover: var(--w-color-background-hover);
2580
+ --background-active: var(--w-color-background-active);
2581
+ --color: var(--w-s-color-text);
2582
+ --border-radius: 9999px;
2583
+ --border-width: 0px;
2584
+ }
2585
+ .w-button--overlay-quiet {
2586
+ --background: transparent;
2587
+ --background-hover: var(--w-s-color-background-hover);
2588
+ --background-active: var(--w-s-color-background-active);
2589
+ --color: var(--w-s-color-text);
2590
+ --border-radius: 9999px;
2591
+ --border-width: 0px;
2592
+ }
2593
+ .w-button--overlay-inverted {
2594
+ --background: var(--w-s-color-background-inverted);
2595
+ --background-hover: var(--w-s-color-background-inverted-hover);
2596
+ --background-active: var(--w-s-color-background-inverted-active);
2597
+ --color: var(--w-s-color-text-inverted);
2598
+ --border-radius: 9999px;
2599
+ --border-width: 0px;
2600
+ }
2601
+ .w-button--overlay-inverted-quiet {
2602
+ --background: transparent;
2603
+ --background-hover: var(--w-s-color-background-inverted-hover);
2604
+ --background-active: var(--w-s-color-background-inverted-active);
2605
+ --color: var(--w-s-color-text-inverted);
2606
+ --border-radius: 9999px;
2607
+ --border-width: 0px;
2608
+ }
2573
2609
 
2574
2610
  /* States config, selects --loading as well since loading is always supposed to be disabled */
2575
2611
  .w-button:disabled,
@@ -2635,12 +2671,12 @@ var N=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var h=(b,e,l,a
2635
2671
  100% {
2636
2672
  background-position: 60px 0;
2637
2673
  }
2638
- }`;var R=["primary","secondary","negative","negativeQuiet","utility","utilityQuiet","pill","link"],c=class extends Z(Q){constructor(){super(),this.variant="secondary"}connectedCallback(){if(super.connectedCallback(),!R.includes(this.variant))throw new Error(`Invalid "variant" attribute. Set its value to one of the following:
2639
- ${R.join(", ")}.`)}firstUpdated(){this.autofocus&&setTimeout(()=>this.focus(),0)}render(){let e={"w-button":this.variant!=="link","w-button--primary":this.variant==="primary","w-button--secondary":this.variant==="secondary","w-button--negative":this.variant==="negative","w-button--utility":this.variant==="utility","w-button--quiet":this.variant==="quiet","w-button--negative-quiet":this.variant==="negativeQuiet","w-button--utility-quiet":this.variant==="utilityQuiet","w-button--small":this.small,"w-button--full-width":this.fullWidth,"w-button--disabled":this.disabled};return H`<a
2674
+ }`;var p=["primary","secondary","negative","negativeQuiet","utility","utilityQuiet","link","overlay","overlayInverted","overlayQuiet","overlayInvertedQuiet"],r=class extends g{constructor(){super(...arguments);this.variant="secondary"}connectedCallback(){if(super.connectedCallback(),!p.includes(this.variant))throw new Error(`Invalid "variant" attribute. Set its value to one of the following:
2675
+ ${p.join(", ")}.`)}firstUpdated(){this.autofocus&&setTimeout(()=>this.focus(),0)}render(){let i={"w-button":this.variant!=="link","w-button--primary":this.variant==="primary","w-button--secondary":this.variant==="secondary","w-button--negative":this.variant==="negative","w-button--utility":this.variant==="utility","w-button--quiet":this.variant==="quiet","w-button--negative-quiet":this.variant==="negativeQuiet","w-button--utility-quiet":this.variant==="utilityQuiet","w-button--overlay":this.variant==="overlay","w-button--overlay-inverted":this.variant==="overlayInverted","w-button--overlay-quiet":this.variant==="overlayQuiet","w-button--overlay-inverted-quiet":this.variant==="overlayInvertedQuiet","w-button--small":this.small,"w-button--full-width":this.fullWidth,"w-button--disabled":this.disabled};return m`<a
2640
2676
  href=${this.href}
2641
2677
  target=${this.target}
2642
2678
  rel=${this.target==="_blank"?this.rel||"noopener":void 0}
2643
- class=${D(e)}>
2679
+ class=${f(i)}>
2644
2680
  <slot></slot>
2645
- </a>`}};c.shadowRootOptions={...Q.shadowRootOptions,delegatesFocus:!0},c.styles=[U,$],h([g({type:Boolean,reflect:!0})],c.prototype,"autofocus",2),h([g({reflect:!0})],c.prototype,"variant",2),h([g({type:Boolean,reflect:!0})],c.prototype,"quiet",2),h([g({type:Boolean,reflect:!0})],c.prototype,"small",2),h([g({reflect:!0})],c.prototype,"href",2),h([g({type:Boolean,reflect:!0})],c.prototype,"disabled",2),h([g({reflect:!0})],c.prototype,"target",2),h([g({reflect:!0})],c.prototype,"rel",2),h([g({attribute:"full-width",type:Boolean,reflect:!0})],c.prototype,"fullWidth",2),h([g({attribute:"button-class",reflect:!0})],c.prototype,"buttonClass",2),h([g({reflect:!0})],c.prototype,"name",2);customElements.get("w-link")||customElements.define("w-link",c);export{c as WarpLink};
2681
+ </a>`}};r.shadowRootOptions={...g.shadowRootOptions,delegatesFocus:!0},r.styles=[b,v],e([o({type:Boolean,reflect:!0})],r.prototype,"autofocus",2),e([o({reflect:!0})],r.prototype,"variant",2),e([o({type:Boolean,reflect:!0})],r.prototype,"small",2),e([o({reflect:!0})],r.prototype,"href",2),e([o({type:Boolean,reflect:!0})],r.prototype,"disabled",2),e([o({reflect:!0})],r.prototype,"target",2),e([o({reflect:!0})],r.prototype,"rel",2),e([o({attribute:"full-width",type:Boolean,reflect:!0})],r.prototype,"fullWidth",2);customElements.get("w-link")||customElements.define("w-link",r);export{r as WarpLink};
2646
2682
  //# sourceMappingURL=index.js.map