alicia-design-system 0.1.0

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.
Files changed (258) hide show
  1. package/.eslintrc.json +23 -0
  2. package/.github/workflows/deploy-storybook.yml +29 -0
  3. package/.prettierrc +6 -0
  4. package/.storybook/AliciaTheme.js +8 -0
  5. package/.storybook/main.js +26 -0
  6. package/.storybook/manager.js +6 -0
  7. package/.storybook/preview-head.html +20 -0
  8. package/.storybook/preview.js +21 -0
  9. package/README.md +23 -0
  10. package/package.json +103 -0
  11. package/public/index.html +38 -0
  12. package/setupFile.js +5 -0
  13. package/src/App.css +38 -0
  14. package/src/App.test.tsx +9 -0
  15. package/src/App.tsx +5 -0
  16. package/src/alicia/common/Buttons/Button.spec.tsx +11 -0
  17. package/src/alicia/common/Buttons/Buttons.stories.tsx +21 -0
  18. package/src/alicia/common/Buttons/Buttons.tsx +15 -0
  19. package/src/alicia/common/Buttons/index.ts +1 -0
  20. package/src/alicia/common/Checkbox/Checkbox.stories.tsx +31 -0
  21. package/src/alicia/common/Checkbox/Checkbox.tsx +23 -0
  22. package/src/alicia/common/Checkbox/index.ts +1 -0
  23. package/src/alicia/common/DateInput/DateInput.stories.tsx +26 -0
  24. package/src/alicia/common/DateInput/DateInput.tsx +66 -0
  25. package/src/alicia/common/FileUpload/FileUpload.stories.tsx +26 -0
  26. package/src/alicia/common/FileUpload/FileUpload.tsx +184 -0
  27. package/src/alicia/common/FileUpload/inedx.ts +1 -0
  28. package/src/alicia/common/List/List.stories.tsx +25 -0
  29. package/src/alicia/common/List/List.tsx +28 -0
  30. package/src/alicia/common/List/index.ts +1 -0
  31. package/src/alicia/common/RadioButtonGroup/RadioButtonGroup.stories.tsx +29 -0
  32. package/src/alicia/common/RadioButtonGroup/RadioButtonGroup.tsx +29 -0
  33. package/src/alicia/common/icons/DeleteIcon.tsx +9 -0
  34. package/src/alicia/common/icons/PdfIcon.tsx +9 -0
  35. package/src/alicia/common/icons/UploadIcon.tsx +9 -0
  36. package/src/alicia/common/icons/index.ts +3 -0
  37. package/src/assets/logo/alicia-logo.png +0 -0
  38. package/src/assets/vectors/accounts-big.svg +1 -0
  39. package/src/assets/vectors/accounts-small.svg +1 -0
  40. package/src/assets/vectors/accounts.svg +3 -0
  41. package/src/assets/vectors/action-menu/activate.svg +5 -0
  42. package/src/assets/vectors/action-menu/add.svg +3 -0
  43. package/src/assets/vectors/action-menu/copy.svg +3 -0
  44. package/src/assets/vectors/action-menu/deactivate.svg +4 -0
  45. package/src/assets/vectors/action-menu/delete.svg +3 -0
  46. package/src/assets/vectors/action-menu/download.svg +3 -0
  47. package/src/assets/vectors/action-menu/edit.svg +3 -0
  48. package/src/assets/vectors/action-menu/external-link.svg +4 -0
  49. package/src/assets/vectors/action-menu/invoice.svg +6 -0
  50. package/src/assets/vectors/action-menu/payment-card.svg +3 -0
  51. package/src/assets/vectors/action-menu/view.svg +4 -0
  52. package/src/assets/vectors/arrow-down.svg +1 -0
  53. package/src/assets/vectors/arrow-left.svg +1 -0
  54. package/src/assets/vectors/arrow-right.svg +1 -0
  55. package/src/assets/vectors/arrow-up.svg +1 -0
  56. package/src/assets/vectors/calendar.svg +10 -0
  57. package/src/assets/vectors/checkmark.svg +1 -0
  58. package/src/assets/vectors/close.svg +1 -0
  59. package/src/assets/vectors/dashboard.svg +3 -0
  60. package/src/assets/vectors/dots.svg +1 -0
  61. package/src/assets/vectors/download.svg +1 -0
  62. package/src/assets/vectors/euro.svg +1 -0
  63. package/src/assets/vectors/eye-closed.svg +1 -0
  64. package/src/assets/vectors/eye-open.svg +1 -0
  65. package/src/assets/vectors/handshake.svg +10 -0
  66. package/src/assets/vectors/holders.svg +4 -0
  67. package/src/assets/vectors/info.svg +8 -0
  68. package/src/assets/vectors/invoices.svg +5 -0
  69. package/src/assets/vectors/loading.svg +11 -0
  70. package/src/assets/vectors/logo-small.svg +7 -0
  71. package/src/assets/vectors/logo.svg +7 -0
  72. package/src/assets/vectors/logout.svg +1 -0
  73. package/src/assets/vectors/navigation-menu/chevron-down.svg +3 -0
  74. package/src/assets/vectors/navigation-menu/chevron-up.svg +3 -0
  75. package/src/assets/vectors/navigation-menu/dashboard.svg +6 -0
  76. package/src/assets/vectors/navigation-menu/general-admin.svg +3 -0
  77. package/src/assets/vectors/navigation-menu/lock-open.svg +4 -0
  78. package/src/assets/vectors/navigation-menu/logout.svg +5 -0
  79. package/src/assets/vectors/navigation-menu/my-account.svg +6 -0
  80. package/src/assets/vectors/navigation-menu/partner-admin.svg +5 -0
  81. package/src/assets/vectors/pen.svg +1 -0
  82. package/src/assets/vectors/plus.svg +1 -0
  83. package/src/assets/vectors/policies-big.svg +1 -0
  84. package/src/assets/vectors/policies.svg +6 -0
  85. package/src/assets/vectors/policy.svg +1 -0
  86. package/src/assets/vectors/search.svg +1 -0
  87. package/src/assets/vectors/umbrella.svg +3 -0
  88. package/src/assets/vectors/user.svg +1 -0
  89. package/src/declarations.d.ts +4 -0
  90. package/src/decorators/ReactRouterDecorator.tsx +12 -0
  91. package/src/index.css +13 -0
  92. package/src/index.tsx +17 -0
  93. package/src/legacy_agos/common/Accordion/Accordion.stories.tsx +13 -0
  94. package/src/legacy_agos/common/Accordion/Accordion.styled.ts +41 -0
  95. package/src/legacy_agos/common/Accordion/Accordion.tsx +58 -0
  96. package/src/legacy_agos/common/Accordion/index.ts +1 -0
  97. package/src/legacy_agos/common/Button/Button.stories.tsx +96 -0
  98. package/src/legacy_agos/common/Button/Button.styled.ts +206 -0
  99. package/src/legacy_agos/common/Button/Button.tsx +94 -0
  100. package/src/legacy_agos/common/Button/index.ts +1 -0
  101. package/src/legacy_agos/common/Button/types.ts +34 -0
  102. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.stories.tsx +28 -0
  103. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.styled.ts +15 -0
  104. package/src/legacy_agos/common/ConfirmModal/ConfirmModal.tsx +49 -0
  105. package/src/legacy_agos/common/ConfirmModal/index.ts +1 -0
  106. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.stories.tsx +52 -0
  107. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.styled.ts +10 -0
  108. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/MultiSelectDropdown.tsx +198 -0
  109. package/src/legacy_agos/common/Dropdown/MultiSelectDropdown/index.ts +1 -0
  110. package/src/legacy_agos/common/Dropdown/SelectDropdown/SelectDropdown.stories.tsx +53 -0
  111. package/src/legacy_agos/common/Dropdown/SelectDropdown/SelectDropdown.tsx +83 -0
  112. package/src/legacy_agos/common/Dropdown/SelectDropdown/customStyles.ts +138 -0
  113. package/src/legacy_agos/common/Dropdown/SelectDropdown/index.ts +1 -0
  114. package/src/legacy_agos/common/Dropdown/SelectDropdown/types.ts +67 -0
  115. package/src/legacy_agos/common/Label/Label.stories.tsx +16 -0
  116. package/src/legacy_agos/common/Label/Label.styled.ts +23 -0
  117. package/src/legacy_agos/common/Label/Label.tsx +10 -0
  118. package/src/legacy_agos/common/Label/index.ts +1 -0
  119. package/src/legacy_agos/common/ListItem/ListItem.stories.tsx +25 -0
  120. package/src/legacy_agos/common/ListItem/ListItem.styled.ts +46 -0
  121. package/src/legacy_agos/common/ListItem/ListItem.tsx +24 -0
  122. package/src/legacy_agos/common/ListItem/index.ts +1 -0
  123. package/src/legacy_agos/common/Loading/Loading.stories.tsx +29 -0
  124. package/src/legacy_agos/common/Loading/Loading.styled.ts +59 -0
  125. package/src/legacy_agos/common/Loading/Loading.tsx +24 -0
  126. package/src/legacy_agos/common/Loading/index.ts +1 -0
  127. package/src/legacy_agos/common/Modal/Modal.stories.tsx +48 -0
  128. package/src/legacy_agos/common/Modal/Modal.styled.ts +100 -0
  129. package/src/legacy_agos/common/Modal/Modal.tsx +77 -0
  130. package/src/legacy_agos/common/Modal/index.ts +1 -0
  131. package/src/legacy_agos/common/Notifcation/Notification.stories.tsx +25 -0
  132. package/src/legacy_agos/common/Notifcation/Notification.styled.ts +47 -0
  133. package/src/legacy_agos/common/Notifcation/Notification.tsx +27 -0
  134. package/src/legacy_agos/common/Notifcation/index.ts +1 -0
  135. package/src/legacy_agos/common/StatusLabel/StatusLabel.stories.tsx +31 -0
  136. package/src/legacy_agos/common/StatusLabel/StatusLabel.styled.tsx +26 -0
  137. package/src/legacy_agos/common/StatusLabel/StatusLabel.tsx +14 -0
  138. package/src/legacy_agos/common/StatusLabel/index.ts +1 -0
  139. package/src/legacy_agos/common/Tab/Tab.styled.tsx +29 -0
  140. package/src/legacy_agos/common/Tab/Tab.tsx +6 -0
  141. package/src/legacy_agos/common/Tab/index.ts +1 -0
  142. package/src/legacy_agos/common/TabGroup/TabGroup.stories.tsx +24 -0
  143. package/src/legacy_agos/common/TabGroup/TabGroup.styled.tsx +11 -0
  144. package/src/legacy_agos/common/TabGroup/TabGroup.tsx +21 -0
  145. package/src/legacy_agos/common/TabGroup/index.ts +1 -0
  146. package/src/legacy_agos/common/TestButton/TestButton.stories.tsx +21 -0
  147. package/src/legacy_agos/common/TestButton/TestButton.tsx +8 -0
  148. package/src/legacy_agos/common/TestButton/index.ts +1 -0
  149. package/src/legacy_agos/common/index.ts +6 -0
  150. package/src/legacy_agos/common/types.ts +5 -0
  151. package/src/legacy_agos/form/Checkbox/Checkbox.stories.tsx +38 -0
  152. package/src/legacy_agos/form/Checkbox/Checkbox.styled.ts +74 -0
  153. package/src/legacy_agos/form/Checkbox/Checkbox.tsx +32 -0
  154. package/src/legacy_agos/form/Checkbox/index.ts +1 -0
  155. package/src/legacy_agos/form/FormContainer/index.tsx +41 -0
  156. package/src/legacy_agos/form/FormContainer/styled.ts +5 -0
  157. package/src/legacy_agos/form/FormField/FormField.stories.tsx +26 -0
  158. package/src/legacy_agos/form/FormField/FormField.tsx +37 -0
  159. package/src/legacy_agos/form/FormField/index.ts +1 -0
  160. package/src/legacy_agos/form/FormField/styled.ts +68 -0
  161. package/src/legacy_agos/form/Input/Input.stories.tsx +30 -0
  162. package/src/legacy_agos/form/Input/Input.styled.ts +125 -0
  163. package/src/legacy_agos/form/Input/Input.tsx +54 -0
  164. package/src/legacy_agos/form/Input/index.ts +1 -0
  165. package/src/legacy_agos/form/InputCheckbox/InputCheckbox.stories.tsx +41 -0
  166. package/src/legacy_agos/form/InputCheckbox/InputCheckbox.tsx +35 -0
  167. package/src/legacy_agos/form/InputCheckbox/index.ts +1 -0
  168. package/src/legacy_agos/form/InputPassword/InputPassword.stories.tsx +31 -0
  169. package/src/legacy_agos/form/InputPassword/InputPassword.styled.ts +12 -0
  170. package/src/legacy_agos/form/InputPassword/InputPassword.tsx +29 -0
  171. package/src/legacy_agos/form/InputPassword/index.ts +1 -0
  172. package/src/legacy_agos/form/SelectDropdown/customStyles.ts +124 -0
  173. package/src/legacy_agos/form/SelectDropdown/index.tsx +84 -0
  174. package/src/legacy_agos/form/SelectDropdown/types.ts +63 -0
  175. package/src/legacy_agos/form/Textarea/TextArea.stories.tsx +41 -0
  176. package/src/legacy_agos/form/Textarea/TextArea.styled.ts +7 -0
  177. package/src/legacy_agos/form/Textarea/TextArea.tsx +40 -0
  178. package/src/legacy_agos/form/Textarea/index.ts +1 -0
  179. package/src/legacy_agos/form/dates/translations.ts +23 -0
  180. package/src/legacy_agos/form/index.ts +9 -0
  181. package/src/legacy_agos/form/types.ts +64 -0
  182. package/src/legacy_agos/icon/ActionIcon/index.tsx +62 -0
  183. package/src/legacy_agos/icon/CheckmarkIcon/index.ts +8 -0
  184. package/src/legacy_agos/icon/PenIcon/index.ts +8 -0
  185. package/src/legacy_agos/icon/PlusIcon/index.ts +8 -0
  186. package/src/legacy_agos/icon/SearchIcon/index.ts +8 -0
  187. package/src/legacy_agos/icon/index.ts +5 -0
  188. package/src/legacy_agos/layout/Card/Card.stories.tsx +28 -0
  189. package/src/legacy_agos/layout/Card/Card.styled.ts +33 -0
  190. package/src/legacy_agos/layout/Card/Card.tsx +11 -0
  191. package/src/legacy_agos/layout/Card/index.ts +1 -0
  192. package/src/legacy_agos/layout/DataField/DataField.stories.tsx +18 -0
  193. package/src/legacy_agos/layout/DataField/DataField.styled.ts +45 -0
  194. package/src/legacy_agos/layout/DataField/DataField.tsx +26 -0
  195. package/src/legacy_agos/layout/DataField/index.ts +1 -0
  196. package/src/legacy_agos/layout/Dropdown/Dropdown.styled.ts +79 -0
  197. package/src/legacy_agos/layout/Dropdown/Dropdown.tsx +14 -0
  198. package/src/legacy_agos/layout/Dropdown/index.ts +1 -0
  199. package/src/legacy_agos/layout/Row/Row.stories.tsx +11 -0
  200. package/src/legacy_agos/layout/Row/Row.styled.ts +44 -0
  201. package/src/legacy_agos/layout/Row/Row.tsx +12 -0
  202. package/src/legacy_agos/layout/Row/index.ts +1 -0
  203. package/src/legacy_agos/layout/SimplePage/SimplePage.stories.tsx +11 -0
  204. package/src/legacy_agos/layout/SimplePage/SimplePage.styled.ts +22 -0
  205. package/src/legacy_agos/layout/SimplePage/SimplePage.tsx +12 -0
  206. package/src/legacy_agos/layout/SimplePage/index.ts +1 -0
  207. package/src/legacy_agos/layout/index.ts +5 -0
  208. package/src/legacy_agos/table/Table.stories.tsx +29 -0
  209. package/src/legacy_agos/table/TableActions/TableActions.styled.tsx +41 -0
  210. package/src/legacy_agos/table/TableActions/TableActions.tsx +10 -0
  211. package/src/legacy_agos/table/TableActions/index.ts +1 -0
  212. package/src/legacy_agos/table/TableCell/TableCell.styled.tsx +62 -0
  213. package/src/legacy_agos/table/TableCell/TableCell.tsx +23 -0
  214. package/src/legacy_agos/table/TableCell/index.ts +1 -0
  215. package/src/legacy_agos/table/TableExpandableCell/TableExpandableCell.styled.tsx +7 -0
  216. package/src/legacy_agos/table/TableExpandableCell/TableExpandableCell.tsx +9 -0
  217. package/src/legacy_agos/table/TableExpandableCell/index.ts +1 -0
  218. package/src/legacy_agos/table/TableHeadCell/TableHeadCell.styled.tsx +41 -0
  219. package/src/legacy_agos/table/TableHeadCell/TableHeadCell.tsx +21 -0
  220. package/src/legacy_agos/table/TableHeadCell/index.ts +1 -0
  221. package/src/legacy_agos/table/TableHeadIcon/TableHeadIcon.styled.tsx +23 -0
  222. package/src/legacy_agos/table/TableHeadIcon/TableHeadIcon.tsx +15 -0
  223. package/src/legacy_agos/table/TableHeadIcon/index.ts +1 -0
  224. package/src/legacy_agos/table/TableRow/TableRow.styled.tsx +48 -0
  225. package/src/legacy_agos/table/TableRow/TableRow.tsx +19 -0
  226. package/src/legacy_agos/table/TableRow/index.ts +1 -0
  227. package/src/legacy_agos/table/TableTextCell/TableTextCell.styled.tsx +45 -0
  228. package/src/legacy_agos/table/TableTextCell/TableTextCell.tsx +24 -0
  229. package/src/legacy_agos/table/TableTextCell/index.ts +1 -0
  230. package/src/legacy_agos/table/TableWrapper/TableWrapper.styled.tsx +9 -0
  231. package/src/legacy_agos/table/TableWrapper/TableWrapper.tsx +9 -0
  232. package/src/legacy_agos/table/TableWrapper/index.ts +1 -0
  233. package/src/legacy_agos/table/index.ts +8 -0
  234. package/src/legacy_agos/table/types.ts +22 -0
  235. package/src/legacy_agos/typography/Heading/Heading.stories.tsx +20 -0
  236. package/src/legacy_agos/typography/Heading/Heading.styled.tsx +51 -0
  237. package/src/legacy_agos/typography/Heading/Heading.tsx +14 -0
  238. package/src/legacy_agos/typography/Heading/index.ts +1 -0
  239. package/src/legacy_agos/typography/Text/Text.stories.tsx +32 -0
  240. package/src/legacy_agos/typography/Text/Text.styled.tsx +56 -0
  241. package/src/legacy_agos/typography/Text/Text.tsx +6 -0
  242. package/src/legacy_agos/typography/Text/index.ts +1 -0
  243. package/src/legacy_agos/typography/types.ts +21 -0
  244. package/src/logo.svg +1 -0
  245. package/src/react-app-env.d.ts +2 -0
  246. package/src/reportWebVitals.ts +18 -0
  247. package/src/services/style.ts +9 -0
  248. package/src/setupTests.ts +5 -0
  249. package/src/static/vectors/CalendarSvg.svg +10 -0
  250. package/src/styles/chakraTheme.ts +141 -0
  251. package/src/styles/index.ts +36 -0
  252. package/src/styles/react-toastify.css +25 -0
  253. package/src/styles/theme.ts +38 -0
  254. package/src/styles/types.ts +46 -0
  255. package/src/styles/utils.ts +27 -0
  256. package/src/types/general.ts +25 -0
  257. package/src/types/index.ts +10 -0
  258. package/tsconfig.json +22 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "env": { "browser": true, "es2021": true },
3
+ "extends": [
4
+ "plugin:react/recommended",
5
+ "standard-with-typescript",
6
+ "prettier"
7
+ ],
8
+ "overrides": [],
9
+ "parserOptions": {
10
+ "ecmaVersion": "latest",
11
+ "project": ["./tsconfig.json"],
12
+ "sourceType": "module"
13
+ },
14
+ "plugins": ["react"],
15
+ "rules": {
16
+ "react/react-in-jsx-scope": "off",
17
+ "@typescript-eslint/consistent-type-assertions": "off",
18
+ "@typescript-eslint/strict-boolean-expressions": "off",
19
+ "@typescript-eslint/consistent-type-definitions": "off",
20
+ "@typescript-eslint/explicit-function-return-type": "off",
21
+ "react/display-name": "off"
22
+ }
23
+ }
@@ -0,0 +1,29 @@
1
+ on:
2
+ push:
3
+ branches:
4
+ - main
5
+
6
+ jobs:
7
+ build:
8
+ name: Build application
9
+ runs-on: ubuntu-latest
10
+ steps:
11
+ - name: Check out repository
12
+ uses: actions/checkout@v2
13
+
14
+ - name: Setup Node.js
15
+ uses: actions/setup-node@v2
16
+ with:
17
+ node-version: "17"
18
+ cache: npm
19
+
20
+ - name: 🧰 Install
21
+ run: npm ci --production-only
22
+
23
+ - name: 🧹 Run lint
24
+ run: npm run lint
25
+
26
+ - name: 📜 Deploy to GH pages
27
+ run: npm run deploy --ci
28
+ env:
29
+ GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
package/.prettierrc ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "trailingComma": "es5",
3
+ "tabWidth": 2,
4
+ "semi": true,
5
+ "singleQuote": false
6
+ }
@@ -0,0 +1,8 @@
1
+ import { create } from "@storybook/theming";
2
+ import AliciaLogo from "../src/assets/logo/alicia-logo.png";
3
+
4
+ export default create({
5
+ base: "light",
6
+ brandTitle: "Alicia Insurance storybook",
7
+ brandImage: AliciaLogo,
8
+ });
@@ -0,0 +1,26 @@
1
+ module.exports = {
2
+ stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
3
+ addons: [
4
+ "@storybook/addon-links",
5
+ "@chakra-ui/storybook-addon",
6
+ "@storybook/addon-essentials",
7
+ "@storybook/addon-interactions",
8
+ "@storybook/preset-create-react-app",
9
+ "storybook-addon-styled-component-theme/dist/preset",
10
+ ],
11
+ features: {
12
+ emotionAlias: false,
13
+ },
14
+ framework: "@storybook/react",
15
+ core: {
16
+ builder: "webpack5",
17
+ },
18
+ docsPage: {
19
+ docs: "automatic",
20
+ },
21
+ typescript: {
22
+ check: false,
23
+ checkOptions: {},
24
+ reactDocgen: false,
25
+ },
26
+ };
@@ -0,0 +1,6 @@
1
+ import { addons } from "@storybook/addons";
2
+ import AliciaTheme from "./AliciaTheme";
3
+
4
+ addons.setConfig({
5
+ theme: AliciaTheme,
6
+ });
@@ -0,0 +1,20 @@
1
+ <!-- .storybook/preview-body.html -->
2
+ <link rel="preload" as="font" href="https://alicia-fe-assets.s3.eu-central-1.amazonaws.com/untitled-sans-regular.woff2" type="font/woff2" crossorigin="anonymous">
3
+ <link rel="preload" as="font" href="https://alicia-fe-assets.s3.eu-central-1.amazonaws.com/untitled-sans-medium.woff2" type="font/woff2" crossorigin="anonymous">
4
+
5
+ <style type="text/css">
6
+ @font-face {
7
+ font-family: 'UntitledSansRegular';
8
+ src: url('https://alicia-fe-assets.s3.eu-central-1.amazonaws.com/untitled-sans-regular.woff2') format('woff2'),
9
+ url('styles/ArmWrestler.woff') format('woff');
10
+ font-weight: normal;
11
+ font-style: normal;
12
+ }
13
+ @font-face {
14
+ font-family: 'UntitledSansMedium';
15
+ src: url('https://alicia-fe-assets.s3.eu-central-1.amazonaws.com/untitled-sans-medium.woff2') format('woff2'),
16
+ url('styles/ArmWrestler.woff') format('woff');
17
+ font-weight: normal;
18
+ font-style: normal;
19
+ }
20
+ </style>
@@ -0,0 +1,21 @@
1
+ import { addDecorator } from "@storybook/react";
2
+ import { withThemesProvider } from "storybook-addon-styled-component-theme";
3
+
4
+ import agosTheme from "../src/styles/theme";
5
+ import { chakraTheme as theme } from "../src/styles/chakraTheme";
6
+
7
+ addDecorator(withThemesProvider([agosTheme]));
8
+ addDecorator((storyFn) => <div id="modal">{storyFn()}</div>);
9
+
10
+ export const parameters = {
11
+ chakra: {
12
+ theme,
13
+ },
14
+ actions: { argTypesRegex: "^on[A-Z].*" },
15
+ controls: {
16
+ matchers: {
17
+ color: /(background|color)$/i,
18
+ date: /Date$/,
19
+ },
20
+ },
21
+ };
package/README.md ADDED
@@ -0,0 +1,23 @@
1
+ # Alicia Design System
2
+
3
+ ## Import Storybook into apps
4
+
5
+ Add the GitHub repo to `package.json` dependencies:
6
+
7
+ ```bash
8
+ // package.json
9
+ ...
10
+ "dependencies": {
11
+ "alicia-design-system": "username/repo#branch-name",
12
+ }
13
+ ....
14
+
15
+ ```
16
+
17
+ Run `npm install` and npm will download the project and save it into your `/node_modules/` folder.
18
+
19
+ After new changes have been pushed to the branch, delete the package from your `node_modules` and run npm install again:
20
+
21
+ ```bash
22
+ npm uninstall alicia-design-system && npm install username/repo#branch-name
23
+ ```
package/package.json ADDED
@@ -0,0 +1,103 @@
1
+ {
2
+ "name": "alicia-design-system",
3
+ "version": "0.1.0",
4
+ "private": false,
5
+ "dependencies": {
6
+ "@chakra-ui/icons": "^2.0.17",
7
+ "@chakra-ui/react": "^2.4.9",
8
+ "@emotion/styled": "^11.10.5",
9
+ "@testing-library/jest-dom": "^5.16.5",
10
+ "@testing-library/react": "^13.4.0",
11
+ "@testing-library/user-event": "^13.5.0",
12
+ "@types/jest": "^27.5.2",
13
+ "@types/node": "^16.18.2",
14
+ "@types/react": "^18.0.24",
15
+ "@types/react-dom": "^18.0.8",
16
+ "body-scroll-lock": "^4.0.0-beta.0",
17
+ "date-fns": "^2.29.3",
18
+ "dayjs": "^1.11.6",
19
+ "framer-motion": "^9.0.1",
20
+ "lodash": "^4.17.21",
21
+ "react": "^18.2.0",
22
+ "react-day-picker": "^8.3.6",
23
+ "react-dom": "^18.2.0",
24
+ "react-dropzone": "^14.2.3",
25
+ "react-hook-form": "^7.38.0",
26
+ "react-router-dom": "^6.4.2",
27
+ "react-scripts": "5.0.1",
28
+ "react-select": "^5.5.7",
29
+ "react-table": "^7.8.0",
30
+ "storybook-addon-styled-component-theme": "^2.0.0",
31
+ "styled-components": "^5.3.6",
32
+ "web-vitals": "^2.1.4"
33
+ },
34
+ "scripts": {
35
+ "start": "start-storybook -p 6006 -s public",
36
+ "lint": "eslint ./src --cache",
37
+ "build": "build-storybook -s public",
38
+ "deploy": "storybook-to-ghpages",
39
+ "test": "react-scripts test --setupFiles ./setupFile.js"
40
+ },
41
+ "eslintConfig": {
42
+ "extends": [
43
+ "react-app",
44
+ "react-app/jest"
45
+ ],
46
+ "overrides": [
47
+ {
48
+ "files": [
49
+ "**/*.stories.*"
50
+ ],
51
+ "rules": {
52
+ "import/no-anonymous-default-export": "off"
53
+ }
54
+ }
55
+ ]
56
+ },
57
+ "browserslist": {
58
+ "production": [
59
+ ">0.2%",
60
+ "not dead",
61
+ "not op_mini all"
62
+ ],
63
+ "development": [
64
+ "last 1 chrome version",
65
+ "last 1 firefox version",
66
+ "last 1 safari version"
67
+ ]
68
+ },
69
+ "devDependencies": {
70
+ "@chakra-ui/storybook-addon": "^4.0.16",
71
+ "@storybook/addon-actions": "^6.5.13",
72
+ "@storybook/addon-essentials": "^6.5.13",
73
+ "@storybook/addon-interactions": "^6.5.13",
74
+ "@storybook/addon-links": "^6.5.13",
75
+ "@storybook/builder-webpack5": "^6.5.16",
76
+ "@storybook/manager-webpack5": "^6.5.16",
77
+ "@storybook/node-logger": "^6.5.13",
78
+ "@storybook/preset-create-react-app": "^4.1.2",
79
+ "@storybook/react": "^6.5.13",
80
+ "@storybook/storybook-deployer": "^2.8.16",
81
+ "@storybook/testing-library": "^0.0.13",
82
+ "@storybook/testing-react": "^1.3.0",
83
+ "@types/body-scroll-lock": "^3.1.0",
84
+ "@types/lodash.debounce": "^4.0.7",
85
+ "@types/mdx": "^2.0.3",
86
+ "@types/react-table": "^7.7.12",
87
+ "@types/styled-components": "^5.1.26",
88
+ "@typescript-eslint/eslint-plugin": "^5.43.0",
89
+ "@typescript-eslint/parser": "^5.41.0",
90
+ "babel-plugin-named-exports-order": "^0.0.2",
91
+ "eslint": "^8.27.0",
92
+ "eslint-config-prettier": "^8.5.0",
93
+ "eslint-config-standard-with-typescript": "^23.0.0",
94
+ "eslint-plugin-import": "^2.26.0",
95
+ "eslint-plugin-n": "^15.5.1",
96
+ "eslint-plugin-promise": "^6.1.1",
97
+ "eslint-plugin-react": "^7.31.10",
98
+ "prettier": "2.7.1",
99
+ "prop-types": "^15.8.1",
100
+ "typescript": "^4.9.3",
101
+ "webpack": "^5.74.0"
102
+ }
103
+ }
@@ -0,0 +1,38 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <meta
6
+ name="viewport"
7
+ content="width=device-width, initial-scale=1, shrink-to-fit=no"
8
+ />
9
+ <meta name="theme-color" content="#000000" />
10
+ <!--
11
+ manifest.json provides metadata used when your web app is added to the
12
+ homescreen on Android. See https://developers.google.com/web/fundamentals/engage-and-retain/web-app-manifest/
13
+ -->
14
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
15
+ <link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
16
+ <!--
17
+ Notice the use of %PUBLIC_URL% in the tags above.
18
+ It will be replaced with the URL of the `public` folder during the build.
19
+ Only files inside the `public` folder can be referenced from the HTML.
20
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
21
+ work correctly both with client-side routing and a non-root public URL.
22
+ Learn how to configure a non-root public URL by running `npm run build`.
23
+ -->
24
+ <title>React App</title>
25
+ </head>
26
+ <body>
27
+ <noscript> You need to enable JavaScript to run this app. </noscript>
28
+ <div id="root"></div>
29
+ <!--
30
+ This HTML file is a template.
31
+ If you open it directly in the browser, you will see an empty page.
32
+ You can add webfonts, meta tags, or analytics to this file.
33
+ The build step will place the bundled scripts into the <body> tag.
34
+ To begin the development, run `npm start` or `yarn start`.
35
+ To create a production bundle, use `npm run build` or `yarn build`.
36
+ -->
37
+ </body>
38
+ </html>
package/setupFile.js ADDED
@@ -0,0 +1,5 @@
1
+ // setupFile.js - this will run before the tests in jest.
2
+ import { setGlobalConfig } from '@storybook/testing-react';
3
+ // path of your preview.js file
4
+ import * as globalStorybookConfig from './.storybook/preview';
5
+ setGlobalConfig(globalStorybookConfig);
package/src/App.css ADDED
@@ -0,0 +1,38 @@
1
+ .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ }
@@ -0,0 +1,9 @@
1
+ import React from 'react';
2
+ import { render, screen } from '@testing-library/react';
3
+ import App from './App';
4
+
5
+ test('renders learn react link', () => {
6
+ render(<App />);
7
+ const linkElement = screen.getByText(/learn react/i);
8
+ expect(linkElement).toBeInTheDocument();
9
+ });
package/src/App.tsx ADDED
@@ -0,0 +1,5 @@
1
+ function App() {
2
+ return <div className="App">Hello.. Please use npm run storybook</div>;
3
+ }
4
+
5
+ export default App;
@@ -0,0 +1,11 @@
1
+ import { render } from "@testing-library/react";
2
+
3
+ import { Button } from "./index";
4
+
5
+ describe("Button component testing with testing-library", () => {
6
+ it("renders without crashing", () => {
7
+ const component = render(<Button onClick={() => undefined} />);
8
+
9
+ expect(component).toBeTruthy();
10
+ });
11
+ });
@@ -0,0 +1,21 @@
1
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+
3
+ import { Button } from "./Buttons";
4
+
5
+ export default {
6
+ title: "Alicia/Common/Buttons",
7
+ component: Button,
8
+ argTypes: {},
9
+ } as ComponentMeta<typeof Button>;
10
+
11
+ const Template: ComponentStory<typeof Button> = (args) => {
12
+ return <Button {...args} />;
13
+ };
14
+
15
+ export const Primary = Template.bind({});
16
+
17
+ Primary.args = {
18
+ children: "Primary",
19
+ variant: "solid",
20
+ onChange: () => ({ variant: "primary" }),
21
+ };
@@ -0,0 +1,15 @@
1
+ import { Button as ChakraButton, ButtonProps as ChakraButtonProps} from '@chakra-ui/react'
2
+
3
+ export const Button = ( { children , ...rest } : ButtonProps) => {
4
+
5
+ return (
6
+ <>
7
+ <ChakraButton w="full" {...rest}>{children}</ChakraButton>
8
+ </>
9
+ );
10
+ };
11
+
12
+
13
+ interface ButtonProps extends ChakraButtonProps{
14
+
15
+ }
@@ -0,0 +1 @@
1
+ export { Button } from "./Buttons";
@@ -0,0 +1,31 @@
1
+ import { useEffect, useState } from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { CheckBox } from "./Checkbox";
4
+
5
+ export default {
6
+ title: "Alicia/common/Checkbox",
7
+ component: CheckBox,
8
+ } as ComponentMeta<typeof CheckBox>;
9
+
10
+ const Template: ComponentStory<typeof CheckBox> = (args) => {
11
+ const [isChecked, setIsChecked] = useState(args.isActive);
12
+
13
+ useEffect(() => {
14
+ setIsChecked(args.isActive);
15
+ }, [args.isActive]);
16
+
17
+ return (
18
+ <CheckBox
19
+ {...args}
20
+ isActive={isChecked}
21
+ onChange={() => setIsChecked(!isChecked)}
22
+ />
23
+ );
24
+ };
25
+
26
+ export const Primary = Template.bind({});
27
+
28
+ Primary.args = {
29
+ isActive: false,
30
+ label: "Checkbox",
31
+ };
@@ -0,0 +1,23 @@
1
+ import React from "react";
2
+ import {
3
+ Checkbox,
4
+ } from '@chakra-ui/react';
5
+
6
+ export const CheckBox: React.FC<CheckboxProps> = ({
7
+ isActive,
8
+ onChange,
9
+ label,
10
+ ...props
11
+ }) => {
12
+
13
+ return (
14
+ <Checkbox {...props} onChange={onChange} isChecked={isActive} variant="primary">{label}</Checkbox>
15
+ );
16
+ };
17
+
18
+ export type CheckboxProps = {
19
+ customClass?: string;
20
+ isActive?: boolean;
21
+ label?: string;
22
+ onChange: () => void;
23
+ };
@@ -0,0 +1 @@
1
+ export { CheckBox } from "./Checkbox";
@@ -0,0 +1,26 @@
1
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+
3
+ import { DateInput } from "./DateInput";
4
+
5
+ export default {
6
+ title: "Alicia/Common/DateInput",
7
+ component: DateInput,
8
+ argTypes: {},
9
+ } as ComponentMeta<typeof DateInput>;
10
+
11
+ const Template: ComponentStory<typeof DateInput> = (args) => {
12
+ return <DateInput {...args} onDateChange={(e) => console.log(e)} />;
13
+ };
14
+
15
+ export const Primary = Template.bind({});
16
+ Primary.args = {
17
+ isRequired: false,
18
+ title: '',
19
+ dateString: '',
20
+ message: '',
21
+ minDate: { date: '2009-12-12', error: 'Date cannot be older than 2009-12-12' },
22
+ maxDate: { date: '2010-12-12', error: 'Date cannot be newer than 2010-12-12' },
23
+ controlName: 'birthdate',
24
+ infoMessage: ''
25
+ };
26
+
@@ -0,0 +1,66 @@
1
+ import { FormControl, FormLabel, Input, Text, Tooltip, Flex } from '@chakra-ui/react';
2
+ import { FC, useState, useEffect } from 'react';
3
+ import { differenceInMilliseconds } from 'date-fns';
4
+ import { ReactComponent as InfoIcon } from "assets/vectors/info.svg";
5
+
6
+ export const DateInput: FC<DateInputProps> = ({ title, dateString, message, isRequired = false, minDate, maxDate, controlName, infoMessage }) => {
7
+ const [value, setValue] = useState<string>('');
8
+ const [errorMessage, setErrorMessage] = useState(message);
9
+
10
+ const onChange = (item: string) => {
11
+ setValue(item);
12
+ };
13
+
14
+ useEffect(() => {
15
+ if (dateString) {
16
+ setValue(dateString);
17
+ }
18
+ }, [dateString]);
19
+
20
+ useEffect(() => {
21
+ const selectedDate = new Date(value);
22
+ setErrorMessage('');
23
+ if (minDate) {
24
+ const minDateToSelect = new Date(minDate.date);
25
+ const minDifference = differenceInMilliseconds(minDateToSelect, selectedDate);
26
+ if (minDifference > 0) {
27
+ setErrorMessage(minDate.error ? minDate.error : 'Selected date cannot be older than ' + minDate.date);
28
+ }
29
+ }
30
+ if (maxDate) {
31
+ const maxDateToSelect = new Date(maxDate.date);
32
+ const maxDifference = differenceInMilliseconds(maxDateToSelect, selectedDate);
33
+ if (maxDifference < 0) {
34
+ setErrorMessage(maxDate.error ? maxDate.error : 'Selected date cannot be newer than ' + maxDate.date);
35
+ }
36
+ }
37
+ }, [value, minDate, maxDate]);
38
+
39
+ return (
40
+ <FormControl isRequired={isRequired}>
41
+ {title && (<Flex color='white'><FormLabel htmlFor={controlName} color={errorMessage ? 'error' : 'black'}>{title}</FormLabel>
42
+ {infoMessage && (<Tooltip bg='white' color="black" label={infoMessage} aria-label='A tooltip' hasArrow ><InfoIcon width={16} /></Tooltip>)}
43
+ </Flex>)}
44
+ <Input color={errorMessage ? 'error' : 'black'} placeholder="DD-MM-YYYY" value={value} variant='flushed' id={controlName} name={controlName} type="date" data-date-format="DD MMMM YYYY" onChange={(e) => { onChange(e.target.value); }} />
45
+ {errorMessage && (<Text fontSize='xs' color="error">{errorMessage}</Text>)}
46
+ </FormControl>
47
+ );
48
+ };
49
+
50
+ type DateInputProps = {
51
+ title?: string;
52
+ dateString?: string;
53
+ onDateChange: (value: string) => void;
54
+ message?: string;
55
+ isRequired?: boolean;
56
+ minDate?: DateProps;
57
+ maxDate?: DateProps;
58
+ controlName: string;
59
+ infoMessage?: string;
60
+ };
61
+
62
+ type DateProps = {
63
+ date: string;
64
+ error: string | null;
65
+ }
66
+
@@ -0,0 +1,26 @@
1
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
2
+ import { useState } from "react";
3
+
4
+ import { FileState, FileUpload } from "./FileUpload";
5
+
6
+ export default {
7
+ title: "Alicia/Common/FileUpload",
8
+ component: FileUpload,
9
+ argTypes: {},
10
+ } as ComponentMeta<typeof FileUpload>;
11
+
12
+ const Template: ComponentStory<typeof FileUpload> = (args) => {
13
+ const [files, setFiles] = useState<FileState[]>([]);
14
+ return <FileUpload {...args} files={files} setFiles={setFiles}/>;
15
+ };
16
+
17
+ export const Primary = Template.bind({});
18
+
19
+ Primary.args = {
20
+ maxFileSize: 25,
21
+ accept: {
22
+ 'image/*': ['.jpeg', '.jpg', '.png'],
23
+ 'application/pdf': ['.pdf'],
24
+ },
25
+ customError: ""
26
+ };