@maggioli-design-system/mds-modal 5.1.0 → 5.3.0
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/cjs/{index-7b5471f5.js → index-6f236cfa.js} +164 -69
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mds-modal.cjs.entry.js +16 -7
- package/dist/cjs/mds-modal.cjs.js +2 -2
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/common/floating-controller.js +180 -0
- package/dist/collection/common/slot.js +19 -0
- package/dist/collection/components/mds-modal/mds-modal.css +10 -23
- package/dist/collection/components/mds-modal/mds-modal.js +20 -5
- package/dist/collection/components/mds-modal/test/mds-modal.stories.js +7 -2
- package/dist/collection/dictionary/animation.js +5 -0
- package/dist/collection/dictionary/file-extensions.js +6 -59
- package/dist/collection/dictionary/tree.js +13 -0
- package/dist/collection/fixtures/filenames.js +62 -1
- package/dist/collection/type/animation.js +1 -0
- package/dist/collection/type/tree.js +1 -0
- package/dist/collection/type/variant-file-format.js +5 -0
- package/dist/components/mds-modal.js +15 -6
- package/dist/documentation.d.ts +8 -0
- package/dist/documentation.json +21 -5
- package/dist/esm/{index-1c34ac95.js → index-f8d2dee4.js} +164 -69
- package/dist/esm/loader.js +2 -2
- package/dist/esm/mds-modal.entry.js +16 -7
- package/dist/esm/mds-modal.js +3 -3
- package/dist/esm-es5/index-f8d2dee4.js +1 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/mds-modal.entry.js +1 -1
- package/dist/esm-es5/mds-modal.js +1 -1
- package/dist/mds-modal/mds-modal.esm.js +1 -1
- package/dist/mds-modal/mds-modal.js +1 -1
- package/dist/mds-modal/p-413a00c5.entry.js +1 -0
- package/dist/mds-modal/p-96958acc.system.entry.js +1 -0
- package/dist/mds-modal/p-bc1fa4e4.system.js +2 -0
- package/dist/mds-modal/p-c6899cb0.system.js +1 -0
- package/dist/mds-modal/p-ee90f86a.js +2 -0
- package/dist/stats.json +77 -38
- package/dist/types/common/floating-controller.d.ts +46 -0
- package/dist/types/common/slot.d.ts +3 -0
- package/dist/types/components/mds-modal/test/mds-modal.stories.d.ts +2 -1
- package/dist/types/dictionary/animation.d.ts +2 -0
- package/dist/types/dictionary/tree.d.ts +4 -0
- package/dist/types/fixtures/filenames.d.ts +62 -1
- package/dist/types/type/animation.d.ts +1 -0
- package/dist/types/type/file-types.d.ts +1 -1
- package/dist/types/type/tree.d.ts +3 -0
- package/dist/types/type/variant-file-format.d.ts +1 -1
- package/documentation.json +62 -16
- package/package.json +4 -4
- package/readme.md +2 -0
- package/src/common/floating-controller.ts +263 -0
- package/src/common/slot.ts +24 -0
- package/src/components/mds-modal/css/mds-modal-animate-left.css +2 -1
- package/src/components/mds-modal/css/mds-modal-animate-right.css +2 -1
- package/src/components/mds-modal/css/mds-modal-animate.css +0 -10
- package/src/components/mds-modal/mds-modal.css +6 -0
- package/src/components/mds-modal/mds-modal.tsx +1 -1
- package/src/components/mds-modal/readme.md +2 -0
- package/src/components/mds-modal/test/mds-modal.stories.tsx +10 -4
- package/src/dictionary/animation.ts +8 -0
- package/src/dictionary/file-extensions.ts +6 -60
- package/src/dictionary/tree.ts +21 -0
- package/src/fixtures/filenames.ts +63 -0
- package/src/fixtures/icons.json +21 -0
- package/src/fixtures/iconsauce.json +6 -0
- package/src/meta/file-format/locale.el.json +26 -21
- package/src/meta/file-format/locale.en.json +26 -21
- package/src/meta/file-format/locale.es.json +26 -21
- package/src/meta/file-format/locale.it.json +26 -21
- package/src/type/animation.ts +3 -0
- package/src/type/file-types.ts +6 -0
- package/src/type/tree.ts +12 -0
- package/src/type/variant-file-format.ts +6 -0
- package/www/build/mds-modal.esm.js +1 -1
- package/www/build/mds-modal.js +1 -1
- package/www/build/p-413a00c5.entry.js +1 -0
- package/www/build/p-96958acc.system.entry.js +1 -0
- package/www/build/p-bc1fa4e4.system.js +2 -0
- package/www/build/p-c6899cb0.system.js +1 -0
- package/www/build/p-ee90f86a.js +2 -0
- package/dist/esm-es5/index-1c34ac95.js +0 -1
- package/dist/mds-modal/p-0ed6e0c8.js +0 -2
- package/dist/mds-modal/p-2bf0fd79.system.entry.js +0 -1
- package/dist/mds-modal/p-423dac35.system.js +0 -2
- package/dist/mds-modal/p-67c6f337.system.js +0 -1
- package/dist/mds-modal/p-fbfe7e2e.entry.js +0 -1
- package/www/build/p-0ed6e0c8.js +0 -2
- package/www/build/p-2bf0fd79.system.entry.js +0 -1
- package/www/build/p-423dac35.system.js +0 -2
- package/www/build/p-67c6f337.system.js +0 -1
- package/www/build/p-fbfe7e2e.entry.js +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@maggioli-design-system/mds-modal",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.3.0",
|
|
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 JavaScript framework you are using.",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
"test": "stencil test --spec --e2e"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@maggioli-design-system/mds-button": "6.
|
|
28
|
-
"@maggioli-design-system/styles": "15.
|
|
29
|
-
"@stencil/core": "4.
|
|
27
|
+
"@maggioli-design-system/mds-button": "6.2.0",
|
|
28
|
+
"@maggioli-design-system/styles": "15.7.0",
|
|
29
|
+
"@stencil/core": "4.25.1",
|
|
30
30
|
"clsx": "2.1.0"
|
|
31
31
|
},
|
|
32
32
|
"license": "MIT",
|
package/readme.md
CHANGED
|
@@ -49,7 +49,9 @@ This is a web-component from Maggioli Design System [Magma](https://magma.maggio
|
|
|
49
49
|
| `--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`. |
|
|
50
50
|
| `--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`. |
|
|
51
51
|
| `--mds-modal-window-background` | Set the background color of the window |
|
|
52
|
+
| `--mds-modal-window-distance` | Set the distance between the modal window and the screen bounds |
|
|
52
53
|
| `--mds-modal-window-overflow` | Set the overflow of the window |
|
|
54
|
+
| `--mds-modal-window-radius` | Set the border radius of the window |
|
|
53
55
|
| `--mds-modal-window-shadow` | Set the box shadow of the window |
|
|
54
56
|
| `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
|
|
55
57
|
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import {
|
|
2
|
+
arrow,
|
|
3
|
+
autoPlacement,
|
|
4
|
+
autoUpdate,
|
|
5
|
+
computePosition,
|
|
6
|
+
flip,
|
|
7
|
+
Middleware,
|
|
8
|
+
MiddlewareData,
|
|
9
|
+
offset,
|
|
10
|
+
shift,
|
|
11
|
+
} from '@floating-ui/dom'
|
|
12
|
+
import { FloatingUIPlacement, FloatingUIStrategy } from '@type/floating-ui'
|
|
13
|
+
import { cssDurationToMilliseconds } from './unit'
|
|
14
|
+
import { setAttributeIfEmpty } from './aria'
|
|
15
|
+
import { HTMLStencilElement } from '@stencil/core/internal'
|
|
16
|
+
|
|
17
|
+
export interface FloatingElement extends PositionOptions {
|
|
18
|
+
host: HTMLFloatingElement,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface HTMLFloatingElement extends HTMLStencilElement, PositionOptions {
|
|
22
|
+
visible: boolean,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface PositionOptions {
|
|
26
|
+
arrow: boolean;
|
|
27
|
+
arrowPadding: number;
|
|
28
|
+
autoPlacement: boolean;
|
|
29
|
+
flip: boolean;
|
|
30
|
+
offset: number;
|
|
31
|
+
placement: FloatingUIPlacement;
|
|
32
|
+
shift: boolean;
|
|
33
|
+
shiftPadding: number;
|
|
34
|
+
strategy: FloatingUIStrategy;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export class FloatingController {
|
|
38
|
+
private _caller: HTMLElement
|
|
39
|
+
private readonly _host: HTMLFloatingElement
|
|
40
|
+
arrowEl: HTMLElement | undefined
|
|
41
|
+
|
|
42
|
+
private cleanupAutoUpdate: () => void
|
|
43
|
+
|
|
44
|
+
constructor (host: HTMLFloatingElement, arrowEl?: HTMLElement) {
|
|
45
|
+
this._host = host
|
|
46
|
+
this.arrowEl = arrowEl
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
updateCaller (target: string): HTMLElement {
|
|
50
|
+
// search caller in document or rootNode of host (if target is in shadowDOM)
|
|
51
|
+
const caller = (this._host.parentElement?.shadowRoot?.querySelector(target) as HTMLElement) ??
|
|
52
|
+
((this._host.getRootNode() as HTMLElement).querySelector(target) as HTMLElement)
|
|
53
|
+
|
|
54
|
+
if (!caller) {
|
|
55
|
+
throw Error(`Target not found: ${target}`)
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
this._caller = caller
|
|
59
|
+
|
|
60
|
+
setAttributeIfEmpty(this._caller, 'aria-haspopup', 'true')
|
|
61
|
+
setAttributeIfEmpty(this._caller, 'aria-controls', target)
|
|
62
|
+
setAttributeIfEmpty(this._host, 'role', 'menu')
|
|
63
|
+
setAttributeIfEmpty(this._host, 'aria-labelledby', target)
|
|
64
|
+
return caller
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
private readonly arrowInset = (
|
|
68
|
+
middleware: MiddlewareData,
|
|
69
|
+
arrowPosition: string,
|
|
70
|
+
): { bottom?: string; left?: string; right?: string; top?: string } => {
|
|
71
|
+
const { arrow } = middleware
|
|
72
|
+
const inset = { bottom: '', left: '', right: '', top: '' }
|
|
73
|
+
|
|
74
|
+
if (arrow === undefined) {
|
|
75
|
+
return {}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
switch (arrowPosition) {
|
|
79
|
+
case 'bottom':
|
|
80
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : ''
|
|
81
|
+
inset.top = '100%'
|
|
82
|
+
break
|
|
83
|
+
case 'left':
|
|
84
|
+
inset.right = '100%'
|
|
85
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : ''
|
|
86
|
+
break
|
|
87
|
+
case 'right':
|
|
88
|
+
inset.left = '100%'
|
|
89
|
+
inset.top = arrow.y !== null ? `${arrow.y}px` : ''
|
|
90
|
+
break
|
|
91
|
+
case 'top':
|
|
92
|
+
inset.left = arrow.x !== null ? `${arrow.x}px` : ''
|
|
93
|
+
inset.top = ''
|
|
94
|
+
break
|
|
95
|
+
default:
|
|
96
|
+
break
|
|
97
|
+
}
|
|
98
|
+
return inset
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
private readonly arrowTransform = (
|
|
102
|
+
arrowPosition: string,
|
|
103
|
+
): { transform: string } => {
|
|
104
|
+
let transformProps = this._host.arrow && this._host.visible ? 'scale(1)' : 'scale(0)'
|
|
105
|
+
switch (arrowPosition) {
|
|
106
|
+
case 'bottom':
|
|
107
|
+
transformProps = `rotate(180deg) ${transformProps} translate(0, -100%)`
|
|
108
|
+
break
|
|
109
|
+
case 'left':
|
|
110
|
+
transformProps = `rotate(-90deg) ${transformProps} translate(50%, -50%)`
|
|
111
|
+
break
|
|
112
|
+
case 'right':
|
|
113
|
+
transformProps = `rotate(90deg) ${transformProps} translate(-50%, -50%)`
|
|
114
|
+
break
|
|
115
|
+
case 'top':
|
|
116
|
+
transformProps = `rotate(0deg) ${transformProps} translate(0, 0)`
|
|
117
|
+
break
|
|
118
|
+
default:
|
|
119
|
+
break
|
|
120
|
+
}
|
|
121
|
+
return { transform: transformProps }
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
private readonly arrowTransformOrigin = (
|
|
125
|
+
arrowPosition: string,
|
|
126
|
+
): { transformOrigin: string } => {
|
|
127
|
+
switch (arrowPosition) {
|
|
128
|
+
case 'bottom':
|
|
129
|
+
return { transformOrigin: 'center top' }
|
|
130
|
+
case 'left':
|
|
131
|
+
return { transformOrigin: 'right center' }
|
|
132
|
+
case 'right':
|
|
133
|
+
return { transformOrigin: 'left center' }
|
|
134
|
+
case 'top':
|
|
135
|
+
return { transformOrigin: 'center bottom' }
|
|
136
|
+
default:
|
|
137
|
+
return { transformOrigin: 'center top' }
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
private readonly calculatePosition = (): void => {
|
|
142
|
+
if (!this._caller) return
|
|
143
|
+
|
|
144
|
+
const middleware: Middleware[] = new Array<Middleware>()
|
|
145
|
+
const config: { padding?: number } = {}
|
|
146
|
+
|
|
147
|
+
if (this._host.shiftPadding) {
|
|
148
|
+
config.padding = this._host.shiftPadding
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
if (this._host.autoPlacement) {
|
|
152
|
+
middleware.push(autoPlacement())
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
if (this._host.offset) {
|
|
156
|
+
middleware.push(offset(this._host.offset))
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
if (!this._host.autoPlacement && this._host.flip) {
|
|
160
|
+
middleware.push(flip(config))
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (this._host.shift) {
|
|
164
|
+
middleware.push(shift(config))
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (this.arrowEl && this._host.arrow) {
|
|
168
|
+
middleware.push(
|
|
169
|
+
arrow({
|
|
170
|
+
element: this.arrowEl,
|
|
171
|
+
padding: this._host.arrowPadding,
|
|
172
|
+
}),
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
computePosition(this._caller, this._host, {
|
|
177
|
+
middleware,
|
|
178
|
+
placement: this._host.placement,
|
|
179
|
+
strategy: this._host.strategy,
|
|
180
|
+
}).then(({ x, y, placement, middlewareData }) => {
|
|
181
|
+
Object.assign(this._host.style, {
|
|
182
|
+
left: `${x}px`,
|
|
183
|
+
top: `${y}px`,
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
const arrowStyle = {}
|
|
187
|
+
const arrowPosition = {
|
|
188
|
+
top: 'bottom',
|
|
189
|
+
right: 'left',
|
|
190
|
+
bottom: 'top',
|
|
191
|
+
left: 'right',
|
|
192
|
+
}[placement.split('-')[0]]
|
|
193
|
+
|
|
194
|
+
if (arrowPosition && this.arrowEl) {
|
|
195
|
+
Object.assign(arrowStyle, this.arrowTransform(arrowPosition))
|
|
196
|
+
Object.assign(
|
|
197
|
+
arrowStyle,
|
|
198
|
+
this.arrowInset(middlewareData, arrowPosition),
|
|
199
|
+
)
|
|
200
|
+
Object.assign(arrowStyle, this.arrowTransformOrigin(arrowPosition))
|
|
201
|
+
Object.assign(this.arrowEl.style, arrowStyle)
|
|
202
|
+
}
|
|
203
|
+
})
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
updatePosition (): void {
|
|
207
|
+
if (this.cleanupAutoUpdate) this.cleanupAutoUpdate()
|
|
208
|
+
this.cleanupAutoUpdate = autoUpdate(this._caller, this._host, this.calculatePosition)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
dismiss (): void {
|
|
212
|
+
this.cleanupAutoUpdate()
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
export class Backdrop {
|
|
217
|
+
private readonly defaultBackdropId = 'mds-backdrop'
|
|
218
|
+
private readonly backdropBackgroundVisible = 'rgba(var(--magma-backdrop-color, 0 0 0) / var(--magma-backdrop-opacity, 0.1))'
|
|
219
|
+
private readonly backdropBackgroundHidden = 'rgba(var(--magma-backdrop-color, 0 0 0) / 0)'
|
|
220
|
+
|
|
221
|
+
private readonly backdropId
|
|
222
|
+
private readonly cssBackdropZIndex
|
|
223
|
+
private readonly cssBackdropDuration
|
|
224
|
+
|
|
225
|
+
private backdropEl: HTMLElement
|
|
226
|
+
private backdropTimer: NodeJS.Timeout
|
|
227
|
+
|
|
228
|
+
constructor (backdropId?: string) {
|
|
229
|
+
this.backdropId = backdropId ?? this.defaultBackdropId
|
|
230
|
+
this.cssBackdropZIndex = `var(--${this.backdropId}-z-index)`
|
|
231
|
+
this.cssBackdropDuration = `var(--${this.backdropId}-duration)`
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
attachBackdrop (): void {
|
|
235
|
+
if (!this.backdropEl) {
|
|
236
|
+
this.backdropEl = document.createElement('div')
|
|
237
|
+
this.backdropEl.className = this.backdropId
|
|
238
|
+
this.backdropEl.style.inset = '0'
|
|
239
|
+
this.backdropEl.style.pointerEvents = 'none'
|
|
240
|
+
this.backdropEl.style.position = 'fixed'
|
|
241
|
+
this.backdropEl.style.transition = `background-color ${this.cssBackdropDuration} ease-out`
|
|
242
|
+
this.backdropEl.style.zIndex = this.cssBackdropZIndex
|
|
243
|
+
}
|
|
244
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundHidden
|
|
245
|
+
document.body.appendChild(this.backdropEl)
|
|
246
|
+
|
|
247
|
+
clearTimeout(this.backdropTimer)
|
|
248
|
+
this.backdropTimer = setTimeout(() => {
|
|
249
|
+
this.backdropEl.style.backgroundColor = this.backdropBackgroundVisible
|
|
250
|
+
}, 1)
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
detachBackdrop (): void {
|
|
254
|
+
if (!this.backdropEl) {
|
|
255
|
+
return
|
|
256
|
+
}
|
|
257
|
+
this.backdropEl.style.backgroundColor = 'transparent'
|
|
258
|
+
clearTimeout(this.backdropTimer)
|
|
259
|
+
this.backdropTimer = setTimeout(() => {
|
|
260
|
+
this.backdropEl.remove()
|
|
261
|
+
}, cssDurationToMilliseconds(this.cssBackdropDuration))
|
|
262
|
+
}
|
|
263
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const hasSlottedElements = (el: HTMLElement, name?: string): boolean => {
|
|
2
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])'
|
|
3
|
+
|
|
4
|
+
const slot: HTMLSlotElement = el.shadowRoot?.querySelector(query) as HTMLSlotElement
|
|
5
|
+
if (slot) {
|
|
6
|
+
return slot.assignedElements({ flatten: true }).length > 0
|
|
7
|
+
}
|
|
8
|
+
return false
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const hasSlottedNodes = (el: HTMLElement, name?: string): boolean => {
|
|
12
|
+
const query = name ? `slot[name="${name}"]` : 'slot:not([name])'
|
|
13
|
+
|
|
14
|
+
const slot: HTMLSlotElement = el.shadowRoot?.querySelector(query) as HTMLSlotElement
|
|
15
|
+
if (slot) {
|
|
16
|
+
return slot.assignedNodes().length > 0
|
|
17
|
+
}
|
|
18
|
+
return false
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export {
|
|
22
|
+
hasSlottedElements,
|
|
23
|
+
hasSlottedNodes,
|
|
24
|
+
}
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
* @prop --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`.
|
|
11
11
|
* @prop --mds-modal-window-background: Set the background color of the window
|
|
12
12
|
* @prop --mds-modal-window-overflow: Set the overflow of the window
|
|
13
|
+
* @prop --mds-modal-window-radius: Set the border radius of the window
|
|
14
|
+
* @prop --mds-modal-window-distance: Set the distance between the modal window and the screen bounds
|
|
13
15
|
* @prop --mds-modal-window-shadow: Set the box shadow of the window
|
|
14
16
|
* @prop --mds-modal-z-index: Set the z-index of the window when the component is opened
|
|
15
17
|
*/
|
|
@@ -23,7 +25,9 @@
|
|
|
23
25
|
--mds-modal-transition-outro-ease: theme('transitionTimingFunction.in-out-quint');
|
|
24
26
|
--mds-modal-window-background: theme('colors.tone-neutral');
|
|
25
27
|
--mds-modal-window-overflow: auto;
|
|
28
|
+
--mds-modal-window-radius: 0;
|
|
26
29
|
--mds-modal-window-shadow: theme('boxShadow.2xl');
|
|
30
|
+
--mds-modal-window-distance: 0;
|
|
27
31
|
--mds-modal-z-index: var(--magma-modal-z-index);
|
|
28
32
|
|
|
29
33
|
@apply ease-in-out-expo;
|
|
@@ -76,9 +80,11 @@
|
|
|
76
80
|
@apply gap-0;
|
|
77
81
|
|
|
78
82
|
background-color: var(--mds-modal-window-background);
|
|
83
|
+
border-radius: var(--mds-modal-window-radius);
|
|
79
84
|
box-shadow: var(--mds-modal-window-shadow);
|
|
80
85
|
display: grid;
|
|
81
86
|
grid-template-rows: 1fr;
|
|
87
|
+
margin: var(--mds-modal-window-distance);
|
|
82
88
|
overflow: var(--mds-modal-window-overflow);
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -133,7 +133,7 @@ export class MdsModal {
|
|
|
133
133
|
<Host aria-modal={clsx(this.opened ? 'true' : 'false' )} onClick={(e: Event) => { this.closeModal(e) }}>
|
|
134
134
|
{ this.window
|
|
135
135
|
? <slot name="window"/>
|
|
136
|
-
: <div class={clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`)}
|
|
136
|
+
: <div class={clsx('window', (this.top || this.bottom) && `window-${this.top ? '-top' : ''}${this.bottom ? '-bottom' : ''}`)} part="window">
|
|
137
137
|
{ this.top &&
|
|
138
138
|
<slot name="top"/>
|
|
139
139
|
}
|
|
@@ -47,7 +47,9 @@
|
|
|
47
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
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
49
|
| `--mds-modal-window-background` | Set the background color of the window |
|
|
50
|
+
| `--mds-modal-window-distance` | Set the distance between the modal window and the screen bounds |
|
|
50
51
|
| `--mds-modal-window-overflow` | Set the overflow of the window |
|
|
52
|
+
| `--mds-modal-window-radius` | Set the border radius of the window |
|
|
51
53
|
| `--mds-modal-window-shadow` | Set the box shadow of the window |
|
|
52
54
|
| `--mds-modal-z-index` | Set the z-index of the window when the component is opened |
|
|
53
55
|
|
|
@@ -26,19 +26,19 @@ const email = `${firstName.toLowerCase()}.${lastName.toLowerCase()}@nintendo.com
|
|
|
26
26
|
|
|
27
27
|
const Template = args =>
|
|
28
28
|
<mds-modal {...args}>
|
|
29
|
-
<header slot="top" class="p-800 flex gap-400 items-center border-b border-solid border-0 border-tone-neutral-09">
|
|
29
|
+
<header slot="top" class="p-800 flex gap-400 items-center border-b border-solid border-0 border-tone-neutral-09 max-w-[400px]">
|
|
30
30
|
<mds-img class="w-1600" src="/logo-gruppo-maggioli-512w.webp"/>
|
|
31
31
|
<div class="text-tone-neutral-02">
|
|
32
32
|
<mds-text typography="h5" class="truncate min-w-0">Maggioli Editore</mds-text>
|
|
33
33
|
<mds-text typography="detail" class="truncate min-w-0">Menu di servizio</mds-text>
|
|
34
34
|
</div>
|
|
35
35
|
</header>
|
|
36
|
-
<div class="p-800">
|
|
36
|
+
<div class="p-800 max-w-[400px]">
|
|
37
37
|
<mds-text>
|
|
38
38
|
As a multi-brand design system, our components need to be flexible enough for any one of our brands to use them for multiple use cases. To achieve this, we ensure that all of the brands are involved in the specification stage, giving us more confidence that we’re future-proofing our components as more brands adopt NewsKit.
|
|
39
39
|
</mds-text>
|
|
40
40
|
</div>
|
|
41
|
-
<footer slot="bottom" class="p-800 flex gap-400 text-tone-neutral-02 border-t border-solid border-0 border-tone-neutral-09">
|
|
41
|
+
<footer slot="bottom" class="p-800 flex gap-400 text-tone-neutral-02 border-t border-solid border-0 border-tone-neutral-09 max-w-[400px]">
|
|
42
42
|
<mds-author class="flex-grow">
|
|
43
43
|
<mds-avatar slot="avatar" class="w-1600 mobile:w-1200" src="/avatar-01-200x200.jpeg"/>
|
|
44
44
|
<mds-text typography="h6">{ fullName }</mds-text>
|
|
@@ -81,7 +81,13 @@ export const Default = Template.bind({})
|
|
|
81
81
|
Default.args = {
|
|
82
82
|
position: 'right',
|
|
83
83
|
}
|
|
84
|
-
|
|
84
|
+
|
|
85
|
+
export const DefaultWindowCustomized = Template.bind({})
|
|
86
|
+
DefaultWindowCustomized.args = {
|
|
87
|
+
position: 'right',
|
|
88
|
+
style: { '--mds-modal-window-distance': '1rem', '--mds-modal-window-radius': '1rem' },
|
|
89
|
+
}
|
|
90
|
+
export const CustomWindowElement = CustomTemplate.bind({})
|
|
85
91
|
export const Interactive = InteractiveTemplate.bind({})
|
|
86
92
|
export const ARIATest = CustomTemplate.bind({})
|
|
87
93
|
ARIATest.args = {
|
|
@@ -26,8 +26,8 @@ const fileExtensionsDictionary: FileExtenstion = {
|
|
|
26
26
|
exe: { format: 'executable', description: 'fileEXE' },
|
|
27
27
|
flac: { format: 'audio', description: 'uncompressedAudio' },
|
|
28
28
|
gif: { format: 'image', description: 'compressedImage', preview: true },
|
|
29
|
-
htm: { format: 'markup', description: 'documentWeb' },
|
|
30
29
|
heic: { format: 'image', description: 'imageHEFF' },
|
|
30
|
+
htm: { format: 'markup', description: 'documentWeb' },
|
|
31
31
|
html: { format: 'markup', description: 'documentWeb' },
|
|
32
32
|
jpe: { format: 'image', description: 'compressedImage', preview: true },
|
|
33
33
|
jpeg: { format: 'image', description: 'compressedImage', preview: true },
|
|
@@ -44,9 +44,12 @@ const fileExtensionsDictionary: FileExtenstion = {
|
|
|
44
44
|
mpg4: { format: 'video', description: 'videoSD' },
|
|
45
45
|
mpg: { format: 'video', description: 'videoSD' },
|
|
46
46
|
mpga: { format: 'audio', description: 'compressedAudio' },
|
|
47
|
+
odf: { format: 'document', description: 'openDocumentFormat' },
|
|
47
48
|
odp: { format: 'slide', description: 'slideLO' },
|
|
48
49
|
ods: { format: 'spreadsheet', description: 'spreadsheetLO' },
|
|
49
50
|
odt: { format: 'text', description: 'documentLO' },
|
|
51
|
+
ole: { format: 'document', description: 'objectLinkingAndEmbedding' },
|
|
52
|
+
p7m: { format: 'certificate', description: 'documentDigitalSingnature' },
|
|
50
53
|
pdf: { format: 'document', description: 'documentAdobe' },
|
|
51
54
|
php: { format: 'code', description: 'filePHP' },
|
|
52
55
|
png: { format: 'image', description: 'imagePNG', preview: true },
|
|
@@ -59,6 +62,7 @@ const fileExtensionsDictionary: FileExtenstion = {
|
|
|
59
62
|
tar: { format: 'archive', description: 'uncompressedArchive' },
|
|
60
63
|
tiff: { format: 'image', description: 'imageTIFF' },
|
|
61
64
|
ts: { format: 'code', description: 'fileTS' },
|
|
65
|
+
tsd: { format: 'certificate', description: 'certificateTSD' },
|
|
62
66
|
tsx: { format: 'code', description: 'fileTSX' },
|
|
63
67
|
txt: { format: 'text', description: 'documentTXT' },
|
|
64
68
|
wav: { format: 'audio', description: 'uncompressedAudio' },
|
|
@@ -66,68 +70,10 @@ const fileExtensionsDictionary: FileExtenstion = {
|
|
|
66
70
|
xar: { format: 'archive', description: 'compressedArchive' },
|
|
67
71
|
xls: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
68
72
|
xlsx: { format: 'spreadsheet', description: 'spreadsheetMS' },
|
|
73
|
+
xml: { format: 'markup', description: 'extensibleMarkupLanguage' },
|
|
69
74
|
zip: { format: 'archive', description: 'compressedArchive' },
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
// const fileExtensionsDictionary: FileExtenstion = {
|
|
73
|
-
// '7z': { format: 'archive', description: 'Archivio compresso' },
|
|
74
|
-
// ace: { format: 'archive', description: 'Archivio compresso' },
|
|
75
|
-
// ai: { format: 'vector', description: 'Vettoriale Adobe Illustrator' },
|
|
76
|
-
// dart: { format: 'code', description: 'Dart' },
|
|
77
|
-
// db: { format: 'data', description: 'File di database' },
|
|
78
|
-
// default: { format: 'attachment', description: 'Formato sconosciuto' },
|
|
79
|
-
// dmg: { format: 'executable', description: 'Apple Disk Image' },
|
|
80
|
-
// doc: { format: 'text', description: 'Documento Microsoft Word' },
|
|
81
|
-
// docm: { format: 'text', description: 'Documento Microsoft Word' },
|
|
82
|
-
// docx: { format: 'text', description: 'Documento Microsoft Word Compresso' },
|
|
83
|
-
// eml: { format: 'email', description: 'E-mail di posta elettronica' },
|
|
84
|
-
// eps: { format: 'vector', description: 'Vettoriale Corel Draw' },
|
|
85
|
-
// exe: { format: 'executable', description: 'File eseguibile Windows' },
|
|
86
|
-
// flac: { format: 'audio', description: 'Audio non compresso' },
|
|
87
|
-
// gif: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
88
|
-
// htm: { format: 'markup', description: 'Pagina web' },
|
|
89
|
-
// heic: { format: 'image', description: 'High Efficiency Image File Format' },
|
|
90
|
-
// html: { format: 'markup', description: 'Pagina web' },
|
|
91
|
-
// jpe: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
92
|
-
// jpeg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
93
|
-
// jpg: { format: 'image', description: 'Immagine compressa', preview: true },
|
|
94
|
-
// js: { format: 'code', description: 'JavaScript' },
|
|
95
|
-
// json: { format: 'data', description: 'JavaScript Object Notation' },
|
|
96
|
-
// jsx: { format: 'code', description: 'JavaScript' },
|
|
97
|
-
// m2v: { format: 'video', description: 'Filmato SD' },
|
|
98
|
-
// mp2: { format: 'audio', description: 'Audio compresso' },
|
|
99
|
-
// mp3: { format: 'audio', description: 'Audio compresso' },
|
|
100
|
-
// mp4: { format: 'video', description: 'Filmato HD' },
|
|
101
|
-
// mp4v: { format: 'video', description: 'Filmato HD' },
|
|
102
|
-
// mpeg: { format: 'video', description: 'Filmato SD' },
|
|
103
|
-
// mpg4: { format: 'video', description: 'Filmato SD' },
|
|
104
|
-
// mpg: { format: 'video', description: 'Filmato SD' },
|
|
105
|
-
// mpga: { format: 'audio', description: 'Audio compresso' },
|
|
106
|
-
// odp: { format: 'slide', description: 'Slide di presentazione LibreOffice' },
|
|
107
|
-
// ods: { format: 'spreadsheet', description: 'Foglio di calcolo LibreOffice' },
|
|
108
|
-
// odt: { format: 'text', description: 'File di testo LibreOffice' },
|
|
109
|
-
// pdf: { format: 'document', description: 'Documento Adobe' },
|
|
110
|
-
// php: { format: 'code', description: 'Hypertext Preprocessor' },
|
|
111
|
-
// png: { format: 'image', description: 'Immagine Portable Network Graphics', preview: true },
|
|
112
|
-
// ppt: { format: 'slide', description: 'Slide di presentazione PowerPoint' },
|
|
113
|
-
// rar: { format: 'archive', description: 'Archivio compresso' },
|
|
114
|
-
// rtf: { format: 'text', description: 'Documento di testo Rich Text Format' },
|
|
115
|
-
// sass: { format: 'code', description: 'Syntactically Awesome StyleSheets' },
|
|
116
|
-
// shtml: { format: 'markup', description: 'Pagina web' },
|
|
117
|
-
// svg: { format: 'vector', description: 'Scalable Vector Graphics', preview: true },
|
|
118
|
-
// tar: { format: 'archive', description: 'Archivio non compresso' },
|
|
119
|
-
// tiff: { format: 'image', description: 'Tag Image File Format' },
|
|
120
|
-
// ts: { format: 'code', description: 'TypeScript' },
|
|
121
|
-
// tsx: { format: 'code', description: 'TypeScript Extended Syntax' },
|
|
122
|
-
// txt: { format: 'text', description: 'Documento di testo non formattato' },
|
|
123
|
-
// wav: { format: 'audio', description: 'Audio non compresso' },
|
|
124
|
-
// webp: { format: 'image', description: 'Immagine Web Picture', preview: true },
|
|
125
|
-
// xar: { format: 'archive', description: 'Archivio compresso' },
|
|
126
|
-
// xls: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
127
|
-
// xlsx: { format: 'spreadsheet', description: 'Foglio di calcolo Office' },
|
|
128
|
-
// zip: { format: 'archive', description: 'Archivio compresso' },
|
|
129
|
-
// }
|
|
130
|
-
|
|
131
77
|
const genericMimeToExt: Map<string, string[]> = new Map([
|
|
132
78
|
['image', ['.png', '.jpg', '.jpeg', '.tiff', '.webp', '.jpe', '.gif', '.heic']],
|
|
133
79
|
['audio', ['.mp2', '.mp3', '.mpga', '.wav', '.flac']],
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const treeActionsDictionary = [
|
|
2
|
+
'auto',
|
|
3
|
+
'visible',
|
|
4
|
+
]
|
|
5
|
+
|
|
6
|
+
const treeAppearanceDictionary = [
|
|
7
|
+
'depth',
|
|
8
|
+
'none',
|
|
9
|
+
]
|
|
10
|
+
|
|
11
|
+
const treeIconDictionary = [
|
|
12
|
+
'folder',
|
|
13
|
+
'chevron',
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
treeActionsDictionary,
|
|
18
|
+
treeAppearanceDictionary,
|
|
19
|
+
treeIconDictionary,
|
|
20
|
+
}
|
|
21
|
+
|
|
@@ -55,6 +55,69 @@ const filesList = [
|
|
|
55
55
|
'wooden.jsx',
|
|
56
56
|
]
|
|
57
57
|
|
|
58
|
+
const namedFilesList = {
|
|
59
|
+
'7z': 'frozen_haptic.7z',
|
|
60
|
+
'No extension file': 'this_is_an_extensionless_file',
|
|
61
|
+
'png with URL': 'https://i2.wp.com/clipart.info/images/ccovers/1495750818Apple-PNG-Clip-Art.png',
|
|
62
|
+
ace: 'sky_marketing.ace',
|
|
63
|
+
ai: 'foreground_overriding.ai',
|
|
64
|
+
db: 'matrix_black_hat.db',
|
|
65
|
+
default: 'copying.default',
|
|
66
|
+
dmg: 'protocol_designer.dmg',
|
|
67
|
+
doc: 'forges.doc',
|
|
68
|
+
docm: 'officer_somalia.docm',
|
|
69
|
+
docx: 'upgradable_gold.docx',
|
|
70
|
+
eml: 'brunei_logistical.eml',
|
|
71
|
+
eps: 'alarm_circuit_plastic.eps',
|
|
72
|
+
exe: 'rss_systematic_avon.exe',
|
|
73
|
+
flac: 'liaison_panel_central.flac',
|
|
74
|
+
gif: 'initiatives_group.gif',
|
|
75
|
+
htm: 'books_monetize_arizona.htm',
|
|
76
|
+
html: 'flexibility_auto_money.html',
|
|
77
|
+
jpe: 'intelligent_radical.jpe',
|
|
78
|
+
jpeg: 'iowa_installation.jpeg',
|
|
79
|
+
jpg: 'buckinghamshire_macao.jpg',
|
|
80
|
+
js: 'monitor.js',
|
|
81
|
+
json: 'calculating.json',
|
|
82
|
+
jsx: 'wooden.jsx',
|
|
83
|
+
m2v: 'interface_bedfordshire_solid.m2v',
|
|
84
|
+
mp2: 'explicit.mp2',
|
|
85
|
+
mp3: 'optimization_radical.mp3',
|
|
86
|
+
mp4: 'nebraska.mp4',
|
|
87
|
+
mp4v: 'reduced_regional_greenland.mp4v',
|
|
88
|
+
mpeg: 'impactful_alarm_handmade.mpeg',
|
|
89
|
+
mpg4: 'revolutionize.mpg4',
|
|
90
|
+
mpg: 'complexity_deposit.mpg',
|
|
91
|
+
mpga: 'ports_copy_granite.mpga',
|
|
92
|
+
odf: 'This is a file_to_read.odf',
|
|
93
|
+
odp: 'needs_based_solid.odp',
|
|
94
|
+
ods: 'compressing_black_colorado.ods',
|
|
95
|
+
odt: 'salad_compressing.odt',
|
|
96
|
+
ole: 'Document-RPF_Open-new.ole',
|
|
97
|
+
p7m: 'file with certificate from government.pdf.p7m',
|
|
98
|
+
pdf: 'connect_local_visualize.pdf',
|
|
99
|
+
php: 'fish.php',
|
|
100
|
+
png: 'awesome_orchestration.png',
|
|
101
|
+
ppt: 'gorgeous_manager_savings.ppt',
|
|
102
|
+
rar: 'unbranded.rar',
|
|
103
|
+
rtf: 'pound.rtf',
|
|
104
|
+
sass: 'open_source_gorgeous.sass',
|
|
105
|
+
shtml: 'brand.shtml',
|
|
106
|
+
svg: 'b2c_tan_sports.svg',
|
|
107
|
+
tar: 'graphic_frozen_bedfordshire.tar',
|
|
108
|
+
ts: 'forge_face.ts',
|
|
109
|
+
tsd: 'Marked file-7483274hy6Fg6R8.tsd',
|
|
110
|
+
txt: 'bedfordshire_iceland_identity.txt',
|
|
111
|
+
wav: 'synergistic.wav',
|
|
112
|
+
webp: 'open_source.webp',
|
|
113
|
+
xar: 'wisconsin_bypassing_small.xar',
|
|
114
|
+
xls: 'metrics_lempira_account.xls',
|
|
115
|
+
xlsx: 'hdd_navigate_panama.xlsx',
|
|
116
|
+
xml: 'Markup language.xml',
|
|
117
|
+
zip: 'tuna_table_fall.zip',
|
|
118
|
+
}
|
|
119
|
+
|
|
58
120
|
export {
|
|
59
121
|
filesList,
|
|
122
|
+
namedFilesList,
|
|
60
123
|
}
|