1
- import { html } from ' lit' ;
2
- import { Meta , Canvas , ArgsTable , Story } from ' @storybook/addon-docs' ;
3
- import { ifDefined } from ' lit/directives/if-defined.js' ;
4
- import { unsafeHTML } from ' lit/directives/unsafe-html.js' ;
1
+ import { html } from " lit" ;
2
+ import { ArgsTable , Canvas , Meta , Story } from " @storybook/addon-docs" ;
3
+ import { ifDefined } from " lit/directives/if-defined.js" ;
4
+ import { unsafeHTML } from " lit/directives/unsafe-html.js" ;
5
5
6
6
<Meta
7
7
title = " Components/Calendar"
@@ -16,23 +16,26 @@ import { unsafeHTML } from 'lit/directives/unsafe-html.js';
16
16
}}
17
17
/>
18
18
19
- export const CalendarTemplate = (args ) => html ` <bl-calendar
19
+ export const CalendarTemplate = (args ) => html `
20
+ <bl-calendar
20
21
type=${ifDefined (args .type )}
21
22
min-date=${ifDefined (args .minDate )}
22
23
max-date=${ifDefined (args .maxDate )}
23
24
start-of-week=${ifDefined (args .startOfWeek )}
24
25
locale=${ifDefined (args .locale )}
25
- default-value=${ifDefined (args .defaultValue )}
26
- disabled-dates=${ifDefined (args .disabledDates )}>${unsafeHTML (args .content )}</bl-calendar> `
26
+ value=${ifDefined (args .value )}
27
+ disabled-dates=${ifDefined (args .disabledDates )}>${unsafeHTML (args .content )}
28
+ </bl-calendar> `
27
29
28
30
29
- export const Template = (args ) => html ` ${CalendarTemplate ({... args })} ` ;
31
+ export const Template = (args ) => html ` ${CalendarTemplate ({ ... args })} ` ;
30
32
31
33
32
34
# Calendar
33
35
34
36
<bl-badge icon = " document" >[ ADR] ( https://github.com/Trendyol/baklava/issues/795 ) </bl-badge >
35
- <bl-badge icon = " puzzle" >[ Figma] ( https://www.figma.com/file/RrcLH0mWpIUy4vwuTlDeKN/Baklava-Design-Guide?type=design&node-id=1412-8914&mode=design&t=b0kU7tBfJQFvz2at-0 ) </bl-badge >
37
+ <bl-badge
38
+ icon = " puzzle" >[ Figma] ( https://www.figma.com/file/RrcLH0mWpIUy4vwuTlDeKN/Baklava-Design-Guide?type=design&node-id=1412-8914&mode=design&t=b0kU7tBfJQFvz2at-0 ) </bl-badge >
36
39
37
40
Calendar component is an ** internal** component for using inside Datepicker component.
38
41
@@ -77,12 +80,28 @@ You can select date range from calendar.
77
80
</Story >
78
81
</Canvas >
79
82
83
+ ### Set Value
84
+
85
+ You can set default value to calendar.
86
+
87
+ <Canvas >
88
+ <Story name = " Default Value" args = { {
89
+ type: ' single' ,
90
+ value: new Date (new Date ().getFullYear (), new Date ().getMonth (), new Date ().getDate () + 2 )
91
+ }} >
92
+ { Template .bind ({})}
93
+ </Story >
94
+ </Canvas >
95
+
80
96
### Disabled Dates
81
97
82
98
You can set dates which you want to disable from calendar.
83
99
84
100
<Canvas >
85
- <Story name = " Disabled Dates" args = { { type: ' single' ,disabledDates:` ["${new Date (new Date ().getFullYear (),new Date ().getMonth (),new Date ().getDate ()+ 2 )}"] ` }} >
101
+ <Story name = " Disabled Dates" args = { {
102
+ type: ' single' ,
103
+ disabledDates: new Date (new Date ().getFullYear (), new Date ().getMonth (), new Date ().getDate () + 2 )
104
+ }} >
86
105
{ Template .bind ({})}
87
106
</Story >
88
107
</Canvas >
0 commit comments