imbric-theme 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/.babelrc.json +3 -0
- package/.commitlintrc.json +3 -0
- package/.dockerignore +14 -0
- package/.editorconfig +13 -0
- package/.eslintignore +1 -0
- package/.eslintrc.json +36 -0
- package/.huskyrc.json +6 -0
- package/.lintstagedrc.json +5 -0
- package/.nvmrc +1 -0
- package/.prettierignore +1 -0
- package/.prettierrc.json +4 -0
- package/.releaserc.json +13 -0
- package/.storybook/main.js +13 -0
- package/.storybook/preview-head.html +2 -0
- package/.storybook/preview.js +53 -0
- package/.stylelintrc.json +14 -0
- package/.vscode/launch.json +15 -0
- package/.vscode/settings.json +3 -0
- package/CHANGELOG.md +0 -0
- package/Dockerfile +17 -0
- package/README.md +69 -0
- package/atoms/AlertModal/AlertModal.js +69 -0
- package/atoms/AlertModal/AlertModal.module.css +3 -0
- package/atoms/AlertModal/AlertModal.stories.js +30 -0
- package/atoms/AlertModal/constants.js +4 -0
- package/atoms/AlertModal/index.js +3 -0
- package/atoms/Avatar/Avatar.js +36 -0
- package/atoms/Avatar/Avatar.module.css +3 -0
- package/atoms/Avatar/Avatar.stories.js +29 -0
- package/atoms/Avatar/__snapshots__/Avatar.stories.js.snap +105 -0
- package/atoms/Avatar/constants.js +3 -0
- package/atoms/Avatar/helpers.js +7 -0
- package/atoms/Avatar/index.js +3 -0
- package/atoms/Button/Button.js +83 -0
- package/atoms/Button/Button.module.css +85 -0
- package/atoms/Button/Button.stories.js +47 -0
- package/atoms/Button/Button.test.js +60 -0
- package/atoms/Button/__snapshots__/Button.stories.js.snap +191 -0
- package/atoms/Button/constants.js +3 -0
- package/atoms/Button/index.js +3 -0
- package/atoms/Card/Card.js +48 -0
- package/atoms/Card/Card.module.css +52 -0
- package/atoms/Card/Card.stories.js +41 -0
- package/atoms/Card/__snapshots__/Card.stories.js.snap +136 -0
- package/atoms/Card/constants.js +4 -0
- package/atoms/Card/index.js +3 -0
- package/atoms/Check/Check.js +28 -0
- package/atoms/Check/Check.module.css +11 -0
- package/atoms/Check/Check.stories.js +15 -0
- package/atoms/Check/__snapshots__/Check.stories.js.snap +67 -0
- package/atoms/Check/index.js +2 -0
- package/atoms/Checkbox/Checkbox.js +77 -0
- package/atoms/Checkbox/Checkbox.module.css +60 -0
- package/atoms/Checkbox/Checkbox.stories.js +30 -0
- package/atoms/Checkbox/constants.js +1 -0
- package/atoms/Checkbox/index.js +3 -0
- package/atoms/Divider/Divider.js +22 -0
- package/atoms/Divider/Divider.module.css +25 -0
- package/atoms/Divider/Divider.stories.js +23 -0
- package/atoms/Divider/__snapshots__/Divider.stories.js.snap +22 -0
- package/atoms/Divider/constants.js +3 -0
- package/atoms/Divider/index.js +3 -0
- package/atoms/Heading/Heading.js +37 -0
- package/atoms/Heading/Heading.module.css +70 -0
- package/atoms/Heading/Heading.stories.js +46 -0
- package/atoms/Heading/__snapshots__/Heading.stories.js.snap +189 -0
- package/atoms/Heading/constants.js +5 -0
- package/atoms/Heading/index.js +3 -0
- package/atoms/Icon/Icon.js +66 -0
- package/atoms/Icon/Icon.module.css +142 -0
- package/atoms/Icon/Icon.stories.js +48 -0
- package/atoms/Icon/__snapshots__/Icon.stories.js.snap +1311 -0
- package/atoms/Icon/constants.js +1091 -0
- package/atoms/Icon/helpers.js +9 -0
- package/atoms/Icon/index.js +3 -0
- package/atoms/Input/Input.js +229 -0
- package/atoms/Input/Input.module.css +83 -0
- package/atoms/Input/Input.stories.js +38 -0
- package/atoms/Input/__snapshots__/Input.stories.js.snap +101 -0
- package/atoms/Input/constants.js +3 -0
- package/atoms/Input/index.js +3 -0
- package/atoms/Label/Label.js +31 -0
- package/atoms/Label/Label.module.css +42 -0
- package/atoms/Label/Label.stories.js +26 -0
- package/atoms/Label/constants.js +1 -0
- package/atoms/Label/index.js +3 -0
- package/atoms/LinkItem/LinkItem.js +38 -0
- package/atoms/LinkItem/LinkItem.module.css +19 -0
- package/atoms/LinkItem/LinkItem.stories.js +30 -0
- package/atoms/LinkItem/__snapshots__/Link.stories.js.snap +118 -0
- package/atoms/LinkItem/constants.js +5 -0
- package/atoms/LinkItem/index.js +3 -0
- package/atoms/Loading/Loading.js +30 -0
- package/atoms/Loading/Loading.module.css +51 -0
- package/atoms/Loading/Loading.stories.js +17 -0
- package/atoms/Loading/__snapshots__/Loading.stories.js.snap +26 -0
- package/atoms/Loading/index.js +2 -0
- package/atoms/Modal/Modal.js +121 -0
- package/atoms/Modal/Modal.module.css +142 -0
- package/atoms/Modal/Modal.stories.js +43 -0
- package/atoms/Modal/__snapshots__/Modal.stories.js.snap +239 -0
- package/atoms/Modal/constants.js +1 -0
- package/atoms/Modal/index.js +3 -0
- package/atoms/Paragraph/Paragraph.js +56 -0
- package/atoms/Paragraph/Paragraph.module.css +72 -0
- package/atoms/Paragraph/Paragraph.stories.js +52 -0
- package/atoms/Paragraph/__snapshots__/Paragraph.stories.js.snap +230 -0
- package/atoms/Paragraph/constants.js +5 -0
- package/atoms/Paragraph/index.js +3 -0
- package/atoms/Picture/Picture.js +47 -0
- package/atoms/Picture/Picture.module.css +16 -0
- package/atoms/Picture/Picture.stories.js +32 -0
- package/atoms/Picture/__snapshots__/Picture.stories.js.snap +156 -0
- package/atoms/Picture/index.js +2 -0
- package/atoms/Tab/Tab.js +41 -0
- package/atoms/Tab/Tab.module.css +17 -0
- package/atoms/Tab/Tab.stories.js +27 -0
- package/atoms/Tab/constants.js +1 -0
- package/atoms/Tab/index.js +3 -0
- package/atoms/Textarea/Textarea.js +137 -0
- package/atoms/Textarea/Textarea.module.css +54 -0
- package/atoms/Textarea/Textarea.stories.js +16 -0
- package/atoms/Textarea/__snapshots__/Textarea.stories.js.snap +25 -0
- package/atoms/Textarea/index.js +2 -0
- package/atoms/Toggle/Toggle.js +56 -0
- package/atoms/Toggle/Toggle.module.css +41 -0
- package/atoms/Toggle/Toggle.stories.js +21 -0
- package/atoms/Toggle/constants.js +1 -0
- package/atoms/Toggle/index.js +3 -0
- package/codecov.yml +2 -0
- package/helpers/storybook.js +29 -0
- package/helpers/storybook.test.js +40 -0
- package/helpers/styles.js +37 -0
- package/helpers/styles.test.js +222 -0
- package/hocs/withStyles.js +17 -0
- package/hook/useAddColumn.js +40 -0
- package/hook/useMedia.js +22 -0
- package/hook/useStateDate.js +25 -0
- package/hook/useTable.js +54 -0
- package/index.js +71 -0
- package/jest.config.js +23 -0
- package/jest.setup.js +13 -0
- package/layout/CenteredContent/CenteredContent.js +30 -0
- package/layout/CenteredContent/CenteredContent.module.css +12 -0
- package/layout/CenteredContent/CenteredContent.stories.js +22 -0
- package/layout/CenteredContent/__snapshots__/CenteredContent.stories.js.snap +27 -0
- package/layout/CenteredContent/index.js +2 -0
- package/layout/Container/Container.js +29 -0
- package/layout/Container/Container.module.css +14 -0
- package/layout/Container/Container.stories.js +22 -0
- package/layout/Container/__snapshots__/Container.stories.js.snap +27 -0
- package/layout/Container/index.js +2 -0
- package/layout/DynamicTable/DynamicTable.js +372 -0
- package/layout/DynamicTable/DynamicTable.module.css +76 -0
- package/layout/DynamicTable/DynamicTable.stories.js +79 -0
- package/layout/DynamicTable/constants.js +323 -0
- package/layout/DynamicTable/index.js +3 -0
- package/layout/FlexColumnContent/FlexColumnContent.js +26 -0
- package/layout/FlexColumnContent/FlexColumnContent.module.css +5 -0
- package/layout/FlexColumnContent/FlexColumnContent.stories.js +28 -0
- package/layout/FlexColumnContent/constants.js +1 -0
- package/layout/FlexColumnContent/index.js +3 -0
- package/layout/FullHeightContent/FullHeightContent.js +40 -0
- package/layout/FullHeightContent/FullHeightContent.module.css +21 -0
- package/layout/FullHeightContent/FullHeightContent.stories.js +22 -0
- package/layout/FullHeightContent/__snapshots__/FullHeightContent.stories.js.snap +41 -0
- package/layout/FullHeightContent/index.js +2 -0
- package/layout/Navbar/Navbar.js +247 -0
- package/layout/Navbar/Navbar.module.css +35 -0
- package/layout/Navbar/Navbar.stories.js +20 -0
- package/layout/Navbar/constants.js +35 -0
- package/layout/Navbar/index.js +2 -0
- package/layout/Sidebar/Sidebar.js +115 -0
- package/layout/Sidebar/Sidebar.module.css +387 -0
- package/layout/Sidebar/Sidebar.stories.js +28 -0
- package/layout/Sidebar/constants.js +228 -0
- package/layout/Sidebar/index.js +3 -0
- package/layout/Spacer/Spacer.js +40 -0
- package/layout/Spacer/Spacer.module.css +12 -0
- package/layout/Spacer/Spacer.stories.js +25 -0
- package/layout/Spacer/__snapshots__/Spacer.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/Horizontal.js +43 -0
- package/layout/Spacer/components/Horizontal/Horizontal.stories.js +32 -0
- package/layout/Spacer/components/Horizontal/__snapshots__/Horizontal.stories.js.snap +97 -0
- package/layout/Spacer/components/Horizontal/index.js +1 -0
- package/layout/Spacer/components/Vertical/Vertical.js +31 -0
- package/layout/Spacer/components/Vertical/Vertical.stories.js +25 -0
- package/layout/Spacer/components/Vertical/__snapshots__/Vertical.stories.js.snap +85 -0
- package/layout/Spacer/components/Vertical/index.js +1 -0
- package/layout/Spacer/components/index.js +2 -0
- package/layout/Spacer/constants.js +5 -0
- package/layout/Spacer/helpers.js +3 -0
- package/layout/Spacer/index.js +3 -0
- package/molecules/Accordion/Accordion.js +70 -0
- package/molecules/Accordion/Accordion.module.css +12 -0
- package/molecules/Accordion/Accordion.stories.js +31 -0
- package/molecules/Accordion/__snapshots__/Accordion.stories.js.snap +228 -0
- package/molecules/Accordion/index.js +2 -0
- package/molecules/AddButton/AddButton.js +137 -0
- package/molecules/AddButton/AddButton.module.css +128 -0
- package/molecules/AddButton/AddButton.stories.js +47 -0
- package/molecules/AddButton/__snapshots__/AddButton.stories.js.snap +326 -0
- package/molecules/AddButton/constants.js +6 -0
- package/molecules/AddButton/handlers.js +58 -0
- package/molecules/AddButton/handlers.test.js +19 -0
- package/molecules/AddButton/helpers.js +6 -0
- package/molecules/AddButton/helpers.test.js +41 -0
- package/molecules/AddButton/hooks.js +14 -0
- package/molecules/AddButton/index.js +3 -0
- package/molecules/ButtonIcon/ButtonIcon.js +41 -0
- package/molecules/ButtonIcon/ButtonIcon.stories.js +27 -0
- package/molecules/ButtonIcon/__snapshots__/ButtonIcon.stories.js.snap +178 -0
- package/molecules/ButtonIcon/constants.js +6 -0
- package/molecules/ButtonIcon/index.js +2 -0
- package/molecules/CardDefault/CardDefault.js +65 -0
- package/molecules/CardDefault/CardDefault.module.css +19 -0
- package/molecules/CardDefault/CardDefault.stories.js +23 -0
- package/molecules/CardDefault/constants.js +1 -0
- package/molecules/CardDefault/index.js +3 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.js +89 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.module.css +118 -0
- package/molecules/CardProductTypesBooking/CardProductTypesBooking.stories.js +25 -0
- package/molecules/CardProductTypesBooking/constants.js +1 -0
- package/molecules/CardProductTypesBooking/index.js +3 -0
- package/molecules/CardServiceDetail/CardServiceDetail.js +400 -0
- package/molecules/CardServiceDetail/CardServiceDetail.module.css +222 -0
- package/molecules/CardServiceDetail/CardServiceDetail.stories.js +23 -0
- package/molecules/CardServiceDetail/constants.js +1 -0
- package/molecules/CardServiceDetail/index.js +3 -0
- package/molecules/CardServices/CardServices.js +461 -0
- package/molecules/CardServices/CardServices.module.css +213 -0
- package/molecules/CardServices/CardServices.stories.js +41 -0
- package/molecules/CardServices/constants.js +5 -0
- package/molecules/CardServices/index.js +3 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.js +381 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.module.css +213 -0
- package/molecules/CardServicesFinalized/CardServicesFinalized.stories.js +23 -0
- package/molecules/CardServicesFinalized/constants.js +1 -0
- package/molecules/CardServicesFinalized/index.js +3 -0
- package/molecules/CheckList/CheckList.js +135 -0
- package/molecules/CheckList/CheckList.module.css +94 -0
- package/molecules/CheckList/CheckList.stories.js +25 -0
- package/molecules/CheckList/constants.js +23 -0
- package/molecules/CheckList/index.js +3 -0
- package/molecules/ColumnTable/ColumnTable.js +154 -0
- package/molecules/ColumnTable/ColumnTable.module.css +51 -0
- package/molecules/ColumnTable/ColumnTable.stories.js +26 -0
- package/molecules/ColumnTable/constants.js +117 -0
- package/molecules/ColumnTable/index.js +3 -0
- package/molecules/DatePicker/DatePicker.js +242 -0
- package/molecules/DatePicker/DatePicker.module.css +38 -0
- package/molecules/DatePicker/DatePicker.stories.js +23 -0
- package/molecules/DatePicker/constants.js +3 -0
- package/molecules/DatePicker/index.js +3 -0
- package/molecules/DatePickerTime/DatePickerTime.js +133 -0
- package/molecules/DatePickerTime/DatePickerTime.module.css +3 -0
- package/molecules/DatePickerTime/DatePickerTime.stories.js +18 -0
- package/molecules/DatePickerTime/constants.js +1 -0
- package/molecules/DatePickerTime/index.js +3 -0
- package/molecules/Dropdown/Dropdown.js +62 -0
- package/molecules/Dropdown/Dropdown.module.css +52 -0
- package/molecules/Dropdown/Dropdown.stories.js +41 -0
- package/molecules/Dropdown/__snapshots__/Dropdown.stories.js.snap +181 -0
- package/molecules/Dropdown/index.js +2 -0
- package/molecules/DynamicSelect/DynamicSelect.js +186 -0
- package/molecules/DynamicSelect/DynamicSelect.module.css +10 -0
- package/molecules/DynamicSelect/DynamicSelect.stories.js +32 -0
- package/molecules/DynamicSelect/constants.js +7 -0
- package/molecules/DynamicSelect/index.js +3 -0
- package/molecules/Error/Error.js +35 -0
- package/molecules/Error/Error.module.css +12 -0
- package/molecules/Error/Error.stories.js +18 -0
- package/molecules/Error/__snapshots__/Error.stories.js.snap +134 -0
- package/molecules/Error/index.js +2 -0
- package/molecules/FooterTable/FooterTable.js +166 -0
- package/molecules/FooterTable/FooterTable.module.css +63 -0
- package/molecules/FooterTable/FooterTable.stories.js +23 -0
- package/molecules/FooterTable/constants.js +9 -0
- package/molecules/FooterTable/index.js +3 -0
- package/molecules/IconLabel/IconLabel.js +83 -0
- package/molecules/IconLabel/IconLabel.module.css +16 -0
- package/molecules/IconLabel/IconLabel.stories.js +25 -0
- package/molecules/IconLabel/__snapshots__/IconLabel.stories.js.snap +211 -0
- package/molecules/IconLabel/constants.js +6 -0
- package/molecules/IconLabel/index.js +3 -0
- package/molecules/InputAutocomplete/InputAutocomplete.js +221 -0
- package/molecules/InputAutocomplete/InputAutocomplete.module.css +55 -0
- package/molecules/InputAutocomplete/InputAutocomplete.stories.js +23 -0
- package/molecules/InputAutocomplete/constants.js +1 -0
- package/molecules/InputAutocomplete/index.js +3 -0
- package/molecules/ItemMenu/ItemMenu.js +134 -0
- package/molecules/ItemMenu/ItemMenu.module.css +363 -0
- package/molecules/ItemMenu/ItemMenu.stories.js +42 -0
- package/molecules/ItemMenu/constants.js +36 -0
- package/molecules/ItemMenu/index.js +3 -0
- package/molecules/LoadingError/LoadingError.js +31 -0
- package/molecules/LoadingError/LoadingError.stories.js +24 -0
- package/molecules/LoadingError/__snapshots__/LoadingError.stories.js.snap +109 -0
- package/molecules/LoadingError/index.js +1 -0
- package/molecules/RowTable/RowTable.js +928 -0
- package/molecules/RowTable/RowTable.module.css +63 -0
- package/molecules/RowTable/RowTable.stories.js +26 -0
- package/molecules/RowTable/constants.js +798 -0
- package/molecules/RowTable/index.js +3 -0
- package/molecules/Score/Score.js +61 -0
- package/molecules/Score/Score.module.css +11 -0
- package/molecules/Score/Score.stories.js +13 -0
- package/molecules/Score/__snapshots__/Score.stories.js.snap +100 -0
- package/molecules/Score/faces/happy.svg +7 -0
- package/molecules/Score/faces/normal.svg +6 -0
- package/molecules/Score/faces/sad.svg +6 -0
- package/molecules/Score/index.js +2 -0
- package/molecules/Tabs/Tabs.js +59 -0
- package/molecules/Tabs/Tabs.module.css +13 -0
- package/molecules/Tabs/Tabs.stories.js +34 -0
- package/molecules/Tabs/constants.js +34 -0
- package/molecules/Tabs/index.js +3 -0
- package/molecules/Task/Task.js +114 -0
- package/molecules/Task/Task.module.css +47 -0
- package/molecules/Task/Task.stories.js +47 -0
- package/molecules/Task/__snapshots__/Task.stories.js.snap +953 -0
- package/molecules/Task/constants.js +1 -0
- package/molecules/Task/index.js +3 -0
- package/molecules/TaskCounter/TaskCounter.js +74 -0
- package/molecules/TaskCounter/TaskCounter.module.css +11 -0
- package/molecules/TaskCounter/TaskCounter.stories.js +26 -0
- package/molecules/TaskCounter/__snapshots__/TaskCounter.stories.js.snap +177 -0
- package/molecules/TaskCounter/index.js +2 -0
- package/package.json +119 -0
- package/pages/Login/Login.js +102 -0
- package/pages/Login/Login.module.css +5 -0
- package/pages/Login/Login.stories.js +23 -0
- package/pages/Login/constants.js +1 -0
- package/pages/Login/index.js +3 -0
- package/pages/Login/validation/loginSchema.js +5 -0
- package/public/favicon.ico +0 -0
- package/public/static/google-maps.png +0 -0
- package/public/static/images/folders-folder.svg +26 -0
- package/public/static/images/permissions.svg +14 -0
- package/public/static/images/reports-results.svg +18 -0
- package/public/static/logo.svg +19 -0
- package/public/static/logologin.png +0 -0
- package/public/static/logologin.svg +16 -0
- package/public/static/logologintagos.svg +19 -0
- package/public/static/logotipo.svg +50 -0
- package/public/static/logotipoS.svg +26 -0
- package/public/static/taxisvalencia_logod.png +0 -0
- package/scripts/build-tokens.js +40 -0
- package/scripts/create-component.js +128 -0
- package/storybook.test.js +13 -0
- package/styles/GrupoMutua.css +391 -0
- package/styles/default.css +391 -0
- package/styles/globals.css +1524 -0
- package/styles/radiotaxiaragon.css +391 -0
- package/styles/spartan.css +391 -0
- package/styles/tagos.css +391 -0
- package/styles/taxisvalencia.css +391 -0
- package/styles/tokens.css +391 -0
- package/templates/component/Component.js +22 -0
- package/templates/component/Component.module.css +3 -0
- package/templates/component/Component.stories.js +23 -0
- package/templates/component/constants.js +1 -0
- package/templates/component/index.js +3 -0
- package/tokens/Token/Helper.js +30 -0
- package/tokens/Token/Token.js +13 -0
- package/tokens/Token/Token.module.css +64 -0
- package/tokens/Token/components/Color.js +21 -0
- package/tokens/Token/components/Color.stories.js +126 -0
- package/tokens/Token/components/FontFamily.js +24 -0
- package/tokens/Token/components/FontFamily.stories.js +32 -0
- package/tokens/Token/components/FontSize.js +24 -0
- package/tokens/Token/components/FontSize.stories.js +31 -0
- package/tokens/Token/components/FontWeight.js +24 -0
- package/tokens/Token/components/FontWeight.stories.js +31 -0
- package/tokens/Token/components/Spacing.js +24 -0
- package/tokens/Token/components/Spacing.stories.js +29 -0
- package/tokens/Token/components/__snapshots__/Color.stories.js.snap +7169 -0
- package/tokens/Token/components/__snapshots__/FontFamily.stories.js.snap +133 -0
- package/tokens/Token/components/__snapshots__/FontSize.stories.js.snap +261 -0
- package/tokens/Token/components/__snapshots__/FontWeight.stories.js.snap +317 -0
- package/tokens/Token/components/__snapshots__/Spacing.stories.js.snap +229 -0
- package/tokens/Token/components/index.js +5 -0
- package/tokens/Token/helpers.js +17 -0
- package/tokens/Token/index.js +1 -0
- package/tokens/index.js +472 -0
- package/utils/isEmpty.js +28 -0
- package/utils/isEmpty.test.js +125 -0
- package/utils/isObject.js +4 -0
- package/utils/keyboardCodes.js +6 -0
- package/utils/testUtils/matchMediaMock.js +14 -0
- package/utils/testUtils/svgrMock.js +2 -0
- package/utils/toCapitalize.js +4 -0
- package/utils/toKebabCase.js +8 -0
- package/utils/toPascalCase.js +20 -0
- package/webpack/cssModules.js +30 -0
- package/webpack/loadConfigs.js +6 -0
- package/webpack/reactInlineSvg.js +22 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
import { Toggle, styles, options } from '.'
|
2
|
+
|
3
|
+
import {
|
4
|
+
getTemplate,
|
5
|
+
getListTemplate,
|
6
|
+
getOptionsArgTypes,
|
7
|
+
} from '../../helpers/storybook'
|
8
|
+
|
9
|
+
const Template = getTemplate(Toggle, styles)
|
10
|
+
const ListTemplate = getListTemplate(Toggle, styles)
|
11
|
+
|
12
|
+
export default {
|
13
|
+
title: 'Atoms/Toggle',
|
14
|
+
component: Toggle,
|
15
|
+
args: {},
|
16
|
+
argTypes: {
|
17
|
+
// types: getOptionsArgTypes(options.types),
|
18
|
+
},
|
19
|
+
}
|
20
|
+
|
21
|
+
export const Default = Template.bind({})
|
@@ -0,0 +1 @@
|
|
1
|
+
export const options = { types: [] }
|
package/codecov.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
/* eslint-disable react/display-name, react/jsx-key */
|
2
|
+
import React from 'react'
|
3
|
+
import { getClasses } from './styles'
|
4
|
+
|
5
|
+
export const getTemplate = (Component, styles) => (args) => {
|
6
|
+
const allProps = { ...Component.defaultProps, ...args }
|
7
|
+
return <Component {...args} getStyles={getClasses(styles)(allProps)} />
|
8
|
+
}
|
9
|
+
|
10
|
+
export const getListTemplate = (Component, styles) => ({ items, ...args }) =>
|
11
|
+
items.map((item, index) => {
|
12
|
+
const allProps = { ...Component.defaultProps, ...args, ...item }
|
13
|
+
return (
|
14
|
+
<Component
|
15
|
+
key={index}
|
16
|
+
{...args}
|
17
|
+
{...item}
|
18
|
+
getStyles={getClasses(styles)(allProps)}
|
19
|
+
/>
|
20
|
+
)
|
21
|
+
})
|
22
|
+
|
23
|
+
export const getOptionsArgTypes = (options, description = '**Options:**') => ({
|
24
|
+
description: description,
|
25
|
+
table: {
|
26
|
+
type: { summary: options.map((option) => `'${option}'`).join('|') },
|
27
|
+
},
|
28
|
+
control: { type: 'select', options },
|
29
|
+
})
|
@@ -0,0 +1,40 @@
|
|
1
|
+
import { getTemplate } from './storybook'
|
2
|
+
|
3
|
+
jest.mock('./styles', () => ({
|
4
|
+
getClasses: (a) => (b) => ({ ...a, ...b }),
|
5
|
+
}))
|
6
|
+
|
7
|
+
describe('[ helpers / storybook ]', () => {
|
8
|
+
describe('#getTemplate', () => {
|
9
|
+
describe('when `Component`, `styles`, and `args` are provided', () => {
|
10
|
+
it('should return a `Component` with `defaultProps`, `styles` and `args`', () => {
|
11
|
+
// given
|
12
|
+
const Component = (props) => ({ props })
|
13
|
+
Component.defaultProps = { defaultProps: 'defaultProps', foo: 'bar' }
|
14
|
+
|
15
|
+
const styles = { styles: 'styles' }
|
16
|
+
const args = { args: 'args', foo: 'foo' }
|
17
|
+
|
18
|
+
// when
|
19
|
+
const result = getTemplate(Component, styles)(args)
|
20
|
+
|
21
|
+
// then
|
22
|
+
expect(result).toMatchInlineSnapshot(`
|
23
|
+
<Component
|
24
|
+
args="args"
|
25
|
+
defaultProps="defaultProps"
|
26
|
+
foo="foo"
|
27
|
+
getStyles={
|
28
|
+
Object {
|
29
|
+
"args": "args",
|
30
|
+
"defaultProps": "defaultProps",
|
31
|
+
"foo": "foo",
|
32
|
+
"styles": "styles",
|
33
|
+
}
|
34
|
+
}
|
35
|
+
/>
|
36
|
+
`)
|
37
|
+
})
|
38
|
+
})
|
39
|
+
})
|
40
|
+
})
|
@@ -0,0 +1,37 @@
|
|
1
|
+
import classNames from 'classnames'
|
2
|
+
|
3
|
+
export const getDynamicClasses = (cssModule = {}, props = {}, classes) => {
|
4
|
+
return classes.reduce((classesObject, classKey) => {
|
5
|
+
const propValue = props[classKey]
|
6
|
+
const className = cssModule[`${classKey}-${propValue}`]
|
7
|
+
|
8
|
+
return className && propValue
|
9
|
+
? { ...classesObject, [className]: propValue }
|
10
|
+
: classesObject
|
11
|
+
}, {})
|
12
|
+
}
|
13
|
+
|
14
|
+
export const getModuleClasses = (cssModule, classKey) => {
|
15
|
+
return (cssModule && cssModule[classKey]) || classKey
|
16
|
+
}
|
17
|
+
|
18
|
+
export const getObjectClasses = (cssModule, object) => {
|
19
|
+
return Object.keys(object).reduce((classes, classKey) => {
|
20
|
+
const className = cssModule[classKey]
|
21
|
+
return className ? { ...classes, [className]: object[classKey] } : classes
|
22
|
+
}, {})
|
23
|
+
}
|
24
|
+
|
25
|
+
export const getClasses = (cssModule = {}) => (props) => (...args) => {
|
26
|
+
return classNames(
|
27
|
+
args.map((arg) => {
|
28
|
+
if (Array.isArray(arg)) {
|
29
|
+
return getDynamicClasses(cssModule, props, arg)
|
30
|
+
} else if (typeof arg === 'string') {
|
31
|
+
return getModuleClasses(cssModule, arg)
|
32
|
+
} else if (typeof arg === 'object') {
|
33
|
+
return getObjectClasses(cssModule, arg)
|
34
|
+
}
|
35
|
+
})
|
36
|
+
)
|
37
|
+
}
|
@@ -0,0 +1,222 @@
|
|
1
|
+
import {
|
2
|
+
getDynamicClasses,
|
3
|
+
getModuleClasses,
|
4
|
+
getObjectClasses,
|
5
|
+
getClasses,
|
6
|
+
} from './styles'
|
7
|
+
|
8
|
+
const cssModuleMock = {
|
9
|
+
['size-sm']: '.xyz_size_sm',
|
10
|
+
['color-red']: '.xyz_color_red',
|
11
|
+
['is-editable']: '.xyz_is_editable',
|
12
|
+
['is-inverted']: '.xyz_is_inverted',
|
13
|
+
}
|
14
|
+
|
15
|
+
const propsMock = { size: 'sm', color: 'red' }
|
16
|
+
|
17
|
+
jest.mock('classnames', () => (value) => value)
|
18
|
+
|
19
|
+
describe('[ helpers / styles ]', () => {
|
20
|
+
describe('#getDynamicClasses', () => {
|
21
|
+
describe('when all `props` match the `classes` array', () => {
|
22
|
+
it('should return the dynamic classes', () => {
|
23
|
+
// given
|
24
|
+
const args = ['size', 'color']
|
25
|
+
// when
|
26
|
+
const result = getDynamicClasses(cssModuleMock, propsMock, args)
|
27
|
+
// then
|
28
|
+
const expected = { '.xyz_size_sm': 'sm', '.xyz_color_red': 'red' }
|
29
|
+
|
30
|
+
expect(result).toStrictEqual(expected)
|
31
|
+
})
|
32
|
+
})
|
33
|
+
|
34
|
+
describe("when all `props` doesn't match the `classes` array", () => {
|
35
|
+
it('should return an empty object', () => {
|
36
|
+
// given
|
37
|
+
const args = ['type', 'width']
|
38
|
+
// when
|
39
|
+
const result = getDynamicClasses(cssModuleMock, propsMock, args)
|
40
|
+
// then
|
41
|
+
const expected = {}
|
42
|
+
|
43
|
+
expect(result).toStrictEqual(expected)
|
44
|
+
})
|
45
|
+
})
|
46
|
+
|
47
|
+
describe('when some `props` match the `array` classes', () => {
|
48
|
+
it('should return the dynamic classes', () => {
|
49
|
+
// given
|
50
|
+
const args = ['type', 'color']
|
51
|
+
|
52
|
+
// when
|
53
|
+
const result = getDynamicClasses(cssModuleMock, propsMock, args)
|
54
|
+
// then
|
55
|
+
const expected = { '.xyz_color_red': 'red' }
|
56
|
+
|
57
|
+
expect(result).toStrictEqual(expected)
|
58
|
+
})
|
59
|
+
})
|
60
|
+
})
|
61
|
+
|
62
|
+
describe('#getModuleClasses', () => {
|
63
|
+
describe('when `cssModule` contains the `classKey`', () => {
|
64
|
+
it('should return the module class', () => {
|
65
|
+
// given
|
66
|
+
const args = 'size-sm'
|
67
|
+
// when
|
68
|
+
const result = getModuleClasses(cssModuleMock, args)
|
69
|
+
// then
|
70
|
+
const expected = '.xyz_size_sm'
|
71
|
+
|
72
|
+
expect(result).toBe(expected)
|
73
|
+
})
|
74
|
+
})
|
75
|
+
describe("when `cssModule` doesn't contain the `classKey`", () => {
|
76
|
+
it('should return the `classKey`', () => {
|
77
|
+
// given
|
78
|
+
const args = 'type-primary'
|
79
|
+
// when
|
80
|
+
const result = getModuleClasses(cssModuleMock, args)
|
81
|
+
// then
|
82
|
+
const expected = 'type-primary'
|
83
|
+
|
84
|
+
expect(result).toBe(expected)
|
85
|
+
})
|
86
|
+
})
|
87
|
+
|
88
|
+
describe('when `cssModule` is undefined', () => {
|
89
|
+
it('should return the `classKey`', () => {
|
90
|
+
// given
|
91
|
+
const args = 'size-sm'
|
92
|
+
// when
|
93
|
+
const result = getModuleClasses(undefined, args)
|
94
|
+
// then
|
95
|
+
const expected = 'size-sm'
|
96
|
+
|
97
|
+
expect(result).toBe(expected)
|
98
|
+
})
|
99
|
+
})
|
100
|
+
|
101
|
+
describe('when `cssModule` is null', () => {
|
102
|
+
it('should return the `classKey`', () => {
|
103
|
+
// given
|
104
|
+
const args = 'size-sm'
|
105
|
+
// when
|
106
|
+
const result = getModuleClasses(null, args)
|
107
|
+
// then
|
108
|
+
const expected = 'size-sm'
|
109
|
+
|
110
|
+
expect(result).toBe(expected)
|
111
|
+
})
|
112
|
+
})
|
113
|
+
})
|
114
|
+
|
115
|
+
describe('#getObjectClasses', () => {
|
116
|
+
describe('when `cssModule` and `object` is provided', () => {
|
117
|
+
it('should return the object class', () => {
|
118
|
+
// given
|
119
|
+
const args = { 'is-editable': true, 'is-inverted': false }
|
120
|
+
// when
|
121
|
+
const result = getObjectClasses(cssModuleMock, args)
|
122
|
+
// then
|
123
|
+
const expected = { '.xyz_is_editable': true, '.xyz_is_inverted': false }
|
124
|
+
|
125
|
+
expect(result).toStrictEqual(expected)
|
126
|
+
})
|
127
|
+
})
|
128
|
+
|
129
|
+
describe("when the `object` doesn't match any `cssModule` class", () => {
|
130
|
+
it('should return an empty object', () => {
|
131
|
+
// given
|
132
|
+
const args = { 'is-block': true, 'is-inline': false }
|
133
|
+
// when
|
134
|
+
const result = getObjectClasses(cssModuleMock, args)
|
135
|
+
// then
|
136
|
+
const expected = {}
|
137
|
+
|
138
|
+
expect(result).toStrictEqual(expected)
|
139
|
+
})
|
140
|
+
})
|
141
|
+
|
142
|
+
describe('when the `object` match some `cssModule` class', () => {
|
143
|
+
it('should return an empty object', () => {
|
144
|
+
// given
|
145
|
+
const args = { 'is-editable': true, 'is-inline': false }
|
146
|
+
// when
|
147
|
+
const result = getObjectClasses(cssModuleMock, args)
|
148
|
+
// then
|
149
|
+
const expected = { '.xyz_is_editable': true }
|
150
|
+
|
151
|
+
expect(result).toStrictEqual(expected)
|
152
|
+
})
|
153
|
+
})
|
154
|
+
|
155
|
+
describe('when `object` is empty', () => {
|
156
|
+
it('should return an empty object', () => {
|
157
|
+
// given
|
158
|
+
const args = {}
|
159
|
+
// when
|
160
|
+
const result = getObjectClasses(cssModuleMock, args)
|
161
|
+
// then
|
162
|
+
const expected = {}
|
163
|
+
|
164
|
+
expect(result).toStrictEqual(expected)
|
165
|
+
})
|
166
|
+
})
|
167
|
+
})
|
168
|
+
|
169
|
+
describe('#getClasses', () => {
|
170
|
+
describe('when `arg` is an array', () => {
|
171
|
+
it('should return the classnames', () => {
|
172
|
+
// given
|
173
|
+
const args = ['size', 'color']
|
174
|
+
// when
|
175
|
+
const result = getClasses(cssModuleMock)(propsMock)(args)
|
176
|
+
// then
|
177
|
+
const expected = [{ '.xyz_size_sm': 'sm', '.xyz_color_red': 'red' }]
|
178
|
+
|
179
|
+
expect(result).toStrictEqual(expected)
|
180
|
+
})
|
181
|
+
})
|
182
|
+
|
183
|
+
describe('when `arg` is an string and `cssModule` contains the `classKey`', () => {
|
184
|
+
it('should return the classnames', () => {
|
185
|
+
// given
|
186
|
+
const args = 'size-sm'
|
187
|
+
// when
|
188
|
+
const result = getClasses(cssModuleMock)(propsMock)(args)
|
189
|
+
// then
|
190
|
+
const expected = ['.xyz_size_sm']
|
191
|
+
|
192
|
+
expect(result).toStrictEqual(expected)
|
193
|
+
})
|
194
|
+
})
|
195
|
+
|
196
|
+
describe("when `arg` is an string and `cssModule` doesn't contain the `classKey`", () => {
|
197
|
+
it('should return the classnames', () => {
|
198
|
+
// given
|
199
|
+
const args = 'width-full'
|
200
|
+
// when
|
201
|
+
const result = getClasses(cssModuleMock)(propsMock)(args)
|
202
|
+
// then
|
203
|
+
const expected = ['width-full']
|
204
|
+
|
205
|
+
expect(result).toStrictEqual(expected)
|
206
|
+
})
|
207
|
+
})
|
208
|
+
|
209
|
+
describe('when `arg` is an object', () => {
|
210
|
+
it('should return the classnames', () => {
|
211
|
+
// given
|
212
|
+
const args = { 'is-editable': true, 'is-block': true }
|
213
|
+
// when
|
214
|
+
const result = getClasses(cssModuleMock)(propsMock)(args)
|
215
|
+
// then
|
216
|
+
const expected = [{ '.xyz_is_editable': true }]
|
217
|
+
|
218
|
+
expect(result).toStrictEqual(expected)
|
219
|
+
})
|
220
|
+
})
|
221
|
+
})
|
222
|
+
})
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import { getClasses } from '../helpers/styles'
|
3
|
+
|
4
|
+
const withStyles = (styles) => (WrappedComponent) => {
|
5
|
+
const WithStylesComponent = (props) => {
|
6
|
+
const allProps = { ...WrappedComponent.defaultProps, ...props }
|
7
|
+
return (
|
8
|
+
<WrappedComponent getStyles={getClasses(styles)(allProps)} {...props} />
|
9
|
+
)
|
10
|
+
}
|
11
|
+
|
12
|
+
WithStylesComponent.displayName = WrappedComponent.displayName
|
13
|
+
|
14
|
+
return WithStylesComponent
|
15
|
+
}
|
16
|
+
|
17
|
+
export default withStyles
|
@@ -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
|
package/hook/useMedia.js
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
import { useEffect, useState } from 'react'
|
2
|
+
|
3
|
+
const useMedia = (queries, values, defaultValue) => {
|
4
|
+
const mediaQueryLists = queries.map((q) => window.matchMedia(q))
|
5
|
+
const getValue = () => {
|
6
|
+
const index = mediaQueryLists.findIndex((mql) => mql.matches)
|
7
|
+
return typeof values[index] !== 'undefined' ? values[index] : defaultValue
|
8
|
+
}
|
9
|
+
|
10
|
+
const [value, setValue] = useState(getValue)
|
11
|
+
|
12
|
+
useEffect(() => {
|
13
|
+
const handler = () => setValue(getValue)
|
14
|
+
mediaQueryLists.forEach((mql) => mql.addListener(handler))
|
15
|
+
|
16
|
+
return () => mediaQueryLists.forEach((mql) => mql.removeListener(handler))
|
17
|
+
}, [])
|
18
|
+
|
19
|
+
return value
|
20
|
+
}
|
21
|
+
|
22
|
+
export default useMedia
|
@@ -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,54 @@
|
|
1
|
+
import { useState, useEffect } from 'react'
|
2
|
+
|
3
|
+
const calculateRange = (dataTotalQueryCount, data, rowsPerPage) => {
|
4
|
+
const range = []
|
5
|
+
if (!data) {
|
6
|
+
var num = Math.ceil(1)
|
7
|
+
} else {
|
8
|
+
// num = Math.ceil(data.length / rowsPerPage)
|
9
|
+
num = Math.ceil(dataTotalQueryCount / rowsPerPage)
|
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
|
+
// if (!data) {
|
23
|
+
// return (data = [])
|
24
|
+
// } else {
|
25
|
+
// // return data.slice((page - 1) * rowsPerPage, page * rowsPerPage)
|
26
|
+
// return data
|
27
|
+
// }
|
28
|
+
// }
|
29
|
+
|
30
|
+
const sliceData = (data) => {
|
31
|
+
if (!data) {
|
32
|
+
return (data = [])
|
33
|
+
} else {
|
34
|
+
// return data.slice((page - 1) * rowsPerPage, page * rowsPerPage)
|
35
|
+
return data
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
const useTable = (dataTotalQueryCount, data, page, rowsPerPage) => {
|
40
|
+
const [tableRange, setTableRange] = useState([])
|
41
|
+
const [slice, setSlice] = useState([])
|
42
|
+
|
43
|
+
useEffect(() => {
|
44
|
+
const range = calculateRange(dataTotalQueryCount, data, rowsPerPage)
|
45
|
+
setTableRange([...range])
|
46
|
+
|
47
|
+
const slice = sliceData(data, page, rowsPerPage)
|
48
|
+
setSlice([...slice])
|
49
|
+
}, [dataTotalQueryCount, data, setTableRange, page, setSlice, rowsPerPage])
|
50
|
+
|
51
|
+
return { slice, range: tableRange }
|
52
|
+
}
|
53
|
+
|
54
|
+
export default useTable
|
package/index.js
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
// Pages
|
2
|
+
export { default as Login } from './pages/Login'
|
3
|
+
|
4
|
+
// Layout
|
5
|
+
export { default as CenteredContent } from './layout/CenteredContent'
|
6
|
+
export { default as Container } from './layout/Container'
|
7
|
+
export { default as FullHeightContent } from './layout/FullHeightContent'
|
8
|
+
export { default as FlexColumnContent } from './layout/FlexColumnContent'
|
9
|
+
export { default as Spacer } from './layout/Spacer'
|
10
|
+
export { default as Sidebar } from './layout/Sidebar'
|
11
|
+
export { default as Navbar } from './layout/Navbar'
|
12
|
+
export { default as DynamicTable } from './layout/DynamicTable'
|
13
|
+
|
14
|
+
|
15
|
+
// Atoms
|
16
|
+
export { default as AlertModal } from './atoms/AlertModal'
|
17
|
+
export { default as Avatar } from './atoms/Avatar'
|
18
|
+
export { default as Button } from './atoms/Button'
|
19
|
+
export { default as Card } from './atoms/Card'
|
20
|
+
export { default as Check } from './atoms/Check'
|
21
|
+
export { default as Checkbox } from './atoms/Checkbox'
|
22
|
+
export { default as Divider } from './atoms/Divider'
|
23
|
+
export { default as Heading } from './atoms/Heading'
|
24
|
+
export { default as Icon } from './atoms/Icon'
|
25
|
+
export { default as Input } from './atoms/Input'
|
26
|
+
export { default as Label } from './atoms/Label'
|
27
|
+
export { default as LinkItem } from './atoms/LinkItem'
|
28
|
+
export { default as Loading } from './atoms/Loading'
|
29
|
+
export { default as Modal } from './atoms/Modal'
|
30
|
+
export { default as Paragraph } from './atoms/Paragraph'
|
31
|
+
export { default as Picture } from './atoms/Picture'
|
32
|
+
export { default as Textarea } from './atoms/Textarea'
|
33
|
+
export { default as Tab } from './atoms/Tab'
|
34
|
+
export { default as Toggle } from './atoms/Toggle'
|
35
|
+
|
36
|
+
|
37
|
+
|
38
|
+
// Molecules
|
39
|
+
export { default as Accordion } from './molecules/Accordion'
|
40
|
+
export { default as AddButton } from './molecules/AddButton'
|
41
|
+
export { default as ButtonIcon } from './molecules/ButtonIcon'
|
42
|
+
export { default as CardServiceDetail } from './molecules/CardServiceDetail'
|
43
|
+
export { default as CardServices } from './molecules/CardServices'
|
44
|
+
export { default as CardServicesFinalized } from './molecules/CardServicesFinalized'
|
45
|
+
export { default as CardProductTypesBooking } from './molecules/CardProductTypesBooking'
|
46
|
+
export { default as Dropdown } from './molecules/Dropdown'
|
47
|
+
export { default as LoadingError } from './molecules/LoadingError'
|
48
|
+
export { default as Score } from './molecules/Score'
|
49
|
+
export { default as Task } from './molecules/Task'
|
50
|
+
export { default as TaskCounter } from './molecules/TaskCounter'
|
51
|
+
export { default as IconLabel } from './molecules/IconLabel'
|
52
|
+
export { default as ItemMenu } from './molecules/ItemMenu'
|
53
|
+
export { default as InputAutocomplete } from './molecules/InputAutocomplete'
|
54
|
+
export { default as CheckList } from './molecules/CheckList'
|
55
|
+
export { default as ColumnTable } from './molecules/ColumnTable'
|
56
|
+
export { default as RowTable } from './molecules/RowTable'
|
57
|
+
export { default as FooterTable } from './molecules/FooterTable'
|
58
|
+
export { default as DynamicSelect } from './molecules/DynamicSelect'
|
59
|
+
export { default as DatePicker } from './molecules/DynamicSelect'
|
60
|
+
export { default as CardDefault } from './molecules/CardDefault'
|
61
|
+
export { default as Tabs } from './molecules/Tabs'
|
62
|
+
export { default as DatePickerTime } from './molecules/DatePickerTime'
|
63
|
+
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
export { default as useTable } from './hook/useTable'
|
68
|
+
export { default as useStateDate } from './hook/useStateDate'
|
69
|
+
|
70
|
+
|
71
|
+
|
package/jest.config.js
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
module.exports = {
|
2
|
+
moduleNameMapper: {
|
3
|
+
'\\.css$': 'identity-obj-proxy',
|
4
|
+
'\\.svg$': '<rootDir>/utils/testUtils/svgrMock.js',
|
5
|
+
},
|
6
|
+
setupFilesAfterEnv: ['./jest.setup.js'],
|
7
|
+
transform: {
|
8
|
+
'^.+\\.stories\\.jsx?$': '@storybook/addon-storyshots/injectFileName',
|
9
|
+
'^.+\\.jsx?$': 'babel-jest',
|
10
|
+
},
|
11
|
+
collectCoverageFrom: [
|
12
|
+
'{atoms,molecules,layout,pages}/**/!(index).js',
|
13
|
+
'{hocs,helpers}/*.js',
|
14
|
+
],
|
15
|
+
coverageThreshold: {
|
16
|
+
global: {
|
17
|
+
statements: 60,
|
18
|
+
branches: 60,
|
19
|
+
lines: 60,
|
20
|
+
functions: 60,
|
21
|
+
},
|
22
|
+
},
|
23
|
+
}
|
package/jest.setup.js
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
// https://console.spec.whatwg.org/#loglevel-severity
|
2
|
+
const CONSOLE_LEVELS = ['debug', 'log', 'info', 'warn', 'error']
|
3
|
+
|
4
|
+
// Notice that by default the levels will be ["error"]
|
5
|
+
const allowedConsoleLevels = CONSOLE_LEVELS.slice(
|
6
|
+
CONSOLE_LEVELS.indexOf(process.env.CONSOLE_LEVEL)
|
7
|
+
)
|
8
|
+
|
9
|
+
global.console = CONSOLE_LEVELS.reduce((levels, level) => {
|
10
|
+
return allowedConsoleLevels.includes(level)
|
11
|
+
? { ...levels, [level]: console[level] }
|
12
|
+
: { ...levels, [level]: jest.fn() }
|
13
|
+
}, {})
|
@@ -0,0 +1,30 @@
|
|
1
|
+
import React from 'react'
|
2
|
+
import PropTypes from 'prop-types'
|
3
|
+
|
4
|
+
import styles from './CenteredContent.module.css'
|
5
|
+
import withStyles from '../../hocs/withStyles'
|
6
|
+
|
7
|
+
export const CenteredContent = ({ getStyles, children, isPlayground }) => {
|
8
|
+
return (
|
9
|
+
<div
|
10
|
+
className={getStyles('centered-content', {
|
11
|
+
'is-playground': isPlayground,
|
12
|
+
})}
|
13
|
+
>
|
14
|
+
{children}
|
15
|
+
</div>
|
16
|
+
)
|
17
|
+
}
|
18
|
+
|
19
|
+
CenteredContent.propTypes = {
|
20
|
+
children: PropTypes.node.isRequired,
|
21
|
+
getStyles: PropTypes.func.isRequired,
|
22
|
+
isPlayground: PropTypes.bool,
|
23
|
+
}
|
24
|
+
|
25
|
+
CenteredContent.defaultProps = {
|
26
|
+
isPlayground: false,
|
27
|
+
getStyles: () => {},
|
28
|
+
}
|
29
|
+
|
30
|
+
export default withStyles(styles)(CenteredContent)
|