groovinads-ui 1.2.51 → 1.2.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "groovinads-ui",
|
|
3
3
|
"description": "Groovinads UI is a React component library designed exclusively for Groovinads applications. It provides ready-to-use UI elements styled according to Groovinads design guidelines to facilitate rapid development.",
|
|
4
|
-
"version": "1.2.
|
|
4
|
+
"version": "1.2.52",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"css",
|
|
7
7
|
"sass",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"build-lib": "rollup -c"
|
|
75
75
|
},
|
|
76
76
|
"dependencies": {
|
|
77
|
+
"date-fns": "^4.1.0",
|
|
77
78
|
"react-datepicker": "^7.3.0",
|
|
78
79
|
"react-responsive": "^10.0.0"
|
|
79
80
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import PropTypes from 'prop-types';
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react'
|
|
3
|
+
import { format } from 'date-fns';
|
|
3
4
|
|
|
4
5
|
// COMPONENTS
|
|
5
6
|
import { Dropdown } from 'react-bootstrap'
|
|
@@ -17,24 +18,18 @@ export default function DropdownSimpleDatePicker({
|
|
|
17
18
|
overflow = false,
|
|
18
19
|
date,
|
|
19
20
|
setDate,
|
|
20
|
-
|
|
21
|
+
handleClear,
|
|
21
22
|
}) {
|
|
22
|
-
|
|
23
|
+
|
|
23
24
|
const [internalShow, setInternalShow] = useState(!!show);
|
|
24
25
|
const dropdownRef = useRef(null);
|
|
25
|
-
|
|
26
|
-
const handleGlobalToggle = (event) => {
|
|
27
|
-
if (event.detail !== inputLabel) {
|
|
28
|
-
closeDropdown();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
26
|
|
|
32
27
|
const internalToggle = () => {
|
|
33
28
|
const newShowState = !internalShow;
|
|
34
29
|
setInternalShow(newShowState);
|
|
35
30
|
|
|
36
|
-
if (newShowState)
|
|
37
|
-
|
|
31
|
+
if (newShowState) window.dispatchEvent(new CustomEvent('dropdownToggle', { detail: inputLabel }));
|
|
32
|
+
|
|
38
33
|
try {
|
|
39
34
|
onToggle();
|
|
40
35
|
} catch (error) { }
|
|
@@ -54,8 +49,8 @@ export default function DropdownSimpleDatePicker({
|
|
|
54
49
|
}, 200);
|
|
55
50
|
};
|
|
56
51
|
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
|
|
53
|
+
const clearDate = () => {
|
|
59
54
|
closeDropdown();
|
|
60
55
|
|
|
61
56
|
if (handleClear) {
|
|
@@ -95,7 +90,7 @@ export default function DropdownSimpleDatePicker({
|
|
|
95
90
|
>
|
|
96
91
|
<span className='dropdown-label'>{inputLabel}</span>
|
|
97
92
|
<span>
|
|
98
|
-
{(date
|
|
93
|
+
{date ? format(new Date(date), 'EEE MMM dd yyyy') : ''}
|
|
99
94
|
</span>
|
|
100
95
|
|
|
101
96
|
<Icon iconName='angle-down' className={'caret'} />
|
|
@@ -142,14 +137,14 @@ export default function DropdownSimpleDatePicker({
|
|
|
142
137
|
}
|
|
143
138
|
|
|
144
139
|
DropdownSimpleDatePicker.propTypes = {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
140
|
+
className: PropTypes.string,
|
|
141
|
+
show: PropTypes.bool,
|
|
142
|
+
setShow: PropTypes.func,
|
|
143
|
+
onToggle: PropTypes.func,
|
|
144
|
+
inputLabel: PropTypes.string,
|
|
145
|
+
overflow: PropTypes.bool,
|
|
146
|
+
date: PropTypes.string,
|
|
147
|
+
setDate: PropTypes.func,
|
|
148
|
+
clearDate: PropTypes.func,
|
|
149
|
+
handleClear: PropTypes.func,
|
|
155
150
|
};
|