imbric-theme 0.3.5 → 0.3.9

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.
@@ -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
- export const Checkbox = ({ getStyles, onChange, label, id, value, name }) => {
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
- type="checkbox"
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
+ &nbsp;{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.string.isRequired,
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: '1',
44
- name: '1',
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: '1',
17
- name: '1',
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),
@@ -20,6 +20,7 @@ export const Input = ({
20
20
  onChange,
21
21
  onClick,
22
22
  placeholder,
23
+ pattern,
23
24
  }) => (
24
25
  <input
25
26
  className={getStyles('input', {
@@ -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 target="_blank" 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 { Link, styles, options } from '.'
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(Link, styles)
10
- const ListTemplate = getListTemplate(Link, styles)
9
+ const Template = getTemplate(LinkItem, styles)
10
+ const ListTemplate = getListTemplate(LinkItem, styles)
11
11
 
12
12
  export default {
13
- title: 'Atoms/Link',
14
- component: Link,
13
+ title: 'Atoms/LinkItem',
14
+ component: LinkItem,
15
15
  args: {
16
16
  children: 'Mouths Muil',
17
17
  },
File without changes
@@ -0,0 +1,3 @@
1
+ export { default, LinkItem } from './LinkItem'
2
+ export { options } from './constants'
3
+ export { default as styles } from './LinkItem.module.css'
@@ -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
+ }
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 Link } from './atoms/Link'
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'
@@ -164,7 +164,7 @@ DynamicTable.defaultProps = {
164
164
  isViewRange: true,
165
165
  isViewAddColumn: true,
166
166
  isViewDownloadDoc: true,
167
- isLayoutDate: 'DateRangePicker',
167
+ isLayoutDate: 'Calendar',
168
168
  handleSelectRange: () => { },
169
169
  handleDownloadExcel: () => { },
170
170
  }
@@ -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
 
@@ -113,12 +115,14 @@ ColumnTable.propTypes = {
113
115
  handleSorting: PropTypes.func.isRequired,
114
116
  getStyles: PropTypes.func.isRequired,
115
117
  columnUppercase: PropTypes.bool,
118
+ onChangeInput: PropTypes.func,
116
119
  }
117
120
 
118
121
  ColumnTable.defaultProps = {
119
122
  getStyles: () => { },
120
123
  handleSorting: () => { },
121
124
  columnUppercase: false,
125
+ onChangeInput: () => { },
122
126
  }
123
127
 
124
128
  export default withStyles(styles)(ColumnTable)
@@ -16,9 +16,9 @@ export default {
16
16
  columnUppercase: false,
17
17
  columnsData: options.columns,
18
18
  },
19
- argTypes: {
20
- // typeInput: getOptionsArgTypes(options.typeInput),
21
- },
19
+ // argTypes: {
20
+ // // typeInput: getOptionsArgTypes(options.typeInput),
21
+ // },
22
22
  }
23
23
 
24
24
  export const Default = Template.bind({})
@@ -43,6 +43,15 @@ export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placehol
43
43
  paddingTop: '2px',
44
44
  }),
45
45
 
46
+ placeholder: (base) => ({
47
+ ...base,
48
+ color: 'var(--color-brand-white-lilac)',
49
+ fontWeight: 'var(--font-weight-light)',
50
+ whiteSpace: 'nowrap',
51
+ overflow: 'hidden',
52
+ textOverflow: 'ellipsis',
53
+ }),
54
+
46
55
  }
47
56
 
48
57
  // const handleChange = (value) => {
@@ -80,7 +89,7 @@ export const DynamicSelect = ({ getStyles, optionsSelect, defaultValue, placehol
80
89
 
81
90
  DynamicSelect.propTypes = {
82
91
  getStyles: PropTypes.func.isRequired,
83
- defaultValue: PropTypes.string,
92
+ defaultValue: PropTypes.object,
84
93
  placeholder: PropTypes.string,
85
94
  isMulti: PropTypes.bool,
86
95
  isClearable: PropTypes.bool,
@@ -94,7 +103,6 @@ DynamicSelect.propTypes = {
94
103
 
95
104
  DynamicSelect.defaultProps = {
96
105
  getStyles: () => { },
97
- defaultValue: '',
98
106
  placeholder: 'seleccionar',
99
107
  isMulti: false,
100
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.5",
3
+ "version": "0.3.9",
4
4
  "description": "Components library IMBRIC",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -1,33 +0,0 @@
1
- import React from 'react'
2
- import PropTypes from 'prop-types'
3
-
4
- import styles from './Link.module.css'
5
- import { options } from './constants'
6
- import withStyles from '../../hocs/withStyles'
7
-
8
- import Paragraph from '../Paragraph'
9
-
10
- export const Link = ({ children, size, color, getStyles }) => {
11
- return (
12
- <a className={getStyles('link', ['color'])}>
13
- <Paragraph size={size} color={color} weight="semibold" isInline>
14
- {children}
15
- </Paragraph>
16
- </a>
17
- )
18
- }
19
-
20
- Link.propTypes = {
21
- children: PropTypes.node.isRequired,
22
- getStyles: PropTypes.func.isRequired,
23
- color: PropTypes.oneOf(options.colors),
24
- size: PropTypes.oneOf(options.sizes),
25
- }
26
-
27
- Link.defaultProps = {
28
- getStyles: () => {},
29
- color: 'primary',
30
- size: 'md',
31
- }
32
-
33
- export default withStyles(styles)(Link)
@@ -1,3 +0,0 @@
1
- export { default, Link } from './Link'
2
- export { options } from './constants'
3
- export { default as styles } from './Link.module.css'