@empathyco/x-components 3.0.0-alpha.220 → 3.0.0-alpha.222
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/CHANGELOG.md +24 -0
- package/design-system/full-theme.css +168 -169
- package/docs/API-reference/api/x-components.basemodal._refs.md +1 -0
- package/docs/API-reference/api/x-components.basemodal.md +3 -1
- package/docs/API-reference/api/x-components.basemodal.referenceelement.md +13 -0
- package/docs/API-reference/api/x-components.basemodal.referenceselector.md +13 -0
- package/docs/API-reference/api/x-components.installxoptions.domelement.md +2 -2
- package/docs/API-reference/api/x-components.installxoptions.md +1 -1
- package/docs/API-reference/components/common/modals/x-components.base-modal.md +12 -8
- package/js/components/modals/base-events-modal.vue.js +11 -6
- package/js/components/modals/base-events-modal.vue.js.map +1 -1
- package/js/components/modals/base-events-modal.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/components/modals/base-id-modal.vue.js +11 -6
- package/js/components/modals/base-id-modal.vue.js.map +1 -1
- package/js/components/modals/base-id-modal.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue.js +3 -2
- package/js/components/modals/base-modal.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue_rollup-plugin-vue_script.vue.js +44 -5
- package/js/components/modals/base-modal.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/components/modals/base-modal.vue_rollup-plugin-vue_styles.0.vue.js +1 -1
- package/js/components/modals/main-modal.vue.js +14 -9
- package/js/components/modals/main-modal.vue.js.map +1 -1
- package/js/components/modals/main-modal.vue_rollup-plugin-vue_script.vue.js.map +1 -1
- package/js/x-installer/x-installer/x-installer.js +17 -16
- package/js/x-installer/x-installer/x-installer.js.map +1 -1
- package/package.json +2 -2
- package/report/x-components.api.json +86 -4
- package/report/x-components.api.md +7 -2
- package/types/components/modals/base-events-modal.vue.d.ts.map +1 -1
- package/types/components/modals/base-id-modal.vue.d.ts.map +1 -1
- package/types/components/modals/base-modal.vue.d.ts +33 -3
- package/types/components/modals/base-modal.vue.d.ts.map +1 -1
- package/types/components/modals/main-modal.vue.d.ts.map +1 -1
- package/types/x-installer/x-installer/types.d.ts +3 -4
- package/types/x-installer/x-installer/types.d.ts.map +1 -1
- package/types/x-installer/x-installer/x-installer.d.ts +9 -6
- package/types/x-installer/x-installer/x-installer.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See
|
|
4
4
|
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.0-alpha.222](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.221...@empathyco/x-components@3.0.0-alpha.222) (2022-11-10)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **x-plugin:** Add function as possible value of `domElement` in InstallXOptions.(#836)
|
|
11
|
+
([99a96ef](https://github.com/empathyco/x/commit/99a96ef2303f27b656835253203bc73758a337ae))
|
|
12
|
+
|
|
13
|
+
# Change Log
|
|
14
|
+
|
|
15
|
+
All notable changes to this project will be documented in this file. See
|
|
16
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
17
|
+
|
|
18
|
+
## [3.0.0-alpha.221](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.220...@empathyco/x-components@3.0.0-alpha.221) (2022-11-10)
|
|
19
|
+
|
|
20
|
+
### Features
|
|
21
|
+
|
|
22
|
+
- place modal under selected element (#829)
|
|
23
|
+
([1f46d42](https://github.com/empathyco/x/commit/1f46d428dccdf4807110afc48b5fd600b41bfeae))
|
|
24
|
+
|
|
25
|
+
# Change Log
|
|
26
|
+
|
|
27
|
+
All notable changes to this project will be documented in this file. See
|
|
28
|
+
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
29
|
+
|
|
6
30
|
## [3.0.0-alpha.220](https://github.com/empathyco/x/compare/@empathyco/x-components@3.0.0-alpha.219...@empathyco/x-components@3.0.0-alpha.220) (2022-11-09)
|
|
7
31
|
|
|
8
32
|
### Features
|
|
@@ -142,6 +142,174 @@
|
|
|
142
142
|
--x-size-border-width-bottom-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
|
|
143
143
|
--x-size-border-width-left-dropdown-list-card: var(--x-size-border-width-dropdown-list-card);
|
|
144
144
|
}
|
|
145
|
+
.x-dropdown {
|
|
146
|
+
box-sizing: border-box;
|
|
147
|
+
position: relative;
|
|
148
|
+
font-size: var(--x-size-font-dropdown-default);
|
|
149
|
+
font-family: var(--x-font-family-dropdown-default);
|
|
150
|
+
font-weight: var(--x-number-font-weight-dropdown-default);
|
|
151
|
+
line-height: var(--x-size-line-height-dropdown-default);
|
|
152
|
+
}
|
|
153
|
+
[dir="ltr"] .x-dropdown__toggle {
|
|
154
|
+
border-right-width: var(--x-size-border-width-right-dropdown-toggle-default);
|
|
155
|
+
}
|
|
156
|
+
[dir="rtl"] .x-dropdown__toggle {
|
|
157
|
+
border-left-width: var(--x-size-border-width-right-dropdown-toggle-default);
|
|
158
|
+
}
|
|
159
|
+
[dir="ltr"] .x-dropdown__toggle {
|
|
160
|
+
border-left-width: var(--x-size-border-width-left-dropdown-toggle-default);
|
|
161
|
+
}
|
|
162
|
+
[dir="rtl"] .x-dropdown__toggle {
|
|
163
|
+
border-right-width: var(--x-size-border-width-left-dropdown-toggle-default);
|
|
164
|
+
}
|
|
165
|
+
[dir="ltr"] .x-dropdown__toggle {
|
|
166
|
+
padding-right: var(--x-size-padding-right-dropdown-toggle-default);
|
|
167
|
+
}
|
|
168
|
+
[dir="rtl"] .x-dropdown__toggle {
|
|
169
|
+
padding-left: var(--x-size-padding-right-dropdown-toggle-default);
|
|
170
|
+
}
|
|
171
|
+
[dir="ltr"] .x-dropdown__toggle {
|
|
172
|
+
padding-left: var(--x-size-padding-left-dropdown-toggle-default);
|
|
173
|
+
}
|
|
174
|
+
[dir="rtl"] .x-dropdown__toggle {
|
|
175
|
+
padding-right: var(--x-size-padding-left-dropdown-toggle-default);
|
|
176
|
+
}
|
|
177
|
+
.x-dropdown__toggle {
|
|
178
|
+
border-style: solid;
|
|
179
|
+
border-top-width: var(--x-size-border-width-top-dropdown-toggle-default);
|
|
180
|
+
border-bottom-width: var(--x-size-border-width-bottom-dropdown-toggle-default);
|
|
181
|
+
border-radius: var(--x-size-border-radius-top-left-dropdown-default) var(--x-size-border-radius-top-right-dropdown-default) var(--x-size-border-radius-bottom-right-dropdown-default) var(--x-size-border-radius-bottom-left-dropdown-default);
|
|
182
|
+
background: var(--x-color-background-dropdown-toggle-default);
|
|
183
|
+
color: var(--x-color-text-dropdown-toggle-default);
|
|
184
|
+
border-color: var(--x-color-border-dropdown-toggle-default);
|
|
185
|
+
padding-top: var(--x-size-padding-top-dropdown-toggle-default);
|
|
186
|
+
padding-bottom: var(--x-size-padding-bottom-dropdown-toggle-default);
|
|
187
|
+
gap: var(--x-size-gap-dropdown-item-default);
|
|
188
|
+
width: var(--x-size-width-dropdown-toggle-default);
|
|
189
|
+
display: flex;
|
|
190
|
+
flex-flow: row nowrap;
|
|
191
|
+
margin: 0;
|
|
192
|
+
cursor: pointer;
|
|
193
|
+
overflow: var(--x-string-overflow-dropdown-toggle-default);
|
|
194
|
+
box-shadow: var(--x-string-box-shadow-dropdown-default);
|
|
195
|
+
}
|
|
196
|
+
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
|
|
197
|
+
.x-dropdown__toggle {
|
|
198
|
+
gap: 0;
|
|
199
|
+
}
|
|
200
|
+
.x-dropdown__toggle > *:not(:last-child) {
|
|
201
|
+
margin-right: var(--x-size-gap-dropdown-item-default);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
[dir="ltr"] .x-dropdown__toggle * + .x-icon:last-child {
|
|
205
|
+
margin-left: auto;
|
|
206
|
+
}
|
|
207
|
+
[dir="rtl"] .x-dropdown__toggle * + .x-icon:last-child {
|
|
208
|
+
margin-right: auto;
|
|
209
|
+
}
|
|
210
|
+
.x-dropdown__toggle-selected-value {
|
|
211
|
+
color: var(--x-color-text-dropdown-toggle-default-selected);
|
|
212
|
+
}
|
|
213
|
+
[dir="ltr"] .x-dropdown__items-list {
|
|
214
|
+
border-right-width: var(--x-size-border-width-right-dropdown-list-default);
|
|
215
|
+
}
|
|
216
|
+
[dir="rtl"] .x-dropdown__items-list {
|
|
217
|
+
border-left-width: var(--x-size-border-width-right-dropdown-list-default);
|
|
218
|
+
}
|
|
219
|
+
[dir="ltr"] .x-dropdown__items-list {
|
|
220
|
+
border-left-width: var(--x-size-border-width-left-dropdown-list-default);
|
|
221
|
+
}
|
|
222
|
+
[dir="rtl"] .x-dropdown__items-list {
|
|
223
|
+
border-right-width: var(--x-size-border-width-left-dropdown-list-default);
|
|
224
|
+
}
|
|
225
|
+
.x-dropdown__items-list {
|
|
226
|
+
background: var(--x-color-background-dropdown-default);
|
|
227
|
+
box-sizing: border-box;
|
|
228
|
+
min-width: var(--x-size-min-width-dropdown-list-default);
|
|
229
|
+
position: absolute;
|
|
230
|
+
top: calc(100% + var(--x-size-gap-dropdown-default));
|
|
231
|
+
overflow: var(--x-string-overflow-dropdown-list-default);
|
|
232
|
+
border-color: var(--x-color-border-dropdown-list-default);
|
|
233
|
+
border-top-width: var(--x-size-border-width-top-dropdown-list-default);
|
|
234
|
+
border-bottom-width: var(--x-size-border-width-bottom-dropdown-list-default);
|
|
235
|
+
border-radius: var(--x-size-border-radius-top-left-dropdown-default) var(--x-size-border-radius-top-right-dropdown-default) var(--x-size-border-radius-bottom-right-dropdown-default) var(--x-size-border-radius-bottom-left-dropdown-default);
|
|
236
|
+
border-style: solid;
|
|
237
|
+
margin: 0;
|
|
238
|
+
padding: 0;
|
|
239
|
+
box-shadow: var(--x-string-box-shadow-dropdown-default);
|
|
240
|
+
z-index: 1;
|
|
241
|
+
}
|
|
242
|
+
.x-dropdown__items-list:before, .x-dropdown__items-list:after {
|
|
243
|
+
content: "";
|
|
244
|
+
display: block;
|
|
245
|
+
height: var(--x-size-padding-vertical-dropdown-list-default);
|
|
246
|
+
}
|
|
247
|
+
[dir="ltr"] .x-dropdown__item {
|
|
248
|
+
padding-left: var(--x-size-padding-left-dropdown-item-default);
|
|
249
|
+
}
|
|
250
|
+
[dir="rtl"] .x-dropdown__item {
|
|
251
|
+
padding-right: var(--x-size-padding-left-dropdown-item-default);
|
|
252
|
+
}
|
|
253
|
+
[dir="ltr"] .x-dropdown__item {
|
|
254
|
+
padding-right: var(--x-size-padding-right-dropdown-item-default);
|
|
255
|
+
}
|
|
256
|
+
[dir="rtl"] .x-dropdown__item {
|
|
257
|
+
padding-left: var(--x-size-padding-right-dropdown-item-default);
|
|
258
|
+
}
|
|
259
|
+
.x-dropdown__item {
|
|
260
|
+
background: var(--x-color-background-dropdown-default);
|
|
261
|
+
padding-top: var(--x-size-padding-top-dropdown-item-default);
|
|
262
|
+
padding-bottom: var(--x-size-padding-bottom-dropdown-item-default);
|
|
263
|
+
gap: var(--x-size-gap-dropdown-item-default);
|
|
264
|
+
border: none;
|
|
265
|
+
display: flex;
|
|
266
|
+
flex-flow: row nowrap;
|
|
267
|
+
justify-content: flex-start;
|
|
268
|
+
text-align: left;
|
|
269
|
+
width: 100%;
|
|
270
|
+
margin: 0;
|
|
271
|
+
white-space: nowrap;
|
|
272
|
+
cursor: pointer;
|
|
273
|
+
}
|
|
274
|
+
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
|
|
275
|
+
.x-dropdown__item {
|
|
276
|
+
gap: 0;
|
|
277
|
+
}
|
|
278
|
+
.x-dropdown__item > *:not(:last-child) {
|
|
279
|
+
margin-right: var(--x-size-gap-dropdown-item-default);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
.x-dropdown__item:hover, .x-dropdown__item--is-highlighted {
|
|
283
|
+
color: var(--x-color-text-dropdown-item-default-hover);
|
|
284
|
+
background-color: var(--x-color-background-dropdown-item-default-hover);
|
|
285
|
+
font-weight: var(--x-number-font-weight-dropdown-item-default-hover);
|
|
286
|
+
-webkit-text-decoration: var(--x-font-decoration-dropdown-item-default-hover);
|
|
287
|
+
text-decoration: var(--x-font-decoration-dropdown-item-default-hover);
|
|
288
|
+
}
|
|
289
|
+
.x-dropdown__item--is-selected {
|
|
290
|
+
color: var(--x-color-text-dropdown-item-default-selected);
|
|
291
|
+
background-color: var(--x-color-background-dropdown-item-default-selected);
|
|
292
|
+
font-weight: var(--x-number-font-weight-dropdown-item-default-selected);
|
|
293
|
+
-webkit-text-decoration: var(--x-font-decoration-dropdown-item-default-selected);
|
|
294
|
+
text-decoration: var(--x-font-decoration-dropdown-item-default-selected);
|
|
295
|
+
}
|
|
296
|
+
[dir="ltr"] .x-dropdown__item * + .x-icon:last-child {
|
|
297
|
+
margin-left: auto;
|
|
298
|
+
}
|
|
299
|
+
[dir="rtl"] .x-dropdown__item * + .x-icon:last-child {
|
|
300
|
+
margin-right: auto;
|
|
301
|
+
}
|
|
302
|
+
.x-dropdown--is-open {
|
|
303
|
+
--x-color-background-dropdown-toggle-default: var(
|
|
304
|
+
--x-color-background-dropdown-toggle-open-default
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
[dir="ltr"] .x-dropdown--right .x-dropdown__items-list {
|
|
308
|
+
right: 0;
|
|
309
|
+
}
|
|
310
|
+
[dir="rtl"] .x-dropdown--right .x-dropdown__items-list {
|
|
311
|
+
left: 0;
|
|
312
|
+
}
|
|
145
313
|
:root {
|
|
146
314
|
--x-size-border-radius-dropdown-default: var(--x-size-border-radius-base-none);
|
|
147
315
|
--x-size-border-radius-top-left-dropdown-default: var(--x-size-border-radius-dropdown-default);
|
|
@@ -7124,172 +7292,3 @@
|
|
|
7124
7292
|
.x-normal-case {
|
|
7125
7293
|
text-transform: none;
|
|
7126
7294
|
}
|
|
7127
|
-
|
|
7128
|
-
.x-dropdown {
|
|
7129
|
-
box-sizing: border-box;
|
|
7130
|
-
position: relative;
|
|
7131
|
-
font-size: var(--x-size-font-dropdown-default);
|
|
7132
|
-
font-family: var(--x-font-family-dropdown-default);
|
|
7133
|
-
font-weight: var(--x-number-font-weight-dropdown-default);
|
|
7134
|
-
line-height: var(--x-size-line-height-dropdown-default);
|
|
7135
|
-
}
|
|
7136
|
-
[dir="ltr"] .x-dropdown__toggle {
|
|
7137
|
-
border-right-width: var(--x-size-border-width-right-dropdown-toggle-default);
|
|
7138
|
-
}
|
|
7139
|
-
[dir="rtl"] .x-dropdown__toggle {
|
|
7140
|
-
border-left-width: var(--x-size-border-width-right-dropdown-toggle-default);
|
|
7141
|
-
}
|
|
7142
|
-
[dir="ltr"] .x-dropdown__toggle {
|
|
7143
|
-
border-left-width: var(--x-size-border-width-left-dropdown-toggle-default);
|
|
7144
|
-
}
|
|
7145
|
-
[dir="rtl"] .x-dropdown__toggle {
|
|
7146
|
-
border-right-width: var(--x-size-border-width-left-dropdown-toggle-default);
|
|
7147
|
-
}
|
|
7148
|
-
[dir="ltr"] .x-dropdown__toggle {
|
|
7149
|
-
padding-right: var(--x-size-padding-right-dropdown-toggle-default);
|
|
7150
|
-
}
|
|
7151
|
-
[dir="rtl"] .x-dropdown__toggle {
|
|
7152
|
-
padding-left: var(--x-size-padding-right-dropdown-toggle-default);
|
|
7153
|
-
}
|
|
7154
|
-
[dir="ltr"] .x-dropdown__toggle {
|
|
7155
|
-
padding-left: var(--x-size-padding-left-dropdown-toggle-default);
|
|
7156
|
-
}
|
|
7157
|
-
[dir="rtl"] .x-dropdown__toggle {
|
|
7158
|
-
padding-right: var(--x-size-padding-left-dropdown-toggle-default);
|
|
7159
|
-
}
|
|
7160
|
-
.x-dropdown__toggle {
|
|
7161
|
-
border-style: solid;
|
|
7162
|
-
border-top-width: var(--x-size-border-width-top-dropdown-toggle-default);
|
|
7163
|
-
border-bottom-width: var(--x-size-border-width-bottom-dropdown-toggle-default);
|
|
7164
|
-
border-radius: var(--x-size-border-radius-top-left-dropdown-default) var(--x-size-border-radius-top-right-dropdown-default) var(--x-size-border-radius-bottom-right-dropdown-default) var(--x-size-border-radius-bottom-left-dropdown-default);
|
|
7165
|
-
background: var(--x-color-background-dropdown-toggle-default);
|
|
7166
|
-
color: var(--x-color-text-dropdown-toggle-default);
|
|
7167
|
-
border-color: var(--x-color-border-dropdown-toggle-default);
|
|
7168
|
-
padding-top: var(--x-size-padding-top-dropdown-toggle-default);
|
|
7169
|
-
padding-bottom: var(--x-size-padding-bottom-dropdown-toggle-default);
|
|
7170
|
-
gap: var(--x-size-gap-dropdown-item-default);
|
|
7171
|
-
width: var(--x-size-width-dropdown-toggle-default);
|
|
7172
|
-
display: flex;
|
|
7173
|
-
flex-flow: row nowrap;
|
|
7174
|
-
margin: 0;
|
|
7175
|
-
cursor: pointer;
|
|
7176
|
-
overflow: var(--x-string-overflow-dropdown-toggle-default);
|
|
7177
|
-
box-shadow: var(--x-string-box-shadow-dropdown-default);
|
|
7178
|
-
}
|
|
7179
|
-
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
|
|
7180
|
-
.x-dropdown__toggle {
|
|
7181
|
-
gap: 0;
|
|
7182
|
-
}
|
|
7183
|
-
.x-dropdown__toggle > *:not(:last-child) {
|
|
7184
|
-
margin-right: var(--x-size-gap-dropdown-item-default);
|
|
7185
|
-
}
|
|
7186
|
-
}
|
|
7187
|
-
[dir="ltr"] .x-dropdown__toggle * + .x-icon:last-child {
|
|
7188
|
-
margin-left: auto;
|
|
7189
|
-
}
|
|
7190
|
-
[dir="rtl"] .x-dropdown__toggle * + .x-icon:last-child {
|
|
7191
|
-
margin-right: auto;
|
|
7192
|
-
}
|
|
7193
|
-
.x-dropdown__toggle-selected-value {
|
|
7194
|
-
color: var(--x-color-text-dropdown-toggle-default-selected);
|
|
7195
|
-
}
|
|
7196
|
-
[dir="ltr"] .x-dropdown__items-list {
|
|
7197
|
-
border-right-width: var(--x-size-border-width-right-dropdown-list-default);
|
|
7198
|
-
}
|
|
7199
|
-
[dir="rtl"] .x-dropdown__items-list {
|
|
7200
|
-
border-left-width: var(--x-size-border-width-right-dropdown-list-default);
|
|
7201
|
-
}
|
|
7202
|
-
[dir="ltr"] .x-dropdown__items-list {
|
|
7203
|
-
border-left-width: var(--x-size-border-width-left-dropdown-list-default);
|
|
7204
|
-
}
|
|
7205
|
-
[dir="rtl"] .x-dropdown__items-list {
|
|
7206
|
-
border-right-width: var(--x-size-border-width-left-dropdown-list-default);
|
|
7207
|
-
}
|
|
7208
|
-
.x-dropdown__items-list {
|
|
7209
|
-
background: var(--x-color-background-dropdown-default);
|
|
7210
|
-
box-sizing: border-box;
|
|
7211
|
-
min-width: var(--x-size-min-width-dropdown-list-default);
|
|
7212
|
-
position: absolute;
|
|
7213
|
-
top: calc(100% + var(--x-size-gap-dropdown-default));
|
|
7214
|
-
overflow: var(--x-string-overflow-dropdown-list-default);
|
|
7215
|
-
border-color: var(--x-color-border-dropdown-list-default);
|
|
7216
|
-
border-top-width: var(--x-size-border-width-top-dropdown-list-default);
|
|
7217
|
-
border-bottom-width: var(--x-size-border-width-bottom-dropdown-list-default);
|
|
7218
|
-
border-radius: var(--x-size-border-radius-top-left-dropdown-default) var(--x-size-border-radius-top-right-dropdown-default) var(--x-size-border-radius-bottom-right-dropdown-default) var(--x-size-border-radius-bottom-left-dropdown-default);
|
|
7219
|
-
border-style: solid;
|
|
7220
|
-
margin: 0;
|
|
7221
|
-
padding: 0;
|
|
7222
|
-
box-shadow: var(--x-string-box-shadow-dropdown-default);
|
|
7223
|
-
z-index: 1;
|
|
7224
|
-
}
|
|
7225
|
-
.x-dropdown__items-list:before, .x-dropdown__items-list:after {
|
|
7226
|
-
content: "";
|
|
7227
|
-
display: block;
|
|
7228
|
-
height: var(--x-size-padding-vertical-dropdown-list-default);
|
|
7229
|
-
}
|
|
7230
|
-
[dir="ltr"] .x-dropdown__item {
|
|
7231
|
-
padding-left: var(--x-size-padding-left-dropdown-item-default);
|
|
7232
|
-
}
|
|
7233
|
-
[dir="rtl"] .x-dropdown__item {
|
|
7234
|
-
padding-right: var(--x-size-padding-left-dropdown-item-default);
|
|
7235
|
-
}
|
|
7236
|
-
[dir="ltr"] .x-dropdown__item {
|
|
7237
|
-
padding-right: var(--x-size-padding-right-dropdown-item-default);
|
|
7238
|
-
}
|
|
7239
|
-
[dir="rtl"] .x-dropdown__item {
|
|
7240
|
-
padding-left: var(--x-size-padding-right-dropdown-item-default);
|
|
7241
|
-
}
|
|
7242
|
-
.x-dropdown__item {
|
|
7243
|
-
background: var(--x-color-background-dropdown-default);
|
|
7244
|
-
padding-top: var(--x-size-padding-top-dropdown-item-default);
|
|
7245
|
-
padding-bottom: var(--x-size-padding-bottom-dropdown-item-default);
|
|
7246
|
-
gap: var(--x-size-gap-dropdown-item-default);
|
|
7247
|
-
border: none;
|
|
7248
|
-
display: flex;
|
|
7249
|
-
flex-flow: row nowrap;
|
|
7250
|
-
justify-content: flex-start;
|
|
7251
|
-
text-align: left;
|
|
7252
|
-
width: 100%;
|
|
7253
|
-
margin: 0;
|
|
7254
|
-
white-space: nowrap;
|
|
7255
|
-
cursor: pointer;
|
|
7256
|
-
}
|
|
7257
|
-
@media not all and (-webkit-min-device-pixel-ratio: 0), not all and (min-resolution: 0.001dpcm) {
|
|
7258
|
-
.x-dropdown__item {
|
|
7259
|
-
gap: 0;
|
|
7260
|
-
}
|
|
7261
|
-
.x-dropdown__item > *:not(:last-child) {
|
|
7262
|
-
margin-right: var(--x-size-gap-dropdown-item-default);
|
|
7263
|
-
}
|
|
7264
|
-
}
|
|
7265
|
-
.x-dropdown__item:hover, .x-dropdown__item--is-highlighted {
|
|
7266
|
-
color: var(--x-color-text-dropdown-item-default-hover);
|
|
7267
|
-
background-color: var(--x-color-background-dropdown-item-default-hover);
|
|
7268
|
-
font-weight: var(--x-number-font-weight-dropdown-item-default-hover);
|
|
7269
|
-
-webkit-text-decoration: var(--x-font-decoration-dropdown-item-default-hover);
|
|
7270
|
-
text-decoration: var(--x-font-decoration-dropdown-item-default-hover);
|
|
7271
|
-
}
|
|
7272
|
-
.x-dropdown__item--is-selected {
|
|
7273
|
-
color: var(--x-color-text-dropdown-item-default-selected);
|
|
7274
|
-
background-color: var(--x-color-background-dropdown-item-default-selected);
|
|
7275
|
-
font-weight: var(--x-number-font-weight-dropdown-item-default-selected);
|
|
7276
|
-
-webkit-text-decoration: var(--x-font-decoration-dropdown-item-default-selected);
|
|
7277
|
-
text-decoration: var(--x-font-decoration-dropdown-item-default-selected);
|
|
7278
|
-
}
|
|
7279
|
-
[dir="ltr"] .x-dropdown__item * + .x-icon:last-child {
|
|
7280
|
-
margin-left: auto;
|
|
7281
|
-
}
|
|
7282
|
-
[dir="rtl"] .x-dropdown__item * + .x-icon:last-child {
|
|
7283
|
-
margin-right: auto;
|
|
7284
|
-
}
|
|
7285
|
-
.x-dropdown--is-open {
|
|
7286
|
-
--x-color-background-dropdown-toggle-default: var(
|
|
7287
|
-
--x-color-background-dropdown-toggle-open-default
|
|
7288
|
-
);
|
|
7289
|
-
}
|
|
7290
|
-
[dir="ltr"] .x-dropdown--right .x-dropdown__items-list {
|
|
7291
|
-
right: 0;
|
|
7292
|
-
}
|
|
7293
|
-
[dir="rtl"] .x-dropdown--right .x-dropdown__items-list {
|
|
7294
|
-
left: 0;
|
|
7295
|
-
}
|
|
@@ -17,7 +17,7 @@ export default class BaseModal extends Vue
|
|
|
17
17
|
|
|
18
18
|
| Property | Modifiers | Type | Description |
|
|
19
19
|
| --- | --- | --- | --- |
|
|
20
|
-
| [$refs](./x-components.basemodal._refs.md) | | { modal: HTMLDivElement; } | |
|
|
20
|
+
| [$refs](./x-components.basemodal._refs.md) | | { modal: HTMLDivElement; modalContent: HTMLDivElement; } | |
|
|
21
21
|
| [animation](./x-components.basemodal.animation.md) | | Vue \| string | Animation to use for opening/closing the modal. This animation only affects the content. |
|
|
22
22
|
| [focusOnOpen](./x-components.basemodal.focusonopen.md) | | boolean | Determines if the focused element changes to one inside the modal when it opens. Either the first element with a positive tabindex or just the first focusable element. |
|
|
23
23
|
| [isWaitingForLeave](./x-components.basemodal.iswaitingforleave.md) | | boolean | Boolean to delay the leave animation until it has completed. |
|
|
@@ -25,6 +25,8 @@ export default class BaseModal extends Vue
|
|
|
25
25
|
| [overlayAnimation](./x-components.basemodal.overlayanimation.md) | | Vue \| string | Animation to use for the overlay (backdrop) part of the modal. By default, it uses a fade transition. |
|
|
26
26
|
| [previousBodyOverflow](./x-components.basemodal.previousbodyoverflow.md) | | string | The previous value of the body overflow style. |
|
|
27
27
|
| [previousHTMLOverflow](./x-components.basemodal.previoushtmloverflow.md) | | string | The previous value of the HTML element overflow style. |
|
|
28
|
+
| [referenceElement](./x-components.basemodal.referenceelement.md) | | HTMLElement | The reference element to use to find the modal's position. |
|
|
29
|
+
| [referenceSelector?](./x-components.basemodal.referenceselector.md) | | string | <i>(Optional)</i> The reference selector of a DOM element to use as reference to position the modal. This selector can be an ID or a class, if it is a class, it will use the first element that matches. |
|
|
28
30
|
|
|
29
31
|
## Methods
|
|
30
32
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseModal](./x-components.basemodal.md) > [referenceElement](./x-components.basemodal.referenceelement.md)
|
|
4
|
+
|
|
5
|
+
## BaseModal.referenceElement property
|
|
6
|
+
|
|
7
|
+
The reference element to use to find the modal's position.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
protected referenceElement: HTMLElement;
|
|
13
|
+
```
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
|
2
|
+
|
|
3
|
+
[Home](./index.md) > [@empathyco/x-components](./x-components.md) > [BaseModal](./x-components.basemodal.md) > [referenceSelector](./x-components.basemodal.referenceselector.md)
|
|
4
|
+
|
|
5
|
+
## BaseModal.referenceSelector property
|
|
6
|
+
|
|
7
|
+
The reference selector of a DOM element to use as reference to position the modal. This selector can be an ID or a class, if it is a class, it will use the first element that matches.
|
|
8
|
+
|
|
9
|
+
<b>Signature:</b>
|
|
10
|
+
|
|
11
|
+
```typescript
|
|
12
|
+
referenceSelector?: string;
|
|
13
|
+
```
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
## InstallXOptions.domElement property
|
|
6
6
|
|
|
7
|
-
An Element \| string to indicate the HTML element that will contain the Vue application. If
|
|
7
|
+
An Element \| string \| function to indicate the HTML element that will contain the Vue application. If it isn't passed, the [XInstaller](./x-components.xinstaller.md) will create the target element.
|
|
8
8
|
|
|
9
9
|
<b>Signature:</b>
|
|
10
10
|
|
|
11
11
|
```typescript
|
|
12
|
-
domElement?: Element | string;
|
|
12
|
+
domElement?: Element | string | ((snippetConfig: NormalisedSnippetConfig) => Element | string);
|
|
13
13
|
```
|
|
@@ -20,7 +20,7 @@ export interface InstallXOptions<API extends XAPI = XAPI> extends XPluginOptions
|
|
|
20
20
|
| [api?](./x-components.installxoptions.api.md) | API \| false | <i>(Optional)</i> The API to expose globally. If is not passed the default [BaseXAPI](./x-components.basexapi.md) will be used. If a <code>false</code> value is passed then the API is not created. |
|
|
21
21
|
| [app?](./x-components.installxoptions.app.md) | VueConstructor \| ComponentOptions<Vue> | <i>(Optional)</i> The Vue component used as root of the application. If it is not passed, no Vue Application is initialized, only plugin installed. |
|
|
22
22
|
| [bus?](./x-components.installxoptions.bus.md) | [XBus](./x-components.xbus.md) | <i>(Optional)</i> The [XBus](./x-components.xbus.md) used in the [XPlugin](./x-components.xplugin.md)<!-- -->. If not passed an instance of [BaseXBus](./x-components.basexbus.md) will be used. |
|
|
23
|
-
| [domElement?](./x-components.installxoptions.domelement.md) | Element \| string | <i>(Optional)</i> An Element \| string to indicate the HTML element that will contain the Vue application. If
|
|
23
|
+
| [domElement?](./x-components.installxoptions.domelement.md) | Element \| string \| ((snippetConfig: [NormalisedSnippetConfig](./x-components.normalisedsnippetconfig.md)<!-- -->) => Element \| string) | <i>(Optional)</i> An Element \| string \| function to indicate the HTML element that will contain the Vue application. If it isn't passed, the [XInstaller](./x-components.xinstaller.md) will create the target element. |
|
|
24
24
|
| [onCreateApp?](./x-components.installxoptions.oncreateapp.md) | (app: Vue) => void | <i>(Optional)</i> Callback to invoke after instantiating the app. |
|
|
25
25
|
| [plugin?](./x-components.installxoptions.plugin.md) | PluginObject<[XPluginOptions](./x-components.xpluginoptions.md)<!-- -->> | <i>(Optional)</i> The XPlugin which will be installed. If not passed, an instance of [XPlugin](./x-components.xplugin.md) will be installed. |
|
|
26
26
|
| [vue?](./x-components.installxoptions.vue.md) | VueConstructor | <i>(Optional)</i> The Vue instance used to install the plugin and to create the Application. If not passed the default Vue instance is used. This can be useful to use the <code>localVue</code> in the unit tests. |
|
|
@@ -11,12 +11,13 @@ complex modals.
|
|
|
11
11
|
|
|
12
12
|
## Props
|
|
13
13
|
|
|
14
|
-
| Name
|
|
15
|
-
|
|
|
16
|
-
| <code>animation</code>
|
|
17
|
-
| <code>overlayAnimation</code>
|
|
18
|
-
| <code>open</code>
|
|
19
|
-
| <code>focusOnOpen</code>
|
|
14
|
+
| Name | Description | Type | Default |
|
|
15
|
+
| ------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------- | ---------------------------- |
|
|
16
|
+
| <code>animation</code> | Animation to use for opening/closing the modal. This animation only affects the content. | <code>union</code> | <code>() => NoElement</code> |
|
|
17
|
+
| <code>overlayAnimation</code> | Animation to use for the overlay (backdrop) part of the modal. By default, it uses<br />a fade transition. | <code>union</code> | <code>() => Fade</code> |
|
|
18
|
+
| <code>open</code> | Determines if the modal is open or not. | <code>boolean</code> | <code></code> |
|
|
19
|
+
| <code>focusOnOpen</code> | Determines if the focused element changes to one inside the modal when it opens. Either the<br />first element with a positive tabindex or just the first focusable element. | <code>boolean</code> | <code>true</code> |
|
|
20
|
+
| <code>referenceSelector</code> | The reference selector of a DOM element to use as reference to position the modal.<br />This selector can be an ID or a class, if it is a class, it will use the first<br />element that matches. | <code>string</code> | <code></code> |
|
|
20
21
|
|
|
21
22
|
## Events
|
|
22
23
|
|
|
@@ -34,7 +35,9 @@ complex modals.
|
|
|
34
35
|
## Examples
|
|
35
36
|
|
|
36
37
|
The `BaseModal` is a simple component that serves to create complex modals. Its open state has to be
|
|
37
|
-
passed via prop.
|
|
38
|
+
passed via prop. There is a prop, `referenceSelector`, used to place the modal under some element
|
|
39
|
+
instead of set the top of the element directly. It also accepts an animation to use for opening &
|
|
40
|
+
closing.
|
|
38
41
|
|
|
39
42
|
It emits a `click:overlay` event when any part out of the content is clicked, but only if the modal
|
|
40
43
|
is open.
|
|
@@ -44,9 +47,10 @@ is open.
|
|
|
44
47
|
<div>
|
|
45
48
|
<button @click="open = true">Open modal</button>
|
|
46
49
|
<BaseModal
|
|
47
|
-
animation="fadeAndSlide"
|
|
50
|
+
:animation="fadeAndSlide"
|
|
48
51
|
:open="open"
|
|
49
52
|
@click:overlay="open = false"
|
|
53
|
+
referenceSelector=".header"
|
|
50
54
|
>
|
|
51
55
|
<h1>Hello</h1>
|
|
52
56
|
<p>The modal is working</p>
|
|
@@ -11,13 +11,18 @@ var __vue_render__ = function () {
|
|
|
11
11
|
var _c = _vm._self._c || _h;
|
|
12
12
|
return _c(
|
|
13
13
|
"BaseModal",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
_vm._b(
|
|
15
|
+
{
|
|
16
|
+
attrs: { animation: _vm.animation, open: _vm.isOpen },
|
|
17
|
+
on: {
|
|
18
|
+
"click:overlay": _vm.emitBodyClickEvent,
|
|
19
|
+
"focusin:body": _vm.emitBodyClickEvent,
|
|
20
|
+
},
|
|
19
21
|
},
|
|
20
|
-
|
|
22
|
+
"BaseModal",
|
|
23
|
+
_vm.$attrs,
|
|
24
|
+
false
|
|
25
|
+
),
|
|
21
26
|
[_vm._t("default")],
|
|
22
27
|
2
|
|
23
28
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-events-modal.vue.js","sources":["../../../../src/components/modals/base-events-modal.vue"],"sourcesContent":["<template>\n <BaseModal\n @click:overlay=\"emitBodyClickEvent\"\n @focusin:body=\"emitBodyClickEvent\"\n :animation=\"animation\"\n :open=\"isOpen\"\n >\n <slot />\n </BaseModal>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { XEvent } from '../../wiring/events.types';\n import { XOn } from '../decorators/bus.decorators';\n import { WireMetadata } from '../../wiring/wiring.types';\n import { isElementEqualOrContained } from '../../utils/html';\n import BaseModal from './base-modal.vue';\n\n /**\n * Component containing a modal that emits a {@link XEventsTypes.UserClickedCloseEventsModal} when\n * clicking outside the content rendered in the default slot and can receive, through the\n * eventsToCloseModal prop, a list of {@link XEvent | xEvents} to listen to in order to close\n * also the modal, eventsToOpenModal prop, another list of {@link XEvent | xEvents} to customize\n * the events to listen to open the modal and a prop, displayOverlay, to display an\n * overlay over the rest of the html. The default slot offers the possibility to customize the\n * modal content.\n *\n * @public\n */\n @Component({\n components: { BaseModal }\n })\n export default class BaseEventsModal extends Vue {\n /**\n * Animation to use for opening/closing the modal.\n */\n @Prop()\n public animation?: Vue | string;\n /**\n * Array of {@link XEvent | xEvents} to listen to open the modal.\n */\n @Prop({ default: (): XEvent[] => ['UserClickedOpenEventsModal'] })\n public eventsToOpenModal!: XEvent[];\n\n /**\n * Array of {@link XEvent | xEvents} to listen to close the modal.\n */\n @Prop({\n default: (): XEvent[] => ['UserClickedCloseEventsModal', 'UserClickedOutOfEventsModal']\n })\n public eventsToCloseModal!: XEvent[];\n\n /**\n * Event to emit when any part of the website out of the modal has been clicked.\n */\n @Prop({ default: 'UserClickedOutOfEventsModal' })\n public bodyClickEvent!: XEvent;\n\n /**\n * Whether the modal is open or not.\n */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param _payload - The payload of the event that opened the modal.\n * @param metadata - The metadata of the event that opened the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToOpenModal)\n openModal(_payload: unknown, metadata: WireMetadata): void {\n if (!this.isOpen) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToCloseModal)\n closeModal(): void {\n if (this.isOpen) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits the event defined in the {@link BaseEventsModal.bodyClickEvent} event unless the passed\n * event target is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitBodyClickEvent(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit(this.bodyClickEvent, undefined, { target: this.$el as HTMLElement });\n }\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseEventsModal` component handles the modal open/close state via the events passed via props.\nIts configured by default to work as a modal for a whole search application, but if the events are\nchanged, it can work as a modal that is opened/closed when the events it is listening are emitted.\n\n### Basic usage\n\nThe component interacts with the open and close components, which are preconfigured by default to\nemit the same events that the `BaseEventsModal` component is listening to:\n\n```vue\n<template>\n <div>\n <BaseEventsModalOpen>Open</BaseEventsModalOpen>\n <BaseEventsModal>\n <BaseEventsModalClose>Close</BaseEventsModalClose>\n <img src=\"success.png\" />\n </BaseEventsModal>\n </div>\n</template>\n\n<script>\n import { BaseEventsModalOpen, BaseEventsModal } from '@empathyco/x-components';\n\n export default {\n name: 'ModalTest',\n components: {\n BaseEventsModalOpen,\n BaseEventsModal\n }\n };\n</script>\n```\n\n### Customizing the events\n\nIf needed, the events to open/close the modal can be changed. The modal can listen one or more\nevents. To do so, the `eventsToCloseModal` and `eventsToOpenModal` props can be used. Below you can\nsee a full example on how this would work with custom events.\n\n```vue\n<template>\n <div>\n <BaseEventsModalOpen openingEvent=\"UserClickedOpenMyCustomModal\">Open</BaseEventsModalOpen>\n <BaseEventsModal\n :eventsToCloseModal=\"eventsToCloseModal\"\n :eventsToOpenModal=\"eventsToOpenModal\"\n >\n <BaseEventsModalClose closingEvent=\"UserClickedCloseMyCustomModalFromHeader\">\n Close from header\n </BaseEventsModalClose>\n <img src=\"success.png\" />\n <BaseEventsModalClose closingEvent=\"UserClickedCloseMyCustomModalFromFooter\">\n Close from footer\n </BaseEventsModalClose>\n </BaseEventsModal>\n </div>\n</template>\n\n<script>\n import {\n BaseEventsModalOpen,\n BaseEventsModal,\n BaseEventsModalClose\n } from '@empathyco/x-components';\n\n export default {\n name: 'ModalTest',\n components: {\n BaseEventsModalOpen,\n BaseEventsModal,\n BaseEventsModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedCloseEventsModal`: the event is emitted after clicking outside the content rendered in\n the default slot.\n- `UserClickedOutOfEventsModal`: the event is emitted after clicking outside the modal.\n- Custom events to open or close the modal.\n</docs>\n"],"names":[],"mappings":";;;;AAEA
|
|
1
|
+
{"version":3,"file":"base-events-modal.vue.js","sources":["../../../../src/components/modals/base-events-modal.vue"],"sourcesContent":["<template>\n <BaseModal\n @click:overlay=\"emitBodyClickEvent\"\n @focusin:body=\"emitBodyClickEvent\"\n :animation=\"animation\"\n :open=\"isOpen\"\n v-bind=\"$attrs\"\n >\n <slot />\n </BaseModal>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { XEvent } from '../../wiring/events.types';\n import { XOn } from '../decorators/bus.decorators';\n import { WireMetadata } from '../../wiring/wiring.types';\n import { isElementEqualOrContained } from '../../utils/html';\n import BaseModal from './base-modal.vue';\n\n /**\n * Component containing a modal that emits a {@link XEventsTypes.UserClickedCloseEventsModal} when\n * clicking outside the content rendered in the default slot and can receive, through the\n * eventsToCloseModal prop, a list of {@link XEvent | xEvents} to listen to in order to close\n * also the modal, eventsToOpenModal prop, another list of {@link XEvent | xEvents} to customize\n * the events to listen to open the modal and a prop, displayOverlay, to display an\n * overlay over the rest of the html. The default slot offers the possibility to customize the\n * modal content.\n *\n * @public\n */\n @Component({\n components: { BaseModal }\n })\n export default class BaseEventsModal extends Vue {\n /**\n * Animation to use for opening/closing the modal.\n */\n @Prop()\n public animation?: Vue | string;\n /**\n * Array of {@link XEvent | xEvents} to listen to open the modal.\n */\n @Prop({ default: (): XEvent[] => ['UserClickedOpenEventsModal'] })\n public eventsToOpenModal!: XEvent[];\n\n /**\n * Array of {@link XEvent | xEvents} to listen to close the modal.\n */\n @Prop({\n default: (): XEvent[] => ['UserClickedCloseEventsModal', 'UserClickedOutOfEventsModal']\n })\n public eventsToCloseModal!: XEvent[];\n\n /**\n * Event to emit when any part of the website out of the modal has been clicked.\n */\n @Prop({ default: 'UserClickedOutOfEventsModal' })\n public bodyClickEvent!: XEvent;\n\n /**\n * Whether the modal is open or not.\n */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param _payload - The payload of the event that opened the modal.\n * @param metadata - The metadata of the event that opened the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToOpenModal)\n openModal(_payload: unknown, metadata: WireMetadata): void {\n if (!this.isOpen) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToCloseModal)\n closeModal(): void {\n if (this.isOpen) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits the event defined in the {@link BaseEventsModal.bodyClickEvent} event unless the passed\n * event target is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitBodyClickEvent(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit(this.bodyClickEvent, undefined, { target: this.$el as HTMLElement });\n }\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseEventsModal` component handles the modal open/close state via the events passed via props.\nIts configured by default to work as a modal for a whole search application, but if the events are\nchanged, it can work as a modal that is opened/closed when the events it is listening are emitted.\n\n### Basic usage\n\nThe component interacts with the open and close components, which are preconfigured by default to\nemit the same events that the `BaseEventsModal` component is listening to:\n\n```vue\n<template>\n <div>\n <BaseEventsModalOpen>Open</BaseEventsModalOpen>\n <BaseEventsModal>\n <BaseEventsModalClose>Close</BaseEventsModalClose>\n <img src=\"success.png\" />\n </BaseEventsModal>\n </div>\n</template>\n\n<script>\n import { BaseEventsModalOpen, BaseEventsModal } from '@empathyco/x-components';\n\n export default {\n name: 'ModalTest',\n components: {\n BaseEventsModalOpen,\n BaseEventsModal\n }\n };\n</script>\n```\n\n### Customizing the events\n\nIf needed, the events to open/close the modal can be changed. The modal can listen one or more\nevents. To do so, the `eventsToCloseModal` and `eventsToOpenModal` props can be used. Below you can\nsee a full example on how this would work with custom events.\n\n```vue\n<template>\n <div>\n <BaseEventsModalOpen openingEvent=\"UserClickedOpenMyCustomModal\">Open</BaseEventsModalOpen>\n <BaseEventsModal\n :eventsToCloseModal=\"eventsToCloseModal\"\n :eventsToOpenModal=\"eventsToOpenModal\"\n >\n <BaseEventsModalClose closingEvent=\"UserClickedCloseMyCustomModalFromHeader\">\n Close from header\n </BaseEventsModalClose>\n <img src=\"success.png\" />\n <BaseEventsModalClose closingEvent=\"UserClickedCloseMyCustomModalFromFooter\">\n Close from footer\n </BaseEventsModalClose>\n </BaseEventsModal>\n </div>\n</template>\n\n<script>\n import {\n BaseEventsModalOpen,\n BaseEventsModal,\n BaseEventsModalClose\n } from '@empathyco/x-components';\n\n export default {\n name: 'ModalTest',\n components: {\n BaseEventsModalOpen,\n BaseEventsModal,\n BaseEventsModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedCloseEventsModal`: the event is emitted after clicking outside the content rendered in\n the default slot.\n- `UserClickedOutOfEventsModal`: the event is emitted after clicking outside the modal.\n- Custom events to open or close the modal.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-events-modal.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/modals/base-events-modal.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { XEvent } from '../../wiring/events.types';\nimport { XOn } from '../decorators/bus.decorators';\nimport { WireMetadata } from '../../wiring/wiring.types';\nimport { isElementEqualOrContained } from '../../utils/html';\nimport BaseModal from './base-modal.vue';\n\n/**\n * Component containing a modal that emits a {@link XEventsTypes.UserClickedCloseEventsModal} when\n * clicking outside the content rendered in the default slot and can receive, through the\n * eventsToCloseModal prop, a list of {@link XEvent | xEvents} to listen to in order to close\n * also the modal, eventsToOpenModal prop, another list of {@link XEvent | xEvents} to customize\n * the events to listen to open the modal and a prop, displayOverlay, to display an\n * overlay over the rest of the html. The default slot offers the possibility to customize the\n * modal content.\n *\n * @public\n */\n@Component({\n components: { BaseModal }\n})\nexport default class BaseEventsModal extends Vue {\n /**\n * Animation to use for opening/closing the modal.\n */\n @Prop()\n public animation?: Vue | string;\n /**\n * Array of {@link XEvent | xEvents} to listen to open the modal.\n */\n @Prop({ default: (): XEvent[] => ['UserClickedOpenEventsModal'] })\n public eventsToOpenModal!: XEvent[];\n\n /**\n * Array of {@link XEvent | xEvents} to listen to close the modal.\n */\n @Prop({\n default: (): XEvent[] => ['UserClickedCloseEventsModal', 'UserClickedOutOfEventsModal']\n })\n public eventsToCloseModal!: XEvent[];\n\n /**\n * Event to emit when any part of the website out of the modal has been clicked.\n */\n @Prop({ default: 'UserClickedOutOfEventsModal' })\n public bodyClickEvent!: XEvent;\n\n /**\n * Whether the modal is open or not.\n */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param _payload - The payload of the event that opened the modal.\n * @param metadata - The metadata of the event that opened the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToOpenModal)\n openModal(_payload: unknown, metadata: WireMetadata): void {\n if (!this.isOpen) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToCloseModal)\n closeModal(): void {\n if (this.isOpen) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits the event defined in the {@link BaseEventsModal.bodyClickEvent} event unless the passed\n * event target is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitBodyClickEvent(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit(this.bodyClickEvent, undefined, { target: this.$el as HTMLElement });\n }\n }\n}\n"],"names":["BaseModal"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"base-events-modal.vue_rollup-plugin-vue_script.vue.js","sources":["../../../../src/components/modals/base-events-modal.vue?rollup-plugin-vue=script.ts"],"sourcesContent":["\n\n\n\n\n\n\n\n\n\n\n\n\nimport Vue from 'vue';\nimport { Component, Prop } from 'vue-property-decorator';\nimport { XEvent } from '../../wiring/events.types';\nimport { XOn } from '../decorators/bus.decorators';\nimport { WireMetadata } from '../../wiring/wiring.types';\nimport { isElementEqualOrContained } from '../../utils/html';\nimport BaseModal from './base-modal.vue';\n\n/**\n * Component containing a modal that emits a {@link XEventsTypes.UserClickedCloseEventsModal} when\n * clicking outside the content rendered in the default slot and can receive, through the\n * eventsToCloseModal prop, a list of {@link XEvent | xEvents} to listen to in order to close\n * also the modal, eventsToOpenModal prop, another list of {@link XEvent | xEvents} to customize\n * the events to listen to open the modal and a prop, displayOverlay, to display an\n * overlay over the rest of the html. The default slot offers the possibility to customize the\n * modal content.\n *\n * @public\n */\n@Component({\n components: { BaseModal }\n})\nexport default class BaseEventsModal extends Vue {\n /**\n * Animation to use for opening/closing the modal.\n */\n @Prop()\n public animation?: Vue | string;\n /**\n * Array of {@link XEvent | xEvents} to listen to open the modal.\n */\n @Prop({ default: (): XEvent[] => ['UserClickedOpenEventsModal'] })\n public eventsToOpenModal!: XEvent[];\n\n /**\n * Array of {@link XEvent | xEvents} to listen to close the modal.\n */\n @Prop({\n default: (): XEvent[] => ['UserClickedCloseEventsModal', 'UserClickedOutOfEventsModal']\n })\n public eventsToCloseModal!: XEvent[];\n\n /**\n * Event to emit when any part of the website out of the modal has been clicked.\n */\n @Prop({ default: 'UserClickedOutOfEventsModal' })\n public bodyClickEvent!: XEvent;\n\n /**\n * Whether the modal is open or not.\n */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param _payload - The payload of the event that opened the modal.\n * @param metadata - The metadata of the event that opened the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToOpenModal)\n openModal(_payload: unknown, metadata: WireMetadata): void {\n if (!this.isOpen) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @internal\n */\n @XOn(component => (component as BaseEventsModal).eventsToCloseModal)\n closeModal(): void {\n if (this.isOpen) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits the event defined in the {@link BaseEventsModal.bodyClickEvent} event unless the passed\n * event target is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitBodyClickEvent(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit(this.bodyClickEvent, undefined, { target: this.$el as HTMLElement });\n }\n }\n}\n"],"names":["BaseModal"],"mappings":";;;;;;;AAqBA;;;;;;;;;;;AAcA,IAAqB,eAAe,GAApC,MAAqB,eAAgB,SAAQ,GAAG;IAAhD;;;;;QA6BY,WAAM,GAAG,KAAK,CAAC;KAiD1B;;;;;;;;;IAnCC,SAAS,CAAC,QAAiB,EAAE,QAAsB;QACjD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YAChB,IAAI,CAAC,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC;YACrC,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;SACpB;KACF;;;;;;IAQD,UAAU;QACR,IAAI,IAAI,CAAC,MAAM,EAAE;YACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;SACrB;KACF;;;;;;;;IASS,kBAAkB,CAAC,KAA8B;;QAEzD,IACE,CAAC,IAAI,CAAC,aAAa;YACnB,CAAC,yBAAyB,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,MAAqB,CAAC,EAC3E;YACA,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,IAAI,CAAC,GAAkB,EAAE,CAAC,CAAC;SACnF;KACF;CACF,CAAA;AAzEC;IADC,IAAI,EAAE;kDACyB;AAKhC;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAgB,CAAC,4BAA4B,CAAC,EAAE,CAAC;0DAC9B;AAQpC;IAHC,IAAI,CAAC;QACJ,OAAO,EAAE,MAAgB,CAAC,6BAA6B,EAAE,6BAA6B,CAAC;KACxF,CAAC;2DACmC;AAMrC;IADC,IAAI,CAAC,EAAE,OAAO,EAAE,6BAA6B,EAAE,CAAC;uDAClB;AAmB/B;IADC,GAAG,CAAC,SAAS,IAAK,SAA6B,CAAC,iBAAiB,CAAC;gDAMlE;AAQD;IADC,GAAG,CAAC,SAAS,IAAK,SAA6B,CAAC,kBAAkB,CAAC;iDAKnE;AA5DkB,eAAe;IAHnC,SAAS,CAAC;QACT,UAAU,EAAE,aAAEA,iBAAS,EAAE;KAC1B,CAAC;GACmB,eAAe,CA8EnC;aA9EoB,eAAe;;;;"}
|
|
@@ -11,13 +11,18 @@ var __vue_render__ = function () {
|
|
|
11
11
|
var _c = _vm._self._c || _h;
|
|
12
12
|
return _c(
|
|
13
13
|
"BaseModal",
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
_vm._b(
|
|
15
|
+
{
|
|
16
|
+
attrs: { animation: _vm.animation, open: _vm.isOpen },
|
|
17
|
+
on: {
|
|
18
|
+
"click:overlay": _vm.emitClickOutOfModal,
|
|
19
|
+
"focusin:body": _vm.emitClickOutOfModal,
|
|
20
|
+
},
|
|
19
21
|
},
|
|
20
|
-
|
|
22
|
+
"BaseModal",
|
|
23
|
+
_vm.$attrs,
|
|
24
|
+
false
|
|
25
|
+
),
|
|
21
26
|
[_vm._t("default")],
|
|
22
27
|
2
|
|
23
28
|
)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-id-modal.vue.js","sources":["../../../../src/components/modals/base-id-modal.vue"],"sourcesContent":["<template>\n <BaseModal\n @click:overlay=\"emitClickOutOfModal\"\n @focusin:body=\"emitClickOutOfModal\"\n :animation=\"animation\"\n :open=\"isOpen\"\n >\n <slot />\n </BaseModal>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { XOn } from '../decorators/bus.decorators';\n import { WireMetadata } from '../../wiring/wiring.types';\n import { isElementEqualOrContained } from '../../utils/html';\n import BaseModal from './base-modal.vue';\n\n /**\n * Component containing a modal expecting a required prop, named `modalId`. It reacts to\n * `UserClickedOpenModal`, `UserClickedCloseModal` and `UserClickedOutOfModal` events, when their\n * payload matches the component's 'modalId' prop, to handle its open/close state. The default\n * slot offers the possibility to customise the modal content.\n *\n * @public\n */\n @Component({\n components: { BaseModal }\n })\n export default class BaseIdModal extends Vue {\n /** Animation to use for opening/closing the modal. */\n @Prop()\n public animation?: Vue | string;\n\n /** The modalId to use for the open and close event listeners. */\n @Prop({ required: true })\n public modalId!: string;\n\n /** Whether the modal is open or not. */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param modalId - The payload of the {@link XEventsTypes.UserClickedOpenModal} event.\n * @param metadata - The metadata of the emitted event.\n * @public\n */\n @XOn('UserClickedOpenModal')\n openModal(modalId: string, metadata: WireMetadata): void {\n if (!this.isOpen && this.modalId === modalId) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @param payload - The payload of the closing events:\n * {@link XEventsTypes.UserClickedCloseModal} or {@link XEventsTypes.UserClickedOutOfModal}.\n *\n * @public\n */\n @XOn(['UserClickedCloseModal', 'UserClickedOutOfModal'])\n closeModal(payload: string): void {\n if (this.isOpen && this.modalId === payload) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits a {@link XEventsTypes.UserClickedOutOfModal} event unless the passed event target\n * is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitClickOutOfModal(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit('UserClickedOutOfModal', this.modalId, { target: this.$el as HTMLElement });\n }\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseIdModal` component reacts to the `UserClickedOpenModal`, `UserClickedCloseModal` and\n`UserClickedOutOfModal` to handle its open/close state. The component filters out the events which\npayload doesn't match its `modalId` prop and reacts only to those who match this criteria.\n\n### Basic usage\n\nThe component interacts with both `BaseIdModalOpen` and `BaseIdModalClose` components, which have to\nshare the same value in their `modalId` prop to work:\n\n```vue\n<template>\n <div>\n <BaseIdModalOpen modalId=\"myModal\">Open</BaseIdModalOpen>\n <BaseIdModal modalId=\"myModal\">\n <img src=\"success.png\" />\n <BaseIdModalClose modalId=\"myModal\">Close</BaseIdModalClose>\n </BaseIdModal>\n </div>\n</template>\n\n<script>\n import { BaseIdModalOpen, BaseIdModal, BaseIdModalClose } from '@empathyco/x-components';\n\n export default {\n name: 'TestModal',\n components: {\n BaseIdModalOpen,\n BaseIdModal,\n BaseIdModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedOutOfModal`: the event is emitted after the user clicks outside the modal. The event\n payload is the id of the modal and a metadata with the target element that emitted it.\n</docs>\n"],"names":[],"mappings":";;;;AAEA
|
|
1
|
+
{"version":3,"file":"base-id-modal.vue.js","sources":["../../../../src/components/modals/base-id-modal.vue"],"sourcesContent":["<template>\n <BaseModal\n @click:overlay=\"emitClickOutOfModal\"\n @focusin:body=\"emitClickOutOfModal\"\n :animation=\"animation\"\n :open=\"isOpen\"\n v-bind=\"$attrs\"\n >\n <slot />\n </BaseModal>\n</template>\n\n<script lang=\"ts\">\n import Vue from 'vue';\n import { Component, Prop } from 'vue-property-decorator';\n import { XOn } from '../decorators/bus.decorators';\n import { WireMetadata } from '../../wiring/wiring.types';\n import { isElementEqualOrContained } from '../../utils/html';\n import BaseModal from './base-modal.vue';\n\n /**\n * Component containing a modal expecting a required prop, named `modalId`. It reacts to\n * `UserClickedOpenModal`, `UserClickedCloseModal` and `UserClickedOutOfModal` events, when their\n * payload matches the component's 'modalId' prop, to handle its open/close state. The default\n * slot offers the possibility to customise the modal content.\n *\n * @public\n */\n @Component({\n components: { BaseModal }\n })\n export default class BaseIdModal extends Vue {\n /** Animation to use for opening/closing the modal. */\n @Prop()\n public animation?: Vue | string;\n\n /** The modalId to use for the open and close event listeners. */\n @Prop({ required: true })\n public modalId!: string;\n\n /** Whether the modal is open or not. */\n protected isOpen = false;\n\n /** The element that opened the modal. */\n protected openerElement?: HTMLElement;\n\n /**\n * Opens the modal.\n *\n * @param modalId - The payload of the {@link XEventsTypes.UserClickedOpenModal} event.\n * @param metadata - The metadata of the emitted event.\n * @public\n */\n @XOn('UserClickedOpenModal')\n openModal(modalId: string, metadata: WireMetadata): void {\n if (!this.isOpen && this.modalId === modalId) {\n this.openerElement = metadata.target;\n this.isOpen = true;\n }\n }\n\n /**\n * Closes the modal.\n *\n * @param payload - The payload of the closing events:\n * {@link XEventsTypes.UserClickedCloseModal} or {@link XEventsTypes.UserClickedOutOfModal}.\n *\n * @public\n */\n @XOn(['UserClickedCloseModal', 'UserClickedOutOfModal'])\n closeModal(payload: string): void {\n if (this.isOpen && this.modalId === payload) {\n this.isOpen = false;\n }\n }\n\n /**\n * Emits a {@link XEventsTypes.UserClickedOutOfModal} event unless the passed event target\n * is the button that opened the modal.\n *\n * @param event - The event that triggered the close attempt.\n * @public\n */\n protected emitClickOutOfModal(event: MouseEvent | FocusEvent): void {\n // Prevents clicking the open button when the panel is already open to close the panel.\n if (\n !this.openerElement ||\n !isElementEqualOrContained(this.openerElement, event.target as HTMLElement)\n ) {\n this.$x.emit('UserClickedOutOfModal', this.modalId, { target: this.$el as HTMLElement });\n }\n }\n }\n</script>\n\n<docs lang=\"mdx\">\n## Examples\n\nThe `BaseIdModal` component reacts to the `UserClickedOpenModal`, `UserClickedCloseModal` and\n`UserClickedOutOfModal` to handle its open/close state. The component filters out the events which\npayload doesn't match its `modalId` prop and reacts only to those who match this criteria.\n\n### Basic usage\n\nThe component interacts with both `BaseIdModalOpen` and `BaseIdModalClose` components, which have to\nshare the same value in their `modalId` prop to work:\n\n```vue\n<template>\n <div>\n <BaseIdModalOpen modalId=\"myModal\">Open</BaseIdModalOpen>\n <BaseIdModal modalId=\"myModal\">\n <img src=\"success.png\" />\n <BaseIdModalClose modalId=\"myModal\">Close</BaseIdModalClose>\n </BaseIdModal>\n </div>\n</template>\n\n<script>\n import { BaseIdModalOpen, BaseIdModal, BaseIdModalClose } from '@empathyco/x-components';\n\n export default {\n name: 'TestModal',\n components: {\n BaseIdModalOpen,\n BaseIdModal,\n BaseIdModalClose\n }\n };\n</script>\n```\n\n## Events\n\nA list of events that the component will emit:\n\n- `UserClickedOutOfModal`: the event is emitted after the user clicks outside the modal. The event\n payload is the id of the modal and a metadata with the target element that emitted it.\n</docs>\n"],"names":[],"mappings":";;;;AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|