@maggioli-design-system/mds-input-select 2.0.3 → 2.0.4

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.
@@ -0,0 +1,13 @@
1
+ // ISO 8601 date regex allowing optional components (month, day, time)
2
+ const ISO8601RegexString = '^\\d{4}(-\\d{2})?(-\\d{2})?(T\\d{2}(:\\d{2})?(:\\d{2})?(\\.\\d{3})?)?([+-]\\d{2}:\\d{2}|Z)?$';
3
+ const isISO8601Date = (dateString) => {
4
+ const ISO8601Regex = new RegExp(ISO8601RegexString);
5
+ return ISO8601Regex.test(dateString);
6
+ };
7
+ const sanitizeISO8601Date = (dateString) => {
8
+ if (isISO8601Date(dateString)) {
9
+ return dateString;
10
+ }
11
+ return new Date(dateString).toISOString();
12
+ };
13
+ export { sanitizeISO8601Date, isISO8601Date, };
@@ -2,15 +2,19 @@ import Handlebars from "handlebars";
2
2
  export class Locale {
3
3
  constructor(configData) {
4
4
  this.rollbackLanguage = 'en';
5
+ this.set = (configData) => {
6
+ this.config = configData;
7
+ };
5
8
  this.lang = (element) => {
6
9
  this.closestElement = element.closest('[lang]');
7
10
  if (this.closestElement) {
8
11
  if (this.closestElement.lang) {
9
12
  this.language = this.closestElement.lang;
10
- return;
13
+ return this.language;
11
14
  }
12
15
  }
13
16
  this.language = this.rollbackLanguage;
17
+ return this.language;
14
18
  };
15
19
  this.pluralize = (tag, context) => {
16
20
  const languagePhrase = this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag];
@@ -43,6 +47,8 @@ export class Locale {
43
47
  }
44
48
  return this.config[this.language] ? this.config[this.language][tag] : this.config[this.rollbackLanguage][tag];
45
49
  };
46
- this.config = configData;
50
+ if (configData) {
51
+ this.set(configData);
52
+ }
47
53
  }
48
54
  }
@@ -27,4 +27,9 @@ const buttonIconPositionDictionary = [
27
27
  'left',
28
28
  'right',
29
29
  ];
30
- export { buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneVariantDictionary, buttonVariantDictionary, };
30
+ const buttonTypeDictionary = [
31
+ 'button',
32
+ 'submit',
33
+ 'reset',
34
+ ];
35
+ export { buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, };
@@ -83,8 +83,13 @@ const toneSimpleVariantDictionary = [
83
83
  'weak',
84
84
  'quiet',
85
85
  ];
86
+ const toneSmartVariantDictionary = [
87
+ 'strong',
88
+ 'weak',
89
+ 'ghost',
90
+ ];
86
91
  const toneMinimalVariantDictionary = [
87
92
  'strong',
88
93
  'weak',
89
94
  ];
90
- export { themeFullVariantAvatarDictionary, themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneVariantDictionary, };
95
+ export { themeFullVariantAvatarDictionary, themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneSmartVariantDictionary, toneVariantDictionary, };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-09-17T06:00:25",
2
+ "timestamp": "2024-09-26T11:04:53",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.21.0",
package/dist/stats.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-09-17T06:00:25",
2
+ "timestamp": "2024-09-26T11:04:53",
3
3
  "compiler": {
4
4
  "name": "node",
5
5
  "version": "20.10.0"
@@ -9,13 +9,14 @@
9
9
  "fsNamespace": "mds-input-select",
10
10
  "components": 1,
11
11
  "entries": 1,
12
- "bundles": 90,
12
+ "bundles": 92,
13
13
  "outputs": [
14
14
  {
15
15
  "name": "dist-collection",
16
- "files": 42,
16
+ "files": 44,
17
17
  "generatedFiles": [
18
18
  "./dist/collection/common/aria.js",
19
+ "./dist/collection/common/date.js",
19
20
  "./dist/collection/common/file.js",
20
21
  "./dist/collection/common/icon.js",
21
22
  "./dist/collection/common/keyboard-manager.js",
@@ -46,6 +47,7 @@
46
47
  "./dist/collection/interface/input-value.js",
47
48
  "./dist/collection/type/autocomplete.js",
48
49
  "./dist/collection/type/button.js",
50
+ "./dist/collection/type/date.js",
49
51
  "./dist/collection/type/file-types.js",
50
52
  "./dist/collection/type/floating-ui.js",
51
53
  "./dist/collection/type/form-rel.js",
@@ -869,6 +871,7 @@
869
871
  },
870
872
  "sourceGraph": {
871
873
  "./src/common/aria.ts": [],
874
+ "./src/common/date.ts": [],
872
875
  "./src/common/file.ts": [],
873
876
  "./src/common/icon.ts": [],
874
877
  "./src/common/keyboard-manager.ts": [],
@@ -911,6 +914,7 @@
911
914
  "./src/interface/input-value.ts": [],
912
915
  "./src/type/autocomplete.ts": [],
913
916
  "./src/type/button.ts": [],
917
+ "./src/type/date.ts": [],
914
918
  "./src/type/file-types.ts": [],
915
919
  "./src/type/floating-ui.ts": [],
916
920
  "./src/type/form-rel.ts": [],
@@ -0,0 +1,4 @@
1
+ import { ISO8601Date } from '@type/date';
2
+ declare const isISO8601Date: (dateString: string) => boolean;
3
+ declare const sanitizeISO8601Date: (dateString: string) => ISO8601Date;
4
+ export { sanitizeISO8601Date, isISO8601Date, };
@@ -9,8 +9,9 @@ export declare class Locale {
9
9
  language: string;
10
10
  config: LocaleConfig;
11
11
  closestElement: HTMLElement;
12
- constructor(configData: LocaleConfig);
13
- lang: (element: HTMLElement) => void;
12
+ constructor(configData?: LocaleConfig);
13
+ set: (configData: LocaleConfig) => void;
14
+ lang: (element: HTMLElement) => string;
14
15
  private pluralize;
15
16
  get: (tag: string | string[], context?: Record<string, string | number>) => string;
16
17
  }
@@ -3,4 +3,5 @@ declare const buttonToneVariantDictionary: string[];
3
3
  declare const buttonTargetDictionary: string[];
4
4
  declare const buttonSizeDictionary: string[];
5
5
  declare const buttonIconPositionDictionary: string[];
6
- export { buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneVariantDictionary, buttonVariantDictionary, };
6
+ declare const buttonTypeDictionary: string[];
7
+ export { buttonIconPositionDictionary, buttonSizeDictionary, buttonTargetDictionary, buttonToneVariantDictionary, buttonTypeDictionary, buttonVariantDictionary, };
@@ -7,5 +7,6 @@ declare const themeLabelVariantDictionary: string[];
7
7
  declare const toneVariantDictionary: string[];
8
8
  declare const toneActionVariantDictionary: string[];
9
9
  declare const toneSimpleVariantDictionary: string[];
10
+ declare const toneSmartVariantDictionary: string[];
10
11
  declare const toneMinimalVariantDictionary: string[];
11
- export { themeFullVariantAvatarDictionary, themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneVariantDictionary, };
12
+ export { themeFullVariantAvatarDictionary, themeFullVariantDictionary, themeLabelVariantDictionary, themeLuminanceVariantDictionary, themeStatusVariantDictionary, themeVariantDictionary, toneActionVariantDictionary, toneMinimalVariantDictionary, toneSimpleVariantDictionary, toneSmartVariantDictionary, toneVariantDictionary, };
@@ -0,0 +1,5 @@
1
+ type ISO8601DateFormat<K, T> = K & {
2
+ __isISO8601DateFormat: T;
3
+ };
4
+ type ISO8601Date = ISO8601DateFormat<string, 'ISO8601Date'>;
5
+ export { ISO8601Date, };
@@ -8,5 +8,5 @@ export type ActionVariantType = 'primary' | 'dark' | 'light';
8
8
  export type StateVariantType = 'disabled' | 'focused' | 'readonly';
9
9
  export type ToneActionVariantType = 'primary' | 'secondary' | 'tertiary' | 'strong' | 'weak' | 'ghost' | 'quiet';
10
10
  export type ToneVariantType = 'strong' | 'weak' | 'ghost' | 'quiet';
11
- export type ToneSimpleVariantType = 'strong' | 'weak' | 'quiet';
11
+ export type ToneSimpleVariantType = 'quiet' | 'strong' | 'weak';
12
12
  export type ToneMinimalVariantType = 'strong' | 'weak';
@@ -1,5 +1,5 @@
1
1
  {
2
- "timestamp": "2024-09-17T03:14:28",
2
+ "timestamp": "2024-09-26T07:00:37",
3
3
  "compiler": {
4
4
  "name": "@stencil/core",
5
5
  "version": "4.21.0",
@@ -376,8 +376,8 @@
376
376
  "docstring": "",
377
377
  "path": "src/type/variant.ts"
378
378
  },
379
- "src/type/variant.ts::ToneSimpleVariantType": {
380
- "declaration": "export type ToneSimpleVariantType =\n | 'strong'\n | 'weak'\n | 'quiet'",
379
+ "src/type/variant.ts::ToneVariantType": {
380
+ "declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
381
381
  "docstring": "",
382
382
  "path": "src/type/variant.ts"
383
383
  },
@@ -401,6 +401,11 @@
401
401
  "docstring": "",
402
402
  "path": "src/type/variant.ts"
403
403
  },
404
+ "src/type/variant.ts::ToneSimpleVariantType": {
405
+ "declaration": "export type ToneSimpleVariantType =\n | 'quiet'\n | 'strong'\n | 'weak'",
406
+ "docstring": "",
407
+ "path": "src/type/variant.ts"
408
+ },
404
409
  "src/components/mds-benchmark-bar/meta/types.ts::BenchmarkBarTypographyType": {
405
410
  "declaration": "export type BenchmarkBarTypographyType =\n | 'option'\n | 'label'",
406
411
  "docstring": "",
@@ -441,11 +446,6 @@
441
446
  "docstring": "",
442
447
  "path": "src/type/button.ts"
443
448
  },
444
- "src/type/variant.ts::ToneVariantType": {
445
- "declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
446
- "docstring": "",
447
- "path": "src/type/variant.ts"
448
- },
449
449
  "src/type/button.ts::ButtonSizeType": {
450
450
  "declaration": "export type ButtonSizeType =\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'",
451
451
  "docstring": "",
@@ -721,6 +721,16 @@
721
721
  "docstring": "",
722
722
  "path": "src/components/mds-progress/meta/types.ts"
723
723
  },
724
+ "src/type/date.ts::ISO8601Date": {
725
+ "declaration": "type ISO8601Date = ISO8601DateFormat<string, 'ISO8601Date'>",
726
+ "docstring": "",
727
+ "path": "src/type/date.ts"
728
+ },
729
+ "src/components/mds-push-notification/meta/types.ts::NotificationDateFormatType": {
730
+ "declaration": "string",
731
+ "docstring": "",
732
+ "path": "src/components/mds-push-notification/meta/types.ts"
733
+ },
724
734
  "src/components/mds-push-notification/meta/types.ts::NotificationPreviewType": {
725
735
  "declaration": "export type NotificationPreviewType =\n | 'avatar'\n | 'image'",
726
736
  "docstring": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-input-select",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "mds-input-select 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",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@maggioli-design-system/styles": "15.3.2",
28
- "@maggioli-design-system/mds-input-tip": "1.1.2",
28
+ "@maggioli-design-system/mds-input-tip": "1.1.3",
29
29
  "@stencil/core": "4.21.0",
30
30
  "clsx": "2.1.0"
31
31
  },
@@ -0,0 +1,21 @@
1
+ import { ISO8601Date } from '@type/date'
2
+
3
+ // ISO 8601 date regex allowing optional components (month, day, time)
4
+ const ISO8601RegexString = '^\\d{4}(-\\d{2})?(-\\d{2})?(T\\d{2}(:\\d{2})?(:\\d{2})?(\\.\\d{3})?)?([+-]\\d{2}:\\d{2}|Z)?$'
5
+
6
+ const isISO8601Date = (dateString: string): boolean => {
7
+ const ISO8601Regex = new RegExp(ISO8601RegexString)
8
+ return ISO8601Regex.test(dateString)
9
+ }
10
+
11
+ const sanitizeISO8601Date = (dateString: string): ISO8601Date => {
12
+ if (isISO8601Date(dateString)) {
13
+ return dateString as ISO8601Date
14
+ }
15
+ return new Date(dateString).toISOString() as ISO8601Date
16
+ }
17
+
18
+ export {
19
+ sanitizeISO8601Date,
20
+ isISO8601Date,
21
+ }
@@ -13,22 +13,28 @@ export class Locale {
13
13
  config: LocaleConfig
14
14
  closestElement:HTMLElement
15
15
 
16
- constructor (configData: LocaleConfig) {
16
+ constructor (configData?: LocaleConfig) {
17
+ if (configData) {
18
+ this.set(configData)
19
+ }
20
+ }
21
+
22
+ set = (configData: LocaleConfig): void => {
17
23
  this.config = configData
18
24
  }
19
25
 
20
- lang = (element: HTMLElement): void => {
26
+ lang = (element: HTMLElement): string => {
21
27
  this.closestElement = element.closest('[lang]') as HTMLElement
22
28
 
23
-
24
29
  if (this.closestElement) {
25
30
  if (this.closestElement.lang) {
26
31
  this.language = this.closestElement.lang
27
- return
32
+ return this.language
28
33
  }
29
34
  }
30
35
 
31
36
  this.language = this.rollbackLanguage
37
+ return this.language
32
38
  }
33
39
 
34
40
  private pluralize = (tag: string | string[], context: Record<string, string | number>): string => {
@@ -32,10 +32,17 @@ const buttonIconPositionDictionary = [
32
32
  'right',
33
33
  ]
34
34
 
35
+ const buttonTypeDictionary = [
36
+ 'button',
37
+ 'submit',
38
+ 'reset',
39
+ ]
40
+
35
41
  export {
36
42
  buttonIconPositionDictionary,
37
43
  buttonSizeDictionary,
38
44
  buttonTargetDictionary,
39
45
  buttonToneVariantDictionary,
46
+ buttonTypeDictionary,
40
47
  buttonVariantDictionary,
41
48
  }
@@ -92,6 +92,12 @@ const toneSimpleVariantDictionary = [
92
92
  'quiet',
93
93
  ]
94
94
 
95
+ const toneSmartVariantDictionary = [
96
+ 'strong',
97
+ 'weak',
98
+ 'ghost',
99
+ ]
100
+
95
101
  const toneMinimalVariantDictionary = [
96
102
  'strong',
97
103
  'weak',
@@ -107,5 +113,6 @@ export {
107
113
  toneActionVariantDictionary,
108
114
  toneMinimalVariantDictionary,
109
115
  toneSimpleVariantDictionary,
116
+ toneSmartVariantDictionary,
110
117
  toneVariantDictionary,
111
118
  }
@@ -33,6 +33,7 @@
33
33
  "mgg/address-book-off",
34
34
  "mgg/address-book-on",
35
35
  "mgg/adv-denied",
36
+ "mgg/ai",
36
37
  "mgg/alerts-pagopa",
37
38
  "mgg/ansc",
38
39
  "mgg/area-edificabile",
@@ -86,8 +87,16 @@
86
87
  "mgg/download-csv",
87
88
  "mgg/download-json",
88
89
  "mgg/electronic-document",
90
+ "mgg/email-assigned",
91
+ "mgg/email-open-blocked",
89
92
  "mgg/email-open-check",
93
+ "mgg/email-open-lock",
90
94
  "mgg/email-open-off",
95
+ "mgg/email-open-play",
96
+ "mgg/email-open-stop",
97
+ "mgg/email-open-user",
98
+ "mgg/email-open-view",
99
+ "mgg/email-to-assign",
91
100
  "mgg/face-to-face-meeting",
92
101
  "mgg/factory",
93
102
  "mgg/farmer",
@@ -115,12 +124,19 @@
115
124
  "mgg/fit-vertical",
116
125
  "mgg/forwarded-with-a-single-sending",
117
126
  "mgg/fullscreen-on-alt",
127
+ "mgg/google-book-closed",
128
+ "mgg/google-book-closed-outline",
129
+ "mgg/google-book-large",
130
+ "mgg/google-book-large-outline",
131
+ "mgg/google-book-opening",
132
+ "mgg/google-book-opening-outline",
118
133
  "mgg/google-check-small",
119
134
  "mgg/google-experiment",
120
135
  "mgg/google-face-retouching-off",
121
136
  "mgg/google-hub",
122
137
  "mgg/google-keyboard-double-arrow-down",
123
138
  "mgg/google-keyboard-double-arrow-up",
139
+ "mgg/google-newsstand",
124
140
  "mgg/google-place-item",
125
141
  "mgg/group-assigned-automatically-system",
126
142
  "mgg/group-ceased",
@@ -130,6 +146,7 @@
130
146
  "mgg/historic-building",
131
147
  "mgg/historic-building-unusable",
132
148
  "mgg/home-hammer",
149
+ "mgg/home-link",
133
150
  "mgg/home-number",
134
151
  "mgg/inagibile",
135
152
  "mgg/input-calendar-costs",
@@ -21,6 +21,7 @@
21
21
  "mgg/address-book-off",
22
22
  "mgg/address-book-on",
23
23
  "mgg/adv-denied",
24
+ "mgg/ai",
24
25
  "mgg/alerts-pagopa",
25
26
  "mgg/ansc",
26
27
  "mgg/area-edificabile",
@@ -74,8 +75,16 @@
74
75
  "mgg/download-csv",
75
76
  "mgg/download-json",
76
77
  "mgg/electronic-document",
78
+ "mgg/email-assigned",
79
+ "mgg/email-open-blocked",
77
80
  "mgg/email-open-check",
81
+ "mgg/email-open-lock",
78
82
  "mgg/email-open-off",
83
+ "mgg/email-open-play",
84
+ "mgg/email-open-stop",
85
+ "mgg/email-open-user",
86
+ "mgg/email-open-view",
87
+ "mgg/email-to-assign",
79
88
  "mgg/face-to-face-meeting",
80
89
  "mgg/factory",
81
90
  "mgg/farmer",
@@ -103,12 +112,19 @@
103
112
  "mgg/fit-vertical",
104
113
  "mgg/forwarded-with-a-single-sending",
105
114
  "mgg/fullscreen-on-alt",
115
+ "mgg/google-book-closed-outline",
116
+ "mgg/google-book-closed",
117
+ "mgg/google-book-large-outline",
118
+ "mgg/google-book-large",
119
+ "mgg/google-book-opening-outline",
120
+ "mgg/google-book-opening",
106
121
  "mgg/google-check-small",
107
122
  "mgg/google-experiment",
108
123
  "mgg/google-face-retouching-off",
109
124
  "mgg/google-hub",
110
125
  "mgg/google-keyboard-double-arrow-down",
111
126
  "mgg/google-keyboard-double-arrow-up",
127
+ "mgg/google-newsstand",
112
128
  "mgg/google-place-item",
113
129
  "mgg/group-assigned-automatically-system",
114
130
  "mgg/group-ceased",
@@ -118,6 +134,7 @@
118
134
  "mgg/historic-building-unusable",
119
135
  "mgg/historic-building",
120
136
  "mgg/home-hammer",
137
+ "mgg/home-link",
121
138
  "mgg/home-number",
122
139
  "mgg/inagibile",
123
140
  "mgg/input-calendar-costs",
@@ -0,0 +1,10 @@
1
+ type ISO8601DateFormat<K, T> = K & { __isISO8601DateFormat: T };
2
+
3
+ // Defines a branded type for the date ISO 8601 string
4
+ type ISO8601Date = ISO8601DateFormat<string, 'ISO8601Date'>
5
+
6
+ // const validDate: ISO8601Date = sanitizeISO8601Date('2024-09-24T15:30:00Z')
7
+
8
+ export {
9
+ ISO8601Date,
10
+ }
@@ -90,9 +90,9 @@ export type ToneVariantType =
90
90
  | 'quiet' // no background, no border
91
91
 
92
92
  export type ToneSimpleVariantType =
93
+ | 'quiet'
93
94
  | 'strong'
94
95
  | 'weak'
95
- | 'quiet'
96
96
 
97
97
  export type ToneMinimalVariantType =
98
98
  | 'strong'