Skip to content

Commit 423eb33

Browse files
author
iropolo
committed
refactor(components): dlt-3282 renamed show prop to open
1 parent 2d00fe0 commit 423eb33

16 files changed

+93
-93
lines changed

packages/dialtone-vue/components/modal/modal.stories.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ maximus ipsum ex. Curabitur elementum luctus augue, quis eleifend tortor feugiat
1818
Maecenas maximus, ipsum et laoreet congue, diam massa aliquam libero, at pellentesque \
1919
orci ipsum et velit.`,
2020
title: 'Example Title',
21-
onClose: action('update:show'),
21+
onClose: action('update:open'),
2222
};
2323

2424
export const argTypesData = {
@@ -103,7 +103,7 @@ export const argTypesData = {
103103
type: 'boolean',
104104
},
105105
},
106-
show: {
106+
open: {
107107
control: {
108108
type: 'boolean',
109109
},
@@ -116,7 +116,7 @@ export const argTypesData = {
116116
},
117117

118118
// Events
119-
'update:show': {
119+
'update:open': {
120120
description: `The modal will emit a "false" boolean value for this event when the \
121121
user performs a modal-closing action. Parent components can sync on this value to create \
122122
a 2-way binding to control modal visibility.`,
@@ -151,7 +151,7 @@ export const Default = {
151151
parameters: {
152152
percy: {
153153
args: {
154-
show: true,
154+
open: true,
155155
},
156156
},
157157
},

packages/dialtone-vue/components/modal/modal.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { DtModal, MODAL_BANNER_KINDS } from '@/components/modal';
22
import { mount } from '@vue/test-utils';
33

4-
const SYNC_EVENT_NAME = 'update:show';
4+
const SYNC_EVENT_NAME = 'update:open';
55

66
const MOCK_MODAL_COPY = 'test modal copy';
77
const MOCK_MODAL_TITLE = 'test modal title';
@@ -14,7 +14,7 @@ const baseProps = {
1414
title: MOCK_MODAL_TITLE,
1515
copy: MOCK_MODAL_COPY,
1616
bannerTitle: MOCK_MODAL_BANNER,
17-
show: true,
17+
open: true,
1818
};
1919

2020
const baseSlots = {};
@@ -222,7 +222,7 @@ describe('DtModal Tests', () => {
222222
const bannerTitle = 'title';
223223

224224
await wrapper.setProps({
225-
show: true,
225+
open: true,
226226
bannerTitle,
227227
bannerClass,
228228
});
@@ -234,7 +234,7 @@ describe('DtModal Tests', () => {
234234

235235
it('Should apply banner kind', async () => {
236236
await wrapper.setProps({
237-
show: true,
237+
open: true,
238238
bannerKind: 'info',
239239
bannerTitle: 'title',
240240
});

packages/dialtone-vue/components/modal/modal.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
@keydown="onKeydown"
2222
>
2323
<div
24-
v-if="show && (hasSlotContent($slots.banner) || bannerTitle)"
24+
v-if="open && (hasSlotContent($slots.banner) || bannerTitle)"
2525
data-qa="dt-modal-banner"
2626
:class="[
2727
'd-modal__banner',
@@ -35,13 +35,13 @@
3535
</slot>
3636
</div>
3737
<transition
38-
:appear="show"
38+
:appear="open"
3939
name="d-modal__dialog"
4040
@after-enter="onAfterEnter"
4141
@after-leave="onAfterLeave"
4242
>
4343
<div
44-
v-show="show"
44+
v-show="open"
4545
:class="[
4646
'd-modal__dialog',
4747
{ 'd-modal__dialog--scrollable': fixedHeaderFooter },
@@ -195,7 +195,7 @@ export default {
195195
* Parent component can sync on this value to control the modal's visibility.
196196
* @values true, false
197197
*/
198-
show: {
198+
open: {
199199
type: Boolean,
200200
default: false,
201201
},
@@ -362,10 +362,10 @@ export default {
362362
* The modal will emit a "false" boolean value for this event when the user performs a modal-closing action.
363363
* Parent components can sync on this value to create a 2-way binding to control modal visibility.
364364
*
365-
* @event update:show
365+
* @event update:open
366366
* @type {Boolean}
367367
*/
368-
'update:show',
368+
'update:open',
369369
],
370370
371371
data () {
@@ -393,13 +393,13 @@ export default {
393393
},
394394
395395
watch: {
396-
show (isShowing) {
396+
open (isShowing) {
397397
this.syncDialogState(isShowing);
398398
},
399399
},
400400
401401
mounted () {
402-
if (this.show) {
402+
if (this.open) {
403403
this.syncDialogState(true);
404404
}
405405
},
@@ -436,7 +436,7 @@ export default {
436436
},
437437
438438
close () {
439-
this.$emit('update:show', false);
439+
this.$emit('update:open', false);
440440
},
441441
442442
onBackdropClick (event) {
@@ -451,7 +451,7 @@ export default {
451451
},
452452
453453
async onAfterEnter () {
454-
this.$emit('update:show', true);
454+
this.$emit('update:open', true);
455455
await this.setFocusAfterTransition();
456456
},
457457

packages/dialtone-vue/components/modal/modal_default.story.vue

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<dt-modal
44
:title="$attrs.title"
55
:banner-title="$attrs.bannerTitle"
6-
:show="isOpen"
6+
:open="isOpen"
77
:kind="$attrs.kind"
88
:size="$attrs.size"
99
:copy="$attrs.copy"
@@ -18,7 +18,7 @@
1818
:close-on-click="$attrs.closeOnClick"
1919
:append-to="$attrs.appendTo"
2020
:content-mode="$attrs.contentMode"
21-
@update:show="close"
21+
@update:open="close"
2222
>
2323
<template
2424
v-if="$attrs.banner"
@@ -92,7 +92,7 @@ export default {
9292
9393
data () {
9494
return {
95-
isOpen: this.$attrs.show,
95+
isOpen: this.$attrs.open,
9696
};
9797
},
9898
@@ -103,9 +103,9 @@ export default {
103103
},
104104
105105
watch: {
106-
show: {
106+
open: {
107107
handler () {
108-
this.isOpen = this.$attrs.show;
108+
this.isOpen = this.$attrs.open;
109109
},
110110
},
111111
},

packages/dialtone-vue/components/popover/popover_variants.story.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@
377377
<p>
378378
{{ sampleText }}
379379
</p>
380-
<dt-tooltip :show="$attrs.open">
380+
<dt-tooltip :open="$attrs.open">
381381
<template #anchor>
382382
<dt-button>
383383
Hover me

packages/dialtone-vue/components/toast/toast.stories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const argTypesData = {
7979
type: 'select',
8080
},
8181
},
82-
show: {
82+
open: {
8383
table: {
8484
defaultValue: {
8585
summary: 'false',
@@ -156,7 +156,7 @@ export const Default = {
156156
parameters: {
157157
percy: {
158158
args: {
159-
show: true,
159+
open: true,
160160
},
161161
},
162162
},

packages/dialtone-vue/components/toast/toast.test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import DtNoticeAction from '../notice/notice_action.vue';
55
import DtNoticeContent from '../notice/notice_content.vue';
66
import DtNoticeIcon from '../notice/notice_icon.vue';
77

8-
const baseProps = { title: '', show: true };
8+
const baseProps = { title: '', open: true };
99
const baseSlots = {};
1010

1111
let mockProps = {};
@@ -152,7 +152,7 @@ describe('DtToast Tests', () => {
152152

153153
expect(toast.exists()).toBe(true);
154154

155-
mockProps = { show: true, duration: 6500 };
155+
mockProps = { open: true, duration: 6500 };
156156

157157
updateWrapper();
158158

@@ -170,7 +170,7 @@ describe('DtToast Tests', () => {
170170
it('should close the toast with close method', async () => {
171171
expect(toast.exists()).toBe(true);
172172

173-
await wrapper.setProps({ show: false });
173+
await wrapper.setProps({ open: false });
174174

175175
toast = wrapper.find('[data-qa="dt-toast"]');
176176

packages/dialtone-vue/components/toast/toast.vue

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default {
126126
* Supports v-model
127127
* @values true, false
128128
*/
129-
show: {
129+
open: {
130130
type: Boolean,
131131
default: false,
132132
},
@@ -193,11 +193,11 @@ export default {
193193
'close',
194194
195195
/**
196-
* Sync show value
196+
* Sync open value
197197
*
198-
* @event update:show
198+
* @event update:open
199199
*/
200-
'update:show',
200+
'update:open',
201201
],
202202
203203
data () {
@@ -218,10 +218,10 @@ export default {
218218
},
219219
220220
watch: {
221-
show: {
222-
handler: function (show) {
223-
this.isShown = show;
224-
if (show) {
221+
open: {
222+
handler: function (open) {
223+
this.isShown = open;
224+
if (open) {
225225
this.setTimeout();
226226
} else {
227227
clearTimeout(this.displayTimer);
@@ -241,15 +241,15 @@ export default {
241241
if (this.shouldSetTimeout) {
242242
this.displayTimer = setTimeout(() => {
243243
this.isShown = false;
244-
this.$emit('update:show', false);
244+
this.$emit('update:open', false);
245245
}, this.duration);
246246
}
247247
},
248248
249249
handleClose () {
250250
this.isShown = false;
251251
this.$emit('close');
252-
this.$emit('update:show', false);
252+
this.$emit('update:open', false);
253253
},
254254
},
255255
};

packages/dialtone-vue/components/toast/toast_default.story.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<aside class="d-toast-wrapper">
88
<dt-toast
99
ref="toast"
10-
v-model:show="isShown"
10+
v-model:open="isShown"
1111
:kind="$attrs.kind"
1212
:title="$attrs.title"
1313
:message="$attrs.message"
@@ -78,7 +78,7 @@ export default {
7878
7979
data () {
8080
return {
81-
isShown: this.$attrs.show,
81+
isShown: this.$attrs.open,
8282
};
8383
},
8484
@@ -101,8 +101,8 @@ export default {
101101
},
102102
103103
watch: {
104-
show: function (show) {
105-
this.isShown = show;
104+
open: function (open) {
105+
this.isShown = open;
106106
},
107107
},
108108

packages/dialtone-vue/components/tooltip/tooltip.stories.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export const argTypesData = {
7070
enabled: {
7171
type: 'boolean',
7272
},
73-
show: {
73+
open: {
7474
options: [null, true, false],
7575
type: 'select',
7676
},
@@ -100,7 +100,7 @@ export const argTypesData = {
100100
disable: true,
101101
},
102102
},
103-
'update:show': {
103+
'update:open': {
104104
table: {
105105
disable: true,
106106
},

0 commit comments

Comments
 (0)