budibase/packages/builder/src/components/common/DatePicker.svelte

38 lines
754 B
Svelte
Raw Normal View History

2019-07-13 11:35:57 +02:00
<script>
import Flatpickr from "svelte-flatpickr"
2020-09-01 23:00:30 +02:00
import { Label, Input } from "@budibase/bbui"
2020-09-09 14:44:36 +02:00
import "flatpickr/dist/flatpickr.css"
export let label
export let value
2019-07-13 11:35:57 +02:00
const PICKER_OPTIONS = {
2020-09-09 14:45:47 +02:00
enableTime: true
}
2019-07-13 11:35:57 +02:00
</script>
<div class="bb-margin-m">
<Label small forAttr={'datepicker-label'}>{label}</Label>
<Flatpickr
placeholder={label}
2020-09-09 14:44:36 +02:00
options={PICKER_OPTIONS}
bind:value
/>
2020-09-09 14:44:36 +02:00
</div>
<style>
:global(.flatpickr-input) {
width: 100%;
min-width: 0;
box-sizing: border-box;
color: var(--ink);
border-radius: 5px;
border: none;
background-color: var(--grey-2);
padding: var(--spacing-m);
font-size: var(--font-size-xs);
margin: 0;
outline-color: var(--blue);
}
</style>