@warp-ds/elements 2.8.2-next.1 → 2.8.2-next.2

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.
Files changed (84) hide show
  1. package/dist/custom-elements.json +37 -60
  2. package/dist/index.d.ts +3 -25
  3. package/dist/packages/affix/affix.js +5 -5
  4. package/dist/packages/affix/affix.js.map +3 -3
  5. package/dist/packages/alert/alert.d.ts +1 -0
  6. package/dist/packages/alert/alert.js +7 -7
  7. package/dist/packages/alert/alert.js.map +3 -3
  8. package/dist/packages/alert/alert.test.js +21 -0
  9. package/dist/packages/attention/attention.js +9 -9
  10. package/dist/packages/attention/attention.js.map +3 -3
  11. package/dist/packages/badge/badge.js +2 -2
  12. package/dist/packages/badge/badge.js.map +3 -3
  13. package/dist/packages/badge/badge.test.js +14 -0
  14. package/dist/packages/breadcrumbs/breadcrumbs.d.ts +1 -1
  15. package/dist/packages/breadcrumbs/breadcrumbs.js +7 -7
  16. package/dist/packages/breadcrumbs/breadcrumbs.js.map +3 -3
  17. package/dist/packages/breadcrumbs/breadcrumbs.test.js +3 -1
  18. package/dist/packages/button/button.js +7 -7
  19. package/dist/packages/button/button.js.map +3 -3
  20. package/dist/packages/combobox/combobox.js +2 -2
  21. package/dist/packages/combobox/combobox.js.map +2 -2
  22. package/dist/packages/combobox/combobox.test.js +5 -2
  23. package/dist/packages/datepicker/datepicker.js +5 -5
  24. package/dist/packages/datepicker/datepicker.js.map +3 -3
  25. package/dist/packages/expandable/expandable.js +11 -11
  26. package/dist/packages/expandable/expandable.js.map +3 -3
  27. package/dist/packages/icon/icon.js +2 -2
  28. package/dist/packages/icon/icon.js.map +3 -3
  29. package/dist/packages/icon/icon.test.d.ts +1 -0
  30. package/dist/packages/icon/icon.test.js +51 -0
  31. package/dist/packages/link/link.js +4 -4
  32. package/dist/packages/link/link.js.map +3 -3
  33. package/dist/packages/link/link.test.js +14 -0
  34. package/dist/packages/modal-header/modal-header.js +1 -1
  35. package/dist/packages/modal-header/modal-header.js.map +3 -3
  36. package/dist/packages/page-indicator/page-indicator.js +7 -7
  37. package/dist/packages/page-indicator/page-indicator.js.map +3 -3
  38. package/dist/packages/page-indicator/page-indicator.test.js +23 -0
  39. package/dist/packages/pagination/pagination.d.ts +4 -0
  40. package/dist/packages/pagination/pagination.js +14 -14
  41. package/dist/packages/pagination/pagination.js.map +3 -3
  42. package/dist/packages/pagination/pagination.react.stories.d.ts +1 -1
  43. package/dist/packages/pagination/pagination.test.js +18 -0
  44. package/dist/packages/pill/pill.js +5 -5
  45. package/dist/packages/pill/pill.js.map +3 -3
  46. package/dist/packages/radio/radio.a11y.test.js +15 -6
  47. package/dist/packages/radio/radio.js +2 -2
  48. package/dist/packages/radio/radio.js.map +2 -2
  49. package/dist/packages/radio/radio.test.js +7 -7
  50. package/dist/packages/radio-group/radio-group.js +9 -9
  51. package/dist/packages/radio-group/radio-group.js.map +2 -2
  52. package/dist/packages/radio-group/radio-group.test.js +3 -2
  53. package/dist/packages/select/select.js +13 -13
  54. package/dist/packages/select/select.js.map +3 -3
  55. package/dist/packages/slider/slider.test.js +41 -0
  56. package/dist/packages/slider-thumb/slider-thumb.js +1 -1
  57. package/dist/packages/slider-thumb/slider-thumb.js.map +2 -2
  58. package/dist/packages/step/step.d.ts +1 -0
  59. package/dist/packages/step/step.js +4 -4
  60. package/dist/packages/step/step.js.map +3 -3
  61. package/dist/packages/step-indicator/step-indicator.a11y.test.js +3 -1
  62. package/dist/packages/switch/switch.a11y.test.js +10 -6
  63. package/dist/packages/switch/switch.js +2 -2
  64. package/dist/packages/switch/switch.js.map +3 -3
  65. package/dist/packages/switch/switch.test.js +0 -5
  66. package/dist/packages/tab/tab.d.ts +2 -0
  67. package/dist/packages/tab/tab.js +5 -5
  68. package/dist/packages/tab/tab.js.map +3 -3
  69. package/dist/packages/tab-panel/tab-panel.d.ts +2 -1
  70. package/dist/packages/tab-panel/tab-panel.js +7 -3
  71. package/dist/packages/tab-panel/tab-panel.js.map +3 -3
  72. package/dist/packages/tabs/tabs.a11y.test.js +16 -7
  73. package/dist/packages/tabs/tabs.js +1 -1
  74. package/dist/packages/tabs/tabs.js.map +2 -2
  75. package/dist/packages/tabs/tabs.test.js +45 -1
  76. package/dist/packages/textfield/textfield.js +2 -2
  77. package/dist/packages/textfield/textfield.js.map +2 -2
  78. package/dist/packages/textfield/textfield.test.js +26 -0
  79. package/dist/packages/toast/toast.js +3 -3
  80. package/dist/packages/toast/toast.js.map +3 -3
  81. package/dist/packages/toast/toast.test.d.ts +1 -0
  82. package/dist/packages/toast/toast.test.js +58 -0
  83. package/dist/web-types.json +18 -52
  84. package/package.json +4 -3
@@ -1,4 +1,4 @@
1
- var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var r=(i,o,e,s)=>{for(var t=s>1?void 0:s?w(o,e):o,c=i.length-1,a;c>=0;c--)(a=i[c])&&(t=(s?a(o,e,t):a(t))||t);return s&&t&&h(o,e,t),t};import{html as g,LitElement as v}from"lit";import{property as l,state as f}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{css as d}from"lit";var p=d`
1
+ var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var c=(i,o,e,s)=>{for(var t=s>1?void 0:s?w(o,e):o,r=i.length-1,a;r>=0;r--)(a=i[r])&&(t=(s?a(o,e,t):a(t))||t);return s&&t&&h(o,e,t),t};import{html as d,LitElement as v}from"lit";import{property as l,state as f}from"lit/decorators.js";import{classMap as u}from"lit/directives/class-map.js";import{css as g}from"lit";var p=g`
2
2
  :host {
3
3
  display: inline-block;
4
4
  }
@@ -23,5 +23,5 @@ var h=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var r=(i,o,e,s
23
23
  --w-icon-size: 32px;
24
24
  }
25
25
 
26
- `;var m=new Map,y='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function z(i,o={}){var s;let e=(s=o.responseParser)!=null?s:(t=>t.text());return m.has(i)||m.set(i,fetch(i).then(e)),m.get(i)}var n=class extends v{constructor(){super(...arguments);this.name="";this.size="medium";this.locale="en";this.svg=null}async fetchIcon(e){let s=`https://assets.finn.no/pkg/eikons/v1/${this.locale}/${e}.svg`;try{let t=await z(s);return new DOMParser().parseFromString(t,"text/html").body.querySelector("svg")}catch(t){return null}}firstUpdated(){this.loadIcon()}updated(e){(e.has("name")||e.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let e=await this.fetchIcon(this.name);e||(e=new DOMParser().parseFromString(y,"text/html").body.firstElementChild),this.svg=e}render(){let e={"w-icon":!0,"w-icon--s":this.size==="small","w-icon--m":this.size==="medium","w-icon--l":this.size==="large"},s=typeof this.size=="string"&&this.size.endsWith("px")?`--w-icon-size: ${this.size};`:"";return g`<div class="${u(e)}" style="${s}" part="w-${this.name.toLowerCase()}">${this.svg}</div>`}};n.styles=[p],r([l({type:String,reflect:!0})],n.prototype,"name",2),r([l({type:String,reflect:!0})],n.prototype,"size",2),r([l({type:String,reflect:!0})],n.prototype,"locale",2),r([f()],n.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",n);export{n as WIcon};
26
+ `;var m=new Map,y='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function x(i,o={}){var s;let e=(s=o.responseParser)!=null?s:(t=>t.text());return m.has(i)||m.set(i,fetch(i).then(e)),m.get(i)}var n=class extends v{constructor(){super(...arguments);this.name="";this.svg=null}async fetchIcon(e){let t=`https://assets.finn.no/pkg/eikons/v1/${this.locale||"en"}/${e}.svg`;try{let r=await x(t);return new DOMParser().parseFromString(r,"text/html").body.querySelector("svg")}catch(r){return null}}firstUpdated(){this.loadIcon()}updated(e){(e.has("name")||e.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let e=await this.fetchIcon(this.name);e||(e=new DOMParser().parseFromString(y,"text/html").body.firstElementChild),this.svg=e}render(){let e=this.size||"medium",s={"w-icon":!0,"w-icon--s":e==="small","w-icon--m":e==="medium","w-icon--l":e==="large"},t=typeof e=="string"&&e.endsWith("px")?`--w-icon-size: ${e};`:"";return d`<div class="${u(s)}" style="${t}" part="w-${this.name.toLowerCase()}">${this.svg}</div>`}};n.styles=[p],c([l({type:String,reflect:!0})],n.prototype,"name",2),c([l({type:String,reflect:!0})],n.prototype,"size",2),c([l({type:String,reflect:!0})],n.prototype,"locale",2),c([f()],n.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",n);export{n as WIcon};
27
27
  //# sourceMappingURL=icon.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../packages/icon/icon.ts", "../../../packages/icon/style.ts"],
4
- "sourcesContent": ["import { html, LitElement, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './style.js';\n\n// Generic parser for fetch responses\ntype ResponseParser<T> = (response: Response) => Promise<T>;\n\ninterface CacheFetchOptions<T> {\n responseParser?: ResponseParser<T>;\n}\n\nconst _fetchMap = new Map<string, Promise<any>>();\nconst ERROR_SVG = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>';\n\n/**\n * A minimal in-memory map to de-duplicate Fetch API media requests.\n *\n * @param uri - Resource URL\n * @param options - Optional parser for the response\n * @returns Promise of parsed response\n */\nfunction cacheFetch<T = string>(uri: string, options: CacheFetchOptions<T> = {}): Promise<T> {\n const parser = options.responseParser ?? ((res: Response) => res.text() as Promise<any>);\n if (!_fetchMap.has(uri)) {\n _fetchMap.set(uri, fetch(uri).then(parser));\n }\n return _fetchMap.get(uri) as Promise<T>;\n}\n\nexport class WIcon extends LitElement {\n static styles = [styles];\n\n /** Icon filename (without .svg) */\n @property({ type: String, reflect: true })\n name = '';\n\n /** Size: small, medium, large or pixel value (e.g. \"32px\") */\n @property({ type: String, reflect: true })\n size: 'small' | 'medium' | 'large' | string = 'medium';\n\n /** Locale used in CDN URL */\n @property({ type: String, reflect: true })\n locale = 'en';\n\n /** Parsed SVG element (not reflected as attribute) */\n @state()\n private svg: SVGElement | null = null;\n\n /**\n * Fetch an icon SVG from the CDN, with caching\n * @param iconName - Name of the icon file\n * @returns SVGElement or null on failure\n */\n private async fetchIcon(iconName: string): Promise<SVGElement | null> {\n const uri = `https://assets.finn.no/pkg/eikons/v1/${this.locale}/${iconName}.svg`;\n try {\n const svgText = await cacheFetch<string>(uri);\n const doc = new DOMParser().parseFromString(svgText, 'text/html');\n return doc.body.querySelector('svg');\n } catch {\n return null;\n }\n }\n\n protected firstUpdated(): void {\n this.loadIcon();\n }\n\n protected updated(changedProps: Map<string, unknown>): void {\n if (changedProps.has('name') || changedProps.has('locale')) {\n this.loadIcon();\n }\n }\n\n private async loadIcon(): Promise<void> {\n if (!this.name) {\n this.svg = null;\n return;\n }\n\n let iconEl = await this.fetchIcon(this.name);\n if (!iconEl) {\n const doc = new DOMParser().parseFromString(ERROR_SVG, 'text/html');\n iconEl = doc.body.firstElementChild as SVGElement;\n }\n this.svg = iconEl;\n }\n\n render(): TemplateResult {\n const classes = {\n 'w-icon': true,\n 'w-icon--s': this.size === 'small',\n 'w-icon--m': this.size === 'medium',\n 'w-icon--l': this.size === 'large',\n };\n const customStyle = typeof this.size === 'string' && this.size.endsWith('px') ? `--w-icon-size: ${this.size};` : '';\n return html`<div class=\"${classMap(classes)}\" style=\"${customStyle}\" part=\"w-${this.name.toLowerCase()}\">${this.svg}</div>`;\n }\n}\n\nif (!customElements.get('w-icon')) {\n customElements.define('w-icon', WIcon);\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n:host {\n display: inline-block;\n}\n.w-icon {\n --_w-icon-size: var(--w-icon-size, 24px);\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n display: flex;\n}\n.w-icon svg {\n pointer-events: none;\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n}\n.w-icon--s {\n --w-icon-size: 16px;\n}\n.w-icon--m {\n --w-icon-size: 24px;\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CAEA,IAAIC,EAAS,MAAM,KAAK,UAAU,KAAK,IAAI,EACtCA,IAEHA,EADY,IAAI,UAAU,EAAE,gBAAgBb,EAAW,WAAW,EACrD,KAAK,mBAEpB,KAAK,IAAMa,CACb,CAEA,QAAyB,CACvB,IAAMC,EAAU,CACd,SAAU,GACV,YAAa,KAAK,OAAS,QAC3B,YAAa,KAAK,OAAS,SAC3B,YAAa,KAAK,OAAS,OAC7B,EACMC,EAAc,OAAO,KAAK,MAAS,UAAY,KAAK,KAAK,SAAS,IAAI,EAAI,kBAAkB,KAAK,IAAI,IAAM,GACjH,OAAOC,gBAAmBC,EAASH,CAAO,CAAC,YAAYC,CAAW,aAAa,KAAK,KAAK,YAAY,CAAC,KAAK,KAAK,GAAG,QACrH,CACF,EArEaR,EACJ,OAAS,CAACW,CAAM,EAIvBC,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAJ9Bb,EAKX,oBAIAY,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAR9Bb,EASX,oBAIAY,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAZ9Bb,EAaX,sBAIQY,EAAA,CADPE,EAAM,GAhBId,EAiBH,mBAsDL,eAAe,IAAI,QAAQ,GAC9B,eAAe,OAAO,SAAUA,CAAK",
6
- "names": ["html", "LitElement", "property", "state", "classMap", "css", "styles", "_fetchMap", "ERROR_SVG", "cacheFetch", "uri", "options", "_a", "parser", "res", "WIcon", "LitElement", "iconName", "svgText", "e", "changedProps", "iconEl", "classes", "customStyle", "html", "classMap", "styles", "__decorateClass", "property", "state"]
4
+ "sourcesContent": ["import { html, LitElement, TemplateResult } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './style.js';\n\n// Generic parser for fetch responses\ntype ResponseParser<T> = (response: Response) => Promise<T>;\n\ninterface CacheFetchOptions<T> {\n responseParser?: ResponseParser<T>;\n}\n\nconst _fetchMap = new Map<string, Promise<any>>();\nconst ERROR_SVG = '<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 32 32\"></svg>';\n\n/**\n * A minimal in-memory map to de-duplicate Fetch API media requests.\n *\n * @param uri - Resource URL\n * @param options - Optional parser for the response\n * @returns Promise of parsed response\n */\nfunction cacheFetch<T = string>(uri: string, options: CacheFetchOptions<T> = {}): Promise<T> {\n const parser = options.responseParser ?? ((res: Response) => res.text() as Promise<any>);\n if (!_fetchMap.has(uri)) {\n _fetchMap.set(uri, fetch(uri).then(parser));\n }\n return _fetchMap.get(uri) as Promise<T>;\n}\n\nexport class WIcon extends LitElement {\n static styles = [styles];\n\n /** Icon filename (without .svg) */\n @property({ type: String, reflect: true })\n name = '';\n\n /** Size: small, medium, large or pixel value (e.g. \"32px\") */\n @property({ type: String, reflect: true })\n size: 'small' | 'medium' | 'large' | string;\n\n /** Locale used in CDN URL */\n @property({ type: String, reflect: true })\n locale: string;\n\n /** Parsed SVG element (not reflected as attribute) */\n @state()\n private svg: SVGElement | null = null;\n\n /**\n * Fetch an icon SVG from the CDN, with caching\n * @param iconName - Name of the icon file\n * @returns SVGElement or null on failure\n */\n private async fetchIcon(iconName: string): Promise<SVGElement | null> {\n const locale = this.locale || 'en';\n const uri = `https://assets.finn.no/pkg/eikons/v1/${locale}/${iconName}.svg`;\n try {\n const svgText = await cacheFetch<string>(uri);\n const doc = new DOMParser().parseFromString(svgText, 'text/html');\n return doc.body.querySelector('svg');\n } catch {\n return null;\n }\n }\n\n protected firstUpdated(): void {\n this.loadIcon();\n }\n\n protected updated(changedProps: Map<string, unknown>): void {\n if (changedProps.has('name') || changedProps.has('locale')) {\n this.loadIcon();\n }\n }\n\n private async loadIcon(): Promise<void> {\n if (!this.name) {\n this.svg = null;\n return;\n }\n\n let iconEl = await this.fetchIcon(this.name);\n if (!iconEl) {\n const doc = new DOMParser().parseFromString(ERROR_SVG, 'text/html');\n iconEl = doc.body.firstElementChild as SVGElement;\n }\n this.svg = iconEl;\n }\n\n render(): TemplateResult {\n const size = this.size || 'medium';\n const classes = {\n 'w-icon': true,\n 'w-icon--s': size === 'small',\n 'w-icon--m': size === 'medium',\n 'w-icon--l': size === 'large',\n };\n const customStyle = typeof size === 'string' && size.endsWith('px') ? `--w-icon-size: ${size};` : '';\n return html`<div class=\"${classMap(classes)}\" style=\"${customStyle}\" part=\"w-${this.name.toLowerCase()}\">${this.svg}</div>`;\n }\n}\n\nif (!customElements.get('w-icon')) {\n customElements.define('w-icon', WIcon);\n}\n", "import { css } from 'lit';\n\nexport const styles = css`\n:host {\n display: inline-block;\n}\n.w-icon {\n --_w-icon-size: var(--w-icon-size, 24px);\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n display: flex;\n}\n.w-icon svg {\n pointer-events: none;\n height: var(--_w-icon-size);\n width: var(--_w-icon-size);\n}\n.w-icon--s {\n --w-icon-size: 16px;\n}\n.w-icon--m {\n --w-icon-size: 24px;\n}\n.w-icon--l {\n --w-icon-size: 32px;\n}\n\n`;\n"],
5
+ "mappings": "wMAAA,OAAS,QAAAA,EAAM,cAAAC,MAAkC,MACjD,OAAS,YAAAC,EAAU,SAAAC,MAAa,oBAChC,OAAS,YAAAC,MAAgB,8BCFzB,OAAS,OAAAC,MAAW,MAEb,IAAMC,EAASD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;EDUtB,IAAME,EAAY,IAAI,IAChBC,EAAY,qEASlB,SAASC,EAAuBC,EAAaC,EAAgC,CAAC,EAAe,CAtB7F,IAAAC,EAuBE,IAAMC,GAASD,EAAAD,EAAQ,iBAAR,KAAAC,GAA4BE,GAAkBA,EAAI,KAAK,GACtE,OAAKP,EAAU,IAAIG,CAAG,GACpBH,EAAU,IAAIG,EAAK,MAAMA,CAAG,E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,EAAK,CAAC,GAR9Bd,EASX,oBAIAa,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAZ9Bd,EAaX,sBAIQa,EAAA,CADPE,EAAM,GAhBIf,EAiBH,mBAwDL,eAAe,IAAI,QAAQ,GAC9B,eAAe,OAAO,SAAUA,CAAK",
6
+ "names": ["html", "LitElement", "property", "state", "classMap", "css", "styles", "_fetchMap", "ERROR_SVG", "cacheFetch", "uri", "options", "_a", "parser", "res", "WIcon", "LitElement", "iconName", "svgText", "e", "changedProps", "iconEl", "size", "classes", "customStyle", "html", "classMap", "styles", "__decorateClass", "property", "state"]
7
7
  }
@@ -0,0 +1 @@
1
+ import './icon.js';
@@ -0,0 +1,51 @@
1
+ import { html } from 'lit';
2
+ import { expect, test } from 'vitest';
3
+ import { render } from 'vitest-browser-lit';
4
+ import './icon.js';
5
+ test('renders the icon', async () => {
6
+ const component = html `<w-icon name="Plus" data-testid="icon"></w-icon>`;
7
+ const page = render(component);
8
+ await expect.element(page.getByTestId('icon')).toBeVisible();
9
+ });
10
+ test('defaults to medium size when no size attribute is set', async () => {
11
+ const component = html `<w-icon name="Plus" data-testid="icon"></w-icon>`;
12
+ const page = render(component);
13
+ const el = page.getByTestId('icon').element();
14
+ // The size attribute should not be reflected (to avoid hydration mismatch)
15
+ expect(el.hasAttribute('size')).toBe(false);
16
+ // But the medium size class should still be applied
17
+ await expect
18
+ .poll(() => {
19
+ const inner = el.shadowRoot?.querySelector('.w-icon');
20
+ return inner?.classList.contains('w-icon--m');
21
+ })
22
+ .toBe(true);
23
+ });
24
+ test('defaults to en locale when no locale attribute is set', async () => {
25
+ const component = html `<w-icon name="Plus" data-testid="icon"></w-icon>`;
26
+ const page = render(component);
27
+ const el = page.getByTestId('icon').element();
28
+ // The locale attribute should not be reflected (to avoid hydration mismatch)
29
+ expect(el.hasAttribute('locale')).toBe(false);
30
+ });
31
+ test('uses specified size when size attribute is set', async () => {
32
+ const component = html `<w-icon name="Plus" size="small" data-testid="icon"></w-icon>`;
33
+ const page = render(component);
34
+ const el = page.getByTestId('icon').element();
35
+ // The size attribute should be reflected
36
+ expect(el.getAttribute('size')).toBe('small');
37
+ // And the small size class should be applied
38
+ await expect
39
+ .poll(() => {
40
+ const inner = el.shadowRoot?.querySelector('.w-icon');
41
+ return inner?.classList.contains('w-icon--s');
42
+ })
43
+ .toBe(true);
44
+ });
45
+ test('uses specified locale when locale attribute is set', async () => {
46
+ const component = html `<w-icon name="Plus" locale="nb" data-testid="icon"></w-icon>`;
47
+ const page = render(component);
48
+ const el = page.getByTestId('icon').element();
49
+ // The locale attribute should be reflected
50
+ expect(el.getAttribute('locale')).toBe('nb');
51
+ });
@@ -1,4 +1,4 @@
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`
1
+ var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var o=(d,n,r,i)=>{for(var a=i>1?void 0:i?h(n,r):n,c=d.length-1,l;c>=0;c--)(l=d[c])&&(a=(i?l(n,r,a):l(a))||a);return i&&a&&u(n,r,a),a};import{html as m,LitElement as g}from"lit";import{property as t}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 {
@@ -2671,12 +2671,12 @@ var u=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var e=(d,a,i,n
2671
2671
  100% {
2672
2672
  background-position: 60px 0;
2673
2673
  }
2674
- }`;var p=["primary","secondary","negative","negativeQuiet","utility","utilityQuiet","quiet","link","overlay","overlayInverted","overlayQuiet","overlayInvertedQuiet"],r=class extends g{constructor(){super(...arguments);this.autofocus=!1;this.variant="secondary";this.small=!1;this.disabled=!1;this.fullWidth=!1}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
2674
+ }`;var p=["primary","secondary","negative","negativeQuiet","utility","utilityQuiet","quiet","link","overlay","overlayInverted","overlayQuiet","overlayInvertedQuiet"],e=class extends g{constructor(){super(...arguments);this.autofocus=!1;this.small=!1;this.disabled=!1;this.fullWidth=!1}connectedCallback(){if(super.connectedCallback(),this.variant&&!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 r=this.variant||"secondary",i={"w-button":r!=="link","w-button--primary":r==="primary","w-button--secondary":r==="secondary"||!this.variant,"w-button--negative":r==="negative","w-button--utility":r==="utility","w-button--quiet":r==="quiet","w-button--negative-quiet":r==="negativeQuiet","w-button--utility-quiet":r==="utilityQuiet","w-button--overlay":r==="overlay","w-button--overlay-inverted":r==="overlayInverted","w-button--overlay-quiet":r==="overlayQuiet","w-button--overlay-inverted-quiet":r==="overlayInvertedQuiet","w-button--small":this.small,"w-button--full-width":this.fullWidth,"w-button--disabled":this.disabled};return m`<a
2676
2676
  href=${this.href}
2677
2677
  target=${this.target}
2678
2678
  rel=${this.target==="_blank"?this.rel||"noopener":void 0}
2679
2679
  class=${f(i)}>
2680
2680
  <slot></slot>
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};
2681
+ </a>`}};e.shadowRootOptions={...g.shadowRootOptions,delegatesFocus:!0},e.styles=[b,v],o([t({type:Boolean,reflect:!0})],e.prototype,"autofocus",2),o([t({reflect:!0})],e.prototype,"variant",2),o([t({type:Boolean,reflect:!0})],e.prototype,"small",2),o([t({reflect:!0})],e.prototype,"href",2),o([t({type:Boolean,reflect:!0})],e.prototype,"disabled",2),o([t({reflect:!0})],e.prototype,"target",2),o([t({reflect:!0})],e.prototype,"rel",2),o([t({attribute:"full-width",type:Boolean,reflect:!0})],e.prototype,"fullWidth",2);customElements.get("w-link")||customElements.define("w-link",e);export{e as WarpLink};
2682
2682
  //# sourceMappingURL=link.js.map