0.1.15 • Published 2 years ago

@melodev/solid-datepicker v0.1.15

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Solid DatePicker

A reusable datepicker for solidJS projects

Sample usage

import { DatePicker } from '@melodev/solid-datepicker';

export default function App() {
    const [selectedDate, setSelectedDate] = createSignal<Date | null>(null);

    return (
        <div>
        	<DatePicker
                value={selectedDate()}
                onDateSelected={d => setSelectedDate(d)}
            />
        </div>
    );
}

Customize your datepicker

set locale, color, icon, input mask, min and max dates, toggle calendar features, use your own logic to disable dates and add custom classes.

 <DatePicker
    inputWidth={140}
    ref={datepickerRef}
    color={color}
    locale={'pt-BR'}
    icon={<FaCalendarAlt size={16} />}
    initialDate={new Date()}
    min={minDate}
    max={maxDate}
    placeholder={'29/04/1987'}
    hint={'brazilian'}
    hint={"dd/mm/aaaa"}
    delimiter={'/'}
    applyMask={true}
    filter={weekendFilter}
    value={selectedDate()}
    onDateSelected={d => setSelectedDate(d)} // both input and calendar
    onInput={console.log} // input input
    onChange={console.log} // input change
    closeAfterClick={false}
    label="DatePicker"
    disabled
    hideYearButtons={false}
    calendarOnly={false} // no input, calendar only
    dateClass={higlight20thDay}
/>

DEFAULT_PROPS

const DEFAULT_PROPS: DatepickerProps = {
	ref: null,
	value: null,
	color: '#009898',
	icon: DEFAULT_ICON,
	hint: '',
	initialDate: new Date(),
	min: null,
	max: null,
	delimiter: '/',
	inputWidth: 160,
	errorMessage: 'invalid date',
	filter: (d: Date) => true,
	onDateSelected: (d: Date | null) => d,
	onInput: (e: any) => e,
	onChange: (e: any) => e,
	dateClass: (d: Date) => '',
	label: 'date picker',
	placeholder: 'placeholder',
	theme: 'light',
	applyMask: true,
	disabled: false,
	inputDisabled: false,
	calendarDisabled: false,
	closeAfterClick: false,
	hideYearButtons: false,
	locale: 'en',
	type: 'datePicker',
	calendarOnly: false, // no input, calendar only;
};
0.1.13

2 years ago

0.1.14

2 years ago

0.1.15

2 years ago

0.1.12

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.9

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago