@warp-ds/elements 2.9.0-next.1 → 2.9.0-next.3
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 +17 -10
- package/dist/docs/affix/affix.md +56 -0
- package/dist/docs/affix/api.md +48 -0
- package/dist/docs/alert/accessibility.md +30 -0
- package/dist/docs/alert/alert.md +208 -0
- package/dist/docs/alert/api.md +39 -0
- package/dist/docs/alert/examples.md +84 -0
- package/dist/docs/alert/usage.md +42 -0
- package/dist/docs/attention/api.md +132 -0
- package/dist/docs/attention/attention.md +138 -0
- package/dist/docs/badge/api.md +28 -0
- package/dist/docs/badge/badge.md +36 -0
- package/dist/docs/box/api.md +52 -0
- package/dist/docs/box/box.md +60 -0
- package/dist/docs/breadcrumbs/api.md +20 -0
- package/dist/docs/breadcrumbs/breadcrumbs.md +28 -0
- package/dist/docs/button/api.md +155 -0
- package/dist/docs/button/button.md +163 -0
- package/dist/docs/card/api.md +44 -0
- package/dist/docs/card/card.md +52 -0
- package/dist/docs/combobox/api.md +132 -0
- package/dist/docs/combobox/combobox.md +140 -0
- package/dist/docs/datepicker/api.md +192 -0
- package/dist/docs/datepicker/datepicker.md +202 -0
- package/dist/docs/expandable/api.md +100 -0
- package/dist/docs/expandable/expandable.md +108 -0
- package/dist/docs/link/api.md +87 -0
- package/dist/docs/link/link.md +95 -0
- package/dist/docs/page-indicator/api.md +28 -0
- package/dist/docs/page-indicator/page-indicator.md +35 -0
- package/dist/docs/pagination/api.md +44 -0
- package/dist/docs/pagination/pagination.md +52 -0
- package/dist/docs/pill/api.md +76 -0
- package/dist/docs/pill/pill.md +84 -0
- package/dist/docs/select/api.md +116 -0
- package/dist/docs/select/select.md +124 -0
- package/dist/docs/slider/api.md +214 -0
- package/dist/docs/slider/slider.md +222 -0
- package/dist/docs/slider-thumb/api.md +116 -0
- package/dist/docs/slider-thumb/slider-thumb.md +124 -0
- package/dist/docs/step/api.md +28 -0
- package/dist/docs/step/step.md +34 -0
- package/dist/docs/step-indicator/api.md +28 -0
- package/dist/docs/step-indicator/step-indicator.md +36 -0
- package/dist/docs/switch/api.md +52 -0
- package/dist/docs/switch/switch.md +58 -0
- package/dist/docs/tab/api.md +76 -0
- package/dist/docs/tab/tab.md +84 -0
- package/dist/docs/tab-panel/api.md +21 -0
- package/dist/docs/tab-panel/tab-panel.md +30 -0
- package/dist/docs/tabs/api.md +36 -0
- package/dist/docs/tabs/tabs.md +44 -0
- package/dist/docs/textarea/api.md +156 -0
- package/dist/docs/textarea/textarea.md +164 -0
- package/dist/docs/textfield/api.md +194 -0
- package/dist/docs/textfield/textfield.md +202 -0
- package/dist/docs/toast-container/api.md +14 -0
- package/dist/docs/toast-container/toast-container.md +20 -0
- package/dist/index.d.ts +0 -2
- package/dist/packages/affix/affix.js +5 -5
- package/dist/packages/affix/affix.js.map +2 -2
- package/dist/packages/alert/alert.d.ts +15 -0
- package/dist/packages/alert/alert.js +6 -6
- package/dist/packages/alert/alert.js.map +2 -2
- package/dist/packages/alert/alert.test.js +1 -1
- package/dist/packages/attention/attention.d.ts +0 -1
- package/dist/packages/attention/attention.js +21 -21
- package/dist/packages/attention/attention.js.map +4 -4
- package/dist/packages/datepicker/DatePicker.test.js +5 -5
- package/dist/packages/datepicker/datepicker.js +1 -1
- package/dist/packages/datepicker/datepicker.js.map +2 -2
- package/dist/packages/expandable/expandable.js +7 -7
- package/dist/packages/expandable/expandable.js.map +2 -2
- package/dist/packages/icon/icon.js +2 -2
- package/dist/packages/icon/icon.js.map +2 -2
- package/dist/packages/icon/icon.test.js +14 -0
- package/dist/packages/modal-header/modal-header.js +6 -6
- package/dist/packages/modal-header/modal-header.js.map +2 -2
- package/dist/packages/pagination/pagination.js +3 -3
- package/dist/packages/pagination/pagination.js.map +2 -2
- package/dist/packages/pill/pill.js +3 -3
- package/dist/packages/pill/pill.js.map +2 -2
- package/dist/packages/select/select.js +4 -4
- package/dist/packages/select/select.js.map +2 -2
- package/dist/packages/step/step.js +4 -4
- package/dist/packages/step/step.js.map +2 -2
- package/dist/packages/toast/toast.js +4 -4
- package/dist/packages/toast/toast.js.map +2 -2
- package/dist/web-types.json +18 -5
- package/package.json +26 -23
- package/dist/packages/utils/index.d.ts +0 -10
- package/dist/packages/utils/index.js +0 -37
|
@@ -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!: string;\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
|
|
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,EAAE,KAAKG,CAAM,CAAC,EAErCN,EAAU,IAAIG,CAAG,CAC1B,CAEO,IAAMK,EAAN,cAAoBC,CAAW,CAA/B,
|
|
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!: string;\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, useDefault: true })\n locale: string = document.documentElement.lang || '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 size = this.size || 'medium';\n const name = this.name || '';\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-${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,EAAE,KAAKG,CAAM,CAAC,EAErCN,EAAU,IAAIG,CAAG,CAC1B,CAEO,IAAMK,EAAN,cAAoBC,CAAW,CAA/B,kCAaL,YAAiB,SAAS,gBAAgB,MAAQ,KAIlD,KAAQ,IAAyB,KAOjC,MAAc,UAAUC,EAA8C,CACpE,IAAMP,EAAM,wCAAwC,KAAK,MAAM,IAAIO,CAAQ,OAC3E,GAAI,CACF,IAAMC,EAAU,MAAMT,EAAmBC,CAAG,EAE5C,OADY,IAAI,UAAU,EAAE,gBAAgBQ,EAAS,WAAW,EACrD,KAAK,cAAc,KAAK,CACrC,OAAQC,EAAA,CACN,OAAO,IACT,CACF,CAEU,cAAqB,CAC7B,KAAK,SAAS,CAChB,CAEU,QAAQC,EAA0C,EACtDA,EAAa,IAAI,MAAM,GAAKA,EAAa,IAAI,QAAQ,IACvD,KAAK,SAAS,CAElB,CAEA,MAAc,UAA0B,CACtC,GAAI,CAAC,KAAK,KAAM,CACd,KAAK,IAAM,KACX,MACF,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,EAAO,KAAK,MAAQ,SACpBC,EAAO,KAAK,MAAQ,GACpBC,EAAU,CACd,SAAU,GACV,YAAaF,IAAS,QACtB,YAAaA,IAAS,SACtB,YAAaA,IAAS,OACxB,EACMG,EAAc,OAAOH,GAAS,UAAYA,EAAK,SAAS,IAAI,EAAI,kBAAkBA,CAAI,IAAM,GAClG,OAAOI,gBAAmBC,EAASH,CAAO,CAAC,YAAYC,CAAW,aAAaF,EAAK,YAAY,CAAC,KAAK,KAAK,GAAG,QAChH,CACF,EAvEaR,EACJ,OAAS,CAACa,CAAM,EAIvBC,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAJ9Bf,EAKX,oBAIAc,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAR9Bf,EASX,oBAIAc,EAAA,CADCC,EAAS,CAAE,KAAM,OAAQ,QAAS,GAAM,WAAY,EAAK,CAAC,GAZhDf,EAaX,sBAIQc,EAAA,CADPE,EAAM,GAhBIhB,EAiBH,mBAwDL,eAAe,IAAI,QAAQ,GAC9B,eAAe,OAAO,SAAUA,CAAK",
|
|
6
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", "name", "classes", "customStyle", "html", "classMap", "styles", "__decorateClass", "property", "state"]
|
|
7
7
|
}
|
|
@@ -49,3 +49,17 @@ test('uses specified locale when locale attribute is set', async () => {
|
|
|
49
49
|
// The locale attribute should be reflected
|
|
50
50
|
expect(el.getAttribute('locale')).toBe('nb');
|
|
51
51
|
});
|
|
52
|
+
test('uses html lang attribute when no locale attribute is set', async () => {
|
|
53
|
+
const originalLang = document.documentElement.lang;
|
|
54
|
+
try {
|
|
55
|
+
document.documentElement.lang = 'fi';
|
|
56
|
+
const component = html `<w-icon name="Plus" data-testid="icon"></w-icon>`;
|
|
57
|
+
const page = render(component);
|
|
58
|
+
const el = page.getByTestId('icon').element();
|
|
59
|
+
// The component should use the html lang value as its locale
|
|
60
|
+
expect(el.locale).toBe('fi');
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
document.documentElement.lang = originalLang;
|
|
64
|
+
}
|
|
65
|
+
});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
var ze=Object.create;var C=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Te=(o,e,r)=>e in o?C(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var H=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Le=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ce(e))!Me.call(o,a)&&a!==r&&C(o,a,{get:()=>e[a],enumerable:!(t=G(e,a))||t.enumerable});return o};var Oe=(o,e,r)=>(r=o!=null?ze(Ee(o)):{},Le(e||!o||!o.__esModule?C(r,"default",{value:o,enumerable:!0}):r,o));var b=(o,e,r,t)=>{for(var a=t>1?void 0:t?G(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&C(e,r,a),a};var E=(o,e,r)=>Te(o,typeof e!="symbol"?e+"":e,r);var Q=H(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.errorMessages=w.ErrorType=void 0;var k;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(k=w.ErrorType||(w.ErrorType={}));w.errorMessages=new Map([[k.MalformedUnicode,"malformed Unicode character escape sequence"],[k.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[k.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[k.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[k.EndOfString,"malformed escape sequence at end of string"]])});var re=H(
|
|
2
|
-
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function Ye(o){return $e.get(o)||o}var Ae=/\\(?:(\\)|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 ee(o,e=!1){return o.replace(Ae,function(r,t,a,s,n,i,l,p,v){if(t!==void 0)return"\\";if(a!==void 0)return
|
|
1
|
+
var ze=Object.create;var C=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var Ce=Object.getOwnPropertyNames;var Ee=Object.getPrototypeOf,Me=Object.prototype.hasOwnProperty;var Te=(o,e,r)=>e in o?C(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r;var H=(o,e)=>()=>(e||o((e={exports:{}}).exports,e),e.exports);var Le=(o,e,r,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of Ce(e))!Me.call(o,a)&&a!==r&&C(o,a,{get:()=>e[a],enumerable:!(t=G(e,a))||t.enumerable});return o};var Oe=(o,e,r)=>(r=o!=null?ze(Ee(o)):{},Le(e||!o||!o.__esModule?C(r,"default",{value:o,enumerable:!0}):r,o));var b=(o,e,r,t)=>{for(var a=t>1?void 0:t?G(e,r):e,s=o.length-1,n;s>=0;s--)(n=o[s])&&(a=(t?n(e,r,a):n(a))||a);return t&&a&&C(e,r,a),a};var E=(o,e,r)=>Te(o,typeof e!="symbol"?e+"":e,r);var Q=H(w=>{"use strict";Object.defineProperty(w,"__esModule",{value:!0});w.errorMessages=w.ErrorType=void 0;var k;(function(o){o.MalformedUnicode="MALFORMED_UNICODE",o.MalformedHexadecimal="MALFORMED_HEXADECIMAL",o.CodePointLimit="CODE_POINT_LIMIT",o.OctalDeprecation="OCTAL_DEPRECATION",o.EndOfString="END_OF_STRING"})(k=w.ErrorType||(w.ErrorType={}));w.errorMessages=new Map([[k.MalformedUnicode,"malformed Unicode character escape sequence"],[k.MalformedHexadecimal,"malformed hexadecimal character escape sequence"],[k.CodePointLimit,"Unicode codepoint must not be greater than 0x10FFFF in escape sequence"],[k.OctalDeprecation,'"0"-prefixed octal literals and octal escape sequences are deprecated; for octal literals use the "0o" prefix instead'],[k.EndOfString,"malformed escape sequence at end of string"]])});var re=H(u=>{"use strict";Object.defineProperty(u,"__esModule",{value:!0});u.unraw=u.errorMessages=u.ErrorType=void 0;var c=Q();Object.defineProperty(u,"ErrorType",{enumerable:!0,get:function(){return c.ErrorType}});Object.defineProperty(u,"errorMessages",{enumerable:!0,get:function(){return c.errorMessages}});function De(o){return!o.match(/[^a-f0-9]/i)?parseInt(o,16):NaN}function T(o,e,r){let t=De(o);if(Number.isNaN(t)||r!==void 0&&r!==o.length)throw new SyntaxError(c.errorMessages.get(e));return t}function Pe(o){let e=T(o,c.ErrorType.MalformedHexadecimal,2);return String.fromCharCode(e)}function W(o,e){let r=T(o,c.ErrorType.MalformedUnicode,4);if(e!==void 0){let t=T(e,c.ErrorType.MalformedUnicode,4);return String.fromCharCode(r,t)}return String.fromCharCode(r)}function Ne(o){return o.charAt(0)==="{"&&o.charAt(o.length-1)==="}"}function je(o){if(!Ne(o))throw new SyntaxError(c.errorMessages.get(c.ErrorType.MalformedUnicode));let e=o.slice(1,-1),r=T(e,c.ErrorType.MalformedUnicode);try{return String.fromCodePoint(r)}catch(t){throw t instanceof RangeError?new SyntaxError(c.errorMessages.get(c.ErrorType.CodePointLimit)):t}}function Fe(o,e=!1){if(e)throw new SyntaxError(c.errorMessages.get(c.ErrorType.OctalDeprecation));let r=parseInt(o,8);return String.fromCharCode(r)}var $e=new Map([["b","\b"],["f","\f"],["n",`
|
|
2
|
+
`],["r","\r"],["t"," "],["v","\v"],["0","\0"]]);function Ye(o){return $e.get(o)||o}var Ae=/\\(?:(\\)|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 ee(o,e=!1){return o.replace(Ae,function(r,t,a,s,n,i,l,p,v){if(t!==void 0)return"\\";if(a!==void 0)return Pe(a);if(s!==void 0)return je(s);if(n!==void 0)return W(n,i);if(l!==void 0)return W(l);if(p==="0")return"\0";if(p!==void 0)return Fe(p,!e);if(v!==void 0)return Ye(v);throw new SyntaxError(c.errorMessages.get(c.ErrorType.EndOfString))})}u.unraw=ee;u.default=ee});var V=(o,e)=>({dx:o.left-e.left,dy:o.top-e.top,dw:o.width/e.width,dh:o.height/e.height,first:o,last:e}),J=({dx:o,dy:e})=>[{transform:`translate(${o}px, ${e}px)`},{transform:"none"}],K={easing:"ease",duration:300};var N=!1,Se=typeof window!="undefined";if(Se){let o=window.matchMedia("(prefers-reduced-motion: reduce)"),e=({matches:r})=>N=r;o.addEventListener&&o.addEventListener("change",e),e(o)}var M=class{constructor(e,{animation:r={},keyframes:t,respectReduceMotion:a=!0}={}){E(this,"first");E(this,"last");E(this,"el");this.el=e,this.first={},this.last={},this.userAnimationOptions=r,this.keyframeGenerator=t||J,this.shouldReduceMotion=a}async when(e){this.prep();let r=await e();return await this.play(),r}prep(){this.first=this.el.getBoundingClientRect()}async play(){if(this.last=this.el.getBoundingClientRect(),!this.el.animate)return;await this.el.animate(this.keyframes,this.animationOptions).finished}get keyframes(){return this.keyframeGenerator(V(this.first,this.last))}get defaults(){return K}get mergedOptions(){return{...this.defaults,...this.userAnimationOptions}}get animationOptions(){return this.shouldReduceMotion?N?{...this.mergedOptions,duration:0}:this.mergedOptions:this.mergedOptions}};var ae=Oe(re(),1);var h=o=>typeof o=="string",Re=o=>typeof o=="function",oe=new Map,ie="en";function Y(o){return[...Array.isArray(o)?o:[o],ie]}function A(o,e,r){let t=Y(o);r||(r="default");let a;if(typeof r=="string")switch(a={day:"numeric",month:"short",year:"numeric"},r){case"full":a.weekday="long";case"long":a.month="long";break;case"short":a.month="numeric";break}else a=r;return L(()=>O("date",t,r),()=>new Intl.DateTimeFormat(t,a)).format(h(e)?new Date(e):e)}function Ie(o,e,r){let t;if(r||(r="default"),typeof r=="string")switch(t={second:"numeric",minute:"numeric",hour:"numeric"},r){case"full":case"long":t.timeZoneName="short";break;case"short":delete t.second}else t=r;return A(o,e,t)}function j(o,e,r){let t=Y(o);return L(()=>O("number",t,r),()=>new Intl.NumberFormat(t,r)).format(e)}function te(o,e,r,{offset:t=0,...a}){var i,l;let s=Y(o),n=e?L(()=>O("plural-ordinal",s),()=>new Intl.PluralRules(s,{type:"ordinal"})):L(()=>O("plural-cardinal",s),()=>new Intl.PluralRules(s,{type:"cardinal"}));return(l=(i=a[r])!=null?i:a[n.select(r-t)])!=null?l:a.other}function L(o,e){let r=o(),t=oe.get(r);return t||(t=e(),oe.set(r,t)),t}function O(o,e,r){let t=e.join("-");return`${o}-${t}-${JSON.stringify(r)}`}var ne=/\\u[a-fA-F0-9]{4}|\\x[a-fA-F0-9]{2}/,se="%__lingui_octothorpe__%",Be=(o,e,r={})=>{let t=e||o,a=n=>typeof n=="object"?n:r[n],s=(n,i)=>{let l=Object.keys(r).length?a("number"):void 0,p=j(t,n,l);return i.replace(new RegExp(se,"g"),p)};return{plural:(n,i)=>{let{offset:l=0}=i,p=te(t,!1,n,i);return s(n-l,p)},selectordinal:(n,i)=>{let{offset:l=0}=i,p=te(t,!0,n,i);return s(n-l,p)},select:Ue,number:(n,i)=>j(t,n,a(i)||{style:i}),date:(n,i)=>A(t,n,a(i)||i),time:(n,i)=>Ie(t,n,a(i)||i)}},Ue=(o,e)=>{var r;return(r=e[o])!=null?r:e.other};function Xe(o,e,r){return(t={},a)=>{let s=Be(e,r,a),n=(l,p=!1)=>Array.isArray(l)?l.reduce((v,_)=>{if(_==="#"&&p)return v+se;if(h(_))return v+_;let[Z,f,q]=_,D={};f==="plural"||f==="selectordinal"||f==="select"?Object.entries(q).forEach(([P,_e])=>{D[P]=n(_e,f==="plural"||f==="selectordinal")}):D=q;let z;if(f){let P=s[f];z=P(t[Z],D)}else z=t[Z];return z==null?v:v+z},""):l,i=n(o);return h(i)&&ne.test(i)?(0,ae.unraw)(i):h(i)?i:i?String(i):""}}var Ze=Object.defineProperty,qe=(o,e,r)=>e in o?Ze(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,Ge=(o,e,r)=>(qe(o,typeof e!="symbol"?e+"":e,r),r),F=class{constructor(){Ge(this,"_events",{})}on(e,r){var a;var t;return(a=(t=this._events)[e])!=null||(t[e]=[]),this._events[e].push(r),()=>this.removeListener(e,r)}removeListener(e,r){let t=this._getListeners(e);if(!t)return;let a=t.indexOf(r);~a&&t.splice(a,1)}emit(e,...r){let t=this._getListeners(e);t&&t.map(a=>a.apply(this,r))}_getListeners(e){let r=this._events[e];return Array.isArray(r)?r:!1}},He=Object.defineProperty,Ve=(o,e,r)=>e in o?He(o,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):o[e]=r,x=(o,e,r)=>(Ve(o,typeof e!="symbol"?e+"":e,r),r),$=class extends F{constructor(e){var r;super(),x(this,"_locale",""),x(this,"_locales"),x(this,"_localeData",{}),x(this,"_messages",{}),x(this,"_missing"),x(this,"_messageCompiler"),x(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((r=e.locale)!=null?r:ie,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,r){let t=this._localeData[e];t?Object.assign(t,r):this._localeData[e]=r}setMessagesCompiler(e){return this._messageCompiler=e,this}loadLocaleData(e,r){typeof e=="string"?this._loadLocaleData(e,r):Object.keys(e).forEach(t=>this._loadLocaleData(t,e[t])),this.emit("change")}_load(e,r){let t=this._messages[e];t?Object.assign(t,r):this._messages[e]=r}load(e,r){typeof e=="string"&&typeof r=="object"?this._load(e,r):Object.entries(e).forEach(([t,a])=>this._load(t,a)),this.emit("change")}loadAndActivate({locale:e,locales:r,messages:t}){this._locale=e,this._locales=r||void 0,this._messages[this._locale]=t,this.emit("change")}activate(e,r){this._locale=e,this._locales=r,this.emit("change")}_(e,r,t){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=t==null?void 0:t.message;e||(e=""),h(e)||(r=e.values||r,a=e.message,e=e.id);let s=this.messages[e],n=s===void 0,i=this._missing;if(i&&n)return Re(i)?i(this._locale,e):i;n&&this.emit("missing",{id:e,locale:this._locale});let l=s||a||e;return h(l)&&(this._messageCompiler?l=this._messageCompiler(l):console.warn(`Uncompiled message detected! Message:
|
|
3
3
|
|
|
4
4
|
> ${l}
|
|
5
5
|
|
|
@@ -32,7 +32,7 @@ Please compile your catalog first.
|
|
|
32
32
|
--w-icon-size: 32px;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
-
`;var I=new Map,or='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function tr(o,e={}){var t;let r=(t=e.responseParser)!=null?t:(a=>a.text());return I.has(o)||I.set(o,fetch(o).then(r)),I.get(o)}var m=class extends We{constructor(){super(...arguments);this.svg=null}async fetchIcon(r){let
|
|
35
|
+
`;var I=new Map,or='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"></svg>';function tr(o,e={}){var t;let r=(t=e.responseParser)!=null?t:(a=>a.text());return I.has(o)||I.set(o,fetch(o).then(r)),I.get(o)}var m=class extends We{constructor(){super(...arguments);this.locale=document.documentElement.lang||"en";this.svg=null}async fetchIcon(r){let t=`https://assets.finn.no/pkg/eikons/v1/${this.locale}/${r}.svg`;try{let a=await tr(t);return new DOMParser().parseFromString(a,"text/html").body.querySelector("svg")}catch(a){return null}}firstUpdated(){this.loadIcon()}updated(r){(r.has("name")||r.has("locale"))&&this.loadIcon()}async loadIcon(){if(!this.name){this.svg=null;return}let r=await this.fetchIcon(this.name);r||(r=new DOMParser().parseFromString(or,"text/html").body.firstElementChild),this.svg=r}render(){let r=this.size||"medium",t=this.name||"",a={"w-icon":!0,"w-icon--s":r==="small","w-icon--m":r==="medium","w-icon--l":r==="large"},s=typeof r=="string"&&r.endsWith("px")?`--w-icon-size: ${r};`:"";return Qe`<div class="${rr(a)}" style="${s}" part="w-${t.toLowerCase()}">${this.svg}</div>`}};m.styles=[le],b([R({type:String,reflect:!0})],m.prototype,"name",2),b([R({type:String,reflect:!0})],m.prototype,"size",2),b([R({type:String,reflect:!0,useDefault:!0})],m.prototype,"locale",2),b([er()],m.prototype,"svg",2);customElements.get("w-icon")||customElements.define("w-icon",m);var ar=["en","nb","fi","da","sv"],B="en",S=o=>ar.find(e=>o===e||o.toLowerCase().includes(e))||B;function y(){if(typeof window=="undefined"){let o=process.env.NMP_LANGUAGE||Intl.DateTimeFormat().resolvedOptions().locale;return S(o)}try{let o=de(document);if(o)return S(o);let e=lr();if(e)return S(e);let r=de(ue());return r?S(r):B}catch(o){return console.warn("could not detect locale, falling back to source locale",o),B}}var pe=(o,e,r,t,a)=>{d.load("en",o),d.load("nb",e),d.load("fi",r),d.load("da",t),d.load("sv",a);let s=y();d.activate(s),be(),nr()},ir="warp-i18n-change";function be(){typeof window!="undefined"&&window.dispatchEvent(new Event(ir))}var ce=!1;function nr(){if(ce||typeof window=="undefined"||!(document!=null&&document.documentElement))return;ce=!0;let o=()=>{let a=y();d.locale!==a&&(d.activate(a),be())},e=new MutationObserver(a=>{for(let s of a)if(s.type==="attributes"&&s.attributeName==="lang"){o();break}});e.observe(document.documentElement,{attributes:!0,attributeFilter:["lang"]});let r=ue();r&&r.documentElement&&r!==document&&e.observe(r.documentElement,{attributes:!0,attributeFilter:["lang"]});let t=sr();t&&e.observe(t,{attributes:!0,attributeFilter:["lang"]})}function ue(){var o,e;try{return(e=(o=window.parent)==null?void 0:o.document)!=null?e:null}catch(r){return null}}function de(o){var e,r;try{return(r=(e=o==null?void 0:o.documentElement)==null?void 0:e.lang)!=null?r:""}catch(t){return""}}function sr(){var o;try{return(o=window.frameElement)!=null?o:null}catch(e){return null}}function lr(){var o,e,r;try{return(r=(e=(o=window.frameElement)==null?void 0:o.getAttribute)==null?void 0:e.call(o,"lang"))!=null?r:""}catch(t){return""}}var ge=JSON.parse('{"modal.aria.back":["Tilbage"],"modal.aria.close":["Luk"]}');var he=JSON.parse('{"modal.aria.back":["Back"],"modal.aria.close":["Close"]}');var me=JSON.parse('{"modal.aria.back":["Takaisin"],"modal.aria.close":["Sulje"]}');var ve=JSON.parse('{"modal.aria.back":["Tilbake"],"modal.aria.close":["Lukk"]}');var fe=JSON.parse('{"modal.aria.back":["Tillbaka"],"modal.aria.close":["St\xE4ng"]}');var we=o=>class extends o{constructor(){super(...arguments);this.patchClose=!0;this._close=null}close(){this._close()}};import{css as xe}from"lit";var ke=xe`
|
|
36
36
|
*,
|
|
37
37
|
:before,
|
|
38
38
|
:after {
|
|
@@ -2471,7 +2471,7 @@ Please compile your catalog first.
|
|
|
2471
2471
|
display: none
|
|
2472
2472
|
}
|
|
2473
2473
|
}
|
|
2474
|
-
`;var
|
|
2474
|
+
`;var g=class extends we(dr){constructor(){super();this.back=!1;this.noClose=!1;this._hasTopContent=!1;pe(he,ve,me,ge,fe)}render(){return U`
|
|
2475
2475
|
<div class="header">
|
|
2476
2476
|
<slot name="top" @slotchange=${this.handleTopSlotChange}></slot>
|
|
2477
2477
|
<div class="${this._hasTopContent?"":"header-title-bar"}">
|
|
@@ -2495,7 +2495,7 @@ Please compile your catalog first.
|
|
|
2495
2495
|
@click="${this.close}">
|
|
2496
2496
|
<w-icon name="Close" size="small" locale="${y()}" style="display: flex;" class="flex"></w-icon>
|
|
2497
2497
|
</w-button>
|
|
2498
|
-
</div>`}emitBack(){this.dispatchEvent(new CustomEvent("backClicked",{bubbles:!0,composed:!0}))}handleTopSlotChange(r){let t=r.target.assignedElements({flatten:!0});this._hasTopContent=!!t.length}};
|
|
2498
|
+
</div>`}emitBack(){this.dispatchEvent(new CustomEvent("backClicked",{bubbles:!0,composed:!0}))}handleTopSlotChange(r){let t=r.target.assignedElements({flatten:!0});this._hasTopContent=!!t.length}};g.styles=[ke,cr`
|
|
2499
2499
|
.header {
|
|
2500
2500
|
position: relative;
|
|
2501
2501
|
padding-bottom: 0.8rem;
|
|
@@ -2588,5 +2588,5 @@ Please compile your catalog first.
|
|
|
2588
2588
|
min-width: 32px;
|
|
2589
2589
|
}
|
|
2590
2590
|
}
|
|
2591
|
-
`],b([X({type:String})],
|
|
2591
|
+
`],b([X({type:String})],g.prototype,"title",2),b([X({type:Boolean})],g.prototype,"back",2),b([X({type:Boolean,attribute:"no-close"})],g.prototype,"noClose",2),b([br()],g.prototype,"_hasTopContent",2),b([pr(".title-el")],g.prototype,"titleEl",2);customElements.get("w-modal-header")||customElements.define("w-modal-header",g);export{g as ModalHeader};
|
|
2592
2592
|
//# sourceMappingURL=modal-header.js.map
|