imbric-theme 0.3.6 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -10,7 +10,7 @@ import Paragraph from '../Paragraph'
10
10
  export const LinkItem = ({ children, size, color, getStyles, isHref }) => {
11
11
  return (
12
12
  <Link href={isHref} passHref>
13
- <a className={getStyles('link', ['color'])}>
13
+ <a target="_blank" className={getStyles('link', ['color'])}>
14
14
  <Paragraph size={size} color={color} weight="semibold" isInline>
15
15
  {children}
16
16
  </Paragraph>
@@ -8,7 +8,9 @@ import Icon from '../Icon'
8
8
  import Container from '../../layout/Container'
9
9
  import isEmpty from '../../utils/isEmpty'
10
10
 
11
+
11
12
  import useMedia from '../../hook/useMedia'
13
+ import Heading from '../Heading'
12
14
 
13
15
  // Sync with ./Modal.module.css#L13-L17
14
16
  const FADE_OUT_ANIMATION_TIME = 400
@@ -33,6 +35,7 @@ export const Modal = ({
33
35
  getStyles,
34
36
  type,
35
37
  isPlayground,
38
+ titleModal,
36
39
  }) => {
37
40
  const isDesktop = useMedia(['(min-width: 992px)'], [true])
38
41
  const [onFadeOut, setOnFadeOut] = useState(false)
@@ -54,7 +57,7 @@ export const Modal = ({
54
57
  <div className={getStyles('heading')}>
55
58
  {!!onClose && (
56
59
  <Icon
57
- color={isDesktop && type === 'secondary' ? 'primary' : 'inverted'}
60
+ color={isDesktop && type === 'secondary' ? 'primary' : 'primary'}
58
61
  name={isDesktop ? 'cross' : 'angleLeft'}
59
62
  background={isDesktop ? 'transparent' : 'muted'}
60
63
  onClick={handleClose}
@@ -71,8 +74,11 @@ export const Modal = ({
71
74
  })}
72
75
  />
73
76
  )}
77
+ <Heading color='black' size='lg' weight='light'>
78
+ {titleModal}
79
+ </Heading>
74
80
  </div>
75
- <Container>{children}</Container>
81
+ <Container><div className={getStyles('container')}>{children}</div></Container>
76
82
  </div>
77
83
  </div>
78
84
  )
@@ -88,11 +94,13 @@ Modal.propTypes = {
88
94
  }),
89
95
  type: PropTypes.oneOf(options.types),
90
96
  isPlayground: PropTypes.bool,
97
+ titleModal: PropTypes.string,
91
98
  }
92
99
 
93
100
  Modal.defaultProps = {
94
101
  getStyles: () => {},
95
102
  type: 'primary',
103
+ titleModal: 'Ejemplo titulo'
96
104
  }
97
105
 
98
106
  export default withStyles(styles)(Modal)
@@ -4,7 +4,7 @@
4
4
  display: flex;
5
5
  align-items: center;
6
6
  justify-content: center;
7
- background: var(--modal-backdrop-color);
7
+ background: rgb(0 0 0 / 50%);
8
8
  inset: 0;
9
9
  }
10
10
 
@@ -24,7 +24,7 @@
24
24
  padding: 16px 32px;
25
25
  }
26
26
 
27
- :not(.is-playground) > .modal {
27
+ :not(.is-playground)>.modal {
28
28
  animation: fadeInModal 0.4s ease-in forwards;
29
29
  opacity: 0;
30
30
  }
@@ -45,7 +45,7 @@
45
45
  }
46
46
 
47
47
  .type-primary {
48
- background-color: var(--color-primary);
48
+ background-color: var(--color-primary-inverted);
49
49
  }
50
50
 
51
51
  .type-secondary {
@@ -54,14 +54,22 @@
54
54
 
55
55
  @media (min-width: 992px) {
56
56
  .modal {
57
- max-width: var(--modal-desktop-max-width);
58
- height: var(--modal-desktop-height);
57
+ max-width: 465px;
58
+ height: auto;
59
59
  border-radius: var(--border-radius-sm);
60
+ /* max-height: 100%;
61
+ overflow: auto; */
60
62
  }
61
63
 
62
64
  .heading {
63
65
  flex-direction: row-reverse;
64
66
  }
67
+
68
+ .container {
69
+ max-height: 600px;
70
+ overflow: auto;
71
+ min-width: 100%;
72
+ }
65
73
  }
66
74
 
67
75
  @keyframes fadeInModal {
@@ -82,4 +90,4 @@
82
90
  to {
83
91
  opacity: 0;
84
92
  }
85
- }
93
+ }
@@ -16,7 +16,7 @@ import LoadingError from '../../molecules/LoadingError'
16
16
  // import useStateDate from '../../hook/useStateDate';
17
17
 
18
18
 
19
- export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isLayoutDate, isViewRange, isViewAddColumn, isViewDownloadDoc, handleAddColumn, handleSelectRange, handleDownloadExcel }) => {
19
+ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isLayoutDate, isViewRange, isViewAddColumn, isViewDownloadDoc, handleAddColumn, handleSelectRange, handleDownloadExcel, labelDinamicSelect, placeholderDinamicSelect, labelSinceDateRange, labelTillDateRange }) => {
20
20
 
21
21
  const [tableData, setTableData] = useState(optionsData);
22
22
  const [columnsData, setColumnsData] = useState(opColumns);
@@ -94,6 +94,8 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
94
94
  <DatePicker
95
95
  isLayoutDate={isLayoutDate}
96
96
  onChangeRange={handleSelectRange}
97
+ sinceDateRange={labelSinceDateRange}
98
+ tillDateRange={labelTillDateRange}
97
99
  />
98
100
  </div>
99
101
  ) : null}
@@ -102,13 +104,13 @@ export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns,
102
104
 
103
105
  {isViewAddColumn ? (
104
106
  <div className={getStyles('opFunctionBox3')}>
105
- <Label>Mostrar u ocultar columnas</Label>
107
+ <Label>{labelDinamicSelect}</Label>
106
108
  <DynamicSelect
107
109
  isMulti
108
110
  isInline
109
111
  onChange={handleAddColumn}
110
112
  optionsSelect={addColumsData}
111
- placeholder='Seleccionar columnas'
113
+ placeholder={placeholderDinamicSelect}
112
114
  />
113
115
  </div>
114
116
  ) : null}
@@ -156,6 +158,10 @@ DynamicTable.propTypes = {
156
158
  isLayoutDate: PropTypes.string,
157
159
  handleSelectRange: PropTypes.func,
158
160
  handleDownloadExcel: PropTypes.func,
161
+ labelDinamicSelect: PropTypes.string,
162
+ placeholderDinamicSelect: PropTypes.string,
163
+ labelSinceDateRange: PropTypes.string,
164
+ labelTillDateRange: PropTypes.string,
159
165
  }
160
166
 
161
167
  DynamicTable.defaultProps = {
@@ -164,9 +170,13 @@ DynamicTable.defaultProps = {
164
170
  isViewRange: true,
165
171
  isViewAddColumn: true,
166
172
  isViewDownloadDoc: true,
167
- isLayoutDate: 'DateRangePicker',
173
+ isLayoutDate: 'Calendar',
168
174
  handleSelectRange: () => { },
169
175
  handleDownloadExcel: () => { },
176
+ labelDinamicSelect: 'Mostrar u ocultar columnas',
177
+ placeholderDinamicSelect: 'Seleccionar columnas',
178
+ labelSinceDateRange: 'Desde',
179
+ labelTillDateRange: 'Hasta',
170
180
  }
171
181
 
172
182
  export default withStyles(styles)(DynamicTable)
@@ -27,6 +27,8 @@ export default {
27
27
  isViewRange: true,
28
28
  isViewAddColumn: true,
29
29
  isViewDownloadDoc: true,
30
+ labelDinamicSelect: 'Mostrar u ocultar columnas',
31
+ placeholderDinamicSelect: 'Seleccionar columnas',
30
32
  },
31
33
  argTypes: {
32
34
  // types: getOptionsArgTypes(options.types),
@@ -2,11 +2,32 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
  import styles from './Navbar.module.css'
4
4
  import withStyles from '../../hocs/withStyles'
5
+ import { useRouter } from "next/router";
6
+ import Link from 'next/link'
7
+ import DynamicSelect from '../../molecules/DynamicSelect'
5
8
 
6
9
  import Heading from '../../atoms/Heading/Heading'
7
10
  import Tabs from '../../molecules/Tabs/Tabs'
11
+ import Icon from '../../atoms/Icon'
12
+ import { options } from './constants'
13
+
14
+ export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout, defaultValueLanguage, optionsSelectLanguage, handleChangeLanguage }) => {
15
+
16
+
17
+ const router = useRouter();
18
+
19
+ const handleClick = (e, path) => {
20
+
21
+ console.log("I clicked on the About Page" + path);
22
+
23
+ router.push({
24
+ pathname: path,
25
+ })
26
+
27
+
28
+ };
29
+
8
30
 
9
- export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout }) => {
10
31
  return (
11
32
  <>
12
33
  <header className={getStyles('navbar')}>
@@ -52,16 +73,61 @@ export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkL
52
73
  />
53
74
 
54
75
 
55
- {/* <div className={getStyles('navbar__title', 'navbar__item')}>Taksee</div> */}
56
- {/* <div className={getStyles('navbar__item')}>Legal</div>
57
- <div className={getStyles('navbar__item')}>User Guide</div> */}
58
-
59
76
  {viewOptionsNav ? (
60
- <div onClick={linkLogout} className={getStyles('navbar__item', { 'is-playground': viewTabsNav })}>
61
- Logout
77
+ <div className={getStyles('navbar__actions')}>
78
+ {/* <div className={getStyles('navbar__item')}>Legal</div>
79
+ <div className={getStyles('navbar__item')}>User Guide</div> */}
80
+
81
+ {options.map((item, index) => (
82
+ <Icon
83
+ key={index}
84
+ size='lg'
85
+ name={item.icon}
86
+ color='highlight'
87
+ background='transparent'
88
+ onClick={(e) => handleClick(e, item.href)}
89
+ />
90
+ ))}
91
+
92
+ <DynamicSelect
93
+ isClearable={false}
94
+ // defaultValue={{
95
+ // label: 'ES',
96
+ // value: 'es'
97
+ // }}
98
+ defaultValue={defaultValueLanguage}
99
+ onChange={handleChangeLanguage}
100
+ optionsSelect={optionsSelectLanguage}
101
+ // optionsSelect={[
102
+ // {
103
+ // label: 'ES',
104
+ // value: 'es'
105
+ // },
106
+ // {
107
+ // label: 'EN',
108
+ // value: 'en'
109
+ // }
110
+ // ]}
111
+ />
112
+
113
+ <Icon
114
+ size='lg'
115
+ name='logout'
116
+ color='highlight'
117
+ background='transparent'
118
+ onClick={linkLogout}
119
+ />
120
+
62
121
  </div>
122
+
63
123
  ) : null}
64
124
 
125
+ {/* {viewOptionsNav ? (
126
+ <div onClick={linkLogout} className={getStyles('navbar__item')}>
127
+ Logout
128
+ </div>
129
+ ) : null} */}
130
+
65
131
 
66
132
  </header>
67
133
 
@@ -76,6 +142,7 @@ Navbar.propTypes = {
76
142
  viewTabsNav: PropTypes.bool,
77
143
  viewOptionsNav: PropTypes.bool,
78
144
  linkLogout: PropTypes.func,
145
+ handleChange: PropTypes.func,
79
146
  }
80
147
 
81
148
  Navbar.defaultProps = {
@@ -27,4 +27,9 @@
27
27
  padding: 0.67em 1.5em;
28
28
  cursor: pointer;
29
29
  vertical-align: middle;
30
+ }
31
+
32
+ .navbar__actions {
33
+ display: flex;
34
+ align-items: center;
30
35
  }
@@ -0,0 +1,35 @@
1
+ export const options = [
2
+ {
3
+ active: false,
4
+ href: '#',
5
+ icon: 'legal',
6
+ text: 'Legal',
7
+ view: true,
8
+ viewSubMenu: true,
9
+ },
10
+ {
11
+ active: false,
12
+ href: '/home',
13
+ icon: 'info',
14
+ text: 'User Guide',
15
+ view: true,
16
+ viewSubMenu: false,
17
+ },
18
+ {
19
+ active: false,
20
+ href: '/home',
21
+ icon: 'profile',
22
+ text: 'My profile',
23
+ view: true,
24
+ viewSubMenu: false,
25
+ },
26
+ // {
27
+ // active: false,
28
+ // href: '/home',
29
+ // icon: 'logout',
30
+ // text: 'Salir',
31
+ // view: true,
32
+ // viewSubMenu: false,
33
+ // },
34
+
35
+ ]
@@ -61,24 +61,26 @@ export const ColumnTable = ({ getStyles, handleSorting, columnUppercase, onChang
61
61
 
62
62
  <Horizontal size="xs" />
63
63
 
64
- {cl === "default" ?
65
- <Icon
66
- name="angleUpDown"
67
- size="xs"
68
- />
69
- : cl === "" ? null
70
-
71
- : cl === "angleDown"
72
- ? <Icon
73
- name="angleDown"
74
- size="xs"
75
- />
64
+ {item.sortable ?
76
65
 
77
- : <Icon
78
- name="angleUp"
66
+ cl === "default" ?
67
+ <Icon
68
+ name="angleUpDown"
79
69
  size="xs"
80
70
  />
81
-
71
+ : cl === "" ? null
72
+
73
+ : cl === "angleDown"
74
+ ? <Icon
75
+ name="angleDown"
76
+ size="xs"
77
+ />
78
+
79
+ : <Icon
80
+ name="angleUp"
81
+ size="xs"
82
+ />
83
+ : null
82
84
  }
83
85
  </span>
84
86
 
@@ -33,7 +33,7 @@ import {
33
33
 
34
34
 
35
35
 
36
- export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
36
+ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange, sinceDateRange, tillDateRange }) => {
37
37
 
38
38
  const [isShowCalendar, setShowCalendar] = useState(false);
39
39
 
@@ -96,7 +96,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
96
96
  !isShowCalendar ?
97
97
  <div className={getStyles('date-picker-input')}>
98
98
  <div>
99
- <Label>Desde</Label>
99
+ <Label>{sinceDateRange}</Label>
100
100
  <Input
101
101
  isInline
102
102
  id="startDate"
@@ -108,7 +108,7 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
108
108
  </div>
109
109
 
110
110
  <div>
111
- <Label>Hasta</Label>
111
+ <Label>{tillDateRange}</Label>
112
112
  <Input
113
113
  isInline
114
114
  id="endDate"
@@ -224,13 +224,17 @@ export const DatePicker = ({ getStyles, isLayoutDate, onChangeRange }) => {
224
224
  DatePicker.propTypes = {
225
225
  getStyles: PropTypes.func.isRequired,
226
226
  isLayoutDate: PropTypes.oneOf(options.typeLayoutDate),
227
- onChangeRange: PropTypes.func
227
+ onChangeRange: PropTypes.func,
228
+ sinceDateRange: PropTypes.string,
229
+ tillDateRange: PropTypes.string,
228
230
  }
229
231
 
230
232
  DatePicker.defaultProps = {
231
233
  getStyles: () => { },
232
234
  isLayoutDate: 'Calendar',
233
235
  onChangeRange: () => { },
236
+ sinceDateRange: 'Desde',
237
+ tillDateRange: 'Hasta',
234
238
  }
235
239
 
236
240
  export default withStyles(styles)(DatePicker)
@@ -89,7 +89,7 @@ export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placehol
89
89
 
90
90
  DynamicSelect.propTypes = {
91
91
  getStyles: PropTypes.func.isRequired,
92
- defaultValue: PropTypes.string,
92
+ defaultValue: PropTypes.object,
93
93
  placeholder: PropTypes.string,
94
94
  isMulti: PropTypes.bool,
95
95
  isClearable: PropTypes.bool,
@@ -103,7 +103,6 @@ DynamicSelect.propTypes = {
103
103
 
104
104
  DynamicSelect.defaultProps = {
105
105
  getStyles: () => { },
106
- defaultValue: '',
107
106
  placeholder: 'seleccionar',
108
107
  isMulti: false,
109
108
  isClearable: true,
@@ -14,7 +14,7 @@ export default {
14
14
  component: DynamicSelect,
15
15
  args: {
16
16
  optionsSelect: options.optionsSelect,
17
- defaultValue: '',
17
+ defaultValue: options.optionsSelect[0],
18
18
  placeholder: 'seleccionar',
19
19
  isMulti: false,
20
20
  isClearable: true,
@@ -6,8 +6,20 @@ import { options } from './constants'
6
6
  import withStyles from '../../hocs/withStyles'
7
7
 
8
8
  import Moment from 'react-moment'
9
+ import Icon from '../../atoms/Icon'
10
+ import { Horizontal, Vertical } from '../../layout/Spacer/components'
11
+
12
+ export const RowTable = ({ getStyles, slice, columnsData, onClickActionEdit, onClickActionSendEmail, onClickActionDelete }) => {
13
+
14
+
15
+
16
+
17
+ // const handleEditStaff = (e, item) => {
18
+ // console.log(item)
19
+ // console.log(e)
20
+ // }
21
+
9
22
 
10
- export const RowTable = ({ getStyles, slice, columnsData }) => {
11
23
  return (
12
24
  <div className={getStyles('tbl-content')}>
13
25
  <table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
@@ -17,33 +29,59 @@ export const RowTable = ({ getStyles, slice, columnsData }) => {
17
29
  <tr key={index}>
18
30
  {columnsData.map((itemTd) => (
19
31
  itemTd.activeView ?
20
-
21
32
  (
22
- itemTd.subAccessor !== '' ?
23
33
 
24
- <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor][itemTd.subAccessor]}</td> :
25
34
 
26
- itemTd.typeFilter === 'date' ?
35
+ itemTd.subAccessor === 'action' ?
36
+
37
+ <td className={getStyles('td')} key={[itemTd.accessor]}>
38
+
39
+ <Icon
40
+ background="base"
41
+ name="settings"
42
+ onClick={(e) => { onClickActionEdit(e, item) }}
43
+ />
44
+ <Horizontal size="xs" />
45
+ <Icon
46
+ background="base"
47
+ name="arrowUp"
48
+ // onClick={(e) => onClickEdit(e, item)}
49
+ onClick={e => { onClickActionSendEmail(e, item) }}
50
+ />
51
+ <Horizontal size="xs" />
52
+ <Icon
53
+ background="base"
54
+ name="trash"
55
+ // onClick={(e) => onClickEdit(e, item)}
56
+ onClick={e => { onClickActionDelete(e, item) }}
57
+ />
58
+ </td> :
59
+
60
+ itemTd.subAccessor !== '' ?
61
+
62
+ <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor][itemTd.subAccessor]}</td> :
63
+
64
+ itemTd.typeFilter === 'date' ?
27
65
 
28
- <td className={getStyles('td')} key={[itemTd.accessor]}>
29
- <Moment format="DD/MM/YYYY hh:mm:ss">
30
- {item[itemTd.accessor]}
31
- </Moment>
32
- </td>
66
+ <td className={getStyles('td')} key={[itemTd.accessor]}>
67
+ <Moment format="DD/MM/YYYY hh:mm:ss">
68
+ {item[itemTd.accessor]}
69
+ </Moment>
70
+ </td>
33
71
 
34
- : itemTd.typeFilter === 'number' ?
72
+ : itemTd.typeFilter === 'number' ?
35
73
 
36
- itemTd.subTypeFilter ?
74
+ itemTd.subTypeFilter ?
37
75
 
38
- <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toFixed(2).toString().replace(/\./g, ',')} €</td>
39
- :
40
- <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
76
+ <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toFixed(2).toString().replace(/\./g, ',')} €</td>
77
+ :
78
+ <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
41
79
 
42
- : itemTd.subTypeFilter ?
80
+ : itemTd.subTypeFilter ?
43
81
 
44
- <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toString().replace(/\./g, ',').slice(0, 5)} €</td>
45
- :
46
- <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
82
+ <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor].toString().replace(/\./g, ',').slice(0, 5)} €</td>
83
+ :
84
+ <td className={getStyles('td')} key={[itemTd.accessor]}>{item[itemTd.accessor]}</td>
47
85
 
48
86
  ) : null
49
87
  ))}
@@ -59,10 +97,14 @@ export const RowTable = ({ getStyles, slice, columnsData }) => {
59
97
  RowTable.propTypes = {
60
98
  getStyles: PropTypes.func.isRequired,
61
99
  type: PropTypes.oneOf(options.types),
100
+ onClickActionEdit: PropTypes.func,
101
+ onClickActionSendEmail: PropTypes.func,
102
+ onClickActionDelete: PropTypes.func
62
103
  }
63
104
 
64
105
  RowTable.defaultProps = {
65
106
  getStyles: () => { },
107
+ onClickActionEdit: () => { },
66
108
  }
67
109
 
68
110
  export default withStyles(styles)(RowTable)
@@ -300,6 +300,19 @@ export const options = {
300
300
  nameInput: 'ID Proveedor',
301
301
  placeholder: 'ID Proveedor'
302
302
  },
303
+ {
304
+ accessor: 'action',
305
+ subAccessor: 'action',
306
+ activeView: true,
307
+ idInput: 'action',
308
+ nameInput: 'Acciones',
309
+ placeholder: 'Acciones',
310
+ sortable: false,
311
+ subTypeFilter: false,
312
+ title: '',
313
+ typeFilter: 'text',
314
+ viewIsFilter: false,
315
+ },
303
316
  ],
304
317
 
305
318
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imbric-theme",
3
- "version": "0.3.6",
3
+ "version": "0.4.0",
4
4
  "description": "Components library IMBRIC",
5
5
  "private": false,
6
6
  "main": "index.js",