Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: components #1364

Merged
merged 69 commits into from
Feb 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
2417de7
feat: components props test
Flosciante Feb 13, 2024
0272ce7
Merge branch 'dev' into feat/components-test
Flosciante Feb 13, 2024
217df53
feat: update alert test
Flosciante Feb 13, 2024
50a50fe
update badge test
Flosciante Feb 13, 2024
141d593
feat: impove button test
Flosciante Feb 13, 2024
ef0b5e9
feat: improve carousel test
Flosciante Feb 13, 2024
3c93894
feat: improve chip test
Flosciante Feb 13, 2024
7507818
feat: improve dropdown test
Flosciante Feb 14, 2024
13b5289
feat: improve icon test
Flosciante Feb 14, 2024
1064442
feat: imprive dropdown test
Flosciante Feb 14, 2024
e632233
improve link test
Flosciante Feb 14, 2024
cf25e7c
improve meter test
Flosciante Feb 14, 2024
e485259
feat: improve progress test
Flosciante Feb 14, 2024
48a2050
feat: improve checkbox test
Flosciante Feb 14, 2024
8ecf8fe
feat: improve form test
Flosciante Feb 14, 2024
86b2c34
feat: formgroup test to fix
Flosciante Feb 14, 2024
c358aa0
feat: improve input test
Flosciante Feb 14, 2024
e97e264
feat: improve inputmenu test
Flosciante Feb 14, 2024
3b3e112
feat: improve radio test
Flosciante Feb 14, 2024
f0ba4a0
feat: improve radiogroup test
Flosciante Feb 14, 2024
e8f57c0
feat: improve range test
Flosciante Feb 14, 2024
eff419c
feat: improve select test
Flosciante Feb 14, 2024
771b6c1
feat: improve textarea test
Flosciante Feb 15, 2024
d7f730b
feat: improve toggle test
Flosciante Feb 15, 2024
1f1636c
feat: improve card test
Flosciante Feb 15, 2024
4e87aad
feat: improve container test
Flosciante Feb 15, 2024
fad3724
feat: improve divider test
Flosciante Feb 15, 2024
9d239bc
feat: improve breadcrumb test
Flosciante Feb 15, 2024
f65a232
feat: improve commandpalette test
Flosciante Feb 15, 2024
447b68d
feat: improve horizontalNavigation test
Flosciante Feb 15, 2024
2d53553
feat(test): mock id to avoid to update snapshot
Flosciante Feb 15, 2024
32a15d2
feat: improve pagination test
Flosciante Feb 15, 2024
c91b9b5
feat: tabs test
Flosciante Feb 15, 2024
036de86
feat: imprive vertical navigation test
Flosciante Feb 15, 2024
989fbc9
feat: improve context mmenu test
Flosciante Feb 15, 2024
d3d008d
feat: improve notification test
Flosciante Feb 15, 2024
c764e6b
feat: improve notifications test
Flosciante Feb 15, 2024
b03d212
feat: improve tooltip test
Flosciante Feb 15, 2024
9f0b0f0
up
Flosciante Feb 15, 2024
7edb3d7
up
Flosciante Feb 15, 2024
e3287eb
Merge branch 'dev' into feat/components-test
Flosciante Feb 15, 2024
320b04b
up
Flosciante Feb 15, 2024
5660eb5
up
Flosciante Feb 16, 2024
bac0e15
up
Flosciante Feb 16, 2024
ca56e66
fix: linter
Flosciante Feb 16, 2024
66f318c
up
Flosciante Feb 16, 2024
63769e5
up
Flosciante Feb 16, 2024
d5552a1
up
Flosciante Feb 16, 2024
5915fa8
feat: up carousel test and snap
Flosciante Feb 16, 2024
b086da2
Merge branch 'dev' into feat/components-test
benjamincanac Feb 22, 2024
124d4bf
Merge branch 'dev' into feat/components-test
benjamincanac Feb 22, 2024
048096c
chore(renovate): update `extends` (#1380)
shinGangan Feb 23, 2024
cf07314
Merge branch 'dev' into feat/components-test
benjamincanac Feb 23, 2024
98079d1
chore(deps): update devdependency @nuxt/ui-pro to v1.0.0-28478433.ed4…
renovate[bot] Feb 23, 2024
721602c
up
benjamincanac Feb 23, 2024
8e1ad86
up
benjamincanac Feb 23, 2024
bf496da
up
benjamincanac Feb 23, 2024
601470d
up
benjamincanac Feb 23, 2024
34341f6
Merge branch 'dev' into feat/components-test
benjamincanac Feb 24, 2024
af8c16b
up
benjamincanac Feb 24, 2024
6387f09
up
benjamincanac Feb 24, 2024
f86cb4a
up
benjamincanac Feb 24, 2024
65a09ec
up
benjamincanac Feb 24, 2024
59ca1b5
up
benjamincanac Feb 25, 2024
3c293a1
up
benjamincanac Feb 25, 2024
26bb7e2
up
benjamincanac Feb 25, 2024
c7149e9
test(Form): update (#1383)
romhml Feb 26, 2024
4c377f9
Merge branch 'dev' into feat/components-test
benjamincanac Feb 26, 2024
e6076c5
up
benjamincanac Feb 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 34 additions & 40 deletions src/runtime/components/data/Table.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<template>
<div :class="ui.wrapper" v-bind="attrs">
<table :class="[ui.base, ui.divide]">
<thead :class="ui.thead">
<tr :class="ui.tr.base">
<th v-if="modelValue" scope="col" :class="ui.checkbox.padding">
<UCheckbox :model-value="indeterminate || selected.length === rows.length" :indeterminate="indeterminate" aria-label="Select all" @change="onChange" />
<div :class="_ui.wrapper" v-bind="attrs">
<table :class="[_ui.base, _ui.divide]">
<thead :class="_ui.thead">
<tr :class="_ui.tr.base">
<th v-if="modelValue" scope="col" :class="_ui.checkbox.padding">
<UCheckbox :model-value="indeterminate || selected.length === _rows.length" :indeterminate="indeterminate" aria-label="Select all" @change="onChange" />
</th>

<th v-for="(column, index) in columns" :key="index" scope="col" :class="[ui.th.base, ui.th.padding, ui.th.color, ui.th.font, ui.th.size, column.class]">
<slot :name="`${column.key}-header`" :column="column" :sort="sort" :on-sort="onSort">
<th v-for="(column, index) in _columns" :key="index" scope="col" :class="[_ui.th.base, _ui.th.padding, _ui.th.color, _ui.th.font, _ui.th.size, column.class]">
<slot :name="`${column.key}-header`" :column="column" :sort="_sort" :on-sort="onSort">
<UButton
v-if="column.sortable"
v-bind="{ ...(ui.default.sortButton || {}), ...sortButton }"
:icon="(!sort.column || sort.column !== column.key) ? (sortButton.icon || ui.default.sortButton.icon) : sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
v-bind="{ ...(_ui.default.sortButton || {}), ...sortButton }"
:icon="(!_sort.column || _sort.column !== column.key) ? (sortButton.icon || _ui.default.sortButton.icon) : _sort.direction === 'asc' ? sortAscIcon : sortDescIcon"
:label="column[columnAttribute]"
@click="onSort(column)"
/>
Expand All @@ -22,45 +22,45 @@
</tr>

<tr v-if="loading && progress">
<td :colspan="0" :class="ui.progress.wrapper">
<UProgress v-bind="{ ...(ui.default.progress || {}), ...progress }" size="2xs" />
<td :colspan="0" :class="_ui.progress.wrapper">
<UProgress v-bind="{ ...(_ui.default.progress || {}), ...progress }" size="2xs" />
</td>
</tr>
</thead>
<tbody :class="ui.tbody">
<tr v-if="loadingState && loading && !rows.length">
<td :colspan="columns.length + (modelValue ? 1 : 0)">
<tbody :class="_ui.tbody">
<tr v-if="_loadingState && loading && !_rows.length">
<td :colspan="_columns.length + (modelValue ? 1 : 0)">
<slot name="loading-state">
<div :class="ui.loadingState.wrapper">
<UIcon v-if="loadingState.icon" :name="loadingState.icon" :class="ui.loadingState.icon" aria-hidden="true" />
<p :class="ui.loadingState.label">
{{ loadingState.label }}
<div :class="_ui.loadingState.wrapper">
<UIcon v-if="_loadingState.icon" :name="_loadingState.icon" :class="_ui.loadingState.icon" aria-hidden="true" />
<p :class="_ui.loadingState.label">
{{ _loadingState.label }}
</p>
</div>
</slot>
</td>
</tr>

<tr v-else-if="emptyState && !rows.length">
<td :colspan="columns.length + (modelValue ? 1 : 0)">
<tr v-else-if="_emptyState && !_rows.length">
<td :colspan="_columns.length + (modelValue ? 1 : 0)">
<slot name="empty-state">
<div :class="ui.emptyState.wrapper">
<UIcon v-if="emptyState.icon" :name="emptyState.icon" :class="ui.emptyState.icon" aria-hidden="true" />
<p :class="ui.emptyState.label">
{{ emptyState.label }}
<div :class="_ui.emptyState.wrapper">
<UIcon v-if="_emptyState.icon" :name="_emptyState.icon" :class="_ui.emptyState.icon" aria-hidden="true" />
<p :class="_ui.emptyState.label">
{{ _emptyState.label }}
</p>
</div>
</slot>
</td>
</tr>

<template v-else>
<tr v-for="(row, index) in rows" :key="index" :class="[ui.tr.base, isSelected(row) && ui.tr.selected, $attrs.onSelect && ui.tr.active, row?.class]" @click="() => onSelect(row)">
<td v-if="modelValue" :class="ui.checkbox.padding">
<tr v-for="(row, index) in _rows" :key="index" :class="[_ui.tr.base, isSelected(row) && _ui.tr.selected, $attrs.onSelect && _ui.tr.active, row?.class]" @click="() => onSelect(row)">
<td v-if="modelValue" :class="_ui.checkbox.padding">
<UCheckbox v-model="selected" :value="row" aria-label="Select row" @click.stop />
</td>

<td v-for="(column, subIndex) in columns" :key="subIndex" :class="[ui.td.base, ui.td.padding, ui.td.color, ui.td.font, ui.td.size, row[column.key]?.class]">
<td v-for="(column, subIndex) in _columns" :key="subIndex" :class="[_ui.td.base, _ui.td.padding, _ui.td.color, _ui.td.font, _ui.td.size, row[column.key]?.class]">
<slot :name="`${column.key}-data`" :column="column" :row="row" :index="index" :get-row-data="(defaultValue) => getRowData(row, column.key, defaultValue)">
{{ getRowData(row, column.key) }}
</slot>
Expand Down Expand Up @@ -293,21 +293,15 @@ export default defineComponent({
}

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
// eslint-disable-next-line vue/no-dupe-keys
sort,
// eslint-disable-next-line vue/no-dupe-keys
columns,
// eslint-disable-next-line vue/no-dupe-keys
rows,
_sort: sort,
_columns: columns,
_rows: rows,
selected,
indeterminate,
// eslint-disable-next-line vue/no-dupe-keys
emptyState,
// eslint-disable-next-line vue/no-dupe-keys
loadingState,
_emptyState: emptyState,
_loadingState: loadingState,
isSelected,
onSort,
onSelect,
Expand Down
19 changes: 9 additions & 10 deletions src/runtime/components/elements/Accordion.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<template>
<div :class="ui.wrapper">
<div :class="_ui.wrapper">
<HDisclosure
v-for="(item, index) in items"
v-slot="{ open, close }"
:key="index"
as="div"
:class="ui.container"
:class="_ui.container"
:default-open="defaultOpen || item.defaultOpen"
>
<HDisclosureButton
Expand All @@ -17,14 +17,14 @@
@keydown.space="closeOthers(index, $event)"
>
<slot :item="item" :index="index" :open="open" :close="close">
<UButton v-bind="{ ...omit(ui.default, ['openIcon', 'closeIcon']), ...attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }">
<UButton v-bind="{ ...omit(_ui.default, ['openIcon', 'closeIcon']), ...attrs, ...omit(item, ['slot', 'disabled', 'content', 'defaultOpen']) }">
<template #trailing>
<UIcon
:name="!open ? openIcon : closeIcon ? closeIcon : openIcon"
:class="[
open && !closeIcon ? '-rotate-180' : '',
uiButton.icon.size[item.size || uiButton.default.size],
ui.item.icon
_uiButton.icon.size[item.size || _uiButton.default.size],
_ui.item.icon
]"
/>
</template>
Expand All @@ -33,14 +33,14 @@
</HDisclosureButton>

<Transition
v-bind="ui.transition"
v-bind="_ui.transition"
@enter="onEnter"
@after-enter="onAfterEnter"
@before-leave="onBeforeLeave"
@leave="onLeave"
>
<div v-show="open">
<HDisclosurePanel :class="[ui.item.base, ui.item.size, ui.item.color, ui.item.padding]" static>
<HDisclosurePanel :class="[_ui.item.base, _ui.item.size, _ui.item.color, _ui.item.padding]" static>
<slot :name="item.slot || 'item'" :item="item" :index="index" :open="open" :close="close">
{{ item.content }}
</slot>
Expand Down Expand Up @@ -157,9 +157,8 @@ export default defineComponent({
provideUseId(() => useId())

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
uiButton,
_ui: ui,
_uiButton: uiButton,
attrs,
buttonRefs,
closeOthers,
Expand Down
25 changes: 12 additions & 13 deletions src/runtime/components/elements/Alert.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
<template>
<div :class="alertClass" v-bind="attrs">
<div class="flex" :class="[ui.gap, { 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }]">
<UIcon v-if="icon" :name="icon" :class="ui.icon.base" />
<UAvatar v-if="avatar" v-bind="{ size: ui.avatar.size, ...avatar }" :class="ui.avatar.base" />
<div class="flex" :class="[_ui.gap, { 'items-start': (description || $slots.description), 'items-center': !description && !$slots.description }]">
<UIcon v-if="icon" :name="icon" :class="_ui.icon.base" />
<UAvatar v-if="avatar" v-bind="{ size: _ui.avatar.size, ...avatar }" :class="_ui.avatar.base" />

<div :class="ui.inner">
<p v-if="(title || $slots.title)" :class="ui.title">
<div :class="_ui.inner">
<p v-if="(title || $slots.title)" :class="_ui.title">
<slot name="title" :title="title">
{{ title }}
</slot>
</p>
<p v-if="description || $slots.description" :class="ui.description">
<p v-if="description || $slots.description" :class="_ui.description">
<slot name="description" :description="description">
{{ description }}
</slot>
</p>

<div v-if="(description || $slots.description) && actions.length" :class="ui.actions">
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
<div v-if="(description || $slots.description) && actions.length" :class="_ui.actions">
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(_ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
</div>
</div>
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(ui.actions, 'mt-0')">
<div v-if="closeButton || (!description && !$slots.description && actions.length)" :class="twMerge(_ui.actions, 'mt-0')">
<template v-if="!description && !$slots.description && actions.length">
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
<UButton v-for="(action, index) of actions" :key="index" v-bind="{ ...(_ui.default.actionButton || {}), ...action }" @click.stop="onAction(action)" />
</template>

<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
<UButton v-if="closeButton" aria-label="Close" v-bind="{ ...(_ui.default.closeButton || {}), ...closeButton }" @click.stop="$emit('close')" />
</div>
</div>
</div>
Expand Down Expand Up @@ -128,8 +128,7 @@ export default defineComponent({
}

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
alertClass,
onAction,
Expand Down
12 changes: 5 additions & 7 deletions src/runtime/components/elements/Avatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
<span :class="wrapperClass">
<img
v-if="url && !error"
:class="imgClass"
:class="_imgClass"
:alt="alt"
:src="url"
v-bind="attrs"
@error="onError"
>
<span v-else-if="text" :class="ui.text">{{ text }}</span>
<span v-else-if="text" :class="_ui.text">{{ text }}</span>
<UIcon v-else-if="icon" :name="icon" :class="iconClass" />
<span v-else-if="placeholder" :class="ui.placeholder">{{ placeholder }}</span>
<span v-else-if="placeholder" :class="_ui.placeholder">{{ placeholder }}</span>

<span v-if="chipColor" :class="chipClass">
{{ chipText }}
Expand Down Expand Up @@ -152,12 +152,10 @@ export default defineComponent({
}

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
wrapperClass,
// eslint-disable-next-line vue/no-dupe-keys
imgClass,
_imgClass: imgClass,
iconClass,
chipClass,
url,
Expand Down
5 changes: 2 additions & 3 deletions src/runtime/components/elements/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</slot>

<slot>
<span v-if="label" :class="[truncate ? ui.truncate : '']">
<span v-if="label" :class="[truncate ? _ui.truncate : '']">
{{ label }}
</span>
</slot>
Expand Down Expand Up @@ -194,8 +194,7 @@ export default defineComponent({
const linkProps = computed(() => getNuxtLinkProps(props))

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
isLeading,
isTrailing,
Expand Down
25 changes: 12 additions & 13 deletions src/runtime/components/elements/Carousel.vue
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<template>
<div :class="ui.wrapper" v-bind="attrs">
<div ref="carouselRef" :class="ui.container" class="no-scrollbar">
<div :class="_ui.wrapper" v-bind="attrs">
<div ref="carouselRef" :class="_ui.container" class="no-scrollbar">
<div
v-for="(item, index) in items"
:key="index"
:class="ui.item"
:class="_ui.item"
>
<slot :item="item" :index="index" />
</div>
</div>

<div v-if="arrows" :class="ui.arrows.wrapper">
<div v-if="arrows" :class="_ui.arrows.wrapper">
<slot name="prev" :on-click="onClickPrev" :disabled="isFirst">
<UButton
v-if="prevButton"
:disabled="isFirst"
v-bind="{ ...ui.default.prevButton, ...prevButton }"
:class="twMerge(ui.default.prevButton.class, prevButton?.class)"
v-bind="{ ..._ui.default.prevButton, ...prevButton }"
:class="twMerge(_ui.default.prevButton.class, prevButton?.class)"
aria-label="Prev"
@click="onClickPrev"
/>
Expand All @@ -26,22 +26,22 @@
<UButton
v-if="nextButton"
:disabled="isLast"
v-bind="{ ...ui.default.nextButton, ...nextButton }"
:class="twMerge(ui.default.nextButton.class, nextButton?.class)"
v-bind="{ ..._ui.default.nextButton, ...nextButton }"
:class="twMerge(_ui.default.nextButton.class, nextButton?.class)"
aria-label="Next"
@click="onClickNext"
/>
</slot>
</div>

<div v-if="indicators" :class="ui.indicators.wrapper">
<div v-if="indicators" :class="_ui.indicators.wrapper">
<template v-for="page in pages" :key="page">
<slot name="indicator" :on-click="onClick" :active="page === currentPage" :page="page">
<button
type="button"
:class="[
ui.indicators.base,
page === currentPage ? ui.indicators.active : ui.indicators.inactive
_ui.indicators.base,
page === currentPage ? _ui.indicators.active : _ui.indicators.inactive
]"
:aria-label="`set slide ${page}`"
@click="onClick(page)"
Expand Down Expand Up @@ -153,8 +153,7 @@ export default defineComponent({
})

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
isFirst,
isLast,
Expand Down
5 changes: 2 additions & 3 deletions src/runtime/components/elements/Chip.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<div :class="ui.wrapper" v-bind="attrs">
<div :class="_ui.wrapper" v-bind="attrs">
<slot />

<span v-if="show" :class="chipClass">
Expand Down Expand Up @@ -82,8 +82,7 @@ export default defineComponent({
})

return {
// eslint-disable-next-line vue/no-dupe-keys
ui,
_ui: ui,
attrs,
chipClass
}
Expand Down
Loading
Loading