## ----include = FALSE----------------------------------------------------------
knitr::opts_chunk$set(collapse = TRUE, comment = "#>")

## ----setup--------------------------------------------------------------------
library(VanillaCalendar)

## -----------------------------------------------------------------------------
VanillaCalendar()

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    firstWeekday = 1,
    selectedTheme = "light"
  ),
  height = "380px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(selectionDatesMode = "multiple-ranged", locale = "en"),
  height = "380px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    selectionDatesMode = "multiple",
    selectedDates = Sys.Date() + c(0, 2, 4)
  ),
  height = "380px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    dateMin = Sys.Date(),                     # nothing in the past
    dateMax = Sys.Date() + 30,                # nothing beyond a month out
    disableWeekdays = c(0, 6),                # no weekends; Sunday is 0
    disableDates = Sys.Date() + 3,            # and not that one either
    displayDisabledDates = TRUE
  ),
  height = "380px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    type = "multiple",
    displayMonthsCount = 2,
    displayDatesOutside = FALSE,
    selectionDatesMode = "multiple-ranged"
  ),
  width = "100%",
  height = "400px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    selectionTimeMode = 24,     # or 12, for an AM/PM picker
    selectedTime = "09:00",
    timeMinHour = 8,
    timeMaxHour = 18,
    timeStepMinute = 15
  ),
  height = "440px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = "en",
    enableWeekNumbers = TRUE,
    selectedWeekends = c(0, 6),
    selectedHolidays = as.Date(c("2026-12-25", "2026-12-26", "2027-01-01"))
  ),
  height = "400px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(options = list(locale = "ca-ES"), height = "380px")

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(
    locale = list(
      months = list(long = month.name, short = month.abb),
      weekdays = list(long = c("Sunday", "Monday", "Tuesday", "Wednesday",
                               "Thursday", "Friday", "Saturday"),
                      short = c("Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"))
    )
  ),
  height = "380px"
)

## -----------------------------------------------------------------------------
VanillaCalendar(
  options = list(locale = "en", selectedTheme = "dark"),
  height = "380px"
)

## ----warning = TRUE-----------------------------------------------------------
cal <- VanillaCalendar(options = list(selectionDateMode = "single"))

