Skip to content

Commit 9fc5488

Browse files
Mikhail BashkiroverikkroesgerjanvangeesttlouissedaKmoR
committed
feat(calendar): add reusable calendar
Co-authored-by: Erik Kroes <erik.kroes@ing.com> Co-authored-by: Gerjan van Geest <gerjan.van.geest@ing.com> Co-authored-by: Thijs Louisse <thijs.louisse@ing.com> Co-authored-by: Thomas Allmer <thomas.allmer@ing.com>
1 parent 043106c commit 9fc5488

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3275
-0
lines changed

packages/calendar/README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# Calendar
2+
3+
[//]: # (AUTO INSERT HEADER PREPUBLISH)
4+
5+
`lion-calendar` is a reusable and accessible calendar view.
6+
7+
## Features
8+
9+
- fully accessible keyboard navigation (Arrow Keys, PgUp, PgDn, ALT+PgUp, ALT+PgDn)
10+
- **minDate**: disables all dates before a given date
11+
- **maxDate**: disables all dates after a given date
12+
- **disableDates**: disables some dates within an available range
13+
- **selectedDate**: currently selected date
14+
- **centralDate**: date that determines the currently visible month and that will be focused when keyboard moves the focus to the month grid
15+
- **focusedDate**: (getter only) currently focused date (if there is any with real focus)
16+
- **focusDate(date)**: focus on a certain date
17+
- **focusSelectedDate()**: focus on the current selected date
18+
- **focusCentralDate()**: focus on the current central date
19+
- **firstDayOfWeek**: typically Sunday (default) or Monday
20+
- **weekdayHeaderNotation**: long/short/narrow for the current locale (e.g. Thursday/Thu/T)
21+
- **locale**: different locale for the current component only
22+
23+
## How to use
24+
25+
### Installation
26+
27+
```sh
28+
npm i --save @lion/calendar
29+
```
30+
31+
```js
32+
import '@lion/calendar/lion-calendar.js';
33+
```
34+
35+
### Example
36+
37+
```html
38+
<lion-calendar
39+
.minDate="${new Date()}"
40+
.maxDate="${new Date('2019/12/09')}"
41+
.disableDates=${day => day.getDay() === 6 || day.getDay() === 0}
42+
>
43+
</lion-calendar>
44+
```

packages/calendar/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { LionCalendar } from './src/LionCalendar.js';

packages/calendar/lion-calendar.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { LionCalendar } from './src/LionCalendar.js';
2+
3+
customElements.define('lion-calendar', LionCalendar);

packages/calendar/package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "@lion/calendar",
3+
"version": "0.0.0",
4+
"description": "Reusable calendar component",
5+
"author": "ing-bank",
6+
"homepage": "https://github.com/ing-bank/lion/",
7+
"license": "MIT",
8+
"publishConfig": {
9+
"access": "public"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "https://github.com/ing-bank/lion.git",
14+
"directory": "packages/calendar"
15+
},
16+
"scripts": {
17+
"prepublishOnly": "../../scripts/npm-prepublish.js"
18+
},
19+
"keywords": [
20+
"lion",
21+
"web-components",
22+
"calendar"
23+
],
24+
"main": "index.js",
25+
"module": "index.js",
26+
"files": [
27+
"src",
28+
"stories",
29+
"test",
30+
"translations",
31+
"*.js"
32+
],
33+
"dependencies": {
34+
"@lion/core": "^0.1.4",
35+
"@lion/localize": "^0.1.7"
36+
},
37+
"devDependencies": {
38+
"@lion/button": "^0.1.7",
39+
"@open-wc/demoing-storybook": "^0.2.0",
40+
"@open-wc/testing": "^0.11.1",
41+
"sinon": "^7.2.2"
42+
}
43+
}

0 commit comments

Comments
 (0)