@oliasoft-open-source/react-ui-library 1.0.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 (317) hide show
  1. package/.eslintignore +2 -0
  2. package/.eslintrc.js +125 -0
  3. package/.gitlab-ci.yml +45 -0
  4. package/.husky/pre-commit +4 -0
  5. package/.prettierignore +3 -0
  6. package/.prettierrc +4 -0
  7. package/.storybook/main.js +36 -0
  8. package/.storybook/preview.js +40 -0
  9. package/.storybook/storybook.less +8 -0
  10. package/LICENSE +21 -0
  11. package/README.md +5 -0
  12. package/babel.config.js +31 -0
  13. package/index.js +76 -0
  14. package/jest.config.js +9 -0
  15. package/package.json +136 -0
  16. package/src/components/accordion/accordion.jsx +132 -0
  17. package/src/components/accordion/accordion.module.less +66 -0
  18. package/src/components/accordion/accordion.stories.jsx +171 -0
  19. package/src/components/accordion/chevron/chevron.jsx +12 -0
  20. package/src/components/accordion/chevron/chevron.module.less +12 -0
  21. package/src/components/accordion/helpers/accordion-with-default-toggle.jsx +106 -0
  22. package/src/components/accordion/helpers/accordion-with-default-toggle.module.less +24 -0
  23. package/src/components/actions/actions.jsx +129 -0
  24. package/src/components/actions/actions.module.less +44 -0
  25. package/src/components/actions/actions.shape.js +32 -0
  26. package/src/components/actions/actions.stories.jsx +79 -0
  27. package/src/components/badge/badge.jsx +58 -0
  28. package/src/components/badge/badge.module.less +55 -0
  29. package/src/components/badge/badge.stories.jsx +31 -0
  30. package/src/components/breadcrumb/breadcrumb.jsx +49 -0
  31. package/src/components/breadcrumb/breadcrumb.module.less +39 -0
  32. package/src/components/breadcrumb/breadcrumb.stories.jsx +45 -0
  33. package/src/components/breadcrumb/link.jsx +31 -0
  34. package/src/components/button/button.jsx +156 -0
  35. package/src/components/button/button.module.less +300 -0
  36. package/src/components/button/button.stories.jsx +74 -0
  37. package/src/components/button-group/button-group.jsx +140 -0
  38. package/src/components/button-group/button-group.module.less +24 -0
  39. package/src/components/button-group/button-group.stories-data.jsx +67 -0
  40. package/src/components/button-group/button-group.stories.jsx +63 -0
  41. package/src/components/buttons-and-links.stories.mdx +55 -0
  42. package/src/components/card/card.jsx +51 -0
  43. package/src/components/card/card.module.less +48 -0
  44. package/src/components/card/card.stories.jsx +39 -0
  45. package/src/components/check-box/check-box.jsx +92 -0
  46. package/src/components/check-box/check-box.module.less +101 -0
  47. package/src/components/check-box/check-box.stories.jsx +27 -0
  48. package/src/components/color/color.stories-data.jsx +71 -0
  49. package/src/components/color/color.stories.mdx +37 -0
  50. package/src/components/dialog/dialog.jsx +64 -0
  51. package/src/components/dialog/dialog.module.less +76 -0
  52. package/src/components/divider/divider.jsx +40 -0
  53. package/src/components/divider/divider.module.less +28 -0
  54. package/src/components/divider/divider.stories.jsx +50 -0
  55. package/src/components/drawer/drawer-tabs.jsx +43 -0
  56. package/src/components/drawer/drawer.jsx +150 -0
  57. package/src/components/drawer/drawer.module.less +167 -0
  58. package/src/components/drawer/drawer.stories.jsx +156 -0
  59. package/src/components/empty/empty.jsx +52 -0
  60. package/src/components/empty/empty.module.less +17 -0
  61. package/src/components/empty/empty.stories.jsx +26 -0
  62. package/src/components/file-input/file-input.jsx +101 -0
  63. package/src/components/file-input/file-input.module.less +3 -0
  64. package/src/components/file-input/file-input.stories.jsx +109 -0
  65. package/src/components/form/field.jsx +96 -0
  66. package/src/components/form/field.stories.jsx +101 -0
  67. package/src/components/form/form.module.less +30 -0
  68. package/src/components/form/form.stories.jsx +191 -0
  69. package/src/components/heading/heading.jsx +105 -0
  70. package/src/components/heading/heading.module.less +59 -0
  71. package/src/components/heading/heading.stories.jsx +60 -0
  72. package/src/components/icon/deprecated-icon.jsx +97 -0
  73. package/src/components/icon/icon.jsx +71 -0
  74. package/src/components/icon/icon.module.less +33 -0
  75. package/src/components/icon/icon.stories.jsx +37 -0
  76. package/src/components/icon/icons.example.module.less +4 -0
  77. package/src/components/input/input.jsx +167 -0
  78. package/src/components/input/input.module.less +94 -0
  79. package/src/components/input/input.stories.jsx +28 -0
  80. package/src/components/input-group/input-group-addon/input-group-addon.jsx +36 -0
  81. package/src/components/input-group/input-group-addon/input-group-addon.module.less +31 -0
  82. package/src/components/input-group/input-group.jsx +51 -0
  83. package/src/components/input-group/input-group.module.less +10 -0
  84. package/src/components/input-group/input-group.stories.jsx +77 -0
  85. package/src/components/input-validation.stories.mdx +61 -0
  86. package/src/components/inputs.stories.mdx +201 -0
  87. package/src/components/label/label.jsx +115 -0
  88. package/src/components/label/label.module.less +43 -0
  89. package/src/components/label/label.stories.jsx +60 -0
  90. package/src/components/layout/column/column.jsx +85 -0
  91. package/src/components/layout/column/styles.js +45 -0
  92. package/src/components/layout/column.stories.jsx +60 -0
  93. package/src/components/layout/examples/afe.stories.jsx +180 -0
  94. package/src/components/layout/examples/blowout.stories.jsx +68 -0
  95. package/src/components/layout/examples/casing-loads.stories.jsx +297 -0
  96. package/src/components/layout/examples/formation.stories.jsx +110 -0
  97. package/src/components/layout/examples/projects.stories.jsx +108 -0
  98. package/src/components/layout/examples/reservoirs.stories.jsx +211 -0
  99. package/src/components/layout/examples/site.stories.jsx +263 -0
  100. package/src/components/layout/flex/flex.jsx +48 -0
  101. package/src/components/layout/flex/flex.stories.jsx +54 -0
  102. package/src/components/layout/form-row/form-row.jsx +15 -0
  103. package/src/components/layout/form-row/form-row.module.less +11 -0
  104. package/src/components/layout/grid/grid.jsx +62 -0
  105. package/src/components/layout/grid/grid.stories.jsx +65 -0
  106. package/src/components/layout/page/page.jsx +42 -0
  107. package/src/components/layout/page/page.module.less +27 -0
  108. package/src/components/layout/page.stories.jsx +93 -0
  109. package/src/components/layout/placeholder.jsx +2 -0
  110. package/src/components/layout/print-header/print-header.jsx +22 -0
  111. package/src/components/layout/print-header/print-header.module.less +9 -0
  112. package/src/components/layout/row/row.jsx +75 -0
  113. package/src/components/layout/row/row.module.less +7 -0
  114. package/src/components/layout/spacer/spacer.jsx +26 -0
  115. package/src/components/layout/spacer/spacer.stories.jsx +50 -0
  116. package/src/components/layout-forms.stories.mdx +104 -0
  117. package/src/components/layout-general.stories.mdx +215 -0
  118. package/src/components/list/list-row/item-content.jsx +15 -0
  119. package/src/components/list/list-row/label.jsx +11 -0
  120. package/src/components/list/list-row/list-heading.jsx +52 -0
  121. package/src/components/list/list-row/list-row.jsx +128 -0
  122. package/src/components/list/list-row/list-subheading.jsx +72 -0
  123. package/src/components/list/list-row/meta-content.jsx +24 -0
  124. package/src/components/list/list-row/meta-count.jsx +10 -0
  125. package/src/components/list/list-row/name.jsx +45 -0
  126. package/src/components/list/list.jsx +276 -0
  127. package/src/components/list/list.module.less +256 -0
  128. package/src/components/list/list.stories-data.jsx +287 -0
  129. package/src/components/list/list.stories.jsx +458 -0
  130. package/src/components/list/toggle-narrow.jsx +13 -0
  131. package/src/components/loader/loader.jsx +63 -0
  132. package/src/components/loader/loader.module.less +63 -0
  133. package/src/components/loader/loader.stories.jsx +155 -0
  134. package/src/components/menu/index.js +7 -0
  135. package/src/components/menu/layer/divider.jsx +4 -0
  136. package/src/components/menu/layer/heading.jsx +15 -0
  137. package/src/components/menu/layer/layer.jsx +82 -0
  138. package/src/components/menu/layer/option.jsx +77 -0
  139. package/src/components/menu/layer/path.js +44 -0
  140. package/src/components/menu/layer/placementOptions.js +6 -0
  141. package/src/components/menu/layer/section.jsx +66 -0
  142. package/src/components/menu/menu.jsx +359 -0
  143. package/src/components/menu/menu.module.less +241 -0
  144. package/src/components/menu/menu.stories-data.jsx +168 -0
  145. package/src/components/menu/menu.stories.jsx +126 -0
  146. package/src/components/menu/menu.test.js +58 -0
  147. package/src/components/menu/trigger/button.jsx +50 -0
  148. package/src/components/menu/trigger/component.jsx +14 -0
  149. package/src/components/menu/trigger/text.jsx +25 -0
  150. package/src/components/menu/trigger/trigger.jsx +86 -0
  151. package/src/components/message/dismiss.jsx +26 -0
  152. package/src/components/message/message.jsx +137 -0
  153. package/src/components/message/message.module.less +114 -0
  154. package/src/components/message/message.stories.jsx +84 -0
  155. package/src/components/modal/modal.jsx +50 -0
  156. package/src/components/modal/modal.module.less +35 -0
  157. package/src/components/modal/modal.stories.jsx +159 -0
  158. package/src/components/option-dropdown/heading.jsx +6 -0
  159. package/src/components/option-dropdown/layer.jsx +81 -0
  160. package/src/components/option-dropdown/option-dropdown.jsx +53 -0
  161. package/src/components/option-dropdown/option-dropdown.module.less +50 -0
  162. package/src/components/option-dropdown/option-dropdown.stories.jsx +35 -0
  163. package/src/components/option-dropdown/option.jsx +13 -0
  164. package/src/components/pagination/pagination.jsx +139 -0
  165. package/src/components/pagination/pagination.module.less +11 -0
  166. package/src/components/pagination/pagination.stories.jsx +78 -0
  167. package/src/components/pagination/pagination.test.js +92 -0
  168. package/src/components/pagination/pagination.viewdata.js +66 -0
  169. package/src/components/pop-confirm/content.jsx +25 -0
  170. package/src/components/pop-confirm/pop-confirm.jsx +61 -0
  171. package/src/components/pop-confirm/pop-confirm.module.less +18 -0
  172. package/src/components/pop-confirm/pop-confirm.stories.jsx +53 -0
  173. package/src/components/popover/popover.jsx +112 -0
  174. package/src/components/popover/popover.module.less +22 -0
  175. package/src/components/popover/popover.stories.jsx +59 -0
  176. package/src/components/portal/portal.jsx +16 -0
  177. package/src/components/portal/portal.stories.jsx +69 -0
  178. package/src/components/progress-bar/progress-bar.jsx +64 -0
  179. package/src/components/progress-bar/progress-bar.module.less +64 -0
  180. package/src/components/progress-bar/progress-bar.stories.jsx +23 -0
  181. package/src/components/radio-button/radio-button.jsx +139 -0
  182. package/src/components/radio-button/radio-button.module.less +135 -0
  183. package/src/components/radio-button/radio-button.stories.jsx +37 -0
  184. package/src/components/radio-button/radio-input.jsx +52 -0
  185. package/src/components/select/custom-select/custom-select.jsx +440 -0
  186. package/src/components/select/custom-select/custom-select.module.less +123 -0
  187. package/src/components/select/custom-select/custom-select.reducer.js +157 -0
  188. package/src/components/select/custom-select/layer/heading.jsx +13 -0
  189. package/src/components/select/custom-select/layer/layer.jsx +73 -0
  190. package/src/components/select/custom-select/layer/option.jsx +54 -0
  191. package/src/components/select/custom-select/layer/placementOptions.js +7 -0
  192. package/src/components/select/custom-select/layer/section.jsx +35 -0
  193. package/src/components/select/custom-select/trigger/input.jsx +100 -0
  194. package/src/components/select/custom-select/trigger/trigger.jsx +155 -0
  195. package/src/components/select/custom-select/trigger/trigger.module.less +289 -0
  196. package/src/components/select/native-select/native-select.jsx +198 -0
  197. package/src/components/select/native-select/native-select.module.less +107 -0
  198. package/src/components/select/select.input.js +146 -0
  199. package/src/components/select/select.jsx +207 -0
  200. package/src/components/select/select.stories-data.jsx +92 -0
  201. package/src/components/select/select.stories.jsx +135 -0
  202. package/src/components/select/select.test.js +519 -0
  203. package/src/components/side-bar/container.module.less +29 -0
  204. package/src/components/side-bar/link.jsx +83 -0
  205. package/src/components/side-bar/sections.jsx +23 -0
  206. package/src/components/side-bar/side-bar.jsx +102 -0
  207. package/src/components/side-bar/side-bar.module.less +137 -0
  208. package/src/components/side-bar/side-bar.stories.jsx +101 -0
  209. package/src/components/slider/rc-slider.less +47 -0
  210. package/src/components/slider/slider-tooltip.jsx +20 -0
  211. package/src/components/slider/slider.jsx +233 -0
  212. package/src/components/slider/slider.module.less +40 -0
  213. package/src/components/slider/slider.stories.jsx +110 -0
  214. package/src/components/spinner/spinner.jsx +37 -0
  215. package/src/components/spinner/spinner.module.less +115 -0
  216. package/src/components/spinner/spinner.stories.jsx +24 -0
  217. package/src/components/table/cell/cell.jsx +614 -0
  218. package/src/components/table/cell/cell.module.less +152 -0
  219. package/src/components/table/footer/footer.jsx +66 -0
  220. package/src/components/table/footer/footer.module.less +14 -0
  221. package/src/components/table/helper.js +64 -0
  222. package/src/components/table/helper.test.js +166 -0
  223. package/src/components/table/icon/icon.module.less +31 -0
  224. package/src/components/table/row/expanded-content-row.jsx +16 -0
  225. package/src/components/table/row/row.jsx +253 -0
  226. package/src/components/table/row/row.module.less +62 -0
  227. package/src/components/table/table-scroll-wrapper.jsx +48 -0
  228. package/src/components/table/table.jsx +232 -0
  229. package/src/components/table/table.module.less +145 -0
  230. package/src/components/table/table.stories-data.jsx +752 -0
  231. package/src/components/table/table.stories.jsx +814 -0
  232. package/src/components/table/table.test.js +30 -0
  233. package/src/components/table/table.variables.less +19 -0
  234. package/src/components/table/table.viewdata.js +26 -0
  235. package/src/components/table/title/title.jsx +30 -0
  236. package/src/components/table/title/title.module.less +9 -0
  237. package/src/components/tabs/content.jsx +14 -0
  238. package/src/components/tabs/label.jsx +50 -0
  239. package/src/components/tabs/tabs.jsx +191 -0
  240. package/src/components/tabs/tabs.module.less +73 -0
  241. package/src/components/tabs/tabs.stories.jsx +110 -0
  242. package/src/components/text/text.jsx +64 -0
  243. package/src/components/text/text.module.less +45 -0
  244. package/src/components/text/text.stories.jsx +31 -0
  245. package/src/components/text-link/text-link.jsx +23 -0
  246. package/src/components/text-link/text-link.stories.jsx +20 -0
  247. package/src/components/textarea/textarea.jsx +126 -0
  248. package/src/components/textarea/textarea.module.less +55 -0
  249. package/src/components/textarea/textarea.stories.jsx +26 -0
  250. package/src/components/toaster/toaster.jsx +39 -0
  251. package/src/components/toaster/toaster.less +17 -0
  252. package/src/components/toaster/toaster.stories.jsx +116 -0
  253. package/src/components/toggle/toggle.jsx +65 -0
  254. package/src/components/toggle/toggle.module.less +139 -0
  255. package/src/components/toggle/toggle.stories.jsx +26 -0
  256. package/src/components/tooltip/tooltip-layer.jsx +72 -0
  257. package/src/components/tooltip/tooltip.jsx +108 -0
  258. package/src/components/tooltip/tooltip.module.less +28 -0
  259. package/src/components/tooltip/tooltip.stories.jsx +71 -0
  260. package/src/components/top-bar/element/element.jsx +72 -0
  261. package/src/components/top-bar/element/link.jsx +29 -0
  262. package/src/components/top-bar/title.jsx +24 -0
  263. package/src/components/top-bar/top-bar.jsx +79 -0
  264. package/src/components/top-bar/top-bar.module.less +191 -0
  265. package/src/components/top-bar/top-bar.stories.jsx +137 -0
  266. package/src/components/top-bar/warning.jsx +6 -0
  267. package/src/components/tree/tree-item.jsx +79 -0
  268. package/src/components/tree/tree-placeholder.jsx +6 -0
  269. package/src/components/tree/tree.jsx +129 -0
  270. package/src/components/tree/tree.module.less +33 -0
  271. package/src/components/tree/tree.stories-data.jsx +89 -0
  272. package/src/components/tree/tree.stories.jsx +106 -0
  273. package/src/docs/components/page/page.jsx +16 -0
  274. package/src/docs/config/config.js +1 -0
  275. package/src/docs/html/favicon.png +0 -0
  276. package/src/docs/html/index.html +11 -0
  277. package/src/docs/navigation/footer/footer.jsx +48 -0
  278. package/src/docs/navigation/header/header.jsx +39 -0
  279. package/src/docs/navigation/header/header.module.less +32 -0
  280. package/src/docs/navigation/routes/routes.jsx +16 -0
  281. package/src/docs/start.jsx +12 -0
  282. package/src/docs/views/main/main.jsx +209 -0
  283. package/src/docs/views/main/main.module.less +14 -0
  284. package/src/docs/views/not-found/not-found.jsx +5 -0
  285. package/src/helpers/disabled-context.js +8 -0
  286. package/src/helpers/styles.js +68 -0
  287. package/src/helpers/text.js +6 -0
  288. package/src/helpers/types.js +5 -0
  289. package/src/hooks/index.js +3 -0
  290. package/src/hooks/use-focus.js +11 -0
  291. package/src/hooks/use-keyboard-event.js +16 -0
  292. package/src/hooks/use-window-width.js +20 -0
  293. package/src/images/icons/icon-drop.png +0 -0
  294. package/src/images/icons/icon-share.png +0 -0
  295. package/src/images/icons/icons8-junction.svg +4 -0
  296. package/src/images/logo.png +0 -0
  297. package/src/images/logo.svg +13 -0
  298. package/src/images/oliasoft-logo.svg +1 -0
  299. package/src/style/colors.less +26 -0
  300. package/src/style/external.less +10 -0
  301. package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
  302. package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
  303. package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
  304. package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
  305. package/src/style/fonts.less +27 -0
  306. package/src/style/global.less +51 -0
  307. package/src/style/mixins.less +67 -0
  308. package/src/style/reset/reset.less +34 -0
  309. package/src/style/shared.less +25 -0
  310. package/src/style/theme.dark.less +37 -0
  311. package/src/style/theme.default.less +74 -0
  312. package/src/style/variables.less +49 -0
  313. package/webpack/webpack.common.js +39 -0
  314. package/webpack/webpack.common.rules.js +102 -0
  315. package/webpack/webpack.dev.js +22 -0
  316. package/webpack/webpack.prod.js +23 -0
  317. package/webpack/webpack.resolve.js +22 -0
@@ -0,0 +1,752 @@
1
+ import React from 'react';
2
+ import {
3
+ FaArrowDown,
4
+ FaArrowUp,
5
+ FaCheck,
6
+ FaExclamationCircle,
7
+ FaExclamationTriangle,
8
+ FaHeartbeat,
9
+ FaMinus,
10
+ FaPlus,
11
+ FaShareSquare,
12
+ } from 'react-icons/fa';
13
+ import { Text } from '../text/text';
14
+
15
+ export const table = {
16
+ headers: [
17
+ {
18
+ cells: [
19
+ { value: 'Name' },
20
+ { value: 'Weight' },
21
+ { value: 'Energy' },
22
+ { value: 'Origin' },
23
+ ],
24
+ },
25
+ ],
26
+ rows: [
27
+ {
28
+ cells: [
29
+ { value: 'Brown rice', testId: 'table-tbody-cell-brown-rice' },
30
+ { value: 100, testId: 'table-tbody-cell-100' },
31
+ { value: 361, testId: 'table-tbody-cell-361' },
32
+ { value: 'Vietnam', testId: 'table-tbody-cell-vietnam' },
33
+ ],
34
+ },
35
+ {
36
+ cells: [
37
+ { value: 'Buckwheat', testId: 'table-tbody-cell-buckwheat' },
38
+ { value: 50, testId: 'table-tbody-cell-50' },
39
+ { value: 358, testId: 'table-tbody-cell-358' },
40
+ { value: 'Poland', testId: 'table-tbody-cell-poland' },
41
+ ],
42
+ },
43
+ {
44
+ cells: [
45
+ { value: 'Couscous', testId: 'table-tbody-cell-couscous' },
46
+ { value: 10, testId: 'table-tbody-cell-10' },
47
+ { value: 368, testId: 'table-tbody-cell-368' },
48
+ { value: 'France', testId: 'table-tbody-cell-france' },
49
+ ],
50
+ },
51
+ ],
52
+ };
53
+
54
+ export const tableColumnWidths = {
55
+ ...table,
56
+ columnWidths: ['200px', '20%', '100px', 'auto'],
57
+ };
58
+
59
+ export const tableStaticTooltips = {
60
+ ...table,
61
+ rows: table.rows.map((row) => ({
62
+ ...row,
63
+ cells: row.cells.map((cell) => ({ ...cell, tooltip: 'Tooltip' })),
64
+ })),
65
+ };
66
+
67
+ export const tableBreakLongContent = {
68
+ ...table,
69
+ rows: [
70
+ {
71
+ cells: [
72
+ {
73
+ breakWord: true,
74
+ value:
75
+ 'LoremipsumdolorsitametconsecteturadipiscingelitseddoeiusmodtemporincididuntutlaboreetdoloremagnaaliquaUtenimadminimveniamquisnostrudexercitationullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeullamcolaborisnisiutaliquipexeacommodoconsequatDuisauteiruredolorinreprehenderitinvoluptatevelitessecillumdoloreeufugiatnullapariaturufugiatnullapariatur',
76
+ },
77
+ { value: 100 },
78
+ { value: 361 },
79
+ { value: 'Vietnam' },
80
+ ],
81
+ },
82
+ ...table.rows,
83
+ ],
84
+ };
85
+
86
+ export const tableUnits = {
87
+ ...table,
88
+ headers: [
89
+ ...table.headers,
90
+ {
91
+ cells: [
92
+ {},
93
+ {
94
+ options: [
95
+ { label: 'kg', value: 'kg' },
96
+ { label: 'tonnes', value: 'tonnes' },
97
+ ],
98
+ type: 'Select',
99
+ searchable: false,
100
+ value: { label: 'kg', value: 'kg' },
101
+ onChange: () => {},
102
+ },
103
+ { type: 'Unit', value: 'kcal / 100g' },
104
+ {},
105
+ ],
106
+ },
107
+ ],
108
+ };
109
+
110
+ export const tableActiveRow = {
111
+ ...table,
112
+ rows: table.rows.map((row, index) => ({
113
+ ...row,
114
+ active: index === 0,
115
+ onRowClick: () => {},
116
+ })),
117
+ };
118
+
119
+ export const tableTitle = {
120
+ ...table,
121
+ name: 'Food',
122
+ };
123
+
124
+ export const tableChildComponent = {
125
+ ...table,
126
+ name: 'Food',
127
+ actions: [{ childComponent: <FaHeartbeat /> }],
128
+ };
129
+
130
+ export const tableInfiniteScroll = {
131
+ ...table,
132
+ headers: [
133
+ ...table.headers,
134
+ {
135
+ cells: [
136
+ {},
137
+ {
138
+ options: [
139
+ { label: 'kg', value: 'kg' },
140
+ { label: 'tonnes', value: 'tonnes' },
141
+ ],
142
+ type: 'Select',
143
+ native: true,
144
+ value: { label: 'kg', value: 'kg' },
145
+ onChange: () => {},
146
+ },
147
+ { type: 'Unit', value: 'kcal / 100g' },
148
+ {},
149
+ ],
150
+ },
151
+ ],
152
+ bordered: true,
153
+ infiniteScroll: true,
154
+ maxHeight: '500px',
155
+ stickyHeaders: true,
156
+ rows: Array.from({ length: 100 }, (_, index) => ({
157
+ cells: [
158
+ { type: 'Input', value: `Strawberry Letter ${index + 1}` },
159
+ { type: 'Input', value: 100 },
160
+ { type: 'Input', value: 361 },
161
+ { type: 'Input', value: 'Vietnam' },
162
+ ],
163
+ })),
164
+ footer: {
165
+ content: (
166
+ <>
167
+ <strong>Footer content:</strong> goes here
168
+ </>
169
+ ),
170
+ },
171
+ };
172
+
173
+ export const tableInfiniteScrollDnD = {
174
+ ...tableInfiniteScroll,
175
+ draggable: true,
176
+ };
177
+
178
+ export const tableRowFocus = {
179
+ ...table,
180
+ rows: table.rows.map((row, index) => ({
181
+ ...row,
182
+ onRowFocus: () => {},
183
+ })),
184
+ };
185
+
186
+ const subComponent = () => {
187
+ return (
188
+ <ul>
189
+ <li>Carrots</li>
190
+ <li>Chocolate</li>
191
+ <li>Chorizo</li>
192
+ </ul>
193
+ );
194
+ };
195
+
196
+ export const tableJsxContent = {
197
+ headers: [
198
+ {
199
+ cells: [{ value: 'Name' }, { value: 'Content' }],
200
+ },
201
+ ],
202
+ rows: [
203
+ {
204
+ cells: [{ value: 'Sub-component' }, { value: subComponent() }],
205
+ },
206
+ {
207
+ cells: [
208
+ { value: 'JSX' },
209
+ {
210
+ value: (
211
+ <div>
212
+ Some <Text bold>bold content</Text>
213
+ </div>
214
+ ),
215
+ },
216
+ ],
217
+ },
218
+ ],
219
+ };
220
+
221
+ export const tableColspan = {
222
+ ...table,
223
+ headers: [
224
+ {
225
+ cells: [{ value: '' }, { value: 'Stats', colSpan: 2 }, { value: '' }],
226
+ },
227
+ ...table.headers,
228
+ ],
229
+ rows: [
230
+ ...table.rows,
231
+ {
232
+ cells: [{ value: 'Total', colSpan: 4 }],
233
+ },
234
+ ],
235
+ };
236
+
237
+ export const tableAlignment = {
238
+ ...tableColspan,
239
+ columnAlignment: ['left', 'right', 'right', 'left', 'right'],
240
+ columnHeaderAlignments: [
241
+ ['', 'center', ''],
242
+ ['', 'right', 'right', ''],
243
+ ['', 'right', 'right', ''],
244
+ ],
245
+ };
246
+
247
+ export const tableEditable = {
248
+ headers: [
249
+ {
250
+ cells: [
251
+ { value: 'Name', testId: 'with-editable-cells-cell-name' },
252
+ { value: 'Weight (kg)' },
253
+ { value: 'Energy (kcal / 100g)' },
254
+ { value: 'Origin' },
255
+ ],
256
+ },
257
+ ],
258
+ rows: [
259
+ {
260
+ cells: [
261
+ {
262
+ value: 'Brown rice',
263
+ type: 'Input',
264
+ onChange: () => {},
265
+ testId: 'table-tbody-cell-brown-rice',
266
+ disabled: true,
267
+ },
268
+ {
269
+ type: 'Select',
270
+ native: true,
271
+ options: [
272
+ { label: 50, value: 50 },
273
+ { label: 100, value: 100 },
274
+ ],
275
+ value: { label: 100, value: 100 },
276
+ onChange: () => {},
277
+ },
278
+ { value: 361, type: 'Input', onChange: () => {} },
279
+ {
280
+ type: 'Select',
281
+ options: [
282
+ { label: 'France', value: 'France' },
283
+ { label: 'Poland', value: 'Poland' },
284
+ { label: 'Vietnam', value: 'Vietnam' },
285
+ ],
286
+ value: { label: 'Vietnam', value: 'Vietnam' },
287
+ onChange: () => {},
288
+ },
289
+ ],
290
+ },
291
+ {
292
+ cells: [
293
+ {
294
+ value: 'Buckwheat',
295
+ type: 'Input',
296
+ onChange: () => {},
297
+ testId: 'table-tbody-cell-buckwheat',
298
+ },
299
+ {
300
+ type: 'Select',
301
+ native: true,
302
+ options: [
303
+ { label: 50, value: 50 },
304
+ { label: 100, value: 100 },
305
+ ],
306
+ value: { label: 100, value: 100 },
307
+ onChange: () => {},
308
+ },
309
+ { value: 361, type: 'Input', onChange: () => {} },
310
+ {
311
+ type: 'Select',
312
+ options: [
313
+ { label: 'France', value: 'France' },
314
+ { label: 'Poland', value: 'Poland' },
315
+ { label: 'Vietnam', value: 'Vietnam' },
316
+ ],
317
+ value: { label: 'Poland', value: 'Poland' },
318
+ onChange: () => {},
319
+ error: 'Error',
320
+ },
321
+ ],
322
+ },
323
+ {
324
+ cells: [
325
+ {
326
+ value: 'Couscous',
327
+ type: 'Input',
328
+ onChange: () => {},
329
+ testId: 'table-tbody-cell-couscous',
330
+ },
331
+ {
332
+ type: 'Select',
333
+ native: true,
334
+ options: [
335
+ { label: 50, value: 50 },
336
+ { label: 100, value: 100 },
337
+ ],
338
+ value: { label: 100, value: 100 },
339
+ onChange: () => {},
340
+ warning: 'Warning',
341
+ },
342
+ { value: 361, type: 'Input', onChange: () => {} },
343
+ {
344
+ type: 'Select',
345
+ options: [
346
+ { label: 'France', value: 'France' },
347
+ { label: 'Poland', value: 'Poland' },
348
+ { label: 'Vietnam', value: 'Vietnam' },
349
+ ],
350
+ value: { label: 'France', value: 'France' },
351
+ onChange: () => {},
352
+ },
353
+ ],
354
+ },
355
+ ],
356
+ };
357
+
358
+ export const tableFilters = {
359
+ ...table,
360
+ headers: [
361
+ ...table.headers,
362
+ {
363
+ cells: [
364
+ {
365
+ value: '',
366
+ type: 'Input',
367
+ placeholder: 'Search',
368
+ onChange: () => {},
369
+ },
370
+ {
371
+ value: '',
372
+ type: 'Input',
373
+ placeholder: 'Search',
374
+ onChange: () => {},
375
+ },
376
+ {
377
+ value: '',
378
+ type: 'Input',
379
+ placeholder: 'Search',
380
+ onChange: () => {},
381
+ },
382
+ {
383
+ value: '',
384
+ type: 'Input',
385
+ placeholder: 'Search',
386
+ onChange: () => {},
387
+ },
388
+ ],
389
+ },
390
+ ],
391
+ };
392
+
393
+ export const tableStickyHeaders = {
394
+ maxHeight: '400px',
395
+ name: 'Food',
396
+ stickyHeaders: 'true',
397
+ headers: [
398
+ {
399
+ cells: [
400
+ { value: 'Name' },
401
+ { value: 'Weight' },
402
+ { value: 'Energy' },
403
+ { value: 'Origin' },
404
+ ],
405
+ actions: [
406
+ {
407
+ primary: true,
408
+ icon: 'plus',
409
+ label: 'Add',
410
+ onClick: () => {},
411
+ },
412
+ ],
413
+ },
414
+ {
415
+ cells: [
416
+ {},
417
+ {
418
+ options: [
419
+ { label: 'kg', value: 'kg' },
420
+ { label: 'tonnes', value: 'tonnes' },
421
+ ],
422
+ type: 'Select',
423
+ native: true,
424
+ value: { label: 'kg', value: 'kg' },
425
+ onChange: () => {},
426
+ },
427
+ { type: 'Unit', value: 'kcal / 100g' },
428
+ {},
429
+ ],
430
+ },
431
+ ],
432
+ rows: Array.from({ length: 100 }, () => ({
433
+ cells: [
434
+ { type: 'Input', value: 'Brown rice' },
435
+ { type: 'Input', value: 100 },
436
+ { type: 'Input', value: 361, error: 'test error' },
437
+ { type: 'Input', value: 'Vietnam' },
438
+ ],
439
+ })),
440
+ };
441
+
442
+ export const tableSort = {
443
+ fixedWidth: '100%',
444
+ headers: [
445
+ {
446
+ cells: [
447
+ { value: 'Name' },
448
+ {
449
+ value: 'Weight (kg)',
450
+ hasSort: true,
451
+ sort: 'up',
452
+ sortPriority: 1,
453
+ onSort: () => {},
454
+ },
455
+ {
456
+ value: 'Energy (kcal / 100g)',
457
+ hasSort: true,
458
+ sort: 'down',
459
+ sortPriority: 2,
460
+ onSort: () => {},
461
+ },
462
+ {
463
+ value: 'Origin',
464
+ hasSort: true,
465
+ sort: '',
466
+ sortPriority: 1,
467
+ onSort: () => {},
468
+ },
469
+ ],
470
+ },
471
+ ],
472
+ rows: [
473
+ {
474
+ cells: [
475
+ { value: 'Brown rice' },
476
+ { value: 100 },
477
+ { value: 361 },
478
+ { value: 'Vietnam' },
479
+ ],
480
+ },
481
+ {
482
+ cells: [
483
+ { value: 'Buckwheat' },
484
+ { value: 50 },
485
+ { value: 358 },
486
+ { value: 'Poland' },
487
+ ],
488
+ },
489
+ {
490
+ cells: [
491
+ { value: 'Couscous' },
492
+ { value: 10 },
493
+ { value: 368 },
494
+ { value: 'France' },
495
+ ],
496
+ },
497
+ ],
498
+ };
499
+
500
+ export const tableIcons = {
501
+ headers: [
502
+ {
503
+ cells: [
504
+ {},
505
+ { value: 'Name' },
506
+ { value: 'Weight (kg)' },
507
+ { value: 'Energy (kcal / 100g)' },
508
+ { value: 'Origin' },
509
+ ],
510
+ },
511
+ ],
512
+ rows: [
513
+ {
514
+ cells: [
515
+ { type: 'Icon', icon: <FaCheck color="var(--color-text-success)" /> },
516
+ { value: 'Brown rice' },
517
+ { value: 100 },
518
+ { value: 361 },
519
+ { value: 'Vietnam' },
520
+ ],
521
+ },
522
+ {
523
+ cells: [
524
+ {
525
+ type: 'Icon',
526
+ icon: <FaExclamationCircle color="var(--color-text-warning)" />,
527
+ },
528
+ { value: 'Buckwheat' },
529
+ { value: 50 },
530
+ { value: 358 },
531
+ { value: 'Poland' },
532
+ ],
533
+ },
534
+ {
535
+ cells: [
536
+ {
537
+ type: 'Icon',
538
+ icon: <FaExclamationTriangle color="var(--color-text-error)" />,
539
+ },
540
+ { value: 'Couscous' },
541
+ { value: 10 },
542
+ { value: 368 },
543
+ { value: 'France' },
544
+ ],
545
+ },
546
+ ],
547
+ };
548
+
549
+ export const tableActions = {
550
+ headers: [
551
+ {
552
+ cells: [
553
+ { value: 'Name' },
554
+ { value: 'Weight (kg)' },
555
+ { value: 'Energy (kcal / 100g)' },
556
+ { value: 'Origin' },
557
+ ],
558
+ actions: [
559
+ {
560
+ primary: true,
561
+ label: 'Add',
562
+ icon: <FaPlus />,
563
+ onClick: () => {},
564
+ },
565
+ ],
566
+ },
567
+ ],
568
+ rows: [
569
+ {
570
+ cells: [
571
+ { value: 'Brown rice' },
572
+ { value: 100 },
573
+ { value: 361 },
574
+ { value: 'Vietnam' },
575
+ ],
576
+ actions: [{ label: 'Delete', icon: <FaMinus />, onClick: () => {} }],
577
+ },
578
+ {
579
+ cells: [
580
+ { value: 'Buckwheat' },
581
+ { value: 50 },
582
+ { value: 358 },
583
+ { value: 'Poland' },
584
+ ],
585
+ actions: [{ label: 'Delete', icon: <FaMinus />, onClick: () => {} }],
586
+ },
587
+ {
588
+ cells: [
589
+ { value: 'Couscous' },
590
+ { value: 10 },
591
+ { value: 368 },
592
+ { value: 'France' },
593
+ ],
594
+ actions: [
595
+ {
596
+ label: 'test',
597
+ icon: <FaMinus />,
598
+ onClick: () => {},
599
+ hidden: true,
600
+ },
601
+ ],
602
+ },
603
+ ],
604
+ };
605
+
606
+ export const tableWithSubActions = {
607
+ headers: [
608
+ {
609
+ cells: [
610
+ { value: 'Name' },
611
+ { value: 'Weight (kg)' },
612
+ { value: 'Energy (kcal / 100g)' },
613
+ { value: 'Origin' },
614
+ ],
615
+ actions: [
616
+ {
617
+ primary: true,
618
+ label: 'Add',
619
+ icon: <FaPlus />,
620
+ onClick: () => {},
621
+ },
622
+ ],
623
+ },
624
+ ],
625
+ rows: [
626
+ {
627
+ cells: [
628
+ { value: 'Brown rice' },
629
+ { value: 100 },
630
+ { value: 361 },
631
+ { value: 'Vietnam' },
632
+ ],
633
+ actions: [
634
+ {
635
+ label: 'More',
636
+ subActions: [
637
+ {
638
+ label: 'Move Up',
639
+ icon: <FaArrowUp />,
640
+ onClick: () => {},
641
+ },
642
+ {
643
+ label: 'Move Down',
644
+ icon: <FaArrowDown />,
645
+ onClick: () => {},
646
+ },
647
+ { label: 'Delete', icon: <FaMinus />, onClick: () => {} },
648
+ ],
649
+ },
650
+ ],
651
+ },
652
+ {
653
+ cells: [
654
+ { value: 'Buckwheat' },
655
+ { value: 50 },
656
+ { value: 358 },
657
+ { value: 'Poland' },
658
+ ],
659
+ actions: [
660
+ {
661
+ label: 'More',
662
+ subActions: [
663
+ {
664
+ label: 'Move Up',
665
+ icon: <FaArrowUp />,
666
+ onClick: () => {},
667
+ },
668
+ {
669
+ label: 'Move Down',
670
+ icon: <FaArrowDown />,
671
+ onClick: () => {},
672
+ },
673
+ { label: 'Delete', icon: <FaMinus />, onClick: () => {} },
674
+ ],
675
+ },
676
+ ],
677
+ },
678
+ {
679
+ cells: [
680
+ { value: 'Couscous' },
681
+ { value: 10 },
682
+ { value: 368 },
683
+ { value: 'France' },
684
+ ],
685
+ actions: [
686
+ {
687
+ label: 'More',
688
+ subActions: [
689
+ {
690
+ label: 'Move Up',
691
+ icon: <FaArrowUp />,
692
+ onClick: () => {},
693
+ },
694
+ {
695
+ label: 'Move Down',
696
+ icon: <FaArrowDown />,
697
+ onClick: () => {},
698
+ },
699
+ { label: 'Delete', icon: <FaMinus />, onClick: () => {} },
700
+ ],
701
+ },
702
+ ],
703
+ },
704
+ ],
705
+ };
706
+
707
+ export const tableFooter = {
708
+ ...table,
709
+ footer: {
710
+ content: (
711
+ <>
712
+ <strong>Footer content:</strong> goes here
713
+ </>
714
+ ),
715
+ pagination: {
716
+ rowCount: 500,
717
+ selectedPage: 10,
718
+ rowsPerPage: {
719
+ onChange: () => {},
720
+ options: [
721
+ { label: '10 / page', value: 10 },
722
+ { label: '20 / page', value: 20 },
723
+ { label: '50 / page', value: 50 },
724
+ { label: 'Show all', value: 0 },
725
+ ],
726
+ value: 20,
727
+ },
728
+ goTo: { onChange: () => {} },
729
+ onSelectPage: () => {},
730
+ small: true,
731
+ },
732
+ actions: [{ label: 'Share', icon: <FaShareSquare />, onClick: () => {} }],
733
+ },
734
+ };
735
+
736
+ export const tableHelpLibraryIcons = {
737
+ ...table,
738
+ headers: table.headers.map((header) => ({
739
+ ...header,
740
+ cells: header.cells.map((cell) => ({
741
+ ...cell,
742
+ helpIcon: {
743
+ onClick: () => console.log('Help clicked'),
744
+ tooltip: 'Help text goes here',
745
+ },
746
+ libraryIcon: {
747
+ onClick: () => console.log('Library clicked'),
748
+ tooltip: 'Edit in library',
749
+ },
750
+ })),
751
+ })),
752
+ };