@@ -2,90 +2,75 @@ import React, { useEffect, useRef } from "react";
22import ReactDOM from "react-dom/client" ;
33import "./index.css" ;
44import {
5- IgrDateRangePicker ,
6- IgrIcon ,
7- IgrButton ,
8- registerIconFromText ,
5+ IgrDateRangePicker ,
6+ IgrIcon ,
7+ IgrButton ,
8+ registerIconFromText ,
99} from "igniteui-react" ;
1010import "igniteui-webcomponents/themes/light/bootstrap.css" ;
1111
1212export default function DrpSlots ( ) {
13- const dateRangeRef = useRef < IgrDateRangePicker > ( ) ;
13+ const dateRangeRef = useRef < IgrDateRangePicker > ( ) ;
1414
15- const Apps =
16- '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z"/></svg>' ;
15+ const Apps = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M240-160q-33 0-56.5-23.5T160-240q0-33 23.5-56.5T240-320q33 0 56.5 23.5T320-240q0 33-23.5 56.5T240-160Zm240 0q-33 0-56.5-23.5T400-240q0-33 23.5-56.5T480-320q33 0 56.5 23.5T560-240q0 33-23.5 56.5T480-160Zm240 0q-33 0-56.5-23.5T640-240q0-33 23.5-56.5T720-320q33 0 56.5 23.5T800-240q0 33-23.5 56.5T720-160ZM240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400ZM240-640q-33 0-56.5-23.5T160-720q0-33 23.5-56.5T240-800q33 0 56.5 23.5T320-720q0 33-23.5 56.5T240-640Zm240 0q-33 0-56.5-23.5T400-720q0-33 23.5-56.5T480-800q33 0 56.5 23.5T560-720q0 33-23.5 56.5T480-640Zm240 0q-33 0-56.5-23.5T640-720q0-33 23.5-56.5T720-800q33 0 56.5 23.5T800-720q0 33-23.5 56.5T720-640Z"/></svg>' ;
16+ const Bin = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>' ;
17+ const Down = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M480-360 280-560h400L480-360Z"/></svg>' ;
18+ const Upload = '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M440-200h80v-167l64 64 56-57-160-160-160 160 57 56 63-63v167ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>' ;
1719
18- const Bin =
19- '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M280-120q-33 0-56.5-23.5T200-200v-520h-40v-80h200v-40h240v40h200v80h-40v520q0 33-23.5 56.5T680-120H280Zm400-600H280v520h400v-520ZM360-280h80v-360h-80v360Zm160 0h80v-360h-80v360ZM280-720v520-520Z"/></svg>' ;
20+ registerIconFromText ( "appsIcon" , Apps ) ;
21+ registerIconFromText ( "binIcon" , Bin ) ;
22+ registerIconFromText ( "downArrowIcon" , Down ) ;
23+ registerIconFromText ( "uploadIcon" , Upload ) ;
2024
21- const Down =
22- '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M480-360 280-560h400L480-360Z"/></svg>' ;
25+ useEffect ( ( ) => {
26+ let prefixSuffix = document . getElementById ( "prefixSuffix" ) as IgrDateRangePicker ;
27+ let icons = document . getElementById ( "icons" ) as IgrDateRangePicker ;
28+ const today : Date = new Date ( ) ;
29+ let tomorrow : Date = new Date ( ) ;
30+ tomorrow . setDate ( today . getDate ( ) + 1 ) ;
31+ prefixSuffix . value = { start : today , end : tomorrow } ;
32+ icons . value = { start : today , end : tomorrow } ;
33+ } , [ ] ) ;
2334
24- const Upload =
25- '<svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e3e3e3"><path d="M440-200h80v-167l64 64 56-57-160-160-160 160 57 56 63-63v167ZM240-80q-33 0-56.5-23.5T160-160v-640q0-33 23.5-56.5T240-880h320l240 240v480q0 33-23.5 56.5T720-80H240Zm280-520v-200H240v640h480v-440H520ZM240-800v200-200 640-640Z"/></svg>' ;
35+ const toggleWeekNumbers = ( ) => {
36+ dateRangeRef . current . showWeekNumbers = ! dateRangeRef . current . showWeekNumbers ;
37+ } ;
2638
27- registerIconFromText ( "appsIcon" , Apps ) ;
28- registerIconFromText ( "binIcon" , Bin ) ;
29- registerIconFromText ( "downArrowIcon" , Down ) ;
30- registerIconFromText ( "uploadIcon" , Upload ) ;
31-
32- useEffect ( ( ) => {
33- let prefixSuffix = document . getElementById (
34- "prefixSuffix"
35- ) as IgrDateRangePicker ;
36- let icons = document . getElementById ( "icons" ) as IgrDateRangePicker ;
37- const today : Date = new Date ( ) ;
38- let tomorrow : Date = new Date ( ) ;
39- tomorrow . setDate ( today . getDate ( ) + 1 ) ;
40- prefixSuffix . value = { start : today , end : tomorrow } ;
41- icons . value = { start : today , end : tomorrow } ;
42- } , [ ] ) ;
43-
44- const toggleWeekNumbers = ( ) => {
45- dateRangeRef . current . showWeekNumbers =
46- ! dateRangeRef . current . showWeekNumbers ;
47- } ;
48-
49- return (
50- < div className = "container sample center" >
51- < h3 > Actions</ h3 >
52- < IgrDateRangePicker mode = "dialog" ref = { dateRangeRef } >
53- < IgrButton slot = "actions" onClick = { toggleWeekNumbers } >
54- Toggle Week Numbers
55- </ IgrButton >
56- </ IgrDateRangePicker >
57-
58- < h3 > Custom separator</ h3 >
59- < IgrDateRangePicker useTwoInputs >
60- < span slot = "separator" > till</ span >
61- </ IgrDateRangePicker >
62-
63- < h3 > Helper text</ h3 >
64- < IgrDateRangePicker >
65- < span slot = "helper-text" > Helper text goes here.</ span >
66- </ IgrDateRangePicker >
67-
68- < h3 > Prefix & Suffix </ h3 >
69- < IgrDateRangePicker id = "prefixSuffix" >
70- < IgrIcon slot = "prefix" name = "downArrowIcon" > </ IgrIcon >
71- < IgrIcon slot = "suffix" name = "uploadIcon" > </ IgrIcon >
72- </ IgrDateRangePicker >
73-
74- < h3 > Clear & Calendar icons </ h3 >
75- < IgrDateRangePicker id = "icons" >
76- < IgrIcon slot = "clear-icon" name = "binIcon" > </ IgrIcon >
77- < IgrIcon slot = "calendar-icon" name = "appsIcon" > </ IgrIcon >
78- </ IgrDateRangePicker >
79-
80- < h3 > Custom calendar header + title</ h3 >
81- < IgrDateRangePicker mode = "dialog" >
82- < span slot = "title" > Custom calendar title goes here.</ span >
83- < span slot = "header-date" >
84- Custom content instead of date goes here.
85- </ span >
86- </ IgrDateRangePicker >
87- </ div >
88- ) ;
39+ return (
40+ < div className = "container sample center" >
41+ < h3 > Actions</ h3 >
42+ < IgrDateRangePicker mode = "dialog" ref = { dateRangeRef } >
43+ < IgrButton slot = "actions" onClick = { toggleWeekNumbers } >
44+ Toggle Week Numbers
45+ </ IgrButton >
46+ </ IgrDateRangePicker >
47+ < h3 > Custom separator</ h3 >
48+ < IgrDateRangePicker useTwoInputs >
49+ < span slot = "separator" > till</ span >
50+ </ IgrDateRangePicker >
51+ < h3 > Helper text</ h3 >
52+ < IgrDateRangePicker >
53+ < span slot = "helper-text" > Helper text goes here.</ span >
54+ </ IgrDateRangePicker >
55+ < h3 > Prefix & Suffix </ h3 >
56+ < IgrDateRangePicker id = "prefixSuffix" >
57+ < IgrIcon slot = "prefix" name = "downArrowIcon" > </ IgrIcon >
58+ < IgrIcon slot = "suffix" name = "uploadIcon" > </ IgrIcon >
59+ </ IgrDateRangePicker >
60+ < h3 > Clear & Calendar icons </ h3 >
61+ < IgrDateRangePicker id = "icons" >
62+ < IgrIcon slot = "clear-icon" name = "binIcon" > </ IgrIcon >
63+ < IgrIcon slot = "calendar-icon" name = "appsIcon" > </ IgrIcon >
64+ </ IgrDateRangePicker >
65+ < h3 > Custom calendar header + title</ h3 >
66+ < IgrDateRangePicker mode = "dialog" >
67+ < span slot = "title" > Custom calendar title goes here.</ span >
68+ < span slot = "header-date" >
69+ Custom content instead of date goes here.
70+ </ span >
71+ </ IgrDateRangePicker >
72+ </ div >
73+ ) ;
8974}
9075
9176// rendering above class to the React DOM
0 commit comments