Refactor #4908 - For Galleria

pull/4911/head
tugcekucukoglu 2023-11-30 23:06:40 +03:00
parent fd6799bbe0
commit a59fb53535
6 changed files with 30 additions and 4 deletions

View File

@ -92,7 +92,7 @@ export const defaultOptions = {
moveToSource: 'Move to Source', moveToSource: 'Move to Source',
moveAllToTarget: 'Move All to Target', moveAllToTarget: 'Move All to Target',
moveAllToSource: 'Move All to Source', moveAllToSource: 'Move All to Source',
pageLabel: '{page}', pageLabel: 'Page {page}',
firstPageLabel: 'First Page', firstPageLabel: 'First Page',
lastPageLabel: 'Last Page', lastPageLabel: 'Last Page',
nextPageLabel: 'Next Page', nextPageLabel: 'Next Page',

View File

@ -113,6 +113,14 @@ export default {
nextButtonProps: { nextButtonProps: {
type: null, type: null,
default: null default: null
},
ariaLabel: {
type: String,
default: null
},
ariaRoledescription: {
type: String,
default: null
} }
}, },
style: GalleriaStyle, style: GalleriaStyle,

View File

@ -390,6 +390,14 @@ export interface GalleriaProps {
* Used to pass all properties of the HTMLButtonElement to the next navigation button. * Used to pass all properties of the HTMLButtonElement to the next navigation button.
*/ */
nextButtonProps?: ButtonHTMLAttributes | undefined; nextButtonProps?: ButtonHTMLAttributes | undefined;
/**
* Defines a string value that labels an interactive element.
*/
ariaLabel?: string | undefined;
/**
* Defines a string value that description for the role of the component.
*/
ariaRoledescription?: string | undefined;
/** /**
* Used to pass attributes to DOM elements inside the component. * Used to pass attributes to DOM elements inside the component.
* @type {GalleriaPassThroughOptions} * @type {GalleriaPassThroughOptions}

View File

@ -1,6 +1,6 @@
<template> <template>
<Portal v-if="fullScreen"> <Portal v-if="fullScreen">
<div v-if="containerVisible" :ref="maskRef" :class="[cx('mask'), maskClass]" :role="fullScreen ? 'dialog' : 'region'" :aria-modal="fullScreen ? 'true' : undefined" v-bind="ptm('mask')"> <div v-if="containerVisible" :ref="maskRef" :class="[cx('mask'), maskClass]" role="dialog" :aria-modal="fullScreen ? 'true' : undefined" v-bind="ptm('mask')">
<transition name="p-galleria" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')"> <transition name="p-galleria" @before-enter="onBeforeEnter" @enter="onEnter" @before-leave="onBeforeLeave" @after-leave="onAfterLeave" appear v-bind="ptm('transition')">
<GalleriaContent v-if="visible" :ref="containerRef" v-focustrap @mask-hide="maskHide" :templates="$slots" @activeitem-change="onActiveItemChange" :pt="pt" :unstyled="unstyled" v-bind="$props" /> <GalleriaContent v-if="visible" :ref="containerRef" v-focustrap @mask-hide="maskHide" :templates="$slots" @activeitem-change="onActiveItemChange" :pt="pt" :unstyled="unstyled" v-bind="$props" />
</transition> </transition>

View File

@ -1,5 +1,15 @@
<template> <template>
<div v-if="$attrs.value && $attrs.value.length > 0" :id="id" :class="[cx('root'), $attrs.containerClass]" :style="$attrs.containerStyle" v-bind="{ ...$attrs.containerProps, ...getPTOptions('root') }" data-pc-name="galleria"> <div
v-if="$attrs.value && $attrs.value.length > 0"
:id="id"
role="region"
:class="[cx('root'), $attrs.containerClass]"
:style="$attrs.containerStyle"
:aria-label="$attrs.ariaLabel"
:aria-roledescription="$attrs.ariaRoledescription"
v-bind="{ ...$attrs.containerProps, ...getPTOptions('root') }"
data-pc-name="galleria"
>
<button v-if="$attrs.fullScreen" v-ripple autofocus type="button" :class="cx('closeButton')" :aria-label="closeAriaLabel" @click="$emit('mask-hide')" v-bind="getPTOptions('closeButton')"> <button v-if="$attrs.fullScreen" v-ripple autofocus type="button" :class="cx('closeButton')" :aria-label="closeAriaLabel" @click="$emit('mask-hide')" v-bind="getPTOptions('closeButton')">
<component :is="$attrs.templates['closeicon'] || 'TimesIcon'" :class="cx('closeIcon')" v-bind="getPTOptions('closeIcon')" /> <component :is="$attrs.templates['closeicon'] || 'TimesIcon'" :class="cx('closeIcon')" v-bind="getPTOptions('closeIcon')" />
</button> </button>

View File

@ -358,7 +358,7 @@
</tr> </tr>
<tr> <tr>
<td>aria.pageLabel</td> <td>aria.pageLabel</td>
<td>{page}</td> <td>Page {page}</td>
</tr> </tr>
<tr> <tr>
<td>aria.firstPageLabel</td> <td>aria.firstPageLabel</td>