import { storiesOf, html } from '@open-wc/demoing-storybook';
import { css } from '@lion/core';
import '@lion/button/lion-button.js';
import '../lion-calendar.js';
const calendarDemoStyle = css`
.demo-calendar {
border: 1px solid #adadad;
box-shadow: 0 0 16px #ccc;
max-width: 500px;
}
`;
storiesOf('Calendar|Standalone', module)
.add(
'default',
() => html`
`,
)
.add('selectedDate', () => {
const today = new Date();
const selectedDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
return html`
`;
})
.add('centralDate', () => {
const today = new Date();
const centralDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
return html`
Use TAB to see which date will be focused first.
`;
})
.add('control focus', () => {
const today = new Date();
const selectedDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 1);
const centralDate = new Date(today.getFullYear(), today.getMonth() + 1, today.getDate());
return html`
Focus:
document.querySelector('#js-demo-calendar').focusCentralDate()}"
>
Central date
document.querySelector('#js-demo-calendar').focusSelectedDate()}"
>
Selected date
document.querySelector('#js-demo-calendar').focusDate(today)}">
Today
Be aware that the central date changes when a new date is focused.
`;
})
.add('minDate', () => {
const today = new Date();
const minDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 2);
return html`
`;
})
.add('maxDate', () => {
const today = new Date();
const maxDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 2);
return html`
`;
})
.add(
'disableDates',
() => html`
day.getDay() === 6 || day.getDay() === 0}
>
`,
)
.add('combined disabled dates', () => {
const today = new Date();
const maxDate = new Date(today.getFullYear(), today.getMonth() + 2, today.getDate());
return html`
day.getDay() === 6 || day.getDay() === 0}
.minDate="${new Date()}"
.maxDate="${maxDate}"
>
`;
});