@warp-ds/elements 2.3.0-next.24 → 2.3.0-next.25
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/custom-elements.json +218 -8
- package/dist/index.d.ts +39 -0
- package/dist/packages/attention/index.js +20 -20
- package/dist/packages/attention/index.js.map +3 -3
- package/dist/packages/button/button.react.stories.d.ts +1 -1
- package/dist/packages/button/button.test.js +30 -1
- package/dist/packages/button/index.d.ts +2 -0
- package/dist/packages/button/index.js +12 -12
- package/dist/packages/button/index.js.map +3 -3
- package/dist/packages/combobox/combobox.react.stories.d.ts +1 -1
- package/dist/packages/combobox/combobox.stories.d.ts +1 -0
- package/dist/packages/combobox/combobox.stories.js +29 -3
- package/dist/packages/combobox/index.d.ts +7 -1
- package/dist/packages/combobox/index.js +19 -19
- package/dist/packages/combobox/index.js.map +4 -4
- package/dist/packages/datepicker/datepicker.d.ts +1 -0
- package/dist/packages/datepicker/datepicker.js +35 -35
- package/dist/packages/datepicker/datepicker.js.map +3 -3
- package/dist/packages/datepicker/datepicker.react.stories.d.ts +1 -1
- package/dist/packages/datepicker/datepicker.test.js +27 -0
- package/dist/packages/link/link.react.stories.d.ts +1 -1
- package/dist/packages/select/index.d.ts +1 -0
- package/dist/packages/select/index.js +15 -15
- package/dist/packages/select/index.js.map +3 -3
- package/dist/packages/select/select.react.stories.d.ts +1 -1
- package/dist/packages/select/select.test.js +30 -0
- package/dist/packages/slider/slider-thumb.d.ts +1 -0
- package/dist/packages/slider/slider-thumb.js +23 -23
- package/dist/packages/slider/slider-thumb.js.map +3 -3
- package/dist/packages/slider/slider.d.ts +1 -2
- package/dist/packages/slider/slider.js +20 -20
- package/dist/packages/slider/slider.js.map +4 -4
- package/dist/packages/slider/slider.stories.js +2 -2
- package/dist/packages/slider/slider.test.js +28 -0
- package/dist/packages/switch/index.d.ts +10 -2
- package/dist/packages/switch/index.js +5 -5
- package/dist/packages/switch/index.js.map +4 -4
- package/dist/packages/switch/switch.react.stories.js +4 -4
- package/dist/packages/switch/switch.stories.js +6 -5
- package/dist/packages/switch/switch.test.d.ts +1 -0
- package/dist/packages/switch/switch.test.js +40 -0
- package/dist/packages/textarea/textarea.d.ts +1 -0
- package/dist/packages/textarea/textarea.js +14 -14
- package/dist/packages/textarea/textarea.js.map +3 -3
- package/dist/packages/textarea/textarea.react.stories.d.ts +1 -1
- package/dist/packages/textarea/textarea.test.js +19 -0
- package/dist/packages/textfield/index.d.ts +3 -0
- package/dist/packages/textfield/index.js +8 -8
- package/dist/packages/textfield/index.js.map +3 -3
- package/dist/packages/textfield/textfield.react.stories.d.ts +1 -1
- package/dist/packages/textfield/textfield.stories.d.ts +1 -0
- package/dist/packages/textfield/textfield.stories.js +17 -0
- package/dist/web-types.json +7 -3
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ import { StoryObj } from '@storybook/react';
|
|
|
3
3
|
import { Button } from './react';
|
|
4
4
|
declare const _default: {
|
|
5
5
|
title: string;
|
|
6
|
-
render(args: Omit<React.HTMLAttributes<import(".").WarpButton>, "rel" | "_classes" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "variant" | "form" | "small" | "quiet" | "href" | "target" | "fullWidth" | "buttonClass" | "name" | "type" | "loading" | "value" | "ariaValueTextLoading" | "updated" | "firstUpdated" | "_primaryClasses" | "_secondaryClasses" | "_utilityClasses" | "_negativeClasses" | "_pillClasses" | "_linkClasses" | "_handleButtonClick" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "
|
|
6
|
+
render(args: Omit<React.HTMLAttributes<import(".").WarpButton>, "rel" | "_classes" | "render" | "renderOptions" | "connectedCallback" | "disconnectedCallback" | "renderRoot" | "isUpdatePending" | "hasUpdated" | "addController" | "removeController" | "attributeChangedCallback" | "requestUpdate" | "updateComplete" | "variant" | "form" | "small" | "quiet" | "href" | "target" | "fullWidth" | "buttonClass" | "name" | "type" | "loading" | "value" | "ariaValueTextLoading" | "updated" | "firstUpdated" | "_primaryClasses" | "_secondaryClasses" | "_utilityClasses" | "_negativeClasses" | "_pillClasses" | "_linkClasses" | "_handleButtonClick" | "resetFormControl" | "validationTarget" | "internals" | "showError" | "validationMessage" | "validity" | "validationComplete" | "checkValidity" | "formResetCallback" | "valueChangedCallback" | "validityCallback" | "validationMessageCallback" | "setValue" | "shouldFormValueUpdate"> & {} & Partial<Omit<import(".").WarpButton, keyof HTMLElement>> & React.RefAttributes<import(".").WarpButton>): React.JSX.Element;
|
|
7
7
|
component: import("@lit/react").ReactWebComponent<import(".").WarpButton, {}>;
|
|
8
8
|
};
|
|
9
9
|
export default _default;
|
|
@@ -14,7 +14,36 @@ test('by default button type is button', async () => {
|
|
|
14
14
|
await expect.element(page.getByRole('button')).toHaveAttribute('type', 'button');
|
|
15
15
|
});
|
|
16
16
|
test.todo('works in a form as type submit');
|
|
17
|
-
test
|
|
17
|
+
test('Works in a form as type reset', async () => {
|
|
18
|
+
const label = 'Test label';
|
|
19
|
+
render(html `
|
|
20
|
+
<form>
|
|
21
|
+
<w-button
|
|
22
|
+
label=${label}
|
|
23
|
+
name="test"
|
|
24
|
+
type="reset"
|
|
25
|
+
value="test"
|
|
26
|
+
variant="secondary"
|
|
27
|
+
>
|
|
28
|
+
Reset the form
|
|
29
|
+
</w-button>
|
|
30
|
+
</form>
|
|
31
|
+
`);
|
|
32
|
+
const form = document.querySelector('form');
|
|
33
|
+
const wButton = document.querySelector('w-button');
|
|
34
|
+
// sanity
|
|
35
|
+
expect(form).not.toBeNull();
|
|
36
|
+
expect(wButton).not.toBeNull();
|
|
37
|
+
// Initial value is "test"
|
|
38
|
+
expect(wButton.value).toBe('test');
|
|
39
|
+
// Change the value to "definitely not test"
|
|
40
|
+
wButton.value = 'definitely not test';
|
|
41
|
+
expect(wButton.value).toBe('definitely not test');
|
|
42
|
+
// Reset the form
|
|
43
|
+
form.reset();
|
|
44
|
+
// Value should be reset back to "test"
|
|
45
|
+
expect(wButton.value).toBe('test');
|
|
46
|
+
});
|
|
18
47
|
test('calling focus on w-button focuses the button inside the shadow root', async () => {
|
|
19
48
|
const component = html `<w-button>This is a button</w-button>`;
|
|
20
49
|
const page = render(component);
|
|
@@ -9,6 +9,7 @@ declare const WarpButton_base: import("@open-wc/form-control").Constructor<impor
|
|
|
9
9
|
* [See Storybook for usage examples](https://warp-ds.github.io/elements/?path=/docs/buttons-button--docs)
|
|
10
10
|
*/
|
|
11
11
|
declare class WarpButton extends WarpButton_base {
|
|
12
|
+
#private;
|
|
12
13
|
static shadowRootOptions: {
|
|
13
14
|
delegatesFocus: boolean;
|
|
14
15
|
mode: ShadowRootMode;
|
|
@@ -54,6 +55,7 @@ declare class WarpButton extends WarpButton_base {
|
|
|
54
55
|
get _classes(): string;
|
|
55
56
|
/** @internal */
|
|
56
57
|
_handleButtonClick(): void;
|
|
58
|
+
resetFormControl(): void;
|
|
57
59
|
render(): import("lit").TemplateResult<1>;
|
|
58
60
|
}
|
|
59
61
|
export { WarpButton };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function
|
|
1
|
+
var Ze=Object.create;var se=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var Be=Object.getOwnPropertyNames;var Ge=Object.getPrototypeOf,Je=Object.prototype.hasOwnProperty;var ve=r=>{throw TypeError(r)};var me=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports);var Ke=(r,e,t,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Be(e))!Je.call(r,a)&&a!==t&&se(r,a,{get:()=>e[a],enumerable:!(o=pe(e,a))||o.enumerable});return r};var We=(r,e,t)=>(t=r!=null?Ze(Ge(r)):{},Ke(e||!r||!r.__esModule?se(t,"default",{value:r,enumerable:!0}):t,r));var m=(r,e,t,o)=>{for(var a=o>1?void 0:o?pe(e,t):e,b=r.length-1,c;b>=0;b--)(c=r[b])&&(a=(o?c(e,t,a):c(a))||a);return o&&a&&se(e,t,a),a};var fe=(r,e,t)=>e.has(r)||ve("Cannot "+t);var we=(r,e,t)=>(fe(r,e,"read from private field"),t?t.call(r):e.get(r)),xe=(r,e,t)=>e.has(r)?ve("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(r):e.set(r,t),ye=(r,e,t,o)=>(fe(r,e,"write to private field"),o?o.call(r,t):e.set(r,t),t);var ke=me(A=>{"use strict";Object.defineProperty(A,"__esModule",{value:!0});A.errorMessages=A.ErrorType=void 0;var I;(function(r){r.MalformedUnicode="MALFORMED_UNICODE",r.MalformedHexadecimal="MALFORMED_HEXADECIMAL",r.CodePointLimit="CODE_POINT_LIMIT",r.OctalDeprecation="OCTAL_DEPRECATION",r.EndOfString="END_OF_STRING"})(I=A.ErrorType||(A.ErrorType={}));A.errorMessages=new Map([[I.MalformedUnicode,"malformed Unicode character escape sequence"],[I.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[I.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[I.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[I.EndOfString,"malformed escape sequence at end of string"]])});var Ce=me(F=>{"use strict";Object.defineProperty(F,"__esModule",{value:!0});F.unraw=F.errorMessages=F.ErrorType=void 0;var C=ke();Object.defineProperty(F,"ErrorType",{enumerable:!0,get:function(){return C.ErrorType}});Object.defineProperty(F,"errorMessages",{enumerable:!0,get:function(){return C.errorMessages}});function er(r){return!r.match(/[^a-f0-9]/i)?parseInt(r,16):NaN}function K(r,e,t){let o=er(r);if(Number.isNaN(o)||t!==void 0&&t!==r.length)throw new SyntaxError(C.errorMessages.get(e));return o}function rr(r){let e=K(r,C.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(e)}function $e(r,e){let t=K(r,C.ErrorType.MalformedUnicode,4);if(e!==void 0){let o=K(e,C.ErrorType.MalformedUnicode,4);return String.fromCharCode(t,o)}return String.fromCharCode(t)}function tr(r){return r.charAt(0)==="{"&&r.charAt(r.length-1)==="}"}function or(r){if(!tr(r))throw new SyntaxError(C.errorMessages.get(C.ErrorType.MalformedUnicode));let e=r.slice(1,-1),t=K(e,C.ErrorType.MalformedUnicode);try{return String.fromCodePoint(t)}catch(o){throw o instanceof RangeError?new SyntaxError(C.errorMessages.get(C.ErrorType.CodePointLimit)):o}}function ar(r,e=!1){if(e)throw new SyntaxError(C.errorMessages.get(C.ErrorType.OctalDeprecation));let t=parseInt(r,8);return String.fromCharCode(t)}var ir=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function nr(r){return ir.get(r)||r}var sr=/\\(?:(\\)|x([\s\S]{0,2})|u(\{[^}]*\}?)|u([\s\S]{4})\\u([^{][\s\S]{0,3})|u([\s\S]{0,4})|([0-3]?[0-7]{1,2})|([\s\S])|$)/g;function _e(r,e=!1){return r.replace(sr,function(t,o,a,b,c,l,v,k,E){if(o!==void 0)return"\\";if(a!==void 0)return rr(a);if(b!==void 0)return or(b);if(c!==void 0)return $e(c,l);if(v!==void 0)return $e(v);if(k==="0")return"\0";if(k!==void 0)return ar(k,!e);if(E!==void 0)return nr(E);throw new SyntaxError(C.errorMessages.get(C.ErrorType.EndOfString))})}F.unraw=_e;F.default=_e});var le=function(){for(var r=[],e=arguments.length;e--;)r[e]=arguments[e];return r.reduce(function(t,o){return t.concat(typeof o=="string"?o:Array.isArray(o)?le.apply(void 0,o):typeof o=="object"&&o?Object.keys(o).map(function(a){return o[a]?a:""}):"")},[]).join(" ")};var Me=We(Ce(),1);var T=r=>typeof r=="string",lr=r=>typeof r=="function",ze=new Map,Le="en";function be(r){return[...Array.isArray(r)?r:[r],Le]}function ge(r,e,t){let o=be(r);t||(t="default");let a;if(typeof t=="string")switch(a={day:"numeric",month:"short",year:"numeric"},t){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=t;return W(()=>ee("date",o,t),()=>new Intl.DateTimeFormat(o,a)).format(T(e)?new Date(e):e)}function dr(r,e,t){let o;if(t||(t="default"),typeof t=="string")switch(o={second:"numeric",minute:"numeric",hour:"numeric"},t){case"full":case"long":o.timeZoneName="short";break;case"short":delete o.second}else o=t;return ge(r,e,o)}function de(r,e,t){let o=be(r);return W(()=>ee("number",o,t),()=>new Intl.NumberFormat(o,t)).format(e)}function Se(r,e,t,{offset:o=0,...a}){var l,v;let b=be(r),c=e?W(()=>ee("plural-ordinal",b),()=>new Intl.PluralRules(b,{type:"ordinal"})):W(()=>ee("plural-cardinal",b),()=>new Intl.PluralRules(b,{type:"cardinal"}));return(v=(l=a[t])!=null?l:a[c.select(t-o)])!=null?v:a.other}function W(r,e){let t=r(),o=ze.get(t);return o||(o=e(),ze.set(t,o)),o}function ee(r,e,t){let o=e.join("-");return`${r}-${o}-${JSON.stringify(t)}`}var Ee=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,Qe="%__lingui_octothorpe__%",cr=(r,e,t={})=>{let o=e||r,a=c=>typeof c=="object"?c:t[c],b=(c,l)=>{let v=Object.keys(t).length?a("number"):void 0,k=de(o,c,v);return l.replace(new RegExp(Qe,"g"),k)};return{plural:(c,l)=>{let{offset:v=0}=l,k=Se(o,!1,c,l);return b(c-v,k)},selectordinal:(c,l)=>{let{offset:v=0}=l,k=Se(o,!0,c,l);return b(c-v,k)},select:ur,number:(c,l)=>de(o,c,a(l)||{style:l}),date:(c,l)=>ge(o,c,a(l)||l),time:(c,l)=>dr(o,c,a(l)||l)}},ur=(r,e)=>{var t;return(t=e[r])!=null?t:e.other};function br(r,e,t){return(o={},a)=>{let b=cr(e,t,a),c=(v,k=!1)=>Array.isArray(v)?v.reduce((E,D)=>{if(D==="#"&&k)return E+Qe;if(T(D))return E+D;let[U,M,P]=D,O={};M==="plural"||M==="selectordinal"||M==="select"?Object.entries(P).forEach(([j,R])=>{O[j]=c(R,M==="plural"||M==="selectordinal")}):O=P;let z;if(M){let j=b[M];z=j(o[U],O)}else z=o[U];return z==null?E:E+z},""):v,l=c(r);return T(l)&&Ee.test(l)?(0,Me.unraw)(l):T(l)?l:l?String(l):""}}var gr=Object.defineProperty,hr=(r,e,t)=>e in r?gr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,pr=(r,e,t)=>(hr(r,typeof e!="symbol"?e+"":e,t),t),ce=class{constructor(){pr(this,"_events",{})}on(e,t){var a;var o;return(a=(o=this._events)[e])!=null||(o[e]=[]),this._events[e].push(t),()=>this.removeListener(e,t)}removeListener(e,t){let o=this._getListeners(e);if(!o)return;let a=o.indexOf(t);~a&&o.splice(a,1)}emit(e,...t){let o=this._getListeners(e);o&&o.map(a=>a.apply(this,t))}_getListeners(e){let t=this._events[e];return Array.isArray(t)?t:!1}},vr=Object.defineProperty,mr=(r,e,t)=>e in r?vr(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,N=(r,e,t)=>(mr(r,typeof e!="symbol"?e+"":e,t),t),ue=class extends ce{constructor(e){var t;super(),N(this,"_locale",""),N(this,"_locales"),N(this,"_localeData",{}),N(this,"_messages",{}),N(this,"_missing"),N(this,"_messageCompiler"),N(this,"t",this._.bind(this)),e.missing!=null&&(this._missing=e.missing),e.messages!=null&&this.load(e.messages),e.localeData!=null&&this.loadLocaleData(e.localeData),(typeof e.locale=="string"||e.locales)&&this.activate((t=e.locale)!=null?t:Le,e.locales)}get locale(){return this._locale}get locales(){return this._locales}get messages(){var e;return(e=this._messages[this._locale])!=null?e:{}}get localeData(){var e;return(e=this._localeData[this._locale])!=null?e:{}}_loadLocaleData(e,t){let o=this._localeData[e];o?Object.assign(o,t):this._localeData[e]=t}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,t){typeof e=="string"?this._loadLocaleData(e,t):Object.keys(e).forEach(o=>this._loadLocaleData(o,e[o])),this.emit("change")}_load(e,t){let o=this._messages[e];o?Object.assign(o,t):this._messages[e]=t}load(e,t){typeof e=="string"&&typeof t=="object"?this._load(e,t):Object.entries(e).forEach(([o,a])=>this._load(o,a)),this.emit("change")}loadAndActivate({locale:e,locales:t,messages:o}){this._locale=e,this._locales=t||void 0,this._messages[this._locale]=o,this.emit("change")}activate(e,t){this._locale=e,this._locales=t,this.emit("change")}_(e,t,o){if(!this.locale)throw new Error("Lingui: Attempted to call a translation function without setting a locale.\nMake sure to call `i18n.activate(locale)` before using Lingui functions.\nThis issue may also occur due to a race condition in your initialization logic.");let a=o==null?void 0:o.message;e||(e=""),T(e)||(t=e.values||t,a=e.message,e=e.id);let b=this.messages[e],c=b===void 0,l=this._missing;if(l&&c)return lr(l)?l(this._locale,e):l;c&&this.emit("missing",{id:e,locale:this._locale});let v=b||a||e;return T(v)&&(this._messageCompiler?v=this._messageCompiler(v):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${v}
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ That means you use raw catalog or your catalog doesn't have a translation for th
|
|
|
7
7
|
ICU features such as interpolation and plurals will not work properly for that message.
|
|
8
8
|
|
|
9
9
|
Please compile your catalog first.
|
|
10
|
-
`)),T(v)&&
|
|
10
|
+
`)),T(v)&&Ee.test(v)?JSON.parse(`"${v}"`):T(v)?v:br(v,this._locale,this._locales)(t,o==null?void 0:o.formats)}date(e,t){return ge(this._locales||this._locale,e,t)}number(e,t){return de(this._locales||this._locale,e,t)}};function fr(r={}){return new ue(r)}var G=fr();var p=function(r,e,t,o){if(t==="a"&&!o)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!o:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?o:t==="a"?o.call(r):o?o.value:e.get(r)},x=function(r,e,t,o,a){if(o==="m")throw new TypeError("Private method is not writable");if(o==="a"&&!a)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!a:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return o==="a"?a.call(r,t):a?a.value=t:e.set(r,t),t};function re(r){var e,t,o,a,b,c,l,v,k,E,D,U,M,P,O,z,j,R,ae;class He extends r{constructor(...u){var h,w,$;super(...u),e.add(this),this.internals=this.attachInternals(),t.set(this,!1),o.set(this,!1),a.set(this,!1),b.set(this,void 0),c.set(this,void 0),l.set(this,!0),k.set(this,""),E.set(this,()=>{x(this,a,!0,"f"),x(this,t,!0,"f"),p(this,e,"m",z).call(this)}),D.set(this,()=>{x(this,t,!1,"f"),p(this,e,"m",j).call(this,this.shouldFormValueUpdate()?p(this,k,"f"):""),!this.validity.valid&&p(this,a,"f")&&x(this,o,!0,"f");let q=p(this,e,"m",z).call(this);this.validationMessageCallback&&this.validationMessageCallback(q?this.internals.validationMessage:"")}),U.set(this,()=>{var q;p(this,l,"f")&&this.validationTarget&&(this.internals.setValidity(this.validity,this.validationMessage,this.validationTarget),x(this,l,!1,"f")),x(this,a,!0,"f"),x(this,o,!0,"f"),p(this,e,"m",z).call(this),(q=this===null||this===void 0?void 0:this.validationMessageCallback)===null||q===void 0||q.call(this,this.showError?this.internals.validationMessage:"")}),M.set(this,void 0),P.set(this,!1),O.set(this,Promise.resolve()),(h=this.addEventListener)===null||h===void 0||h.call(this,"focus",p(this,E,"f")),(w=this.addEventListener)===null||w===void 0||w.call(this,"blur",p(this,D,"f")),($=this.addEventListener)===null||$===void 0||$.call(this,"invalid",p(this,U,"f")),this.setValue(null)}static get formAssociated(){return!0}static get validators(){return this.formControlValidators||[]}static get observedAttributes(){let u=this.validators.map($=>$.attribute).flat(),h=super.observedAttributes||[];return[...new Set([...h,...u])]}static getValidator(u){return this.validators.find(h=>h.attribute===u)||null}static getValidators(u){return this.validators.filter(h=>{var w;if(h.attribute===u||!((w=h.attribute)===null||w===void 0)&&w.includes(u))return!0})}get form(){return this.internals.form}get showError(){return p(this,e,"m",z).call(this)}checkValidity(){return this.internals.checkValidity()}get validity(){return this.internals.validity}get validationMessage(){return this.internals.validationMessage}attributeChangedCallback(u,h,w){var $;($=super.attributeChangedCallback)===null||$===void 0||$.call(this,u,h,w);let H=this.constructor.getValidators(u);H!=null&&H.length&&this.validationTarget&&this.setValue(p(this,k,"f"))}setValue(u){var h;x(this,o,!1,"f"),(h=this.validationMessageCallback)===null||h===void 0||h.call(this,""),x(this,k,u,"f");let $=this.shouldFormValueUpdate()?u:null;this.internals.setFormValue($),p(this,e,"m",j).call(this,$),this.valueChangedCallback&&this.valueChangedCallback($),p(this,e,"m",z).call(this)}shouldFormValueUpdate(){return!0}get validationComplete(){return new Promise(u=>u(p(this,O,"f")))}formResetCallback(){var u,h;x(this,a,!1,"f"),x(this,o,!1,"f"),p(this,e,"m",z).call(this),(u=this.resetFormControl)===null||u===void 0||u.call(this),(h=this.validationMessageCallback)===null||h===void 0||h.call(this,p(this,e,"m",z).call(this)?this.validationMessage:"")}}return t=new WeakMap,o=new WeakMap,a=new WeakMap,b=new WeakMap,c=new WeakMap,l=new WeakMap,k=new WeakMap,E=new WeakMap,D=new WeakMap,U=new WeakMap,M=new WeakMap,P=new WeakMap,O=new WeakMap,e=new WeakSet,v=function(){let u=this.getRootNode(),h=`${this.localName}[name="${this.getAttribute("name")}"]`;return u.querySelectorAll(h)},z=function(){if(this.hasAttribute("disabled"))return!1;let u=p(this,o,"f")||p(this,a,"f")&&!this.validity.valid&&!p(this,t,"f");return u&&this.internals.states?this.internals.states.add("--show-error"):this.internals.states&&this.internals.states.delete("--show-error"),u},j=function(u){let h=this.constructor,w={},$=h.validators,q=[],H=$.some(L=>L.isValid instanceof Promise);p(this,P,"f")||(x(this,O,new Promise(L=>{x(this,M,L,"f")}),"f"),x(this,P,!0,"f")),p(this,b,"f")&&(p(this,b,"f").abort(),x(this,c,p(this,b,"f"),"f"));let Z=new AbortController;x(this,b,Z,"f");let B,he=!1;$.length&&($.forEach(L=>{let ie=L.key||"customError",Y=L.isValid(this,u,Z.signal);Y instanceof Promise?(q.push(Y),Y.then(ne=>{ne!=null&&(w[ie]=!ne,B=p(this,e,"m",ae).call(this,L,u),p(this,e,"m",R).call(this,w,B))})):(w[ie]=!Y,this.validity[ie]!==!Y&&(he=!0),!Y&&!B&&(B=p(this,e,"m",ae).call(this,L,u)))}),Promise.allSettled(q).then(()=>{var L;Z!=null&&Z.signal.aborted||(x(this,P,!1,"f"),(L=p(this,M,"f"))===null||L===void 0||L.call(this))}),(he||!H)&&p(this,e,"m",R).call(this,w,B))},R=function(u,h){if(this.validationTarget)this.internals.setValidity(u,h,this.validationTarget),x(this,l,!1,"f");else{if(this.internals.setValidity(u,h),this.internals.validity.valid)return;x(this,l,!0,"f")}},ae=function(u,h){if(this.validityCallback){let w=this.validityCallback(u.key||"customError");if(w)return w}return u.message instanceof Function?u.message(this,h):u.message},He}import{html as oe,LitElement as Re,css as zr}from"lit";import{property as S}from"lit/decorators.js";var wr=["en","nb","fi","da","sv"],Fe="en",qe=r=>wr.find(e=>r===e||r.toLowerCase().includes(e))||Fe;function xr(){if(typeof window=="undefined"){let r=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return qe(r)}try{let r=document.documentElement.lang;return qe(r)}catch(r){return console.warn("could not detect locale, falling back to source locale",r),Fe}}var yr=(r,e,t,o,a,b)=>r==="nb"?t:r==="fi"?o:r==="da"?a:r==="sv"?b:e,De=(r,e,t,o,a)=>{let b=xr(),c=yr(b,r,e,t,o,a);G.load(b,c),G.activate(b)};import{html as $r,LitElement as Te}from"lit";import{property as Q}from"lit/decorators.js";import{classMap as _r}from"lit/directives/class-map.js";import{css as Pe}from"lit";var te=Pe`
|
|
11
11
|
*,
|
|
12
12
|
:before,
|
|
13
13
|
:after {
|
|
@@ -280,7 +280,7 @@ Please compile your catalog first.
|
|
|
280
280
|
svg {
|
|
281
281
|
pointer-events: none;
|
|
282
282
|
}
|
|
283
|
-
`,
|
|
283
|
+
`,Vr=Pe`*, :before, :after {
|
|
284
284
|
--w-rotate: 0;
|
|
285
285
|
--w-rotate-x: 0;
|
|
286
286
|
--w-rotate-y: 0;
|
|
@@ -2446,7 +2446,7 @@ Please compile your catalog first.
|
|
|
2446
2446
|
display: none
|
|
2447
2447
|
}
|
|
2448
2448
|
}
|
|
2449
|
-
`;import{css as
|
|
2449
|
+
`;import{css as kr}from"lit";var Oe=kr`.w-button,
|
|
2450
2450
|
.w-button--secondary {
|
|
2451
2451
|
/* Local scoped variables, given the default button (the secondary variant) as a default */
|
|
2452
2452
|
--_background: var(--background, var(--w-s-color-background));
|
|
@@ -2644,15 +2644,15 @@ Please compile your catalog first.
|
|
|
2644
2644
|
100% {
|
|
2645
2645
|
background-position: 60px 0;
|
|
2646
2646
|
}
|
|
2647
|
-
}`;var
|
|
2648
|
-
${
|
|
2647
|
+
}`;var Ve=["primary","secondary","negative","negativeQuiet","utility","utilityQuiet","pill","link"],_=class extends re(Te){constructor(){super(),this.variant="secondary"}connectedCallback(){if(super.connectedCallback(),!Ve.includes(this.variant))throw new Error(`Invalid "variant" attribute. Set its value to one of the following:
|
|
2648
|
+
${Ve.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 $r`<a
|
|
2649
2649
|
href=${this.href}
|
|
2650
2650
|
target=${this.target}
|
|
2651
2651
|
rel=${this.target==="_blank"?this.rel||"noopener":void 0}
|
|
2652
|
-
class=${
|
|
2652
|
+
class=${_r(e)}>
|
|
2653
2653
|
<slot></slot>
|
|
2654
|
-
</a>`}};_.shadowRootOptions={...Qe.shadowRootOptions,delegatesFocus:!0},_.styles=[re,Ee],m([Q({type:Boolean,reflect:!0})],_.prototype,"autofocus",2),m([Q({reflect:!0})],_.prototype,"variant",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"quiet",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"small",2),m([Q({reflect:!0})],_.prototype,"href",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"disabled",2),m([Q({reflect:!0})],_.prototype,"target",2),m([Q({reflect:!0})],_.prototype,"rel",2),m([Q({attribute:"full-width",type:Boolean,reflect:!0})],_.prototype,"fullWidth",2),m([Q({attribute:"button-class",reflect:!0})],_.prototype,"buttonClass",2),m([Q({reflect:!0})],_.prototype,"name",2);customElements.get("w-link")||customElements.define("w-link",_);var Fe=JSON.parse('{"button.aria.loading":["Indl\xE6ser..."]}');var De=JSON.parse('{"button.aria.loading":["Loading..."]}');var Pe=JSON.parse('{"button.aria.loading":["Ladataan..."]}');var Oe=JSON.parse('{"button.aria.loading":["Laster..."]}');var Te=JSON.parse('{"button.aria.loading":["Laddar ..."]}');import{css as wr}from"lit";var Ve=wr`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.text-center{text-align:center}.animate-inprogress{background-size:30px 30px;animation:3s linear infinite animate-inprogress;background-image:linear-gradient(135deg,#0000000d 25%,#0000 0 50%,#0000000d 0 75%,#0000 0,#0000)!important}@keyframes animate-inprogress{0%{background-position:0 0}to{background-position:60px 0}}.hover\\:bg-clip-padding:hover{-webkit-background-clip:padding-box;background-clip:padding-box}.bg-transparent{background-color:#0000}.bg-\\[--w-color-button-primary-background\\]{background-color:var(--w-color-button-primary-background)}.hover\\:bg-\\[--w-color-button-pill-background-hover\\]:hover{background-color:var(--w-color-button-pill-background-hover)}.hover\\:bg-\\[--w-color-button-primary-background-hover\\]:hover{background-color:var(--w-color-button-primary-background-hover)}.active\\:bg-\\[--w-color-button-pill-background-active\\]:active{background-color:var(--w-color-button-pill-background-active)}.active\\:bg-\\[--w-color-button-primary-background-active\\]:active{background-color:var(--w-color-button-primary-background-active)}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-transparent{border-color:#0000}.rounded-4{border-radius:4px}.rounded-8{border-radius:8px}.rounded-full{border-radius:9999px}.inline-block{display:inline-block}.inline{display:inline}.inline-flex{display:inline-flex}.hover\\:underline:hover,.focus\\:underline:focus,.active\\:underline:active{text-decoration-line:underline}.hover\\:no-underline:hover,.focus\\:no-underline:focus,.active\\:no-underline:active{text-decoration:none}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.items-center{align-items:center}.justify-center{justify-content:center}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled{background-color:var(--w-s-color-background-disabled)}.s-bg-negative{background-color:var(--w-s-color-background-negative)}.s-bg-subtle{background-color:var(--w-s-color-background-subtle)}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-negative-hover:hover{background-color:var(--w-s-color-background-negative-hover)}.hover\\:s-bg-negative-subtle-hover:hover{background-color:var(--w-s-color-background-negative-subtle-hover)}.active\\:s-bg-active:active{background-color:var(--w-s-color-background-active)}.active\\:s-bg-negative-active:active{background-color:var(--w-s-color-background-negative-active)}.active\\:s-bg-negative-subtle-active:active{background-color:var(--w-s-color-background-negative-subtle-active)}.s-text{color:var(--w-s-color-text)}.s-text-inverted{color:var(--w-s-color-text-inverted)}.s-text-link{color:var(--w-s-color-text-link)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-icon{color:var(--w-s-color-icon)}.hover\\:s-icon-hover:hover{color:var(--w-s-color-icon-hover)}.active\\:s-icon-active:active{color:var(--w-s-color-icon-active)}.s-border{border-color:var(--w-s-color-border)}.hover\\:s-border-hover:hover{border-color:var(--w-s-color-border-hover)}.active\\:s-border-active:active{border-color:var(--w-s-color-border-active)}.max-w-full{max-width:100%}.max-w-max{max-width:max-content}.min-h-32{min-height:3.2rem}.min-w-32{min-width:3.2rem}.w-full{width:100%}.min-h-\\[44px\\]{min-height:44px}.min-w-\\[44px\\]{min-width:44px}.p-0{padding:0}.p-4{padding:.4rem}.px-14{padding-left:1.4rem;padding-right:1.4rem}.px-16{padding-left:1.6rem;padding-right:1.6rem}.py-10{padding-top:1rem;padding-bottom:1rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.py-6{padding-top:.6rem;padding-bottom:.6rem}.py-8{padding-top:.8rem;padding-bottom:.8rem}.px-\\[15px\\]{padding-left:15px;padding-right:15px}.py-\\[11px\\]{padding-top:11px;padding-bottom:11px}.py-\\[7px\\]{padding-top:7px;padding-bottom:7px}.cursor-default{cursor:default}.font-bold{font-weight:700}.pointer-events-none{pointer-events:none}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-\\[24\\]{line-height:2.4rem}`;var Ae=["primary","secondary","negative","utility","pill","link"],V="font-bold focusable justify-center transition-colors ease-in-out",f={primary:"s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",secondary:"s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",utility:"s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",destructive:"s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",pill:"s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",disabled:"s-text-inverted s-bg-disabled",quiet:"bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",utilityQuiet:"s-text bg-transparent hover:s-bg-hover active:s-bg-active",negativeQuiet:"bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",loading:"s-text s-bg-subtle",link:"s-text-link"},g={primary:`border-0 rounded-8 ${V}`,secondary:`border-2 rounded-8 ${V}`,utility:`border rounded-4 ${V}`,negative:`border-0 rounded-8 ${V}`,pill:`p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${V}`,link:`bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${f.link}`},n={xsmall:"py-6 px-16",small:"py-8 px-16",medium:"py-10 px-14",large:"py-12 px-16",utility:"py-[11px] px-[15px]",smallUtility:"py-[7px] px-[15px]",pill:"min-h-[44px] min-w-[44px]",pillSmall:"min-h-32 min-w-32",link:"p-0"},s={medium:"text-m leading-[24]",xsmall:"text-xs"},i={inProgress:`border-transparent animate-inprogress pointer-events-none ${f.loading}`,quiet:`border-0 rounded-8 ${V}`,utilityQuiet:`border-0 rounded-4 ${V}`,negativeQuiet:`border-0 rounded-8 ${V}`,isDisabled:`font-bold justify-center transition-colors ease-in-out cursor-default pointer-events-none ${f.disabled}`},d={secondary:`${n.medium} ${s.medium} ${g.secondary} ${f.secondary}`,secondaryHref:`${n.medium} ${s.medium} ${g.secondary} ${f.secondary}`,secondaryDisabled:`${n.medium} ${s.medium} ${g.secondary} ${i.isDisabled}`,secondarySmall:`${s.xsmall} ${n.xsmall} ${g.secondary} ${f.secondary}`,secondarySmallDisabled:`${s.xsmall} ${n.xsmall} ${g.secondary} ${i.isDisabled}`,secondaryQuiet:`${n.medium} ${s.medium} ${i.quiet} ${f.quiet}`,secondaryQuietDisabled:`${n.medium} ${s.medium} ${i.quiet} ${i.isDisabled}`,secondarySmallQuiet:`${s.xsmall} ${n.xsmall} ${i.quiet} ${f.quiet}`,secondarySmallQuietDisabled:`${s.xsmall} ${n.xsmall} ${i.quiet} ${i.isDisabled}`,secondaryLoading:`${n.medium} ${s.medium} ${g.secondary} ${i.inProgress}`,secondarySmallLoading:`${s.xsmall} ${n.xsmall} ${g.secondary} ${i.inProgress}`,secondarySmallQuietLoading:`${s.xsmall} ${n.xsmall} ${i.quiet} ${i.inProgress}`,secondaryQuietLoading:`${n.medium} ${s.medium} ${i.quiet} ${i.inProgress}`,primary:`${n.large} ${s.medium} ${g.primary} ${f.primary}`,primaryDisabled:`${n.large} ${s.medium} ${i.isDisabled} ${g.primary}`,primarySmall:`${n.small} ${s.xsmall} ${g.primary} ${f.primary}`,primarySmallDisabled:`${n.small} ${s.xsmall} ${i.isDisabled} ${g.primary} `,primaryQuiet:`${n.large} ${s.medium} ${i.quiet} ${f.quiet}`,primaryQuietDisabled:`${n.large} ${s.medium} ${i.quiet} ${i.isDisabled}`,primarySmallQuiet:`${n.small} ${s.xsmall} ${i.quiet} ${f.quiet}`,primarySmallQuietDisabled:`${n.small} ${s.xsmall} ${i.quiet} ${i.isDisabled}`,primaryLoading:`${n.large} ${s.medium} ${i.inProgress} ${g.primary}`,primarySmallLoading:`${n.small} ${s.xsmall} ${i.inProgress} ${g.primary}`,primarySmallQuietLoading:`${n.small} ${s.xsmall} ${i.quiet} ${i.inProgress} ${g.primary}`,primaryQuietLoading:`${n.large} ${s.medium} ${i.quiet} ${i.inProgress}`,utility:`${n.utility} ${s.medium} ${g.utility} ${f.utility}`,utilityDisabled:`${n.utility} ${s.medium} ${g.utility} ${i.isDisabled}`,utilityQuiet:`${n.large} ${s.medium} ${i.utilityQuiet} ${f.utilityQuiet}`,utilityQuietDisabled:`${n.large} ${s.medium} ${i.utilityQuiet} ${i.isDisabled}`,utilitySmall:`${n.smallUtility} ${s.xsmall} ${g.utility} ${f.utility}`,utilitySmallDisabled:`${n.smallUtility} ${s.xsmall} ${g.utility} ${i.isDisabled}`,utilitySmallQuiet:`${n.smallUtility} ${s.xsmall} ${i.utilityQuiet} ${f.utilityQuiet}`,utilitySmallQuietDisabled:`${n.smallUtility} ${s.xsmall} ${i.utilityQuiet} ${i.isDisabled}`,utilityLoading:`${n.large} ${s.medium} ${g.utility} ${i.inProgress}`,utilitySmallLoading:`${n.smallUtility} ${s.xsmall} ${g.utility} ${i.inProgress}`,utilityQuietLoading:`${n.large} ${s.medium} ${i.inProgress} ${i.utilityQuiet}`,utilitySmallQuietLoading:`${n.smallUtility} ${s.xsmall} ${i.inProgress} ${i.utilityQuiet}`,negative:`${n.large} ${s.medium} ${g.negative} ${f.destructive}`,negativeDisabled:`${n.large} ${s.medium} ${g.negative} ${i.isDisabled}`,negativeQuiet:`${n.large} ${s.medium} ${i.negativeQuiet} ${f.negativeQuiet}`,negativeQuietDisabled:`${n.large} ${s.medium} ${i.negativeQuiet}${i.isDisabled}`,negativeSmall:`${n.small} ${s.xsmall} ${g.negative} ${f.destructive}`,negativeSmallDisabled:`${n.small} ${s.xsmall} ${g.negative} ${i.isDisabled}`,negativeSmallQuiet:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${f.negativeQuiet}`,negativeSmallQuietDisabled:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${i.isDisabled}`,negativeLoading:`${n.large} ${s.medium} ${g.negative} ${i.inProgress}`,negativeSmallLoading:`${n.small} ${s.xsmall} ${i.inProgress} ${g.negative}`,negativeQuietLoading:`${n.large} ${s.medium} ${i.negativeQuiet} ${g.negative} ${i.inProgress}`,negativeSmallQuietLoading:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${i.inProgress}`,pill:`${n.pill} ${s.medium} ${g.pill} ${f.pill}`,pillSmall:`${n.pillSmall} ${s.xsmall} ${g.pill} ${f.pill}`,pillLoading:`${n.pill} ${s.medium} ${g.pill} ${i.inProgress}`,pillSmallLoading:`${n.pillSmall} ${s.xsmall} ${g.pill} ${i.inProgress}`,link:`${n.link} ${s.medium} ${g.link}`,linkSmall:`${n.link} ${s.xsmall} ${g.link}`,linkAsButton:"inline-block active:no-underline hover:no-underline focus:no-underline text-center",a11y:"sr-only",fullWidth:"w-full max-w-full",contentWidth:"max-w-max"},y=class extends ee(je){constructor(){super();this.type="button";Me(De,Oe,Pe,Fe,Te),this.variant="secondary",this.ariaValueTextLoading=G._({id:"button.aria.loading",message:"Loading...",comment:"Screen reader message for buttons that are loading"})}updated(r){r.has("value")&&this.setValue(this.value)}connectedCallback(){if(super.connectedCallback(),!Ae.includes(this.variant))throw new Error(`Invalid "variant" attribute. Set its value to one of the following:
|
|
2655
|
-
${
|
|
2654
|
+
</a>`}};_.shadowRootOptions={...Te.shadowRootOptions,delegatesFocus:!0},_.styles=[te,Oe],m([Q({type:Boolean,reflect:!0})],_.prototype,"autofocus",2),m([Q({reflect:!0})],_.prototype,"variant",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"quiet",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"small",2),m([Q({reflect:!0})],_.prototype,"href",2),m([Q({type:Boolean,reflect:!0})],_.prototype,"disabled",2),m([Q({reflect:!0})],_.prototype,"target",2),m([Q({reflect:!0})],_.prototype,"rel",2),m([Q({attribute:"full-width",type:Boolean,reflect:!0})],_.prototype,"fullWidth",2),m([Q({attribute:"button-class",reflect:!0})],_.prototype,"buttonClass",2),m([Q({reflect:!0})],_.prototype,"name",2);customElements.get("w-link")||customElements.define("w-link",_);var je=JSON.parse('{"button.aria.loading":["Indl\xE6ser..."]}');var Ae=JSON.parse('{"button.aria.loading":["Loading..."]}');var Ne=JSON.parse('{"button.aria.loading":["Ladataan..."]}');var Ue=JSON.parse('{"button.aria.loading":["Laster..."]}');var Ye=JSON.parse('{"button.aria.loading":["Laddar ..."]}');import{css as Cr}from"lit";var Ie=Cr`*,:before,:after{--w-rotate:0;--w-rotate-x:0;--w-rotate-y:0;--w-rotate-z:0;--w-scale-x:1;--w-scale-y:1;--w-scale-z:1;--w-skew-x:0;--w-skew-y:0;--w-translate-x:0;--w-translate-y:0;--w-translate-z:0}.text-center{text-align:center}.animate-inprogress{background-size:30px 30px;animation:3s linear infinite animate-inprogress;background-image:linear-gradient(135deg,#0000000d 25%,#0000 0 50%,#0000000d 0 75%,#0000 0,#0000)!important}@keyframes animate-inprogress{0%{background-position:0 0}to{background-position:60px 0}}.hover\\:bg-clip-padding:hover{-webkit-background-clip:padding-box;background-clip:padding-box}.bg-transparent{background-color:#0000}.bg-\\[--w-color-button-primary-background\\]{background-color:var(--w-color-button-primary-background)}.hover\\:bg-\\[--w-color-button-pill-background-hover\\]:hover{background-color:var(--w-color-button-pill-background-hover)}.hover\\:bg-\\[--w-color-button-primary-background-hover\\]:hover{background-color:var(--w-color-button-primary-background-hover)}.active\\:bg-\\[--w-color-button-pill-background-active\\]:active{background-color:var(--w-color-button-pill-background-active)}.active\\:bg-\\[--w-color-button-primary-background-active\\]:active{background-color:var(--w-color-button-primary-background-active)}.border{border-width:1px}.border-0{border-width:0}.border-2{border-width:2px}.border-transparent{border-color:#0000}.rounded-4{border-radius:4px}.rounded-8{border-radius:8px}.rounded-full{border-radius:9999px}.inline-block{display:inline-block}.inline{display:inline}.inline-flex{display:inline-flex}.hover\\:underline:hover,.focus\\:underline:focus,.active\\:underline:active{text-decoration-line:underline}.hover\\:no-underline:hover,.focus\\:no-underline:focus,.active\\:no-underline:active{text-decoration:none}.focusable:focus{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:focus-visible{outline:2px solid var(--w-s-color-border-focus);outline-offset:var(--w-outline-offset,1px)}.focusable:not(:focus-visible){outline:none}.items-center{align-items:center}.justify-center{justify-content:center}.static{position:static}.s-bg{background-color:var(--w-s-color-background)}.s-bg-disabled{background-color:var(--w-s-color-background-disabled)}.s-bg-negative{background-color:var(--w-s-color-background-negative)}.s-bg-subtle{background-color:var(--w-s-color-background-subtle)}.hover\\:s-bg-hover:hover{background-color:var(--w-s-color-background-hover)}.hover\\:s-bg-negative-hover:hover{background-color:var(--w-s-color-background-negative-hover)}.hover\\:s-bg-negative-subtle-hover:hover{background-color:var(--w-s-color-background-negative-subtle-hover)}.active\\:s-bg-active:active{background-color:var(--w-s-color-background-active)}.active\\:s-bg-negative-active:active{background-color:var(--w-s-color-background-negative-active)}.active\\:s-bg-negative-subtle-active:active{background-color:var(--w-s-color-background-negative-subtle-active)}.s-text{color:var(--w-s-color-text)}.s-text-inverted{color:var(--w-s-color-text-inverted)}.s-text-link{color:var(--w-s-color-text-link)}.s-text-negative{color:var(--w-s-color-text-negative)}.s-icon{color:var(--w-s-color-icon)}.hover\\:s-icon-hover:hover{color:var(--w-s-color-icon-hover)}.active\\:s-icon-active:active{color:var(--w-s-color-icon-active)}.s-border{border-color:var(--w-s-color-border)}.hover\\:s-border-hover:hover{border-color:var(--w-s-color-border-hover)}.active\\:s-border-active:active{border-color:var(--w-s-color-border-active)}.max-w-full{max-width:100%}.max-w-max{max-width:max-content}.min-h-32{min-height:3.2rem}.min-w-32{min-width:3.2rem}.w-full{width:100%}.min-h-\\[44px\\]{min-height:44px}.min-w-\\[44px\\]{min-width:44px}.p-0{padding:0}.p-4{padding:.4rem}.px-14{padding-left:1.4rem;padding-right:1.4rem}.px-16{padding-left:1.6rem;padding-right:1.6rem}.py-10{padding-top:1rem;padding-bottom:1rem}.py-12{padding-top:1.2rem;padding-bottom:1.2rem}.py-6{padding-top:.6rem;padding-bottom:.6rem}.py-8{padding-top:.8rem;padding-bottom:.8rem}.px-\\[15px\\]{padding-left:15px;padding-right:15px}.py-\\[11px\\]{padding-top:11px;padding-bottom:11px}.py-\\[7px\\]{padding-top:7px;padding-bottom:7px}.cursor-default{cursor:default}.font-bold{font-weight:700}.pointer-events-none{pointer-events:none}.sr-only{clip:rect(0,0,0,0);white-space:nowrap;border-width:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-duration:.15s;transition-timing-function:cubic-bezier(.4,0,.2,1)}.ease-in-out{transition-timing-function:cubic-bezier(.4,0,.2,1)}.text-m{font-size:var(--w-font-size-m);line-height:var(--w-line-height-m)}.text-xs{font-size:var(--w-font-size-xs);line-height:var(--w-line-height-xs)}.leading-\\[24\\]{line-height:2.4rem}`;var Xe=["primary","secondary","negative","utility","pill","link"],V="font-bold focusable justify-center transition-colors ease-in-out",f={primary:"s-text-inverted bg-[--w-color-button-primary-background] hover:bg-[--w-color-button-primary-background-hover] active:bg-[--w-color-button-primary-background-active]",secondary:"s-text-link s-border s-bg hover:s-bg-hover hover:s-border-hover active:s-bg-active",utility:"s-text s-bg hover:s-bg-hover active:s-bg-active s-border hover:s-border-hover active:s-border-active",destructive:"s-bg-negative s-text-inverted hover:s-bg-negative-hover active:s-bg-negative-active",pill:"s-icon hover:s-icon-hover active:s-icon-active bg-transparent hover:bg-[--w-color-button-pill-background-hover] active:bg-[--w-color-button-pill-background-active]",disabled:"s-text-inverted s-bg-disabled",quiet:"bg-transparent s-text-link hover:s-bg-hover active:s-bg-active",utilityQuiet:"s-text bg-transparent hover:s-bg-hover active:s-bg-active",negativeQuiet:"bg-transparent s-text-negative hover:s-bg-negative-subtle-hover active:s-bg-negative-subtle-active",loading:"s-text s-bg-subtle",link:"s-text-link"},g={primary:`border-0 rounded-8 ${V}`,secondary:`border-2 rounded-8 ${V}`,utility:`border rounded-4 ${V}`,negative:`border-0 rounded-8 ${V}`,pill:`p-4 rounded-full border-0 inline-flex items-center justify-center hover:bg-clip-padding ${V}`,link:`bg-transparent focusable ease-in-out inline active:underline hover:underline focus:underline ${f.link}`},n={xsmall:"py-6 px-16",small:"py-8 px-16",medium:"py-10 px-14",large:"py-12 px-16",utility:"py-[11px] px-[15px]",smallUtility:"py-[7px] px-[15px]",pill:"min-h-[44px] min-w-[44px]",pillSmall:"min-h-32 min-w-32",link:"p-0"},s={medium:"text-m leading-[24]",xsmall:"text-xs"},i={inProgress:`border-transparent animate-inprogress pointer-events-none ${f.loading}`,quiet:`border-0 rounded-8 ${V}`,utilityQuiet:`border-0 rounded-4 ${V}`,negativeQuiet:`border-0 rounded-8 ${V}`,isDisabled:`font-bold justify-center transition-colors ease-in-out cursor-default pointer-events-none ${f.disabled}`},d={secondary:`${n.medium} ${s.medium} ${g.secondary} ${f.secondary}`,secondaryHref:`${n.medium} ${s.medium} ${g.secondary} ${f.secondary}`,secondaryDisabled:`${n.medium} ${s.medium} ${g.secondary} ${i.isDisabled}`,secondarySmall:`${s.xsmall} ${n.xsmall} ${g.secondary} ${f.secondary}`,secondarySmallDisabled:`${s.xsmall} ${n.xsmall} ${g.secondary} ${i.isDisabled}`,secondaryQuiet:`${n.medium} ${s.medium} ${i.quiet} ${f.quiet}`,secondaryQuietDisabled:`${n.medium} ${s.medium} ${i.quiet} ${i.isDisabled}`,secondarySmallQuiet:`${s.xsmall} ${n.xsmall} ${i.quiet} ${f.quiet}`,secondarySmallQuietDisabled:`${s.xsmall} ${n.xsmall} ${i.quiet} ${i.isDisabled}`,secondaryLoading:`${n.medium} ${s.medium} ${g.secondary} ${i.inProgress}`,secondarySmallLoading:`${s.xsmall} ${n.xsmall} ${g.secondary} ${i.inProgress}`,secondarySmallQuietLoading:`${s.xsmall} ${n.xsmall} ${i.quiet} ${i.inProgress}`,secondaryQuietLoading:`${n.medium} ${s.medium} ${i.quiet} ${i.inProgress}`,primary:`${n.large} ${s.medium} ${g.primary} ${f.primary}`,primaryDisabled:`${n.large} ${s.medium} ${i.isDisabled} ${g.primary}`,primarySmall:`${n.small} ${s.xsmall} ${g.primary} ${f.primary}`,primarySmallDisabled:`${n.small} ${s.xsmall} ${i.isDisabled} ${g.primary} `,primaryQuiet:`${n.large} ${s.medium} ${i.quiet} ${f.quiet}`,primaryQuietDisabled:`${n.large} ${s.medium} ${i.quiet} ${i.isDisabled}`,primarySmallQuiet:`${n.small} ${s.xsmall} ${i.quiet} ${f.quiet}`,primarySmallQuietDisabled:`${n.small} ${s.xsmall} ${i.quiet} ${i.isDisabled}`,primaryLoading:`${n.large} ${s.medium} ${i.inProgress} ${g.primary}`,primarySmallLoading:`${n.small} ${s.xsmall} ${i.inProgress} ${g.primary}`,primarySmallQuietLoading:`${n.small} ${s.xsmall} ${i.quiet} ${i.inProgress} ${g.primary}`,primaryQuietLoading:`${n.large} ${s.medium} ${i.quiet} ${i.inProgress}`,utility:`${n.utility} ${s.medium} ${g.utility} ${f.utility}`,utilityDisabled:`${n.utility} ${s.medium} ${g.utility} ${i.isDisabled}`,utilityQuiet:`${n.large} ${s.medium} ${i.utilityQuiet} ${f.utilityQuiet}`,utilityQuietDisabled:`${n.large} ${s.medium} ${i.utilityQuiet} ${i.isDisabled}`,utilitySmall:`${n.smallUtility} ${s.xsmall} ${g.utility} ${f.utility}`,utilitySmallDisabled:`${n.smallUtility} ${s.xsmall} ${g.utility} ${i.isDisabled}`,utilitySmallQuiet:`${n.smallUtility} ${s.xsmall} ${i.utilityQuiet} ${f.utilityQuiet}`,utilitySmallQuietDisabled:`${n.smallUtility} ${s.xsmall} ${i.utilityQuiet} ${i.isDisabled}`,utilityLoading:`${n.large} ${s.medium} ${g.utility} ${i.inProgress}`,utilitySmallLoading:`${n.smallUtility} ${s.xsmall} ${g.utility} ${i.inProgress}`,utilityQuietLoading:`${n.large} ${s.medium} ${i.inProgress} ${i.utilityQuiet}`,utilitySmallQuietLoading:`${n.smallUtility} ${s.xsmall} ${i.inProgress} ${i.utilityQuiet}`,negative:`${n.large} ${s.medium} ${g.negative} ${f.destructive}`,negativeDisabled:`${n.large} ${s.medium} ${g.negative} ${i.isDisabled}`,negativeQuiet:`${n.large} ${s.medium} ${i.negativeQuiet} ${f.negativeQuiet}`,negativeQuietDisabled:`${n.large} ${s.medium} ${i.negativeQuiet}${i.isDisabled}`,negativeSmall:`${n.small} ${s.xsmall} ${g.negative} ${f.destructive}`,negativeSmallDisabled:`${n.small} ${s.xsmall} ${g.negative} ${i.isDisabled}`,negativeSmallQuiet:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${f.negativeQuiet}`,negativeSmallQuietDisabled:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${i.isDisabled}`,negativeLoading:`${n.large} ${s.medium} ${g.negative} ${i.inProgress}`,negativeSmallLoading:`${n.small} ${s.xsmall} ${i.inProgress} ${g.negative}`,negativeQuietLoading:`${n.large} ${s.medium} ${i.negativeQuiet} ${g.negative} ${i.inProgress}`,negativeSmallQuietLoading:`${n.small} ${s.xsmall} ${i.negativeQuiet} ${i.inProgress}`,pill:`${n.pill} ${s.medium} ${g.pill} ${f.pill}`,pillSmall:`${n.pillSmall} ${s.xsmall} ${g.pill} ${f.pill}`,pillLoading:`${n.pill} ${s.medium} ${g.pill} ${i.inProgress}`,pillSmallLoading:`${n.pillSmall} ${s.xsmall} ${g.pill} ${i.inProgress}`,link:`${n.link} ${s.medium} ${g.link}`,linkSmall:`${n.link} ${s.xsmall} ${g.link}`,linkAsButton:"inline-block active:no-underline hover:no-underline focus:no-underline text-center",a11y:"sr-only",fullWidth:"w-full max-w-full",contentWidth:"max-w-max"},J,y=class extends re(Re){constructor(){super();this.type="button";xe(this,J,null);De(Ae,Ue,Ne,je,Ye),this.variant="secondary",this.ariaValueTextLoading=G._({id:"button.aria.loading",message:"Loading...",comment:"Screen reader message for buttons that are loading"})}updated(t){t.has("value")&&this.setValue(this.value)}connectedCallback(){if(super.connectedCallback(),!Xe.includes(this.variant))throw new Error(`Invalid "variant" attribute. Set its value to one of the following:
|
|
2655
|
+
${Xe.join(", ")}.`);ye(this,J,this.value)}firstUpdated(){this.autofocus&&!this.href&&setTimeout(()=>this.focus(),0)}get _primaryClasses(){return[!this.small&&!this.quiet&&!this.loading&&d.primary,this.small&&!this.quiet&&!this.loading&&d.primarySmall,this.small&&this.quiet&&!this.loading&&d.primarySmallQuiet,this.small&&this.loading&&(this.quiet?d.primarySmallQuietLoading:d.primarySmallLoading),!this.small&&this.quiet&&!this.loading&&d.primaryQuiet,!this.small&&this.loading&&(this.quiet?d.primaryQuietLoading:d.primaryLoading)]}get _secondaryClasses(){return[!this.small&&!this.quiet&&!this.loading&&d.secondary,this.small&&!this.quiet&&!this.loading&&d.secondarySmall,this.small&&this.loading&&(this.quiet?d.secondarySmallQuietLoading:d.secondarySmallLoading),this.small&&this.quiet&&!this.loading&&d.secondarySmallQuiet,!this.small&&this.quiet&&!this.loading&&d.secondaryQuiet,!this.small&&this.loading&&(this.quiet?d.secondaryQuietLoading:d.secondaryLoading)]}get _utilityClasses(){return[!this.small&&!this.quiet&&!this.loading&&d.utility,this.small&&!this.quiet&&!this.loading&&d.utilitySmall,this.small&&this.quiet&&!this.loading&&d.utilitySmallQuiet,this.small&&this.loading&&(this.quiet?d.utilitySmallQuietLoading:d.utilitySmallLoading),!this.small&&this.quiet&&!this.loading&&d.utilityQuiet,!this.small&&this.loading&&(this.quiet?d.utilityQuietLoading:d.utilityLoading)]}get _negativeClasses(){return[!this.small&&!this.quiet&&!this.loading&&d.negative,this.small&&!this.quiet&&!this.loading&&d.negativeSmall,this.small&&this.quiet&&!this.loading&&d.negativeSmallQuiet,this.small&&this.loading&&(this.quiet?d.negativeSmallQuietLoading:d.negativeSmallLoading),!this.small&&this.quiet&&!this.loading&&d.negativeQuiet,!this.small&&this.loading&&(this.quiet?d.negativeQuietLoading:d.negativeLoading)]}get _pillClasses(){return[!this.loading&&(this.small?d.pillSmall:d.pill),this.loading&&(this.small?d.pillSmallLoading:d.pillLoading)]}get _linkClasses(){return[this.small?d.linkSmall:d.link]}get _classes(){return le(this.buttonClass,[this.variant==="primary"&&this._primaryClasses,this.variant==="secondary"&&this._secondaryClasses,this.variant==="utility"&&this._utilityClasses,this.variant==="negative"&&this._negativeClasses,this.variant==="pill"&&this._pillClasses,this.variant==="link"&&this._linkClasses,this.href&&d.linkAsButton,this.fullWidth?d.fullWidth:d.contentWidth])}_handleButtonClick(){this.type==="submit"?this.internals.form.requestSubmit():this.type==="reset"&&this.internals.form.reset()}resetFormControl(){this.value=we(this,J)}render(){return oe` ${this.href?oe`<w-link
|
|
2656
2656
|
href=${this.href}
|
|
2657
2657
|
target=${this.target}
|
|
2658
2658
|
variant=${this.variant}
|
|
@@ -2664,8 +2664,8 @@ ${Ae.join(", ")}.`)}firstUpdated(){this.autofocus&&!this.href&&setTimeout(()=>th
|
|
|
2664
2664
|
class=${this.buttonClass}
|
|
2665
2665
|
rel=${this.target==="_blank"?this.rel||"noopener":void 0}>
|
|
2666
2666
|
<slot></slot>
|
|
2667
|
-
</w-link>`:
|
|
2667
|
+
</w-link>`:oe`<button type=${this.type||"button"} class=${this._classes} @click="${this._handleButtonClick}">
|
|
2668
2668
|
<slot></slot>
|
|
2669
2669
|
</button>`}
|
|
2670
|
-
${this.loading?
|
|
2670
|
+
${this.loading?oe`<span class="sr-only" role="progressbar" aria-valuenow="{0}" aria-valuetext=${this.ariaValueTextLoading}></span>`:null}`}};J=new WeakMap,y.shadowRootOptions={...Re.shadowRootOptions,delegatesFocus:!0},y.styles=[te,Ie,zr`:host([full-width]) { width: 100%; }`],m([S({reflect:!0})],y.prototype,"type",2),m([S({type:Boolean,reflect:!0})],y.prototype,"autofocus",2),m([S({reflect:!0})],y.prototype,"variant",2),m([S({type:Boolean,reflect:!0})],y.prototype,"quiet",2),m([S({type:Boolean,reflect:!0})],y.prototype,"small",2),m([S({type:Boolean,reflect:!0})],y.prototype,"loading",2),m([S({reflect:!0})],y.prototype,"href",2),m([S({reflect:!0})],y.prototype,"target",2),m([S({reflect:!0})],y.prototype,"rel",2),m([S({attribute:"full-width",type:Boolean,reflect:!0})],y.prototype,"fullWidth",2),m([S({attribute:"button-class",reflect:!0})],y.prototype,"buttonClass",2),m([S({reflect:!0})],y.prototype,"name",2),m([S({reflect:!0})],y.prototype,"value",2);customElements.get("w-button")||customElements.define("w-button",y);export{y as WarpButton};
|
|
2671
2671
|
//# sourceMappingURL=index.js.map
|