imbric-theme 0.4.8 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,44 +7,29 @@ import withStyles from '../../hocs/withStyles'
7
7
  import withReactContent from 'sweetalert2-react-content'
8
8
  import Swal from 'sweetalert2'
9
9
 
10
- export const handleClickConfirmed = ( resultIsConfirmed ) => {
11
- resultIsConfirmed
12
- }
13
-
14
-
15
- export const AlertModal = ({ children, getStyles, titleAlert, subTitleAlert, iconAlert, txtBtnAlert, resultIsConfirmed, resultIsDenied }) => {
10
+ export const AlertModal = ({
11
+ children,
12
+ getStyles,
13
+ titleAlert,
14
+ subTitleAlert,
15
+ iconAlert,
16
+ txtBtnAlert,
17
+ onConfirm,
18
+ onDismiss,
19
+ }) => {
16
20
 
17
21
  const MySwal = withReactContent(Swal)
18
22
 
19
- // MySwal.fire({
20
- // title: <p>Hello World</p>,
21
- // didOpen: () => {
22
- // // `MySwal` is a subclass of `Swal` with all the same instance & static methods
23
- // MySwal.showLoading()
24
- // },
25
- // }).then(() => {
26
- // return MySwal.fire(<p>Shorthand works too</p>)
27
- // })
28
-
29
- // MySwal.fire(
30
- // 'Good job!',
31
- // 'You clicked the button!',
32
- // 'success'
33
- // )
34
-
35
23
  MySwal.fire({
36
24
  title: titleAlert,
37
25
  icon: iconAlert,
38
26
  html: subTitleAlert,
39
27
  confirmButtonText: txtBtnAlert,
40
28
  }).then((result) => {
41
- /* Read more about isConfirmed, isDenied below */
42
- if (result.isConfirmed) {
43
-
44
- handleClickConfirmed(resultIsConfirmed)
45
-
46
- } else if (result.isDenied) {
47
- resultIsDenied
29
+ if (result.isConfirmed || (result.isDismissed && !onDismiss)) {
30
+ onConfirm()
31
+ } else if (result.isDismissed) {
32
+ onDismiss()
48
33
  }
49
34
  })
50
35
 
@@ -58,20 +43,19 @@ AlertModal.propTypes = {
58
43
  titleAlert: PropTypes.string.isRequired,
59
44
  subTitleAlert: PropTypes.string.isRequired,
60
45
  txtBtnAlert: PropTypes.string.isRequired,
61
- resultIsConfirmed: PropTypes.any,
62
- resultIsDenied: PropTypes.any,
63
46
  iconAlert: PropTypes.oneOf(options.icon),
47
+ onConfirm: PropTypes.func,
48
+ onDismiss: PropTypes.func,
64
49
  }
65
50
 
66
51
  AlertModal.defaultProps = {
67
52
  getStyles: () => {},
53
+ onConfirm: () => {},
54
+ // onDismiss: () => {}, // Not default for use onConfirm if is undefined
68
55
  titleAlert: 'Felicidades!',
69
- subTitleAlert: 'Ejemplo de subtitulo',
70
- txtBtnAlert: 'Aceptar',
56
+ subTitleAlert: 'Todo ha ido correctamente',
57
+ txtBtnAlert: 'Ok',
71
58
  iconAlert: 'success',
72
- // resultIsConfirmed: () => { setModalAlert(false)},
73
- // resultIsConfirmed: (setModalAlert(false)),
74
- // resultIsDenied: '',
75
59
  }
76
60
 
77
61
  export default withStyles(styles)(AlertModal)
@@ -1,43 +1,47 @@
1
- import React from 'react'
1
+ import { useState } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import styles from './Checkbox.module.css'
5
- import { options } from './constants'
6
5
  import withStyles from '../../hocs/withStyles'
7
6
 
8
-
9
- export const Checkbox = ({ getStyles, onChange, label, id, value, name, linkCheck, nameLinkCheck }) => {
10
-
11
- const [checked, setChecked] = React.useState(false);
12
-
7
+ export const Checkbox = ({
8
+ getStyles,
9
+ onChange,
10
+ label,
11
+ id,
12
+ value,
13
+ name,
14
+ linkCheck,
15
+ nameLinkCheck,
16
+ }) => {
17
+ const [checked, setChecked] = useState(value)
13
18
 
14
19
  return (
15
-
16
20
  <div className={getStyles('checkbox')}>
17
-
18
- {/* <input
21
+ <input
22
+ className={getStyles('checkbox-custom')}
19
23
  type="checkbox"
20
24
  id={id}
21
25
  name={name}
22
26
  label={label}
23
- value={value}
24
- onChange={onChange}
27
+ checked={checked}
28
+ onChange={(e) => {
29
+ setChecked(!checked)
30
+ onChange(e)
31
+ }}
25
32
  />
26
- &nbsp;{label} */}
27
-
28
- <input className={getStyles('checkbox-custom')}
29
- type="checkbox"
30
- id={id}
31
- name={name}
32
- label={label}
33
- checked={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
-
33
+ <label htmlFor={name} className={getStyles('checkbox-custom-label')}>
34
+ {label}
35
+ <a
36
+ className={getStyles('checkbox-custom-link')}
37
+ href={linkCheck}
38
+ target="_black"
39
+ >
40
+ {' '}
41
+ {nameLinkCheck}
42
+ </a>{' '}
43
+ </label>
39
44
  </div>
40
-
41
45
  )
42
46
  }
43
47
 
@@ -53,12 +57,12 @@ Checkbox.propTypes = {
53
57
  }
54
58
 
55
59
  Checkbox.defaultProps = {
56
- getStyles: () => { },
57
- onChange: () => { },
58
- id: 'hola',
59
- name: 'hola',
60
+ getStyles: () => {},
61
+ onChange: () => {},
62
+ id: 'checkbox',
63
+ name: 'checkbox',
60
64
  value: true,
61
- label: 'Hola',
65
+ label: 'Aceptas los terminos',
62
66
  nameLinkCheck: '',
63
67
  linkCheck: '',
64
68
  }
@@ -909,9 +909,9 @@ export const iconsMap = {
909
909
  viewBox: '0 0 24 24',
910
910
  svg: (
911
911
  <>
912
- <path class="st0" d="M18.4,8.8c0.9-0.9,0.9-2.3,0-3.2c-0.9-0.9-2.3-0.9-3.2,0c-0.9,0.9-0.9,2.3,0,3.2C16.1,9.7,17.6,9.7,18.4,8.8z
912
+ <path className="st0" d="M18.4,8.8c0.9-0.9,0.9-2.3,0-3.2c-0.9-0.9-2.3-0.9-3.2,0c-0.9,0.9-0.9,2.3,0,3.2C16.1,9.7,17.6,9.7,18.4,8.8z
913
913
  M17.5,6.5c0.4,0.4,0.4,1,0,1.3c-0.4,0.4-1,0.4-1.3,0c-0.4-0.4-0.4-1,0-1.3C16.5,6.1,17.1,6.1,17.5,6.5z"/>
914
- <path class="st0" d="M1.5,12c-0.7,0.7-0.7,1.7,0,2.4l8.1,8.1c0.7,0.7,1.7,0.7,2.4,0L22.5,12c0.3-0.3,0.5-0.7,0.5-1.2V2.7
914
+ <path className="st0" d="M1.5,12c-0.7,0.7-0.7,1.7,0,2.4l8.1,8.1c0.7,0.7,1.7,0.7,2.4,0L22.5,12c0.3-0.3,0.5-0.7,0.5-1.2V2.7
915
915
  C23,1.8,22.2,1,21.3,1h-8.1c-0.4,0-0.9,0.2-1.2,0.5L1.5,12z M11.4,20.7c-0.3,0.3-0.9,0.3-1.2,0l-6.9-6.9c-0.3-0.3-0.3-0.9,0-1.2
916
916
  l9.6-9.6c0.2-0.2,0.4-0.2,0.6-0.2h6.9c0.5,0,0.8,0.4,0.8,0.8v6.9c0,0.2-0.1,0.4-0.2,0.6L11.4,20.7z"/>
917
917
  </>
@@ -935,24 +935,12 @@ export const iconsMap = {
935
935
  ),
936
936
  },
937
937
  firstElement: {
938
- viewBox: '0 0 24 24',
939
- svg: (
940
- <>
941
- <path class="st0" d="M20.4,0H3.6C3.2,0,2.9,0.3,2.9,0.6v22.7c0,0.4,0.3,0.6,0.6,0.6h12.6c0.2,0,0.4-0.1,0.5-0.2l4.3-4.8
942
- c0.1-0.1,0.2-0.3,0.2-0.4V0.6C21.1,0.3,20.8,0,20.4,0z M19,16.8l-3.8,0l0,0c-0.2,0-0.4,0.1-0.5,0.2c-0.1,0.1-0.2,0.3-0.2,0.5
943
- l0,4.8H4.9V1.6H19C19,1.6,19,16.8,19,16.8z"/>
944
- <path class="st0" d="M15.8,13.2h-4v0l1-0.8c1.6-1.4,2.9-2.8,2.9-4.6c0-1.9-1.3-3.4-3.8-3.4c-1.5,0-2.7,0.5-3.5,1.1L9,7.2
945
- c0.6-0.4,1.4-0.9,2.3-0.9c1.2,0,1.8,0.7,1.8,1.6c0,1.3-1.2,2.5-3.5,4.6l-1.4,1.3v1.5h7.6V13.2z"/>
946
- </>
947
- ),
948
- },
949
- secondElement: {
950
938
  viewBox: '0 0 24 24',
951
939
  svg: (
952
940
  <>
953
941
  <g>
954
942
  <g>
955
- <path class="st0" d="M20.4,0H3.6C3.2,0,2.9,0.3,2.9,0.6v22.7c0,0.4,0.3,0.6,0.6,0.6h12.6c0.2,0,0.4-0.1,0.5-0.2l4.3-4.8
943
+ <path className="st0" d="M20.4,0H3.6C3.2,0,2.9,0.3,2.9,0.6v22.7c0,0.4,0.3,0.6,0.6,0.6h12.6c0.2,0,0.4-0.1,0.5-0.2l4.3-4.8
956
944
  c0.1-0.1,0.2-0.3,0.2-0.4V0.6C21.1,0.3,20.8,0,20.4,0z M19,16.8h-3.8l0,0c-0.2,0-0.4,0.1-0.5,0.2s-0.2,0.3-0.2,0.5v4.8H4.9V1.6H19
957
945
  V16.8z"/>
958
946
  </g>
@@ -963,6 +951,18 @@ export const iconsMap = {
963
951
  </>
964
952
  ),
965
953
  },
954
+ secondElement: {
955
+ viewBox: '0 0 24 24',
956
+ svg: (
957
+ <>
958
+ <path className="st0" d="M20.4,0H3.6C3.2,0,2.9,0.3,2.9,0.6v22.7c0,0.4,0.3,0.6,0.6,0.6h12.6c0.2,0,0.4-0.1,0.5-0.2l4.3-4.8
959
+ c0.1-0.1,0.2-0.3,0.2-0.4V0.6C21.1,0.3,20.8,0,20.4,0z M19,16.8l-3.8,0l0,0c-0.2,0-0.4,0.1-0.5,0.2c-0.1,0.1-0.2,0.3-0.2,0.5
960
+ l0,4.8H4.9V1.6H19C19,1.6,19,16.8,19,16.8z"/>
961
+ <path className="st0" d="M15.8,13.2h-4v0l1-0.8c1.6-1.4,2.9-2.8,2.9-4.6c0-1.9-1.3-3.4-3.8-3.4c-1.5,0-2.7,0.5-3.5,1.1L9,7.2
962
+ c0.6-0.4,1.4-0.9,2.3-0.9c1.2,0,1.8,0.7,1.8,1.6c0,1.3-1.2,2.5-3.5,4.6l-1.4,1.3v1.5h7.6V13.2z"/>
963
+ </>
964
+ ),
965
+ },
966
966
 
967
967
  }
968
968
 
@@ -14,7 +14,7 @@ export const Label = ({ children, getStyles, isHint }) => {
14
14
  }
15
15
 
16
16
  Label.propTypes = {
17
- children: PropTypes.string,
17
+ children: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
18
18
  getStyles: PropTypes.func.isRequired,
19
19
  isHint: PropTypes.bool,
20
20
  color: PropTypes.oneOf(options.colors),
@@ -2,10 +2,9 @@ import React, { useState } from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import styles from './Toggle.module.css'
5
- import { options } from './constants'
6
5
  import withStyles from '../../hocs/withStyles'
7
6
 
8
- export const Toggle = ({ getStyles, onChangeCheckbox, value, id, checked, name }) => {
7
+ export const Toggle = ({ getStyles, onChangeCheckbox, disabled, id, checked, name }) => {
9
8
 
10
9
  const [isChecked, setIsChecked] = useState(false);
11
10
 
@@ -20,15 +19,15 @@ export const Toggle = ({ getStyles, onChangeCheckbox, value, id, checked, name }
20
19
  type="checkbox"
21
20
  id={id}
22
21
  name={name}
23
- value={value}
22
+ disabled={disabled}
24
23
  checked={isChecked || checked}
25
24
  onChange={(e) => {
26
25
  handleOnChange()
27
- onChangeCheckbox()
26
+ onChangeCheckbox(e)
28
27
  }}
29
28
  className={getStyles('toggle-item')}
30
29
  />
31
- <label htmlFor={id} className={getStyles('checkbox-custom-label')} for={id}></label>
30
+ <label htmlFor={id} className={getStyles('checkbox-custom-label')}></label>
32
31
 
33
32
 
34
33
  </div>
@@ -40,7 +39,7 @@ Toggle.propTypes = {
40
39
  id: PropTypes.string.isRequired,
41
40
  name: PropTypes.string.isRequired,
42
41
  checked: PropTypes.bool.isRequired,
43
- value: PropTypes.string,
42
+ disabled: PropTypes.bool,
44
43
  }
45
44
 
46
45
  Toggle.defaultProps = {
@@ -49,7 +48,7 @@ Toggle.defaultProps = {
49
48
  id: 'toggle',
50
49
  name: 'toggle',
51
50
  checked: false,
52
- value: 'Hola',
51
+ disabled: false,
53
52
  }
54
53
 
55
54
 
@@ -9,28 +9,26 @@ import Spacer from '../../layout/Spacer'
9
9
  import styles from './Accordion.module.css'
10
10
  import withStyles from '../../hocs/withStyles'
11
11
 
12
- const handleToggle = ({ onToggle, isCollapsed, setIsCollapsed }) => () => {
13
- setIsCollapsed(!isCollapsed)
14
- onToggle(!isCollapsed)
15
- }
16
-
17
12
  export const Accordion = ({
18
13
  title,
19
14
  children,
20
15
  onToggle,
21
16
  getStyles,
22
- defaultIsCollapsed,
17
+ collapsed,
23
18
  idAccordion,
24
19
  addons,
25
20
  }) => {
26
- const [isCollapsed, setIsCollapsed] = useState(defaultIsCollapsed)
21
+ const [isCollapsed, setIsCollapsed] = useState(collapsed)
27
22
 
28
23
  return (
29
24
  <div className={getStyles('accordion')}>
30
25
  <div
31
- id={idAccordion}
26
+ id={idAccordion}
32
27
  className={getStyles('container')}
33
- onClick={handleToggle({ onToggle, isCollapsed, setIsCollapsed })}
28
+ onClick={() => {
29
+ setIsCollapsed(!isCollapsed)
30
+ onToggle(!isCollapsed)
31
+ }}
34
32
  >
35
33
  <Icon
36
34
  color="inverted"
@@ -53,9 +51,9 @@ export const Accordion = ({
53
51
  Accordion.propTypes = {
54
52
  title: PropTypes.string.isRequired,
55
53
  getStyles: PropTypes.func.isRequired,
54
+ collapsed: PropTypes.bool.isRequired,
56
55
  children: PropTypes.node,
57
56
  onToggle: PropTypes.func,
58
- defaultIsCollapsed: PropTypes.bool,
59
57
  addons: PropTypes.shape({
60
58
  prepend: PropTypes.node,
61
59
  append: PropTypes.node,
@@ -63,10 +61,10 @@ Accordion.propTypes = {
63
61
  }
64
62
 
65
63
  Accordion.defaultProps = {
64
+ title: '',
66
65
  getStyles: () => {},
66
+ collapsed: true,
67
67
  onToggle: () => {},
68
- current: 0,
69
- defaultIsCollapsed: true,
70
68
  }
71
69
 
72
70
  export default withStyles(styles)(Accordion)
@@ -329,7 +329,7 @@ export const RowTable = ({
329
329
 
330
330
  RowTable.propTypes = {
331
331
  getStyles: PropTypes.func.isRequired,
332
- type: PropTypes.oneOf(options.types),
332
+ type: PropTypes.oneOf(options.types || []),
333
333
  isClickRow: PropTypes.bool,
334
334
  onClickRow: PropTypes.func,
335
335
  onClickCheckbox: PropTypes.func,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "imbric-theme",
3
- "version": "0.4.8",
3
+ "version": "0.5.0",
4
4
  "description": "Components library IMBRIC",
5
5
  "private": false,
6
6
  "main": "index.js",
@@ -59,7 +59,6 @@
59
59
  "react-moment": "1.1.2",
60
60
  "react-router": "6.3.0",
61
61
  "react-router-dom": "6.3.0",
62
- "react-search-autocomplete": "7.2.2",
63
62
  "react-select": "5.3.2",
64
63
  "react-spinners": "0.13.4",
65
64
  "react-tooltip": "4.4.0",