imbric-theme 0.1.1 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (208) hide show
  1. package/.dockerignore +14 -0
  2. package/.eslintignore +1 -0
  3. package/.prettierignore +1 -0
  4. package/.storybook/main.js +6 -2
  5. package/.storybook/preview.js +21 -0
  6. package/.vscode/settings.json +3 -0
  7. package/Dockerfile +17 -0
  8. package/README.md +2 -2
  9. package/atoms/AlertModal/AlertModal.js +69 -0
  10. package/atoms/AlertModal/AlertModal.module.css +3 -0
  11. package/atoms/AlertModal/AlertModal.stories.js +30 -0
  12. package/atoms/AlertModal/constants.js +4 -0
  13. package/atoms/AlertModal/index.js +3 -0
  14. package/atoms/Button/Button.js +17 -2
  15. package/atoms/Button/Button.module.css +25 -3
  16. package/atoms/Button/Button.stories.js +1 -1
  17. package/atoms/Button/__snapshots__/Button.stories.js.snap +8 -8
  18. package/atoms/Check/Check.js +6 -4
  19. package/atoms/Checkbox/Checkbox.js +77 -0
  20. package/atoms/Checkbox/Checkbox.module.css +60 -0
  21. package/atoms/Checkbox/Checkbox.stories.js +30 -0
  22. package/atoms/Checkbox/constants.js +1 -0
  23. package/atoms/Checkbox/index.js +3 -0
  24. package/atoms/Divider/Divider.js +5 -2
  25. package/atoms/Divider/Divider.module.css +20 -0
  26. package/atoms/Divider/Divider.stories.js +13 -2
  27. package/atoms/Divider/constants.js +3 -0
  28. package/atoms/Divider/index.js +1 -0
  29. package/atoms/Heading/Heading.js +1 -1
  30. package/atoms/Heading/Heading.module.css +4 -0
  31. package/atoms/Heading/Heading.stories.js +2 -2
  32. package/atoms/Heading/__snapshots__/Heading.stories.js.snap +16 -16
  33. package/atoms/Heading/constants.js +1 -1
  34. package/atoms/Icon/Icon.js +1 -1
  35. package/atoms/Icon/Icon.module.css +30 -0
  36. package/atoms/Icon/constants.js +750 -145
  37. package/atoms/Input/Input.js +195 -15
  38. package/atoms/Input/Input.module.css +62 -6
  39. package/atoms/Input/Input.stories.js +8 -2
  40. package/atoms/Input/__snapshots__/Input.stories.js.snap +5 -5
  41. package/atoms/Input/constants.js +1 -1
  42. package/atoms/Label/Label.js +31 -0
  43. package/atoms/Label/Label.module.css +42 -0
  44. package/atoms/Label/Label.stories.js +26 -0
  45. package/atoms/Label/constants.js +1 -0
  46. package/atoms/Label/index.js +3 -0
  47. package/atoms/LinkItem/LinkItem.js +38 -0
  48. package/atoms/{Link/Link.module.css → LinkItem/LinkItem.module.css} +6 -1
  49. package/atoms/{Link/Link.stories.js → LinkItem/LinkItem.stories.js} +5 -5
  50. package/atoms/LinkItem/index.js +3 -0
  51. package/atoms/Modal/Modal.js +27 -4
  52. package/atoms/Modal/Modal.module.css +63 -6
  53. package/atoms/Paragraph/Paragraph.module.css +4 -0
  54. package/atoms/Paragraph/Paragraph.stories.js +2 -2
  55. package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +16 -16
  56. package/atoms/Picture/Picture.js +9 -2
  57. package/atoms/Tab/Tab.js +41 -0
  58. package/atoms/Tab/Tab.module.css +17 -0
  59. package/atoms/Tab/Tab.stories.js +27 -0
  60. package/atoms/Tab/constants.js +1 -0
  61. package/atoms/Tab/index.js +3 -0
  62. package/atoms/Textarea/Textarea.js +106 -15
  63. package/atoms/Textarea/Textarea.module.css +31 -2
  64. package/atoms/Toggle/Toggle.js +56 -0
  65. package/atoms/Toggle/Toggle.module.css +41 -0
  66. package/atoms/Toggle/Toggle.stories.js +21 -0
  67. package/atoms/Toggle/constants.js +1 -0
  68. package/atoms/Toggle/index.js +3 -0
  69. package/helpers/storybook.js +2 -2
  70. package/hook/useAddColumn.js +40 -0
  71. package/hook/useStateDate.js +25 -0
  72. package/hook/useTable.js +54 -0
  73. package/index.js +41 -1
  74. package/jest.config.js +1 -1
  75. package/layout/DynamicTable/DynamicTable.js +372 -0
  76. package/layout/DynamicTable/DynamicTable.module.css +62 -0
  77. package/layout/DynamicTable/DynamicTable.stories.js +79 -0
  78. package/layout/DynamicTable/constants.js +323 -0
  79. package/layout/DynamicTable/index.js +3 -0
  80. package/layout/FlexColumnContent/FlexColumnContent.js +26 -0
  81. package/layout/FlexColumnContent/FlexColumnContent.module.css +5 -0
  82. package/layout/FlexColumnContent/FlexColumnContent.stories.js +28 -0
  83. package/layout/FlexColumnContent/constants.js +1 -0
  84. package/layout/FlexColumnContent/index.js +3 -0
  85. package/layout/Navbar/Navbar.js +247 -0
  86. package/layout/Navbar/Navbar.module.css +35 -0
  87. package/layout/Navbar/Navbar.stories.js +20 -0
  88. package/layout/Navbar/constants.js +35 -0
  89. package/layout/Navbar/index.js +2 -0
  90. package/layout/Sidebar/Sidebar.js +115 -0
  91. package/layout/Sidebar/Sidebar.module.css +387 -0
  92. package/layout/Sidebar/Sidebar.stories.js +28 -0
  93. package/layout/Sidebar/constants.js +228 -0
  94. package/layout/Sidebar/index.js +3 -0
  95. package/molecules/Accordion/Accordion.js +11 -11
  96. package/molecules/CardDefault/CardDefault.js +65 -0
  97. package/molecules/CardDefault/CardDefault.module.css +19 -0
  98. package/molecules/CardDefault/CardDefault.stories.js +23 -0
  99. package/molecules/CardDefault/constants.js +1 -0
  100. package/molecules/CardDefault/index.js +3 -0
  101. package/molecules/CardProductTypesBooking/CardProductTypesBooking.js +89 -0
  102. package/molecules/CardProductTypesBooking/CardProductTypesBooking.module.css +118 -0
  103. package/molecules/CardProductTypesBooking/CardProductTypesBooking.stories.js +25 -0
  104. package/molecules/CardProductTypesBooking/constants.js +1 -0
  105. package/molecules/CardProductTypesBooking/index.js +3 -0
  106. package/molecules/CardServiceDetail/CardServiceDetail.js +400 -0
  107. package/molecules/CardServiceDetail/CardServiceDetail.module.css +222 -0
  108. package/molecules/CardServiceDetail/CardServiceDetail.stories.js +23 -0
  109. package/molecules/CardServiceDetail/constants.js +1 -0
  110. package/molecules/CardServiceDetail/index.js +3 -0
  111. package/molecules/CardServices/CardServices.js +461 -0
  112. package/molecules/CardServices/CardServices.module.css +213 -0
  113. package/molecules/CardServices/CardServices.stories.js +41 -0
  114. package/molecules/CardServices/constants.js +5 -0
  115. package/molecules/CardServices/index.js +3 -0
  116. package/molecules/CardServicesFinalized/CardServicesFinalized.js +381 -0
  117. package/molecules/CardServicesFinalized/CardServicesFinalized.module.css +213 -0
  118. package/molecules/CardServicesFinalized/CardServicesFinalized.stories.js +23 -0
  119. package/molecules/CardServicesFinalized/constants.js +1 -0
  120. package/molecules/CardServicesFinalized/index.js +3 -0
  121. package/molecules/CheckList/CheckList.js +135 -0
  122. package/molecules/CheckList/CheckList.module.css +94 -0
  123. package/molecules/CheckList/CheckList.stories.js +25 -0
  124. package/molecules/CheckList/constants.js +23 -0
  125. package/molecules/CheckList/index.js +3 -0
  126. package/molecules/ColumnTable/ColumnTable.js +155 -0
  127. package/molecules/ColumnTable/ColumnTable.module.css +51 -0
  128. package/molecules/ColumnTable/ColumnTable.stories.js +26 -0
  129. package/molecules/ColumnTable/constants.js +117 -0
  130. package/molecules/ColumnTable/index.js +3 -0
  131. package/molecules/DatePicker/DatePicker.js +242 -0
  132. package/molecules/DatePicker/DatePicker.module.css +38 -0
  133. package/molecules/DatePicker/DatePicker.stories.js +23 -0
  134. package/molecules/DatePicker/constants.js +3 -0
  135. package/molecules/DatePicker/index.js +3 -0
  136. package/molecules/DatePickerTime/DatePickerTime.js +133 -0
  137. package/molecules/DatePickerTime/DatePickerTime.module.css +3 -0
  138. package/molecules/DatePickerTime/DatePickerTime.stories.js +18 -0
  139. package/molecules/DatePickerTime/constants.js +1 -0
  140. package/molecules/DatePickerTime/index.js +3 -0
  141. package/molecules/Dropdown/Dropdown.js +26 -23
  142. package/molecules/Dropdown/Dropdown.module.css +21 -3
  143. package/molecules/DynamicSelect/DynamicSelect.js +186 -0
  144. package/molecules/DynamicSelect/DynamicSelect.module.css +10 -0
  145. package/molecules/DynamicSelect/DynamicSelect.stories.js +32 -0
  146. package/molecules/DynamicSelect/constants.js +7 -0
  147. package/molecules/DynamicSelect/index.js +3 -0
  148. package/molecules/Error/Error.js +2 -2
  149. package/molecules/Error/Error.module.css +3 -2
  150. package/molecules/FooterTable/FooterTable.js +166 -0
  151. package/molecules/FooterTable/FooterTable.module.css +63 -0
  152. package/molecules/FooterTable/FooterTable.stories.js +23 -0
  153. package/molecules/FooterTable/constants.js +9 -0
  154. package/molecules/FooterTable/index.js +3 -0
  155. package/molecules/InputAutocomplete/InputAutocomplete.js +221 -0
  156. package/molecules/InputAutocomplete/InputAutocomplete.module.css +55 -0
  157. package/molecules/InputAutocomplete/InputAutocomplete.stories.js +23 -0
  158. package/molecules/InputAutocomplete/constants.js +1 -0
  159. package/molecules/InputAutocomplete/index.js +3 -0
  160. package/molecules/ItemMenu/ItemMenu.js +134 -0
  161. package/molecules/ItemMenu/ItemMenu.module.css +363 -0
  162. package/molecules/ItemMenu/ItemMenu.stories.js +42 -0
  163. package/molecules/ItemMenu/constants.js +36 -0
  164. package/molecules/ItemMenu/index.js +3 -0
  165. package/molecules/RowTable/RowTable.js +928 -0
  166. package/molecules/RowTable/RowTable.module.css +63 -0
  167. package/molecules/RowTable/RowTable.stories.js +26 -0
  168. package/molecules/RowTable/constants.js +798 -0
  169. package/molecules/RowTable/index.js +3 -0
  170. package/molecules/Tabs/Tabs.js +59 -0
  171. package/molecules/Tabs/Tabs.module.css +13 -0
  172. package/molecules/Tabs/Tabs.stories.js +34 -0
  173. package/molecules/Tabs/constants.js +34 -0
  174. package/molecules/Tabs/index.js +3 -0
  175. package/package.json +34 -17
  176. package/pages/Login/Login.js +102 -0
  177. package/pages/Login/Login.module.css +5 -0
  178. package/pages/Login/Login.stories.js +23 -0
  179. package/pages/Login/constants.js +1 -0
  180. package/pages/Login/index.js +3 -0
  181. package/pages/Login/validation/loginSchema.js +5 -0
  182. package/public/favicon.ico +0 -0
  183. package/public/static/google-maps.png +0 -0
  184. package/public/static/images/folders-folder.svg +26 -0
  185. package/public/static/images/permissions.svg +14 -0
  186. package/public/static/images/reports-results.svg +18 -0
  187. package/public/static/logo.svg +19 -0
  188. package/public/static/logologin.png +0 -0
  189. package/public/static/logologin.svg +16 -0
  190. package/public/static/logologintagos.svg +19 -0
  191. package/public/static/logotipo.svg +50 -0
  192. package/public/static/logotipoS.svg +26 -0
  193. package/public/static/taxisvalencia_logod.png +0 -0
  194. package/scripts/create-component.js +2 -1
  195. package/styles/GrupoMutua.css +391 -0
  196. package/styles/default.css +391 -0
  197. package/styles/globals.css +1514 -0
  198. package/styles/radiotaxiaragon.css +391 -0
  199. package/styles/spartan.css +391 -0
  200. package/styles/tagos.css +391 -0
  201. package/styles/taxisvalencia.css +391 -0
  202. package/styles/tokens.css +2 -1
  203. package/tokens/index.js +2 -1
  204. package/.eslintcache +0 -1
  205. package/atoms/Link/Link.js +0 -33
  206. package/atoms/Link/index.js +0 -3
  207. /package/atoms/{Link → LinkItem}/__snapshots__/Link.stories.js.snap +0 -0
  208. /package/atoms/{Link → LinkItem}/constants.js +0 -0
package/.dockerignore ADDED
@@ -0,0 +1,14 @@
1
+ # Config folders
2
+ .idea/
3
+ .vscode/
4
+
5
+ # Generated by MacOS
6
+ .DS_Store
7
+
8
+ # Generated by Windows
9
+ Thumbs.db
10
+
11
+ # Cache & build files
12
+ node_modules/
13
+ storybook-static/
14
+ .eslintcache
package/.eslintignore ADDED
@@ -0,0 +1 @@
1
+ node_modules
@@ -0,0 +1 @@
1
+ node_modules
@@ -3,7 +3,11 @@ const cssModules = require('../webpack/cssModules')
3
3
  const reactInlineSvg = require('../webpack/reactInlineSvg')
4
4
 
5
5
  module.exports = {
6
- stories: ['../{tokens,atoms,molecules,layout}/**/*.stories.@(js|mdx)'],
7
- addons: ['@storybook/addon-links', '@storybook/addon-essentials'],
6
+ stories: ['../{tokens,atoms,molecules,layout,pages}/**/*.stories.@(js|mdx)'],
7
+ addons: ['@storybook/addon-links', '@storybook/addon-essentials', 'storybook-addon-theme-changer'],
8
+ staticDirs: ['../public'],
8
9
  webpackFinal: loadConfigs([cssModules, reactInlineSvg]),
10
+ features: {
11
+ postcss: false,
12
+ },
9
13
  }
@@ -3,6 +3,13 @@ import React from 'react'
3
3
  import 'minireset.css'
4
4
  import '../styles/globals.css'
5
5
  import '../styles/tokens.css'
6
+ import '../styles/GrupoMutua.css'
7
+ import '../styles/taxisvalencia.css'
8
+ import '../styles/radiotaxiaragon.css'
9
+ import '../styles/spartan.css'
10
+ import '../styles/default.css'
11
+ import '../styles/tagos.css'
12
+
6
13
 
7
14
  const getStyles = ({ __sb } = {}) => ({
8
15
  display: 'flex',
@@ -30,3 +37,17 @@ export const parameters = {
30
37
  },
31
38
  actions: { argTypesRegex: '^on[A-Z].*' },
32
39
  }
40
+
41
+ export const globalTypes = {
42
+ themes: {
43
+ defaultValue: [
44
+ "Imbric",
45
+ "Default",
46
+ "GrupoMutua",
47
+ "Taxisvalencia",
48
+ "Radiotaxiaragon",
49
+ "Spartan",
50
+ "Tagos",
51
+ ],
52
+ }
53
+ }
@@ -0,0 +1,3 @@
1
+ {
2
+ "editor.formatOnSave": true
3
+ }
package/Dockerfile ADDED
@@ -0,0 +1,17 @@
1
+ FROM node:18-alpine
2
+
3
+ ## set environment stage
4
+ ENV PATH /app/node_modules/.bin:$PATH
5
+ ENV NODE_OPTIONS --openssl-legacy-provider
6
+ WORKDIR /app
7
+ COPY . /app/
8
+
9
+ ## build app stage
10
+ RUN yarn install --network-timeout 200000 \
11
+ && yarn build
12
+
13
+ ## final image stage
14
+ FROM nginx:alpine
15
+ COPY --from=0 /app/storybook-static/ /usr/share/nginx/html/
16
+
17
+ EXPOSE 80
package/README.md CHANGED
@@ -16,11 +16,11 @@
16
16
 
17
17
  _Using NPM_
18
18
  ```bash
19
- npm install ....
19
+ npm install imbric-theme
20
20
  ```
21
21
  _Using Yarn_
22
22
  ```bash
23
- yarn add ....
23
+ yarn add imbric-theme
24
24
  ```
25
25
 
26
26
  #### 2. Using the library
@@ -0,0 +1,69 @@
1
+ import React from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './AlertModal.module.css'
5
+ import { options } from './constants'
6
+ import withStyles from '../../hocs/withStyles'
7
+ import withReactContent from 'sweetalert2-react-content'
8
+ import Swal from 'sweetalert2'
9
+
10
+ export const AlertModal = ({
11
+ children,
12
+ getStyles,
13
+ titleAlert,
14
+ subTitleAlert,
15
+ iconAlert,
16
+ txtBtnAlert,
17
+ txtBtnAlertCancel,
18
+ showCancelButton,
19
+ onConfirm,
20
+ onDismiss,
21
+ }) => {
22
+
23
+ const MySwal = withReactContent(Swal)
24
+
25
+ MySwal.fire({
26
+ title: titleAlert,
27
+ icon: iconAlert,
28
+ html: subTitleAlert,
29
+ confirmButtonText: txtBtnAlert,
30
+ cancelButtonText: txtBtnAlertCancel,
31
+ showCancelButton: showCancelButton,
32
+ }).then((result) => {
33
+ if (result.isConfirmed || (result.isDismissed && !onDismiss)) {
34
+ onConfirm()
35
+ } else if (result.isDismissed) {
36
+ onDismiss()
37
+ }
38
+ })
39
+
40
+
41
+ return <div className={getStyles('alert-modal')}>{children}</div>
42
+ }
43
+
44
+ AlertModal.propTypes = {
45
+ children: PropTypes.node,
46
+ getStyles: PropTypes.func.isRequired,
47
+ titleAlert: PropTypes.string.isRequired,
48
+ subTitleAlert: PropTypes.string.isRequired,
49
+ txtBtnAlert: PropTypes.string.isRequired,
50
+ txtBtnAlertCancel: PropTypes.string,
51
+ iconAlert: PropTypes.oneOf(options.icon),
52
+ onConfirm: PropTypes.func,
53
+ onDismiss: PropTypes.func,
54
+ showCancelButton: PropTypes.bool,
55
+ }
56
+
57
+ AlertModal.defaultProps = {
58
+ getStyles: () => { },
59
+ onConfirm: () => { },
60
+ // onDismiss: () => {}, // Not default for use onConfirm if is undefined
61
+ titleAlert: 'Felicidades!',
62
+ subTitleAlert: 'Todo ha ido correctamente',
63
+ txtBtnAlert: 'Ok',
64
+ txtBtnAlertCancel: 'Cancelar',
65
+ iconAlert: 'success',
66
+ showCancelButton: false,
67
+ }
68
+
69
+ export default withStyles(styles)(AlertModal)
@@ -0,0 +1,3 @@
1
+ .alert-modal {
2
+ display: flex;
3
+ }
@@ -0,0 +1,30 @@
1
+ import { AlertModal, styles, options } from '.'
2
+ options
3
+
4
+ import {
5
+ getTemplate,
6
+ getListTemplate,
7
+ getOptionsArgTypes,
8
+ } from '../../helpers/storybook'
9
+
10
+ const Template = getTemplate(AlertModal, styles)
11
+ const ListTemplate = getListTemplate(AlertModal, styles)
12
+
13
+ export default {
14
+ title: 'Atoms/AlertModal',
15
+ component: AlertModal,
16
+ args: {
17
+ titleAlert: 'Felicidades!',
18
+ subTitleAlert: 'Ejemplo de subtitulo',
19
+ txtBtnAlert: 'Aceptar',
20
+ // resultIsConfirmed: true,
21
+ // resultIsDenied: '',
22
+ },
23
+ argTypes: {
24
+ iconAlert: getOptionsArgTypes(options.icon),
25
+ },
26
+ }
27
+
28
+ export const Default = Template.bind({})
29
+ // export const List = ListTemplate.bind({})
30
+ // List.args = { items: options.types.map((type) => ({ type })) }
@@ -0,0 +1,4 @@
1
+ export const options = {
2
+ icon: ['success', 'error', 'warning', 'info', 'question'],
3
+ }
4
+
@@ -0,0 +1,3 @@
1
+ export { default, AlertModal } from './AlertModal'
2
+ export { options } from './constants'
3
+ export { default as styles } from './AlertModal.module.css'
@@ -20,13 +20,21 @@ export const Button = ({
20
20
  addons,
21
21
  isMuted,
22
22
  isInline,
23
+ isFloatRight,
24
+ isFloatLeft,
23
25
  onClick,
26
+ id,
24
27
  getStyles,
25
28
  }) => (
26
29
  <button
30
+ id={id}
31
+ type="submit"
32
+ disabled={isMuted}
27
33
  className={getStyles('button', ['type'], {
28
34
  'is-inline': isInline || type === 'tertiary',
29
35
  'is-muted': isMuted && type === 'primary',
36
+ 'is-float-right': isFloatRight,
37
+ 'is-float-left': isFloatLeft,
30
38
  })}
31
39
  onClick={onClick && handleClick({ onClick })}
32
40
  >
@@ -37,6 +45,7 @@ export const Button = ({
37
45
  isCentered
38
46
  isInline={isObject(addons) && !isEmpty(addons)}
39
47
  weight={'light'}
48
+ size={'xs'}
40
49
  >
41
50
  {children}
42
51
  </Heading>
@@ -56,13 +65,19 @@ Button.propTypes = {
56
65
  onClick: PropTypes.func,
57
66
  isInline: PropTypes.bool,
58
67
  isMuted: PropTypes.bool,
68
+ isFloatRight: PropTypes.bool,
69
+ isFloatLeft: PropTypes.bool,
70
+ id: PropTypes.string,
59
71
  }
60
72
 
61
73
  Button.defaultProps = {
62
74
  type: 'primary',
63
- getStyles: () => {},
64
- onClick: () => {},
75
+ getStyles: () => { },
76
+ onClick: () => { },
65
77
  isInline: false,
78
+ isFloatRight: false,
79
+ isFloatLeft: false,
80
+ id: '',
66
81
  }
67
82
 
68
83
  export default withStyles(styles)(Button)
@@ -2,10 +2,10 @@
2
2
  display: inline-flex;
3
3
  width: 100%;
4
4
  min-width: max-content;
5
- height: 45px;
5
+ height: 40px;
6
6
  align-items: center;
7
7
  justify-content: center;
8
- padding: 20px 30px;
8
+ padding: 12px 30px;
9
9
  border: var(--border-width-thin) solid var(--color-base-transparent);
10
10
  border-radius: var(--button-border-radius-none);
11
11
  box-shadow: var(--box-shadow-sm);
@@ -13,6 +13,17 @@
13
13
  transition: filter 0.5s ease, box-shadow 0.2s ease-in;
14
14
  }
15
15
 
16
+ [data-theme="GrupoMutua"] .button {
17
+ border-radius: var(--button-border-radius-sm);
18
+ }
19
+
20
+ [data-theme="Taxisvalencia"] .button,
21
+ [data-theme="Radiotaxiaragon"] .button,
22
+ [data-theme="Spartan"] .button,
23
+ [data-theme="Default"] .button {
24
+ border-radius: var(--button-border-radius-sm);
25
+ }
26
+
16
27
  .button:focus {
17
28
  box-shadow: 0 0 0 1px var(--color-primary), 0 0 10px 0 var(--color-primary);
18
29
  outline: none;
@@ -59,5 +70,16 @@
59
70
  }
60
71
 
61
72
  .is-muted {
62
- background: var(--color-primary-muted);
73
+ background: var(--color-font-muted);
74
+ cursor: default;
75
+ box-shadow: var(--box-shadow-none) !important;
76
+ filter: brightness(1) !important;
63
77
  }
78
+
79
+ .is-float-right {
80
+ float: right;
81
+ }
82
+
83
+ .is-float-left {
84
+ float: left;
85
+ }
@@ -12,7 +12,7 @@ export default {
12
12
  title: 'Atoms/Button',
13
13
  component: Button,
14
14
  args: {
15
- children: 'You Shall Not Pass!',
15
+ children: 'Sed ut perspiciatis unde!',
16
16
  },
17
17
  argTypes: {
18
18
  type: getOptionsArgTypes(options.types),
@@ -22,7 +22,7 @@ exports[`Storyshots Atoms/Button Addon Append 1`] = `
22
22
  <h1
23
23
  className="heading color-inverted size-md weight-light is-centered is-inline"
24
24
  >
25
- You Shall Not Pass!
25
+ Sed ut perspiciatis unde!
26
26
  </h1>
27
27
  But ill-tempered Thengel.
28
28
  </button>
@@ -52,7 +52,7 @@ exports[`Storyshots Atoms/Button Addon Prepend 1`] = `
52
52
  <h1
53
53
  className="heading color-inverted size-md weight-light is-centered is-inline"
54
54
  >
55
- You Shall Not Pass!
55
+ Sed ut perspiciatis unde!
56
56
  </h1>
57
57
  </button>
58
58
  </div>
@@ -80,7 +80,7 @@ exports[`Storyshots Atoms/Button Default 1`] = `
80
80
  <h1
81
81
  className="heading color-inverted size-md weight-light is-centered"
82
82
  >
83
- You Shall Not Pass!
83
+ Sed ut perspiciatis unde!
84
84
  </h1>
85
85
  </button>
86
86
  </div>
@@ -108,7 +108,7 @@ exports[`Storyshots Atoms/Button Inline 1`] = `
108
108
  <h1
109
109
  className="heading color-inverted size-md weight-light is-centered"
110
110
  >
111
- You Shall Not Pass!
111
+ Sed ut perspiciatis unde!
112
112
  </h1>
113
113
  </button>
114
114
  </div>
@@ -136,7 +136,7 @@ exports[`Storyshots Atoms/Button Muted 1`] = `
136
136
  <h1
137
137
  className="heading color-inverted size-md weight-light is-centered"
138
138
  >
139
- You Shall Not Pass!
139
+ Sed ut perspiciatis unde!
140
140
  </h1>
141
141
  </button>
142
142
  </div>
@@ -164,7 +164,7 @@ exports[`Storyshots Atoms/Button Types 1`] = `
164
164
  <h1
165
165
  className="heading color-inverted size-md weight-light is-centered"
166
166
  >
167
- You Shall Not Pass!
167
+ Sed ut perspiciatis unde!
168
168
  </h1>
169
169
  </button>
170
170
  <button
@@ -174,7 +174,7 @@ exports[`Storyshots Atoms/Button Types 1`] = `
174
174
  <h1
175
175
  className="heading color-primary size-md weight-light is-centered"
176
176
  >
177
- You Shall Not Pass!
177
+ Sed ut perspiciatis unde!
178
178
  </h1>
179
179
  </button>
180
180
  <button
@@ -184,7 +184,7 @@ exports[`Storyshots Atoms/Button Types 1`] = `
184
184
  <h1
185
185
  className="heading color-primary size-md weight-light is-centered"
186
186
  >
187
- You Shall Not Pass!
187
+ Sed ut perspiciatis unde!
188
188
  </h1>
189
189
  </button>
190
190
  </div>
@@ -6,21 +6,23 @@ import Icon from '../Icon'
6
6
  import styles from './Check.module.css'
7
7
  import withStyles from '../../hocs/withStyles'
8
8
 
9
- export const Check = ({ isChecked, getStyles }) => {
9
+ export const Check = ({ isChecked, getStyles, onClickChecked }) => {
10
10
  return isChecked ? (
11
- <Icon name="checkCircle" color="muted" isClickable />
11
+ <Icon name="checkCircle" color="muted" isClickable onClick={onClickChecked} />
12
12
  ) : (
13
- <span className={getStyles('check')} />
13
+ <span onClick={onClickChecked} className={getStyles('check')} />
14
14
  )
15
15
  }
16
16
 
17
17
  Check.propTypes = {
18
18
  getStyles: PropTypes.func.isRequired,
19
19
  isChecked: PropTypes.bool,
20
+ onClickChecked: PropTypes.func,
20
21
  }
21
22
 
22
23
  Check.defaultProps = {
23
- getStyles: () => {},
24
+ getStyles: () => { },
25
+ onClickChecked: () => { },
24
26
  }
25
27
 
26
28
  export default withStyles(styles)(Check)
@@ -0,0 +1,77 @@
1
+ import { useState } from 'react'
2
+ import PropTypes from 'prop-types'
3
+
4
+ import styles from './Checkbox.module.css'
5
+ import withStyles from '../../hocs/withStyles'
6
+
7
+ export const Checkbox = ({
8
+ getStyles,
9
+ onChange,
10
+ label,
11
+ id,
12
+ value,
13
+ name,
14
+ linkCheck,
15
+ nameLinkCheck,
16
+ handleClick,
17
+ disabled,
18
+ }) => {
19
+ const [checked, setChecked] = useState(value)
20
+
21
+ return (
22
+ <div className={getStyles('checkbox')}>
23
+ <input
24
+ className={getStyles('checkbox-custom', { 'is-disabled': disabled })}
25
+ type="checkbox"
26
+ id={id}
27
+ name={name}
28
+ label={label}
29
+ checked={checked}
30
+ onChange={(e) => {
31
+ setChecked(!checked)
32
+ onChange(e)
33
+ }}
34
+ onClick={handleClick}
35
+ disabled={disabled}
36
+ />
37
+ <label htmlFor={name} className={getStyles('checkbox-custom-label')}>
38
+ {label}
39
+ <a
40
+ className={getStyles('checkbox-custom-link')}
41
+ href={linkCheck}
42
+ target="_black"
43
+ >
44
+ {' '}
45
+ {nameLinkCheck}
46
+ </a>{' '}
47
+ </label>
48
+ </div>
49
+ )
50
+ }
51
+
52
+ Checkbox.propTypes = {
53
+ getStyles: PropTypes.func.isRequired,
54
+ onChange: PropTypes.func.isRequired,
55
+ id: PropTypes.string.isRequired,
56
+ name: PropTypes.string.isRequired,
57
+ value: PropTypes.bool.isRequired,
58
+ label: PropTypes.string,
59
+ nameLinkCheck: PropTypes.string,
60
+ linkCheck: PropTypes.string,
61
+ disabled: PropTypes.bool,
62
+ }
63
+
64
+ Checkbox.defaultProps = {
65
+ getStyles: () => { },
66
+ onChange: () => { },
67
+ id: 'checkbox',
68
+ name: 'checkbox',
69
+ value: true,
70
+ label: 'Aceptas los terminos',
71
+ nameLinkCheck: '',
72
+ linkCheck: '',
73
+ handleClick: () => { },
74
+ disabled: false,
75
+ }
76
+
77
+ export default withStyles(styles)(Checkbox)
@@ -0,0 +1,60 @@
1
+ .checkbox {
2
+ display: flex;
3
+ }
4
+
5
+ /* ////////////////////// */
6
+
7
+
8
+ .checkbox-custom {
9
+ opacity: 0;
10
+ position: absolute;
11
+ }
12
+
13
+ .checkbox-custom,
14
+ .checkbox-custom-label {
15
+ display: inline-block;
16
+ vertical-align: middle;
17
+ margin: 5px;
18
+ cursor: pointer;
19
+ color: var(--color-brand-regent-gray);
20
+ font-weight: var(--font-weight-light);
21
+ }
22
+
23
+ .checkbox-custom+.checkbox-custom-label:before {
24
+ content: '';
25
+ background: #fff;
26
+ border-radius: 5px;
27
+ border: 2px solid #ddd;
28
+ display: inline-block;
29
+ vertical-align: middle;
30
+ width: 10px;
31
+ height: 10px;
32
+ padding: 2px;
33
+ margin-right: 10px;
34
+ text-align: center;
35
+ }
36
+
37
+ .checkbox-custom:checked+.checkbox-custom-label:before {
38
+ content: "";
39
+ display: inline-block;
40
+ width: 1px;
41
+ height: 5px;
42
+ border: solid var(--color-brand-smalt);
43
+ border-width: 0 3px 3px 0;
44
+ transform: rotate(45deg);
45
+ -webkit-transform: rotate(45deg);
46
+ -ms-transform: rotate(45deg);
47
+ border-radius: 0px;
48
+ margin: 0px 15px 5px 5px;
49
+ }
50
+
51
+ .checkbox-custom,
52
+ .checkbox-custom-link {
53
+ font-weight: var(--font-weight-normal);
54
+ color: var(--color-primary);
55
+ text-decoration: underline;
56
+ }
57
+
58
+ .is-disabled {
59
+ cursor: no-drop;
60
+ }
@@ -0,0 +1,30 @@
1
+ import { Checkbox, styles, options } from '.'
2
+
3
+ import {
4
+ getTemplate,
5
+ getListTemplate,
6
+ getOptionsArgTypes,
7
+ } from '../../helpers/storybook'
8
+
9
+ const Template = getTemplate(Checkbox, styles)
10
+ const ListTemplate = getListTemplate(Checkbox, styles)
11
+
12
+ export default {
13
+ title: 'Atoms/Checkbox',
14
+ component: Checkbox,
15
+ args: {
16
+ id: 'hola',
17
+ name: 'hola',
18
+ value: true,
19
+ label: 'Hola',
20
+ nameLinkCheck: '',
21
+ linkCheck: '',
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 })) }
@@ -0,0 +1 @@
1
+ export const options = { types: [] }
@@ -0,0 +1,3 @@
1
+ export { default, Checkbox } from './Checkbox'
2
+ export { options } from './constants'
3
+ export { default as styles } from './Checkbox.module.css'
@@ -2,18 +2,21 @@ import React from 'react'
2
2
  import PropTypes from 'prop-types'
3
3
 
4
4
  import styles from './Divider.module.css'
5
+ import { options } from './constants'
5
6
  import withStyles from '../../hocs/withStyles'
6
7
 
7
- export const Divider = ({ getStyles }) => {
8
- return <div className={getStyles('divider')} />
8
+ export const Divider = ({ color, getStyles }) => {
9
+ return <div className={getStyles('divider', ['color'])} />
9
10
  }
10
11
 
11
12
  Divider.propTypes = {
12
13
  getStyles: PropTypes.func.isRequired,
14
+ color: PropTypes.oneOf(options.colors),
13
15
  }
14
16
 
15
17
  Divider.defaultProps = {
16
18
  getStyles: () => {},
19
+ color: 'primary',
17
20
  }
18
21
 
19
22
  export default withStyles(styles)(Divider)
@@ -3,3 +3,23 @@
3
3
  height: 1px;
4
4
  background: var(--color-font-base);
5
5
  }
6
+
7
+ .color-primary {
8
+ background: var(--color-primary);
9
+ }
10
+
11
+ .color-secondary {
12
+ background: var(--color-secondary);
13
+ }
14
+
15
+ .color-tertiary {
16
+ background: var(--color-tertiary);
17
+ }
18
+
19
+ .color-highlight {
20
+ background: var(--color-primary-highlight);
21
+ }
22
+
23
+ .color-inverted {
24
+ background: var(--color-primary-inverted);
25
+ }
@@ -1,12 +1,23 @@
1
- import { Divider, styles } from '.'
1
+ import { Divider, styles, options } from '.'
2
2
 
3
- import { getTemplate } from '../../helpers/storybook'
3
+ import {
4
+ getTemplate,
5
+ getListTemplate,
6
+ getOptionsArgTypes,
7
+ } from '../../helpers/storybook'
4
8
 
5
9
  const Template = getTemplate(Divider, styles)
10
+ const ListTemplate = getListTemplate(Divider, styles)
6
11
 
7
12
  export default {
8
13
  title: 'Atoms/Divider',
9
14
  component: Divider,
15
+ argTypes: {
16
+ color: getOptionsArgTypes(options.colors),
17
+ },
10
18
  }
11
19
 
12
20
  export const Default = Template.bind({})
21
+
22
+ export const Colors = ListTemplate.bind({})
23
+ Colors.args = { items: options.colors.map((color) => ({ color })) }