agroptima-design-system 0.31.5 → 0.31.6-beta.2
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
|
@@ -5,24 +5,30 @@
|
|
|
5
5
|
@use '../../settings/breakpoints';
|
|
6
6
|
|
|
7
7
|
// Interpolation applied: https://sass-lang.com/documentation/breaking-changes/css-vars/
|
|
8
|
+
.rdp-root {
|
|
9
|
+
width: 309px;
|
|
10
|
+
--rdp-accent-color: #{color_alias.$primary-color-600};
|
|
11
|
+
--rdp-accent-background-color: #{color_alias.$primary-color-50};
|
|
12
|
+
--rdp-range_middle-background-color: #{color_alias.$primary-color-50};
|
|
13
|
+
--rdp-range_start-date-background-color: #{color_alias.$primary-color-600};
|
|
14
|
+
--rdp-range_end-date-background-color: #{color_alias.$primary-color-600};
|
|
8
15
|
|
|
9
|
-
.date-picker {
|
|
10
|
-
.rdp-root {
|
|
11
|
-
width: 309px;
|
|
12
|
-
--rdp-accent-color: #{color_alias.$primary-color-600};
|
|
13
|
-
}
|
|
14
|
-
.rdp-caption_label {
|
|
15
|
-
text-transform: capitalize;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.single {
|
|
19
|
-
.rdp-selected .rdp-day_button {
|
|
20
|
-
background-color: #{color_alias.$primary-color-600} !important;
|
|
21
|
-
color: white !important;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.range {
|
|
26
|
-
--rdp-accent-background-color: #{color_alias.$primary-color-50};
|
|
27
|
-
}
|
|
28
16
|
}
|
|
17
|
+
|
|
18
|
+
.rdp-caption_label {
|
|
19
|
+
text-transform: capitalize;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
.rdp-selected .rdp-day_button {
|
|
24
|
+
background-color: #{color_alias.$primary-color-600};
|
|
25
|
+
color: #{color_alias.$neutral-white};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rdp-range_middle .rdp-day_button {
|
|
29
|
+
@include typography.body-regular-primary;
|
|
30
|
+
background-color: var(--rdp-range_middle-background-color);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
@@ -51,24 +51,20 @@ export function DatePicker(props: DatePickerProps): React.JSX.Element {
|
|
|
51
51
|
|
|
52
52
|
if (type === 'single') {
|
|
53
53
|
return (
|
|
54
|
-
<
|
|
55
|
-
<DateSinglePicker
|
|
56
|
-
lng={lng}
|
|
57
|
-
selected={selected}
|
|
58
|
-
onSelect={onSelect}
|
|
59
|
-
className="single"
|
|
60
|
-
/>
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
63
|
-
}
|
|
64
|
-
return (
|
|
65
|
-
<div className={cssClasses}>
|
|
66
|
-
<DateRangePicker
|
|
54
|
+
<DateSinglePicker
|
|
67
55
|
lng={lng}
|
|
68
56
|
selected={selected}
|
|
69
57
|
onSelect={onSelect}
|
|
70
|
-
className=
|
|
58
|
+
className={cssClasses}
|
|
71
59
|
/>
|
|
72
|
-
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
return (
|
|
63
|
+
<DateRangePicker
|
|
64
|
+
lng={lng}
|
|
65
|
+
selected={selected}
|
|
66
|
+
onSelect={onSelect}
|
|
67
|
+
className={cssClasses}
|
|
68
|
+
/>
|
|
73
69
|
)
|
|
74
70
|
}
|
|
@@ -25,16 +25,21 @@ export function DateRangePicker({
|
|
|
25
25
|
className,
|
|
26
26
|
}: DateRangePickerProps): React.JSX.Element {
|
|
27
27
|
const manageFooterText = (): string => {
|
|
28
|
-
|
|
28
|
+
console.log(selected, '-----')
|
|
29
|
+
if (!selected?.from && !selected?.to) return translations[lng].pickDate
|
|
29
30
|
|
|
30
|
-
if (
|
|
31
|
+
if (selected.from && !selected.to)
|
|
32
|
+
return translations[lng].selectedOnlyFrom.replace(
|
|
33
|
+
'${from}',
|
|
34
|
+
formatDatePickerFooterDate(selected.from, lng as string),
|
|
35
|
+
)
|
|
31
36
|
|
|
32
37
|
return translations[lng].selectedRangeOfDates
|
|
33
38
|
.replace(
|
|
34
39
|
'${from}',
|
|
35
|
-
formatDatePickerFooterDate(selected
|
|
40
|
+
formatDatePickerFooterDate(selected?.from, lng as string),
|
|
36
41
|
)
|
|
37
|
-
.replace('${to}', formatDatePickerFooterDate(selected
|
|
42
|
+
.replace('${to}', formatDatePickerFooterDate(selected?.to, lng as string))
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
const [selected, setSelected] = useState<DateRange | undefined>(preselected)
|
|
@@ -43,7 +48,9 @@ export function DateRangePicker({
|
|
|
43
48
|
})
|
|
44
49
|
|
|
45
50
|
useEffect(() => {
|
|
46
|
-
|
|
51
|
+
setTimeout(() => {
|
|
52
|
+
setSelected(preselected)
|
|
53
|
+
}, 0)
|
|
47
54
|
setFooter(manageFooterText())
|
|
48
55
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
49
56
|
}, [preselected])
|
|
@@ -8,11 +8,13 @@ export const translations: Translation = {
|
|
|
8
8
|
pickSingleDate: 'Pick a date',
|
|
9
9
|
selectedDate: 'Selected date: ${date}',
|
|
10
10
|
selectedRangeOfDates: 'Selected dates range: from ${from} to ${to}',
|
|
11
|
+
selectedOnlyFrom: 'Selected dates range: from ${from}',
|
|
11
12
|
},
|
|
12
13
|
es: {
|
|
13
14
|
pickDate: 'Selecciona un día o un rango de fechas',
|
|
14
15
|
pickSingleDate: 'Selecciona una fecha',
|
|
15
16
|
selectedDate: 'Fecha seleccionada: ${date}',
|
|
16
17
|
selectedRangeOfDates: 'Rango de fechas seleccionado: desde ${from} a ${to}',
|
|
18
|
+
selectedOnlyFrom: 'Rango de fechas seleccionado: desde ${from}',
|
|
17
19
|
},
|
|
18
20
|
}
|