Skip to content

Commit

Permalink
Merge pull request #793 from dnum-mi/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
laruiss authored Apr 19, 2024
2 parents d0387e2 + 2ff3875 commit e976e42
Show file tree
Hide file tree
Showing 12 changed files with 22 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/components/DsfrCheckbox/DsfrCheckboxSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ const onChange = ({ name, checked }: { name: string, checked: boolean }) => {
:name="option.name"
:label="option.label"
:disabled="option.disabled"
:aria-disabled="option.disabled"
:small="small"
:inline="inline"
:model-value="modelValue.includes(option.name)"
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrFileUpload/DsfrFileUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const onChange = ($event: InputEvent) => {
v-bind="$attrs"
:value="modelValue"
:disabled="disabled"
:aria-disabled="disabled"
:accept="accept.join(',')"
@change="onChange($event as InputEvent)"
>
Expand Down
10 changes: 7 additions & 3 deletions src/components/DsfrPagination/DsfrPagination.vue
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
:href="pages[0]?.href"
class="fr-pagination__link fr-pagination__link--first"
:title="firstPageTitle"
:disabled="currentPage === 0 ? true : null"
:disabled="currentPage === 0 ? true : undefined"
:aria-disabled="currentPage === 0 ? true : undefined"
@click.prevent="tofirstPage()"
/>
</li>
Expand All @@ -57,7 +58,8 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
:href="pages[Math.max(currentPage - 1, 0)]?.href"
class="fr-pagination__link fr-pagination__link--prev fr-pagination__link--lg-label"
:title="prevPageTitle"
:disabled="currentPage === 0 ? true : null"
:disabled="currentPage === 0 ? true : undefined"
:aria-disabled="currentPage === 0 ? true : undefined"
@click.prevent="toPreviousPage()"
>{{ prevPageTitle }}</a>
</li>
Expand All @@ -82,7 +84,8 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
:href="pages[Math.min(currentPage + 1, pages.length - 1)]?.href"
class="fr-pagination__link fr-pagination__link--next fr-pagination__link--lg-label"
:title="nextPageTitle"
:disabled="currentPage === pages.length - 1 ? true : null"
:disabled="currentPage === pages.length - 1 ? true : undefined"
:aria-disabled="currentPage === pages.length - 1 ? true : undefined"
@click.prevent="toNextPage()"
>{{ nextPageTitle }}</a>
</li>
Expand All @@ -92,6 +95,7 @@ const isCurrentPage = (page: Page) => props.pages.indexOf(page) === props.curren
:href="pages[pages.length - 1]?.href"
:title="lastPageTitle"
:disabled="currentPage === pages.length - 1 ? true : null"
:aria-disabled="currentPage === pages.length - 1 ? true : undefined"
@click.prevent="toLastPage()"
/>
</li>
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrRadioButton/DsfrRadioButton.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export type DsfrRadioButtonProps = {
id?: string
name?: string
modelValue: string | number | boolean | undefined
disabled?: boolean
small?: boolean
inline?: boolean
value: string | number | boolean
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrRadioButton/DsfrRadioButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const rich = computed(() => !!props.img)
:name="name"
:value="value"
:checked="modelValue === value"
:disabled="disabled"
v-bind="$attrs"
@click="$emit('update:modelValue', value)"
>
Expand Down
3 changes: 2 additions & 1 deletion src/components/DsfrRadioButton/DsfrRadioButtonSet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { OhVueIcon as VIcon } from 'oh-vue-icons'
import { fireEvent, render } from '@testing-library/vue'

import RadioButtonSet from './DsfrRadioButtonSet.vue'
import { DsfrRadioButtonProps } from './DsfrRadioButton.types'

describe('DsfrRadioButtonSet', () => {
it('should render a set of radio buttons with label in div', () => {
Expand Down Expand Up @@ -38,7 +39,7 @@ describe('DsfrRadioButtonSet', () => {
const selectedValue = 1
const toClickLabel = 'Label 3'
const errorMessage = 'Message d’erreur'
const options = [
const options: Omit<DsfrRadioButtonProps, 'modelValue'>[] = [
{
label: selectedLabel,
value: selectedValue,
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrRadioButton/DsfrRadioButtonSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const onChange = ($event: string) => {
v-for="(option, i) of options"
:key="typeof option.value === 'boolean' ? i : (option.value || i)"
:name="name"
:aria-disabled="option.disabled"
v-bind="option"
:small="small"
:inline="inline"
Expand Down
2 changes: 2 additions & 0 deletions src/components/DsfrRange/DsfrRange.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ onMounted(() => {
:step="step"
:value="lowerValue"
:disabled="disabled"
:aria-disabled="disabled"
:aria-labelledby="`${id}-label`"
:aria-describedby="`${id}-messages`"
@input="emit('update:lowerValue', +($event.target as HTMLInputElement)?.value)"
Expand All @@ -133,6 +134,7 @@ onMounted(() => {
:step="step"
:value="modelValue"
:disabled="disabled"
:aria-disabled="disabled"
:aria-labelledby="`${id}-label`"
:aria-describedby="`${id}-messages`"
@input="emit('update:modelValue', +($event.target as HTMLInputElement)?.value)"
Expand Down
2 changes: 2 additions & 0 deletions src/components/DsfrSearchBar/DsfrSearchBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ const emit = defineEmits<{
:label-visible="labelVisible"
:label="label"
:disabled="disabled"
:aria-disabled="disabled"
@update:model-value="emit('update:modelValue', $event)"
@keydown.enter="emit('search', modelValue)"
/>
<DsfrButton
title="Rechercher"
:disabled="disabled"
:aria-disabled="disabled"
@click="emit('search', modelValue)"
>
{{ buttonText }}
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrSegmented/DsfrSegmented.vue
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const dsfrIcon = computed(() => {
:value="value"
:checked="modelValue === value"
:disabled="disabled"
:aria-disabled="disabled"
v-bind="$attrs"
@click="$emit('update:modelValue', value)"
>
Expand Down
2 changes: 2 additions & 0 deletions src/components/DsfrSelect/DsfrSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ const messageType = computed(() => {
class="fr-select"
:name="name || selectId"
:disabled="disabled"
:aria-disabled="disabled"
:required="required"
@change="$emit('update:modelValue',($event.target as HTMLInputElement)?.value)"
>
Expand All @@ -83,6 +84,7 @@ const messageType = computed(() => {
:selected="modelValue === option || (typeof option === 'object' && option.value === modelValue)"
:value="typeof option === 'object' ? option.value : option"
:disabled="!!(typeof option === 'object' && option.disabled)"
:aria-disabled="!!(typeof option === 'object' && option.disabled)"
>
{{ typeof option === 'object' ? option.text : option }}
</option>
Expand Down
1 change: 1 addition & 0 deletions src/components/DsfrToggleSwitch/DsfrToggleSwitch.vue
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const labelId = computed(() => {
<input
:id="inputId"
:disabled="disabled"
:aria-disabled="disabled"
type="checkbox"
:checked="modelValue"
:data-testid="inputId"
Expand Down

0 comments on commit e976e42

Please sign in to comment.