pixel-react 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (444) hide show
  1. package/.prettierrc.js +13 -0
  2. package/.storybook/main.ts +26 -0
  3. package/.storybook/preview.ts +26 -0
  4. package/.yarn/install-state.gz +0 -0
  5. package/.yarnrc.yml +1 -0
  6. package/README.md +25 -0
  7. package/dist/tsconfig.tsbuildinfo +1 -0
  8. package/index.scss +0 -0
  9. package/lib/StyleGuide/ColorPalette/ColorPalette.d.ts +3 -0
  10. package/lib/StyleGuide/ColorPalette/ColorPalette.stories.d.ts +6 -0
  11. package/lib/StyleGuide/ColorPalette/colorPaletteList.d.ts +3 -0
  12. package/lib/StyleGuide/ColorPalette/index.d.ts +1 -0
  13. package/lib/StyleGuide/ColorPalette/types.d.ts +15 -0
  14. package/lib/StyleGuide/Typography/Typography.d.ts +3 -0
  15. package/lib/StyleGuide/Typography/Typography.stories.d.ts +6 -0
  16. package/lib/StyleGuide/Typography/TypographyList.d.ts +5 -0
  17. package/lib/StyleGuide/Typography/types.d.ts +8 -0
  18. package/lib/assets/utils/functionUtils.d.ts +1 -0
  19. package/lib/components/Accordion/Accordion.d.ts +8 -0
  20. package/lib/components/Accordion/Accordion.stories.d.ts +6 -0
  21. package/lib/components/Accordion/index.d.ts +1 -0
  22. package/lib/components/Accordion/types.d.ts +27 -0
  23. package/lib/components/AddResourceButton/AddButton.d.ts +4 -0
  24. package/lib/components/AddResourceButton/AddButton.stories.d.ts +8 -0
  25. package/lib/components/AddResourceButton/ArrowsButton/ArrowsButton.d.ts +6 -0
  26. package/lib/components/AddResourceButton/index.d.ts +1 -0
  27. package/lib/components/AddResourceButton/type.d.ts +65 -0
  28. package/lib/components/Button/Button.d.ts +5 -0
  29. package/lib/components/Button/Button.stories.d.ts +12 -0
  30. package/lib/components/Button/index.d.ts +1 -0
  31. package/lib/components/Button/types.d.ts +61 -0
  32. package/lib/components/Charts/DonutChart/DonutChart.d.ts +5 -0
  33. package/lib/components/Charts/DonutChart/DonutChart.stories.d.ts +6 -0
  34. package/lib/components/Charts/DonutChart/index.d.ts +1 -0
  35. package/lib/components/Charts/DonutChart/type.d.ts +13 -0
  36. package/lib/components/Charts/RadialChart/RadialChart.d.ts +5 -0
  37. package/lib/components/Charts/RadialChart/RadialChart.stories.d.ts +6 -0
  38. package/lib/components/Charts/RadialChart/index.d.ts +1 -0
  39. package/lib/components/Charts/RadialChart/types.d.ts +25 -0
  40. package/lib/components/Checkbox/Checkbox.d.ts +6 -0
  41. package/lib/components/Checkbox/Checkbox.stories.d.ts +8 -0
  42. package/lib/components/Checkbox/index.d.ts +1 -0
  43. package/lib/components/Checkbox/types.d.ts +30 -0
  44. package/lib/components/Chip/Chip.d.ts +4 -0
  45. package/lib/components/Chip/Chip.stories.d.ts +14 -0
  46. package/lib/components/Chip/index.d.ts +1 -0
  47. package/lib/components/Chip/types.d.ts +18 -0
  48. package/lib/components/Drawer/Drawer.d.ts +4 -0
  49. package/lib/components/Drawer/Drawer.stories.d.ts +7 -0
  50. package/lib/components/Drawer/Types.d.ts +85 -0
  51. package/lib/components/Drawer/index.d.ts +1 -0
  52. package/lib/components/ExpandableMenu/ExpandableMenu.d.ts +5 -0
  53. package/lib/components/ExpandableMenu/ExpandableMenu.stories.d.ts +7 -0
  54. package/lib/components/ExpandableMenu/index.d.ts +1 -0
  55. package/lib/components/ExpandableMenu/types.d.ts +34 -0
  56. package/lib/components/FileDropzone/Dropzone.d.ts +5 -0
  57. package/lib/components/FileDropzone/FileDropzone.d.ts +4 -0
  58. package/lib/components/FileDropzone/FileDropzone.stories.d.ts +8 -0
  59. package/lib/components/FileDropzone/FilePreview.d.ts +4 -0
  60. package/lib/components/FileDropzone/index.d.ts +1 -0
  61. package/lib/components/FileDropzone/types.d.ts +103 -0
  62. package/lib/components/Form/Form.d.ts +16 -0
  63. package/lib/components/Form/Form.stories.d.ts +6 -0
  64. package/lib/components/Form/index.d.ts +1 -0
  65. package/lib/components/Form/types.d.ts +1 -0
  66. package/lib/components/GridLayout/GridLayout.d.ts +6 -0
  67. package/lib/components/GridLayout/GridLayout.stories.d.ts +8 -0
  68. package/lib/components/GridLayout/index.d.ts +2 -0
  69. package/lib/components/GridLayout/types.d.ts +57 -0
  70. package/lib/components/HighlightText/HighlightText.d.ts +4 -0
  71. package/lib/components/HighlightText/HighlightText.stories.d.ts +6 -0
  72. package/lib/components/HighlightText/index.d.ts +1 -0
  73. package/lib/components/HighlightText/types.d.ts +4 -0
  74. package/lib/components/Icon/Icon.d.ts +4 -0
  75. package/lib/components/Icon/Icon.stories.d.ts +7 -0
  76. package/lib/components/Icon/iconList.d.ts +2 -0
  77. package/lib/components/Icon/index.d.ts +1 -0
  78. package/lib/components/Icon/types.d.ts +10 -0
  79. package/lib/components/Input/Input.d.ts +4 -0
  80. package/lib/components/Input/Input.stories.d.ts +9 -0
  81. package/lib/components/Input/index.d.ts +1 -0
  82. package/lib/components/Input/types.d.ts +74 -0
  83. package/lib/components/InputWithDropdown/InputWithDropdown.d.ts +4 -0
  84. package/lib/components/InputWithDropdown/InputWithDropdown.stories.d.ts +8 -0
  85. package/lib/components/InputWithDropdown/index.d.ts +1 -0
  86. package/lib/components/InputWithDropdown/types.d.ts +88 -0
  87. package/lib/components/LazyLoad/LazyLoad.d.ts +2 -0
  88. package/lib/components/LazyLoad/LazyLoad.stories.d.ts +6 -0
  89. package/lib/components/LazyLoad/LazyLoading.d.ts +2 -0
  90. package/lib/components/LazyLoad/index.d.ts +1 -0
  91. package/lib/components/MenuOption/MenuOption.d.ts +4 -0
  92. package/lib/components/MenuOption/MenuOption.stories.d.ts +15 -0
  93. package/lib/components/MenuOption/index.d.ts +1 -0
  94. package/lib/components/MenuOption/types.d.ts +134 -0
  95. package/lib/components/MiniModal/MiniModal.d.ts +4 -0
  96. package/lib/components/MiniModal/MiniModal.stories.d.ts +9 -0
  97. package/lib/components/MiniModal/index.d.ts +1 -0
  98. package/lib/components/MiniModal/types.d.ts +89 -0
  99. package/lib/components/MultiSelect/Dropdown.d.ts +4 -0
  100. package/lib/components/MultiSelect/MultiSelect.d.ts +4 -0
  101. package/lib/components/MultiSelect/MultiSelect.stories.d.ts +9 -0
  102. package/lib/components/MultiSelect/MultiSelectTypes.d.ts +18 -0
  103. package/lib/components/MultiSelect/dropdownTypes.d.ts +15 -0
  104. package/lib/components/MultiSelect/index.d.ts +1 -0
  105. package/lib/components/RadioButton/RadioButton.d.ts +4 -0
  106. package/lib/components/RadioButton/RadioButton.stories.d.ts +10 -0
  107. package/lib/components/RadioButton/index.d.ts +1 -0
  108. package/lib/components/RadioButton/radioButtonTypes.d.ts +35 -0
  109. package/lib/components/RadioGroup/RadioGroup.d.ts +4 -0
  110. package/lib/components/RadioGroup/RadioGroup.stories.d.ts +8 -0
  111. package/lib/components/RadioGroup/index.d.ts +1 -0
  112. package/lib/components/RadioGroup/radioGroupTypes.d.ts +47 -0
  113. package/lib/components/Search/Search.d.ts +4 -0
  114. package/lib/components/Search/Search.stories.d.ts +6 -0
  115. package/lib/components/Search/index.d.ts +1 -0
  116. package/lib/components/Search/types.d.ts +15 -0
  117. package/lib/components/Select/Select.d.ts +4 -0
  118. package/lib/components/Select/Select.stories.d.ts +13 -0
  119. package/lib/components/Select/components/Dropdown/Dropdown.d.ts +4 -0
  120. package/lib/components/Select/components/Dropdown/dropdownTypes.d.ts +15 -0
  121. package/lib/components/Select/index.d.ts +1 -0
  122. package/lib/components/Select/types.d.ts +68 -0
  123. package/lib/components/Table/Table.d.ts +4 -0
  124. package/lib/components/Table/Table.stories.d.ts +11 -0
  125. package/lib/components/Table/Types.d.ts +98 -0
  126. package/lib/components/Table/index.d.ts +1 -0
  127. package/lib/components/TableTree/TableTree.d.ts +21 -0
  128. package/lib/components/TableTree/TableTree.stories.d.ts +7 -0
  129. package/lib/components/TableTree/data.d.ts +313 -0
  130. package/lib/components/TableTree/index.d.ts +1 -0
  131. package/lib/components/Tabs/Tabs.d.ts +5 -0
  132. package/lib/components/Tabs/Tabs.stories.d.ts +8 -0
  133. package/lib/components/Tabs/index.d.ts +1 -0
  134. package/lib/components/Tabs/types.d.ts +40 -0
  135. package/lib/components/TextArea/Textarea.d.ts +4 -0
  136. package/lib/components/TextArea/Textarea.stories.d.ts +9 -0
  137. package/lib/components/TextArea/Types.d.ts +78 -0
  138. package/lib/components/TextArea/index.d.ts +1 -0
  139. package/lib/components/ThemeProvider/ThemeProvider.d.ts +7 -0
  140. package/lib/components/ThemeProvider/index.d.ts +1 -0
  141. package/lib/components/ThemeProvider/types.d.ts +11 -0
  142. package/lib/components/Toast/Toast.d.ts +5 -0
  143. package/lib/components/Toast/Toast.stories.d.ts +6 -0
  144. package/lib/components/Toast/index.d.ts +1 -0
  145. package/lib/components/Toast/types.d.ts +20 -0
  146. package/lib/components/Toggle/Toggle.d.ts +5 -0
  147. package/lib/components/Toggle/Toggle.stories.d.ts +12 -0
  148. package/lib/components/Toggle/index.d.ts +1 -0
  149. package/lib/components/Toggle/types.d.ts +50 -0
  150. package/lib/components/Tooltip/Tooltip.d.ts +5 -0
  151. package/lib/components/Tooltip/Tooltip.stories.d.ts +15 -0
  152. package/lib/components/Tooltip/index.d.ts +1 -0
  153. package/lib/components/Tooltip/types.d.ts +37 -0
  154. package/lib/components/Typography/Typography.d.ts +5 -0
  155. package/lib/components/Typography/Typography.stories.d.ts +10 -0
  156. package/lib/components/Typography/index.d.ts +1 -0
  157. package/lib/components/Typography/types.d.ts +47 -0
  158. package/lib/hooks/keyboardevents/useEscKeyEvent.d.ts +2 -0
  159. package/lib/hooks/useClickOutside.d.ts +2 -0
  160. package/lib/hooks/useFileDropzone.d.ts +3 -0
  161. package/lib/hooks/usePortalPosition.d.ts +9 -0
  162. package/lib/hooks/useTheme.d.ts +3 -0
  163. package/lib/index.css +404 -0
  164. package/lib/index.d.ts +1286 -0
  165. package/lib/index.esm.css +404 -0
  166. package/lib/index.esm.js +9317 -0
  167. package/lib/index.esm.js.map +1 -0
  168. package/lib/index.js +9376 -0
  169. package/lib/index.js.map +1 -0
  170. package/lib/tsconfig.tsbuildinfo +1 -0
  171. package/lib/utils/TableCell/TableCell.d.ts +1 -0
  172. package/lib/utils/checkEmpty/checkEmpty.d.ts +3 -0
  173. package/lib/utils/checkEmpty/checkEmpty.stories.d.ts +6 -0
  174. package/lib/utils/ffID/ffID.stories.d.ts +6 -0
  175. package/lib/utils/ffID/ffid.d.ts +2 -0
  176. package/lib/utils/getExtension/getExtension.d.ts +4 -0
  177. package/lib/utils/getExtension/getExtension.stories.d.ts +6 -0
  178. package/lib/utils/truncateText/truncateText.d.ts +1 -0
  179. package/lib/utils/truncateText/truncateText.stories.d.ts +6 -0
  180. package/package.json +62 -0
  181. package/rollup.config.mjs +57 -0
  182. package/src/StyleGuide/ColorPalette/ColorPalette.scss +58 -0
  183. package/src/StyleGuide/ColorPalette/ColorPalette.stories.tsx +16 -0
  184. package/src/StyleGuide/ColorPalette/ColorPalette.tsx +61 -0
  185. package/src/StyleGuide/ColorPalette/colorPaletteList.ts +97 -0
  186. package/src/StyleGuide/ColorPalette/index.ts +1 -0
  187. package/src/StyleGuide/ColorPalette/types.ts +17 -0
  188. package/src/StyleGuide/Typography/Typography.scss +100 -0
  189. package/src/StyleGuide/Typography/Typography.stories.tsx +16 -0
  190. package/src/StyleGuide/Typography/Typography.tsx +60 -0
  191. package/src/StyleGuide/Typography/TypographyList.ts +3 -0
  192. package/src/StyleGuide/Typography/types.ts +9 -0
  193. package/src/assets/Themes/BaseTheme.scss +130 -0
  194. package/src/assets/Themes/DarkTheme.scss +131 -0
  195. package/src/assets/Themes/Theme.scss +200 -0
  196. package/src/assets/icons/Arrow.svg +5 -0
  197. package/src/assets/icons/accordion_header_icon.svg +10 -0
  198. package/src/assets/icons/arrow_down.svg +3 -0
  199. package/src/assets/icons/arrow_right.svg +5 -0
  200. package/src/assets/icons/arrow_up.svg +3 -0
  201. package/src/assets/icons/arrows_down_icon.svg +3 -0
  202. package/src/assets/icons/arrows_right_icon.svg +10 -0
  203. package/src/assets/icons/arrows_top_icon.svg +3 -0
  204. package/src/assets/icons/check_mark.svg +3 -0
  205. package/src/assets/icons/close_pill.svg +3 -0
  206. package/src/assets/icons/delete.svg +17 -0
  207. package/src/assets/icons/dropzone_icon.svg +18 -0
  208. package/src/assets/icons/error.svg +17 -0
  209. package/src/assets/icons/file.svg +12 -0
  210. package/src/assets/icons/info.svg +17 -0
  211. package/src/assets/icons/logo.svg +18 -0
  212. package/src/assets/icons/manage_apps.svg +3 -0
  213. package/src/assets/icons/moon_stars.svg +10 -0
  214. package/src/assets/icons/more.svg +11 -0
  215. package/src/assets/icons/plus_icon.svg +11 -0
  216. package/src/assets/icons/remove.svg +12 -0
  217. package/src/assets/icons/replace.svg +12 -0
  218. package/src/assets/icons/search.svg +3 -0
  219. package/src/assets/icons/success.svg +13 -0
  220. package/src/assets/icons/sun_icon.svg +10 -0
  221. package/src/assets/icons/tick_icon.svg +5 -0
  222. package/src/assets/icons/toast_close.svg +3 -0
  223. package/src/assets/icons/warning.svg +17 -0
  224. package/src/assets/icons/wrong_mark.svg +3 -0
  225. package/src/assets/styles/_colors.scss +145 -0
  226. package/src/assets/styles/_fonts.scss +68 -0
  227. package/src/assets/styles/_mixins.scss +20 -0
  228. package/src/assets/utils/functionUtils.ts +5 -0
  229. package/src/components/Accordion/Accordion.scss +45 -0
  230. package/src/components/Accordion/Accordion.stories.tsx +31 -0
  231. package/src/components/Accordion/Accordion.tsx +62 -0
  232. package/src/components/Accordion/index.ts +1 -0
  233. package/src/components/Accordion/types.ts +28 -0
  234. package/src/components/AddResourceButton/AddButton.scss +36 -0
  235. package/src/components/AddResourceButton/AddButton.stories.tsx +126 -0
  236. package/src/components/AddResourceButton/AddButton.tsx +121 -0
  237. package/src/components/AddResourceButton/ArrowsButton/ArrowsButton.scss +160 -0
  238. package/src/components/AddResourceButton/ArrowsButton/ArrowsButton.tsx +38 -0
  239. package/src/components/AddResourceButton/index.ts +1 -0
  240. package/src/components/AddResourceButton/type.ts +60 -0
  241. package/src/components/Button/Button.scss +148 -0
  242. package/src/components/Button/Button.stories.tsx +74 -0
  243. package/src/components/Button/Button.tsx +66 -0
  244. package/src/components/Button/index.ts +1 -0
  245. package/src/components/Button/types.ts +65 -0
  246. package/src/components/Charts/DonutChart/DonutChart.scss +76 -0
  247. package/src/components/Charts/DonutChart/DonutChart.stories.tsx +30 -0
  248. package/src/components/Charts/DonutChart/DonutChart.tsx +241 -0
  249. package/src/components/Charts/DonutChart/index.ts +1 -0
  250. package/src/components/Charts/DonutChart/type.ts +23 -0
  251. package/src/components/Charts/RadialChart/RadialChart.scss +12 -0
  252. package/src/components/Charts/RadialChart/RadialChart.stories.tsx +36 -0
  253. package/src/components/Charts/RadialChart/RadialChart.tsx +174 -0
  254. package/src/components/Charts/RadialChart/index.ts +1 -0
  255. package/src/components/Charts/RadialChart/types.ts +32 -0
  256. package/src/components/Checkbox/Checkbox.scss +89 -0
  257. package/src/components/Checkbox/Checkbox.stories.tsx +47 -0
  258. package/src/components/Checkbox/Checkbox.tsx +61 -0
  259. package/src/components/Checkbox/index.ts +1 -0
  260. package/src/components/Checkbox/types.ts +30 -0
  261. package/src/components/Chip/Chip.scss +70 -0
  262. package/src/components/Chip/Chip.stories.tsx +88 -0
  263. package/src/components/Chip/Chip.tsx +35 -0
  264. package/src/components/Chip/index.ts +1 -0
  265. package/src/components/Chip/types.ts +19 -0
  266. package/src/components/Drawer/Drawer.scss +121 -0
  267. package/src/components/Drawer/Drawer.stories.tsx +88 -0
  268. package/src/components/Drawer/Drawer.tsx +179 -0
  269. package/src/components/Drawer/Types.ts +88 -0
  270. package/src/components/Drawer/index.ts +1 -0
  271. package/src/components/ExpandableMenu/ExpandableMenu.scss +110 -0
  272. package/src/components/ExpandableMenu/ExpandableMenu.stories.tsx +67 -0
  273. package/src/components/ExpandableMenu/ExpandableMenu.tsx +101 -0
  274. package/src/components/ExpandableMenu/index.ts +1 -0
  275. package/src/components/ExpandableMenu/types.ts +34 -0
  276. package/src/components/FileDropzone/Dropzone.tsx +55 -0
  277. package/src/components/FileDropzone/FileDropzone.scss +134 -0
  278. package/src/components/FileDropzone/FileDropzone.stories.tsx +83 -0
  279. package/src/components/FileDropzone/FileDropzone.tsx +98 -0
  280. package/src/components/FileDropzone/FilePreview.tsx +75 -0
  281. package/src/components/FileDropzone/index.ts +1 -0
  282. package/src/components/FileDropzone/types.ts +113 -0
  283. package/src/components/Form/Form.scss +98 -0
  284. package/src/components/Form/Form.stories.tsx +177 -0
  285. package/src/components/Form/Form.tsx +57 -0
  286. package/src/components/Form/index.ts +1 -0
  287. package/src/components/Form/types.ts +1 -0
  288. package/src/components/Form/validation.json +29 -0
  289. package/src/components/GridLayout/GridLayout.scss +71 -0
  290. package/src/components/GridLayout/GridLayout.stories.tsx +128 -0
  291. package/src/components/GridLayout/GridLayout.tsx +30 -0
  292. package/src/components/GridLayout/GridLayoutStory.scss +25 -0
  293. package/src/components/GridLayout/index.ts +1 -0
  294. package/src/components/GridLayout/types.ts +64 -0
  295. package/src/components/HighlightText/HighlightText.scss +3 -0
  296. package/src/components/HighlightText/HighlightText.stories.tsx +22 -0
  297. package/src/components/HighlightText/HighlightText.tsx +33 -0
  298. package/src/components/HighlightText/index.ts +1 -0
  299. package/src/components/HighlightText/types.ts +4 -0
  300. package/src/components/Icon/Icon.stories.tsx +37 -0
  301. package/src/components/Icon/Icon.tsx +43 -0
  302. package/src/components/Icon/Icons.scss +34 -0
  303. package/src/components/Icon/iconList.ts +62 -0
  304. package/src/components/Icon/index.ts +1 -0
  305. package/src/components/Icon/types.ts +10 -0
  306. package/src/components/Input/Input.scss +150 -0
  307. package/src/components/Input/Input.stories.tsx +96 -0
  308. package/src/components/Input/Input.tsx +93 -0
  309. package/src/components/Input/index.ts +1 -0
  310. package/src/components/Input/types.ts +77 -0
  311. package/src/components/InputWithDropdown/InputWithDropdown.scss +185 -0
  312. package/src/components/InputWithDropdown/InputWithDropdown.stories.tsx +114 -0
  313. package/src/components/InputWithDropdown/InputWithDropdown.tsx +85 -0
  314. package/src/components/InputWithDropdown/index.ts +1 -0
  315. package/src/components/InputWithDropdown/types.ts +110 -0
  316. package/src/components/LazyLoad/LazyLoad.d.ts +3 -0
  317. package/src/components/LazyLoad/LazyLoad.stories.tsx +33 -0
  318. package/src/components/LazyLoad/LazyLoad.ts +2 -0
  319. package/src/components/LazyLoad/LazyLoading.tsx +19 -0
  320. package/src/components/LazyLoad/index.ts +1 -0
  321. package/src/components/MenuOption/MenuOption.scss +69 -0
  322. package/src/components/MenuOption/MenuOption.stories.tsx +259 -0
  323. package/src/components/MenuOption/MenuOption.tsx +126 -0
  324. package/src/components/MenuOption/index.ts +1 -0
  325. package/src/components/MenuOption/types.ts +161 -0
  326. package/src/components/MiniModal/MiniModal.scss +139 -0
  327. package/src/components/MiniModal/MiniModal.stories.tsx +475 -0
  328. package/src/components/MiniModal/MiniModal.tsx +218 -0
  329. package/src/components/MiniModal/index.ts +1 -0
  330. package/src/components/MiniModal/types.ts +88 -0
  331. package/src/components/MultiSelect/Dropdown.scss +66 -0
  332. package/src/components/MultiSelect/Dropdown.tsx +77 -0
  333. package/src/components/MultiSelect/MultiSelect.scss +190 -0
  334. package/src/components/MultiSelect/MultiSelect.stories.tsx +85 -0
  335. package/src/components/MultiSelect/MultiSelect.tsx +260 -0
  336. package/src/components/MultiSelect/MultiSelectTypes.ts +19 -0
  337. package/src/components/MultiSelect/dropdownTypes.ts +15 -0
  338. package/src/components/MultiSelect/index.ts +1 -0
  339. package/src/components/RadioButton/RadioButton.scss +99 -0
  340. package/src/components/RadioButton/RadioButton.stories.tsx +43 -0
  341. package/src/components/RadioButton/RadioButton.tsx +32 -0
  342. package/src/components/RadioButton/index.ts +1 -0
  343. package/src/components/RadioButton/radioButtonTypes.tsx +40 -0
  344. package/src/components/RadioGroup/RadioGroup.scss +5 -0
  345. package/src/components/RadioGroup/RadioGroup.stories.tsx +81 -0
  346. package/src/components/RadioGroup/RadioGroup.tsx +30 -0
  347. package/src/components/RadioGroup/index.ts +1 -0
  348. package/src/components/RadioGroup/radioGroupTypes.tsx +54 -0
  349. package/src/components/Search/Search.scss +87 -0
  350. package/src/components/Search/Search.stories.tsx +26 -0
  351. package/src/components/Search/Search.tsx +103 -0
  352. package/src/components/Search/index.ts +1 -0
  353. package/src/components/Search/types.ts +15 -0
  354. package/src/components/Select/Select.scss +247 -0
  355. package/src/components/Select/Select.stories.tsx +156 -0
  356. package/src/components/Select/Select.tsx +368 -0
  357. package/src/components/Select/components/Dropdown/Dropdown.scss +70 -0
  358. package/src/components/Select/components/Dropdown/Dropdown.tsx +89 -0
  359. package/src/components/Select/components/Dropdown/dropdownTypes.ts +19 -0
  360. package/src/components/Select/index.ts +1 -0
  361. package/src/components/Select/types.ts +122 -0
  362. package/src/components/Table/Table.scss +101 -0
  363. package/src/components/Table/Table.stories.tsx +345 -0
  364. package/src/components/Table/Table.tsx +128 -0
  365. package/src/components/Table/Types.ts +100 -0
  366. package/src/components/Table/index.ts +1 -0
  367. package/src/components/TableTree/TableTree.scss +142 -0
  368. package/src/components/TableTree/TableTree.stories.tsx +121 -0
  369. package/src/components/TableTree/TableTree.tsx +216 -0
  370. package/src/components/TableTree/TableTreeStories.scss +22 -0
  371. package/src/components/TableTree/data.ts +573 -0
  372. package/src/components/TableTree/index.ts +1 -0
  373. package/src/components/Tabs/Tabs.scss +76 -0
  374. package/src/components/Tabs/Tabs.stories.tsx +104 -0
  375. package/src/components/Tabs/Tabs.tsx +64 -0
  376. package/src/components/Tabs/index.ts +1 -0
  377. package/src/components/Tabs/types.ts +38 -0
  378. package/src/components/TextArea/Textarea.scss +145 -0
  379. package/src/components/TextArea/Textarea.stories.tsx +92 -0
  380. package/src/components/TextArea/Textarea.tsx +84 -0
  381. package/src/components/TextArea/Types.ts +82 -0
  382. package/src/components/TextArea/index.tsx +1 -0
  383. package/src/components/ThemeProvider/ThemeProvider.tsx +24 -0
  384. package/src/components/ThemeProvider/index.ts +1 -0
  385. package/src/components/ThemeProvider/types.ts +14 -0
  386. package/src/components/Toast/Toast.scss +121 -0
  387. package/src/components/Toast/Toast.stories.tsx +180 -0
  388. package/src/components/Toast/Toast.tsx +116 -0
  389. package/src/components/Toast/index.ts +1 -0
  390. package/src/components/Toast/types.ts +27 -0
  391. package/src/components/Toggle/Toggle.scss +132 -0
  392. package/src/components/Toggle/Toggle.stories.tsx +132 -0
  393. package/src/components/Toggle/Toggle.tsx +96 -0
  394. package/src/components/Toggle/index.ts +1 -0
  395. package/src/components/Toggle/types.ts +43 -0
  396. package/src/components/Tooltip/Tooltip.scss +27 -0
  397. package/src/components/Tooltip/Tooltip.stories.tsx +97 -0
  398. package/src/components/Tooltip/Tooltip.tsx +194 -0
  399. package/src/components/Tooltip/index.ts +1 -0
  400. package/src/components/Tooltip/types.ts +60 -0
  401. package/src/components/Typography/Typography.scss +49 -0
  402. package/src/components/Typography/Typography.stories.tsx +57 -0
  403. package/src/components/Typography/Typography.tsx +39 -0
  404. package/src/components/Typography/index.ts +1 -0
  405. package/src/components/Typography/types.ts +56 -0
  406. package/src/fonts/Montserrat/Montserrat-Medium.ttf +0 -0
  407. package/src/fonts/Montserrat/Montserrat-Regular.ttf +0 -0
  408. package/src/fonts/Montserrat/Montserrat-SemiBold.ttf +0 -0
  409. package/src/fonts/Poppins/Poppins-Black.ttf +0 -0
  410. package/src/fonts/Poppins/Poppins-BlackItalic.ttf +0 -0
  411. package/src/fonts/Poppins/Poppins-Bold.ttf +0 -0
  412. package/src/fonts/Poppins/Poppins-BoldItalic.ttf +0 -0
  413. package/src/fonts/Poppins/Poppins-ExtraBold.ttf +0 -0
  414. package/src/fonts/Poppins/Poppins-ExtraBoldItalic.ttf +0 -0
  415. package/src/fonts/Poppins/Poppins-ExtraLight.ttf +0 -0
  416. package/src/fonts/Poppins/Poppins-ExtraLightItalic.ttf +0 -0
  417. package/src/fonts/Poppins/Poppins-Italic.ttf +0 -0
  418. package/src/fonts/Poppins/Poppins-Light.ttf +0 -0
  419. package/src/fonts/Poppins/Poppins-LightItalic.ttf +0 -0
  420. package/src/fonts/Poppins/Poppins-Medium.ttf +0 -0
  421. package/src/fonts/Poppins/Poppins-MediumItalic.ttf +0 -0
  422. package/src/fonts/Poppins/Poppins-Regular.ttf +0 -0
  423. package/src/fonts/Poppins/Poppins-SemiBold.ttf +0 -0
  424. package/src/fonts/Poppins/Poppins-SemiBoldItalic.ttf +0 -0
  425. package/src/fonts/Poppins/Poppins-Thin.ttf +0 -0
  426. package/src/fonts/Poppins/Poppins-ThinItalic.ttf +0 -0
  427. package/src/hooks/keyboardevents/useEscKeyEvent.tsx +31 -0
  428. package/src/hooks/useClickOutside.tsx +30 -0
  429. package/src/hooks/useFileDropzone.tsx +273 -0
  430. package/src/hooks/usePortalPosition.tsx +53 -0
  431. package/src/hooks/useTheme.tsx +13 -0
  432. package/src/index.ts +91 -0
  433. package/src/utils/TableCell/TableCell.ts +16 -0
  434. package/src/utils/checkEmpty/checkEmpty.stories.tsx +34 -0
  435. package/src/utils/checkEmpty/checkEmpty.ts +10 -0
  436. package/src/utils/ffID/ffID.stories.tsx +35 -0
  437. package/src/utils/ffID/ffid.ts +9 -0
  438. package/src/utils/getExtension/getExtension.stories.tsx +23 -0
  439. package/src/utils/getExtension/getExtension.ts +28 -0
  440. package/src/utils/truncateText/truncateText.stories.tsx +37 -0
  441. package/src/utils/truncateText/truncateText.ts +4 -0
  442. package/tsconfig.json +55 -0
  443. package/ui-library.zip +0 -0
  444. package/vite.config.js +30 -0
@@ -0,0 +1,145 @@
1
+ $brand-color: #71347b;
2
+ $text-color: #1e161f;
3
+ $icons-default-color: #71347b;
4
+ $default-icon-color: #a3a3a3;
5
+ $border-color: #f0e7f4;
6
+ $disable-color: #71347b80;
7
+ $hover-color: #f7ebff;
8
+ $pop-up-background-blur: #14041c;
9
+ $drawer-footer-bg: #ffffff;
10
+ $slider-table-color: #efe1f9;
11
+ $tooltip-bg-color: #1e161f;
12
+ $tooltip-text-color: #ffffff;
13
+ $toggle-strip-color: #cfd1e2;
14
+ $toggle-cross-color: #aeb0c0;
15
+ $toggle-strip-shadow: #00000040; // TODO : Color Name is Not Provided By Designers
16
+ $toggle-button-bg-color: #ffffff; // TODO : Color Name is Not Provided By Designers
17
+ $toggle-disable-icon-color: #767994; // TODO : Color Name is Not Provided By Designers
18
+ $arrow-button-bg-color: #ffffff; // TODO : Color Name is Not Provided By Designers
19
+ $shadow-strip-enable-shadow: #141a60;
20
+ $text-bg-highlight: #f5fb00;
21
+ $toast-msg-icon-bg: linear-gradient(180deg, #079455 0%, #00693a 100%);
22
+ $drawer-footer-border: #f0e7f4;
23
+ $primary-button-border: linear-gradient(180deg, #46164d 3.04%, #71347b 100%);
24
+ $table-header-color: #f0e7f4;
25
+ $table-lines-color: #d7b5e3;
26
+ $primary-button-color: linear-gradient(
27
+ 188.79deg,
28
+ #71347b 2.94%,
29
+ #46164d 93.09%
30
+ );
31
+
32
+ $primary-button-hover: linear-gradient(
33
+ 179.06deg,
34
+ #8d3b9a 3.49%,
35
+ #781f86 99.22%
36
+ );
37
+
38
+ $primary-button-disable: linear-gradient(180deg, #46164d 0%, $brand-color 100%);
39
+ $primary-button-text-color: #ffffff;
40
+ $secondary-button-color-text: linear-gradient(
41
+ 179.06deg,
42
+ #71347b 3.49%,
43
+ #46164d 99.22%
44
+ );
45
+ $secondary-button-text-color: #46164d;
46
+ $secondary-button-hover: linear-gradient(
47
+ 179.06deg,
48
+ #71347b0d 3.49%,
49
+ #46164d0d 99.22%
50
+ );
51
+ $tertiary-button-color: linear-gradient(
52
+ 179.06deg,
53
+ #71347b0d 3.49%,
54
+ #46164d0d 99.22%
55
+ );
56
+ $tertiary-button-hover: linear-gradient(
57
+ 179.06deg,
58
+ #71347b1a 3.49%,
59
+ #46164d1a 99.22%
60
+ );
61
+ $delete-button-color: linear-gradient(179.06deg, #e42525 3.49%, #c90000 99.22%);
62
+ $delete-button-border: linear-gradient(180deg, #a90707 3.04%, #e42525 100%);
63
+ $delete-button-hover: linear-gradient(179.06deg, #e95151 3.49%, #d43434 99.22%);
64
+ $secondary-button-color: linear-gradient(180deg, #46164d 0%, #71347b 100%);
65
+ $secondary-icon-color: #71347b;
66
+
67
+ ///!-----------------------------------------------------------------------------------------------------
68
+
69
+ $drawer-title-color: #252c37;
70
+ $button-bg-color: #f6ebff;
71
+ $description-text: #d9d9d9;
72
+ $error_light: #e42525;
73
+ $text-area-border-hover: #1e161f;
74
+ $text-area-border-color: #a3a3a3;
75
+ $default-color: #747474;
76
+
77
+ ///!-----------------------------------------------------------------------------------------------------
78
+
79
+ $description-text: #d9d9d9;
80
+ $ff-success: #079455;
81
+ $ff-warning: #f79009;
82
+ $ff-error-light: #e42525;
83
+ $ff-chips-fill-color: #f9d5ff;
84
+ $ff-chips-blur-color: #575757;
85
+ $hovered-add-button-color: #fce9ff; // TODO: Change the color variable name
86
+ $arrows-button-border-color: #ded1e5; // TODO: Change the color variable name
87
+ $add-icon-hover-color: #431b4a; ////TODO: color need to be add into style guide
88
+
89
+ $add-icon-hover-color: #431b4a; //TODO : Color Name is Not Provided By Designers
90
+ $default-icon-color: #a3a3a3;
91
+ $expandable-menu-default-bg: #fdfaff;
92
+ $expandable-menu-option-bg: #610b861a;
93
+ $file-dropzone-default-color: #71347b1a;
94
+ $file-dropzone-selected-color: #71347b33;
95
+ $file-details-container-shadow: #1e161f29;
96
+ $file-details-bg: #ffffff;
97
+
98
+ :root {
99
+ --tooltip-bg-color: #{$tooltip-bg-color};
100
+ --status-approved-text-color: #016102;
101
+ --status-warning-text-color: #ff8b00;
102
+ --status-rejected-text-color: #c60202;
103
+ --status-skipped-text-color: #3c3838;
104
+ --status-approved-bg-color: #c6efcd;
105
+ --status-rejected-bg-color: #f7d9d9;
106
+ --status-warning-bg-color: #fae2c6; // TODO: Change the color variable name
107
+ --status-skipped-bg-color: #c4c3c3; // TODO: Change the color variable name
108
+ --brand-color: #{$brand-color};
109
+ --icons-default-color: #{$icons-default-color};
110
+ --default-icon-color: #{$default-icon-color};
111
+ --default-color: #747474; // todo color need to be add into style guide
112
+ --primary-icon-color: #ffffff;
113
+ --secondary-icon-color: #71347b;
114
+ --system-color--error: #c50303;
115
+ --hover-color: #{$hover-color};
116
+ --brand2-color: #610b86; // Todo:Change the color variable name
117
+ --status-warning-hover-bg-color: #fcd8ac; // Todo:Change the color variable name
118
+ --status-percentage-growth-bg-color: #ecedf8; // Todo:Change the color variable name
119
+ --primary-icon-color: #ffffff;
120
+ --secondary-icon-color: #71347b;
121
+ --expandable-menu-default-bg: #{$expandable-menu-default-bg}; // TODO: Change the color variable name
122
+ --expandable-menu-option-bg: #{$expandable-menu-option-bg}; // TODO: Change the color variable name
123
+ --text-color: #{$text-color};
124
+ --file-dropzone-default-color: #{$file-dropzone-default-color};
125
+ --file-dropzone-selected-color: #{$file-dropzone-selected-color};
126
+ --file-details-container-shadow: #{$file-details-container-shadow}; // TODO: Change the color variable name
127
+ --file-details-bg: #{$file-details-bg}; // TODO: Change the color variable name
128
+ --error-light: #{$error_light};
129
+
130
+ --tabs-label-default-color: #{tabs-label-default-color};
131
+ --tabs-label-active-color: #{tabs-label-active-color};
132
+ --tabs-border-color: #{tabs-border-color};
133
+ --tabs-bg-color: #{tabs-bg-color};
134
+ --tab-bg-color: #{tab-bg-color};
135
+ --toggle-button-bg-color: #{$toggle-button-bg-color}; // TODO: Change the color variable name
136
+ --toggle-strip-shadow: #{$toggle-strip-shadow}; // TODO: Change the color variable name
137
+ --toggle-strip-color: #{$toggle-strip-color}; // TODO: Change the color variable name
138
+ --disable-color: #{$disable-color};
139
+ --toggle-strip-color: #{$toggle-strip-color};
140
+ --add-icon-hover-color: #{$add-icon-hover-color}; // TODO: Change the color variable name
141
+ --arrows-button-border-color: #{$arrows-button-border-color}; // TODO: Change the color variable name
142
+ --arrow-button-bg-color: #{$arrow-button-bg-color}; // TODO: Change the color variable name
143
+ --text-bg-highlight: #{$text-bg-highlight};
144
+ --slider-table-color: #{$slider-table-color};
145
+ }
@@ -0,0 +1,68 @@
1
+ @mixin fontPoppins($size: 16px) {
2
+ font-family: 'Poppins', sans-serif;
3
+ font-size: $size;
4
+ }
5
+
6
+ @font-face {
7
+ font-family: 'Poppins';
8
+ font-weight: 400;
9
+ src: local('Poppins-Regular'),
10
+ url(../../fonts/Poppins/Poppins-Regular.ttf) format('truetype');
11
+ }
12
+
13
+ @font-face {
14
+ font-family: 'Poppins';
15
+ font-weight: 500;
16
+ src: local('Poppins-Medium'),
17
+ url(../../fonts/Poppins/Poppins-Medium.ttf) format('truetype');
18
+ }
19
+
20
+ @font-face {
21
+ font-family: 'Poppins';
22
+ font-weight: 600;
23
+ src: local('Poppins-SemiBold'),
24
+ url(../../fonts/Poppins/Poppins-SemiBold.ttf) format('truetype');
25
+ }
26
+
27
+ @font-face {
28
+ font-family: 'Poppins';
29
+ font-weight: 700;
30
+ src: local('Poppins-Bold'),
31
+ url(../../fonts/Poppins/Poppins-Bold.ttf) format('truetype');
32
+ }
33
+
34
+ .fontXs {
35
+ @include fontPoppins(10px);
36
+ }
37
+
38
+ .fontSm {
39
+ @include fontPoppins(12px);
40
+ }
41
+
42
+ .fontMd {
43
+ @include fontPoppins(14px);
44
+ }
45
+
46
+ .fontLg {
47
+ @include fontPoppins(16px);
48
+ }
49
+
50
+ .fontXL {
51
+ @include fontPoppins(18px);
52
+ }
53
+
54
+ .font2Xl {
55
+ @include fontPoppins(24px);
56
+ }
57
+
58
+ .font-size-8 {
59
+ @include fontPoppins(8px);
60
+ }
61
+
62
+ .font-size-32 {
63
+ @include fontPoppins(32px);
64
+ }
65
+
66
+ .font-size-80 {
67
+ @include fontPoppins(80px);
68
+ }
@@ -0,0 +1,20 @@
1
+ // Mixin for centering content
2
+ @mixin center-content {
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ }
7
+
8
+ // Mixin for transition effects
9
+ @mixin transition($properties, $duration: 0.3s) {
10
+ transition: $properties $duration;
11
+ }
12
+
13
+ //Mixin for height, width and border
14
+ @mixin box($size, $border: none) {
15
+ width: $size;
16
+ height: $size;
17
+ @if $border != none {
18
+ border: $border;
19
+ }
20
+ }
@@ -0,0 +1,5 @@
1
+ export const isFunction = (functionToCheck: any) => {
2
+ return (
3
+ functionToCheck && {}.toString.call(functionToCheck) === '[object Function]'
4
+ );
5
+ };
@@ -0,0 +1,45 @@
1
+ @import '../../assets/styles/colors';
2
+ @import '../../assets/styles/fonts';
3
+
4
+ .ff-accordion {
5
+ border: 1px solid var(--border-color);
6
+ border-radius: 4px;
7
+ min-width: fit-content;
8
+ .accordion-header {
9
+ display: flex;
10
+ justify-content: space-between;
11
+ min-height: 32px;
12
+ .header-title {
13
+ padding: 8px;
14
+ }
15
+
16
+ .accordion-arrow {
17
+ display: flex;
18
+ padding: 8px;
19
+ align-items: center;
20
+ transition: transform 0.3s ease;
21
+ &.expanded {
22
+ transform: rotate(180deg);
23
+ }
24
+ &:hover {
25
+ color: var(--tooltip-bg-color);
26
+ }
27
+ }
28
+
29
+ &.expanded {
30
+ background-color: var(
31
+ --hover-color
32
+ ); //todo need to replace this color once it is available in the design system
33
+ border-bottom: 1px solid var(--hover-color);
34
+ }
35
+ }
36
+ .accordion-header:hover {
37
+ background-color: var(
38
+ --hover-color
39
+ ); //todo need to replace this color once it is available in the design system
40
+ }
41
+
42
+ .accordion-content {
43
+ padding: 4px;
44
+ }
45
+ }
@@ -0,0 +1,31 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import Accordion from './Accordion';
3
+ import Icon from '../Icon';
4
+
5
+ const meta: Meta<typeof Accordion> = {
6
+ title: 'Components/Accordion',
7
+ component: Accordion,
8
+ parameters: {
9
+ layout: 'padded',
10
+ },
11
+ tags: ['autodocs'],
12
+ };
13
+
14
+ type Story = StoryObj<typeof Accordion>;
15
+ const defaultArgs = {
16
+ headerTitle: 'Accordion',
17
+ };
18
+
19
+ export const SampleAccordion: Story = {
20
+ args: {
21
+ ...defaultArgs,
22
+ headerTitle: (
23
+ <div style={{ display: 'flex', gap: '8px', alignItems: 'center' }}>
24
+ <Icon name="accordion_header_icon" />
25
+ <span>Home and Web</span>
26
+ </div>
27
+ ),
28
+ },
29
+ };
30
+
31
+ export default meta;
@@ -0,0 +1,62 @@
1
+ import { useState } from 'react';
2
+ import './Accordion.scss';
3
+ import Icon from '../Icon';
4
+ import '../../../index.scss';
5
+ import { AccordionProps } from './types';
6
+ import Tooltip from '../Tooltip';
7
+ import Typography from '../Typography';
8
+
9
+ /**
10
+ * Accordion UI component
11
+ */
12
+ const Accordion = ({
13
+ headerTitle = '',
14
+ color,
15
+ minHeight = '32px', // Default min-height for accordion content
16
+ accordionContent = <>This is accordion content</>,
17
+ disable = false,
18
+ disableInfoMessage = '',
19
+ }: AccordionProps) => {
20
+ const [isAccordionExpanded, setIsAccordionExpanded] = useState(true);
21
+
22
+ const onAccordionClick = () => {
23
+ setIsAccordionExpanded(!isAccordionExpanded);
24
+ };
25
+ return (
26
+ <div className="ff-accordion">
27
+ <Tooltip title={disableInfoMessage}>
28
+ <div
29
+ className={`accordion-header ${disable && 'ff-disabled'} ${
30
+ isAccordionExpanded && 'expanded'
31
+ }`}
32
+ style={{ color: color || '--tooltip-bg-color' }}
33
+ >
34
+ <Typography
35
+ as="div"
36
+ className="header-title"
37
+ fontWeight="semi-bold"
38
+ lineHeight="18px"
39
+ >
40
+ {headerTitle}
41
+ </Typography>
42
+
43
+ <Icon
44
+ name={'arrow_up'}
45
+ hoverEffect={false}
46
+ className={`accordion-arrow ${isAccordionExpanded && 'expanded'}`}
47
+ onClick={() => {
48
+ !disable && onAccordionClick();
49
+ }}
50
+ />
51
+ </div>
52
+ </Tooltip>
53
+ {!disable && isAccordionExpanded && (
54
+ <div style={{ minHeight }} className="accordion-content">
55
+ {accordionContent}
56
+ </div>
57
+ )}
58
+ </div>
59
+ );
60
+ };
61
+
62
+ export default Accordion;
@@ -0,0 +1 @@
1
+ export { default } from './Accordion';
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+
3
+ export interface AccordionProps {
4
+ /**
5
+ * Accordion Header Title
6
+ */
7
+ headerTitle: string | JSX.Element;
8
+ /**
9
+ * Content that to be shown while Accordion is expanded
10
+ */
11
+ accordionContent: ReactNode;
12
+ /**
13
+ * Custom color for the Accordion header
14
+ */
15
+ color?: string;
16
+ /**
17
+ * Minimum height for the Accordion
18
+ */
19
+ minHeight?: string;
20
+ /**
21
+ * Property to disable accordion
22
+ */
23
+ disable?: boolean;
24
+ /**
25
+ * Info message to user for disabling accordion
26
+ */
27
+ disableInfoMessage?: string;
28
+ }
@@ -0,0 +1,36 @@
1
+ .ff-add-button-container {
2
+ position: relative;
3
+ border: none;
4
+ width: 24px;
5
+ height: 24px;
6
+ border-radius: 4px;
7
+ background-color: transparent;
8
+ &.ff-hovered-add-button--primary {
9
+ background-color: var(--hover-color);
10
+ }
11
+ .ff-hovered-add-icon--primary {
12
+ svg {
13
+ path {
14
+ fill: var(--add-icon-hover-color);
15
+ }
16
+ }
17
+ }
18
+ .ff-add-icon--primary {
19
+ svg {
20
+ path {
21
+ fill: var(--brand-color);
22
+ }
23
+ }
24
+ }
25
+ .ff-add-button {
26
+ position: absolute;
27
+ border: none;
28
+ width: 100%;
29
+ height: 100%;
30
+ display: flex;
31
+ justify-content: center;
32
+ align-items: center;
33
+ border-radius: 4px;
34
+ background: none;
35
+ }
36
+ }
@@ -0,0 +1,126 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import AddButton from './AddButton';
3
+ import { AddResourceButtonProps } from './type';
4
+
5
+ const meta: Meta<typeof AddButton> = {
6
+ title: 'Components/AddResourceButton',
7
+ component: AddButton,
8
+ parameters: {
9
+ layout: 'centered',
10
+ },
11
+ };
12
+
13
+ type Story = StoryObj<typeof AddButton>;
14
+
15
+ export const Default: Story = {
16
+ args: {
17
+ directionalArrow: [
18
+ {
19
+ direction: 'right',
20
+ menuOptions: [
21
+ {
22
+ label: 'Sub Module',
23
+ value: 'sub_module',
24
+ icon: 'plus',
25
+ disable: false,
26
+ },
27
+ ],
28
+ },
29
+ ],
30
+ } as AddResourceButtonProps,
31
+ };
32
+
33
+ export const TwoArrowsButtons: Story = {
34
+ args: {
35
+ directionalArrow: [
36
+ {
37
+ direction: 'top',
38
+ menuOptions: [
39
+ {
40
+ label: 'Add Module',
41
+ value: 'add_module',
42
+ icon: 'module_icon',
43
+ disable: false,
44
+ },
45
+ ],
46
+ },
47
+ {
48
+ direction: 'right',
49
+ menuOptions: [
50
+ {
51
+ label: 'Add Module',
52
+ value: 'add_module',
53
+ icon: 'module_icon',
54
+ disable: false,
55
+ },
56
+ ],
57
+ },
58
+ ],
59
+ } as AddResourceButtonProps,
60
+ };
61
+
62
+ export const ThreeArrowsButton: Story = {
63
+ args: {
64
+ directionalArrow: [
65
+ {
66
+ direction: 'top',
67
+ menuOptions: [
68
+ {
69
+ label: 'Module',
70
+ value: 'add_module',
71
+ icon: 'module_icon',
72
+ disable: false,
73
+ },
74
+ ],
75
+ },
76
+ {
77
+ direction: 'right',
78
+ menuOptions: [
79
+ {
80
+ label: 'Sub Module',
81
+ value: 'add_module',
82
+ icon: 'module_icon',
83
+ disable: false,
84
+ },
85
+ {
86
+ label: 'Automation Script',
87
+ value: 'add_module',
88
+ icon: 'module_icon',
89
+ disable: false,
90
+ },
91
+ {
92
+ label: 'Manual Test Case',
93
+ value: 'add_module',
94
+ icon: 'module_icon',
95
+ disable: false,
96
+ },
97
+ {
98
+ label: 'Pre / Post Condition',
99
+ value: 'add_module',
100
+ icon: 'module_icon',
101
+ disable: false,
102
+ },
103
+ {
104
+ label: 'Authorization',
105
+ value: 'add_module',
106
+ icon: 'module_icon',
107
+ disable: false,
108
+ },
109
+ ],
110
+ },
111
+ {
112
+ direction: 'down',
113
+ menuOptions: [
114
+ {
115
+ label: 'Sub Module',
116
+ value: 'sub_module',
117
+ icon: 'module_icon',
118
+ disable: false,
119
+ },
120
+ ],
121
+ },
122
+ ],
123
+ } as AddResourceButtonProps,
124
+ };
125
+
126
+ export default meta;
@@ -0,0 +1,121 @@
1
+ import './AddButton.scss';
2
+ import ArrowsButton from './ArrowsButton/ArrowsButton';
3
+ import Icon from '../Icon';
4
+ import { useRef, useState } from 'react';
5
+ import { createPortal } from 'react-dom';
6
+ import {
7
+ AddResourceButtonProps,
8
+ DirectionalArrow,
9
+ validateArrows,
10
+ } from './type';
11
+ import usePortalPosition from '../../hooks/usePortalPosition';
12
+
13
+ const AddButton = ({
14
+ id = 'AddModule',
15
+ variant = 'primary',
16
+ directionalArrow = [
17
+ {
18
+ direction: 'right',
19
+ menuOptions: [
20
+ { label: 'Sub Module', value: 'sub_module', icon: '', disable: false },
21
+ ],
22
+ },
23
+ ],
24
+ zIndex = 99,
25
+ }: AddResourceButtonProps) => {
26
+ const [isHovered, setIsHovered] = useState<boolean>(false);
27
+ const [positionArrowContainer, setPositionArrowContainer] = useState<{
28
+ left: number;
29
+ top: number;
30
+ }>({ left: 0, top: 0 });
31
+ const [activeArrow, setActiveArrow] = useState<string>('');
32
+ const arrowContainerRef = useRef<HTMLDivElement>(null);
33
+ const validArrows = validateArrows(directionalArrow);
34
+ const portalPosition = usePortalPosition(arrowContainerRef, isHovered);
35
+
36
+ const handleHover = () => {
37
+ if (!activeArrow) {
38
+ setIsHovered(true);
39
+ }
40
+ const { positionX, positionY } = portalPosition(arrowContainerRef);
41
+ setPositionArrowContainer({ left: positionX, top: positionY });
42
+ };
43
+
44
+ const handleLeave = () => {
45
+ setIsHovered(false);
46
+ setActiveArrow('');
47
+ };
48
+
49
+ const handleArrowClick = (direction: string) => {
50
+ if (activeArrow === direction) {
51
+ setActiveArrow('');
52
+ setIsHovered(false);
53
+ } else {
54
+ setActiveArrow(direction);
55
+ setIsHovered(true);
56
+ }
57
+ };
58
+
59
+ const getArrowButtonClass = () => {
60
+ const directions = validArrows
61
+ .map((arrow: { direction: string }) => arrow.direction)
62
+ .sort()
63
+ .join('-');
64
+ return `ff-${directions}`;
65
+ };
66
+
67
+ return (
68
+ <div
69
+ className={`ff-add-button-container ${
70
+ isHovered ? `ff-hovered-add-button--${variant}` : ''
71
+ }`}
72
+ id={id}
73
+ onMouseEnter={handleHover}
74
+ onMouseLeave={handleLeave}
75
+ ref={arrowContainerRef}
76
+ >
77
+ <span className="ff-add-button">
78
+ <Icon
79
+ name="plus_icon"
80
+ width={16}
81
+ height={16}
82
+ className={
83
+ isHovered
84
+ ? `ff-hovered-add-icon--${variant}`
85
+ : `ff-add-icon--${variant}`
86
+ }
87
+ />
88
+ </span>
89
+
90
+ {isHovered &&
91
+ createPortal(
92
+ <div
93
+ className={`ff-arrow-buttons-container ${getArrowButtonClass()}`}
94
+ onMouseEnter={handleHover}
95
+ onMouseLeave={handleLeave}
96
+ style={{
97
+ left: positionArrowContainer.left,
98
+ top: positionArrowContainer.top,
99
+ zIndex: zIndex,
100
+ }}
101
+ >
102
+ {directionalArrow.map(
103
+ ({ direction, menuOptions }: DirectionalArrow, index: number) => (
104
+ <ArrowsButton
105
+ key={index}
106
+ direction={direction}
107
+ onArrowClick={() => handleArrowClick(direction)}
108
+ menuOptions={menuOptions}
109
+ isActive={activeArrow === direction}
110
+ variant={variant}
111
+ />
112
+ )
113
+ )}
114
+ </div>,
115
+ document.body
116
+ )}
117
+ </div>
118
+ );
119
+ };
120
+
121
+ export default AddButton;