imbric-theme 0.3.4 → 0.3.8
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/atoms/Checkbox/Checkbox.js +26 -9
- package/atoms/Checkbox/Checkbox.module.css +51 -0
- package/atoms/Checkbox/Checkbox.stories.js +4 -2
- package/atoms/Icon/constants.js +1 -1
- package/atoms/Input/Input.js +1 -0
- package/atoms/LinkItem/LinkItem.js +36 -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/{Link → LinkItem}/__snapshots__/Link.stories.js.snap +0 -0
- package/atoms/{Link → LinkItem}/constants.js +0 -0
- package/atoms/LinkItem/index.js +3 -0
- package/atoms/Modal/Modal.js +9 -1
- package/atoms/Modal/Modal.module.css +6 -6
- package/hook/useAddColumn.js +40 -0
- package/hook/useStateDate.js +25 -0
- package/hook/useTable.js +45 -0
- package/index.js +4 -2
- package/layout/DynamicTable/DynamicTable.js +87 -122
- package/layout/DynamicTable/DynamicTable.module.css +2 -1
- package/layout/DynamicTable/DynamicTable.stories.js +49 -2
- package/layout/DynamicTable/constants.js +50 -567
- package/layout/Navbar/Navbar.js +1 -1
- package/molecules/ColumnTable/ColumnTable.js +78 -73
- package/molecules/ColumnTable/ColumnTable.module.css +13 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +4 -7
- package/molecules/ColumnTable/constants.js +111 -1
- package/molecules/DatePicker/DatePicker.js +27 -14
- package/molecules/DatePicker/DatePicker.module.css +1 -1
- package/molecules/DynamicSelect/DynamicSelect.js +9 -0
- package/molecules/FooterTable/FooterTable.js +47 -0
- package/molecules/FooterTable/FooterTable.module.css +37 -0
- package/molecules/FooterTable/FooterTable.stories.js +23 -0
- package/molecules/FooterTable/constants.js +1 -0
- package/molecules/FooterTable/index.js +3 -0
- package/molecules/RowTable/RowTable.js +70 -4
- package/molecules/RowTable/RowTable.module.css +21 -2
- package/molecules/RowTable/RowTable.stories.js +7 -4
- package/molecules/RowTable/constants.js +318 -1
- package/package.json +1 -1
- package/atoms/Icon/file-download-svgrepo-com.svg +0 -13
- package/atoms/Link/Link.js +0 -33
- package/atoms/Link/index.js +0 -3
@@ -5,7 +5,8 @@ import styles from './Checkbox.module.css'
|
|
5
5
|
import { options } from './constants'
|
6
6
|
import withStyles from '../../hocs/withStyles'
|
7
7
|
|
8
|
-
|
8
|
+
|
9
|
+
export const Checkbox = ({ getStyles, onChange, label, id, value, name, linkCheck, nameLinkCheck }) => {
|
9
10
|
|
10
11
|
const [checked, setChecked] = React.useState(false);
|
11
12
|
|
@@ -14,17 +15,29 @@ export const Checkbox = ({ getStyles, onChange, label, id, value, name }) => {
|
|
14
15
|
|
15
16
|
<div className={getStyles('checkbox')}>
|
16
17
|
|
17
|
-
<input
|
18
|
-
|
18
|
+
{/* <input
|
19
|
+
type="checkbox"
|
19
20
|
id={id}
|
20
21
|
name={name}
|
21
22
|
label={label}
|
22
23
|
value={value}
|
23
24
|
onChange={onChange}
|
24
25
|
/>
|
25
|
-
{label}
|
26
|
+
{label} */}
|
27
|
+
|
28
|
+
<input className={getStyles('checkbox-custom')}
|
29
|
+
type="checkbox"
|
30
|
+
id={id}
|
31
|
+
name={name}
|
32
|
+
label={label}
|
33
|
+
value={value}
|
34
|
+
onChange={onChange}
|
35
|
+
/>
|
36
|
+
<label htmlFor={name} className={getStyles('checkbox-custom-label')}>{label}<a className={getStyles('checkbox-custom-link')} href={linkCheck} target="_black"> {nameLinkCheck}</a> </label>
|
37
|
+
|
38
|
+
|
26
39
|
</div>
|
27
|
-
|
40
|
+
|
28
41
|
)
|
29
42
|
}
|
30
43
|
|
@@ -33,17 +46,21 @@ Checkbox.propTypes = {
|
|
33
46
|
onChange: PropTypes.func.isRequired,
|
34
47
|
id: PropTypes.string.isRequired,
|
35
48
|
name: PropTypes.string.isRequired,
|
36
|
-
value: PropTypes.
|
37
|
-
label: PropTypes.string
|
49
|
+
value: PropTypes.bool.isRequired,
|
50
|
+
label: PropTypes.string,
|
51
|
+
nameLinkCheck: PropTypes.string,
|
52
|
+
linkCheck: PropTypes.string,
|
38
53
|
}
|
39
54
|
|
40
55
|
Checkbox.defaultProps = {
|
41
56
|
getStyles: () => { },
|
42
57
|
onChange: () => { },
|
43
|
-
id: '
|
44
|
-
name: '
|
58
|
+
id: 'hola',
|
59
|
+
name: 'hola',
|
45
60
|
value: true,
|
46
61
|
label: 'Hola',
|
62
|
+
nameLinkCheck: '',
|
63
|
+
linkCheck: '',
|
47
64
|
}
|
48
65
|
|
49
66
|
export default withStyles(styles)(Checkbox)
|
@@ -1,3 +1,54 @@
|
|
1
1
|
.checkbox {
|
2
2
|
display: flex;
|
3
3
|
}
|
4
|
+
|
5
|
+
/* ////////////////////// */
|
6
|
+
|
7
|
+
|
8
|
+
.checkbox-custom {
|
9
|
+
opacity: 0;
|
10
|
+
position: absolute;
|
11
|
+
}
|
12
|
+
|
13
|
+
.checkbox-custom, .checkbox-custom-label {
|
14
|
+
display: inline-block;
|
15
|
+
vertical-align: middle;
|
16
|
+
margin: 5px;
|
17
|
+
cursor: pointer;
|
18
|
+
color: var(--color-brand-regent-gray);
|
19
|
+
font-weight: var(--font-weight-light);
|
20
|
+
}
|
21
|
+
|
22
|
+
.checkbox-custom + .checkbox-custom-label:before {
|
23
|
+
content: '';
|
24
|
+
background: #fff;
|
25
|
+
border-radius: 5px;
|
26
|
+
border: 2px solid #ddd;
|
27
|
+
display: inline-block;
|
28
|
+
vertical-align: middle;
|
29
|
+
width: 10px;
|
30
|
+
height: 10px;
|
31
|
+
padding: 2px;
|
32
|
+
margin-right: 10px;
|
33
|
+
text-align: center;
|
34
|
+
}
|
35
|
+
|
36
|
+
.checkbox-custom:checked + .checkbox-custom-label:before {
|
37
|
+
content: "";
|
38
|
+
display: inline-block;
|
39
|
+
width: 1px;
|
40
|
+
height: 5px;
|
41
|
+
border: solid var(--color-brand-smalt);
|
42
|
+
border-width: 0 3px 3px 0;
|
43
|
+
transform: rotate(45deg);
|
44
|
+
-webkit-transform: rotate(45deg);
|
45
|
+
-ms-transform: rotate(45deg);
|
46
|
+
border-radius: 0px;
|
47
|
+
margin: 0px 15px 5px 5px;
|
48
|
+
}
|
49
|
+
|
50
|
+
.checkbox-custom, .checkbox-custom-link {
|
51
|
+
font-weight: var(--font-weight-normal);
|
52
|
+
color: var(--color-primary);
|
53
|
+
text-decoration: underline;
|
54
|
+
}
|
@@ -13,10 +13,12 @@ export default {
|
|
13
13
|
title: 'Atoms/Checkbox',
|
14
14
|
component: Checkbox,
|
15
15
|
args: {
|
16
|
-
id: '
|
17
|
-
name: '
|
16
|
+
id: 'hola',
|
17
|
+
name: 'hola',
|
18
18
|
value: true,
|
19
19
|
label: 'Hola',
|
20
|
+
nameLinkCheck: '',
|
21
|
+
linkCheck: '',
|
20
22
|
},
|
21
23
|
argTypes: {
|
22
24
|
// types: getOptionsArgTypes(options.types),
|
package/atoms/Icon/constants.js
CHANGED
@@ -88,7 +88,7 @@ export const iconsMap = {
|
|
88
88
|
angleUpDown: {
|
89
89
|
viewBox: '0 0 15 15',
|
90
90
|
svg: (
|
91
|
-
<path
|
91
|
+
<path d="M3.6,4.3c-0.3,0.3-0.3,0.7,0,1c0.3,0.3,0.7,0.3,1,0l2.9-2.9l2.9,2.9c0.3,0.3,0.7,0.3,1,0c0.3-0.3,0.3-0.7,0-1
|
92
92
|
L8,0.9C7.9,0.8,7.7,0.7,7.5,0.7C7.3,0.7,7.1,0.8,7,0.9L3.6,4.3z M11.4,10.7c0.3-0.3,0.3-0.7,0-1c-0.3-0.3-0.7-0.3-1,0l-2.9,2.9
|
93
93
|
L4.6,9.7c-0.3-0.3-0.7-0.3-1,0c-0.3,0.3-0.3,0.7,0,1L7,14.1c0.3,0.3,0.7,0.3,1,0L11.4,10.7z"/>
|
94
94
|
),
|
package/atoms/Input/Input.js
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
import Link from 'next/link'
|
4
|
+
|
5
|
+
import styles from './LinkItem.module.css'
|
6
|
+
import { options } from './constants'
|
7
|
+
import withStyles from '../../hocs/withStyles'
|
8
|
+
import Paragraph from '../Paragraph'
|
9
|
+
|
10
|
+
export const LinkItem = ({ children, size, color, getStyles, isHref }) => {
|
11
|
+
return (
|
12
|
+
<Link href={isHref} passHref>
|
13
|
+
<a className={getStyles('link', ['color'])}>
|
14
|
+
<Paragraph size={size} color={color} weight="semibold" isInline>
|
15
|
+
{children}
|
16
|
+
</Paragraph>
|
17
|
+
</a>
|
18
|
+
</Link>
|
19
|
+
)
|
20
|
+
}
|
21
|
+
|
22
|
+
LinkItem.propTypes = {
|
23
|
+
children: PropTypes.node.isRequired,
|
24
|
+
getStyles: PropTypes.func.isRequired,
|
25
|
+
color: PropTypes.oneOf(options.colors),
|
26
|
+
size: PropTypes.oneOf(options.sizes),
|
27
|
+
}
|
28
|
+
|
29
|
+
LinkItem.defaultProps = {
|
30
|
+
getStyles: () => { },
|
31
|
+
color: 'primary',
|
32
|
+
size: 'md',
|
33
|
+
isHref: '/',
|
34
|
+
}
|
35
|
+
|
36
|
+
export default withStyles(styles)(LinkItem)
|
@@ -1,7 +1,7 @@
|
|
1
1
|
.link {
|
2
2
|
display: inline;
|
3
3
|
max-width: max-content;
|
4
|
-
border-bottom: 1px solid currentColor;
|
4
|
+
/* border-bottom: 1px solid currentColor; */
|
5
5
|
cursor: pointer;
|
6
6
|
}
|
7
7
|
|
@@ -12,3 +12,8 @@
|
|
12
12
|
.color-tertiary {
|
13
13
|
color: var(--color-tertiary);
|
14
14
|
}
|
15
|
+
|
16
|
+
.link p {
|
17
|
+
font-weight: var(--font-weight-normal);
|
18
|
+
text-decoration: underline;
|
19
|
+
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import {
|
1
|
+
import { LinkItem, styles, options } from '.'
|
2
2
|
|
3
3
|
import {
|
4
4
|
getTemplate,
|
@@ -6,12 +6,12 @@ import {
|
|
6
6
|
getOptionsArgTypes,
|
7
7
|
} from '../../helpers/storybook'
|
8
8
|
|
9
|
-
const Template = getTemplate(
|
10
|
-
const ListTemplate = getListTemplate(
|
9
|
+
const Template = getTemplate(LinkItem, styles)
|
10
|
+
const ListTemplate = getListTemplate(LinkItem, styles)
|
11
11
|
|
12
12
|
export default {
|
13
|
-
title: 'Atoms/
|
14
|
-
component:
|
13
|
+
title: 'Atoms/LinkItem',
|
14
|
+
component: LinkItem,
|
15
15
|
args: {
|
16
16
|
children: 'Mouths Muil',
|
17
17
|
},
|
File without changes
|
File without changes
|
package/atoms/Modal/Modal.js
CHANGED
@@ -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' : '
|
60
|
+
color={isDesktop && type === 'secondary' ? 'primary' : 'primary'}
|
58
61
|
name={isDesktop ? 'cross' : 'angleLeft'}
|
59
62
|
background={isDesktop ? 'transparent' : 'muted'}
|
60
63
|
onClick={handleClose}
|
@@ -71,6 +74,9 @@ 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
81
|
<Container>{children}</Container>
|
76
82
|
</div>
|
@@ -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:
|
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)
|
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,8 +54,8 @@
|
|
54
54
|
|
55
55
|
@media (min-width: 992px) {
|
56
56
|
.modal {
|
57
|
-
max-width:
|
58
|
-
height:
|
57
|
+
max-width: 465px;
|
58
|
+
height: auto;
|
59
59
|
border-radius: var(--border-radius-sm);
|
60
60
|
}
|
61
61
|
|
@@ -82,4 +82,4 @@
|
|
82
82
|
to {
|
83
83
|
opacity: 0;
|
84
84
|
}
|
85
|
-
}
|
85
|
+
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
const useAddColumn = (event) => {
|
2
|
+
|
3
|
+
let listKeyColumnOrder = []
|
4
|
+
|
5
|
+
event.forEach(element => {
|
6
|
+
listKeyColumnOrder[element.value] = true
|
7
|
+
});
|
8
|
+
|
9
|
+
for (const itemAddColumns of addColumsData) {
|
10
|
+
if (listKeyColumnOrder[itemAddColumns.value]) {
|
11
|
+
itemAddColumns.activeView = true
|
12
|
+
} else {
|
13
|
+
itemAddColumns.activeView = false
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
|
18
|
+
for (const itemEvent of addColumsData) {
|
19
|
+
|
20
|
+
for (const itemColumns of columnsData) {
|
21
|
+
|
22
|
+
if (itemColumns.accessor === itemEvent.value) {
|
23
|
+
|
24
|
+
if (itemEvent.activeView) {
|
25
|
+
itemColumns.activeView = true
|
26
|
+
} else {
|
27
|
+
itemColumns.activeView = false
|
28
|
+
}
|
29
|
+
|
30
|
+
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
}
|
35
|
+
|
36
|
+
setColumnsData([])
|
37
|
+
|
38
|
+
}
|
39
|
+
|
40
|
+
export default useAddColumn
|
@@ -0,0 +1,25 @@
|
|
1
|
+
import { useEffect, useState } from 'react'
|
2
|
+
import {
|
3
|
+
addDays,
|
4
|
+
} from "date-fns";
|
5
|
+
|
6
|
+
const useStateDate = () => {
|
7
|
+
|
8
|
+
const [state, setState] = useState([
|
9
|
+
{
|
10
|
+
startDate: addDays(new Date(), -59),
|
11
|
+
endDate: new Date(),
|
12
|
+
key: 'selection',
|
13
|
+
}
|
14
|
+
]);
|
15
|
+
|
16
|
+
|
17
|
+
useEffect(() => {
|
18
|
+
|
19
|
+
}, [state]);
|
20
|
+
|
21
|
+
|
22
|
+
return { state, setState }
|
23
|
+
}
|
24
|
+
|
25
|
+
export default useStateDate
|
package/hook/useTable.js
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
import { useState, useEffect } from "react";
|
2
|
+
|
3
|
+
const calculateRange = (data, rowsPerPage) => {
|
4
|
+
const range = []
|
5
|
+
if (!data) {
|
6
|
+
var num = Math.ceil(1);
|
7
|
+
} else {
|
8
|
+
num = Math.ceil(data.length / rowsPerPage);
|
9
|
+
|
10
|
+
}
|
11
|
+
|
12
|
+
// const num = Math.ceil(data.length / rowsPerPage);
|
13
|
+
|
14
|
+
// let i = 1;
|
15
|
+
for (let i = 1; i <= num; i++) {
|
16
|
+
range.push(i);
|
17
|
+
}
|
18
|
+
return range;
|
19
|
+
};
|
20
|
+
|
21
|
+
const sliceData = (data, page, rowsPerPage) => {
|
22
|
+
|
23
|
+
if (!data) {
|
24
|
+
return data = [];
|
25
|
+
} else {
|
26
|
+
return data.slice((page - 1) * rowsPerPage, page * rowsPerPage);
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
const useTable = (data, page, rowsPerPage) => {
|
31
|
+
const [tableRange, setTableRange] = useState([]);
|
32
|
+
const [slice, setSlice] = useState([]);
|
33
|
+
|
34
|
+
useEffect(() => {
|
35
|
+
const range = calculateRange(data, rowsPerPage);
|
36
|
+
setTableRange([...range]);
|
37
|
+
|
38
|
+
const slice = sliceData(data, page, rowsPerPage);
|
39
|
+
setSlice([...slice]);
|
40
|
+
}, [data, setTableRange, page, setSlice, rowsPerPage]);
|
41
|
+
|
42
|
+
return { slice, range: tableRange };
|
43
|
+
};
|
44
|
+
|
45
|
+
export default useTable;
|
package/index.js
CHANGED
@@ -24,7 +24,7 @@ export { default as Heading } from './atoms/Heading'
|
|
24
24
|
export { default as Icon } from './atoms/Icon'
|
25
25
|
export { default as Input } from './atoms/Input'
|
26
26
|
export { default as Label } from './atoms/Label'
|
27
|
-
export { default as
|
27
|
+
export { default as LinkItem } from './atoms/LinkItem'
|
28
28
|
export { default as Modal } from './atoms/Modal'
|
29
29
|
export { default as Paragraph } from './atoms/Paragraph'
|
30
30
|
export { default as Picture } from './atoms/Picture'
|
@@ -32,7 +32,6 @@ export { default as Textarea } from './atoms/Textarea'
|
|
32
32
|
export { default as Tab } from './atoms/Tab'
|
33
33
|
|
34
34
|
|
35
|
-
|
36
35
|
// Molecules
|
37
36
|
export { default as Accordion } from './molecules/Accordion'
|
38
37
|
export { default as AddButton } from './molecules/AddButton'
|
@@ -47,9 +46,12 @@ export { default as ItemMenu } from './molecules/ItemMenu'
|
|
47
46
|
export { default as CheckList } from './molecules/CheckList'
|
48
47
|
export { default as ColumnTable } from './molecules/ColumnTable'
|
49
48
|
export { default as RowTable } from './molecules/RowTable'
|
49
|
+
export { default as FooterTable } from './molecules/FooterTable'
|
50
50
|
export { default as DynamicSelect } from './molecules/DynamicSelect'
|
51
51
|
export { default as DatePicker } from './molecules/DynamicSelect'
|
52
52
|
|
53
|
+
export { default as useTable } from './hook/useTable'
|
54
|
+
export { default as useStateDate } from './hook/useStateDate'
|
53
55
|
|
54
56
|
|
55
57
|
|