imbric-theme 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- package/.storybook/main.js +1 -1
- package/atoms/AlertModal/AlertModal.js +77 -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 +5 -2
- package/atoms/Button/Button.module.css +6 -3
- package/atoms/Checkbox/Checkbox.js +49 -0
- package/atoms/Checkbox/Checkbox.module.css +3 -0
- package/atoms/Checkbox/Checkbox.stories.js +28 -0
- package/atoms/Checkbox/constants.js +1 -0
- package/atoms/Checkbox/index.js +3 -0
- package/atoms/Heading/Heading.js +1 -1
- package/atoms/Heading/Heading.module.css +4 -0
- package/atoms/Heading/constants.js +1 -1
- package/atoms/Icon/constants.js +30 -6
- package/atoms/Icon/file-download-svgrepo-com.svg +13 -0
- package/atoms/Input/Input.js +21 -5
- package/atoms/Input/Input.module.css +26 -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 +38 -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/Paragraph/Paragraph.module.css +4 -0
- package/index.js +20 -1
- package/jest.config.js +1 -1
- package/layout/DynamicTable/DynamicTable.js +207 -0
- package/layout/DynamicTable/DynamicTable.module.css +62 -0
- package/layout/DynamicTable/DynamicTable.stories.js +30 -0
- package/layout/DynamicTable/constants.js +840 -0
- package/layout/DynamicTable/index.js +3 -0
- package/layout/Navbar/Navbar.js +19 -11
- package/layout/Navbar/Navbar.module.css +4 -2
- package/layout/Navbar/Navbar.stories.js +2 -1
- package/layout/Sidebar/Sidebar.module.css +1 -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 +123 -0
- package/molecules/ColumnTable/ColumnTable.module.css +9 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +29 -0
- package/molecules/ColumnTable/constants.js +1 -0
- package/molecules/ColumnTable/index.js +3 -0
- package/molecules/DatePicker/DatePicker.js +223 -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/Dropdown/Dropdown.js +25 -22
- package/molecules/Dropdown/Dropdown.module.css +21 -3
- package/molecules/DynamicSelect/DynamicSelect.js +109 -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/RowTable/RowTable.js +22 -0
- package/molecules/RowTable/RowTable.module.css +3 -0
- package/molecules/RowTable/RowTable.stories.js +23 -0
- package/molecules/RowTable/constants.js +1 -0
- package/molecules/RowTable/index.js +3 -0
- package/package.json +8 -1
- 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/static/logologin.svg +16 -0
- package/scripts/create-component.js +2 -1
- package/storybook-static/0.263f852f.iframe.bundle.js +1 -0
- package/storybook-static/0.91dbd3f3aa2099d25061.manager.bundle.js +1 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js +3 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/1.17e9ac7e.iframe.bundle.js.map +1 -0
- package/storybook-static/2.cc4000c2.iframe.bundle.js +1 -0
- package/storybook-static/3.e9f95d01.iframe.bundle.js +1 -0
- package/storybook-static/4.be0a752c9f5176d6eec1.manager.bundle.js +2 -0
- package/storybook-static/4.be0a752c9f5176d6eec1.manager.bundle.js.LICENSE.txt +8 -0
- package/storybook-static/5.8efdde123acaf8fbb100.manager.bundle.js +1 -0
- package/storybook-static/6.2f82294ae0b087aecb24.manager.bundle.js +2 -0
- package/storybook-static/6.2f82294ae0b087aecb24.manager.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/7.97068037.iframe.bundle.js +1 -0
- package/storybook-static/7.fa9452d2609e8a00f314.manager.bundle.js +1 -0
- package/storybook-static/8.66f5ef1c66fc4628f127.manager.bundle.js +1 -0
- package/storybook-static/8.b545d602.iframe.bundle.js +3 -0
- package/storybook-static/8.b545d602.iframe.bundle.js.LICENSE.txt +12 -0
- package/storybook-static/8.b545d602.iframe.bundle.js.map +1 -0
- package/storybook-static/9.269ed917.iframe.bundle.js +1 -0
- package/storybook-static/favicon.ico +0 -0
- package/storybook-static/iframe.html +348 -0
- package/storybook-static/index.html +59 -0
- package/storybook-static/main.157061c9.iframe.bundle.js +1 -0
- package/storybook-static/main.5a07347846ccf2d7e5dc.manager.bundle.js +1 -0
- package/storybook-static/runtime~main.a14e6e62.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.f78c3fae275fc212c109.manager.bundle.js +1 -0
- package/storybook-static/static/logo.svg +19 -0
- package/storybook-static/static/logologin.svg +16 -0
- package/storybook-static/static/logotipo.svg +50 -0
- package/storybook-static/static/logotipoS.svg +26 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js +3 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js.LICENSE.txt +110 -0
- package/storybook-static/vendors~main.720e76f4.iframe.bundle.js.map +1 -0
- package/storybook-static/vendors~main.fcd0b2a3431ddf75f5f7.manager.bundle.js +2 -0
- package/storybook-static/vendors~main.fcd0b2a3431ddf75f5f7.manager.bundle.js.LICENSE.txt +101 -0
- package/styles/globals.css +592 -0
- package/styles/tokens.css +2 -1
- package/tokens/index.js +2 -1
package/index.js
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
// Pages
|
2
|
+
export { default as Login } from './pages/Login'
|
3
|
+
|
1
4
|
// Layout
|
2
5
|
export { default as CenteredContent } from './layout/CenteredContent'
|
3
6
|
export { default as Container } from './layout/Container'
|
@@ -6,16 +9,21 @@ export { default as FlexColumnContent } from './layout/FlexColumnContent'
|
|
6
9
|
export { default as Spacer } from './layout/Spacer'
|
7
10
|
export { default as Sidebar } from './layout/Sidebar'
|
8
11
|
export { default as Navbar } from './layout/Navbar'
|
12
|
+
export { default as DynamicTable } from './layout/DynamicTable'
|
13
|
+
|
9
14
|
|
10
15
|
// Atoms
|
16
|
+
export { default as AlertModal } from './atoms/AlertModal'
|
11
17
|
export { default as Avatar } from './atoms/Avatar'
|
12
18
|
export { default as Button } from './atoms/Button'
|
13
19
|
export { default as Card } from './atoms/Card'
|
14
20
|
export { default as Check } from './atoms/Check'
|
21
|
+
export { default as Checkbox } from './atoms/Checkbox'
|
15
22
|
export { default as Divider } from './atoms/Divider'
|
16
23
|
export { default as Heading } from './atoms/Heading'
|
17
24
|
export { default as Icon } from './atoms/Icon'
|
18
25
|
export { default as Input } from './atoms/Input'
|
26
|
+
export { default as Label } from './atoms/Label'
|
19
27
|
export { default as Link } from './atoms/Link'
|
20
28
|
export { default as Modal } from './atoms/Modal'
|
21
29
|
export { default as Paragraph } from './atoms/Paragraph'
|
@@ -23,6 +31,8 @@ export { default as Picture } from './atoms/Picture'
|
|
23
31
|
export { default as Textarea } from './atoms/Textarea'
|
24
32
|
export { default as Tab } from './atoms/Tab'
|
25
33
|
|
34
|
+
|
35
|
+
|
26
36
|
// Molecules
|
27
37
|
export { default as Accordion } from './molecules/Accordion'
|
28
38
|
export { default as AddButton } from './molecules/AddButton'
|
@@ -33,4 +43,13 @@ export { default as Score } from './molecules/Score'
|
|
33
43
|
export { default as Task } from './molecules/Task'
|
34
44
|
export { default as TaskCounter } from './molecules/TaskCounter'
|
35
45
|
export { default as IconLabel } from './molecules/IconLabel'
|
36
|
-
export { default as ItemMenu } from './molecules/ItemMenu'
|
46
|
+
export { default as ItemMenu } from './molecules/ItemMenu'
|
47
|
+
export { default as CheckList } from './molecules/CheckList'
|
48
|
+
export { default as ColumnTable } from './molecules/ColumnTable'
|
49
|
+
export { default as RowTable } from './molecules/RowTable'
|
50
|
+
export { default as DynamicSelect } from './molecules/DynamicSelect'
|
51
|
+
export { default as DatePicker } from './molecules/DynamicSelect'
|
52
|
+
|
53
|
+
|
54
|
+
|
55
|
+
|
package/jest.config.js
CHANGED
@@ -0,0 +1,207 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { useEffect, useState } from 'react'
|
3
|
+
import PropTypes from 'prop-types'
|
4
|
+
import styles from './DynamicTable.module.css'
|
5
|
+
import withStyles from '../../hocs/withStyles'
|
6
|
+
import ColumnTable from '../../molecules/ColumnTable'
|
7
|
+
import DynamicSelect from '../../molecules/DynamicSelect'
|
8
|
+
import DatePicker from '../../molecules/DatePicker'
|
9
|
+
import Label from '../../atoms/Label'
|
10
|
+
import Icon from '../../atoms/Icon'
|
11
|
+
import { Horizontal, Vertical } from '../../layout/Spacer/components'
|
12
|
+
import Moment from 'react-moment'
|
13
|
+
|
14
|
+
|
15
|
+
export const DynamicTable = ({ getStyles, optionsData, opColumns, opAddColumns, isViewRange, isViewAddColumn, isViewDownloadDoc }) => {
|
16
|
+
|
17
|
+
const [tableData, setTableData] = useState(optionsData);
|
18
|
+
const [columnsData, setColumnsData] = useState(opColumns);
|
19
|
+
const [addColumsData, setAddColumsData] = useState(opAddColumns);
|
20
|
+
|
21
|
+
useEffect(() => {
|
22
|
+
setColumnsData(opColumns);
|
23
|
+
})
|
24
|
+
|
25
|
+
const handleSorting = (sortField, sortOrder) => {
|
26
|
+
if (sortField) {
|
27
|
+
const sorted = [...tableData].sort((a, b) => {
|
28
|
+
if (a[sortField] === null) return 1;
|
29
|
+
if (b[sortField] === null) return -1;
|
30
|
+
if (a[sortField] === null && b[sortField] === null) return 0;
|
31
|
+
return (
|
32
|
+
a[sortField].toString().localeCompare(b[sortField].toString(), "en", {
|
33
|
+
numeric: true,
|
34
|
+
}) * (sortOrder === "asc" ? 1 : -1)
|
35
|
+
);
|
36
|
+
});
|
37
|
+
setTableData(sorted);
|
38
|
+
}
|
39
|
+
};
|
40
|
+
|
41
|
+
const handleAddColumn = (event) => {
|
42
|
+
|
43
|
+
let listKeyColumnOrder = []
|
44
|
+
|
45
|
+
event.forEach(element => {
|
46
|
+
listKeyColumnOrder[element.value] = true
|
47
|
+
});
|
48
|
+
|
49
|
+
for (const itemAddColumns of addColumsData) {
|
50
|
+
if (listKeyColumnOrder[itemAddColumns.value]) {
|
51
|
+
itemAddColumns.activeView = true
|
52
|
+
} else {
|
53
|
+
itemAddColumns.activeView = false
|
54
|
+
}
|
55
|
+
}
|
56
|
+
|
57
|
+
|
58
|
+
for (const itemEvent of addColumsData) {
|
59
|
+
|
60
|
+
for (const itemColumns of columnsData) {
|
61
|
+
|
62
|
+
if (itemColumns.accessor === itemEvent.value) {
|
63
|
+
|
64
|
+
if (itemEvent.activeView) {
|
65
|
+
itemColumns.activeView = true
|
66
|
+
} else {
|
67
|
+
itemColumns.activeView = false
|
68
|
+
}
|
69
|
+
|
70
|
+
|
71
|
+
}
|
72
|
+
}
|
73
|
+
|
74
|
+
}
|
75
|
+
|
76
|
+
setColumnsData([])
|
77
|
+
|
78
|
+
}
|
79
|
+
|
80
|
+
return (
|
81
|
+
|
82
|
+
<>
|
83
|
+
<div className={getStyles('opFunction')}>
|
84
|
+
|
85
|
+
<div className={getStyles('opFunctionBox1')}>
|
86
|
+
<DatePicker
|
87
|
+
isLayoutDate="DateRangePicker"
|
88
|
+
/>
|
89
|
+
</div>
|
90
|
+
|
91
|
+
<div className={getStyles('opFunctionBox2')}>
|
92
|
+
|
93
|
+
<div className={getStyles('opFunctionBox3')}>
|
94
|
+
<Label>Mostrar u ocultar columnas</Label>
|
95
|
+
<DynamicSelect
|
96
|
+
isMulti
|
97
|
+
isInline
|
98
|
+
onChange={handleAddColumn}
|
99
|
+
optionsSelect={addColumsData}
|
100
|
+
placeholder='Seleccionar columnas'
|
101
|
+
/>
|
102
|
+
</div>
|
103
|
+
<Horizontal size="md" />
|
104
|
+
<div className={getStyles('opFunctionBox3')}>
|
105
|
+
<Icon
|
106
|
+
key="3"
|
107
|
+
background="inverted"
|
108
|
+
name="fileDownload"
|
109
|
+
onClick={function noRefCheck() { }}
|
110
|
+
/>
|
111
|
+
</div>
|
112
|
+
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</div>
|
116
|
+
<Vertical size="md" />
|
117
|
+
<div className={getStyles('dynamic-table')}>
|
118
|
+
<div className={getStyles('tbl-header')}>
|
119
|
+
<table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
|
120
|
+
<thead>
|
121
|
+
<tr>
|
122
|
+
{columnsData.map((item) => (
|
123
|
+
item.activeView ?
|
124
|
+
(<ColumnTable
|
125
|
+
key={item.accessor}
|
126
|
+
handleSorting={handleSorting}
|
127
|
+
sortable={item.sortable}
|
128
|
+
accessor={item.accessor}
|
129
|
+
isFilter={item.viewIsFilter}
|
130
|
+
typeInput={item.typeFilter}
|
131
|
+
idInput={item.idInput}
|
132
|
+
nameInput={item.nameInput}
|
133
|
+
placeholder={item.placeholder}
|
134
|
+
>
|
135
|
+
{item.title}
|
136
|
+
</ColumnTable>
|
137
|
+
) : null
|
138
|
+
))}
|
139
|
+
</tr>
|
140
|
+
</thead>
|
141
|
+
</table>
|
142
|
+
</div>
|
143
|
+
<div className={getStyles('tbl-content')}>
|
144
|
+
<table className={getStyles('table')} cellPadding="0" cellSpacing="0" border="0">
|
145
|
+
<tbody>
|
146
|
+
|
147
|
+
{tableData.map((item, index) => (
|
148
|
+
|
149
|
+
<tr key={index}>
|
150
|
+
{columnsData.map((itemTd) => (
|
151
|
+
itemTd.activeView ?
|
152
|
+
|
153
|
+
(
|
154
|
+
itemTd.typeFilter === 'date' ?
|
155
|
+
|
156
|
+
<td className={getStyles('td')} key={item[itemTd.accessor]}>
|
157
|
+
<Moment format="DD/MM/YYYY hh:mm:ss">
|
158
|
+
{item[itemTd.accessor]}
|
159
|
+
</Moment>
|
160
|
+
</td>
|
161
|
+
|
162
|
+
: itemTd.typeFilter === 'number' ?
|
163
|
+
|
164
|
+
itemTd.subTypeFilter ?
|
165
|
+
|
166
|
+
<td className={getStyles('td')} key={item[itemTd.accessor]}>{item[itemTd.accessor].toFixed(2).toString().replace(/\./g, ',')} €</td>
|
167
|
+
:
|
168
|
+
<td className={getStyles('td')} key={item[itemTd.accessor]}>{item[itemTd.accessor]}</td>
|
169
|
+
:
|
170
|
+
itemTd.subTypeFilter ?
|
171
|
+
|
172
|
+
<td className={getStyles('td')} key={item[itemTd.accessor]}>{item[itemTd.accessor].toString().replace(/\./g, ',').slice(0, 5)} €</td>
|
173
|
+
:
|
174
|
+
<td className={getStyles('td')} key={item[itemTd.accessor]}>{item[itemTd.accessor]}</td>
|
175
|
+
|
176
|
+
|
177
|
+
) : null
|
178
|
+
))}
|
179
|
+
</tr>
|
180
|
+
|
181
|
+
))}
|
182
|
+
|
183
|
+
</tbody>
|
184
|
+
</table>
|
185
|
+
</div>
|
186
|
+
</div>
|
187
|
+
</>
|
188
|
+
|
189
|
+
)
|
190
|
+
}
|
191
|
+
|
192
|
+
DynamicTable.propTypes = {
|
193
|
+
// children: PropTypes.node.isRequired,
|
194
|
+
getStyles: PropTypes.func.isRequired,
|
195
|
+
isViewRange: PropTypes.bool,
|
196
|
+
isViewAddColumn: PropTypes.bool,
|
197
|
+
isViewDownloadDoc: PropTypes.bool,
|
198
|
+
}
|
199
|
+
|
200
|
+
DynamicTable.defaultProps = {
|
201
|
+
getStyles: () => { },
|
202
|
+
isViewRange: true,
|
203
|
+
isViewAddColumn: true,
|
204
|
+
isViewDownloadDoc: true,
|
205
|
+
}
|
206
|
+
|
207
|
+
export default withStyles(styles)(DynamicTable)
|
@@ -0,0 +1,62 @@
|
|
1
|
+
.opFunction {
|
2
|
+
display: flex;
|
3
|
+
align-items: center;
|
4
|
+
justify-content: space-between;
|
5
|
+
}
|
6
|
+
|
7
|
+
/* .opFunctionBox1 {
|
8
|
+
display: inline-flex;
|
9
|
+
} */
|
10
|
+
|
11
|
+
.opFunctionBox2 {
|
12
|
+
display: inline-flex;
|
13
|
+
align-items: flex-end;
|
14
|
+
}
|
15
|
+
|
16
|
+
.dynamic-table {
|
17
|
+
box-shadow: 0px 3px 1px -2px rgb(0 0 0 / 7%), 0px 2px 2px 0px rgb(0 0 0 / 7%), 0px 1px 5px 0px rgb(0 0 0 / 6%);
|
18
|
+
}
|
19
|
+
|
20
|
+
.table {
|
21
|
+
width: 100%;
|
22
|
+
table-layout: fixed;
|
23
|
+
|
24
|
+
}
|
25
|
+
|
26
|
+
.tbl-header {
|
27
|
+
/* background-color: rgba(255, 255, 255, 0.3); */
|
28
|
+
/* background-color: -webkit-linear-gradient(left, #25c481, #25b7c4);
|
29
|
+
background-color: linear-gradient(to right, #25c481, #25b7c4); */
|
30
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
31
|
+
}
|
32
|
+
|
33
|
+
.tbl-content {
|
34
|
+
height: 300px;
|
35
|
+
overflow-x: auto;
|
36
|
+
margin-top: 0px;
|
37
|
+
border: 1px solid rgba(0, 0, 0, 0.1);
|
38
|
+
}
|
39
|
+
|
40
|
+
.td {
|
41
|
+
padding: 15px;
|
42
|
+
text-align: left;
|
43
|
+
vertical-align: middle;
|
44
|
+
font-weight: 300;
|
45
|
+
font-size: 12px;
|
46
|
+
color: var(--color-font-base);
|
47
|
+
border-bottom: solid 1px rgba(0, 0, 0, 0.1);
|
48
|
+
}
|
49
|
+
|
50
|
+
/* for custom scrollbar for webkit browser*/
|
51
|
+
|
52
|
+
/* ::-webkit-scrollbar {
|
53
|
+
width: 6px;
|
54
|
+
}
|
55
|
+
|
56
|
+
::-webkit-scrollbar-track {
|
57
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
58
|
+
}
|
59
|
+
|
60
|
+
::-webkit-scrollbar-thumb {
|
61
|
+
-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
|
62
|
+
} */
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import { DynamicTable, styles, options } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(DynamicTable, styles)
|
10
|
+
const ListTemplate = getListTemplate(DynamicTable, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Layout/DynamicTable',
|
14
|
+
component: DynamicTable,
|
15
|
+
args: {
|
16
|
+
optionsData: options.bookings,
|
17
|
+
opColumns: options.columns,
|
18
|
+
opAddColumns: options.opAddColumns,
|
19
|
+
isViewRange: true,
|
20
|
+
isViewAddColumn: true,
|
21
|
+
isViewDownloadDoc: true,
|
22
|
+
},
|
23
|
+
argTypes: {
|
24
|
+
// types: getOptionsArgTypes(options.types),
|
25
|
+
},
|
26
|
+
}
|
27
|
+
|
28
|
+
export const Default = Template.bind({})
|
29
|
+
// export const List = ListTemplate.bind({})
|
30
|
+
// List.args = { items: options.types.map((type) => ({ type })) }
|