You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
4.2 KiB
161 lines
4.2 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
export const carouselMorfo = {
|
|
name: 'Carousel',
|
|
kebab: 'carousel',
|
|
scope: ['soma'],
|
|
apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/carousel/',
|
|
translations: {
|
|
label: { es: 'Carrusel', en: 'Carousel' },
|
|
prev: { es: 'Diapositiva anterior', en: 'Previous slide' },
|
|
next: { es: 'Diapositiva siguiente', en: 'Next slide' },
|
|
indicator: { es: 'Ir a la diapositiva {{index}}', en: 'Go to slide {{index}}' },
|
|
slide: {
|
|
es: 'Diapositiva {{index}} de {{total}}',
|
|
en: 'Slide {{index}} of {{total}}'
|
|
}
|
|
},
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'provider',
|
|
archetype: 'provider',
|
|
kind: 'public',
|
|
defaultElement: 'section',
|
|
role: 'region',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-orientation', values: ['horizontal', 'vertical'] },
|
|
{ attr: 'data-disabled', severity: 'optional' },
|
|
{ attr: 'data-dragging', severity: 'optional' },
|
|
{ attr: 'data-autoplay', severity: 'optional' }
|
|
],
|
|
aria: [
|
|
{ attr: 'aria-roledescription', value: v.literal('carousel') },
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.carousel.label|Carousel'),
|
|
severity: 'recommended'
|
|
}
|
|
],
|
|
keyboard: [
|
|
{ key: 'ArrowRight', action: 'next-item' },
|
|
{ key: 'ArrowLeft', action: 'prev-item' },
|
|
{ key: 'ArrowDown', action: 'next-item' },
|
|
{ key: 'ArrowUp', action: 'prev-item' },
|
|
{ key: 'Home', action: 'first-item' },
|
|
{ key: 'End', action: 'last-item' }
|
|
]
|
|
},
|
|
{
|
|
name: 'Viewport',
|
|
kebab: 'viewport',
|
|
archetype: 'viewport',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [{ attr: 'data-orientation', values: ['horizontal', 'vertical'] }],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'ItemGroup',
|
|
kebab: 'item-group',
|
|
archetype: 'group',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-orientation', values: ['horizontal', 'vertical'] },
|
|
{ attr: 'data-dragging', severity: 'optional' }
|
|
],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Item',
|
|
kebab: 'item',
|
|
archetype: 'item',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'group',
|
|
optional: false,
|
|
states: ['active', 'inactive'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['active', 'inactive'] },
|
|
{ attr: 'data-index' },
|
|
{ attr: 'data-orientation', values: ['horizontal', 'vertical'] }
|
|
],
|
|
aria: [
|
|
{ attr: 'aria-roledescription', value: v.literal('slide') },
|
|
{ attr: 'aria-label', value: v.propRef('index'), severity: 'recommended' }
|
|
]
|
|
},
|
|
{
|
|
name: 'PrevTrigger',
|
|
kebab: 'prev-trigger',
|
|
archetype: 'trigger',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'button',
|
|
optional: true,
|
|
data: [{ attr: 'data-disabled', severity: 'optional' }],
|
|
aria: [
|
|
{ attr: 'type', value: v.literal('button') },
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.carousel.prev|Previous slide'),
|
|
severity: 'recommended'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'NextTrigger',
|
|
kebab: 'next-trigger',
|
|
archetype: 'trigger',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'button',
|
|
optional: true,
|
|
data: [{ attr: 'data-disabled', severity: 'optional' }],
|
|
aria: [
|
|
{ attr: 'type', value: v.literal('button') },
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.carousel.next|Next slide'),
|
|
severity: 'recommended'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'IndicatorGroup',
|
|
kebab: 'indicator-group',
|
|
archetype: 'group',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'tablist',
|
|
optional: true,
|
|
data: [{ attr: 'data-orientation', values: ['horizontal', 'vertical'] }],
|
|
aria: [{ attr: 'aria-orientation', value: v.propRef('orientation') }]
|
|
},
|
|
{
|
|
name: 'Indicator',
|
|
kebab: 'indicator',
|
|
archetype: 'indicator',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'tab',
|
|
optional: true,
|
|
states: ['active', 'inactive'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['active', 'inactive'] },
|
|
{ attr: 'data-index' }
|
|
],
|
|
aria: [
|
|
{ attr: 'type', value: v.literal('button') },
|
|
{ attr: 'aria-selected', value: v.stateRef('active') },
|
|
{ attr: 'aria-label', value: v.propRef('ariaLabel'), severity: 'recommended' }
|
|
]
|
|
}
|
|
]
|
|
} as const satisfies Morfo;
|