b5r-bonjour
TypeScript icon, indicating that this package has built-in type declarations

0.0.0-beta.33 • Public • Published

Bonjour.js – B5R

Accessible and dependency-free calendar JavaScript library: import the code you need and use your UI controls.

b5r-bonjour Example

Getting Started

  1. Install
  2. Tree Shaking
  3. Examples
  4. Contribution

Install

npm

npm i b5r-bonjour --save

Yarn

yarn add b5r-bonjour

Tree Shaking

Bonjour was designed to be able to do Treeshaking. This technique allows you to reduce the size of the final build by including only the code you use.

Example

import { B5rEvent } from 'b5r-bonjour';
import { B5rMonthView } from 'b5r-bonjour/lib/month-view';
import { B5rWeekView } from 'b5r-bonjour/lib/week-view';

Examples

Week View

HTML

<!-- Calendar -->
<div id="calendarWeekView"></div>


<!-- Your UI controls -->
<button id="btnToday">Today</button>
<button id="btnPrevious">Previous</button>
<button id="btnNext">Next</button>
<button id="btnAdd">Add event</button>

TypeScript

import { B5rWeekView } from 'b5r-bonjour/lib/week-view';

const CalendarWeekView = new B5rWeekView(
    document.getElementById('calendarWeekView'),
    {
        mode: '7-days',
    }
);

document
    .getElementById('btnToday')
    .addEventListener('click', () => {
        CalendarWeekView.today()
    });


document
    .getElementById('btnPrevious')
    .addEventListener('click', () => {
        CalendarWeekView.previous()
    });

document
    .getElementById('btnNext')
    .addEventListener('click', () => {
        CalendarWeekView.next()
    });

document.getElementById('btnAdd').addEventListener('click', () => {
    CalendarWeekView.setEvents([
        {
            id: '1',
            title: 'Event 1',
            subtitle: 'Subtitle',
            dateRange: {
                start: new Date(),
                end: new Date(new Date().setHours(new Date().getHours() + 2)),
            },
        },
    ]);
});

Contribution

Build Project

$ yarn install
$ yarn run build

Storybook

$ yarn install
$ yarn run storybook

Package Sidebar

Install

npm i b5r-bonjour

Weekly Downloads

1

Version

0.0.0-beta.33

License

ISC

Unpacked Size

858 kB

Total Files

203

Last publish

Collaborators

  • guignol
  • raphpare