Skip to content

Commit d6964cc

Browse files
committed
fix: standardize on cvId and suffixes
1 parent 905eb2c commit d6964cc

File tree

4 files changed

+28
-25
lines changed

4 files changed

+28
-25
lines changed

src/components/CvDataTable/CvDataTable.vue

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div :id="uid" :style="tableStyle" class="cv-data-table">
2+
<div :id="cvId" :style="tableStyle" class="cv-data-table">
33
<div
44
:class="[
55
`${carbonPrefix}--data-table-container`,
@@ -55,7 +55,7 @@
5555
<div
5656
v-if="onSearch"
5757
ref="searchContainer"
58-
:aria-labelledby="`${uid}-search`"
58+
:aria-labelledby="`${cvId}-search`"
5959
:class="[
6060
`${carbonPrefix}--search `,
6161
{
@@ -73,20 +73,20 @@
7373
<Search16 :class="`${carbonPrefix}--search-magnifier-icon`" />
7474
</div>
7575
<label
76-
:id="`${uid}-search`"
77-
:for="`searchbox-${uid}`"
76+
:id="`${cvId}-search`"
77+
:for="`searchbox-${cvId}`"
7878
:class="`${carbonPrefix}--label`"
7979
>{{ searchLabel }}</label
8080
>
8181
<input
82-
:id="`searchbox-${uid}`"
82+
:id="`searchbox-${cvId}`"
8383
ref="search"
8484
v-model="searchValue"
8585
:class="`${carbonPrefix}--search-input`"
8686
type="text"
8787
role="searchbox"
8888
:placeholder="searchPlaceholder"
89-
:aria-labelledby="`searchbox-${uid}`"
89+
:aria-labelledby="`searchbox-${cvId}`"
9090
@input="onInternalSearch"
9191
@click="checkSearchExpand(true)"
9292
@keydown.esc.prevent="checkSearchExpand(false)"
@@ -160,7 +160,7 @@
160160
<cv-checkbox-skeleton v-if="isSkeleton" />
161161
<cv-checkbox
162162
v-else
163-
:id="`col-cb-${uid}`"
163+
:id="`${cvId}-headingCheck`"
164164
v-model="headingChecked"
165165
:form-item="false"
166166
value="headingCheck"
@@ -188,7 +188,7 @@
188188
<slot name="data">
189189
<cv-data-table-row
190190
v-for="(row, rowIndex) in data"
191-
:id="`${uid}-${rowIndex}`"
191+
:id="`${cvId}-${rowIndex}`"
192192
:key="`row:${rowIndex}`"
193193
ref="dataRows"
194194
:value="`${rowIndex}`"
@@ -213,7 +213,7 @@
213213
<cv-pagination
214214
v-if="pagination"
215215
v-bind="internalPagination"
216-
:id="`pagination-${uid}`"
216+
:id="`${cvId}-pagination`"
217217
:number-of-items="internalNumberOfItems"
218218
@change="$emit('pagination', $event)"
219219
>
@@ -346,7 +346,7 @@ const props = defineProps({
346346
onSearch: { type: Function, default: undefined },
347347
...propsCvId,
348348
});
349-
const uid = useCvId(props, true);
349+
const cvId = useCvId(props, true);
350350
351351
const isSkeleton = ref(props.skeleton);
352352
provide('is-skeleton', isSkeleton);

src/components/CvDataTable/_CvDataTableRowInner.vue

+6-3
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<cv-checkbox-skeleton v-if="isSkeleton" />
3030
<cv-checkbox
3131
v-else
32-
:id="`row-checked-${id}`"
32+
:id="`${cvId}-row-checked`"
3333
ref="rowChecked"
3434
v-model="dataChecked"
3535
:form-item="false"
@@ -44,7 +44,10 @@
4444
</td>
4545
<slot />
4646
<td v-if="hasOverflowMenu" :class="`${carbonPrefix}--table-column-menu`">
47-
<cv-overflow-menu v-bind="overflowMenuOptions" :id="`om-${id}`">
47+
<cv-overflow-menu
48+
v-bind="overflowMenuOptions"
49+
:id="`${cvId}-overflow-menu`"
50+
>
4851
<cv-overflow-menu-item
4952
v-for="(item, index) in overflowMenuButtons"
5053
:key="`${index}`"
@@ -93,7 +96,7 @@ const props = defineProps({
9396
});
9497
9598
const attrs = useAttrs();
96-
const id = useCvId(attrs, true);
99+
const cvId = useCvId(attrs, true);
97100
98101
const isSkeleton = inject('is-skeleton', ref(false));
99102
/** @type {Ref<UnwrapRef<Set<>>>} */

src/components/CvMultiSelect/CvMultiSelect.vue

+9-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@
1616
>
1717
<label
1818
v-if="title"
19-
:id="`${uid}-label`"
19+
:id="`${cvId}-label`"
2020
:class="[
2121
`${carbonPrefix}--label`,
2222
{ [`${carbonPrefix}--label--disabled`]: disabled },
2323
]"
2424
>{{ title }}</label
2525
>
2626
<div
27-
:aria-labelledby="`${uid}-label`"
27+
:aria-labelledby="`${cvId}-label`"
2828
role="listbox"
2929
tabindex="-1"
3030
:class="[
@@ -68,8 +68,8 @@
6868
:aria-disabled="disabled || null"
6969
aria-haspopup="listbox"
7070
:aria-expanded="data.open ? 'true' : 'false'"
71-
:aria-owns="uid"
72-
:aria-controls="uid"
71+
:aria-owns="cvId"
72+
:aria-controls="cvId"
7373
tabindex="0"
7474
:aria-label="data.open ? 'close menu' : 'open menu'"
7575
data-toggle="true"
@@ -105,7 +105,7 @@
105105
!internalFilter || internalFilter.length === 0,
106106
},
107107
]"
108-
:aria-controls="uid"
108+
:aria-controls="cvId"
109109
aria-autocomplete="list"
110110
role="combobox"
111111
:aria-expanded="data.open ? 'true' : 'false'"
@@ -141,9 +141,9 @@
141141
</button>
142142

143143
<div
144-
:id="uid"
144+
:id="cvId"
145145
ref="elList"
146-
:aria-labelledby="`${uid}-label`"
146+
:aria-labelledby="`${cvId}-label`"
147147
:class="`${carbonPrefix}--list-box__menu`"
148148
role="listbox"
149149
>
@@ -168,7 +168,7 @@
168168
:title="item.label"
169169
>
170170
<cv-checkbox
171-
:id="`${uid}-cb-${item.value}`"
171+
:id="`${cvId}-cb-${item.value}`"
172172
v-model="data.selectedItems"
173173
tabindex="-1"
174174
:form-item="false"
@@ -360,7 +360,7 @@ const props = defineProps({
360360
...propsCvId,
361361
...propsTheme,
362362
});
363-
const uid = useCvId(props, true);
363+
const cvId = useCvId(props, true);
364364
const isLight = useIsLight(props);
365365
366366
const data = reactive({

src/components/CvPagination/CvPagination.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div :class="`cv-pagination ${carbonPrefix}--pagination`" data-pagination>
33
<div :class="`${carbonPrefix}--pagination__left`">
44
<cv-select
5-
:id="`${id}-select-page-size`"
5+
:id="`${cvId}-select-page-size`"
66
ref="pageSizeSelect"
77
:class="`${carbonPrefix}--select__item-count`"
88
:label="pageSizesLabel"
@@ -30,7 +30,7 @@
3030
<div :class="`${carbonPrefix}--pagination__right`">
3131
<cv-select
3232
v-if="numberOfItems !== Infinity"
33-
:id="`${id}-select-page`"
33+
:id="`${cvId}-select-page`"
3434
ref="pageSelect"
3535
:class="`${carbonPrefix}--select__page-number`"
3636
:label="pageNumberLabel"
@@ -105,7 +105,7 @@ const props = defineProps({
105105
pageSizes: { type: Array, default: () => [10, 20, 30, 40, 50] },
106106
});
107107
const attrs = useAttrs();
108-
const id = useCvId(attrs, true);
108+
const cvId = useCvId(attrs, true);
109109
110110
const firstItem = ref(1);
111111
const pageValue = ref(1);

0 commit comments

Comments
 (0)