@maggioli-design-system/mds-input-tip-item 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-09-05T13:13:09",
2
+ "timestamp": "2024-09-13T08:12:14",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.21.0",
@@ -237,7 +237,7 @@
237
237
  "path": "src/components/mds-chip/meta/interface.ts"
238
238
  },
239
239
  "src/components/mds-dropdown/meta/types.ts::DropdownInteractionType": {
240
- "declaration": "export type DropdownInteractionType =\n | 'click'\n | 'mouseover'",
240
+ "declaration": "export type DropdownInteractionType =\n | 'click'\n | 'none'\n | 'mouseover'",
241
241
  "docstring": "",
242
242
  "path": "src/components/mds-dropdown/meta/types.ts"
243
243
  },
@@ -451,6 +451,11 @@
451
451
  "docstring": "",
452
452
  "path": "src/components/mds-pref-animation/meta/types.ts"
453
453
  },
454
+ "src/event-detail/preference.ts::MdsPrefChangeEventDetail": {
455
+ "declaration": "export interface MdsPrefChangeEventDetail {\n preference: UIPreferenceType\n}",
456
+ "docstring": "",
457
+ "path": "src/event-detail/preference.ts"
458
+ },
454
459
  "src/type/preference.ts::ConsumptionModeType": {
455
460
  "declaration": "export type ConsumptionModeType =\n | 'high'\n | 'medium'\n | 'low'",
456
461
  "docstring": "",
@@ -461,6 +466,16 @@
461
466
  "docstring": "",
462
467
  "path": "src/components/mds-pref-contrast/meta/types.ts"
463
468
  },
469
+ "src/type/language.ts::LanguageType": {
470
+ "declaration": "export type LanguageType =\n | 'auto'\n | `${Lowercase<string>}${Lowercase<string>}`\n | `${Lowercase<string>}${Lowercase<string>}${Lowercase<string>}`",
471
+ "docstring": "",
472
+ "path": "src/type/language.ts"
473
+ },
474
+ "src/event-detail/language.ts::MdsPrefLanguageEventDetail": {
475
+ "declaration": "export interface MdsPrefLanguageEventDetail {\n language?: LanguageType\n}",
476
+ "docstring": "",
477
+ "path": "src/event-detail/language.ts"
478
+ },
464
479
  "src/components/mds-pref-theme/meta/types.ts::ThemeModeType": {
465
480
  "declaration": "export type ThemeModeType =\n | 'light'\n | 'dark'\n | 'system'",
466
481
  "docstring": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-input-tip-item",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "mds-input-tip-item is a web-component from Magma Design System, built with StencilJS, TypeScript, Storybook. It's based on the web-component standard and it's designed to be agnostic from the JavaScirpt framework you are using.",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.js",
@@ -24,8 +24,8 @@
24
24
  "test": "stencil test --spec --e2e"
25
25
  },
26
26
  "dependencies": {
27
- "@maggioli-design-system/mds-text": "4.4.0",
28
- "@maggioli-design-system/styles": "15.3.0",
27
+ "@maggioli-design-system/mds-text": "4.4.1",
28
+ "@maggioli-design-system/styles": "15.3.1",
29
29
  "@stencil/core": "4.21.0"
30
30
  },
31
31
  "license": "MIT",
@@ -1,35 +1,39 @@
1
1
  import Handlebars from 'handlebars'
2
2
 
3
3
  type LocaleConfig = {
4
+ el?: Record<string, string | string[]>
5
+ en: Record<string, string | string[]>
6
+ es?: Record<string, string | string[]>
4
7
  it?: Record<string, string | string[]>
5
- en?: Record<string, string | string[]>
6
- gr?: Record<string, string | string[]>
7
8
  }
8
9
 
9
10
  export class Locale {
10
- defaultLanguage: string = 'en'
11
+ rollbackLanguage: string = 'en'
11
12
  language: string
12
13
  config: LocaleConfig
14
+ closestElement:HTMLElement
13
15
 
14
16
  constructor (configData: LocaleConfig) {
15
17
  this.config = configData
16
18
  }
17
19
 
18
20
  lang = (element: HTMLElement): void => {
19
- const closestElement:HTMLElement = element.closest('[lang]') as HTMLElement
20
- if (closestElement) {
21
- if (closestElement.lang) {
22
- this.language = closestElement.lang
21
+ this.closestElement = element.closest('[lang]') as HTMLElement
22
+
23
+
24
+ if (this.closestElement) {
25
+ if (this.closestElement.lang) {
26
+ this.language = this.closestElement.lang
23
27
  return
24
28
  }
25
29
  }
26
30
 
27
- this.language = this.defaultLanguage
31
+ this.language = this.rollbackLanguage
28
32
  }
29
33
 
30
34
  private pluralize = (tag: string | string[], context: Record<string, string | number>): string => {
31
35
 
32
- const languagePhrase: string | string[] = this.config[this.language][tag] ?? this.config[this.defaultLanguage][tag]
36
+ const languagePhrase: string | string[] = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]
33
37
  const phrases: string[] = []
34
38
 
35
39
  if (Array.isArray(languagePhrase)) {
@@ -61,6 +65,6 @@ export class Locale {
61
65
  if (context) {
62
66
  return this.pluralize(tag, context)
63
67
  }
64
- return this.config[this.language][tag] ?? this.config[this.defaultLanguage][tag]
68
+ return this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]
65
69
  }
66
70
  }
@@ -0,0 +1,4 @@
1
+ export type LanguageType =
2
+ | 'auto'
3
+ | `${Lowercase<string>}${Lowercase<string>}`
4
+ | `${Lowercase<string>}${Lowercase<string>}${Lowercase<string>}`
@@ -3,6 +3,7 @@ export type UIPreferenceType =
3
3
  | 'consumption'
4
4
  | 'contrast'
5
5
  | 'theme'
6
+ | 'language'
6
7
 
7
8
  export type ConsumptionModeType =
8
9
  | 'high'
@@ -1 +1 @@
1
- import{p as a,b as t}from"./p-dad0fd1d.js";export{s as setNonce}from"./p-dad0fd1d.js";import{g as p}from"./p-e1255160.js";(()=>{const t=import.meta.url,p={};return""!==t&&(p.resourcesUrl=new URL(".",t).href),a(p)})().then((async a=>(await p(),t([["p-0f7b5474",[[1,"mds-input-tip-item",{variant:[513],expanded:[516]}]]]],a))));
1
+ import{p as a,b as d}from"./p-dad0fd1d.js";export{s as setNonce}from"./p-dad0fd1d.js";import{g as t}from"./p-e1255160.js";(()=>{const d=import.meta.url,t={};return""!==d&&(t.resourcesUrl=new URL(".",d).href),a(t)})().then((async a=>(await t(),d([["p-c23db9de",[[1,"mds-input-tip-item",{variant:[513],expanded:[516]}]]]],a))));