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.
163 lines
4.0 KiB
163 lines
4.0 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
export const stepperMorfo = {
|
|
name: 'Stepper',
|
|
kebab: 'stepper',
|
|
scope: ['soma'],
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'provider',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-orientation', values: ['horizontal', 'vertical'] },
|
|
{ attr: 'data-linear', severity: 'optional' }
|
|
],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'List',
|
|
kebab: 'list',
|
|
kind: 'public',
|
|
defaultElement: 'ol',
|
|
role: 'tablist',
|
|
optional: false,
|
|
data: [],
|
|
aria: [
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.stepper.list|Steps'),
|
|
severity: 'recommended'
|
|
},
|
|
{ attr: 'aria-orientation', value: v.propRef('orientation') }
|
|
]
|
|
},
|
|
{
|
|
name: 'Item',
|
|
kebab: 'item',
|
|
kind: 'public',
|
|
defaultElement: 'li',
|
|
optional: false,
|
|
states: ['complete', 'current', 'incomplete'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['complete', 'current', 'incomplete'] },
|
|
{ attr: 'data-current', severity: 'optional' },
|
|
{ attr: 'data-complete', severity: 'optional' },
|
|
{ attr: 'data-incomplete', severity: 'optional' }
|
|
],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Trigger',
|
|
kebab: 'trigger',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'tab',
|
|
optional: true,
|
|
states: ['complete', 'current', 'incomplete'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['complete', 'current', 'incomplete'] },
|
|
{ attr: 'data-current', severity: 'optional' },
|
|
{ attr: 'data-complete', severity: 'optional' },
|
|
{ attr: 'data-incomplete', severity: 'optional' }
|
|
],
|
|
aria: [
|
|
{ attr: 'type', value: v.literal('button') },
|
|
{
|
|
attr: 'aria-controls',
|
|
value: v.partRef('content'),
|
|
condition: { when: 'part-present', part: 'content' },
|
|
severity: 'recommended'
|
|
},
|
|
{
|
|
attr: 'aria-current',
|
|
value: v.literal('step'),
|
|
severity: 'optional',
|
|
condition: { when: 'state-equals', state: 'current', value: 'true' }
|
|
},
|
|
{
|
|
attr: 'aria-disabled',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'disabled' }
|
|
}
|
|
],
|
|
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: 'Indicator',
|
|
kebab: 'indicator',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
states: ['complete', 'current', 'incomplete'],
|
|
data: [{ attr: 'data-state', values: ['complete', 'current', 'incomplete'] }],
|
|
aria: [{ attr: 'aria-hidden', value: v.literal('true') }]
|
|
},
|
|
{
|
|
name: 'Separator',
|
|
kebab: 'separator',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'separator',
|
|
optional: true,
|
|
states: ['complete', 'current', 'incomplete'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['complete', 'current', 'incomplete'] },
|
|
{ attr: 'data-complete', severity: 'optional' }
|
|
],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Content',
|
|
kebab: 'content',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'tabpanel',
|
|
optional: true,
|
|
states: ['complete', 'current', 'incomplete'],
|
|
data: [{ attr: 'data-state', values: ['complete', 'current', 'incomplete'] }],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'CompletedContent',
|
|
kebab: 'completed-content',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'PrevTrigger',
|
|
kebab: 'prev-trigger',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'button',
|
|
optional: true,
|
|
data: [{ attr: 'data-disabled', severity: 'optional' }],
|
|
aria: [{ attr: 'type', value: v.literal('button') }]
|
|
},
|
|
{
|
|
name: 'NextTrigger',
|
|
kebab: 'next-trigger',
|
|
kind: 'public',
|
|
defaultElement: 'button',
|
|
role: 'button',
|
|
optional: true,
|
|
data: [{ attr: 'data-disabled', severity: 'optional' }],
|
|
aria: [{ attr: 'type', value: v.literal('button') }]
|
|
}
|
|
]
|
|
} as const satisfies Morfo;
|