imbric-theme 0.6.3 → 0.6.5
Sign up to get free protection for your applications and to get access to all the features.
- package/atoms/Input/Input.js +70 -21
- package/atoms/Input/Input.module.css +1 -0
- package/atoms/Picture/Picture.js +9 -2
- package/index.js +2 -0
- package/layout/Sidebar/Sidebar.js +5 -3
- package/molecules/ColumnTable/ColumnTable.module.css +1 -1
- package/molecules/DatePicker/DatePicker.js +3 -2
- 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/DynamicSelect/DynamicSelect.js +5 -2
- package/molecules/RowTable/RowTable.js +26 -1
- package/molecules/RowTable/RowTable.module.css +11 -1
- package/package.json +2 -1
- package/styles/globals.css +1131 -212
package/atoms/Input/Input.js
CHANGED
@@ -36,6 +36,8 @@ export const Input = ({
|
|
36
36
|
colorIcon,
|
37
37
|
backgroundIcon,
|
38
38
|
pattern,
|
39
|
+
onClickViewPass,
|
40
|
+
viewPass,
|
39
41
|
min,
|
40
42
|
}) => (
|
41
43
|
|
@@ -78,26 +80,69 @@ export const Input = ({
|
|
78
80
|
|
79
81
|
</div> :
|
80
82
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
83
|
+
type === 'password' ?
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
<div className={getStyles('box-icon-input')}>
|
88
|
+
|
89
|
+
<input
|
90
|
+
className={getStyles('input', {
|
91
|
+
'is-inline': isInline,
|
92
|
+
'is-inline-code': isInlineCode,
|
93
|
+
'is-input-filter': isInputFilter,
|
94
|
+
'is-input-secondary': isInputSecondary,
|
95
|
+
})}
|
96
|
+
type={type}
|
97
|
+
id={id}
|
98
|
+
value={value}
|
99
|
+
placeholder={placeholder}
|
100
|
+
onChange={onChange}
|
101
|
+
onFocus={onFocus}
|
102
|
+
onBlur={onBlur}
|
103
|
+
onClick={onClick}
|
104
|
+
onKeyDown={onKeyDown}
|
105
|
+
autoComplete={autoComplete}
|
106
|
+
disabled={disabled}
|
107
|
+
min={min}
|
108
|
+
></input>
|
109
|
+
|
110
|
+
<Horizontal size="xs" />
|
111
|
+
|
112
|
+
<Icon
|
113
|
+
background={!viewPass ? "inverted" : "success"}
|
114
|
+
color={!viewPass ? "base" : "inverted"}
|
115
|
+
isClickable
|
116
|
+
name="userView"
|
117
|
+
onClick={onClickViewPass}
|
118
|
+
size="sm"
|
119
|
+
/>
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
: <input
|
127
|
+
className={getStyles('input', {
|
128
|
+
'is-inline': isInline,
|
129
|
+
'is-inline-code': isInlineCode,
|
130
|
+
'is-input-filter': isInputFilter,
|
131
|
+
'is-input-secondary': isInputSecondary,
|
132
|
+
})}
|
133
|
+
type={type}
|
134
|
+
id={id}
|
135
|
+
value={value}
|
136
|
+
placeholder={placeholder}
|
137
|
+
onChange={onChange}
|
138
|
+
onFocus={onFocus}
|
139
|
+
onBlur={onBlur}
|
140
|
+
onClick={onClick}
|
141
|
+
onKeyDown={onKeyDown}
|
142
|
+
autoComplete={autoComplete}
|
143
|
+
disabled={disabled}
|
144
|
+
min={min}
|
145
|
+
></input>
|
101
146
|
|
102
147
|
}
|
103
148
|
|
@@ -128,6 +173,8 @@ Input.propTypes = {
|
|
128
173
|
autoComplete: PropTypes.string,
|
129
174
|
disabled: PropTypes.bool,
|
130
175
|
min: PropTypes.any,
|
176
|
+
onClickViewPass: PropTypes.func,
|
177
|
+
viewPass: PropTypes.bool,
|
131
178
|
}
|
132
179
|
|
133
180
|
Input.defaultProps = {
|
@@ -152,7 +199,9 @@ Input.defaultProps = {
|
|
152
199
|
colorIcon: 'highlight',
|
153
200
|
backgroundIcon: 'base',
|
154
201
|
autoComplete: 'on',
|
155
|
-
disabled: false
|
202
|
+
disabled: false,
|
203
|
+
onClickViewPass: () => { },
|
204
|
+
viewPass: false,
|
156
205
|
}
|
157
206
|
|
158
207
|
export default withStyles(styles)(Input)
|
package/atoms/Picture/Picture.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
import React from 'react'
|
2
2
|
import PropTypes from 'prop-types'
|
3
|
+
import Link from 'next/link'
|
3
4
|
|
4
5
|
import styles from './Picture.module.css'
|
5
6
|
import withStyles from '../../hocs/withStyles'
|
@@ -11,6 +12,7 @@ export const Picture = ({
|
|
11
12
|
height,
|
12
13
|
isRounded,
|
13
14
|
withBorder,
|
15
|
+
isHref,
|
14
16
|
}) => (
|
15
17
|
<picture
|
16
18
|
className={getStyles('picture', {
|
@@ -18,7 +20,10 @@ export const Picture = ({
|
|
18
20
|
'with-border': withBorder,
|
19
21
|
})}
|
20
22
|
>
|
21
|
-
<
|
23
|
+
<Link href={isHref} passHref>
|
24
|
+
<img src={src} style={{ height, maxWidth: width }} />
|
25
|
+
</Link>
|
26
|
+
|
22
27
|
</picture>
|
23
28
|
)
|
24
29
|
|
@@ -29,12 +34,14 @@ Picture.propTypes = {
|
|
29
34
|
height: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
30
35
|
isRounded: PropTypes.bool,
|
31
36
|
withBorder: PropTypes.bool,
|
37
|
+
isHref: PropTypes.any
|
32
38
|
}
|
33
39
|
|
34
40
|
Picture.defaultProps = {
|
35
41
|
height: 'auto',
|
36
42
|
withBorder: false,
|
37
|
-
getStyles: () => {},
|
43
|
+
getStyles: () => { },
|
44
|
+
isHref: ''
|
38
45
|
}
|
39
46
|
|
40
47
|
export default withStyles(styles)(Picture)
|
package/index.js
CHANGED
@@ -59,6 +59,8 @@ export { default as DynamicSelect } from './molecules/DynamicSelect'
|
|
59
59
|
export { default as DatePicker } from './molecules/DynamicSelect'
|
60
60
|
export { default as CardDefault } from './molecules/CardDefault'
|
61
61
|
export { default as Tabs } from './molecules/Tabs'
|
62
|
+
export { default as DatePickerTime } from './molecules/DatePickerTime'
|
63
|
+
|
62
64
|
|
63
65
|
|
64
66
|
|
@@ -11,7 +11,7 @@ import Icon from '../../atoms/Icon'
|
|
11
11
|
import Divider from '../../atoms/Divider'
|
12
12
|
import ItemMenu from '../../molecules/ItemMenu/ItemMenu'
|
13
13
|
|
14
|
-
export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
|
14
|
+
export const Sidebar = ({ getStyles, menuCollapseView, options, isHrefLogo }) => {
|
15
15
|
|
16
16
|
|
17
17
|
return (
|
@@ -30,7 +30,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
|
|
30
30
|
|
31
31
|
<div className={getStyles('logotext')}>
|
32
32
|
{/* small and big change using menuCollapseView state */}
|
33
|
-
{menuCollapseView ? <Picture src="
|
33
|
+
{menuCollapseView ? <Picture isHref={isHrefLogo} src="./static/logotipoS.svg" width={19}></Picture> : <Picture isHref={isHrefLogo} src="./static/logotipo.svg" width={100}></Picture>}
|
34
34
|
</div>
|
35
35
|
{/* <div className={getStyles('closemenu')}>
|
36
36
|
|
@@ -69,7 +69,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
|
|
69
69
|
>
|
70
70
|
{item.text}
|
71
71
|
</ItemMenu>
|
72
|
-
|
72
|
+
|
73
73
|
: null
|
74
74
|
|
75
75
|
))}
|
@@ -93,6 +93,7 @@ export const Sidebar = ({ getStyles, menuCollapseView, options }) => {
|
|
93
93
|
|
94
94
|
Sidebar.propTypes = {
|
95
95
|
getStyles: PropTypes.func.isRequired,
|
96
|
+
isHrefLogo: PropTypes.any
|
96
97
|
// options: PropTypes.arrayOf(
|
97
98
|
// PropTypes.shape({
|
98
99
|
// text: PropTypes.string,
|
@@ -104,6 +105,7 @@ Sidebar.propTypes = {
|
|
104
105
|
Sidebar.defaultProps = {
|
105
106
|
getStyles: () => { },
|
106
107
|
menuCollapseView: false,
|
108
|
+
isHrefLogo: ''
|
107
109
|
}
|
108
110
|
|
109
111
|
export default withStyles(styles)(Sidebar)
|
@@ -82,6 +82,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRa
|
|
82
82
|
(<Calendar
|
83
83
|
date={new Date()}
|
84
84
|
onChange={handleSelect}
|
85
|
+
color={'#3d91ff'}
|
85
86
|
/>)
|
86
87
|
: isLayoutDate === 'DateRange' ?
|
87
88
|
|
@@ -124,7 +125,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRa
|
|
124
125
|
<DateRangePicker
|
125
126
|
locale={locales.es}
|
126
127
|
dateDisplayFormat='d MMMM yyyy'
|
127
|
-
onChange={
|
128
|
+
onChange={item => { handleSelectRange(item); onChangeRange(item); }}
|
128
129
|
showSelectionPreview={false}
|
129
130
|
moveRangeOnFirstSelection={false}
|
130
131
|
months={2}
|
@@ -203,7 +204,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRa
|
|
203
204
|
|
204
205
|
<div className={getStyles('btnSave')} onClick={handleClickCloseCalendar}>
|
205
206
|
<Icon
|
206
|
-
|
207
|
+
id='iconClosedDatePicker'
|
207
208
|
name="checkCircle"
|
208
209
|
color="inverted"
|
209
210
|
onClick={function noRefCheck() { }}
|
@@ -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: [] }
|
@@ -5,7 +5,7 @@ import styles from './DynamicSelect.module.css'
|
|
5
5
|
import withStyles from '../../hocs/withStyles'
|
6
6
|
|
7
7
|
|
8
|
-
export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placeholder, isMulti, isClearable, isDisabled, isLoading, isRtl, isSearchable, isInline, onChange, onFocus, onBlur }) => {
|
8
|
+
export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placeholder, isMulti, isClearable, isDisabled, isLoading, isRtl, isSearchable, isInline, onChange, onFocus, onBlur, closeMenuOnSelect }) => {
|
9
9
|
|
10
10
|
|
11
11
|
const customStyles = {
|
@@ -83,6 +83,7 @@ export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placehol
|
|
83
83
|
onChange={onChange}
|
84
84
|
onFocus={onFocus}
|
85
85
|
onBlur={onBlur}
|
86
|
+
closeMenuOnSelect={closeMenuOnSelect}
|
86
87
|
/>
|
87
88
|
</div>
|
88
89
|
|
@@ -102,7 +103,8 @@ DynamicSelect.propTypes = {
|
|
102
103
|
isInline: PropTypes.bool,
|
103
104
|
onChange: PropTypes.func,
|
104
105
|
onFocus: PropTypes.func,
|
105
|
-
onBlur: PropTypes.func
|
106
|
+
onBlur: PropTypes.func,
|
107
|
+
closeMenuOnSelect: PropTypes.bool
|
106
108
|
}
|
107
109
|
|
108
110
|
DynamicSelect.defaultProps = {
|
@@ -118,6 +120,7 @@ DynamicSelect.defaultProps = {
|
|
118
120
|
onChange: () => { },
|
119
121
|
onFocus: () => { },
|
120
122
|
onBlur: () => { },
|
123
|
+
closeMenuOnSelect: true
|
121
124
|
}
|
122
125
|
|
123
126
|
export default withStyles(styles)(DynamicSelect)
|
@@ -728,7 +728,32 @@ export const RowTable = ({
|
|
728
728
|
?
|
729
729
|
<td className={getStyles('td')} key={[itemTd.accessor]}>{Number(item[itemTd.accessor]).toFixed(2).toString().replace(/\./g, ',')} {itemTd.characterExtra}</td>
|
730
730
|
:
|
731
|
-
|
731
|
+
|
732
|
+
<>
|
733
|
+
|
734
|
+
<td
|
735
|
+
data-tip
|
736
|
+
data-for={'td' + [itemTd.accessor] + index}
|
737
|
+
onMouseEnter={handleMouseEnter}
|
738
|
+
onMouseLeave={handleMouseLeave}
|
739
|
+
className={getStyles('td')}
|
740
|
+
key={[itemTd.accessor]}
|
741
|
+
>
|
742
|
+
{item[itemTd.accessor]}
|
743
|
+
|
744
|
+
|
745
|
+
{isToolTipMounted ? (
|
746
|
+
<ReactTooltip id={'td' + [itemTd.accessor] + index} type='info'>
|
747
|
+
<span>{item[itemTd.accessor]}</span>
|
748
|
+
</ReactTooltip>
|
749
|
+
) : null}
|
750
|
+
|
751
|
+
</td>
|
752
|
+
|
753
|
+
</>
|
754
|
+
|
755
|
+
|
756
|
+
|
732
757
|
|
733
758
|
) : null
|
734
759
|
))}
|
@@ -12,13 +12,16 @@
|
|
12
12
|
}
|
13
13
|
|
14
14
|
.td {
|
15
|
-
padding: 15px;
|
15
|
+
padding: 6px 0px 6px 15px;
|
16
16
|
text-align: left;
|
17
17
|
vertical-align: middle;
|
18
18
|
font-weight: 300;
|
19
19
|
font-size: 12px;
|
20
20
|
color: var(--color-font-base);
|
21
21
|
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
|
22
|
+
overflow: hidden;
|
23
|
+
text-overflow: ellipsis;
|
24
|
+
/* white-space: nowrap; */
|
22
25
|
}
|
23
26
|
|
24
27
|
.tdacction {
|
@@ -29,6 +32,13 @@
|
|
29
32
|
|
30
33
|
.tdacctionIcons {
|
31
34
|
text-align: right;
|
35
|
+
width: max-content;
|
36
|
+
inline-size: max-content;
|
37
|
+
height: max-content;
|
38
|
+
block-size: max-content;
|
39
|
+
display: block;
|
40
|
+
float: right;
|
41
|
+
min-width: 100%
|
32
42
|
}
|
33
43
|
|
34
44
|
.tr-content:hover {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "imbric-theme",
|
3
|
-
"version": "0.6.
|
3
|
+
"version": "0.6.5",
|
4
4
|
"description": "Components library IMBRIC",
|
5
5
|
"private": false,
|
6
6
|
"main": "index.js",
|
@@ -55,6 +55,7 @@
|
|
55
55
|
"moment": "2.29.3",
|
56
56
|
"moment-timezone": "0.5.34",
|
57
57
|
"react-date-range": "1.4.0",
|
58
|
+
"react-datepicker": "4.10.0",
|
58
59
|
"react-icons": "4.3.1",
|
59
60
|
"react-moment": "1.1.2",
|
60
61
|
"react-router": "6.3.0",
|