@integrigo/integrigo-ui 1.6.8 → 1.6.10

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 (260) hide show
  1. package/lib/index.d.ts +1 -1
  2. package/lib/index.esm.js +1 -1
  3. package/lib/index.esm.js.map +1 -1
  4. package/lib/index.js +1 -1
  5. package/lib/src/components/atoms/Alert/Alert.d.ts +10 -0
  6. package/lib/src/components/atoms/Alert/Alert.stories.d.ts +6 -0
  7. package/lib/src/components/atoms/Alert/index.d.ts +1 -0
  8. package/lib/src/components/atoms/Avatar/Avatar.d.ts +8 -0
  9. package/lib/src/components/atoms/Avatar/Avatar.stories.d.ts +13 -0
  10. package/lib/src/components/atoms/Avatar/Avatar.test.d.ts +1 -0
  11. package/lib/src/components/atoms/Avatar/index.d.ts +1 -0
  12. package/lib/src/components/atoms/Card/Card.d.ts +5 -0
  13. package/lib/src/components/atoms/Card/Card.stories.d.ts +5 -0
  14. package/lib/src/components/atoms/Card/index.d.ts +1 -0
  15. package/lib/src/components/atoms/Chip/Chip.d.ts +25 -0
  16. package/lib/src/components/atoms/Chip/Chip.stories.d.ts +6 -0
  17. package/lib/src/components/atoms/Chip/Chip.test.d.ts +1 -0
  18. package/lib/src/components/atoms/Chip/index.d.ts +1 -0
  19. package/lib/src/components/atoms/Divider/Divider.d.ts +5 -0
  20. package/lib/src/components/atoms/Divider/Divider.stories.d.ts +14 -0
  21. package/lib/src/components/atoms/Divider/index.d.ts +1 -0
  22. package/lib/src/components/atoms/Dot/Dot.d.ts +9 -0
  23. package/lib/src/components/atoms/Dot/Dot.stories.d.ts +42 -0
  24. package/lib/src/components/atoms/Dot/Dot.test.d.ts +1 -0
  25. package/lib/src/components/atoms/Dot/index.d.ts +1 -0
  26. package/lib/src/components/atoms/Field/FieldLabel.d.ts +7 -0
  27. package/lib/src/components/atoms/Field/FieldWrapper.d.ts +4 -0
  28. package/lib/src/components/atoms/Field/fieldSizeVariants.d.ts +22 -0
  29. package/lib/src/components/atoms/Field/index.d.ts +3 -0
  30. package/lib/src/components/atoms/Icon/Icon.d.ts +42 -0
  31. package/lib/src/components/atoms/Icon/Icon.stories.d.ts +18 -0
  32. package/lib/src/components/atoms/Icon/IconAddition.d.ts +12 -0
  33. package/lib/src/components/atoms/Icon/icons/AngleDown.d.ts +3 -0
  34. package/lib/src/components/atoms/Icon/icons/ArrowLeft.d.ts +3 -0
  35. package/lib/src/components/atoms/Icon/icons/Bars.d.ts +3 -0
  36. package/lib/src/components/atoms/Icon/icons/Bell.d.ts +3 -0
  37. package/lib/src/components/atoms/Icon/icons/ChechSquare.d.ts +3 -0
  38. package/lib/src/components/atoms/Icon/icons/CheckCircle.d.ts +3 -0
  39. package/lib/src/components/atoms/Icon/icons/ClipboardNotes.d.ts +3 -0
  40. package/lib/src/components/atoms/Icon/icons/Close.d.ts +3 -0
  41. package/lib/src/components/atoms/Icon/icons/DiceFive.d.ts +3 -0
  42. package/lib/src/components/atoms/Icon/icons/Edit.d.ts +3 -0
  43. package/lib/src/components/atoms/Icon/icons/Envelope.d.ts +3 -0
  44. package/lib/src/components/atoms/Icon/icons/ExclamationCircle.d.ts +3 -0
  45. package/lib/src/components/atoms/Icon/icons/ExclamationTriangle.d.ts +3 -0
  46. package/lib/src/components/atoms/Icon/icons/Exit.d.ts +3 -0
  47. package/lib/src/components/atoms/Icon/icons/Facebook.d.ts +3 -0
  48. package/lib/src/components/atoms/Icon/icons/Home.d.ts +3 -0
  49. package/lib/src/components/atoms/Icon/icons/ImageEdit.d.ts +3 -0
  50. package/lib/src/components/atoms/Icon/icons/Instagram.d.ts +3 -0
  51. package/lib/src/components/atoms/Icon/icons/Linkedin.d.ts +3 -0
  52. package/lib/src/components/atoms/Icon/icons/Lock.d.ts +3 -0
  53. package/lib/src/components/atoms/Icon/icons/Minus.d.ts +3 -0
  54. package/lib/src/components/atoms/Icon/icons/Phone.d.ts +3 -0
  55. package/lib/src/components/atoms/Icon/icons/Plus.d.ts +3 -0
  56. package/lib/src/components/atoms/Icon/icons/PointsCircle.d.ts +3 -0
  57. package/lib/src/components/atoms/Icon/icons/Process.d.ts +3 -0
  58. package/lib/src/components/atoms/Icon/icons/Redo.d.ts +3 -0
  59. package/lib/src/components/atoms/Icon/icons/Setting.d.ts +3 -0
  60. package/lib/src/components/atoms/Icon/icons/UserCircle.d.ts +3 -0
  61. package/lib/src/components/atoms/Icon/icons/Users.d.ts +3 -0
  62. package/lib/src/components/atoms/Icon/index.d.ts +3 -0
  63. package/lib/src/components/atoms/Initials/Initials.d.ts +7 -0
  64. package/lib/src/components/atoms/Initials/Initials.stories.d.ts +11 -0
  65. package/lib/src/components/atoms/Initials/index.d.ts +1 -0
  66. package/lib/src/components/atoms/Nav/Nav.d.ts +4 -0
  67. package/lib/src/components/atoms/Nav/Nav.stories.d.ts +5 -0
  68. package/lib/src/components/atoms/Nav/index.d.ts +1 -0
  69. package/lib/src/components/atoms/Pill/Pill.d.ts +4 -0
  70. package/lib/src/components/atoms/Pill/Pill.stories.d.ts +6 -0
  71. package/lib/src/components/atoms/Pill/index.d.ts +1 -0
  72. package/lib/src/components/atoms/Spinner/Spinner.d.ts +4 -0
  73. package/lib/src/components/atoms/Spinner/Spinner.stories.d.ts +5 -0
  74. package/lib/src/components/atoms/Spinner/index.d.ts +1 -0
  75. package/lib/src/components/atoms/Typography/Body.d.ts +6 -0
  76. package/lib/src/components/atoms/Typography/Body.stories.d.ts +8 -0
  77. package/lib/src/components/atoms/Typography/Hero.d.ts +5 -0
  78. package/lib/src/components/atoms/Typography/Hero.stories.d.ts +9 -0
  79. package/lib/src/components/atoms/Typography/Label.d.ts +7 -0
  80. package/lib/src/components/atoms/Typography/Label.stories.d.ts +9 -0
  81. package/lib/src/components/atoms/Typography/index.d.ts +6 -0
  82. package/lib/src/components/atoms/index.d.ts +11 -0
  83. package/lib/src/components/molecules/Button/BasicButton.d.ts +35 -0
  84. package/lib/src/components/molecules/Button/Button.d.ts +12 -0
  85. package/lib/src/components/molecules/Button/Button.stories.d.ts +11 -0
  86. package/lib/src/components/molecules/Button/Button.test.d.ts +1 -0
  87. package/lib/src/components/molecules/Button/Ghost.d.ts +16 -0
  88. package/lib/src/components/molecules/Button/Primary.d.ts +7 -0
  89. package/lib/src/components/molecules/Button/index.d.ts +1 -0
  90. package/lib/src/components/molecules/Checkbox/Checkbox.d.ts +9 -0
  91. package/lib/src/components/molecules/Checkbox/Checkbox.stories.d.ts +19 -0
  92. package/lib/src/components/molecules/Checkbox/index.d.ts +1 -0
  93. package/lib/src/components/molecules/Dropdown/Dropdown.d.ts +15 -0
  94. package/lib/src/components/molecules/Dropdown/Dropdown.stories.d.ts +12 -0
  95. package/lib/src/components/molecules/Dropdown/Option.d.ts +2 -0
  96. package/lib/src/components/molecules/Dropdown/index.d.ts +1 -0
  97. package/lib/src/components/molecules/InfoCard/InfoCard.d.ts +9 -0
  98. package/lib/src/components/molecules/InfoCard/InfoCard.stories.d.ts +7 -0
  99. package/lib/src/components/molecules/InfoCard/index.d.ts +1 -0
  100. package/lib/src/components/molecules/Input/Input.d.ts +20 -0
  101. package/lib/src/components/molecules/Input/Input.stories.d.ts +75 -0
  102. package/lib/src/components/molecules/Input/index.d.ts +1 -0
  103. package/lib/src/components/molecules/Profile/Profile.d.ts +8 -0
  104. package/lib/src/components/molecules/Profile/Profile.stories.d.ts +33 -0
  105. package/lib/src/components/molecules/Profile/Profile.test.d.ts +1 -0
  106. package/lib/src/components/molecules/Profile/index.d.ts +1 -0
  107. package/lib/src/components/molecules/Radio/Radio.d.ts +15 -0
  108. package/lib/src/components/molecules/Radio/Radio.stories.d.ts +20 -0
  109. package/lib/src/components/molecules/Radio/Radio.test.d.ts +1 -0
  110. package/lib/src/components/molecules/Radio/index.d.ts +1 -0
  111. package/lib/src/components/molecules/TextArea/TextArea.d.ts +6 -0
  112. package/lib/src/components/molecules/TextArea/TextArea.stories.d.ts +8 -0
  113. package/lib/src/components/molecules/TextArea/index.d.ts +1 -0
  114. package/lib/src/components/molecules/index.d.ts +8 -0
  115. package/lib/src/components/organisms/Menu/Menu.d.ts +12 -0
  116. package/lib/src/components/organisms/Menu/Menu.stories.d.ts +9 -0
  117. package/lib/src/components/organisms/Menu/MenuItem.d.ts +9 -0
  118. package/lib/src/components/organisms/Menu/index.d.ts +1 -0
  119. package/lib/src/components/organisms/Setting/Setting.d.ts +10 -0
  120. package/lib/src/components/organisms/Setting/Setting.stories.d.ts +5 -0
  121. package/lib/src/components/organisms/Setting/index.d.ts +1 -0
  122. package/lib/src/components/organisms/index.d.ts +2 -0
  123. package/lib/src/helpers/validation.d.ts +3 -0
  124. package/lib/src/index.d.ts +4 -0
  125. package/lib/src/styles/colors.d.ts +24 -0
  126. package/lib/src/styles/global.d.ts +1 -0
  127. package/lib/src/styles/index.d.ts +2 -0
  128. package/lib/src/types/validation.d.ts +1 -0
  129. package/package.json +1 -1
  130. package/src/.storybook/main.js +12 -0
  131. package/src/.storybook/preview.js +20 -0
  132. package/src/components/atoms/Alert/Alert.stories.tsx +26 -0
  133. package/src/components/atoms/Alert/Alert.tsx +107 -0
  134. package/src/components/atoms/Alert/index.ts +1 -0
  135. package/src/components/atoms/Avatar/Avatar.stories.tsx +25 -0
  136. package/src/components/atoms/Avatar/Avatar.test.tsx +17 -0
  137. package/src/components/atoms/Avatar/Avatar.tsx +34 -0
  138. package/src/components/atoms/Avatar/__snapshots__/Avatar.test.tsx.snap +13 -0
  139. package/src/components/atoms/Avatar/index.ts +1 -0
  140. package/src/components/atoms/Card/Card.stories.tsx +29 -0
  141. package/src/components/atoms/Card/Card.tsx +32 -0
  142. package/src/components/atoms/Card/index.ts +1 -0
  143. package/src/components/atoms/Chip/Chip.stories.tsx +62 -0
  144. package/src/components/atoms/Chip/Chip.test.tsx +23 -0
  145. package/src/components/atoms/Chip/Chip.tsx +233 -0
  146. package/src/components/atoms/Chip/__snapshots__/Chip.test.tsx.snap +58 -0
  147. package/src/components/atoms/Chip/index.ts +1 -0
  148. package/src/components/atoms/Divider/Divider.stories.tsx +27 -0
  149. package/src/components/atoms/Divider/Divider.tsx +12 -0
  150. package/src/components/atoms/Divider/index.ts +1 -0
  151. package/src/components/atoms/Dot/Dot.stories.tsx +35 -0
  152. package/src/components/atoms/Dot/Dot.test.tsx +9 -0
  153. package/src/components/atoms/Dot/Dot.tsx +42 -0
  154. package/src/components/atoms/Dot/index.ts +1 -0
  155. package/src/components/atoms/Field/FieldLabel.tsx +32 -0
  156. package/src/components/atoms/Field/FieldWrapper.tsx +14 -0
  157. package/src/components/atoms/Field/fieldSizeVariants.tsx +22 -0
  158. package/src/components/atoms/Field/index.ts +3 -0
  159. package/src/components/atoms/Icon/Icon.stories.tsx +39 -0
  160. package/src/components/atoms/Icon/Icon.tsx +109 -0
  161. package/src/components/atoms/Icon/IconAddition.tsx +94 -0
  162. package/src/components/atoms/Icon/icons/AngleDown.tsx +9 -0
  163. package/src/components/atoms/Icon/icons/ArrowLeft.tsx +9 -0
  164. package/src/components/atoms/Icon/icons/Bars.tsx +9 -0
  165. package/src/components/atoms/Icon/icons/Bell.tsx +9 -0
  166. package/src/components/atoms/Icon/icons/ChechSquare.tsx +9 -0
  167. package/src/components/atoms/Icon/icons/CheckCircle.tsx +9 -0
  168. package/src/components/atoms/Icon/icons/ClipboardNotes.tsx +9 -0
  169. package/src/components/atoms/Icon/icons/Close.tsx +9 -0
  170. package/src/components/atoms/Icon/icons/DiceFive.tsx +9 -0
  171. package/src/components/atoms/Icon/icons/Edit.tsx +9 -0
  172. package/src/components/atoms/Icon/icons/Envelope.tsx +9 -0
  173. package/src/components/atoms/Icon/icons/ExclamationCircle.tsx +9 -0
  174. package/src/components/atoms/Icon/icons/ExclamationTriangle.tsx +9 -0
  175. package/src/components/atoms/Icon/icons/Exit.tsx +9 -0
  176. package/src/components/atoms/Icon/icons/Facebook.tsx +9 -0
  177. package/src/components/atoms/Icon/icons/Home.tsx +9 -0
  178. package/src/components/atoms/Icon/icons/ImageEdit.tsx +9 -0
  179. package/src/components/atoms/Icon/icons/Instagram.tsx +9 -0
  180. package/src/components/atoms/Icon/icons/Linkedin.tsx +9 -0
  181. package/src/components/atoms/Icon/icons/Lock.tsx +9 -0
  182. package/src/components/atoms/Icon/icons/Minus.tsx +9 -0
  183. package/src/components/atoms/Icon/icons/Phone.tsx +9 -0
  184. package/src/components/atoms/Icon/icons/Plus.tsx +9 -0
  185. package/src/components/atoms/Icon/icons/PointsCircle.tsx +9 -0
  186. package/src/components/atoms/Icon/icons/Process.tsx +9 -0
  187. package/src/components/atoms/Icon/icons/Redo.tsx +9 -0
  188. package/src/components/atoms/Icon/icons/Setting.tsx +9 -0
  189. package/src/components/atoms/Icon/icons/UserCircle.tsx +9 -0
  190. package/src/components/atoms/Icon/icons/Users.tsx +9 -0
  191. package/src/components/atoms/Icon/index.ts +3 -0
  192. package/src/components/atoms/Initials/Initials.stories.tsx +23 -0
  193. package/src/components/atoms/Initials/Initials.tsx +36 -0
  194. package/src/components/atoms/Initials/index.ts +1 -0
  195. package/src/components/atoms/Nav/Nav.stories.tsx +19 -0
  196. package/src/components/atoms/Nav/Nav.tsx +21 -0
  197. package/src/components/atoms/Nav/index.ts +1 -0
  198. package/src/components/atoms/Pill/Pill.stories.tsx +27 -0
  199. package/src/components/atoms/Pill/Pill.tsx +17 -0
  200. package/src/components/atoms/Pill/index.ts +1 -0
  201. package/src/components/atoms/Spinner/Spinner.stories.tsx +20 -0
  202. package/src/components/atoms/Spinner/Spinner.tsx +20 -0
  203. package/src/components/atoms/Spinner/index.ts +1 -0
  204. package/src/components/atoms/Typography/Body.stories.tsx +36 -0
  205. package/src/components/atoms/Typography/Body.tsx +16 -0
  206. package/src/components/atoms/Typography/Hero.stories.tsx +36 -0
  207. package/src/components/atoms/Typography/Hero.tsx +27 -0
  208. package/src/components/atoms/Typography/Label.stories.tsx +36 -0
  209. package/src/components/atoms/Typography/Label.tsx +43 -0
  210. package/src/components/atoms/Typography/index.ts +5 -0
  211. package/src/components/atoms/index.ts +11 -0
  212. package/src/components/molecules/Button/BasicButton.tsx +137 -0
  213. package/src/components/molecules/Button/Button.stories.tsx +74 -0
  214. package/src/components/molecules/Button/Button.test.tsx +63 -0
  215. package/src/components/molecules/Button/Button.tsx +180 -0
  216. package/src/components/molecules/Button/Ghost.tsx +75 -0
  217. package/src/components/molecules/Button/Primary.tsx +41 -0
  218. package/src/components/molecules/Button/__snapshots__/Button.test.tsx.snap +208 -0
  219. package/src/components/molecules/Button/index.ts +1 -0
  220. package/src/components/molecules/Checkbox/Checkbox.stories.tsx +33 -0
  221. package/src/components/molecules/Checkbox/Checkbox.tsx +147 -0
  222. package/src/components/molecules/Checkbox/index.tsx +1 -0
  223. package/src/components/molecules/Dropdown/Dropdown.stories.tsx +30 -0
  224. package/src/components/molecules/Dropdown/Dropdown.tsx +95 -0
  225. package/src/components/molecules/Dropdown/Option.tsx +5 -0
  226. package/src/components/molecules/Dropdown/index.ts +1 -0
  227. package/src/components/molecules/InfoCard/InfoCard.stories.tsx +32 -0
  228. package/src/components/molecules/InfoCard/InfoCard.tsx +69 -0
  229. package/src/components/molecules/InfoCard/index.tsx +1 -0
  230. package/src/components/molecules/Input/Input.stories.tsx +80 -0
  231. package/src/components/molecules/Input/Input.tsx +120 -0
  232. package/src/components/molecules/Input/index.ts +1 -0
  233. package/src/components/molecules/Profile/Profile.stories.tsx +32 -0
  234. package/src/components/molecules/Profile/Profile.test.tsx +19 -0
  235. package/src/components/molecules/Profile/Profile.tsx +60 -0
  236. package/src/components/molecules/Profile/index.ts +1 -0
  237. package/src/components/molecules/Radio/Radio.stories.tsx +37 -0
  238. package/src/components/molecules/Radio/Radio.test.tsx +43 -0
  239. package/src/components/molecules/Radio/Radio.tsx +203 -0
  240. package/src/components/molecules/Radio/__snapshots__/Radio.test.tsx.snap +82 -0
  241. package/src/components/molecules/Radio/index.tsx +1 -0
  242. package/src/components/molecules/TextArea/TextArea.stories.tsx +37 -0
  243. package/src/components/molecules/TextArea/TextArea.tsx +50 -0
  244. package/src/components/molecules/TextArea/index.ts +1 -0
  245. package/src/components/molecules/index.ts +8 -0
  246. package/src/components/organisms/Menu/Menu.stories.tsx +20 -0
  247. package/src/components/organisms/Menu/Menu.tsx +29 -0
  248. package/src/components/organisms/Menu/MenuItem.tsx +62 -0
  249. package/src/components/organisms/Menu/index.ts +1 -0
  250. package/src/components/organisms/Setting/Setting.stories.tsx +21 -0
  251. package/src/components/organisms/Setting/Setting.tsx +96 -0
  252. package/src/components/organisms/Setting/index.ts +1 -0
  253. package/src/components/organisms/index.ts +2 -0
  254. package/src/global.d.ts +6 -0
  255. package/src/helpers/validation.ts +31 -0
  256. package/src/index.ts +28 -0
  257. package/src/styles/colors.ts +30 -0
  258. package/src/styles/global.ts +94 -0
  259. package/src/styles/index.ts +2 -0
  260. package/src/types/validation.ts +1 -0
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+ import { Color } from '../../../styles';
4
+
5
+ type InitialsProps = {
6
+ text: string;
7
+ size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
8
+ };
9
+
10
+ const sizeVariant = {
11
+ s: 20,
12
+ m: 32,
13
+ l: 53,
14
+ xl: 64,
15
+ xxl: 94,
16
+ };
17
+
18
+ const colorVariant = [Color.Green, Color.Navy, Color.Orange, Color.Grey60];
19
+
20
+ export const Initials: React.FC<InitialsProps> = ({ text, size = 'm' }) => (
21
+ <Root size={sizeVariant[size]} color={colorVariant[text.charCodeAt(0) % 4]}>
22
+ {text}
23
+ </Root>
24
+ );
25
+
26
+ const Root = styled.div<{ size: number, color: string }>`
27
+ background-color: ${p => p.color};
28
+ color: var(--color-white);
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ text-transform: uppercase;
33
+ width: ${(p) => p.size}px;
34
+ height: ${(p) => p.size}px;
35
+ border-radius: ${(p) => p.size / 2}px;
36
+ `;
@@ -0,0 +1 @@
1
+ export { Initials } from './Initials';
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Nav } from './Nav';
5
+
6
+ export default {
7
+ title: 'Atoms/Nav',
8
+ component: Nav,
9
+ } as ComponentMeta<typeof Nav>;
10
+
11
+ const Template: ComponentStory<typeof Nav> = (args) => <Nav {...args}>The Nav text</Nav>;
12
+
13
+ export const Basic = Template.bind({});
14
+ Basic.args = {};
15
+
16
+ export const Active = Template.bind({});
17
+ Active.args = {
18
+ active: true,
19
+ };
@@ -0,0 +1,21 @@
1
+ import styled from 'styled-components';
2
+
3
+ export interface NavProps {
4
+ active?: boolean;
5
+ }
6
+
7
+ export const Nav = styled.nav<NavProps>`
8
+ font-size: var(--font-size-l);
9
+ font-weight: ${p => p.active ? 'var(--font-bold)' : 'var(--font-medium)'};
10
+ cursor: pointer;
11
+ white-space: nowrap;
12
+ width: min-content;
13
+ transition: color var(--transition-speed);
14
+ padding: var(--padding-s) var(--padding-l);
15
+
16
+ &:hover {
17
+ color: ${p => p.active ? 'auto' : 'var(--color-green)' };
18
+ }
19
+ `;
20
+
21
+ Nav.displayName = 'Nav';
@@ -0,0 +1 @@
1
+ export { Nav } from './Nav';
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Pill } from './Pill';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Atoms/Pill',
9
+ component: Pill,
10
+ } as ComponentMeta<typeof Pill>;
11
+
12
+ const Template: ComponentStory<typeof Pill> = (args) => <Pill {...args}>Tag</Pill>;
13
+
14
+ export const Orange = Template.bind({});
15
+ Orange.args = {
16
+ variant: 'orange',
17
+ };
18
+
19
+ export const Green = Template.bind({});
20
+ Green.args = {
21
+ variant: 'green',
22
+ };
23
+
24
+ export const Red = Template.bind({});
25
+ Red.args = {
26
+ variant: 'red',
27
+ };
@@ -0,0 +1,17 @@
1
+ import styled from 'styled-components';
2
+
3
+ export interface PillProps {
4
+ variant: 'orange' | 'green' | 'red'
5
+ }
6
+
7
+ export const Pill = styled.div<PillProps>`
8
+ background-color: ${p => `var(--color-${p.variant})`};
9
+ border-radius: var(--padding-l);
10
+ color: var(--color-white);
11
+ font-weight: var(--font-bold);
12
+ font-size: var(--font-size-m);
13
+ padding: var(--padding-s) var(--padding-xxl);
14
+ width: min-content;
15
+ `;
16
+
17
+ Pill.displayName = 'Pill';
@@ -0,0 +1 @@
1
+ export { Pill } from './Pill';
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Spinner } from './Spinner';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Atoms/Spinner',
9
+ component: Spinner,
10
+ } as ComponentMeta<typeof Spinner>;
11
+
12
+ const Template: ComponentStory<typeof Spinner> = () => <Spinner />;
13
+
14
+ export const Basic = Template.bind({});
15
+ Basic.args = {
16
+ size: {
17
+ width: 20,
18
+ height: 20,
19
+ },
20
+ };
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import styled, { keyframes } from 'styled-components';
3
+ import { Icon } from '../Icon';
4
+
5
+ export type SpinnerProps = Omit<React.ComponentProps<typeof Icon>, 'type'>;
6
+
7
+ export const Spinner: React.FC<SpinnerProps> = ({ ...props }, ref) => (
8
+ <SpinnerIcon type="process" ref={ref} {...props} />
9
+ );
10
+
11
+ const rotate = keyframes`
12
+ 100% {
13
+ transform: rotate(-360deg);
14
+ }
15
+ `;
16
+
17
+ const SpinnerIcon = styled(Icon)`
18
+ animation: ${rotate} 1s linear infinite;
19
+ will-change: transform;
20
+ `;
@@ -0,0 +1 @@
1
+ export { Spinner } from './Spinner';
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Body } from './Body';
5
+
6
+ export default {
7
+ title: 'Atoms/Typography/Body',
8
+ component: Body,
9
+ } as ComponentMeta<typeof Body>;
10
+
11
+ const Template: ComponentStory<typeof Body> = (args) => <Body {...args}>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque pharetra urna non purus convallis dignissim. Sed lobortis sem molestie est euismod, euismod aliquet dolor ullamcorper. Vivamus nisl metus, ultricies ac pharetra vel, faucibus vel lacus. Vestibulum eget nisi laoreet, dignissim urna sit amet, pretium arcu. Sed non diam dictum, sollicitudin orci et, ultricies nunc. Suspendisse ultrices mi tincidunt efficitur tristique. Vivamus fringilla condimentum tempus. Aliquam varius quam sit amet nunc iaculis, finibus dictum leo tincidunt.</Body>;
12
+
13
+ export const XXL = Template.bind({});
14
+ XXL.args = {
15
+ size: 'xxl',
16
+ };
17
+
18
+ export const XL = Template.bind({});
19
+ XL.args = {
20
+ size: 'xl',
21
+ };
22
+
23
+ export const L = Template.bind({});
24
+ L.args = {
25
+ size: 'l',
26
+ };
27
+
28
+ export const M = Template.bind({});
29
+ M.args = {
30
+ size: 'm',
31
+ };
32
+
33
+ export const S = Template.bind({});
34
+ S.args = {
35
+ size: 's',
36
+ };
@@ -0,0 +1,16 @@
1
+ import styled from 'styled-components';
2
+
3
+ export interface BodyProps {
4
+ size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
5
+ align?: 'left' | 'right' | 'center';
6
+ bold?: boolean
7
+ }
8
+
9
+ export const Body = styled.p<BodyProps>`
10
+ font-size: ${(p) => `var(--font-size-${p.size || 'm'})`};
11
+ line-height: ${(p) => `calc(1.5*var(--font-size-${p.size || 'm'}))`};
12
+ text-align: ${(p) => p.align || 'left'};
13
+ font-weight: ${(p) => p.bold ? 'var(---font-bold)' : 'var(--font-thin)'};
14
+ `;
15
+
16
+ Body.displayName = 'Body';
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Hero } from './Hero';
5
+
6
+ export default {
7
+ title: 'Atoms/Typography/Hero',
8
+ component: Hero,
9
+ } as ComponentMeta<typeof Hero>;
10
+
11
+ const Template: ComponentStory<typeof Hero> = (args) => <Hero {...args}>Title</Hero>;
12
+
13
+ export const XXL = Template.bind({});
14
+ XXL.args = {
15
+ size: 'xxl',
16
+ };
17
+
18
+ export const XL = Template.bind({});
19
+ XL.args = {
20
+ size: 'xl',
21
+ };
22
+
23
+ export const L = Template.bind({});
24
+ L.args = {
25
+ size: 'l',
26
+ };
27
+
28
+ export const M = Template.bind({});
29
+ M.args = {
30
+ size: 'm',
31
+ };
32
+
33
+ export const S = Template.bind({});
34
+ S.args = {
35
+ size: 's',
36
+ };
@@ -0,0 +1,27 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export interface HeroProps {
5
+ size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
6
+ }
7
+
8
+ const SIZE_MAP: Record<string, 'h1' | 'h2' | 'h3' | 'h4' | 'h5'> = {
9
+ s: 'h5',
10
+ m: 'h4',
11
+ l: 'h3',
12
+ xl: 'h2',
13
+ xxl: 'h1',
14
+ };
15
+
16
+ export const Hero: React.FCS<HeroProps> = ({
17
+ size = 'l',
18
+ className,
19
+ children,
20
+ }) => (
21
+ <Header as={SIZE_MAP[size]} className={className}>
22
+ {children}
23
+ </Header>
24
+ );
25
+
26
+ const Header = styled.h1``;
27
+ Header.displayName = 'Header';
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Label } from './Label';
5
+
6
+ export default {
7
+ title: 'Atoms/Typography/Label',
8
+ component: Label,
9
+ } as ComponentMeta<typeof Label>;
10
+
11
+ const Template: ComponentStory<typeof Label> = (args) => <Label {...args}>The label text</Label>;
12
+
13
+ export const XXL = Template.bind({});
14
+ XXL.args = {
15
+ size: 'xxl',
16
+ };
17
+
18
+ export const XL = Template.bind({});
19
+ XL.args = {
20
+ size: 'xl',
21
+ };
22
+
23
+ export const L = Template.bind({});
24
+ L.args = {
25
+ size: 'l',
26
+ };
27
+
28
+ export const M = Template.bind({});
29
+ M.args = {
30
+ size: 'm',
31
+ };
32
+
33
+ export const S = Template.bind({});
34
+ S.args = {
35
+ size: 's',
36
+ };
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import styled from 'styled-components';
3
+
4
+ export interface LabelProps {
5
+ text: string;
6
+ size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
7
+ children?: React.ReactNode;
8
+ }
9
+
10
+ const gapSizeVariant = {
11
+ xxl: '12px',
12
+ xl: '10px',
13
+ l: '4px',
14
+ m: '4px',
15
+ s: '2px',
16
+ };
17
+
18
+ export const Label: React.FC<LabelProps> = ({
19
+ text,
20
+ size,
21
+ children,
22
+ }) => {
23
+ return (
24
+ <LabelContainer sizeVariant={size}>
25
+ {children}
26
+ <LabelText size={size}>
27
+ {text}
28
+ </LabelText>
29
+ </LabelContainer>
30
+ );
31
+ };
32
+
33
+ const LabelContainer = styled.label<{ sizeVariant: LabelProps['size'] }>`
34
+ display: flex;
35
+ align-items: center;
36
+ gap: ${(p) => gapSizeVariant[p.sizeVariant || 'm']};
37
+ `;
38
+
39
+ const LabelText = styled.span<Pick<LabelProps, 'size'>>`
40
+ font-size: ${(p) => `var(--font-size-${p.size || 'm'})`};
41
+ font-weight: var(--font-medium);
42
+ transition: color var(--transition-speed);
43
+ `;
@@ -0,0 +1,5 @@
1
+ import { Body } from './Body';
2
+ import { Hero } from './Hero';
3
+ import { Label } from './Label';
4
+
5
+ export const Typography = { Body, Hero, Label };
@@ -0,0 +1,11 @@
1
+ export { Alert } from './Alert';
2
+ export { Avatar } from './Avatar';
3
+ export { Card } from './Card';
4
+ export { Divider } from './Divider';
5
+ export { Icon } from './Icon';
6
+ export { Pill } from './Pill';
7
+ export { Typography } from './Typography';
8
+ export { Nav } from './Nav';
9
+ export { Spinner } from './Spinner';
10
+ export { Chip } from './Chip';
11
+ export { Dot } from './Dot';
@@ -0,0 +1,137 @@
1
+ import styled, { css, FlattenSimpleInterpolation } from 'styled-components';
2
+
3
+ export const sizeVariants = {
4
+ xl: {
5
+ iconPadding: '48px',
6
+ padding: '16px 24px',
7
+ ghostPadding: '32px',
8
+ font: '20px',
9
+ },
10
+ l: {
11
+ iconPadding: '40px',
12
+ padding: '12px 18px',
13
+ ghostPadding: '24px',
14
+ font: '16px',
15
+ },
16
+ m: {
17
+ iconPadding: '28px',
18
+ padding: '10px 16px',
19
+ ghostPadding: '20px',
20
+ font: '12px',
21
+ },
22
+ s: {
23
+ iconPadding: '16px',
24
+ padding: '6px 12px',
25
+ ghostPadding: '12px',
26
+ font: '8px',
27
+ },
28
+ };
29
+
30
+ export const getDirectionPadding = (
31
+ direction?: 'rtl' | 'ltr',
32
+ ghost?: boolean,
33
+ size: 'xl' | 'l' | 'm' | 's' = 'm',
34
+ ): FlattenSimpleInterpolation => {
35
+ const padding = sizeVariants[size].iconPadding;
36
+ const ghostPadding = sizeVariants[size].ghostPadding;
37
+
38
+ switch (direction) {
39
+ case 'ltr':
40
+ return css`
41
+ ${!ghost && `padding-right: ${padding};`}
42
+ padding-left: ${ghost ? ghostPadding : padding};
43
+ `;
44
+ case 'rtl':
45
+ return css`
46
+ ${!ghost && `padding-left: ${padding};`}
47
+ padding-right: ${ghost ? ghostPadding : padding};
48
+ `;
49
+ default:
50
+ return css``;
51
+ }
52
+ };
53
+
54
+ export const BasicButton = styled.div<{
55
+ direction?: 'ltr' | 'rtl';
56
+ ghost?: boolean;
57
+ disabled?: boolean;
58
+ loading?: boolean;
59
+ sizeVariant: 'xl' | 'l' | 'm' | 's';
60
+ }>`
61
+ background-color: transparent;
62
+ border: none;
63
+ border-radius: var(--padding-xl);
64
+ color: ${(p) => (p.loading ? 'transparent' : 'var(--shades-of-grey-100)')};
65
+ padding: ${(p) => sizeVariants[p.sizeVariant].padding};
66
+ font-weight: var(--font-bold);
67
+ font-size: ${(p) => sizeVariants[p.sizeVariant].font};
68
+ cursor: pointer;
69
+ overflow: hidden;
70
+ position: relative;
71
+ width: 100%;
72
+ transition: color var(--transition-speed),
73
+ background-color var(--transition-speed);
74
+
75
+ &:before {
76
+ content: "";
77
+ position: absolute;
78
+ left: 0;
79
+ top: 0;
80
+ width: calc(100% - 4px);
81
+ height: calc(100% - 4px);
82
+ background-color: transparent;
83
+ border: 2px solid var(--color-orange);
84
+ border-radius: var(--padding-xl);
85
+ z-index: 1;
86
+ transition: background-color var(--transition-speed),
87
+ opacity var(--transition-speed), border-color var(--transition-speed);
88
+ }
89
+
90
+ &:active {
91
+ color: var(--color-orange);
92
+ outline: none;
93
+ }
94
+
95
+ ${(p) => getDirectionPadding(p.direction, p.ghost, p.sizeVariant)};
96
+
97
+ &:hover {
98
+ color: var(--color-orange);
99
+ }
100
+
101
+ &:hover,
102
+ &:hover:before {
103
+ opacity: 0.8;
104
+ border-color: var(--color-orange);
105
+ }
106
+
107
+ &:hover:active,
108
+ &:hover:active:before {
109
+ opacity: 0.6;
110
+ border-color: var(--color-orange);
111
+ }
112
+
113
+ ${(p) =>
114
+ p.disabled &&
115
+ `
116
+ color: ${p.loading ? 'transparent' : 'var(--shades-of-grey-60)'};
117
+ border-color: var(--shades-of-grey-60);
118
+ background-color: var(--shades-of-grey-40);
119
+
120
+ &::before {
121
+ border-color: var(--shades-of-grey-60);
122
+ }
123
+
124
+ &:hover,
125
+ &:active,
126
+ &:hover:active,
127
+ &:hover:before,
128
+ &:hover:active:before {
129
+ color: ${p.loading ? 'transparent' : 'var(--shades-of-grey-60)'};
130
+ cursor: auto;
131
+ opacity: 1;
132
+ border-color: var(--shades-of-grey-60);
133
+ }
134
+ `}
135
+ `;
136
+
137
+ BasicButton.displayName = 'BasicButton';
@@ -0,0 +1,74 @@
1
+ import React from 'react';
2
+ import { ComponentStory, ComponentMeta } from '@storybook/react';
3
+
4
+ import { Button } from './Button';
5
+
6
+ // More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
7
+ export default {
8
+ title: 'Atoms/Button',
9
+ component: Button,
10
+ argTypes: {
11
+ loading: {
12
+ control: 'boolean',
13
+ defaultValue: false,
14
+ },
15
+ },
16
+ } as ComponentMeta<typeof Button>;
17
+
18
+ const Template: ComponentStory<typeof Button> = ({ ...args }) => (
19
+ <Button {...args}>Button</Button>
20
+ );
21
+
22
+ export const Primary = Template.bind({});
23
+ Primary.args = {
24
+ primary: true,
25
+ disabled: false,
26
+ size: 'm',
27
+ };
28
+
29
+ export const Secondary = Template.bind({});
30
+ Secondary.args = {
31
+ disabled: false,
32
+ size: 'm',
33
+ };
34
+
35
+ export const Ghost = Template.bind({});
36
+ Ghost.args = {
37
+ ghost: true,
38
+ disabled: false,
39
+ size: 'm',
40
+ };
41
+
42
+ export const IconLTR = Template.bind({});
43
+ IconLTR.args = {
44
+ primary: true,
45
+ direction: 'ltr',
46
+ icon: 'user-circle',
47
+ disabled: false,
48
+ size: 'm',
49
+ };
50
+
51
+ export const IconRTL = Template.bind({});
52
+ IconRTL.args = {
53
+ primary: true,
54
+ direction: 'rtl',
55
+ icon: 'user-circle',
56
+ disabled: false,
57
+ size: 'm',
58
+ };
59
+
60
+ export const SecondaryWithIcon = Template.bind({});
61
+ SecondaryWithIcon.args = {
62
+ icon: 'user-circle',
63
+ disabled: false,
64
+ size: 'm',
65
+ };
66
+
67
+ export const DisabledGhostWithIcon = Template.bind({});
68
+ DisabledGhostWithIcon.args = {
69
+ ghost: true,
70
+ disabled: false,
71
+ direction: 'ltr',
72
+ icon: 'user-circle',
73
+ size: 'm',
74
+ };
@@ -0,0 +1,63 @@
1
+ import React from 'react';
2
+ import { render, fireEvent, screen } from '@testing-library/react';
3
+ import userEvent from '@testing-library/user-event';
4
+ import { Button } from './Button';
5
+
6
+ describe('<Button />', () => {
7
+ it('primary button should render', () => {
8
+ render(<Button primary >Button</Button>);
9
+ });
10
+
11
+ it('secondary button should render', () => {
12
+ render(<Button>Button</Button>);
13
+ });
14
+
15
+ it('ghost button should render', () => {
16
+ render(<Button ghost>Button</Button>);
17
+ });
18
+
19
+ it('primary - should match snapshot', () => {
20
+ const { container } = render(<Button primary>Button</Button>);
21
+ expect(container).toMatchSnapshot();
22
+ });
23
+
24
+ it('primary + disabled - should match snapshot', () => {
25
+ const { container } = render(<Button primary disabled>Button</Button>);
26
+ expect(container).toMatchSnapshot();
27
+ });
28
+
29
+ it('primary + loading - should match snapshot', () => {
30
+ const { container } = render(<Button primary loading>Button</Button>);
31
+ expect(container).toMatchSnapshot();
32
+ });
33
+
34
+ it('secondary - should match snapshot', () => {
35
+ const { container } = render(<Button>Button</Button>);
36
+ expect(container).toMatchSnapshot();
37
+ });
38
+
39
+ it('secondary + disabled - should match snapshot', () => {
40
+ const { container } = render(<Button disabled>Button</Button>);
41
+ expect(container).toMatchSnapshot();
42
+ });
43
+
44
+ it('secondary + loading - should match snapshot', () => {
45
+ const { container } = render(<Button loading>Button</Button>);
46
+ expect(container).toMatchSnapshot();
47
+ });
48
+
49
+ it('ghost - should match snapshot', () => {
50
+ const { container } = render(<Button>Button</Button>);
51
+ expect(container).toMatchSnapshot();
52
+ });
53
+
54
+ it('ghost + disabled - should match snapshot', () => {
55
+ const { container } = render(<Button ghost disabled>Button</Button>);
56
+ expect(container).toMatchSnapshot();
57
+ });
58
+
59
+ it('ghost + loading - should match snapshot', () => {
60
+ const { container } = render(<Button ghost loading>Button</Button>);
61
+ expect(container).toMatchSnapshot();
62
+ });
63
+ });