@maggioli-design-system/mds-input-tip 1.1.2 → 1.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -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-17T05:58:48",
2
+ "timestamp": "2024-09-26T10:58:34",
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-17T05:58:48",
2
+ "timestamp": "2024-09-26T10:58:34",
3
3
  "compiler": {
4
4
  "name": "node",
5
5
  "version": "20.10.0"
@@ -9,13 +9,14 @@
9
9
  "fsNamespace": "mds-input-tip",
10
10
  "components": 1,
11
11
  "entries": 1,
12
- "bundles": 92,
12
+ "bundles": 94,
13
13
  "outputs": [
14
14
  {
15
15
  "name": "dist-collection",
16
- "files": 44,
16
+ "files": 46,
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",
@@ -48,6 +49,7 @@
48
49
  "./dist/collection/interface/input-value.js",
49
50
  "./dist/collection/type/autocomplete.js",
50
51
  "./dist/collection/type/button.js",
52
+ "./dist/collection/type/date.js",
51
53
  "./dist/collection/type/file-types.js",
52
54
  "./dist/collection/type/floating-ui.js",
53
55
  "./dist/collection/type/form-rel.js",
@@ -452,6 +454,7 @@
452
454
  },
453
455
  "sourceGraph": {
454
456
  "./src/common/aria.ts": [],
457
+ "./src/common/date.ts": [],
455
458
  "./src/common/file.ts": [],
456
459
  "./src/common/icon.ts": [],
457
460
  "./src/common/keyboard-manager.ts": [],
@@ -498,6 +501,7 @@
498
501
  "./src/interface/input-value.ts": [],
499
502
  "./src/type/autocomplete.ts": [],
500
503
  "./src/type/button.ts": [],
504
+ "./src/type/date.ts": [],
501
505
  "./src/type/file-types.ts": [],
502
506
  "./src/type/floating-ui.ts": [],
503
507
  "./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",
@@ -134,8 +134,8 @@
134
134
  "docstring": "",
135
135
  "path": "src/type/variant.ts"
136
136
  },
137
- "src/type/variant.ts::ToneSimpleVariantType": {
138
- "declaration": "export type ToneSimpleVariantType =\n | 'strong'\n | 'weak'\n | 'quiet'",
137
+ "src/type/variant.ts::ToneVariantType": {
138
+ "declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
139
139
  "docstring": "",
140
140
  "path": "src/type/variant.ts"
141
141
  },
@@ -159,6 +159,11 @@
159
159
  "docstring": "",
160
160
  "path": "src/type/variant.ts"
161
161
  },
162
+ "src/type/variant.ts::ToneSimpleVariantType": {
163
+ "declaration": "export type ToneSimpleVariantType =\n | 'quiet'\n | 'strong'\n | 'weak'",
164
+ "docstring": "",
165
+ "path": "src/type/variant.ts"
166
+ },
162
167
  "src/components/mds-benchmark-bar/meta/types.ts::BenchmarkBarTypographyType": {
163
168
  "declaration": "export type BenchmarkBarTypographyType =\n | 'option'\n | 'label'",
164
169
  "docstring": "",
@@ -199,11 +204,6 @@
199
204
  "docstring": "",
200
205
  "path": "src/type/button.ts"
201
206
  },
202
- "src/type/variant.ts::ToneVariantType": {
203
- "declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
204
- "docstring": "",
205
- "path": "src/type/variant.ts"
206
- },
207
207
  "src/type/button.ts::ButtonSizeType": {
208
208
  "declaration": "export type ButtonSizeType =\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'",
209
209
  "docstring": "",
@@ -479,6 +479,16 @@
479
479
  "docstring": "",
480
480
  "path": "src/components/mds-progress/meta/types.ts"
481
481
  },
482
+ "src/type/date.ts::ISO8601Date": {
483
+ "declaration": "type ISO8601Date = ISO8601DateFormat<string, 'ISO8601Date'>",
484
+ "docstring": "",
485
+ "path": "src/type/date.ts"
486
+ },
487
+ "src/components/mds-push-notification/meta/types.ts::NotificationDateFormatType": {
488
+ "declaration": "string",
489
+ "docstring": "",
490
+ "path": "src/components/mds-push-notification/meta/types.ts"
491
+ },
482
492
  "src/components/mds-push-notification/meta/types.ts::NotificationPreviewType": {
483
493
  "declaration": "export type NotificationPreviewType =\n | 'avatar'\n | 'image'",
484
494
  "docstring": "",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/mds-input-tip",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
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,7 +24,7 @@
24
24
  "test": "stencil test --spec --e2e"
25
25
  },
26
26
  "dependencies": {
27
- "@maggioli-design-system/mds-input-tip-item": "1.1.2",
27
+ "@maggioli-design-system/mds-input-tip-item": "1.1.3",
28
28
  "@maggioli-design-system/styles": "15.3.2",
29
29
  "@stencil/core": "4.21.0"
30
30
  },
@@ -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'