agroptima-design-system 0.31.4-beta.0 → 0.31.4
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 +1 -1
- package/src/atoms/DatePicker/DatePicker.scss +13 -0
- package/src/atoms/DatePicker/DatePicker.tsx +20 -4
- package/src/atoms/DatePicker/DateRangePicker.tsx +13 -12
- package/src/atoms/DatePicker/DateSinglePicker.tsx +14 -12
- package/src/atoms/Pagination/Pagination.scss +4 -4
- package/src/stories/Changelog.mdx +6 -0
- package/src/stories/Drawer.stories.js +3 -2
package/package.json
CHANGED
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
.rdp-root {
|
|
11
11
|
width: 309px;
|
|
12
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 {
|
|
13
26
|
--rdp-accent-background-color: #{color_alias.$primary-color-50};
|
|
14
27
|
}
|
|
15
28
|
}
|
|
@@ -39,20 +39,36 @@ type DatePickerProps = (DateSinglePickerProps | DateRangePickerProps) &
|
|
|
39
39
|
DatePickerBaseProps
|
|
40
40
|
|
|
41
41
|
export function DatePicker(props: DatePickerProps): React.JSX.Element {
|
|
42
|
-
const {
|
|
43
|
-
|
|
42
|
+
const {
|
|
43
|
+
variant = 'primary',
|
|
44
|
+
className,
|
|
45
|
+
type,
|
|
46
|
+
lng,
|
|
47
|
+
onSelect,
|
|
48
|
+
selected,
|
|
49
|
+
} = props
|
|
44
50
|
const cssClasses = classNames('date-picker', variant, className)
|
|
45
51
|
|
|
46
52
|
if (type === 'single') {
|
|
47
53
|
return (
|
|
48
54
|
<div className={cssClasses}>
|
|
49
|
-
<DateSinglePicker
|
|
55
|
+
<DateSinglePicker
|
|
56
|
+
lng={lng}
|
|
57
|
+
selected={selected}
|
|
58
|
+
onSelect={onSelect}
|
|
59
|
+
className="single"
|
|
60
|
+
/>
|
|
50
61
|
</div>
|
|
51
62
|
)
|
|
52
63
|
}
|
|
53
64
|
return (
|
|
54
65
|
<div className={cssClasses}>
|
|
55
|
-
<DateRangePicker
|
|
66
|
+
<DateRangePicker
|
|
67
|
+
lng={lng}
|
|
68
|
+
selected={selected}
|
|
69
|
+
onSelect={onSelect}
|
|
70
|
+
className="range"
|
|
71
|
+
/>
|
|
56
72
|
</div>
|
|
57
73
|
)
|
|
58
74
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'react-day-picker/style.css'
|
|
2
2
|
import { useEffect, useState } from 'react'
|
|
3
|
-
import { type DateRange, DayPicker
|
|
3
|
+
import { type DateRange, DayPicker } from 'react-day-picker'
|
|
4
4
|
import { enGB, es } from 'react-day-picker/locale'
|
|
5
5
|
import { formatDatePickerFooterDate } from '../../utils/dateHelpers'
|
|
6
6
|
import type { AvailableLocale } from './DatePicker'
|
|
@@ -15,12 +15,14 @@ export interface DateRangePickerProps {
|
|
|
15
15
|
onSelect: (dateRange: DateRange | undefined) => void
|
|
16
16
|
selected?: DateRange
|
|
17
17
|
lng: keyof typeof availableLocales
|
|
18
|
+
className: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function DateRangePicker({
|
|
21
22
|
onSelect = () => {},
|
|
22
23
|
selected: preselected,
|
|
23
24
|
lng,
|
|
25
|
+
className,
|
|
24
26
|
}: DateRangePickerProps): React.JSX.Element {
|
|
25
27
|
const manageFooterText = (): string => {
|
|
26
28
|
const hasDatesFilter = selected && selected.from && selected.to
|
|
@@ -52,16 +54,15 @@ export function DateRangePicker({
|
|
|
52
54
|
}
|
|
53
55
|
|
|
54
56
|
return (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
</>
|
|
57
|
+
<DayPicker
|
|
58
|
+
className={className}
|
|
59
|
+
locale={availableLocales[lng]}
|
|
60
|
+
mode="range"
|
|
61
|
+
min={1}
|
|
62
|
+
selected={selected}
|
|
63
|
+
onSelect={(dateRange) => selectDate(dateRange)}
|
|
64
|
+
footer={footer}
|
|
65
|
+
defaultMonth={selected?.from}
|
|
66
|
+
/>
|
|
66
67
|
)
|
|
67
68
|
}
|
|
@@ -15,12 +15,14 @@ export interface DateSinglePickerProps {
|
|
|
15
15
|
onSelect: (date: Date | undefined) => void
|
|
16
16
|
selected?: Date
|
|
17
17
|
lng: keyof typeof availableLocales
|
|
18
|
+
className: string
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
export function DateSinglePicker({
|
|
21
22
|
onSelect = () => {},
|
|
22
23
|
selected: preselected,
|
|
23
24
|
lng,
|
|
25
|
+
className,
|
|
24
26
|
}: DateSinglePickerProps): React.JSX.Element {
|
|
25
27
|
const manageFooterText = (): string => {
|
|
26
28
|
if (!selected) return translations[lng].pickSingleDate
|
|
@@ -51,17 +53,17 @@ export function DateSinglePicker({
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
return (
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
56
|
+
<DayPicker
|
|
57
|
+
className={className}
|
|
58
|
+
locale={availableLocales[lng]}
|
|
59
|
+
mode="single"
|
|
60
|
+
selected={selected}
|
|
61
|
+
onSelect={(date) => selectDate(date)}
|
|
62
|
+
footer={footer}
|
|
63
|
+
required
|
|
64
|
+
month={month}
|
|
65
|
+
onMonthChange={(date) => setMonth(date)}
|
|
66
|
+
defaultMonth={selected}
|
|
67
|
+
/>
|
|
66
68
|
)
|
|
67
69
|
}
|
|
@@ -40,13 +40,13 @@
|
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
&:
|
|
43
|
+
&:hover {
|
|
44
44
|
border: 1px solid color_alias.$primary-color-1000;
|
|
45
45
|
background: color_alias.$primary-color-50;
|
|
46
46
|
color: color_alias.$primary-color-1000;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
&.selected {
|
|
50
50
|
border: 1px solid color_alias.$primary-color-1000;
|
|
51
51
|
color: color_alias.$primary-color-1000;
|
|
52
52
|
}
|
|
@@ -80,8 +80,8 @@
|
|
|
80
80
|
border: 1px solid transparent;
|
|
81
81
|
background: none;
|
|
82
82
|
|
|
83
|
-
|
|
84
|
-
&:
|
|
83
|
+
&.selected,
|
|
84
|
+
&:hover {
|
|
85
85
|
border: 1px solid color_alias.$primary-color-1000;
|
|
86
86
|
color: color_alias.$primary-color-1000;
|
|
87
87
|
}
|
|
@@ -4,6 +4,12 @@ import { Meta } from "@storybook/blocks";
|
|
|
4
4
|
|
|
5
5
|
# Changelog
|
|
6
6
|
|
|
7
|
+
## 0.31.4
|
|
8
|
+
|
|
9
|
+
* Capitalized characters in month DatePicker for spanish version.
|
|
10
|
+
* Change the day selection style for DateSinglePicker.
|
|
11
|
+
* Colors in DateRangePicker in filters in Drawer component.
|
|
12
|
+
|
|
7
13
|
## 0.31.3
|
|
8
14
|
|
|
9
15
|
* Add `margin-top` to all cells containing Badges on mobile on CardsTable component.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react'
|
|
2
2
|
import { CheckableTag, CheckableTagGroup } from '../atoms/CheckableTag'
|
|
3
3
|
import { Collapsible } from '../atoms/Collapsible'
|
|
4
|
-
import {
|
|
4
|
+
import { DatePicker } from '../atoms/DatePicker/DatePicker'
|
|
5
5
|
import { Drawer } from '../atoms/Drawer'
|
|
6
6
|
|
|
7
7
|
const figmaPrimaryDesign = {
|
|
@@ -130,9 +130,10 @@ export const Filters = {
|
|
|
130
130
|
</Collapsible>
|
|
131
131
|
<Collapsible noHorizontalPadding open title="Date">
|
|
132
132
|
<div style={{ display: 'flex', justifyContent: 'center' }}>
|
|
133
|
-
<
|
|
133
|
+
<DatePicker
|
|
134
134
|
selected={{ from: new Date(2025, 0, 1), to: new Date(2025, 0, 15) }}
|
|
135
135
|
onSelect={(date) => console.log('date: ', date)}
|
|
136
|
+
type="range"
|
|
136
137
|
lng="en"
|
|
137
138
|
/>
|
|
138
139
|
</div>
|