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.
190 lines
3.9 KiB
190 lines
3.9 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
export const commandMorfo: Morfo = {
|
|
name: 'Command',
|
|
kebab: 'command',
|
|
scope: ['soma'],
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'root',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Input',
|
|
kebab: 'input',
|
|
kind: 'public',
|
|
defaultElement: 'input',
|
|
role: 'combobox',
|
|
optional: false,
|
|
data: [],
|
|
aria: [
|
|
{ attr: 'aria-autocomplete', value: v.literal('list') },
|
|
{ attr: 'aria-expanded', value: v.literal('true') },
|
|
{
|
|
attr: 'aria-controls',
|
|
value: v.partRef('list'),
|
|
condition: { when: 'part-present', part: 'list' },
|
|
severity: 'recommended'
|
|
},
|
|
{ attr: 'aria-activedescendant', value: v.propRef('selectedId'), severity: 'optional' }
|
|
],
|
|
keyboard: [
|
|
{ key: 'ArrowDown', action: 'next-item' },
|
|
{ key: 'ArrowUp', action: 'prev-item' },
|
|
{ key: 'Home', action: 'first-item' },
|
|
{ key: 'End', action: 'last-item' },
|
|
{ key: 'Enter', action: 'select' }
|
|
]
|
|
},
|
|
{
|
|
name: 'List',
|
|
kebab: 'list',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'listbox',
|
|
optional: false,
|
|
data: [],
|
|
aria: [
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.command.list|Suggestions'),
|
|
severity: 'recommended'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'Viewport',
|
|
kebab: 'viewport',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Item',
|
|
kebab: 'item',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'option',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-selected', severity: 'optional' },
|
|
{ attr: 'data-disabled', severity: 'optional' }
|
|
],
|
|
aria: [
|
|
{
|
|
attr: 'aria-selected',
|
|
value: v.propRef('selected'),
|
|
severity: 'optional'
|
|
},
|
|
{
|
|
attr: 'aria-disabled',
|
|
value: v.propRef('disabled'),
|
|
severity: 'optional'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'LinkItem',
|
|
kebab: 'link-item',
|
|
kind: 'public',
|
|
defaultElement: 'a',
|
|
role: 'option',
|
|
optional: true,
|
|
data: [
|
|
{ attr: 'data-selected', severity: 'optional' },
|
|
{ attr: 'data-disabled', severity: 'optional' }
|
|
],
|
|
aria: [
|
|
{
|
|
attr: 'aria-selected',
|
|
value: v.propRef('selected'),
|
|
severity: 'optional'
|
|
},
|
|
{
|
|
attr: 'aria-disabled',
|
|
value: v.propRef('disabled'),
|
|
severity: 'optional'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'Group',
|
|
kebab: 'group',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'group',
|
|
optional: true,
|
|
data: [{ attr: 'data-empty', severity: 'optional' }],
|
|
aria: [
|
|
{
|
|
attr: 'aria-labelledby',
|
|
value: v.partRef('group-heading'),
|
|
condition: { when: 'part-present', part: 'group-heading' },
|
|
severity: 'recommended'
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'GroupHeading',
|
|
kebab: 'group-heading',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: [{ attr: 'aria-hidden', value: v.literal('true') }]
|
|
},
|
|
{
|
|
name: 'GroupItems',
|
|
kebab: 'group-items',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'presentation',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'Empty',
|
|
kebab: 'empty',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'status',
|
|
optional: true,
|
|
data: [],
|
|
aria: [{ attr: 'aria-live', value: v.literal('polite') }]
|
|
},
|
|
{
|
|
name: 'Loading',
|
|
kebab: 'loading',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'progressbar',
|
|
optional: true,
|
|
data: [],
|
|
aria: [
|
|
{ attr: 'aria-valuemin', value: v.literal('0') },
|
|
{ attr: 'aria-valuemax', value: v.literal('100') },
|
|
{ attr: 'aria-valuenow', value: v.propRef('percent'), severity: 'optional' }
|
|
]
|
|
},
|
|
{
|
|
name: 'Separator',
|
|
kebab: 'separator',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
role: 'separator',
|
|
optional: true,
|
|
data: [],
|
|
aria: [{ attr: 'aria-orientation', value: v.literal('horizontal') }]
|
|
}
|
|
]
|
|
};
|