@maggioli-design-system/mds-input-tip 1.0.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. package/dist/cjs/app-globals-3a1e7e63.js +5 -0
  2. package/dist/cjs/index-f87612f6.js +1122 -0
  3. package/dist/cjs/loader.cjs.js +4 -2
  4. package/dist/cjs/mds-input-tip.cjs.entry.js +5 -4
  5. package/dist/cjs/mds-input-tip.cjs.js +12 -10
  6. package/dist/collection/collection-manifest.json +2 -2
  7. package/dist/collection/common/locale.js +37 -9
  8. package/dist/collection/components/mds-input-tip/mds-input-tip.css +105 -87
  9. package/dist/collection/components/mds-input-tip/mds-input-tip.js +2 -2
  10. package/dist/collection/components/mds-input-tip/meta/dictionary.js +5 -0
  11. package/dist/collection/components/mds-input-tip/test/mds-input-tip.stories.js +18 -0
  12. package/dist/collection/type/language.js +1 -0
  13. package/dist/collection/type/preference.js +1 -0
  14. package/dist/components/mds-input-tip.js +4 -3
  15. package/dist/documentation.d.ts +34 -0
  16. package/dist/documentation.json +4 -4
  17. package/dist/esm/app-globals-0f993ce5.js +3 -0
  18. package/dist/esm/index-a04da9f4.js +1095 -0
  19. package/dist/esm/loader.js +5 -3
  20. package/dist/esm/mds-input-tip.entry.js +5 -4
  21. package/dist/esm/mds-input-tip.js +13 -11
  22. package/dist/esm-es5/app-globals-0f993ce5.js +1 -0
  23. package/dist/esm-es5/index-a04da9f4.js +1 -0
  24. package/dist/esm-es5/loader.js +1 -1
  25. package/dist/esm-es5/mds-input-tip.entry.js +1 -1
  26. package/dist/esm-es5/mds-input-tip.js +1 -1
  27. package/dist/mds-input-tip/mds-input-tip.esm.js +1 -1
  28. package/dist/mds-input-tip/mds-input-tip.js +1 -1
  29. package/dist/mds-input-tip/p-14639038.entry.js +1 -0
  30. package/dist/mds-input-tip/p-56ba5cbf.system.js +1 -0
  31. package/dist/mds-input-tip/p-58828816.system.js +2 -0
  32. package/dist/mds-input-tip/p-96bf634c.js +2 -0
  33. package/dist/mds-input-tip/p-ca408384.system.js +1 -0
  34. package/dist/mds-input-tip/p-e1255160.js +1 -0
  35. package/dist/mds-input-tip/p-ed74ada1.system.entry.js +1 -0
  36. package/dist/stats.json +56 -39
  37. package/dist/types/common/locale.d.ts +8 -5
  38. package/dist/types/components/mds-input-tip/mds-input-tip.d.ts +1 -1
  39. package/dist/types/components/mds-input-tip/meta/dictionary.d.ts +2 -0
  40. package/dist/types/components/mds-input-tip/test/mds-input-tip.stories.d.ts +20 -0
  41. package/dist/types/components.d.ts +2 -2
  42. package/dist/types/stencil-public-runtime.d.ts +3 -10
  43. package/dist/types/type/language.d.ts +1 -0
  44. package/dist/types/type/preference.d.ts +2 -0
  45. package/documentation.json +22 -27
  46. package/loader/cdn.js +1 -2
  47. package/loader/index.cjs.js +1 -2
  48. package/loader/index.d.ts +3 -0
  49. package/loader/index.es2017.js +1 -2
  50. package/loader/index.js +1 -2
  51. package/package.json +19 -19
  52. package/readme.md +4 -4
  53. package/src/common/locale.ts +50 -11
  54. package/src/components/mds-input-tip/css/mds-input-tip-pref-animation.css +16 -0
  55. package/src/components/mds-input-tip/mds-input-tip.css +9 -7
  56. package/src/components/mds-input-tip/mds-input-tip.tsx +1 -1
  57. package/src/components/mds-input-tip/meta/dictionary.ts +8 -0
  58. package/src/components/mds-input-tip/readme.md +4 -4
  59. package/src/components/mds-input-tip/test/mds-input-tip.stories.tsx +26 -0
  60. package/src/components.d.ts +2 -2
  61. package/src/fixtures/icons.json +1 -0
  62. package/src/tailwind/components.css +71 -0
  63. package/src/type/language.ts +4 -0
  64. package/src/type/preference.ts +11 -0
  65. package/www/build/mds-input-tip.esm.js +1 -1
  66. package/www/build/mds-input-tip.js +1 -1
  67. package/www/build/p-14639038.entry.js +1 -0
  68. package/www/build/p-56ba5cbf.system.js +1 -0
  69. package/www/build/p-58828816.system.js +2 -0
  70. package/www/build/p-96bf634c.js +2 -0
  71. package/www/build/p-ca408384.system.js +1 -0
  72. package/www/build/p-e1255160.js +1 -0
  73. package/www/build/p-ed74ada1.system.entry.js +1 -0
  74. package/dist/cjs/index-fe2df682.js +0 -1571
  75. package/dist/collection/components/mds-input-tip/test/mds-input-tip.e2e.js +0 -9
  76. package/dist/esm/index-351c5c8a.js +0 -1544
  77. package/dist/esm-es5/index-351c5c8a.js +0 -1
  78. package/dist/mds-input-tip/p-22b86e20.js +0 -2
  79. package/dist/mds-input-tip/p-3428f886.system.js +0 -2
  80. package/dist/mds-input-tip/p-630886b5.entry.js +0 -1
  81. package/dist/mds-input-tip/p-89e037f5.system.entry.js +0 -1
  82. package/dist/mds-input-tip/p-e5fe0b68.system.js +0 -1
  83. package/www/build/p-22b86e20.js +0 -2
  84. package/www/build/p-3428f886.system.js +0 -2
  85. package/www/build/p-630886b5.entry.js +0 -1
  86. package/www/build/p-89e037f5.system.entry.js +0 -1
  87. package/www/build/p-e5fe0b68.system.js +0 -1
@@ -1,14 +1,17 @@
1
1
  type LocaleConfig = {
2
- it?: Record<string, string>;
3
- en?: Record<string, string>;
4
- gr?: Record<string, string>;
2
+ el?: Record<string, string | string[]>;
3
+ en: Record<string, string | string[]>;
4
+ es?: Record<string, string | string[]>;
5
+ it?: Record<string, string | string[]>;
5
6
  };
6
7
  export declare class Locale {
7
- defaultLanguage: string;
8
+ rollbackLanguage: string;
8
9
  language: string;
9
10
  config: LocaleConfig;
11
+ closestElement: HTMLElement;
10
12
  constructor(configData: LocaleConfig);
11
13
  lang: (element: HTMLElement) => void;
12
- get: (tag: string) => string;
14
+ private pluralize;
15
+ get: (tag: string | string[], context?: Record<string, string | number>) => string;
13
16
  }
14
17
  export {};
@@ -1,7 +1,7 @@
1
1
  import { InputTipPositionType } from './meta/types';
2
2
  export declare class MdsInputTip {
3
3
  /**
4
- * Specifies the position of the element relative to its container
4
+ * Specifies if the component is active and shows expanded children or not
5
5
  */
6
6
  readonly active?: boolean;
7
7
  /**
@@ -0,0 +1,2 @@
1
+ declare const inputTipPositionDictionary: string[];
2
+ export { inputTipPositionDictionary, };
@@ -0,0 +1,20 @@
1
+ declare const _default: {
2
+ title: string;
3
+ argTypes: {
4
+ active: {
5
+ type: {
6
+ name: string;
7
+ };
8
+ description: string;
9
+ };
10
+ position: {
11
+ description: string;
12
+ options: string[];
13
+ control: {
14
+ type: string;
15
+ };
16
+ };
17
+ };
18
+ };
19
+ export default _default;
20
+ export declare const Default: any;
@@ -10,7 +10,7 @@ export { InputTipPositionType } from "./components/mds-input-tip/meta/types";
10
10
  export namespace Components {
11
11
  interface MdsInputTip {
12
12
  /**
13
- * Specifies the position of the element relative to its container
13
+ * Specifies if the component is active and shows expanded children or not
14
14
  */
15
15
  "active"?: boolean;
16
16
  /**
@@ -33,7 +33,7 @@ declare global {
33
33
  declare namespace LocalJSX {
34
34
  interface MdsInputTip {
35
35
  /**
36
- * Specifies the position of the element relative to its container
36
+ * Specifies if the component is active and shows expanded children or not
37
37
  */
38
38
  "active"?: boolean;
39
39
  /**
@@ -768,6 +768,7 @@ export declare namespace JSXBase {
768
768
  hrefLang?: string;
769
769
  hreflang?: string;
770
770
  media?: string;
771
+ ping?: string;
771
772
  rel?: string;
772
773
  target?: string;
773
774
  referrerPolicy?: ReferrerPolicy;
@@ -794,7 +795,6 @@ export declare namespace JSXBase {
794
795
  cite?: string;
795
796
  }
796
797
  interface ButtonHTMLAttributes<T> extends HTMLAttributes<T> {
797
- autoFocus?: boolean;
798
798
  disabled?: boolean;
799
799
  form?: string;
800
800
  formAction?: string;
@@ -921,8 +921,6 @@ export declare namespace JSXBase {
921
921
  autocapitalize?: string;
922
922
  autoComplete?: string;
923
923
  autocomplete?: string;
924
- autoFocus?: boolean;
925
- autofocus?: boolean | string;
926
924
  capture?: string;
927
925
  checked?: boolean;
928
926
  crossOrigin?: string;
@@ -979,8 +977,6 @@ export declare namespace JSXBase {
979
977
  popoverTarget?: string;
980
978
  }
981
979
  interface KeygenHTMLAttributes<T> extends HTMLAttributes<T> {
982
- autoFocus?: boolean;
983
- autofocus?: boolean | string;
984
980
  challenge?: string;
985
981
  disabled?: boolean;
986
982
  form?: string;
@@ -993,7 +989,6 @@ export declare namespace JSXBase {
993
989
  interface LabelHTMLAttributes<T> extends HTMLAttributes<T> {
994
990
  form?: string;
995
991
  htmlFor?: string;
996
- htmlfor?: string;
997
992
  }
998
993
  interface LiHTMLAttributes<T> extends HTMLAttributes<T> {
999
994
  value?: string | string[] | number;
@@ -1104,7 +1099,6 @@ export declare namespace JSXBase {
1104
1099
  interface OutputHTMLAttributes<T> extends HTMLAttributes<T> {
1105
1100
  form?: string;
1106
1101
  htmlFor?: string;
1107
- htmlfor?: string;
1108
1102
  name?: string;
1109
1103
  }
1110
1104
  interface ParamHTMLAttributes<T> extends HTMLAttributes<T> {
@@ -1129,7 +1123,6 @@ export declare namespace JSXBase {
1129
1123
  type?: string;
1130
1124
  }
1131
1125
  interface SelectHTMLAttributes<T> extends HTMLAttributes<T> {
1132
- autoFocus?: boolean;
1133
1126
  disabled?: boolean;
1134
1127
  form?: string;
1135
1128
  multiple?: boolean;
@@ -1164,8 +1157,6 @@ export declare namespace JSXBase {
1164
1157
  interface TextareaHTMLAttributes<T> extends HTMLAttributes<T> {
1165
1158
  autoComplete?: string;
1166
1159
  autocomplete?: string;
1167
- autoFocus?: boolean;
1168
- autofocus?: boolean | string;
1169
1160
  cols?: number;
1170
1161
  disabled?: boolean;
1171
1162
  form?: string;
@@ -1218,6 +1209,8 @@ export declare namespace JSXBase {
1218
1209
  interface HTMLAttributes<T = HTMLElement> extends DOMAttributes<T> {
1219
1210
  innerHTML?: string;
1220
1211
  accessKey?: string;
1212
+ autoFocus?: boolean;
1213
+ autofocus?: boolean | string;
1221
1214
  class?: string | {
1222
1215
  [className: string]: boolean;
1223
1216
  };
@@ -0,0 +1 @@
1
+ export type LanguageType = 'auto' | `${Lowercase<string>}${Lowercase<string>}` | `${Lowercase<string>}${Lowercase<string>}${Lowercase<string>}`;
@@ -0,0 +1,2 @@
1
+ export type UIPreferenceType = 'animation' | 'consumption' | 'contrast' | 'theme' | 'language';
2
+ export type ConsumptionModeType = 'high' | 'medium' | 'low';
@@ -1,9 +1,9 @@
1
1
  {
2
- "timestamp": "2024-08-23T14:24:28",
2
+ "timestamp": "2024-09-13T08:12:14",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
- "version": "4.10.0",
6
- "typescriptVersion": "5.3.3"
5
+ "version": "4.21.0",
6
+ "typescriptVersion": "5.5.3"
7
7
  },
8
8
  "components": [
9
9
  {
@@ -26,7 +26,7 @@
26
26
  "mutable": false,
27
27
  "attr": "active",
28
28
  "reflectToAttr": true,
29
- "docs": "Specifies the position of the element relative to its container",
29
+ "docs": "Specifies if the component is active and shows expanded children or not",
30
30
  "docsTags": [],
31
31
  "default": "false",
32
32
  "values": [
@@ -220,7 +220,7 @@
220
220
  "path": "src/components/mds-chip/meta/interface.ts"
221
221
  },
222
222
  "src/components/mds-dropdown/meta/types.ts::DropdownInteractionType": {
223
- "declaration": "export type DropdownInteractionType =\n | 'click'\n | 'mouseover'",
223
+ "declaration": "export type DropdownInteractionType =\n | 'click'\n | 'none'\n | 'mouseover'",
224
224
  "docstring": "",
225
225
  "path": "src/components/mds-dropdown/meta/types.ts"
226
226
  },
@@ -269,26 +269,6 @@
269
269
  "docstring": "",
270
270
  "path": "src/components/mds-filter-item/meta/event-detail.ts"
271
271
  },
272
- "src/components/mds-form/meta/types.ts::CharacterSetType": {
273
- "declaration": "export type CharacterSetType =\n | '8859-1'\n | 'ansi'\n | 'ascii'\n | 'utf-8'",
274
- "docstring": "",
275
- "path": "src/components/mds-form/meta/types.ts"
276
- },
277
- "src/components/mds-form/meta/types.ts::FormAutocompleteType": {
278
- "declaration": "export type FormAutocompleteType =\n | 'off'\n | 'on'",
279
- "docstring": "",
280
- "path": "src/components/mds-form/meta/types.ts"
281
- },
282
- "src/components/mds-form/meta/types.ts::EnctypeType": {
283
- "declaration": "export type EnctypeType =\n | 'application/x-www-form-urlencoded'\n | 'multipart/form-data'\n | 'text/plain'",
284
- "docstring": "",
285
- "path": "src/components/mds-form/meta/types.ts"
286
- },
287
- "src/components/mds-form/meta/types.ts::FormMethodType": {
288
- "declaration": "export type FormMethodType =\n | 'get'\n | 'post'",
289
- "docstring": "",
290
- "path": "src/components/mds-form/meta/types.ts"
291
- },
292
272
  "src/components/mds-header-bar/meta/types.ts::MenuType": {
293
273
  "declaration": "export type MenuType =\n | 'all'\n | 'desktop'\n | 'mobile'\n | 'none'",
294
274
  "docstring": "",
@@ -454,16 +434,31 @@
454
434
  "docstring": "",
455
435
  "path": "src/components/mds-pref-animation/meta/types.ts"
456
436
  },
457
- "src/components/mds-pref-consumption/meta/types.ts::ConsumptionModeType": {
437
+ "src/event-detail/preference.ts::MdsPrefChangeEventDetail": {
438
+ "declaration": "export interface MdsPrefChangeEventDetail {\n preference: UIPreferenceType\n}",
439
+ "docstring": "",
440
+ "path": "src/event-detail/preference.ts"
441
+ },
442
+ "src/type/preference.ts::ConsumptionModeType": {
458
443
  "declaration": "export type ConsumptionModeType =\n | 'high'\n | 'medium'\n | 'low'",
459
444
  "docstring": "",
460
- "path": "src/components/mds-pref-consumption/meta/types.ts"
445
+ "path": "src/type/preference.ts"
461
446
  },
462
447
  "src/components/mds-pref-contrast/meta/types.ts::ContrastModeType": {
463
448
  "declaration": "export type ContrastModeType =\n | 'more'\n | 'no-preference'\n | 'system'",
464
449
  "docstring": "",
465
450
  "path": "src/components/mds-pref-contrast/meta/types.ts"
466
451
  },
452
+ "src/type/language.ts::LanguageType": {
453
+ "declaration": "export type LanguageType =\n | 'auto'\n | `${Lowercase<string>}${Lowercase<string>}`\n | `${Lowercase<string>}${Lowercase<string>}${Lowercase<string>}`",
454
+ "docstring": "",
455
+ "path": "src/type/language.ts"
456
+ },
457
+ "src/event-detail/language.ts::MdsPrefLanguageEventDetail": {
458
+ "declaration": "export interface MdsPrefLanguageEventDetail {\n language?: LanguageType\n}",
459
+ "docstring": "",
460
+ "path": "src/event-detail/language.ts"
461
+ },
467
462
  "src/components/mds-pref-theme/meta/types.ts::ThemeModeType": {
468
463
  "declaration": "export type ThemeModeType =\n | 'light'\n | 'dark'\n | 'system'",
469
464
  "docstring": "",
package/loader/cdn.js CHANGED
@@ -1,3 +1,2 @@
1
-
2
1
  module.exports = require('../dist/cjs/loader.cjs.js');
3
- module.exports.applyPolyfills = function() { return Promise.resolve() };
2
+ module.exports.applyPolyfills = function() { return Promise.resolve() };
@@ -1,3 +1,2 @@
1
-
2
1
  module.exports = require('../dist/cjs/loader.cjs.js');
3
- module.exports.applyPolyfills = function() { return Promise.resolve() };
2
+ module.exports.applyPolyfills = function() { return Promise.resolve() };
package/loader/index.d.ts CHANGED
@@ -9,6 +9,9 @@ export interface CustomElementsDefineOptions {
9
9
  rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
10
10
  }
11
11
  export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
12
+ /**
13
+ * @deprecated
14
+ */
12
15
  export declare function applyPolyfills(): Promise<void>;
13
16
 
14
17
  /**
@@ -1,3 +1,2 @@
1
-
2
1
  export * from '../dist/esm/polyfills/index.js';
3
- export * from '../dist/esm/loader.js';
2
+ export * from '../dist/esm/loader.js';
package/loader/index.js CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  (function(){if("undefined"!==typeof window&&void 0!==window.Reflect&&void 0!==window.customElements){var a=HTMLElement;window.HTMLElement=function(){return Reflect.construct(a,[],this.constructor)};HTMLElement.prototype=a.prototype;HTMLElement.prototype.constructor=HTMLElement;Object.setPrototypeOf(HTMLElement,a)}})();
3
2
  export * from '../dist/esm/polyfills/index.js';
4
- export * from '../dist/esm-es5/loader.js';
3
+ export * from '../dist/esm-es5/loader.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-input-tip",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "mds-input-tip 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,36 +24,36 @@
24
24
  "test": "stencil test --spec --e2e"
25
25
  },
26
26
  "dependencies": {
27
- "@maggioli-design-system/mds-input-tip-item": "1.0.0",
28
- "@maggioli-design-system/styles": "14.3.2",
29
- "@stencil/core": "4.10.0"
30
- },
27
+ "@maggioli-design-system/mds-input-tip-item": "1.1.1",
28
+ "@maggioli-design-system/styles": "15.3.1",
29
+ "@stencil/core": "4.21.0"
30
+ },
31
31
  "license": "MIT",
32
32
  "author": {
33
33
  "name": "Vittorio Vittori",
34
34
  "email": "vittorio.vittori@maggioli.it",
35
35
  "url": "https://vitto.github.io/vit.to/"
36
- },
36
+ },
37
37
  "contributors": [
38
38
  {
39
- "name": "Andrea Pruccoli",
40
- "email": "andrea.pruccoli@maggioli.it",
41
- "role": "Software Engineer"
39
+ "name": "Andrea Pruccoli",
40
+ "email": "andrea.pruccoli@maggioli.it",
41
+ "role": "Software Engineer"
42
42
  },
43
43
  {
44
- "name": "Daniele Tardia",
45
- "email": "daniele.tardia@hibo.it",
46
- "role": "Senior Developer"
44
+ "name": "Daniele Tardia",
45
+ "email": "daniele.tardia@hibo.it",
46
+ "role": "Senior Developer"
47
47
  },
48
48
  {
49
- "name": "Nicola Tamburini",
50
- "email": "nicola.tamburini@maggioli.it",
51
- "role": "Software Engineer"
49
+ "name": "Nicola Tamburini",
50
+ "email": "nicola.tamburini@maggioli.it",
51
+ "role": "Software Engineer"
52
52
  },
53
53
  {
54
- "name": "Vittorio Vittori",
55
- "email": "vittorio.vittori@maggioli.it",
56
- "role": "Product Designer"
54
+ "name": "Vittorio Vittori",
55
+ "email": "vittorio.vittori@maggioli.it",
56
+ "role": "Product Designer"
57
57
  }
58
- ]
58
+ ]
59
59
  }
package/readme.md CHANGED
@@ -7,10 +7,10 @@
7
7
 
8
8
  ## Properties
9
9
 
10
- | Property | Attribute | Description | Type | Default |
11
- | ---------- | ---------- | --------------------------------------------------------------- | -------------------------------- | ------- |
12
- | `active` | `active` | Specifies the position of the element relative to its container | `boolean \| undefined` | `false` |
13
- | `position` | `position` | Specifies the position of the element relative to its container | `"bottom" \| "top" \| undefined` | `'top'` |
10
+ | Property | Attribute | Description | Type | Default |
11
+ | ---------- | ---------- | ----------------------------------------------------------------------- | -------------------------------- | ------- |
12
+ | `active` | `active` | Specifies if the component is active and shows expanded children or not | `boolean \| undefined` | `false` |
13
+ | `position` | `position` | Specifies the position of the element relative to its container | `"bottom" \| "top" \| undefined` | `'top'` |
14
14
 
15
15
 
16
16
  ## Dependencies
@@ -1,31 +1,70 @@
1
+ import Handlebars from 'handlebars'
2
+
1
3
  type LocaleConfig = {
2
- it?: Record<string, string>
3
- en?: Record<string, string>
4
- gr?: Record<string, string>
4
+ el?: Record<string, string | string[]>
5
+ en: Record<string, string | string[]>
6
+ es?: Record<string, string | string[]>
7
+ it?: Record<string, string | string[]>
5
8
  }
6
9
 
7
10
  export class Locale {
8
- defaultLanguage: string = 'en'
11
+ rollbackLanguage: string = 'en'
9
12
  language: string
10
13
  config: LocaleConfig
14
+ closestElement:HTMLElement
11
15
 
12
16
  constructor (configData: LocaleConfig) {
13
17
  this.config = configData
14
18
  }
15
19
 
16
20
  lang = (element: HTMLElement): void => {
17
- const closestElement:HTMLElement = element.closest('[lang]') as HTMLElement
18
- if (closestElement) {
19
- if (closestElement.lang) {
20
- 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
21
27
  return
22
28
  }
23
29
  }
24
30
 
25
- this.language = this.defaultLanguage
31
+ this.language = this.rollbackLanguage
32
+ }
33
+
34
+ private pluralize = (tag: string | string[], context: Record<string, string | number>): string => {
35
+
36
+ const languagePhrase: string | string[] = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]
37
+ const phrases: string[] = []
38
+
39
+ if (Array.isArray(languagePhrase)) {
40
+ phrases.push(languagePhrase[0])
41
+ phrases.push(languagePhrase[1])
42
+ } else {
43
+ phrases.push(languagePhrase)
44
+ phrases.push(languagePhrase)
45
+ }
46
+
47
+ const [ defaultPhrase ] = phrases
48
+ let translatePhrase: string = defaultPhrase
49
+
50
+ const keys = Object.keys(context)
51
+ if (keys.length > 0) {
52
+ const [firstKey] = keys
53
+ if (typeof context[firstKey] === 'number') {
54
+ if (context[firstKey] !== 1) {
55
+ translatePhrase = phrases[1]
56
+ }
57
+ }
58
+ }
59
+
60
+ const template = Handlebars.compile(translatePhrase)
61
+ return template(context)
26
62
  }
27
63
 
28
- get = (tag: string): string => {
29
- return this.config[this.language][tag] ?? this.config[this.defaultLanguage][tag]
64
+ get = (tag: string | string[], context?: Record<string, string | number>): string => {
65
+ if (context) {
66
+ return this.pluralize(tag, context)
67
+ }
68
+ return this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag]
30
69
  }
31
70
  }
@@ -0,0 +1,16 @@
1
+ @tailwind utilities;
2
+
3
+ @container style(--magma-pref-animation: reduce) {
4
+ :host {
5
+ transition-duration: 0s;
6
+ }
7
+ }
8
+
9
+ @container style(--magma-pref-animation: system) {
10
+
11
+ @media (prefers-reduced-motion) {
12
+ :host {
13
+ transition-duration: 0s;
14
+ }
15
+ }
16
+ }
@@ -19,34 +19,36 @@
19
19
  transform: var(--mds-input-tip-active-translate);
20
20
  }
21
21
 
22
- :host ( :empty ) {
22
+ :host(:empty) {
23
23
  display: none;
24
24
  }
25
25
 
26
- :host ( [position="top"] ) {
26
+ :host([position="top"]) {
27
27
  top: theme('spacing.100');
28
28
  }
29
29
 
30
- :host ( [position="bottom"] ) {
30
+ :host([position="bottom"]) {
31
31
  bottom: theme('spacing.100');
32
32
  }
33
33
 
34
- :host ( [position="top"][active]:not([active="false"]) ) {
34
+ :host([position="top"][active]:not([active="false"])) {
35
35
 
36
36
  --mds-input-tip-active-translate: translate(calc(theme('translate.100') * -1), calc(theme('translate.100') * -1));
37
37
  }
38
38
 
39
- :host( [position="top"][active]:not([active="false"]) ) ::slotted( mds-input-tip-item ) {
39
+ :host([position="top"][active]:not([active="false"])) ::slotted( mds-input-tip-item ) {
40
40
  border-top-left-radius: 0;
41
41
  border-top-right-radius: 0;
42
42
  }
43
43
 
44
- :host ( [position="bottom"][active]:not([active="false"]) ) {
44
+ :host([position="bottom"][active]:not([active="false"])) {
45
45
 
46
46
  --mds-input-tip-active-translate: translate(calc(theme('translate.100') * -1), theme('translate.100'));
47
47
  }
48
48
 
49
- :host( [position="bottom"][active]:not([active="false"]) ) ::slotted( mds-input-tip-item ) {
49
+ :host([position="bottom"][active]:not([active="false"])) ::slotted( mds-input-tip-item ) {
50
50
  border-bottom-left-radius: 0;
51
51
  border-bottom-right-radius: 0;
52
52
  }
53
+
54
+ @import './css/mds-input-tip-pref-animation.css';
@@ -9,7 +9,7 @@ import { InputTipPositionType } from './meta/types'
9
9
  export class MdsInputTip {
10
10
 
11
11
  /**
12
- * Specifies the position of the element relative to its container
12
+ * Specifies if the component is active and shows expanded children or not
13
13
  */
14
14
  @Prop({ reflect: true }) readonly active?: boolean = false
15
15
 
@@ -0,0 +1,8 @@
1
+ const inputTipPositionDictionary = [
2
+ 'top',
3
+ 'bottom',
4
+ ]
5
+
6
+ export {
7
+ inputTipPositionDictionary,
8
+ }
@@ -7,10 +7,10 @@
7
7
 
8
8
  ## Properties
9
9
 
10
- | Property | Attribute | Description | Type | Default |
11
- | ---------- | ---------- | --------------------------------------------------------------- | -------------------------------- | ------- |
12
- | `active` | `active` | Specifies the position of the element relative to its container | `boolean \| undefined` | `false` |
13
- | `position` | `position` | Specifies the position of the element relative to its container | `"bottom" \| "top" \| undefined` | `'top'` |
10
+ | Property | Attribute | Description | Type | Default |
11
+ | ---------- | ---------- | ----------------------------------------------------------------------- | -------------------------------- | ------- |
12
+ | `active` | `active` | Specifies if the component is active and shows expanded children or not | `boolean \| undefined` | `false` |
13
+ | `position` | `position` | Specifies the position of the element relative to its container | `"bottom" \| "top" \| undefined` | `'top'` |
14
14
 
15
15
 
16
16
  ----------------------------------------------
@@ -0,0 +1,26 @@
1
+ import { inputTipPositionDictionary } from '../meta/dictionary'
2
+ import { h } from '@stencil/core'
3
+
4
+ export default {
5
+ title: 'Form / Input Tip',
6
+ argTypes: {
7
+ active: {
8
+ type: { name: 'boolean' },
9
+ description: 'Specifies if the component is active and shows expanded children or not',
10
+ },
11
+ position: {
12
+ description: 'Specifies the position of the element relative to its container',
13
+ options: inputTipPositionDictionary,
14
+ control: { type: 'select' },
15
+ },
16
+ },
17
+ }
18
+
19
+ const Template = args =>
20
+ <mds-input-tip {...args}>
21
+ <mds-input-tip-item variant="required"></mds-input-tip-item>
22
+ <mds-input-tip-item variant="disabled"></mds-input-tip-item>
23
+ <mds-input-tip-item variant="readonly"></mds-input-tip-item>
24
+ </mds-input-tip>
25
+
26
+ export const Default = Template.bind({})
@@ -10,7 +10,7 @@ export { InputTipPositionType } from "./components/mds-input-tip/meta/types";
10
10
  export namespace Components {
11
11
  interface MdsInputTip {
12
12
  /**
13
- * Specifies the position of the element relative to its container
13
+ * Specifies if the component is active and shows expanded children or not
14
14
  */
15
15
  "active"?: boolean;
16
16
  /**
@@ -33,7 +33,7 @@ declare global {
33
33
  declare namespace LocalJSX {
34
34
  interface MdsInputTip {
35
35
  /**
36
- * Specifies the position of the element relative to its container
36
+ * Specifies if the component is active and shows expanded children or not
37
37
  */
38
38
  "active"?: boolean;
39
39
  /**
@@ -282,6 +282,7 @@
282
282
  "mi/baseline/badge",
283
283
  "mi/baseline/book",
284
284
  "mi/baseline/border-all",
285
+ "mi/baseline/broken-image",
285
286
  "mi/baseline/cancel",
286
287
  "mi/baseline/category",
287
288
  "mi/baseline/check-box",