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.
156 lines
3.7 KiB
156 lines
3.7 KiB
import type { Morfo } from '../types';
|
|
import { v } from '../types';
|
|
|
|
export const treeViewMorfo: Morfo = {
|
|
name: 'TreeView',
|
|
kebab: 'tree-view',
|
|
scope: ['soma'],
|
|
apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/treeview/',
|
|
parts: [
|
|
{
|
|
name: 'Provider',
|
|
kebab: 'root',
|
|
kind: 'public',
|
|
defaultElement: 'ul',
|
|
role: 'tree',
|
|
optional: false,
|
|
data: [],
|
|
aria: [
|
|
{
|
|
attr: 'aria-label',
|
|
value: v.translationRef('#?components.tree-view.label|Tree'),
|
|
severity: 'recommended'
|
|
},
|
|
{
|
|
attr: 'aria-multiselectable',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'multiple' }
|
|
}
|
|
],
|
|
keyboard: [
|
|
{ key: 'ArrowDown', action: 'next-item' },
|
|
{ key: 'ArrowUp', action: 'prev-item' },
|
|
{ key: 'ArrowRight', action: 'expand' },
|
|
{ key: 'ArrowLeft', action: 'collapse' },
|
|
{ key: 'Home', action: 'first-item' },
|
|
{ key: 'End', action: 'last-item' },
|
|
{ key: 'Enter', action: 'activate' },
|
|
{ key: ' ', action: 'select' }
|
|
]
|
|
},
|
|
{
|
|
name: 'Branch',
|
|
kebab: 'branch',
|
|
kind: 'public',
|
|
defaultElement: 'li',
|
|
role: 'treeitem',
|
|
optional: false,
|
|
states: ['open', 'closed'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['open', 'closed'] },
|
|
{ attr: 'data-selected', severity: 'optional' },
|
|
{ attr: 'data-disabled', severity: 'optional' },
|
|
{ attr: 'data-depth' }
|
|
],
|
|
aria: [
|
|
{ attr: 'aria-expanded', value: v.stateRef('open') },
|
|
{
|
|
attr: 'aria-selected',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'selected' }
|
|
},
|
|
{ attr: 'aria-level', value: v.propRef('depth') },
|
|
{
|
|
attr: 'aria-disabled',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'disabled' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'BranchControl',
|
|
kebab: 'branch-control',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: false,
|
|
states: ['open', 'closed'],
|
|
data: [
|
|
{ attr: 'data-state', values: ['open', 'closed'] },
|
|
{ attr: 'data-selected', severity: 'optional' },
|
|
{ attr: 'data-disabled', severity: 'optional' }
|
|
],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'BranchContent',
|
|
kebab: 'branch-content',
|
|
kind: 'public',
|
|
defaultElement: 'ul',
|
|
role: 'group',
|
|
optional: false,
|
|
states: ['open', 'closed'],
|
|
data: [{ attr: 'data-state', values: ['open', 'closed'] }],
|
|
aria: []
|
|
},
|
|
{
|
|
name: 'BranchIndicator',
|
|
kebab: 'branch-indicator',
|
|
kind: 'public',
|
|
defaultElement: 'span',
|
|
optional: true,
|
|
states: ['open', 'closed'],
|
|
data: [{ attr: 'data-state', values: ['open', 'closed'] }],
|
|
aria: [{ attr: 'aria-hidden', value: v.literal('true') }]
|
|
},
|
|
{
|
|
name: 'BranchIndentGuide',
|
|
kebab: 'branch-indent-guide',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: [{ attr: 'aria-hidden', value: v.literal('true') }]
|
|
},
|
|
{
|
|
name: 'Item',
|
|
kebab: 'item',
|
|
kind: 'public',
|
|
defaultElement: 'li',
|
|
role: 'treeitem',
|
|
optional: false,
|
|
data: [
|
|
{ attr: 'data-selected', severity: 'optional' },
|
|
{ attr: 'data-disabled', severity: 'optional' },
|
|
{ attr: 'data-depth' }
|
|
],
|
|
aria: [
|
|
{
|
|
attr: 'aria-selected',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'selected' }
|
|
},
|
|
{ attr: 'aria-level', value: v.propRef('depth') },
|
|
{
|
|
attr: 'aria-disabled',
|
|
value: v.literal('true'),
|
|
severity: 'optional',
|
|
condition: { when: 'prop-truthy', prop: 'disabled' }
|
|
}
|
|
]
|
|
},
|
|
{
|
|
name: 'Label',
|
|
kebab: 'label',
|
|
kind: 'public',
|
|
defaultElement: 'div',
|
|
optional: true,
|
|
data: [],
|
|
aria: []
|
|
}
|
|
]
|
|
};
|