Skip to content

Commit 2d22c76

Browse files
authored
refactor(components): dlt-3283 refactor prop/slots to be consistent (#1196)
Co-authored-by: iropolo <ignacio.ropolo@dialpad.com>
1 parent ac73bdc commit 2d22c76

26 files changed

Lines changed: 37 additions & 148 deletions

packages/combinator/src/components/controls/control_number.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:size="100"
77
@input="e => emit(VALUE_UPDATE_EVENT, e === '' ? undefined : parseInt(e))"
88
>
9-
<template #labelSlot>
9+
<template #label>
1010
<dt-text
1111
kind="label"
1212
:size="100"

packages/combinator/src/components/controls/control_slot.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
:size="100"
99
@input="updateValue"
1010
>
11-
<template #labelSlot>
11+
<template #label>
1212
<dt-text
1313
kind="label"
1414
:size="100"

packages/combinator/src/components/controls/control_string.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
:size="100"
77
@input="e => emit(VALUE_UPDATE_EVENT, e)"
88
>
9-
<template #labelSlot>
9+
<template #label>
1010
<dt-text
1111
kind="label"
1212
:size="100"

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,6 @@ export const argsData = {
1616

1717
export const argTypesData = {
1818
// Slots
19-
titleOverride: {
20-
table: {
21-
type: { summary: 'VNode' },
22-
},
23-
control: {
24-
type: 'text',
25-
},
26-
},
2719
icon: {
2820
options: iconsList,
2921
table: {

packages/dialtone-vue/components/banner/banner.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<dt-notice-icon
1616
v-if="showIcon"
1717
:kind="kind"
18-
:class="{ 'd-notice__icon--has-title': title || $slots.titleOverride }"
18+
:class="{ 'd-notice__icon--has-title': title || $slots.title }"
1919
>
2020
<!-- @slot Slot for custom icon -->
2121
<slot name="icon" />
@@ -25,10 +25,9 @@
2525
:content-id="contentId"
2626
:title="title"
2727
>
28-
<template #titleOverride>
29-
<!-- eslint-disable-next-line max-len -->
30-
<!-- @slot Allows you to override the title, only use this if you need to override with something other than text. Otherwise use the "title" prop. -->
31-
<slot name="titleOverride" />
28+
<template #title>
29+
<!-- @slot Slot for the title -->
30+
<slot name="title" />
3231
</template>
3332
<!-- @slot the main textual content of the banner -->
3433
<slot />

packages/dialtone-vue/components/banner/banner_default.story.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,6 @@
5656
>
5757
<dt-icon :name="$attrs.icon" />
5858
</template>
59-
<template
60-
v-if="$attrs.titleOverride"
61-
#titleOverride
62-
>
63-
<span v-html="$attrs.titleOverride" />
64-
</template>
6559
</dt-banner>
6660
</div>
6761
</template>

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,6 @@ export const argTypesData = {
6969
disable: true,
7070
},
7171
},
72-
labelSlot: {
73-
table: {
74-
type: { summary: 'VNode' },
75-
},
76-
control: {
77-
type: 'text',
78-
},
79-
},
80-
8172
// Props
8273
modelValue: {
8374
control: 'text',

packages/dialtone-vue/components/input/input.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
data-qa="dt-input-label-wrapper"
1212
>
1313
<!-- @slot Slot for label, defaults to label prop -->
14-
<slot name="labelSlot">
14+
<slot name="label">
1515
<dt-text
1616
v-if="showLabel && label"
1717
ref="label"
@@ -213,7 +213,8 @@ export default {
213213
},
214214
215215
/**
216-
* Label for the input
216+
* Label for the input.
217+
* Can also be overridden with a slot of the same name.
217218
*/
218219
label: {
219220
type: String,

packages/dialtone-vue/components/input/input_default.story.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@
3030
@update:length="updateLength"
3131
@update:invalid="$attrs.onUpdateIsInvalid"
3232
>
33-
<template
34-
v-if="$attrs.labelSlot"
35-
#labelSlot
36-
>
37-
<span v-html="$attrs.labelSlot" />
38-
</template>
3933
<template
4034
v-if="$attrs.description"
4135
#description

packages/dialtone-vue/components/input/input_search_variant.story.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@
2727
@update:length="updateLength"
2828
@update:invalid="$attrs.onUpdateIsInvalid"
2929
>
30-
<template
31-
v-if="$attrs.labelSlot"
32-
#labelSlot
33-
>
34-
<span v-html="$attrs.labelSlot" />
35-
</template>
3630
<template
3731
v-if="$attrs.description"
3832
#description

0 commit comments

Comments
 (0)