@oliasoft-open-source/react-ui-library 2.4.8 → 3.0.1

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,132 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import { Chevron } from './chevron/chevron';
5
- import styles from './accordion.module.less';
6
-
7
- export const AccordionManaged = ({
8
- heading,
9
- bordered,
10
- padding,
11
- expanded: initialExpanded,
12
- children,
13
- testId,
14
- }) => {
15
- const [expanded, toggle] = React.useState(initialExpanded);
16
-
17
- return (
18
- <>
19
- <Accordion
20
- heading={heading}
21
- bordered={bordered}
22
- padding={padding}
23
- expanded={expanded}
24
- onClick={() => {
25
- toggle(!expanded);
26
- }}
27
- testId={testId}
28
- >
29
- {children}
30
- </Accordion>
31
- </>
32
- );
33
- };
34
-
35
- export const AccordionBase = ({
36
- heading,
37
- expanded,
38
- bordered,
39
- padding,
40
- children,
41
- squareBottom,
42
- onClick,
43
- testId,
44
- }) => {
45
- return (
46
- <div
47
- className={cx(
48
- styles.accordion,
49
- bordered ? styles.bordered : '',
50
- expanded ? styles.expanded : '',
51
- squareBottom ? styles.squareBottom : '',
52
- )}
53
- >
54
- <div
55
- className={cx(styles.accordionHeader, onClick ? styles.clickable : '')}
56
- onClick={onClick}
57
- data-testid={testId}
58
- >
59
- <Chevron expanded={expanded} />
60
- <div className={styles.heading}>{heading}</div>
61
- </div>
62
- {expanded && children && (
63
- <div
64
- className={cx(
65
- styles.accordionContent,
66
- bordered && padding ? styles.padding : '',
67
- )}
68
- >
69
- {children}
70
- </div>
71
- )}
72
- </div>
73
- );
74
- };
75
-
76
- export const Accordion = ({
77
- heading,
78
- expanded,
79
- managed,
80
- bordered,
81
- padding,
82
- children,
83
- onClick,
84
- squareBottom,
85
- testId,
86
- }) =>
87
- managed ? (
88
- <AccordionManaged
89
- heading={heading}
90
- expanded={expanded}
91
- bordered={bordered}
92
- padding={padding}
93
- squareBottom={squareBottom}
94
- onClick={onClick}
95
- testId={testId}
96
- >
97
- {children}
98
- </AccordionManaged>
99
- ) : (
100
- <AccordionBase
101
- heading={heading}
102
- expanded={expanded}
103
- bordered={bordered}
104
- padding={padding}
105
- squareBottom={squareBottom}
106
- onClick={onClick}
107
- testId={testId}
108
- >
109
- {children}
110
- </AccordionBase>
111
- );
112
-
113
- Accordion.defaultProps = {
114
- bordered: false,
115
- padding: true,
116
- managed: false,
117
- expanded: false,
118
- onClick: null,
119
- squareBottom: false,
120
- testId: '',
121
- };
122
-
123
- Accordion.propTypes = {
124
- heading: PropTypes.node.isRequired,
125
- bordered: PropTypes.bool,
126
- padding: PropTypes.bool,
127
- managed: PropTypes.bool,
128
- expanded: PropTypes.bool,
129
- onClick: PropTypes.func,
130
- squareBottom: PropTypes.bool,
131
- testId: PropTypes.string,
132
- };
@@ -1,66 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .accordion {
4
- position: relative;
5
- color: var(--color-text);
6
-
7
- .accordionHeader {
8
- display: flex;
9
- align-items: center;
10
-
11
- .heading {
12
- flex-grow: 1;
13
- }
14
-
15
- &.clickable {
16
- &:hover {
17
- cursor: pointer;
18
- > * {
19
- color: var(--color-text) !important;
20
- }
21
- }
22
- }
23
- }
24
-
25
- &:not(.bordered) {
26
- .accordionHeader {
27
- margin-bottom: 15px;
28
- }
29
- }
30
-
31
- &.bordered {
32
- .accordionHeader,
33
- .accordionContent {
34
- border: 1px solid var(--color-border);
35
- line-height: 20px;
36
- }
37
-
38
- .accordionHeader {
39
- padding: @card_padding_y @card_padding_x;
40
- border-radius: @card_border_radius;
41
- background-color: var(--color-background);
42
- }
43
-
44
- &.expanded .accordionHeader {
45
- border-bottom-left-radius: 0;
46
- border-bottom-right-radius: 0;
47
- }
48
-
49
- .accordionContent {
50
- border-top: none;
51
- border-radius: 0 0 @card_border_radius @card_border_radius;
52
- background-color: var(--color-background-raised);
53
-
54
- &.padding {
55
- padding: @card_padding_y @card_padding_x;
56
- }
57
- }
58
- }
59
-
60
- &.bordered.squareBottom {
61
- .accordionHeader {
62
- border-bottom-left-radius: 0;
63
- border-bottom-right-radius: 0;
64
- }
65
- }
66
- }
@@ -1,171 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { useArgs } from '@storybook/addons';
3
- import { FaPlus } from 'react-icons/fa';
4
- import { AccordionWithDefaultToggle as AccordionWithDefaultToggleComponent } from './helpers/accordion-with-default-toggle';
5
- import { Accordion, Heading, Divider, Table } from '../../..';
6
-
7
- export default {
8
- title: 'Layout/Accordion',
9
- component: Accordion,
10
- args: {
11
- bordered: false,
12
- expanded: false,
13
- managed: false,
14
- children: 'Example content',
15
- },
16
- };
17
-
18
- const Template = (args) => {
19
- const [_, updateArgs] = useArgs();
20
- const toggleExpanded = () => {
21
- updateArgs({ expanded: !args.expanded });
22
- };
23
- return (
24
- <Accordion
25
- heading={<Heading onClick={toggleExpanded}>Heading</Heading>}
26
- // eslint-disable-next-line react/jsx-props-no-spreading
27
- {...args}
28
- />
29
- );
30
- };
31
-
32
- export const Default = Template.bind({});
33
-
34
- export const Bordered = Template.bind({});
35
- Bordered.args = {
36
- bordered: true,
37
- };
38
-
39
- export const NoContentPadding = Template.bind({});
40
- NoContentPadding.args = {
41
- bordered: true,
42
- expanded: true,
43
- padding: false,
44
- };
45
-
46
- export const HelpIcon = Template.bind({});
47
- HelpIcon.args = {
48
- bordered: true,
49
- expanded: true,
50
- heading: <Heading onClickHelp={() => console.log('help!')}>Heading</Heading>,
51
- };
52
-
53
- export const LibraryIcon = Template.bind({});
54
- LibraryIcon.args = {
55
- bordered: true,
56
- expanded: true,
57
- heading: (
58
- <Heading
59
- libraryIcon={{
60
- onClick: () => {},
61
- tooltip: 'Show in library',
62
- }}
63
- >
64
- Heading
65
- </Heading>
66
- ),
67
- };
68
-
69
- export const CustomIcon = Template.bind({});
70
- CustomIcon.args = {
71
- bordered: true,
72
- expanded: true,
73
- heading: (
74
- <Heading onIconClick={() => {}} icon={<FaPlus />}>
75
- Heading
76
- </Heading>
77
- ),
78
- };
79
-
80
- export const AccordionWithDefaultToggle = () => {
81
- const [enabled, setEnabled] = useState(true);
82
- const tableWithFluidWidth = {
83
- bordered: false,
84
- headers: [
85
- {
86
- cells: [{ value: 'Name' }, { value: 'Origin' }],
87
- },
88
- ],
89
- rows: [
90
- {
91
- cells: [{ value: 'Brown rice' }, { value: 'Vietnam' }],
92
- },
93
- {
94
- cells: [{ value: 'Buckwheat' }, { value: 'Poland' }],
95
- },
96
- {
97
- cells: [{ value: 'Couscous' }, { value: 'France' }],
98
- },
99
- ],
100
- };
101
- const tableWithFluidWidthEditable = {
102
- bordered: false,
103
- headers: [
104
- {
105
- cells: [{ value: 'Name' }, { value: 'Origin' }],
106
- },
107
- ],
108
- rows: [
109
- {
110
- cells: [
111
- { value: 'Brown rice', type: 'Input', onChange: () => {} },
112
- {
113
- type: 'Select',
114
- options: [
115
- { label: 'Vietnam', value: 'Vietnam' },
116
- { label: 'Other', value: 'Other' },
117
- ],
118
- value: { label: 'Vietnam', value: 'Vietnam' },
119
- native: true,
120
- onChange: () => {},
121
- },
122
- ],
123
- },
124
- {
125
- cells: [
126
- { value: 'Buckwheat', type: 'Input', onChange: () => {} },
127
- {
128
- type: 'Select',
129
- options: [
130
- { label: 'Poland', value: 'Poland' },
131
- { label: 'Other', value: 'Other' },
132
- ],
133
- value: { label: 'Poland', value: 'Poland' },
134
- native: true,
135
- onChange: () => {},
136
- },
137
- ],
138
- },
139
- {
140
- cells: [
141
- { value: 'Couscous', type: 'Input', onChange: () => {} },
142
- {
143
- type: 'Select',
144
- options: [
145
- { label: 'France', value: 'France' },
146
- { label: 'Other', value: 'Other' },
147
- ],
148
- value: { label: 'France', value: 'France' },
149
- native: true,
150
- onChange: () => {},
151
- },
152
- ],
153
- },
154
- ],
155
- };
156
- return (
157
- <AccordionWithDefaultToggleComponent
158
- heading={
159
- <Heading onClickHelp={() => console.log('help!')}>Heading</Heading>
160
- }
161
- toggleLabel="Default Settings"
162
- onClickDefaultToggle={() => setEnabled(!enabled)}
163
- padding={false}
164
- >
165
- <Divider margin={0} />
166
- <Table
167
- table={enabled ? tableWithFluidWidth : tableWithFluidWidthEditable}
168
- />
169
- </AccordionWithDefaultToggleComponent>
170
- );
171
- };
@@ -1,12 +0,0 @@
1
- import React from 'react';
2
- import cx from 'classnames';
3
- import { FaChevronRight } from 'react-icons/fa';
4
- import styles from './chevron.module.less';
5
-
6
- export const Chevron = ({ expanded }) => {
7
- return expanded ? (
8
- <FaChevronRight className={cx(styles.chevron, styles.expanded)} />
9
- ) : (
10
- <FaChevronRight className={cx(styles.chevron)} />
11
- );
12
- };
@@ -1,12 +0,0 @@
1
- @import '../../../style/variables.less';
2
-
3
- .chevron {
4
- margin-right: 10px;
5
- font-size: 11px;
6
- transition: transform 0.3s;
7
- color: var(--color-text-muted);
8
-
9
- &.expanded {
10
- transform: rotate(90deg);
11
- }
12
- }
@@ -1,106 +0,0 @@
1
- import React, { useReducer, useEffect } from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import { Accordion } from '../accordion';
5
- import { CheckBox } from '../../check-box/check-box';
6
- import styles from './accordion-with-default-toggle.module.less';
7
-
8
- const initialState = (initialExpanded, defaultEnabled) => ({
9
- accordionExpanded: initialExpanded,
10
- defaultEnabled,
11
- });
12
-
13
- const reducer = (state, action) => {
14
- switch (action.type) {
15
- case 'TOGGLE_ACCORDION': {
16
- return {
17
- ...state,
18
- accordionExpanded: !state.accordionExpanded,
19
- };
20
- }
21
- case 'TOGGLE_ENABLE': {
22
- return {
23
- accordionExpanded: state.defaultEnabled,
24
- defaultEnabled: !state.defaultEnabled,
25
- };
26
- }
27
- default:
28
- return state;
29
- }
30
- };
31
-
32
- export const AccordionWithDefaultToggle = ({
33
- heading,
34
- toggleLabel,
35
- onClickDefaultToggle,
36
- expanded: initialExpanded,
37
- defaultEnabled: initialDefaultEnabled,
38
- children,
39
- padding,
40
- }) => {
41
- const [state, dispatch] = useReducer(
42
- reducer,
43
- initialState(initialExpanded, initialDefaultEnabled),
44
- );
45
-
46
- useEffect(() => {
47
- if (state.accordionExpanded !== initialExpanded) {
48
- dispatch({ type: 'TOGGLE_ACCORDION' });
49
- }
50
-
51
- if (state.defaultEnabled !== initialDefaultEnabled) {
52
- dispatch({ type: 'TOGGLE_ENABLE' });
53
- }
54
- }, [initialExpanded, initialDefaultEnabled]);
55
-
56
- const content = (
57
- <>
58
- <div className={styles.checkboxWrapper}>
59
- <CheckBox
60
- label={toggleLabel}
61
- onChange={(evt) => {
62
- dispatch({ type: 'TOGGLE_ENABLE' });
63
- if (onClickDefaultToggle) {
64
- onClickDefaultToggle(evt);
65
- }
66
- }}
67
- checked={state.defaultEnabled}
68
- />
69
- </div>
70
- {state.accordionExpanded && (
71
- <div className={styles.contentWrapper}>{children}</div>
72
- )}
73
- </>
74
- );
75
-
76
- return (
77
- <>
78
- <Accordion
79
- heading={heading}
80
- bordered
81
- expanded={state.accordionExpanded}
82
- squareBottom
83
- onClick={() => dispatch({ type: 'TOGGLE_ACCORDION' })}
84
- />
85
- <div className={cx(styles.bordered, padding ? styles.padding : '')}>
86
- {content}
87
- </div>
88
- </>
89
- );
90
- };
91
-
92
- AccordionWithDefaultToggle.defaultProps = {
93
- expanded: false,
94
- defaultEnabled: true,
95
- onClickDefaultToggle: null,
96
- padding: true,
97
- };
98
-
99
- AccordionWithDefaultToggle.propTypes = {
100
- heading: PropTypes.node.isRequired,
101
- toggleLabel: PropTypes.string.isRequired,
102
- expanded: PropTypes.bool,
103
- defaultEnabled: PropTypes.bool,
104
- onClickDefaultToggle: PropTypes.func,
105
- padding: PropTypes.bool,
106
- };
@@ -1,24 +0,0 @@
1
- @import '../../../style/variables.less';
2
-
3
- .bordered {
4
- border: 1px solid var(--color-border);
5
- border-radius: 0 0 @card_border_radius @card_border_radius;
6
- border-top: none;
7
- background-color: var(--color-background-raised);
8
- }
9
-
10
- .checkboxWrapper {
11
- padding: (@card_padding_y - 8px) @card_padding_x;
12
-
13
- &:last-child {
14
- border-radius: 0 0 inherit inherit;
15
- }
16
- }
17
-
18
- .padding {
19
- padding: @card_padding_y @card_padding_x;
20
- }
21
-
22
- .contentWrapper {
23
- border-radius: inherit;
24
- }
@@ -1,129 +0,0 @@
1
- import { isFunction } from 'lodash';
2
- import React, { useContext } from 'react';
3
- import PropTypes from 'prop-types';
4
- import cx from 'classnames';
5
- import { FaEllipsisV } from 'react-icons/fa';
6
- import { Icon } from '../icon/icon';
7
- import { Menu } from '../menu/menu';
8
- import { Button } from '../button/button';
9
- import styles from './actions.module.less';
10
- import { actionsShape } from './actions.shape';
11
- import { DisabledContext } from '../../helpers/disabled-context';
12
-
13
- const SubmenuActions = (props) => {
14
- const { actions, subMenuIcon, primary, testId } = props;
15
- const menuButton = (
16
- <Button
17
- colored={primary ? true : 'muted'}
18
- basic={!primary}
19
- round
20
- small
21
- icon={subMenuIcon ? <Icon icon={subMenuIcon} /> : <FaEllipsisV />}
22
- testId={testId}
23
- />
24
- );
25
-
26
- if (actions.length) {
27
- const subMenu = {
28
- trigger: 'Component',
29
- component: menuButton,
30
- sections: actions.map((a) => {
31
- return {
32
- type: 'Option',
33
- label: a.label,
34
- icon: a.icon,
35
- testId: a.testId,
36
- disabled: a.disabled,
37
- onClick: (evt) => {
38
- evt.stopPropagation();
39
- evt.preventDefault();
40
- if (/* Sentry WELLDESIGN-1EB */ isFunction(a.onClick)) {
41
- a.onClick(evt);
42
- }
43
- },
44
- };
45
- }),
46
- };
47
-
48
- return <Menu menu={subMenu} />;
49
- }
50
- return null;
51
- };
52
-
53
- export const Actions = (props) => {
54
- const disabledContext = useContext(DisabledContext);
55
- const { actions, right, closeLayer } = props;
56
- return (
57
- <div className={cx(styles.actions)}>
58
- {actions.map((action, index) => {
59
- const hidden = action?.hidden || !action || !Object.keys(action).length;
60
- if (!hidden) {
61
- if (
62
- action.childComponent &&
63
- React.isValidElement(action.childComponent)
64
- ) {
65
- return (
66
- <Button
67
- colored="muted"
68
- round
69
- basic
70
- small
71
- icon={action.childComponent}
72
- testId={action.testId}
73
- key={index}
74
- />
75
- );
76
- } else if (action.subActions) {
77
- return (
78
- <SubmenuActions
79
- actions={action.subActions}
80
- primary={action.primary}
81
- subMenuIcon={action.icon}
82
- testId={action.testId}
83
- key={index}
84
- right={right}
85
- />
86
- );
87
- } else {
88
- return (
89
- <Button
90
- key={index}
91
- colored={action.primary ? true : 'muted'}
92
- round
93
- basic={!action.primary}
94
- disabled={action.disabled}
95
- small
96
- name={action.label}
97
- icon={action.icon ? <Icon icon={action.icon} /> : null}
98
- onClick={(evt) => {
99
- if (closeLayer) {
100
- closeLayer();
101
- }
102
- evt.stopPropagation();
103
- evt.preventDefault();
104
- if (
105
- !(action.disabled || disabledContext) &&
106
- /* Sentry WELLDESIGN-1EB */ isFunction(action.onClick)
107
- ) {
108
- action.onClick(evt);
109
- }
110
- }}
111
- testId={action.testId}
112
- />
113
- );
114
- }
115
- }
116
- })}
117
- </div>
118
- );
119
- };
120
-
121
- Actions.defaultProps = {
122
- actions: [],
123
- right: false,
124
- };
125
-
126
- Actions.propTypes = {
127
- actions: actionsShape,
128
- right: PropTypes.bool,
129
- };
@@ -1,44 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .actions {
4
- margin-left: auto;
5
- display: flex;
6
- flex-wrap: nowrap;
7
- justify-content: flex-end;
8
- align-items: center;
9
-
10
- > *:not(:last-child) {
11
- margin-right: 3px;
12
- }
13
- }
14
-
15
- // TODO: Deprecate these custom styles - align with Button
16
- // Need to check existing usage in wellplan
17
- .actionComponentContainer {
18
- width: 24px;
19
- height: 24px;
20
- display: inline-flex;
21
- align-items: center;
22
- justify-content: center;
23
- cursor: pointer;
24
- color: #c8c8c8;
25
- position: relative;
26
- z-index: 2;
27
- transition: color 0.2s;
28
- line-height: 0; // Strip uneccessary white space
29
-
30
- i {
31
- margin: 0;
32
- line-height: 1 !important;
33
- }
34
-
35
- &:hover,
36
- &:focus {
37
- color: var(--color-text-primary-hover);
38
- }
39
-
40
- &:active,
41
- &.active {
42
- color: var(--color-text-primary-active);
43
- }
44
- }