@maggioli-design-system/mds-modal 4.11.3 → 4.11.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.
- package/dist/collection/common/date.js +13 -0
- package/dist/collection/common/locale.js +8 -2
- package/dist/collection/dictionary/button.js +6 -1
- package/dist/collection/dictionary/variant.js +6 -1
- package/dist/collection/type/date.js +1 -0
- package/dist/documentation.json +1 -1
- package/dist/stats.json +7 -3
- package/dist/types/common/date.d.ts +4 -0
- package/dist/types/common/locale.d.ts +3 -2
- package/dist/types/dictionary/button.d.ts +2 -1
- package/dist/types/dictionary/variant.d.ts +2 -1
- package/dist/types/type/date.d.ts +5 -0
- package/dist/types/type/variant.d.ts +1 -1
- package/documentation.json +18 -8
- package/package.json +2 -2
- package/readme.md +0 -13
- package/src/common/date.ts +21 -0
- package/src/common/locale.ts +10 -4
- package/src/dictionary/button.ts +7 -0
- package/src/dictionary/variant.ts +7 -0
- package/src/type/date.ts +10 -0
- package/src/type/variant.ts +1 -1
|
@@ -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
|
-
|
|
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
|
-
|
|
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 {};
|
package/dist/documentation.json
CHANGED
package/dist/stats.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-09-
|
|
2
|
+
"timestamp": "2024-09-26T10:59:56",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "node",
|
|
5
5
|
"version": "20.10.0"
|
|
@@ -9,13 +9,14 @@
|
|
|
9
9
|
"fsNamespace": "mds-modal",
|
|
10
10
|
"components": 1,
|
|
11
11
|
"entries": 1,
|
|
12
|
-
"bundles":
|
|
12
|
+
"bundles": 94,
|
|
13
13
|
"outputs": [
|
|
14
14
|
{
|
|
15
15
|
"name": "dist-collection",
|
|
16
|
-
"files":
|
|
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",
|
|
@@ -627,6 +629,7 @@
|
|
|
627
629
|
},
|
|
628
630
|
"sourceGraph": {
|
|
629
631
|
"./src/common/aria.ts": [],
|
|
632
|
+
"./src/common/date.ts": [],
|
|
630
633
|
"./src/common/file.ts": [],
|
|
631
634
|
"./src/common/icon.ts": [],
|
|
632
635
|
"./src/common/keyboard-manager.ts": [],
|
|
@@ -673,6 +676,7 @@
|
|
|
673
676
|
"./src/interface/input-value.ts": [],
|
|
674
677
|
"./src/type/autocomplete.ts": [],
|
|
675
678
|
"./src/type/button.ts": [],
|
|
679
|
+
"./src/type/date.ts": [],
|
|
676
680
|
"./src/type/file-types.ts": [],
|
|
677
681
|
"./src/type/floating-ui.ts": [],
|
|
678
682
|
"./src/type/form-rel.ts": [],
|
|
@@ -9,8 +9,9 @@ export declare class Locale {
|
|
|
9
9
|
language: string;
|
|
10
10
|
config: LocaleConfig;
|
|
11
11
|
closestElement: HTMLElement;
|
|
12
|
-
constructor(configData
|
|
13
|
-
|
|
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
|
-
|
|
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, };
|
|
@@ -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 = '
|
|
11
|
+
export type ToneSimpleVariantType = 'quiet' | 'strong' | 'weak';
|
|
12
12
|
export type ToneMinimalVariantType = 'strong' | 'weak';
|
package/documentation.json
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"timestamp": "2024-09-
|
|
2
|
+
"timestamp": "2024-09-26T07:00:37",
|
|
3
3
|
"compiler": {
|
|
4
4
|
"name": "@stencil/core",
|
|
5
5
|
"version": "4.21.0",
|
|
@@ -252,8 +252,8 @@
|
|
|
252
252
|
"docstring": "",
|
|
253
253
|
"path": "src/type/variant.ts"
|
|
254
254
|
},
|
|
255
|
-
"src/type/variant.ts::
|
|
256
|
-
"declaration": "export type
|
|
255
|
+
"src/type/variant.ts::ToneVariantType": {
|
|
256
|
+
"declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
|
|
257
257
|
"docstring": "",
|
|
258
258
|
"path": "src/type/variant.ts"
|
|
259
259
|
},
|
|
@@ -277,6 +277,11 @@
|
|
|
277
277
|
"docstring": "",
|
|
278
278
|
"path": "src/type/variant.ts"
|
|
279
279
|
},
|
|
280
|
+
"src/type/variant.ts::ToneSimpleVariantType": {
|
|
281
|
+
"declaration": "export type ToneSimpleVariantType =\n | 'quiet'\n | 'strong'\n | 'weak'",
|
|
282
|
+
"docstring": "",
|
|
283
|
+
"path": "src/type/variant.ts"
|
|
284
|
+
},
|
|
280
285
|
"src/components/mds-benchmark-bar/meta/types.ts::BenchmarkBarTypographyType": {
|
|
281
286
|
"declaration": "export type BenchmarkBarTypographyType =\n | 'option'\n | 'label'",
|
|
282
287
|
"docstring": "",
|
|
@@ -317,11 +322,6 @@
|
|
|
317
322
|
"docstring": "",
|
|
318
323
|
"path": "src/type/button.ts"
|
|
319
324
|
},
|
|
320
|
-
"src/type/variant.ts::ToneVariantType": {
|
|
321
|
-
"declaration": "export type ToneVariantType =\n | 'strong' // background strong\n | 'weak' // background weak\n | 'ghost' // bordered\n | 'quiet'",
|
|
322
|
-
"docstring": "",
|
|
323
|
-
"path": "src/type/variant.ts"
|
|
324
|
-
},
|
|
325
325
|
"src/type/button.ts::ButtonSizeType": {
|
|
326
326
|
"declaration": "export type ButtonSizeType =\n | 'sm'\n | 'md'\n | 'lg'\n | 'xl'",
|
|
327
327
|
"docstring": "",
|
|
@@ -597,6 +597,16 @@
|
|
|
597
597
|
"docstring": "",
|
|
598
598
|
"path": "src/components/mds-progress/meta/types.ts"
|
|
599
599
|
},
|
|
600
|
+
"src/type/date.ts::ISO8601Date": {
|
|
601
|
+
"declaration": "type ISO8601Date = ISO8601DateFormat<string, 'ISO8601Date'>",
|
|
602
|
+
"docstring": "",
|
|
603
|
+
"path": "src/type/date.ts"
|
|
604
|
+
},
|
|
605
|
+
"src/components/mds-push-notification/meta/types.ts::NotificationDateFormatType": {
|
|
606
|
+
"declaration": "string",
|
|
607
|
+
"docstring": "",
|
|
608
|
+
"path": "src/components/mds-push-notification/meta/types.ts"
|
|
609
|
+
},
|
|
600
610
|
"src/components/mds-push-notification/meta/types.ts::NotificationPreviewType": {
|
|
601
611
|
"declaration": "export type NotificationPreviewType =\n | 'avatar'\n | 'image'",
|
|
602
612
|
"docstring": "",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-design-system/mds-modal",
|
|
3
|
-
"version": "4.11.
|
|
3
|
+
"version": "4.11.4",
|
|
4
4
|
"description": "mds-modal 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-button": "5.
|
|
27
|
+
"@maggioli-design-system/mds-button": "5.1.0",
|
|
28
28
|
"@maggioli-design-system/styles": "15.3.2",
|
|
29
29
|
"@stencil/core": "4.21.0",
|
|
30
30
|
"clsx": "2.1.0"
|
package/readme.md
CHANGED
|
@@ -39,19 +39,6 @@ This is a web-component from Maggioli Design System [Magma](https://magma.maggio
|
|
|
39
39
|
| `"window"` | |
|
|
40
40
|
|
|
41
41
|
|
|
42
|
-
## CSS Custom Properties
|
|
43
|
-
|
|
44
|
-
| Name | Description |
|
|
45
|
-
| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
46
|
-
| `--mds-modal-close-icon-color` | Set the color of the close icon button to the top left. |
|
|
47
|
-
| `--mds-modal-overlay-color` | Set the overlay color of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`. |
|
|
48
|
-
| `--mds-modal-overlay-opacity` | Set the overlay color opacity of the background when the component is opened, this property can be inherited from `globals.css` in `styles^8.0.0`. |
|
|
49
|
-
| `--mds-modal-window-background` | Set the background color of the window |
|
|
50
|
-
| `--mds-modal-window-overflow` | Set the overflow of the window |
|
|
51
|
-
| `--mds-modal-window-shadow` | Set the box shadow of the window |
|
|
52
|
-
| `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
|
|
53
|
-
|
|
54
|
-
|
|
55
42
|
## Dependencies
|
|
56
43
|
|
|
57
44
|
### Used by
|
|
@@ -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
|
+
}
|
package/src/common/locale.ts
CHANGED
|
@@ -13,22 +13,28 @@ export class Locale {
|
|
|
13
13
|
config: LocaleConfig
|
|
14
14
|
closestElement:HTMLElement
|
|
15
15
|
|
|
16
|
-
constructor (configData
|
|
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):
|
|
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 => {
|
package/src/dictionary/button.ts
CHANGED
|
@@ -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
|
}
|
package/src/type/date.ts
ADDED
|
@@ -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
|
+
}
|
package/src/type/variant.ts
CHANGED