@sondor-technology/sondor-components 1.0.0 → 1.0.1-develop.11
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/README.md +8 -0
- package/dist/components/alert/alert.d.ts +13 -0
- package/dist/components/alert/alert.d.ts.map +1 -0
- package/dist/components/alert/alert.js +105 -0
- package/dist/components/badge/badge.d.ts +13 -0
- package/dist/components/badge/badge.d.ts.map +1 -0
- package/dist/components/badge/badge.js +101 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +19 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb.js +99 -0
- package/dist/components/button/button.d.ts +23 -0
- package/dist/components/button/button.d.ts.map +1 -0
- package/dist/components/button/button.js +304 -0
- package/dist/components/button-group/button-group.d.ts +6 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +74 -0
- package/dist/components/card/card.d.ts +11 -0
- package/dist/components/card/card.d.ts.map +1 -0
- package/dist/components/card/card.js +54 -0
- package/dist/components/checkbox/checkbox.d.ts +31 -0
- package/dist/components/checkbox/checkbox.d.ts.map +1 -0
- package/dist/components/checkbox/checkbox.js +265 -0
- package/dist/components/code-block/code-block.d.ts +20 -0
- package/dist/components/code-block/code-block.d.ts.map +1 -0
- package/dist/components/code-block/code-block.js +260 -0
- package/dist/components/content-card/content-card.d.ts +13 -0
- package/dist/components/content-card/content-card.d.ts.map +1 -0
- package/dist/components/content-card/content-card.js +140 -0
- package/dist/components/divider/divider.d.ts +16 -0
- package/dist/components/divider/divider.d.ts.map +1 -0
- package/dist/components/divider/divider.js +82 -0
- package/dist/components/drawer/drawer.d.ts +22 -0
- package/dist/components/drawer/drawer.d.ts.map +1 -0
- package/dist/components/drawer/drawer.js +226 -0
- package/dist/components/field/field.d.ts +11 -0
- package/dist/components/field/field.d.ts.map +1 -0
- package/dist/components/field/field.js +32 -0
- package/dist/components/footer/footer.d.ts +6 -0
- package/dist/components/footer/footer.d.ts.map +1 -0
- package/dist/components/footer/footer.js +65 -0
- package/dist/components/form/form-step.d.ts +14 -0
- package/dist/components/form/form-step.d.ts.map +1 -0
- package/dist/components/form/form-step.js +44 -0
- package/dist/components/form/form.d.ts +30 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.js +456 -0
- package/dist/components/grid/grid-row.d.ts +17 -0
- package/dist/components/grid/grid-row.d.ts.map +1 -0
- package/dist/components/grid/grid-row.js +92 -0
- package/dist/components/grid/grid.d.ts +13 -0
- package/dist/components/grid/grid.d.ts.map +1 -0
- package/dist/components/grid/grid.js +42 -0
- package/dist/components/icon/icon-paths.d.ts +132 -0
- package/dist/components/icon/icon-paths.d.ts.map +1 -0
- package/dist/components/icon/icon-paths.js +137 -0
- package/dist/components/icon/icon.d.ts +17 -0
- package/dist/components/icon/icon.d.ts.map +1 -0
- package/dist/components/icon/icon.js +95 -0
- package/dist/components/input/input.d.ts +31 -0
- package/dist/components/input/input.d.ts.map +1 -0
- package/dist/components/input/input.js +268 -0
- package/dist/components/link/link.d.ts +16 -0
- package/dist/components/link/link.d.ts.map +1 -0
- package/dist/components/link/link.js +116 -0
- package/dist/components/metadata/metadata.d.ts +18 -0
- package/dist/components/metadata/metadata.d.ts.map +1 -0
- package/dist/components/metadata/metadata.js +71 -0
- package/dist/components/modal/modal.d.ts +35 -0
- package/dist/components/modal/modal.d.ts.map +1 -0
- package/dist/components/modal/modal.js +251 -0
- package/dist/components/page-layout/page-layout.d.ts +46 -0
- package/dist/components/page-layout/page-layout.d.ts.map +1 -0
- package/dist/components/page-layout/page-layout.js +697 -0
- package/dist/components/radio/radio.d.ts +16 -0
- package/dist/components/radio/radio.d.ts.map +1 -0
- package/dist/components/radio/radio.js +152 -0
- package/dist/components/radio-group/radio-group.d.ts +27 -0
- package/dist/components/radio-group/radio-group.d.ts.map +1 -0
- package/dist/components/radio-group/radio-group.js +161 -0
- package/dist/components/router/router.d.ts +31 -0
- package/dist/components/router/router.d.ts.map +1 -0
- package/dist/components/router/router.js +97 -0
- package/dist/components/select/select.d.ts +16 -0
- package/dist/components/select/select.d.ts.map +1 -0
- package/dist/components/select/select.js +172 -0
- package/dist/components/skeleton/skeleton.d.ts +16 -0
- package/dist/components/skeleton/skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton.js +149 -0
- package/dist/components/switch/switch.d.ts +25 -0
- package/dist/components/switch/switch.d.ts.map +1 -0
- package/dist/components/switch/switch.js +185 -0
- package/dist/components/table/data-table.d.ts +72 -0
- package/dist/components/table/data-table.d.ts.map +1 -0
- package/dist/components/table/data-table.js +551 -0
- package/dist/components/table/table.d.ts +22 -0
- package/dist/components/table/table.d.ts.map +1 -0
- package/dist/components/table/table.js +167 -0
- package/dist/components/tabs/tab-panel.d.ts +8 -0
- package/dist/components/tabs/tab-panel.d.ts.map +1 -0
- package/dist/components/tabs/tab-panel.js +46 -0
- package/dist/components/tabs/tab.d.ts +9 -0
- package/dist/components/tabs/tab.d.ts.map +1 -0
- package/dist/components/tabs/tab.js +91 -0
- package/dist/components/tabs/tabs.d.ts +14 -0
- package/dist/components/tabs/tabs.d.ts.map +1 -0
- package/dist/components/tabs/tabs.js +85 -0
- package/dist/components/textarea/textarea.d.ts +36 -0
- package/dist/components/textarea/textarea.d.ts.map +1 -0
- package/dist/components/textarea/textarea.js +231 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts +15 -0
- package/dist/components/theme-toggle/theme-toggle.d.ts.map +1 -0
- package/dist/components/theme-toggle/theme-toggle.js +130 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts +15 -0
- package/dist/components/vertical-nav/vertical-nav-group.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-group.js +127 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts +14 -0
- package/dist/components/vertical-nav/vertical-nav-item.d.ts.map +1 -0
- package/dist/components/vertical-nav/vertical-nav-item.js +85 -0
- package/dist/styles/index.css +171 -0
- package/dist/styles/reset.d.ts +2 -0
- package/dist/styles/reset.d.ts.map +1 -0
- package/dist/styles/reset.js +50 -0
- package/package.json +7 -2
- package/src/components/alert/alert.ts +100 -100
- package/src/components/badge/badge.ts +96 -96
- package/src/components/breadcrumb/breadcrumb.ts +98 -98
- package/src/components/button/button.ts +281 -281
- package/src/components/button-group/button-group.ts +67 -67
- package/src/components/card/card.ts +52 -52
- package/src/components/checkbox/checkbox.ts +266 -238
- package/src/components/code-block/code-block.ts +256 -256
- package/src/components/content-card/content-card.ts +133 -133
- package/src/components/divider/divider.ts +68 -68
- package/src/components/drawer/drawer.ts +217 -217
- package/src/components/field/field.ts +30 -30
- package/src/components/footer/footer.ts +58 -58
- package/src/components/form/form-step.ts +36 -32
- package/src/components/form/form.ts +492 -376
- package/src/components/grid/grid-row.ts +75 -75
- package/src/components/grid/grid.ts +36 -36
- package/src/components/icon/icon-paths.ts +140 -124
- package/src/components/icon/icon.ts +84 -82
- package/src/components/input/input.ts +248 -248
- package/src/components/link/link.ts +97 -97
- package/src/components/metadata/metadata.ts +66 -66
- package/src/components/modal/modal.ts +246 -158
- package/src/components/page-layout/page-layout.ts +704 -704
- package/src/components/radio/radio.ts +142 -142
- package/src/components/radio-group/radio-group.ts +157 -157
- package/src/components/router/router.ts +133 -46
- package/src/components/select/select.ts +161 -161
- package/src/components/skeleton/skeleton.ts +134 -67
- package/src/components/switch/switch.ts +181 -181
- package/src/components/table/data-table.ts +556 -556
- package/src/components/table/table.ts +153 -153
- package/src/components/tabs/tab-panel.ts +30 -30
- package/src/components/tabs/tab.ts +76 -76
- package/src/components/tabs/tabs.ts +88 -88
- package/src/components/textarea/textarea.ts +215 -215
- package/src/components/theme-toggle/theme-toggle.ts +131 -131
- package/src/components/vertical-nav/vertical-nav-group.ts +115 -96
- package/src/components/vertical-nav/vertical-nav-item.ts +72 -49
- package/src/styles/globals.css +58 -58
- package/src/styles/index.css +80 -80
- package/src/styles/reset.ts +50 -50
- package/src/styles/theme.css +58 -58
- package/src/styles/typography.css +25 -25
- package/tsconfig.json +15 -15
|
@@ -1,159 +1,247 @@
|
|
|
1
|
-
import { LitElement, html, css, PropertyValues } from 'lit';
|
|
2
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
-
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
-
|
|
5
|
-
@customElement('st-modal')
|
|
6
|
-
export class StModal extends LitElement {
|
|
7
|
-
/**
|
|
8
|
-
* Controls whether the modal is open.
|
|
9
|
-
*/
|
|
10
|
-
@property({ type: Boolean, reflect: true }) open = false;
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Title text displayed in the modal header.
|
|
14
|
-
*/
|
|
15
|
-
@property({ type: String }) heading = '';
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
dialog
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
color:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
1
|
+
import { LitElement, html, css, PropertyValues, nothing } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { resetStyles } from '../../styles/reset.js';
|
|
4
|
+
|
|
5
|
+
@customElement('st-modal')
|
|
6
|
+
export class StModal extends LitElement {
|
|
7
|
+
/**
|
|
8
|
+
* Controls whether the modal is open.
|
|
9
|
+
*/
|
|
10
|
+
@property({ type: Boolean, reflect: true }) open = false;
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Title text displayed in the modal header.
|
|
14
|
+
*/
|
|
15
|
+
@property({ type: String }) heading = '';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Size of the modal (sm, md, lg, xl, xxl).
|
|
19
|
+
*/
|
|
20
|
+
@property({ type: String }) size: 'sm' | 'md' | 'lg' | 'xl' | 'xxl' = 'md';
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* If true, the modal cannot be closed by clicking the backdrop or pressing Esc.
|
|
24
|
+
*/
|
|
25
|
+
@property({ type: Boolean }) static = false;
|
|
26
|
+
|
|
27
|
+
@query('dialog') private dialogEl!: HTMLDialogElement;
|
|
28
|
+
|
|
29
|
+
private isClosing = false;
|
|
30
|
+
|
|
31
|
+
static styles = [
|
|
32
|
+
resetStyles,
|
|
33
|
+
css`
|
|
34
|
+
:host {
|
|
35
|
+
display: contents;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
dialog {
|
|
39
|
+
padding: 0;
|
|
40
|
+
border: 1px solid var(--st-color-border);
|
|
41
|
+
border-radius: var(--st-radius-lg, 0.5rem);
|
|
42
|
+
background-color: var(--st-color-surface);
|
|
43
|
+
color: var(--st-color-text);
|
|
44
|
+
|
|
45
|
+
/* Responsive width calculation */
|
|
46
|
+
width: calc(100% - 2rem);
|
|
47
|
+
margin: auto;
|
|
48
|
+
|
|
49
|
+
box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
|
|
50
|
+
font-family: var(--st-font-family, inherit);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/* Sizes */
|
|
54
|
+
dialog.size-sm { max-width: 400px; }
|
|
55
|
+
dialog.size-md { max-width: 500px; }
|
|
56
|
+
dialog.size-lg { max-width: 800px; }
|
|
57
|
+
dialog.size-xl { max-width: 1024px; }
|
|
58
|
+
dialog.size-xxl { max-width: 1280px; }
|
|
59
|
+
|
|
60
|
+
dialog::backdrop {
|
|
61
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
62
|
+
backdrop-filter: blur(2px);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Animations */
|
|
66
|
+
@keyframes fade-in {
|
|
67
|
+
from { opacity: 0; }
|
|
68
|
+
to { opacity: 1; }
|
|
69
|
+
}
|
|
70
|
+
@keyframes fade-out {
|
|
71
|
+
from { opacity: 1; }
|
|
72
|
+
to { opacity: 0; }
|
|
73
|
+
}
|
|
74
|
+
@keyframes slide-up {
|
|
75
|
+
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
76
|
+
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
77
|
+
}
|
|
78
|
+
@keyframes slide-down {
|
|
79
|
+
from { opacity: 1; transform: translateY(0) scale(1); }
|
|
80
|
+
to { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
dialog[open] {
|
|
84
|
+
animation: slide-up 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
85
|
+
}
|
|
86
|
+
dialog[open]::backdrop {
|
|
87
|
+
animation: fade-in 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
dialog.closing {
|
|
91
|
+
animation: slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
92
|
+
}
|
|
93
|
+
dialog.closing::backdrop {
|
|
94
|
+
animation: fade-out 0.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.modal-header {
|
|
98
|
+
display: flex;
|
|
99
|
+
align-items: center;
|
|
100
|
+
justify-content: space-between;
|
|
101
|
+
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
102
|
+
border-bottom: 1px solid var(--st-color-border);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.modal-title {
|
|
106
|
+
font-size: 1.125rem;
|
|
107
|
+
font-weight: 600;
|
|
108
|
+
margin: 0;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.close-btn {
|
|
112
|
+
background: none;
|
|
113
|
+
border: none;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
color: var(--st-color-text-muted);
|
|
116
|
+
padding: 0.25rem;
|
|
117
|
+
display: flex;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
border-radius: var(--st-radius-sm);
|
|
121
|
+
transition: color 0.2s, background-color 0.2s;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
.close-btn:hover {
|
|
125
|
+
color: var(--st-color-text);
|
|
126
|
+
background-color: var(--st-color-surface-muted, #f1f5f9);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.modal-body {
|
|
130
|
+
padding: var(--st-spacing-lg);
|
|
131
|
+
font-size: var(--st-font-size-sm, 0.875rem);
|
|
132
|
+
line-height: 1.5;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
.modal-footer {
|
|
136
|
+
display: flex;
|
|
137
|
+
align-items: center;
|
|
138
|
+
justify-content: flex-end;
|
|
139
|
+
gap: var(--st-spacing-sm);
|
|
140
|
+
padding: var(--st-spacing-md) var(--st-spacing-lg);
|
|
141
|
+
border-top: 1px solid var(--st-color-border);
|
|
142
|
+
background-color: var(--st-color-surface-muted, #f8fafc);
|
|
143
|
+
}
|
|
144
|
+
`
|
|
145
|
+
];
|
|
146
|
+
|
|
147
|
+
updated(changedProperties: PropertyValues) {
|
|
148
|
+
if (changedProperties.has('open')) {
|
|
149
|
+
if (this.open) {
|
|
150
|
+
this.dialogEl.classList.remove('closing');
|
|
151
|
+
this.isClosing = false;
|
|
152
|
+
if (!this.dialogEl.open) {
|
|
153
|
+
this.dialogEl.showModal();
|
|
154
|
+
}
|
|
155
|
+
} else if (this.dialogEl.open && !this.isClosing) {
|
|
156
|
+
this.closeWithAnimation();
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
private closeWithAnimation() {
|
|
162
|
+
if (this.isClosing) return;
|
|
163
|
+
this.isClosing = true;
|
|
164
|
+
this.dialogEl.classList.add('closing');
|
|
165
|
+
|
|
166
|
+
const onAnimationEnd = () => {
|
|
167
|
+
this.dialogEl.removeEventListener('animationend', onAnimationEnd);
|
|
168
|
+
this.dialogEl.classList.remove('closing');
|
|
169
|
+
this.isClosing = false;
|
|
170
|
+
if (!this.open) {
|
|
171
|
+
this.dialogEl.close();
|
|
172
|
+
}
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
this.dialogEl.addEventListener('animationend', onAnimationEnd);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private handleClose() {
|
|
179
|
+
this.open = false;
|
|
180
|
+
this.dispatchEvent(new CustomEvent('st-close', { bubbles: true, composed: true }));
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
private handleCancel(e: Event) {
|
|
184
|
+
e.preventDefault();
|
|
185
|
+
if (!this.static) {
|
|
186
|
+
this.handleClose();
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
private onDialogClose() {
|
|
191
|
+
if (this.open) {
|
|
192
|
+
this.open = false;
|
|
193
|
+
this.dispatchEvent(new CustomEvent('st-close', { bubbles: true, composed: true }));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
private handleBackdropClick(e: MouseEvent) {
|
|
198
|
+
if (this.static) return;
|
|
199
|
+
|
|
200
|
+
const rect = this.dialogEl.getBoundingClientRect();
|
|
201
|
+
const clickedOutside =
|
|
202
|
+
e.clientX < rect.left ||
|
|
203
|
+
e.clientX > rect.right ||
|
|
204
|
+
e.clientY < rect.top ||
|
|
205
|
+
e.clientY > rect.bottom;
|
|
206
|
+
|
|
207
|
+
if (clickedOutside) {
|
|
208
|
+
this.handleClose();
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
render() {
|
|
213
|
+
return html`
|
|
214
|
+
<dialog
|
|
215
|
+
class="size-${this.size}"
|
|
216
|
+
aria-labelledby=${this.heading ? 'modal-heading' : nothing}
|
|
217
|
+
@cancel=${this.handleCancel}
|
|
218
|
+
@click=${this.handleBackdropClick}
|
|
219
|
+
@close=${this.onDialogClose}
|
|
220
|
+
>
|
|
221
|
+
<div class="modal-header" @click=${(e: MouseEvent) => e.stopPropagation()}>
|
|
222
|
+
<slot name="header">
|
|
223
|
+
<h3 class="modal-title" id="modal-heading">${this.heading}</h3>
|
|
224
|
+
</slot>
|
|
225
|
+
|
|
226
|
+
${!this.static ? html`
|
|
227
|
+
<button class="close-btn" @click=${this.handleClose} aria-label="Close modal">
|
|
228
|
+
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="18" y1="6" x2="6" y2="18"></line><line x1="6" y1="6" x2="18" y2="18"></line></svg>
|
|
229
|
+
</button>
|
|
230
|
+
` : nothing}
|
|
231
|
+
</div>
|
|
232
|
+
<div class="modal-body" @click=${(e: MouseEvent) => e.stopPropagation()}>
|
|
233
|
+
<slot></slot>
|
|
234
|
+
</div>
|
|
235
|
+
<div class="modal-footer" @click=${(e: MouseEvent) => e.stopPropagation()}>
|
|
236
|
+
<slot name="footer"></slot>
|
|
237
|
+
</div>
|
|
238
|
+
</dialog>
|
|
239
|
+
`;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
declare global {
|
|
244
|
+
interface HTMLElementTagNameMap {
|
|
245
|
+
'st-modal': StModal;
|
|
246
|
+
}
|
|
159
247
|
}
|