imbric-theme 0.5.3 → 0.5.5
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/AlertModal/AlertModal.js +15 -7
- package/atoms/Checkbox/Checkbox.js +3 -0
- package/atoms/Label/Label.module.css +4 -0
- package/atoms/Label/constants.js +1 -1
- package/layout/Navbar/Navbar.js +89 -12
- package/molecules/Dropdown/Dropdown.js +1 -1
- package/molecules/RowTable/RowTable.js +19 -4
- package/molecules/RowTable/RowTable.module.css +4 -0
- package/package.json +1 -1
| @@ -7,13 +7,15 @@ import withStyles from '../../hocs/withStyles' | |
| 7 7 | 
             
            import withReactContent from 'sweetalert2-react-content'
         | 
| 8 8 | 
             
            import Swal from 'sweetalert2'
         | 
| 9 9 |  | 
| 10 | 
            -
            export const AlertModal = ({ | 
| 10 | 
            +
            export const AlertModal = ({
         | 
| 11 11 | 
             
              children,
         | 
| 12 12 | 
             
              getStyles,
         | 
| 13 13 | 
             
              titleAlert,
         | 
| 14 14 | 
             
              subTitleAlert,
         | 
| 15 15 | 
             
              iconAlert,
         | 
| 16 16 | 
             
              txtBtnAlert,
         | 
| 17 | 
            +
              txtBtnAlertCancel,
         | 
| 18 | 
            +
              showCancelButton,
         | 
| 17 19 | 
             
              onConfirm,
         | 
| 18 20 | 
             
              onDismiss,
         | 
| 19 21 | 
             
            }) => {
         | 
| @@ -25,9 +27,11 @@ export const AlertModal = ({ | |
| 25 27 | 
             
                icon: iconAlert,
         | 
| 26 28 | 
             
                html: subTitleAlert,
         | 
| 27 29 | 
             
                confirmButtonText: txtBtnAlert,
         | 
| 30 | 
            +
                cancelButtonText: txtBtnAlertCancel,
         | 
| 31 | 
            +
                showCancelButton: showCancelButton,
         | 
| 28 32 | 
             
              }).then((result) => {
         | 
| 29 33 | 
             
                if (result.isConfirmed || (result.isDismissed && !onDismiss)) {
         | 
| 30 | 
            -
                  onConfirm() | 
| 34 | 
            +
                  onConfirm()
         | 
| 31 35 | 
             
                } else if (result.isDismissed) {
         | 
| 32 36 | 
             
                  onDismiss()
         | 
| 33 37 | 
             
                }
         | 
| @@ -41,21 +45,25 @@ AlertModal.propTypes = { | |
| 41 45 | 
             
              children: PropTypes.node,
         | 
| 42 46 | 
             
              getStyles: PropTypes.func.isRequired,
         | 
| 43 47 | 
             
              titleAlert: PropTypes.string.isRequired,
         | 
| 44 | 
            -
              subTitleAlert: | 
| 45 | 
            -
              txtBtnAlert: | 
| 48 | 
            +
              subTitleAlert: PropTypes.string.isRequired,
         | 
| 49 | 
            +
              txtBtnAlert: PropTypes.string.isRequired,
         | 
| 50 | 
            +
              txtBtnAlertCancel: PropTypes.string,
         | 
| 46 51 | 
             
              iconAlert: PropTypes.oneOf(options.icon),
         | 
| 47 52 | 
             
              onConfirm: PropTypes.func,
         | 
| 48 53 | 
             
              onDismiss: PropTypes.func,
         | 
| 54 | 
            +
              showCancelButton: PropTypes.bool,
         | 
| 49 55 | 
             
            }
         | 
| 50 56 |  | 
| 51 57 | 
             
            AlertModal.defaultProps = {
         | 
| 52 | 
            -
              getStyles: () => {},
         | 
| 53 | 
            -
              onConfirm: () => {},
         | 
| 58 | 
            +
              getStyles: () => { },
         | 
| 59 | 
            +
              onConfirm: () => { },
         | 
| 54 60 | 
             
              // onDismiss: () => {}, // Not default for use onConfirm if is undefined
         | 
| 55 61 | 
             
              titleAlert: 'Felicidades!',
         | 
| 56 | 
            -
              subTitleAlert: | 
| 62 | 
            +
              subTitleAlert: 'Todo ha ido correctamente',
         | 
| 57 63 | 
             
              txtBtnAlert: 'Ok',
         | 
| 64 | 
            +
              txtBtnAlertCancel: 'Cancelar',
         | 
| 58 65 | 
             
              iconAlert: 'success',
         | 
| 66 | 
            +
              showCancelButton: false,
         | 
| 59 67 | 
             
            }
         | 
| 60 68 |  | 
| 61 69 | 
             
            export default withStyles(styles)(AlertModal)
         | 
| @@ -13,6 +13,7 @@ export const Checkbox = ({ | |
| 13 13 | 
             
              name,
         | 
| 14 14 | 
             
              linkCheck,
         | 
| 15 15 | 
             
              nameLinkCheck,
         | 
| 16 | 
            +
              handleClick,
         | 
| 16 17 | 
             
            }) => {
         | 
| 17 18 | 
             
              const [checked, setChecked] = useState(value)
         | 
| 18 19 |  | 
| @@ -29,6 +30,7 @@ export const Checkbox = ({ | |
| 29 30 | 
             
                      setChecked(!checked)
         | 
| 30 31 | 
             
                      onChange(e)
         | 
| 31 32 | 
             
                    }}
         | 
| 33 | 
            +
                    onclick={handleClick}
         | 
| 32 34 | 
             
                  />
         | 
| 33 35 | 
             
                  <label htmlFor={name} className={getStyles('checkbox-custom-label')}>
         | 
| 34 36 | 
             
                    {label}
         | 
| @@ -65,6 +67,7 @@ Checkbox.defaultProps = { | |
| 65 67 | 
             
              label: 'Aceptas los terminos',
         | 
| 66 68 | 
             
              nameLinkCheck: '',
         | 
| 67 69 | 
             
              linkCheck: '',
         | 
| 70 | 
            +
              handleClick: () => {},
         | 
| 68 71 | 
             
            }
         | 
| 69 72 |  | 
| 70 73 | 
             
            export default withStyles(styles)(Checkbox)
         | 
    
        package/atoms/Label/constants.js
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            export const options = { colors: ['label', 'base', 'muted', 'inverted', 'primary', 'tertiary'], }
         | 
| 1 | 
            +
            export const options = { colors: ['label', 'base', 'muted', 'inverted', 'primary', 'tertiary', 'info'], }
         | 
    
        package/layout/Navbar/Navbar.js
    CHANGED
    
    | @@ -1,21 +1,31 @@ | |
| 1 | 
            -
            import React from 'react'
         | 
| 1 | 
            +
            import React, { useState } 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 5 | 
             
            import { useRouter } from "next/router";
         | 
| 6 | 
            -
            import  | 
| 7 | 
            -
            import DynamicSelect from '../../molecules/DynamicSelect'
         | 
| 6 | 
            +
            import ReactTooltip from 'react-tooltip'
         | 
| 8 7 |  | 
| 9 8 | 
             
            import Heading from '../../atoms/Heading/Heading'
         | 
| 10 9 | 
             
            import Tabs from '../../molecules/Tabs/Tabs'
         | 
| 11 10 | 
             
            import Icon from '../../atoms/Icon'
         | 
| 12 | 
            -
            import { options } from './constants'
         | 
| 13 11 |  | 
| 14 | 
            -
            export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout,  | 
| 12 | 
            +
            export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkLogout, linkLegal, linkInfo, linkProfile, txtTootipLegal, txtTootipInfo, txtTootipProfile, languageSwitchLink }) => {
         | 
| 15 13 |  | 
| 16 14 |  | 
| 17 15 | 
             
              const router = useRouter();
         | 
| 18 16 |  | 
| 17 | 
            +
              // STATE TOOLTIP
         | 
| 18 | 
            +
              const [isToolTipMounted, setIsToolTipMounted] = useState(false)
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              // TOOLTIP
         | 
| 21 | 
            +
              const handleMouseEnter = () => {
         | 
| 22 | 
            +
                setIsToolTipMounted(true)
         | 
| 23 | 
            +
              }
         | 
| 24 | 
            +
              const handleMouseLeave = () => {
         | 
| 25 | 
            +
                setIsToolTipMounted(false)
         | 
| 26 | 
            +
              }
         | 
| 27 | 
            +
             | 
| 28 | 
            +
             | 
| 19 29 | 
             
              const handleClick = (e, path) => {
         | 
| 20 30 |  | 
| 21 31 | 
             
                console.log("I clicked on the About Page" + path);
         | 
| @@ -28,6 +38,8 @@ export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkL | |
| 28 38 | 
             
              };
         | 
| 29 39 |  | 
| 30 40 |  | 
| 41 | 
            +
             | 
| 42 | 
            +
             | 
| 31 43 | 
             
              return (
         | 
| 32 44 | 
             
                <>
         | 
| 33 45 | 
             
                  <header className={getStyles('navbar')}>
         | 
| @@ -74,19 +86,81 @@ export const Navbar = ({ getStyles, viewTabsNav, viewOptionsNav, children, linkL | |
| 74 86 |  | 
| 75 87 | 
             
                    {viewOptionsNav ? (
         | 
| 76 88 | 
             
                      <div className={getStyles('navbar__actions')}>
         | 
| 77 | 
            -
                        {/* <div className={getStyles('navbar__item')}>Legal</div>
         | 
| 78 | 
            -
                      <div className={getStyles('navbar__item')}>User Guide</div> */}
         | 
| 79 89 |  | 
| 80 | 
            -
             | 
| 90 | 
            +
             | 
| 91 | 
            +
                        <span
         | 
| 92 | 
            +
                          data-tip
         | 
| 93 | 
            +
                          data-for='legal'
         | 
| 94 | 
            +
                          onMouseEnter={handleMouseEnter}
         | 
| 95 | 
            +
                          onMouseLeave={handleMouseLeave}
         | 
| 96 | 
            +
                        >
         | 
| 97 | 
            +
                          <Icon
         | 
| 98 | 
            +
                            size='lg'
         | 
| 99 | 
            +
                            name='legal'
         | 
| 100 | 
            +
                            color='highlight'
         | 
| 101 | 
            +
                            background='transparent'
         | 
| 102 | 
            +
                            onClick={linkLegal}
         | 
| 103 | 
            +
                          />
         | 
| 104 | 
            +
             | 
| 105 | 
            +
                        </span>
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                        {isToolTipMounted ? (
         | 
| 108 | 
            +
                          <ReactTooltip id='legal' type='error'>
         | 
| 109 | 
            +
                            <span>{txtTootipLegal}</span>
         | 
| 110 | 
            +
                          </ReactTooltip>
         | 
| 111 | 
            +
                        ) : null}
         | 
| 112 | 
            +
             | 
| 113 | 
            +
             | 
| 114 | 
            +
             | 
| 115 | 
            +
             | 
| 116 | 
            +
                        <span
         | 
| 117 | 
            +
                          data-tip
         | 
| 118 | 
            +
                          data-for='info'
         | 
| 119 | 
            +
                          onMouseEnter={handleMouseEnter}
         | 
| 120 | 
            +
                          onMouseLeave={handleMouseLeave}
         | 
| 121 | 
            +
                        >
         | 
| 122 | 
            +
                          <Icon
         | 
| 123 | 
            +
                            size='lg'
         | 
| 124 | 
            +
                            name='info'
         | 
| 125 | 
            +
                            color='highlight'
         | 
| 126 | 
            +
                            background='transparent'
         | 
| 127 | 
            +
                            onClick={linkInfo}
         | 
| 128 | 
            +
                          />
         | 
| 129 | 
            +
             | 
| 130 | 
            +
                        </span>
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                        {isToolTipMounted ? (
         | 
| 133 | 
            +
                          <ReactTooltip id='info' type='error'>
         | 
| 134 | 
            +
                            <span>{txtTootipInfo}</span>
         | 
| 135 | 
            +
                          </ReactTooltip>
         | 
| 136 | 
            +
                        ) : null}
         | 
| 137 | 
            +
             | 
| 138 | 
            +
             | 
| 139 | 
            +
             | 
| 140 | 
            +
                        <span
         | 
| 141 | 
            +
                          data-tip
         | 
| 142 | 
            +
                          data-for='profile'
         | 
| 143 | 
            +
                          onMouseEnter={handleMouseEnter}
         | 
| 144 | 
            +
                          onMouseLeave={handleMouseLeave}
         | 
| 145 | 
            +
                        >
         | 
| 81 146 | 
             
                          <Icon
         | 
| 82 | 
            -
                            key={index}
         | 
| 83 147 | 
             
                            size='lg'
         | 
| 84 | 
            -
                            name= | 
| 148 | 
            +
                            name='profile'
         | 
| 85 149 | 
             
                            color='highlight'
         | 
| 86 150 | 
             
                            background='transparent'
         | 
| 87 | 
            -
                            onClick={ | 
| 151 | 
            +
                            onClick={linkProfile}
         | 
| 88 152 | 
             
                          />
         | 
| 89 | 
            -
             | 
| 153 | 
            +
             | 
| 154 | 
            +
                        </span>
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                        {isToolTipMounted ? (
         | 
| 157 | 
            +
                          <ReactTooltip id='profile' type='error'>
         | 
| 158 | 
            +
                            <span>{txtTootipProfile}</span>
         | 
| 159 | 
            +
                          </ReactTooltip>
         | 
| 160 | 
            +
                        ) : null}
         | 
| 161 | 
            +
             | 
| 162 | 
            +
             | 
| 163 | 
            +
             | 
| 90 164 |  | 
| 91 165 | 
             
                        {/* <DynamicSelect
         | 
| 92 166 | 
             
                          isClearable={false}
         | 
| @@ -145,6 +219,9 @@ Navbar.propTypes = { | |
| 145 219 | 
             
              viewTabsNav: PropTypes.bool,
         | 
| 146 220 | 
             
              viewOptionsNav: PropTypes.bool,
         | 
| 147 221 | 
             
              linkLogout: PropTypes.func,
         | 
| 222 | 
            +
              linkLegal: PropTypes.func,
         | 
| 223 | 
            +
              linkInfo: PropTypes.func,
         | 
| 224 | 
            +
              linkProfile: PropTypes.func,
         | 
| 148 225 | 
             
              handleChange: PropTypes.func,
         | 
| 149 226 | 
             
              languageSwitchLink: PropTypes.any.isRequired,
         | 
| 150 227 | 
             
            }
         | 
| @@ -47,7 +47,7 @@ Dropdown.propTypes = { | |
| 47 47 | 
             
                  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
         | 
| 48 48 | 
             
                })
         | 
| 49 49 | 
             
              ).isRequired,
         | 
| 50 | 
            -
              value: PropTypes.oneOfType([PropTypes.string, PropTypes. | 
| 50 | 
            +
              value: PropTypes.oneOfType([PropTypes.string, PropTypes.any]),
         | 
| 51 51 | 
             
              id: PropTypes.string,
         | 
| 52 52 | 
             
              isInline: PropTypes.bool,
         | 
| 53 53 | 
             
            }
         | 
| @@ -122,12 +122,27 @@ export const RowTable = ({ | |
| 122 122 |  | 
| 123 123 | 
             
                                      {item[itemTd.accessor].map((itemTdObj, index, array) => (
         | 
| 124 124 |  | 
| 125 | 
            -
                                         | 
| 125 | 
            +
                                        <>
         | 
| 126 126 |  | 
| 127 | 
            -
                                          { | 
| 128 | 
            -
                                            <span>, </span> : null}
         | 
| 127 | 
            +
                                          <span className={getStyles('tdlabelAlt')} key={itemTdObj.id + 'label'}>
         | 
| 129 128 |  | 
| 130 | 
            -
             | 
| 129 | 
            +
                                            {itemTdObj[itemTd.subAccessorAlt]}
         | 
| 130 | 
            +
             | 
| 131 | 
            +
                                            {array.length - 1 !== index ?
         | 
| 132 | 
            +
                                              <span>, </span> : null}
         | 
| 133 | 
            +
                                            : 
         | 
| 134 | 
            +
                                          </span>
         | 
| 135 | 
            +
             | 
| 136 | 
            +
                                          <span key={itemTdObj.id}>
         | 
| 137 | 
            +
             | 
| 138 | 
            +
                                            {itemTdObj[itemTd.subAccessor]}
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                                            {array.length - 1 !== index ?
         | 
| 141 | 
            +
                                              <span>, </span> : null}
         | 
| 142 | 
            +
             | 
| 143 | 
            +
                                          </span>
         | 
| 144 | 
            +
             | 
| 145 | 
            +
                                        </>
         | 
| 131 146 |  | 
| 132 147 | 
             
                                      ))}
         | 
| 133 148 |  |