imbric-theme 0.1.1 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- package/.dockerignore +14 -0
- package/.eslintignore +1 -0
- package/.prettierignore +1 -0
- package/.storybook/main.js +6 -2
- package/.storybook/preview.js +21 -0
- package/.vscode/settings.json +3 -0
- package/Dockerfile +17 -0
- package/README.md +2 -2
- package/atoms/AlertModal/AlertModal.js +69 -0
- package/atoms/AlertModal/AlertModal.module.css +3 -0
- package/atoms/AlertModal/AlertModal.stories.js +30 -0
- package/atoms/AlertModal/constants.js +4 -0
- package/atoms/AlertModal/index.js +3 -0
- package/atoms/Button/Button.js +17 -2
- package/atoms/Button/Button.module.css +25 -3
- package/atoms/Button/Button.stories.js +1 -1
- package/atoms/Button/__snapshots__/Button.stories.js.snap +8 -8
- package/atoms/Check/Check.js +6 -4
- package/atoms/Checkbox/Checkbox.js +77 -0
- package/atoms/Checkbox/Checkbox.module.css +60 -0
- package/atoms/Checkbox/Checkbox.stories.js +30 -0
- package/atoms/Checkbox/constants.js +1 -0
- package/atoms/Checkbox/index.js +3 -0
- package/atoms/Divider/Divider.js +5 -2
- package/atoms/Divider/Divider.module.css +20 -0
- package/atoms/Divider/Divider.stories.js +13 -2
- package/atoms/Divider/constants.js +3 -0
- package/atoms/Divider/index.js +1 -0
- package/atoms/Heading/Heading.js +1 -1
- package/atoms/Heading/Heading.module.css +4 -0
- package/atoms/Heading/Heading.stories.js +2 -2
- package/atoms/Heading/__snapshots__/Heading.stories.js.snap +16 -16
- package/atoms/Heading/constants.js +1 -1
- package/atoms/Icon/Icon.js +1 -1
- package/atoms/Icon/Icon.module.css +30 -0
- package/atoms/Icon/constants.js +750 -145
- package/atoms/Input/Input.js +195 -15
- package/atoms/Input/Input.module.css +62 -6
- package/atoms/Input/Input.stories.js +8 -2
- package/atoms/Input/__snapshots__/Input.stories.js.snap +5 -5
- package/atoms/Input/constants.js +1 -1
- package/atoms/Label/Label.js +31 -0
- package/atoms/Label/Label.module.css +42 -0
- package/atoms/Label/Label.stories.js +26 -0
- package/atoms/Label/constants.js +1 -0
- package/atoms/Label/index.js +3 -0
- package/atoms/LinkItem/LinkItem.js +38 -0
- package/atoms/{Link/Link.module.css → LinkItem/LinkItem.module.css} +6 -1
- package/atoms/{Link/Link.stories.js → LinkItem/LinkItem.stories.js} +5 -5
- package/atoms/LinkItem/index.js +3 -0
- package/atoms/Modal/Modal.js +27 -4
- package/atoms/Modal/Modal.module.css +63 -6
- package/atoms/Paragraph/Paragraph.module.css +4 -0
- package/atoms/Paragraph/Paragraph.stories.js +2 -2
- package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +16 -16
- package/atoms/Picture/Picture.js +9 -2
- package/atoms/Tab/Tab.js +41 -0
- package/atoms/Tab/Tab.module.css +17 -0
- package/atoms/Tab/Tab.stories.js +27 -0
- package/atoms/Tab/constants.js +1 -0
- package/atoms/Tab/index.js +3 -0
- package/atoms/Textarea/Textarea.js +106 -15
- package/atoms/Textarea/Textarea.module.css +31 -2
- package/atoms/Toggle/Toggle.js +56 -0
- package/atoms/Toggle/Toggle.module.css +41 -0
- package/atoms/Toggle/Toggle.stories.js +21 -0
- package/atoms/Toggle/constants.js +1 -0
- package/atoms/Toggle/index.js +3 -0
- package/helpers/storybook.js +2 -2
- package/hook/useAddColumn.js +40 -0
- package/hook/useStateDate.js +25 -0
- package/hook/useTable.js +54 -0
- package/index.js +41 -1
- package/jest.config.js +1 -1
- package/layout/DynamicTable/DynamicTable.js +372 -0
- package/layout/DynamicTable/DynamicTable.module.css +62 -0
- package/layout/DynamicTable/DynamicTable.stories.js +79 -0
- package/layout/DynamicTable/constants.js +323 -0
- package/layout/DynamicTable/index.js +3 -0
- package/layout/FlexColumnContent/FlexColumnContent.js +26 -0
- package/layout/FlexColumnContent/FlexColumnContent.module.css +5 -0
- package/layout/FlexColumnContent/FlexColumnContent.stories.js +28 -0
- package/layout/FlexColumnContent/constants.js +1 -0
- package/layout/FlexColumnContent/index.js +3 -0
- package/layout/Navbar/Navbar.js +247 -0
- package/layout/Navbar/Navbar.module.css +35 -0
- package/layout/Navbar/Navbar.stories.js +20 -0
- package/layout/Navbar/constants.js +35 -0
- package/layout/Navbar/index.js +2 -0
- package/layout/Sidebar/Sidebar.js +115 -0
- package/layout/Sidebar/Sidebar.module.css +387 -0
- package/layout/Sidebar/Sidebar.stories.js +28 -0
- package/layout/Sidebar/constants.js +228 -0
- package/layout/Sidebar/index.js +3 -0
- package/molecules/Accordion/Accordion.js +11 -11
- package/molecules/CardDefault/CardDefault.js +65 -0
- package/molecules/CardDefault/CardDefault.module.css +19 -0
- package/molecules/CardDefault/CardDefault.stories.js +23 -0
- package/molecules/CardDefault/constants.js +1 -0
- package/molecules/CardDefault/index.js +3 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.js +89 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.module.css +118 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.stories.js +25 -0
- package/molecules/CardProductTypesBooking/constants.js +1 -0
- package/molecules/CardProductTypesBooking/index.js +3 -0
- package/molecules/CardServiceDetail/CardServiceDetail.js +400 -0
- package/molecules/CardServiceDetail/CardServiceDetail.module.css +222 -0
- package/molecules/CardServiceDetail/CardServiceDetail.stories.js +23 -0
- package/molecules/CardServiceDetail/constants.js +1 -0
- package/molecules/CardServiceDetail/index.js +3 -0
- package/molecules/CardServices/CardServices.js +461 -0
- package/molecules/CardServices/CardServices.module.css +213 -0
- package/molecules/CardServices/CardServices.stories.js +41 -0
- package/molecules/CardServices/constants.js +5 -0
- package/molecules/CardServices/index.js +3 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.js +381 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.module.css +213 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.stories.js +23 -0
- package/molecules/CardServicesFinalized/constants.js +1 -0
- package/molecules/CardServicesFinalized/index.js +3 -0
- package/molecules/CheckList/CheckList.js +135 -0
- package/molecules/CheckList/CheckList.module.css +94 -0
- package/molecules/CheckList/CheckList.stories.js +25 -0
- package/molecules/CheckList/constants.js +23 -0
- package/molecules/CheckList/index.js +3 -0
- package/molecules/ColumnTable/ColumnTable.js +155 -0
- package/molecules/ColumnTable/ColumnTable.module.css +51 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +26 -0
- package/molecules/ColumnTable/constants.js +117 -0
- package/molecules/ColumnTable/index.js +3 -0
- package/molecules/DatePicker/DatePicker.js +242 -0
- package/molecules/DatePicker/DatePicker.module.css +38 -0
- package/molecules/DatePicker/DatePicker.stories.js +23 -0
- package/molecules/DatePicker/constants.js +3 -0
- package/molecules/DatePicker/index.js +3 -0
- package/molecules/DatePickerTime/DatePickerTime.js +133 -0
- package/molecules/DatePickerTime/DatePickerTime.module.css +3 -0
- package/molecules/DatePickerTime/DatePickerTime.stories.js +18 -0
- package/molecules/DatePickerTime/constants.js +1 -0
- package/molecules/DatePickerTime/index.js +3 -0
- package/molecules/Dropdown/Dropdown.js +26 -23
- package/molecules/Dropdown/Dropdown.module.css +21 -3
- package/molecules/DynamicSelect/DynamicSelect.js +186 -0
- package/molecules/DynamicSelect/DynamicSelect.module.css +10 -0
- package/molecules/DynamicSelect/DynamicSelect.stories.js +32 -0
- package/molecules/DynamicSelect/constants.js +7 -0
- package/molecules/DynamicSelect/index.js +3 -0
- package/molecules/Error/Error.js +2 -2
- package/molecules/Error/Error.module.css +3 -2
- package/molecules/FooterTable/FooterTable.js +166 -0
- package/molecules/FooterTable/FooterTable.module.css +63 -0
- package/molecules/FooterTable/FooterTable.stories.js +23 -0
- package/molecules/FooterTable/constants.js +9 -0
- package/molecules/FooterTable/index.js +3 -0
- package/molecules/InputAutocomplete/InputAutocomplete.js +221 -0
- package/molecules/InputAutocomplete/InputAutocomplete.module.css +55 -0
- package/molecules/InputAutocomplete/InputAutocomplete.stories.js +23 -0
- package/molecules/InputAutocomplete/constants.js +1 -0
- package/molecules/InputAutocomplete/index.js +3 -0
- package/molecules/ItemMenu/ItemMenu.js +134 -0
- package/molecules/ItemMenu/ItemMenu.module.css +363 -0
- package/molecules/ItemMenu/ItemMenu.stories.js +42 -0
- package/molecules/ItemMenu/constants.js +36 -0
- package/molecules/ItemMenu/index.js +3 -0
- package/molecules/RowTable/RowTable.js +928 -0
- package/molecules/RowTable/RowTable.module.css +63 -0
- package/molecules/RowTable/RowTable.stories.js +26 -0
- package/molecules/RowTable/constants.js +798 -0
- package/molecules/RowTable/index.js +3 -0
- package/molecules/Tabs/Tabs.js +59 -0
- package/molecules/Tabs/Tabs.module.css +13 -0
- package/molecules/Tabs/Tabs.stories.js +34 -0
- package/molecules/Tabs/constants.js +34 -0
- package/molecules/Tabs/index.js +3 -0
- package/package.json +34 -17
- package/pages/Login/Login.js +102 -0
- package/pages/Login/Login.module.css +5 -0
- package/pages/Login/Login.stories.js +23 -0
- package/pages/Login/constants.js +1 -0
- package/pages/Login/index.js +3 -0
- package/pages/Login/validation/loginSchema.js +5 -0
- package/public/favicon.ico +0 -0
- package/public/static/google-maps.png +0 -0
- package/public/static/images/folders-folder.svg +26 -0
- package/public/static/images/permissions.svg +14 -0
- package/public/static/images/reports-results.svg +18 -0
- package/public/static/logo.svg +19 -0
- package/public/static/logologin.png +0 -0
- package/public/static/logologin.svg +16 -0
- package/public/static/logologintagos.svg +19 -0
- package/public/static/logotipo.svg +50 -0
- package/public/static/logotipoS.svg +26 -0
- package/public/static/taxisvalencia_logod.png +0 -0
- package/scripts/create-component.js +2 -1
- package/styles/GrupoMutua.css +391 -0
- package/styles/default.css +391 -0
- package/styles/globals.css +1514 -0
- package/styles/radiotaxiaragon.css +391 -0
- package/styles/spartan.css +391 -0
- package/styles/tagos.css +391 -0
- package/styles/taxisvalencia.css +391 -0
- package/styles/tokens.css +2 -1
- package/tokens/index.js +2 -1
- package/.eslintcache +0 -1
- package/atoms/Link/Link.js +0 -33
- package/atoms/Link/index.js +0 -3
- /package/atoms/{Link → LinkItem}/__snapshots__/Link.stories.js.snap +0 -0
- /package/atoms/{Link → LinkItem}/constants.js +0 -0
@@ -0,0 +1,242 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import { useState } from 'react';
|
4
|
+
import styles from './DatePicker.module.css'
|
5
|
+
import { options } from './constants'
|
6
|
+
import withStyles from '../../hocs/withStyles'
|
7
|
+
import { Calendar, DateRangePicker, DateRange, DefinedRange, defaultStaticRanges, defaultInputRanges } from 'react-date-range';
|
8
|
+
import Input from '../../atoms/Input';
|
9
|
+
import * as locales from 'react-date-range/dist/locale';
|
10
|
+
import moment from 'moment'
|
11
|
+
import Label from '../../atoms/Label';
|
12
|
+
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
13
|
+
import Icon from '../../atoms/Icon';
|
14
|
+
import useStateDate from '../../hook/useStateDate';
|
15
|
+
// import 'react-date-range/dist/styles.css'; // main css file
|
16
|
+
// import 'react-date-range/dist/theme/default.css'; // theme css file
|
17
|
+
|
18
|
+
import {
|
19
|
+
addDays,
|
20
|
+
endOfDay,
|
21
|
+
startOfDay,
|
22
|
+
startOfYear,
|
23
|
+
startOfMonth,
|
24
|
+
endOfMonth,
|
25
|
+
endOfYear,
|
26
|
+
addMonths,
|
27
|
+
addYears,
|
28
|
+
startOfWeek,
|
29
|
+
endOfWeek,
|
30
|
+
isSameDay,
|
31
|
+
differenceInCalendarDays
|
32
|
+
} from "date-fns";
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRange, tillDateRange }) => {
|
37
|
+
|
38
|
+
const [isShowCalendar, setShowCalendar] = useState(false);
|
39
|
+
|
40
|
+
|
41
|
+
const { state, setState } = useStateDate();
|
42
|
+
|
43
|
+
|
44
|
+
// const [state, setState] = useState([
|
45
|
+
// {
|
46
|
+
// startDate: addDays(new Date(), -59),
|
47
|
+
// endDate: new Date(),
|
48
|
+
// key: 'selection',
|
49
|
+
// }
|
50
|
+
|
51
|
+
// ]);
|
52
|
+
|
53
|
+
moment.locale('es')
|
54
|
+
const format = "DD/MMMM/YYYY";
|
55
|
+
|
56
|
+
|
57
|
+
const handleSelectRange = (item) => {
|
58
|
+
setState([item.selection])
|
59
|
+
}
|
60
|
+
|
61
|
+
const handleSelect = (date) => {
|
62
|
+
console.log(date); // native Date object
|
63
|
+
console.log(state)
|
64
|
+
}
|
65
|
+
|
66
|
+
const handleClickOpenCalendar = () => {
|
67
|
+
setShowCalendar(true)
|
68
|
+
// console.log(state)
|
69
|
+
}
|
70
|
+
|
71
|
+
const handleClickCloseCalendar = () => {
|
72
|
+
setShowCalendar(false)
|
73
|
+
console.log(state)
|
74
|
+
};
|
75
|
+
|
76
|
+
|
77
|
+
return (
|
78
|
+
<div className={getStyles('date-picker')}>
|
79
|
+
|
80
|
+
{isLayoutDate === 'Calendar' ?
|
81
|
+
|
82
|
+
(<Calendar
|
83
|
+
date={new Date()}
|
84
|
+
onChange={handleSelect}
|
85
|
+
color={'#3d91ff'}
|
86
|
+
/>)
|
87
|
+
: isLayoutDate === 'DateRange' ?
|
88
|
+
|
89
|
+
(<DateRange
|
90
|
+
editableDateInputs={true}
|
91
|
+
onChange={item => useStateDate([item.selection])}
|
92
|
+
moveRangeOnFirstSelection={false}
|
93
|
+
ranges={state}
|
94
|
+
/>)
|
95
|
+
:
|
96
|
+
|
97
|
+
!isShowCalendar ?
|
98
|
+
<div className={getStyles('date-picker-input')}>
|
99
|
+
<div>
|
100
|
+
<Label>{sinceDateRange}</Label>
|
101
|
+
<Input
|
102
|
+
isInline
|
103
|
+
id="startDate"
|
104
|
+
onClick={handleClickOpenCalendar}
|
105
|
+
placeholder="Et harum quidem"
|
106
|
+
value={moment(state[0].startDate).format(format).toString()}
|
107
|
+
/>
|
108
|
+
<Vertical size="xs" />
|
109
|
+
</div>
|
110
|
+
|
111
|
+
<div>
|
112
|
+
<Label>{tillDateRange}</Label>
|
113
|
+
<Input
|
114
|
+
isInline
|
115
|
+
id="endDate"
|
116
|
+
onClick={handleClickOpenCalendar}
|
117
|
+
placeholder="Et harum quidem"
|
118
|
+
value={moment(state[0].endDate).format(format).toString()}
|
119
|
+
/>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
:
|
123
|
+
<div className={getStyles('modalDatePickerRange')}>
|
124
|
+
|
125
|
+
<DateRangePicker
|
126
|
+
locale={locales.es}
|
127
|
+
dateDisplayFormat='d MMMM yyyy'
|
128
|
+
onChange={item => { handleSelectRange(item); onChangeRange(item); }}
|
129
|
+
showSelectionPreview={false}
|
130
|
+
moveRangeOnFirstSelection={false}
|
131
|
+
months={2}
|
132
|
+
ranges={state}
|
133
|
+
direction="horizontal"
|
134
|
+
inputRanges={[
|
135
|
+
{
|
136
|
+
...defaultInputRanges[0],
|
137
|
+
label: 'Dias hasta hoy'
|
138
|
+
},
|
139
|
+
{
|
140
|
+
...defaultInputRanges[1],
|
141
|
+
label: 'Dias desde hoy'
|
142
|
+
}
|
143
|
+
]}
|
144
|
+
staticRanges={[
|
145
|
+
// ...defaultStaticRanges,
|
146
|
+
{
|
147
|
+
label: "Mes pasado",
|
148
|
+
range: () => ({
|
149
|
+
startDate: startOfMonth(addMonths(new Date(), -1)),
|
150
|
+
endDate: endOfMonth(addMonths(new Date(), -1))
|
151
|
+
}),
|
152
|
+
isSelected(range) {
|
153
|
+
const definedRange = this.range();
|
154
|
+
return (
|
155
|
+
isSameDay(range.startDate, definedRange.startDate) &&
|
156
|
+
isSameDay(range.endDate, definedRange.endDate)
|
157
|
+
);
|
158
|
+
}
|
159
|
+
},
|
160
|
+
{
|
161
|
+
label: "Mes actual",
|
162
|
+
range: () => ({
|
163
|
+
startDate: startOfMonth(new Date()),
|
164
|
+
endDate: endOfDay(new Date())
|
165
|
+
}),
|
166
|
+
isSelected(range) {
|
167
|
+
const definedRange = this.range();
|
168
|
+
return (
|
169
|
+
isSameDay(range.startDate, definedRange.startDate) &&
|
170
|
+
isSameDay(range.endDate, definedRange.endDate)
|
171
|
+
);
|
172
|
+
}
|
173
|
+
},
|
174
|
+
{
|
175
|
+
label: "Año pasado",
|
176
|
+
range: () => ({
|
177
|
+
startDate: startOfYear(addYears(new Date(), -1)),
|
178
|
+
endDate: endOfYear(addYears(new Date(), -1))
|
179
|
+
}),
|
180
|
+
isSelected(range) {
|
181
|
+
const definedRange = this.range();
|
182
|
+
return (
|
183
|
+
isSameDay(range.startDate, definedRange.startDate) &&
|
184
|
+
isSameDay(range.endDate, definedRange.endDate)
|
185
|
+
);
|
186
|
+
}
|
187
|
+
},
|
188
|
+
{
|
189
|
+
label: "Año actual",
|
190
|
+
range: () => ({
|
191
|
+
startDate: startOfYear(new Date()),
|
192
|
+
endDate: endOfDay(new Date())
|
193
|
+
}),
|
194
|
+
isSelected(range) {
|
195
|
+
const definedRange = this.range();
|
196
|
+
return (
|
197
|
+
isSameDay(range.startDate, definedRange.startDate) &&
|
198
|
+
isSameDay(range.endDate, definedRange.endDate)
|
199
|
+
);
|
200
|
+
}
|
201
|
+
}
|
202
|
+
]}
|
203
|
+
/>
|
204
|
+
|
205
|
+
<div className={getStyles('btnSave')} onClick={handleClickCloseCalendar}>
|
206
|
+
<Icon
|
207
|
+
id='iconClosedDatePicker'
|
208
|
+
name="checkCircle"
|
209
|
+
color="inverted"
|
210
|
+
onClick={function noRefCheck() { }}
|
211
|
+
/>
|
212
|
+
</div>
|
213
|
+
|
214
|
+
{/* <DefinedRange
|
215
|
+
locale={locales.es}
|
216
|
+
onChange={item => useStateDate([item.selection])}
|
217
|
+
ranges={state}
|
218
|
+
/> */}
|
219
|
+
</div>
|
220
|
+
|
221
|
+
}
|
222
|
+
</div>
|
223
|
+
)
|
224
|
+
}
|
225
|
+
|
226
|
+
DatePicker.propTypes = {
|
227
|
+
getStyles: PropTypes.func.isRequired,
|
228
|
+
isLayoutDate: PropTypes.oneOf(options.typeLayoutDate),
|
229
|
+
onChangeRange: PropTypes.func,
|
230
|
+
sinceDateRange: PropTypes.string,
|
231
|
+
tillDateRange: PropTypes.string,
|
232
|
+
}
|
233
|
+
|
234
|
+
DatePicker.defaultProps = {
|
235
|
+
getStyles: () => { },
|
236
|
+
isLayoutDate: 'Calendar',
|
237
|
+
onChangeRange: () => { },
|
238
|
+
sinceDateRange: 'Desde',
|
239
|
+
tillDateRange: 'Hasta',
|
240
|
+
}
|
241
|
+
|
242
|
+
export default withStyles(styles)(DatePicker)
|
@@ -0,0 +1,38 @@
|
|
1
|
+
.date-picker {
|
2
|
+
display: block;
|
3
|
+
}
|
4
|
+
|
5
|
+
.date-picker-input {
|
6
|
+
display: flex;
|
7
|
+
/* width: 70%; */
|
8
|
+
}
|
9
|
+
|
10
|
+
.modalDatePickerRange {
|
11
|
+
display: flex;
|
12
|
+
position: absolute;
|
13
|
+
align-items: center;
|
14
|
+
justify-content: center;
|
15
|
+
width: 100%;
|
16
|
+
height: 100%;
|
17
|
+
top: 0;
|
18
|
+
left: 0;
|
19
|
+
background-color: rgb(0 0 0 / 60%);
|
20
|
+
z-index: 1;
|
21
|
+
}
|
22
|
+
|
23
|
+
.btnSave {
|
24
|
+
cursor: pointer;
|
25
|
+
width: 30px;
|
26
|
+
background-color: var(--color-tertiary-muted);
|
27
|
+
height: 420px;
|
28
|
+
align-items: center;
|
29
|
+
justify-content: center;
|
30
|
+
display: inline-flex;
|
31
|
+
height: inherit;
|
32
|
+
max-height: 383px;
|
33
|
+
height: 100%;
|
34
|
+
}
|
35
|
+
|
36
|
+
.btnSave:hover {
|
37
|
+
opacity: .8;
|
38
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import { DatePicker, styles, options } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(DatePicker, styles)
|
10
|
+
const ListTemplate = getListTemplate(DatePicker, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Molecules/DatePicker',
|
14
|
+
component: DatePicker,
|
15
|
+
args: {},
|
16
|
+
argTypes: {
|
17
|
+
isLayoutDate: getOptionsArgTypes(options.typeLayoutDate),
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
export const Default = Template.bind({})
|
22
|
+
// export const List = ListTemplate.bind({})
|
23
|
+
// List.args = { items: options.types.map((type) => ({ type })) }
|
@@ -0,0 +1,133 @@
|
|
1
|
+
import React, { useState } from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import styles from './DatePickerTime.module.css'
|
5
|
+
import { options } from './constants'
|
6
|
+
import withStyles from '../../hocs/withStyles'
|
7
|
+
import DatePicker, { CalendarContainer } from 'react-datepicker'
|
8
|
+
// import "react-datepicker/dist/react-datepicker.css"
|
9
|
+
|
10
|
+
import { registerLocale, setDefaultLocale } from "react-datepicker";
|
11
|
+
import es from 'date-fns/locale/es'
|
12
|
+
import moment from 'moment'
|
13
|
+
import Input from '../../atoms/Input/Input'
|
14
|
+
|
15
|
+
|
16
|
+
export const DatePickerTime = ({
|
17
|
+
getStyles,
|
18
|
+
showIcon,
|
19
|
+
selected,
|
20
|
+
onChange,
|
21
|
+
timeCaption,
|
22
|
+
minDate,
|
23
|
+
showTimeSelect,
|
24
|
+
filterTime,
|
25
|
+
dateFormat,
|
26
|
+
timeIntervals,
|
27
|
+
idPicker,
|
28
|
+
}) => {
|
29
|
+
|
30
|
+
registerLocale('es', es)
|
31
|
+
setDefaultLocale('es')
|
32
|
+
|
33
|
+
// const now = moment().add(15, 'minutes').format('d MMMM yyyy, HH:mm')
|
34
|
+
|
35
|
+
// const now = new Date()
|
36
|
+
|
37
|
+
// const nowSelected = new Date()
|
38
|
+
// nowSelected.setMinutes(nowSelected.getMinutes() + 15)
|
39
|
+
|
40
|
+
// const [startDate, setStartDate] = useState(nowSelected)
|
41
|
+
|
42
|
+
// const filterPassedTime = (time) => {
|
43
|
+
// const currentDate = new Date()
|
44
|
+
// currentDate.setMinutes(currentDate.getMinutes() + 15)
|
45
|
+
// const selectedDate = new Date(time)
|
46
|
+
// return currentDate.getTime() < selectedDate.getTime()
|
47
|
+
// }
|
48
|
+
|
49
|
+
|
50
|
+
// const MyContainer = ({ className, children }) => {
|
51
|
+
// return (
|
52
|
+
// // <div style={{ padding: "0px", background: "#216ba5", color: "#fff" }}>
|
53
|
+
// <CalendarContainer className={className}>
|
54
|
+
// {/* <div style={{ background: "#f0f0f0" }}>
|
55
|
+
// ¿Fecha de taxi?
|
56
|
+
// </div> */}
|
57
|
+
// <div style={{
|
58
|
+
// fontFamily: 'Exo, Arial, sans-serif',
|
59
|
+
// fontSize: '13px',
|
60
|
+
// fontWeight: '300'
|
61
|
+
// }}>{children}</div>
|
62
|
+
// </CalendarContainer >
|
63
|
+
// // </div>
|
64
|
+
// )
|
65
|
+
// }
|
66
|
+
|
67
|
+
return (
|
68
|
+
|
69
|
+
<div className={getStyles('date-picker-time')}>
|
70
|
+
<DatePicker
|
71
|
+
showIcon={showIcon}
|
72
|
+
selected={selected}
|
73
|
+
onChange={onChange}
|
74
|
+
timeCaption={timeCaption}
|
75
|
+
// locale="es"
|
76
|
+
// showTimeSelect
|
77
|
+
// timeFormat="p"
|
78
|
+
// timeIntervals={15}
|
79
|
+
// dateFormat="Pp"<
|
80
|
+
minDate={minDate}
|
81
|
+
showTimeSelect={showTimeSelect}
|
82
|
+
filterTime={filterTime}
|
83
|
+
dateFormat={dateFormat}
|
84
|
+
timeIntervals={timeIntervals}
|
85
|
+
id={idPicker}
|
86
|
+
customInput={<Input isInputSecondary> </Input>}
|
87
|
+
// calendarContainer={MyContainer}
|
88
|
+
|
89
|
+
// minTime={(new Date(), 0)}
|
90
|
+
// maxTime={(new Date(), 30)}
|
91
|
+
// maxTime={setHours(setMinutes(new Date(), 30), 20)}
|
92
|
+
// includeTimes={[
|
93
|
+
// setHours(setMinutes(new Date(), 0), 17),
|
94
|
+
// setHours(setMinutes(new Date(), 30), 18),
|
95
|
+
// setHours(setMinutes(new Date(), 30), 19),
|
96
|
+
// setHours(setMinutes(new Date(), 30), 17),
|
97
|
+
// ]}
|
98
|
+
// dateFormat="d MMMM yyyy, HH:mm aa"
|
99
|
+
/>
|
100
|
+
</div>
|
101
|
+
)
|
102
|
+
|
103
|
+
}
|
104
|
+
|
105
|
+
DatePickerTime.propTypes = {
|
106
|
+
getStyles: PropTypes.func.isRequired,
|
107
|
+
showIcon: PropTypes.bool,
|
108
|
+
selected: PropTypes.any,
|
109
|
+
onChange: PropTypes.func,
|
110
|
+
timeCaption: PropTypes.string,
|
111
|
+
minDate: PropTypes.any,
|
112
|
+
showTimeSelect: PropTypes.bool,
|
113
|
+
filterTime: PropTypes.any,
|
114
|
+
dateFormat: PropTypes.string,
|
115
|
+
timeIntervals: PropTypes.any,
|
116
|
+
idPicker: PropTypes.string,
|
117
|
+
}
|
118
|
+
|
119
|
+
DatePickerTime.defaultProps = {
|
120
|
+
getStyles: () => { },
|
121
|
+
showIcon: true,
|
122
|
+
// selected: { startDate },
|
123
|
+
onChange: () => { },
|
124
|
+
timeCaption: "Hora",
|
125
|
+
// minDate: { now },
|
126
|
+
showTimeSelect: true,
|
127
|
+
// filterTime: { filterPassedTime },
|
128
|
+
dateFormat: "dd-MM-yyyy HH:mm aa",
|
129
|
+
timeIntervals: 1,
|
130
|
+
idPicker: 'hola'
|
131
|
+
}
|
132
|
+
|
133
|
+
export default withStyles(styles)(DatePickerTime)
|
@@ -0,0 +1,18 @@
|
|
1
|
+
import { DatePickerTime, styles, options } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(DatePickerTime, styles)
|
10
|
+
const ListTemplate = getListTemplate(DatePickerTime, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Molecules/DatePickerTime',
|
14
|
+
component: DatePickerTime,
|
15
|
+
args: {},
|
16
|
+
}
|
17
|
+
|
18
|
+
export const Default = Template.bind({})
|
@@ -0,0 +1 @@
|
|
1
|
+
export const options = { types: [] }
|
@@ -13,27 +13,30 @@ export const Dropdown = ({
|
|
13
13
|
value,
|
14
14
|
isInline,
|
15
15
|
onChange,
|
16
|
-
}) =>
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
>
|
23
|
-
<Icon className="dropdown-icon" name="angleDown" background="highlight" />
|
24
|
-
<select
|
25
|
-
className={getStyles('dropdown-select')}
|
26
|
-
onChange={(event) => onChange(event?.currentTarget?.value)}
|
27
|
-
value={value}
|
16
|
+
}) => {
|
17
|
+
return (
|
18
|
+
<div
|
19
|
+
className={getStyles('dropdown', {
|
20
|
+
'is-inline': isInline,
|
21
|
+
})}
|
28
22
|
>
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
)
|
23
|
+
<Icon className="dropdown-icon" name="angleDown" background="transparent" />
|
24
|
+
<select
|
25
|
+
id={id}
|
26
|
+
className={getStyles('dropdown-select')}
|
27
|
+
onChange={(event) => onChange(event?.currentTarget?.value)}
|
28
|
+
value={value}
|
29
|
+
>
|
30
|
+
{options.map(({ text, value }) => (
|
31
|
+
<option key={value} value={value}>
|
32
|
+
{text}
|
33
|
+
</option>
|
34
|
+
))}
|
35
|
+
</select>
|
36
|
+
|
37
|
+
</div>
|
38
|
+
)
|
39
|
+
}
|
37
40
|
|
38
41
|
Dropdown.propTypes = {
|
39
42
|
onChange: PropTypes.func.isRequired,
|
@@ -44,7 +47,7 @@ Dropdown.propTypes = {
|
|
44
47
|
value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
45
48
|
})
|
46
49
|
).isRequired,
|
47
|
-
value: PropTypes.oneOfType([PropTypes.string, PropTypes.
|
50
|
+
value: PropTypes.oneOfType([PropTypes.string, PropTypes.any]),
|
48
51
|
id: PropTypes.string,
|
49
52
|
isInline: PropTypes.bool,
|
50
53
|
}
|
@@ -52,8 +55,8 @@ Dropdown.propTypes = {
|
|
52
55
|
Dropdown.defaultProps = {
|
53
56
|
value: '',
|
54
57
|
isInline: false,
|
55
|
-
onChange: () => {},
|
56
|
-
getStyles: () => {},
|
58
|
+
onChange: () => { },
|
59
|
+
getStyles: () => { },
|
57
60
|
}
|
58
61
|
|
59
62
|
export default withStyles(styles)(Dropdown)
|
@@ -16,14 +16,32 @@
|
|
16
16
|
.dropdown-select {
|
17
17
|
width: 100%;
|
18
18
|
height: var(--input-height);
|
19
|
-
padding:
|
20
|
-
border: var(--border-width-thin) solid var(--color-
|
19
|
+
padding: 8px 30px 8px 20px;
|
20
|
+
border: var(--border-width-thin) solid var(--color-brand-white-lilac);
|
21
21
|
background: var(--input-background);
|
22
|
-
border-radius: var(--input-border-radius);
|
22
|
+
/* border-radius: var(--input-border-radius); */
|
23
23
|
color: var(--color-font-base);
|
24
|
+
font-family: var(--font-family-sans);
|
25
|
+
font-size: var(--input-font-base);
|
26
|
+
font-weight: var(--font-weight-medium);
|
27
|
+
line-height: var(--line-height-relaxed);
|
24
28
|
transition: box-shadow 0.2s ease;
|
29
|
+
-moz-appearance: none; /* Firefox */
|
30
|
+
-webkit-appearance: none; /* Safari and Chrome */
|
31
|
+
appearance: none;
|
25
32
|
}
|
26
33
|
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
/* padding: 12px 17px; */
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
|
44
|
+
|
27
45
|
.dropdown-select:focus {
|
28
46
|
box-shadow: 0 0 0 1px var(--color-primary), 0 0 10px 0 var(--color-primary);
|
29
47
|
outline: none;
|