mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
feat(date-picker): type flatpickrProps
This commit is contained in:
parent
bc0b048e30
commit
f2a445cb7e
3 changed files with 18 additions and 5 deletions
|
@ -56,7 +56,11 @@
|
|||
/** Set an id for the date picker element */
|
||||
export let id = "ccs-" + Math.random().toString(36);
|
||||
|
||||
/** Set to `true` to use in component Modal */
|
||||
/**
|
||||
* Override the options passed to the Flatpickr instance
|
||||
* https://flatpickr.js.org/options
|
||||
* @type {import("flatpickr/dist/types/options").Options}
|
||||
*/
|
||||
export let flatpickrProps = {};
|
||||
|
||||
import {
|
||||
|
@ -141,7 +145,7 @@
|
|||
maxDate,
|
||||
minDate,
|
||||
mode: $mode,
|
||||
...flatpickrProps
|
||||
...flatpickrProps,
|
||||
},
|
||||
base: inputRef,
|
||||
input: inputRefTo,
|
||||
|
|
|
@ -2,6 +2,14 @@
|
|||
import { DatePicker, DatePickerSkeleton, DatePickerInput } from "../types";
|
||||
</script>
|
||||
|
||||
<DatePicker
|
||||
datePickerType="single"
|
||||
flatpickrProps="{{ static: true }}"
|
||||
on:change
|
||||
>
|
||||
<DatePickerInput labelText="Meeting date" placeholder="mm/dd/yyyy" />
|
||||
</DatePicker>
|
||||
|
||||
<DatePicker
|
||||
on:change="{(e) => {
|
||||
console.log(e.detail);
|
||||
|
|
7
types/DatePicker/DatePicker.d.ts
vendored
7
types/DatePicker/DatePicker.d.ts
vendored
|
@ -72,10 +72,11 @@ export interface DatePickerProps
|
|||
id?: string;
|
||||
|
||||
/**
|
||||
* Set to true for correct using in Modal
|
||||
* @default false
|
||||
* Override the options passed to the Flatpickr instance
|
||||
* https://flatpickr.js.org/options
|
||||
* @default {}
|
||||
*/
|
||||
staticProp?: boolean;
|
||||
flatpickrProps?: import("flatpickr/dist/types/options").Options;
|
||||
}
|
||||
|
||||
export default class DatePicker extends SvelteComponentTyped<
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue