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.
svelte-kit-vice/src/uix/morfo/components/month-grid.ts

169 lines
4.3 KiB

import type { Morfo } from '../types';
import { v } from '../types';
export const monthGridMorfo = {
name: 'MonthGrid',
kebab: 'month-grid',
scope: ['soma', 'sema'],
expression: "family-default",
apg: 'https://www.w3.org/WAI/ARIA/apg/patterns/grid/',
texts: {
label: '#?components.month-grid.label|Month grid',
prevYear: '#?common.month-grid.prev-year|Previous year',
nextYear: '#?common.month-grid.next-year|Next year'
},
events: [
{
name: 'commit-set',
semantic: {
family: 'commit',
verb: 'set',
target: v.partRef('cell'),
intent: 'affirm',
sequence: 'post'
}
},
{
// Paginar al año anterior/siguiente. Per book cap. 27 §5,
// `shift.navigate` cubre "Lista → detalle. Página A → página B" —
// el usuario está en otro tramo del eje temporal. La variante
// `step` mantiene la huella semántica de paso discreto.
name: 'shift-navigate-step',
semantic: {
family: 'shift',
verb: 'navigate',
target: v.partRef('provider'),
sequence: 'post'
}
}
],
parts: [
{
name: 'Provider',
kebab: 'provider',
archetype: 'provider',
kind: 'public',
defaultElement: 'div',
role: 'application',
optional: false,
data: [
{ attr: 'data-readonly', severity: 'optional' },
{ attr: 'data-disabled', severity: 'optional' }
],
aria: [
{ attr: 'aria-label', value: v.propRef('ariaLabel'), severity: 'recommended' },
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' }
],
keyboard: [
{ key: 'ArrowRight', action: 'next-month' },
{ key: 'ArrowLeft', action: 'prev-month' },
{ key: 'ArrowDown', action: 'next-row' },
{ key: 'ArrowUp', action: 'prev-row' },
{ key: 'PageUp', action: 'prev-year' },
{ key: 'PageDown', action: 'next-year' },
{ key: 'Home', action: 'first-month' },
{ key: 'End', action: 'last-month' },
{ key: 'Enter', action: 'select' },
{ key: ' ', action: 'select' }
]
},
{
name: 'Header',
kebab: 'header',
archetype: 'header',
kind: 'public',
defaultElement: 'div',
optional: true,
data: [],
aria: []
},
{
name: 'Heading',
kebab: 'heading',
archetype: 'header',
kind: 'public',
defaultElement: 'div',
optional: true,
data: [],
aria: []
},
{
name: 'PrevButton',
kebab: 'prev-button',
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.commonRef('month-grid.prev-year', 'Previous year'),
severity: 'recommended'
},
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' }
]
},
{
name: 'NextButton',
kebab: 'next-button',
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.commonRef('month-grid.next-year', 'Next year'),
severity: 'recommended'
},
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' }
]
},
{
name: 'Grid',
kebab: 'grid',
kind: 'public',
defaultElement: 'div',
role: 'grid',
optional: false,
data: [],
aria: [
{
attr: 'aria-labelledby',
value: v.partRef('heading'),
condition: { when: 'part-present', part: 'heading' },
severity: 'recommended'
},
{ attr: 'aria-readonly', value: v.propRef('readonly'), severity: 'optional' },
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' }
]
},
{
name: 'Cell',
kebab: 'cell',
archetype: 'item',
kind: 'public',
defaultElement: 'button',
role: 'gridcell',
optional: false,
data: [
{ attr: 'data-value' },
{ attr: 'data-selected', severity: 'optional' },
{ attr: 'data-current', severity: 'optional' },
{ attr: 'data-disabled', severity: 'optional' },
{ attr: 'data-focused', severity: 'optional' }
],
aria: [
{ attr: 'aria-selected', value: v.propRef('selected'), severity: 'optional' },
{ attr: 'aria-disabled', value: v.propRef('disabled'), severity: 'optional' }
]
}
]
} as const satisfies Morfo;

Powered by TurnKey Linux.