@oliasoft-open-source/react-ui-library 2.4.8 → 3.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 (320) hide show
  1. package/README.md +0 -1
  2. package/dist/global.css +21840 -0
  3. package/dist/index.js +43567 -0
  4. package/package.json +37 -55
  5. package/.eslintignore +0 -2
  6. package/.eslintrc.js +0 -125
  7. package/.gitlab-ci.yml +0 -76
  8. package/.husky/pre-commit +0 -4
  9. package/.prettierignore +0 -3
  10. package/.prettierrc +0 -4
  11. package/.storybook/main.js +0 -36
  12. package/.storybook/preview.js +0 -40
  13. package/.storybook/storybook.less +0 -8
  14. package/babel.config.js +0 -31
  15. package/index.js +0 -76
  16. package/jest.config.js +0 -9
  17. package/scripts/send-mattermost-message.sh +0 -21
  18. package/src/components/accordion/accordion.jsx +0 -132
  19. package/src/components/accordion/accordion.module.less +0 -66
  20. package/src/components/accordion/accordion.stories.jsx +0 -171
  21. package/src/components/accordion/chevron/chevron.jsx +0 -12
  22. package/src/components/accordion/chevron/chevron.module.less +0 -12
  23. package/src/components/accordion/helpers/accordion-with-default-toggle.jsx +0 -106
  24. package/src/components/accordion/helpers/accordion-with-default-toggle.module.less +0 -24
  25. package/src/components/actions/actions.jsx +0 -129
  26. package/src/components/actions/actions.module.less +0 -44
  27. package/src/components/actions/actions.shape.js +0 -32
  28. package/src/components/actions/actions.stories.jsx +0 -79
  29. package/src/components/badge/badge.jsx +0 -58
  30. package/src/components/badge/badge.module.less +0 -55
  31. package/src/components/badge/badge.stories.jsx +0 -31
  32. package/src/components/breadcrumb/breadcrumb.jsx +0 -49
  33. package/src/components/breadcrumb/breadcrumb.module.less +0 -39
  34. package/src/components/breadcrumb/breadcrumb.stories.jsx +0 -45
  35. package/src/components/breadcrumb/link.jsx +0 -31
  36. package/src/components/button/button.jsx +0 -156
  37. package/src/components/button/button.module.less +0 -300
  38. package/src/components/button/button.stories.jsx +0 -74
  39. package/src/components/button-group/button-group.jsx +0 -140
  40. package/src/components/button-group/button-group.module.less +0 -24
  41. package/src/components/button-group/button-group.stories-data.jsx +0 -67
  42. package/src/components/button-group/button-group.stories.jsx +0 -63
  43. package/src/components/buttons-and-links.stories.mdx +0 -55
  44. package/src/components/card/card.jsx +0 -51
  45. package/src/components/card/card.module.less +0 -48
  46. package/src/components/card/card.stories.jsx +0 -39
  47. package/src/components/check-box/check-box.jsx +0 -92
  48. package/src/components/check-box/check-box.module.less +0 -101
  49. package/src/components/check-box/check-box.stories.jsx +0 -27
  50. package/src/components/color/color.stories-data.jsx +0 -71
  51. package/src/components/color/color.stories.mdx +0 -37
  52. package/src/components/dialog/dialog.jsx +0 -77
  53. package/src/components/dialog/dialog.module.less +0 -76
  54. package/src/components/divider/divider.jsx +0 -40
  55. package/src/components/divider/divider.module.less +0 -28
  56. package/src/components/divider/divider.stories.jsx +0 -50
  57. package/src/components/drawer/drawer-resize-wrapper.jsx +0 -76
  58. package/src/components/drawer/drawer-tabs.jsx +0 -44
  59. package/src/components/drawer/drawer.jsx +0 -161
  60. package/src/components/drawer/drawer.module.less +0 -217
  61. package/src/components/drawer/drawer.stories.jsx +0 -296
  62. package/src/components/empty/empty.jsx +0 -52
  63. package/src/components/empty/empty.module.less +0 -17
  64. package/src/components/empty/empty.stories.jsx +0 -26
  65. package/src/components/file-input/file-input.jsx +0 -101
  66. package/src/components/file-input/file-input.module.less +0 -3
  67. package/src/components/file-input/file-input.stories.jsx +0 -109
  68. package/src/components/form/field.jsx +0 -96
  69. package/src/components/form/field.stories.jsx +0 -101
  70. package/src/components/form/form.module.less +0 -30
  71. package/src/components/form/form.stories.jsx +0 -191
  72. package/src/components/heading/heading.jsx +0 -105
  73. package/src/components/heading/heading.module.less +0 -59
  74. package/src/components/heading/heading.stories.jsx +0 -60
  75. package/src/components/icon/deprecated-icon.jsx +0 -97
  76. package/src/components/icon/icon.jsx +0 -71
  77. package/src/components/icon/icon.module.less +0 -33
  78. package/src/components/icon/icon.stories.jsx +0 -37
  79. package/src/components/icon/icons.example.module.less +0 -4
  80. package/src/components/input/input.jsx +0 -167
  81. package/src/components/input/input.module.less +0 -94
  82. package/src/components/input/input.stories.jsx +0 -28
  83. package/src/components/input-group/input-group-addon/input-group-addon.jsx +0 -36
  84. package/src/components/input-group/input-group-addon/input-group-addon.module.less +0 -31
  85. package/src/components/input-group/input-group.jsx +0 -51
  86. package/src/components/input-group/input-group.module.less +0 -10
  87. package/src/components/input-group/input-group.stories.jsx +0 -77
  88. package/src/components/input-validation.stories.mdx +0 -61
  89. package/src/components/inputs.stories.mdx +0 -201
  90. package/src/components/label/label.jsx +0 -115
  91. package/src/components/label/label.module.less +0 -43
  92. package/src/components/label/label.stories.jsx +0 -60
  93. package/src/components/layout/column/column.jsx +0 -85
  94. package/src/components/layout/column/styles.js +0 -45
  95. package/src/components/layout/column.stories.jsx +0 -60
  96. package/src/components/layout/examples/afe.stories.jsx +0 -180
  97. package/src/components/layout/examples/blowout.stories.jsx +0 -68
  98. package/src/components/layout/examples/casing-loads.stories.jsx +0 -297
  99. package/src/components/layout/examples/formation.stories.jsx +0 -110
  100. package/src/components/layout/examples/projects.stories.jsx +0 -108
  101. package/src/components/layout/examples/reservoirs.stories.jsx +0 -211
  102. package/src/components/layout/examples/site.stories.jsx +0 -263
  103. package/src/components/layout/flex/flex.jsx +0 -48
  104. package/src/components/layout/flex/flex.stories.jsx +0 -59
  105. package/src/components/layout/form-row/form-row.jsx +0 -15
  106. package/src/components/layout/form-row/form-row.module.less +0 -11
  107. package/src/components/layout/grid/grid.jsx +0 -62
  108. package/src/components/layout/grid/grid.stories.jsx +0 -67
  109. package/src/components/layout/page/page.jsx +0 -42
  110. package/src/components/layout/page/page.module.less +0 -27
  111. package/src/components/layout/page.stories.jsx +0 -93
  112. package/src/components/layout/placeholder.jsx +0 -2
  113. package/src/components/layout/print-header/print-header.jsx +0 -22
  114. package/src/components/layout/print-header/print-header.module.less +0 -9
  115. package/src/components/layout/row/row.jsx +0 -75
  116. package/src/components/layout/row/row.module.less +0 -7
  117. package/src/components/layout/spacer/spacer.jsx +0 -26
  118. package/src/components/layout/spacer/spacer.stories.jsx +0 -50
  119. package/src/components/layout-forms.stories.mdx +0 -104
  120. package/src/components/layout-general.stories.mdx +0 -215
  121. package/src/components/list/list-row/item-content.jsx +0 -15
  122. package/src/components/list/list-row/label.jsx +0 -11
  123. package/src/components/list/list-row/list-heading.jsx +0 -52
  124. package/src/components/list/list-row/list-row.jsx +0 -128
  125. package/src/components/list/list-row/list-subheading.jsx +0 -72
  126. package/src/components/list/list-row/meta-content.jsx +0 -24
  127. package/src/components/list/list-row/meta-count.jsx +0 -10
  128. package/src/components/list/list-row/name.jsx +0 -45
  129. package/src/components/list/list.jsx +0 -276
  130. package/src/components/list/list.module.less +0 -256
  131. package/src/components/list/list.stories-data.jsx +0 -287
  132. package/src/components/list/list.stories.jsx +0 -458
  133. package/src/components/list/toggle-narrow.jsx +0 -13
  134. package/src/components/loader/loader.jsx +0 -63
  135. package/src/components/loader/loader.module.less +0 -63
  136. package/src/components/loader/loader.stories.jsx +0 -155
  137. package/src/components/menu/index.js +0 -7
  138. package/src/components/menu/layer/divider.jsx +0 -4
  139. package/src/components/menu/layer/heading.jsx +0 -15
  140. package/src/components/menu/layer/layer.jsx +0 -82
  141. package/src/components/menu/layer/option.jsx +0 -77
  142. package/src/components/menu/layer/path.js +0 -44
  143. package/src/components/menu/layer/placementOptions.js +0 -6
  144. package/src/components/menu/layer/section.jsx +0 -66
  145. package/src/components/menu/menu.jsx +0 -359
  146. package/src/components/menu/menu.module.less +0 -241
  147. package/src/components/menu/menu.stories-data.jsx +0 -168
  148. package/src/components/menu/menu.stories.jsx +0 -126
  149. package/src/components/menu/menu.test.js +0 -58
  150. package/src/components/menu/trigger/button.jsx +0 -50
  151. package/src/components/menu/trigger/component.jsx +0 -14
  152. package/src/components/menu/trigger/text.jsx +0 -25
  153. package/src/components/menu/trigger/trigger.jsx +0 -86
  154. package/src/components/message/dismiss.jsx +0 -26
  155. package/src/components/message/message.jsx +0 -137
  156. package/src/components/message/message.module.less +0 -114
  157. package/src/components/message/message.stories.jsx +0 -84
  158. package/src/components/modal/modal.jsx +0 -50
  159. package/src/components/modal/modal.module.less +0 -39
  160. package/src/components/modal/modal.stories.jsx +0 -162
  161. package/src/components/option-dropdown/heading.jsx +0 -6
  162. package/src/components/option-dropdown/layer.jsx +0 -81
  163. package/src/components/option-dropdown/option-dropdown.jsx +0 -53
  164. package/src/components/option-dropdown/option-dropdown.module.less +0 -50
  165. package/src/components/option-dropdown/option-dropdown.stories.jsx +0 -35
  166. package/src/components/option-dropdown/option.jsx +0 -13
  167. package/src/components/pagination/pagination.jsx +0 -139
  168. package/src/components/pagination/pagination.module.less +0 -11
  169. package/src/components/pagination/pagination.stories.jsx +0 -78
  170. package/src/components/pagination/pagination.test.js +0 -92
  171. package/src/components/pagination/pagination.viewdata.js +0 -66
  172. package/src/components/pop-confirm/content.jsx +0 -25
  173. package/src/components/pop-confirm/pop-confirm.jsx +0 -61
  174. package/src/components/pop-confirm/pop-confirm.module.less +0 -18
  175. package/src/components/pop-confirm/pop-confirm.stories.jsx +0 -53
  176. package/src/components/popover/popover.jsx +0 -112
  177. package/src/components/popover/popover.module.less +0 -22
  178. package/src/components/popover/popover.stories.jsx +0 -59
  179. package/src/components/portal/portal.jsx +0 -16
  180. package/src/components/portal/portal.stories.jsx +0 -69
  181. package/src/components/progress-bar/progress-bar.jsx +0 -64
  182. package/src/components/progress-bar/progress-bar.module.less +0 -64
  183. package/src/components/progress-bar/progress-bar.stories.jsx +0 -23
  184. package/src/components/radio-button/radio-button.jsx +0 -139
  185. package/src/components/radio-button/radio-button.module.less +0 -135
  186. package/src/components/radio-button/radio-button.stories.jsx +0 -37
  187. package/src/components/radio-button/radio-input.jsx +0 -52
  188. package/src/components/select/custom-select/custom-select.jsx +0 -440
  189. package/src/components/select/custom-select/custom-select.module.less +0 -123
  190. package/src/components/select/custom-select/custom-select.reducer.js +0 -157
  191. package/src/components/select/custom-select/layer/heading.jsx +0 -13
  192. package/src/components/select/custom-select/layer/layer.jsx +0 -73
  193. package/src/components/select/custom-select/layer/option.jsx +0 -54
  194. package/src/components/select/custom-select/layer/placementOptions.js +0 -7
  195. package/src/components/select/custom-select/layer/section.jsx +0 -35
  196. package/src/components/select/custom-select/trigger/input.jsx +0 -100
  197. package/src/components/select/custom-select/trigger/trigger.jsx +0 -155
  198. package/src/components/select/custom-select/trigger/trigger.module.less +0 -289
  199. package/src/components/select/native-select/native-select.jsx +0 -198
  200. package/src/components/select/native-select/native-select.module.less +0 -107
  201. package/src/components/select/select.input.js +0 -146
  202. package/src/components/select/select.jsx +0 -207
  203. package/src/components/select/select.stories-data.jsx +0 -92
  204. package/src/components/select/select.stories.jsx +0 -135
  205. package/src/components/select/select.test.js +0 -519
  206. package/src/components/side-bar/container.module.less +0 -29
  207. package/src/components/side-bar/link.jsx +0 -83
  208. package/src/components/side-bar/sections.jsx +0 -23
  209. package/src/components/side-bar/side-bar.jsx +0 -102
  210. package/src/components/side-bar/side-bar.module.less +0 -137
  211. package/src/components/side-bar/side-bar.stories.jsx +0 -101
  212. package/src/components/slider/rc-slider.less +0 -47
  213. package/src/components/slider/slider-tooltip.jsx +0 -20
  214. package/src/components/slider/slider.jsx +0 -233
  215. package/src/components/slider/slider.module.less +0 -40
  216. package/src/components/slider/slider.stories.jsx +0 -110
  217. package/src/components/spinner/spinner.jsx +0 -37
  218. package/src/components/spinner/spinner.module.less +0 -115
  219. package/src/components/spinner/spinner.stories.jsx +0 -24
  220. package/src/components/table/cell/cell.jsx +0 -621
  221. package/src/components/table/cell/cell.module.less +0 -164
  222. package/src/components/table/footer/footer.jsx +0 -66
  223. package/src/components/table/footer/footer.module.less +0 -14
  224. package/src/components/table/helper.js +0 -64
  225. package/src/components/table/helper.test.js +0 -166
  226. package/src/components/table/icon/icon.module.less +0 -31
  227. package/src/components/table/row/expanded-content-row.jsx +0 -16
  228. package/src/components/table/row/row.jsx +0 -253
  229. package/src/components/table/row/row.module.less +0 -62
  230. package/src/components/table/table-scroll-wrapper.jsx +0 -49
  231. package/src/components/table/table.jsx +0 -234
  232. package/src/components/table/table.module.less +0 -146
  233. package/src/components/table/table.stories-data.jsx +0 -875
  234. package/src/components/table/table.stories.jsx +0 -759
  235. package/src/components/table/table.test.js +0 -30
  236. package/src/components/table/table.variables.less +0 -11
  237. package/src/components/table/table.viewdata.js +0 -26
  238. package/src/components/table/title/title.jsx +0 -30
  239. package/src/components/table/title/title.module.less +0 -11
  240. package/src/components/tabs/content.jsx +0 -14
  241. package/src/components/tabs/label.jsx +0 -50
  242. package/src/components/tabs/tabs.jsx +0 -191
  243. package/src/components/tabs/tabs.module.less +0 -73
  244. package/src/components/tabs/tabs.stories.jsx +0 -110
  245. package/src/components/text/text.jsx +0 -64
  246. package/src/components/text/text.module.less +0 -45
  247. package/src/components/text/text.stories.jsx +0 -31
  248. package/src/components/text-link/text-link.jsx +0 -23
  249. package/src/components/text-link/text-link.stories.jsx +0 -20
  250. package/src/components/textarea/textarea.jsx +0 -126
  251. package/src/components/textarea/textarea.module.less +0 -55
  252. package/src/components/textarea/textarea.stories.jsx +0 -26
  253. package/src/components/toaster/toaster.jsx +0 -39
  254. package/src/components/toaster/toaster.less +0 -17
  255. package/src/components/toaster/toaster.stories.jsx +0 -116
  256. package/src/components/toggle/toggle.jsx +0 -65
  257. package/src/components/toggle/toggle.module.less +0 -139
  258. package/src/components/toggle/toggle.stories.jsx +0 -26
  259. package/src/components/tooltip/tooltip-layer.jsx +0 -72
  260. package/src/components/tooltip/tooltip.jsx +0 -108
  261. package/src/components/tooltip/tooltip.module.less +0 -28
  262. package/src/components/tooltip/tooltip.stories.jsx +0 -71
  263. package/src/components/top-bar/element/element.jsx +0 -72
  264. package/src/components/top-bar/element/link.jsx +0 -29
  265. package/src/components/top-bar/title.jsx +0 -24
  266. package/src/components/top-bar/top-bar.jsx +0 -79
  267. package/src/components/top-bar/top-bar.module.less +0 -190
  268. package/src/components/top-bar/top-bar.stories.jsx +0 -137
  269. package/src/components/top-bar/warning.jsx +0 -6
  270. package/src/components/tree/tree-item.jsx +0 -79
  271. package/src/components/tree/tree-placeholder.jsx +0 -6
  272. package/src/components/tree/tree.jsx +0 -129
  273. package/src/components/tree/tree.module.less +0 -33
  274. package/src/components/tree/tree.stories-data.jsx +0 -89
  275. package/src/components/tree/tree.stories.jsx +0 -106
  276. package/src/docs/components/page/page.jsx +0 -16
  277. package/src/docs/config/config.js +0 -1
  278. package/src/docs/html/favicon.png +0 -0
  279. package/src/docs/html/index.html +0 -11
  280. package/src/docs/navigation/footer/footer.jsx +0 -48
  281. package/src/docs/navigation/header/header.jsx +0 -39
  282. package/src/docs/navigation/header/header.module.less +0 -32
  283. package/src/docs/navigation/routes/routes.jsx +0 -16
  284. package/src/docs/start.jsx +0 -12
  285. package/src/docs/views/main/main.jsx +0 -209
  286. package/src/docs/views/main/main.module.less +0 -14
  287. package/src/docs/views/not-found/not-found.jsx +0 -5
  288. package/src/helpers/disabled-context.js +0 -8
  289. package/src/helpers/styles.js +0 -68
  290. package/src/helpers/text.js +0 -6
  291. package/src/helpers/types.js +0 -5
  292. package/src/hooks/index.js +0 -3
  293. package/src/hooks/use-focus.js +0 -11
  294. package/src/hooks/use-keyboard-event.js +0 -16
  295. package/src/hooks/use-window-width.js +0 -20
  296. package/src/images/icons/icon-drop.png +0 -0
  297. package/src/images/icons/icon-share.png +0 -0
  298. package/src/images/icons/icons8-junction.svg +0 -4
  299. package/src/images/logo.png +0 -0
  300. package/src/images/logo.svg +0 -13
  301. package/src/images/oliasoft-logo.svg +0 -1
  302. package/src/style/colors.less +0 -26
  303. package/src/style/external.less +0 -10
  304. package/src/style/fonts/lato/Lato-Bold.woff2 +0 -0
  305. package/src/style/fonts/lato/Lato-BoldItalic.woff2 +0 -0
  306. package/src/style/fonts/lato/Lato-Italic.woff2 +0 -0
  307. package/src/style/fonts/lato/Lato-Regular.woff2 +0 -0
  308. package/src/style/fonts.less +0 -27
  309. package/src/style/global.less +0 -51
  310. package/src/style/mixins.less +0 -68
  311. package/src/style/reset/reset.less +0 -34
  312. package/src/style/shared.less +0 -25
  313. package/src/style/theme.dark.less +0 -37
  314. package/src/style/theme.default.less +0 -74
  315. package/src/style/variables.less +0 -49
  316. package/webpack/webpack.common.js +0 -39
  317. package/webpack/webpack.common.rules.js +0 -102
  318. package/webpack/webpack.dev.js +0 -22
  319. package/webpack/webpack.prod.js +0 -23
  320. package/webpack/webpack.resolve.js +0 -22
@@ -1,114 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- :root {
4
- --color-border-message: rgba(black, 0.1);
5
- }
6
-
7
- html[data-theme='dark'] {
8
- --color-border-message: transparent;
9
- }
10
-
11
- @line_height: 20px;
12
- @line_spacing: 3px;
13
-
14
- .container {
15
- padding: 10px 14px;
16
- border-radius: 4px;
17
- display: inline-flex;
18
- align-items: flex-start;
19
- line-height: @line_height;
20
- flex-wrap: wrap;
21
- overflow-y: auto;
22
- scrollbar-width: none;
23
- -ms-overflow-style: none;
24
- border: 1px solid var(--color-border-message);
25
-
26
- &::-webkit-scrollbar {
27
- width: 0px;
28
- background: transparent;
29
- }
30
-
31
- &.block {
32
- display: flex;
33
- }
34
-
35
- &.info {
36
- color: var(--color-text-info);
37
- background-color: var(--color-background-info);
38
- }
39
-
40
- &.success {
41
- color: var(--color-text-success);
42
- background-color: var(--color-background-success);
43
- }
44
-
45
- &.warning {
46
- color: var(--color-text-warning);
47
- background-color: var(--color-background-warning);
48
- }
49
-
50
- &.error {
51
- color: var(--color-text-error);
52
- background-color: var(--color-background-error);
53
- }
54
- }
55
-
56
- .content {
57
- flex: 1;
58
- min-width: 0;
59
- }
60
-
61
- .heading {
62
- font-weight: bold;
63
- letter-spacing: 0.1em;
64
- text-transform: uppercase;
65
- font-size: 0.9rem;
66
- line-height: @line_height;
67
- margin-bottom: @line_spacing;
68
- }
69
-
70
- .icon,
71
- .dismiss {
72
- display: flex;
73
- justify-content: center;
74
- align-items: center;
75
- height: @line_height;
76
- }
77
-
78
- .icon {
79
- margin-right: 12px;
80
- }
81
-
82
- .dismiss {
83
- margin-left: 12px;
84
- color: var(--color-text);
85
-
86
- &.absolute {
87
- position: absolute;
88
- top: 10px;
89
- right: 14px;
90
- }
91
- }
92
-
93
- .legendToggle,
94
- .dismiss {
95
- opacity: 0.4;
96
-
97
- &:hover {
98
- opacity: 0.8;
99
- cursor: pointer;
100
- }
101
-
102
- &:active {
103
- opacity: 1;
104
- }
105
- }
106
-
107
- .legendToggle {
108
- margin-top: @line_spacing;
109
- }
110
-
111
- .detailsText {
112
- margin-top: @line_spacing;
113
- word-break: break-word;
114
- }
@@ -1,84 +0,0 @@
1
- import { useArgs } from '@storybook/addons';
2
- import React from 'react';
3
- import { Message } from '../../..';
4
-
5
- const message = {
6
- visible: true,
7
- heading: undefined,
8
- content: 'Here is some info',
9
- type: 'Info',
10
- withDismiss: false,
11
- icon: false,
12
- details: undefined,
13
- maxHeight: undefined,
14
- };
15
-
16
- export default {
17
- title: 'Basic/Message',
18
- component: Message,
19
- args: {
20
- ...message,
21
- },
22
- argTypes: {
23
- type: {
24
- control: {
25
- type: 'inline-radio',
26
- },
27
- options: ['Info', 'Error', 'Warning', 'Success'],
28
- },
29
- heading: {
30
- control: { type: 'text' },
31
- },
32
- details: {
33
- control: { type: 'text' },
34
- },
35
- },
36
- };
37
-
38
- const Template = (args) => {
39
- const [_, updateArgs] = useArgs();
40
-
41
- const handleClose = () => {
42
- updateArgs({ visible: false });
43
- setTimeout(() => {
44
- updateArgs({ visible: true });
45
- }, 1000);
46
- };
47
-
48
- return (
49
- <Message
50
- message={{
51
- ...args,
52
- onClose: handleClose,
53
- }}
54
- />
55
- );
56
- };
57
-
58
- export const Default = Template.bind({});
59
-
60
- export const Heading = Template.bind({});
61
- Heading.args = { heading: 'Message Heading' };
62
-
63
- export const Icon = Template.bind({});
64
- Icon.args = { icon: true };
65
-
66
- export const Details = Template.bind({});
67
- Details.args = {
68
- details:
69
- 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque at mi ac quam condimentum blandit at sit amet lectus. Nullam volutpat erat maximus, venenatis nisl sed, aliquam libero.',
70
- };
71
-
72
- export const FullWidth = Template.bind({});
73
- FullWidth.args = { width: '100%' };
74
-
75
- export const FixedWidth = Template.bind({});
76
- FixedWidth.args = { width: '300px' };
77
-
78
- export const MaxHeight = Template.bind({});
79
- MaxHeight.args = {
80
- maxHeight: '100px',
81
- content: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. '.repeat(
82
- 20,
83
- ),
84
- };
@@ -1,50 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import { Portal } from '../portal/portal';
5
- import styles from './modal.module.less';
6
-
7
- const Wrapper = ({ children }) => (
8
- <div className={cx(styles.wrapper)}>{children}</div>
9
- );
10
-
11
- const Content = ({ children, width, centered }) => {
12
- return (
13
- <div
14
- className={cx(styles.contentContainer, centered ? styles.centered : '')}
15
- style={{ maxWidth: width }}
16
- >
17
- {children}
18
- </div>
19
- );
20
- };
21
-
22
- export const Modal = ({ children, visible, centered, width }) => {
23
- return (
24
- <>
25
- <Portal id="modalContainer">
26
- {visible ? (
27
- <Wrapper>
28
- <Content width={width} centered={centered}>
29
- {children}
30
- </Content>
31
- </Wrapper>
32
- ) : null}
33
- </Portal>
34
- <div id="modalContainer" />
35
- </>
36
- );
37
- };
38
-
39
- Modal.defaultProps = {
40
- visible: false,
41
- centered: false,
42
- width: '100%',
43
- };
44
-
45
- Modal.propTypes = {
46
- children: PropTypes.node.isRequired,
47
- visible: PropTypes.bool,
48
- centered: PropTypes.bool,
49
- width: PropTypes.string,
50
- };
@@ -1,39 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .wrapper {
4
- z-index: @zindex_modal;
5
- position: fixed;
6
- top: 0;
7
- left: 0;
8
- height: 100%;
9
- width: 100%;
10
- background: rgba(0, 0, 0, 0.8);
11
- padding: 30px;
12
- overflow-x: hidden;
13
- overflow-y: auto;
14
- display: flex;
15
- flex-direction: column;
16
- }
17
-
18
- .contentContainer {
19
- color: var(--color-background-raised);
20
- max-height: 100%;
21
- flex-grow: 1;
22
- display: flex;
23
- flex-direction: column;
24
- align-items: center;
25
- justify-content: flex-start;
26
-
27
- button:not(:last-child) {
28
- margin-right: 12px;
29
- }
30
- }
31
-
32
- .centered > * {
33
- margin-top: auto;
34
- margin-bottom: auto;
35
- }
36
-
37
- .newLine {
38
- white-space: 'pre-wrap';
39
- }
@@ -1,162 +0,0 @@
1
- import { useArgs } from '@storybook/addons';
2
- import React from 'react';
3
- import {
4
- Modal,
5
- Button,
6
- Dialog,
7
- Popover,
8
- Input,
9
- InputGroup,
10
- Field,
11
- Menu,
12
- Select,
13
- Spacer,
14
- Tooltip,
15
- } from '../../..';
16
-
17
- export default {
18
- title: 'Modals/Modal',
19
- component: Modal,
20
- args: {
21
- visible: true,
22
- centered: true,
23
- width: '300px',
24
- heading: 'Are you sure?',
25
- content: <>This will complete the transaction</>,
26
- footer: (
27
- <>
28
- <Button label="Okay" colored onClick={() => {}} />
29
- <Button label="Cancel" onClick={() => {}} />
30
- </>
31
- ),
32
- onClose: () => {},
33
- },
34
- parameters: {
35
- docs: {
36
- inlineStories: false,
37
- iframeHeight: 400,
38
- },
39
- },
40
- };
41
-
42
- const Template = (args) => {
43
- const [{ visible, centered, ...dialogProps }, updateArgs] = useArgs();
44
- const toggleModal = () => {
45
- updateArgs({ visible: !visible });
46
- };
47
- return (
48
- <>
49
- <Modal visible={visible} centered={centered}>
50
- <Dialog
51
- dialog={{
52
- ...dialogProps,
53
- onClose: toggleModal,
54
- }}
55
- />
56
- </Modal>
57
- <Button label="Open Modal" onClick={toggleModal} />
58
- </>
59
- );
60
- };
61
-
62
- export const Default = Template.bind({});
63
-
64
- export const Centered = Template.bind({});
65
- Centered.args = { centered: true };
66
-
67
- export const LineBreak = Template.bind({});
68
- LineBreak.args = { content: ['This is a', 'new line!'] };
69
-
70
- export const Scroll = Template.bind({});
71
- Scroll.args = {
72
- scroll: true,
73
- content: (
74
- <div>{'Example modal content goes here lorem ipsum. '.repeat(100)}</div>
75
- ),
76
- };
77
-
78
- export const FullWidth = Template.bind({});
79
- FullWidth.args = {
80
- width: '100%',
81
- content: (
82
- <div>{'Example modal content goes here lorem ipsum. '.repeat(100)}</div>
83
- ),
84
- };
85
-
86
- export const NoContentPadding = Template.bind({});
87
- NoContentPadding.args = { contentPadding: 0 };
88
-
89
- export const WithPopoverLayers = Template.bind({});
90
- WithPopoverLayers.args = {
91
- content: (
92
- <>
93
- <Tooltip text="Tooltip text">Hover for tooltip</Tooltip>
94
- <Spacer />
95
- <Field label="Custom Select" helpText="Select an animal">
96
- <Select
97
- name="example"
98
- options={[
99
- 'Aardvarks',
100
- 'Kangaroos',
101
- 'Monkeys',
102
- 'Possums',
103
- 'Gorilla',
104
- 'Puma',
105
- 'Patagonian Mara',
106
- 'Tarsier',
107
- 'Koala',
108
- 'Panda',
109
- 'Red Panda',
110
- 'Impala',
111
- 'Tiger',
112
- 'Crocodile',
113
- 'Bat',
114
- ]}
115
- onChange={() => {}}
116
- value="Monkeys"
117
- error="Bad value"
118
- />
119
- </Field>
120
- <Field label="Nested Menu">
121
- <Menu
122
- maxHeight="240px"
123
- menu={{
124
- label: 'Menu',
125
- trigger: 'DropDownButton',
126
- sections: [
127
- {
128
- type: 'Menu',
129
- menu: {
130
- trigger: 'Text',
131
- label: 'Children',
132
- sections: [...Array(100).keys()].map(() => ({
133
- type: 'Option',
134
- label: Math.random().toString(36).substring(7),
135
- onClick: () => {},
136
- })),
137
- },
138
- },
139
- ].concat(
140
- [...Array(100).keys()].map(() => ({
141
- type: 'Option',
142
- label: Math.random().toString(36).substring(7),
143
- onClick: () => {},
144
- })),
145
- ),
146
- }}
147
- />
148
- </Field>
149
- <Popover
150
- content={
151
- <InputGroup small>
152
- <Input value="Value" width="150px" error="Bad value" />
153
- <Button colored label="Save" onClick={() => {}} />
154
- <Button label="Cancel" onClick={close} />
155
- </InputGroup>
156
- }
157
- >
158
- <Button colored label="Toggle me" onClick={() => {}} />
159
- </Popover>
160
- </>
161
- ),
162
- };
@@ -1,6 +0,0 @@
1
- import React from 'react';
2
- import styles from './option-dropdown.module.less';
3
-
4
- export const Heading = ({ label }) => (
5
- <div className={styles.heading}>{label}</div>
6
- );
@@ -1,81 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { Option } from './option';
4
- import { Divider } from '../divider/divider';
5
- import styles from './option-dropdown.module.less';
6
- import { Heading } from './heading';
7
-
8
- export const Layer = ({ options, onChangeOptions, showHeader }) => {
9
- return (
10
- <div className={cx('menu', styles.menu)}>
11
- {showHeader && (
12
- <>
13
- <div className={styles.header}>
14
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
15
- <a
16
- onClick={(evt) => {
17
- const next = options.map((option) => ({
18
- ...option,
19
- selected: true,
20
- }));
21
- onChangeOptions(evt, next);
22
- }}
23
- >
24
- All
25
- </a>
26
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
27
- <a
28
- onClick={(evt) => {
29
- const next = options.map((option) => ({
30
- ...option,
31
- selected: false,
32
- }));
33
- onChangeOptions(evt, next);
34
- }}
35
- >
36
- Clear
37
- </a>
38
- {/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
39
- <a
40
- onClick={(evt) => {
41
- const next = options.map((option) => ({
42
- ...option,
43
- selected: !option.selected,
44
- }));
45
- onChangeOptions(evt, next);
46
- }}
47
- >
48
- Invert
49
- </a>
50
- </div>
51
- <Divider margin="7px" />
52
- </>
53
- )}
54
-
55
- {options.map((option, index) => {
56
- switch (option.type) {
57
- case 'Heading':
58
- return <Heading key={index} label={option.label} />;
59
- case 'Divider':
60
- return <Divider key={index} margin="7px" />;
61
- default:
62
- return (
63
- <Option
64
- key={index}
65
- option={option}
66
- onChange={(evt) => {
67
- const { value } = option;
68
- const next = options.map((option) =>
69
- option.value !== value
70
- ? option
71
- : { ...option, selected: !option.selected },
72
- );
73
- onChangeOptions(evt, next);
74
- }}
75
- />
76
- );
77
- }
78
- })}
79
- </div>
80
- );
81
- };
@@ -1,53 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { Menu } from '../menu/menu';
4
- import { Layer } from './layer';
5
-
6
- export const OptionDropdown = ({
7
- name,
8
- label,
9
- options,
10
- onChange,
11
- showHeader,
12
- }) => {
13
- return (
14
- <Menu
15
- menu={{
16
- label,
17
- trigger: 'DropDownButton',
18
- possiblePlacements: ['top-start', 'bottom-start'],
19
- sections: (
20
- <Layer
21
- options={options}
22
- onChangeOptions={(evt, nextOptions) => {
23
- evt.stopPropagation();
24
- evt.target.name = name;
25
- evt.target.value = nextOptions;
26
- onChange(evt);
27
- }}
28
- showHeader={showHeader}
29
- />
30
- ),
31
- }}
32
- />
33
- );
34
- };
35
-
36
- OptionDropdown.defaultProps = {
37
- name: undefined,
38
- showHeader: true,
39
- };
40
-
41
- OptionDropdown.propTypes = {
42
- name: PropTypes.string,
43
- label: PropTypes.string.isRequired,
44
- options: PropTypes.arrayOf(
45
- PropTypes.shape({
46
- label: PropTypes.string,
47
- value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
48
- selected: PropTypes.bool,
49
- }),
50
- ).isRequired,
51
- onChange: PropTypes.func.isRequired,
52
- showHeader: PropTypes.bool,
53
- };
@@ -1,50 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .menu {
4
- min-width: 160px;
5
- padding: 7px 0;
6
- border: 1px solid var(--color-border);
7
- border-radius: 4px;
8
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
9
- background-color: var(--color-background-raised);
10
- margin-top: 2px;
11
- }
12
-
13
- .header {
14
- padding: 7px 16px;
15
- display: flex;
16
- justify-content: space-between;
17
-
18
- a {
19
- color: var(--color-text-primary);
20
- font-weight: normal;
21
- cursor: pointer;
22
-
23
- &:hover {
24
- color: var(--color-text-primary-hover);
25
- }
26
-
27
- &:active {
28
- color: var(--color-text-primary-active);
29
- }
30
- }
31
- }
32
-
33
- .item {
34
- padding: 7px 16px;
35
- background: transparent;
36
- cursor: default;
37
- }
38
-
39
- .heading {
40
- color: var(--color-text-muted);
41
- letter-spacing: 0.1em;
42
- text-transform: uppercase;
43
- font-size: 12px;
44
- padding: 7px 16px;
45
- max-width: 100%;
46
- display: block;
47
- overflow: hidden;
48
- text-overflow: ellipsis;
49
- white-space: nowrap;
50
- }
@@ -1,35 +0,0 @@
1
- import React from 'react';
2
- import { useArgs } from '@storybook/addons';
3
- import { OptionDropdown } from './option-dropdown';
4
-
5
- const options = [
6
- { label: 'Animals', type: 'Heading' },
7
- { type: 'Divider' },
8
- { label: 'Aardvarks', value: 'termites' },
9
- { label: 'Kangaroos', value: 'grass' },
10
- { label: 'Monkeys', value: 'bananas' },
11
- ];
12
-
13
- export default {
14
- title: 'Forms/OptionDropdown',
15
- component: OptionDropdown,
16
- args: {
17
- label: 'Label',
18
- options,
19
- },
20
- };
21
-
22
- const Template = (args) => {
23
- const [_, updateArgs] = useArgs();
24
- const handleChange = (evt) => {
25
- updateArgs({ options: evt.target.value });
26
- };
27
- return (
28
- <OptionDropdown
29
- // eslint-disable-next-line react/jsx-props-no-spreading
30
- {...args}
31
- onChange={handleChange}
32
- />
33
- );
34
- };
35
- export const Default = Template.bind({});
@@ -1,13 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { CheckBox } from '../check-box/check-box';
4
- import styles from './option-dropdown.module.less';
5
-
6
- export const Option = ({ option, onChange }) => {
7
- const { key, label, selected } = option;
8
- return (
9
- <div key={key} className={styles.item}>
10
- <CheckBox label={label} noMargin checked={selected} onChange={onChange} />
11
- </div>
12
- );
13
- };