@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,101 +0,0 @@
1
- import React, { useState } from 'react';
2
- import { Field, Input, Text } from '../../..';
3
-
4
- export default {
5
- title: 'Forms/Field',
6
- component: Field,
7
- args: {
8
- label: 'Label',
9
- labelLeft: false,
10
- },
11
- };
12
-
13
- const Template = (args) => (
14
- <Field
15
- // eslint-disable-next-line react/jsx-props-no-spreading
16
- {...args}
17
- >
18
- <Input />
19
- </Field>
20
- );
21
- export const Default = Template.bind({});
22
-
23
- export const LabelOnLeft = Template.bind({});
24
- LabelOnLeft.args = {
25
- labelLeft: true,
26
- labelWidth: '80px',
27
- };
28
-
29
- export const HelpIconTooltip = Template.bind({});
30
- HelpIconTooltip.args = {
31
- helpText: 'Tooltip goes here',
32
- };
33
-
34
- export const HelpIconClickable = Template.bind({});
35
- HelpIconClickable.args = {
36
- onClickHelp: () => {},
37
- };
38
-
39
- export const HelpTextBelow = (args) => (
40
- <>
41
- <Field
42
- // eslint-disable-next-line react/jsx-props-no-spreading
43
- {...args}
44
- >
45
- <Input />
46
- <Text small faint>
47
- Help text goes here
48
- </Text>
49
- </Field>
50
- <Field
51
- // eslint-disable-next-line react/jsx-props-no-spreading
52
- {...args}
53
- >
54
- <Input error="Error text goes here" />
55
- <Text small error>
56
- Error text goes here
57
- </Text>
58
- </Field>
59
- <Field
60
- // eslint-disable-next-line react/jsx-props-no-spreading
61
- {...args}
62
- >
63
- <Input warning="Error text goes here" />
64
- <Text small warning>
65
- Warning text goes here
66
- </Text>
67
- </Field>
68
- </>
69
- );
70
-
71
- export const InfoIcon = Template.bind({});
72
- InfoIcon.args = {
73
- info: 'Info goes here',
74
- };
75
-
76
- export const LockIcon = () => {
77
- const [locked, setLocked] = useState(false);
78
- const handleToggleLock = () => setLocked(!locked);
79
- return (
80
- <Field
81
- label="Label"
82
- lock={{
83
- visible: true,
84
- active: locked,
85
- onClick: handleToggleLock,
86
- tooltip: locked ? 'Unlock' : 'Lock',
87
- testId: 'testId',
88
- }}
89
- >
90
- <Input disabled={locked} />
91
- </Field>
92
- );
93
- };
94
-
95
- export const LibraryIcon = Template.bind({});
96
- LibraryIcon.args = {
97
- libraryIcon: {
98
- onClick: () => {},
99
- tooltip: 'View in library',
100
- },
101
- };
@@ -1,30 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .field {
4
- margin-bottom: 14px;
5
- color: var(--color-text);
6
-
7
- &.labelLeft {
8
- display: flex;
9
- align-items: center;
10
-
11
- .fieldInput {
12
- flex-grow: 1;
13
- }
14
- }
15
- }
16
-
17
- .formRow,
18
- .form-row /* hyphens are awkward (deprecate) */ {
19
- display: flex;
20
- flex-wrap: wrap;
21
- align-items: flex-end;
22
-
23
- > *:not(:last-child) {
24
- margin-right: 20px;
25
- }
26
-
27
- .button {
28
- margin-bottom: 14px;
29
- }
30
- }
@@ -1,191 +0,0 @@
1
- import React from 'react';
2
- import { DisabledContext } from '../../helpers/disabled-context';
3
- import {
4
- Field,
5
- Input,
6
- Select,
7
- CheckBox,
8
- ButtonGroup,
9
- Button,
10
- Toggle,
11
- InputGroup,
12
- InputGroupAddon,
13
- Slider,
14
- TextArea,
15
- RadioButton,
16
- Menu,
17
- FormRow,
18
- } from '../../..';
19
-
20
- export default {
21
- title: 'Forms/Layout',
22
- argTypes: {
23
- labelWidth: 'text',
24
- },
25
- args: {
26
- small: false,
27
- row: false,
28
- labelLeft: false,
29
- labelWidth: undefined,
30
- disabled: false,
31
- },
32
- };
33
-
34
- const renderFields = (args) => {
35
- const { small, labelLeft, labelWidth } = args;
36
- return (
37
- <>
38
- <Field
39
- label="Input"
40
- helpText="Some help text"
41
- labelLeft={labelLeft}
42
- labelWidth={labelWidth}
43
- >
44
- <Input value="Value" small={small} />
45
- </Field>
46
- <Field
47
- label="TextArea"
48
- helpText="Some very long help text that needs to have its width constrained so it doesn't look silly"
49
- helpTextMaxWidth={200}
50
- labelLeft={labelLeft}
51
- labelWidth={labelWidth}
52
- >
53
- <TextArea value="Value" small={small} />
54
- </Field>
55
- <Field
56
- label="Select (native)"
57
- labelLeft={labelLeft}
58
- labelWidth={labelWidth}
59
- >
60
- <Select
61
- options={[
62
- { label: 'Option 1', value: '1' },
63
- { label: 'Option 2', value: '2' },
64
- ]}
65
- value={{ label: 'Option 2', value: '2' }}
66
- native
67
- small={small}
68
- width="auto"
69
- />
70
- </Field>
71
- <Field
72
- label="Select (custom)"
73
- labelLeft={labelLeft}
74
- labelWidth={labelWidth}
75
- >
76
- <Select
77
- options={[
78
- { label: 'Option 1', value: '1' },
79
- { label: 'Option 2', value: '2' },
80
- ]}
81
- value={{ label: 'Option 2', value: '2' }}
82
- small={small}
83
- width="auto"
84
- />
85
- </Field>
86
- <Field
87
- label="Select (multi)"
88
- labelLeft={labelLeft}
89
- labelWidth={labelWidth}
90
- >
91
- <Select
92
- options={[
93
- { label: 'Option 1', value: '1' },
94
- { label: 'Option 2', value: '2' },
95
- ]}
96
- value={[
97
- { label: 'Option 1', value: '1' },
98
- { label: 'Option 2', value: '2' },
99
- ]}
100
- small={small}
101
- />
102
- </Field>
103
- <Field label="Slider" labelLeft={labelLeft} labelWidth={labelWidth}>
104
- <Slider
105
- name="example"
106
- label="Number of aardvarks"
107
- value={35}
108
- min={0}
109
- max={100}
110
- step={1}
111
- onChange={() => {}}
112
- showArrows
113
- showTooltip
114
- small={small}
115
- />
116
- </Field>
117
- <Field label="ButtonGroup" labelLeft={labelLeft} labelWidth={labelWidth}>
118
- <ButtonGroup
119
- items={[
120
- { key: 0, label: 'Option 1', value: '1' },
121
- { key: 1, label: 'Option 2', value: '2' },
122
- ]}
123
- value={0}
124
- small={small}
125
- />
126
- </Field>
127
- <Field label="InputGroup" labelLeft={labelLeft} labelWidth={labelWidth}>
128
- <InputGroup small={small}>
129
- <InputGroupAddon>$</InputGroupAddon>
130
- <Input name="example" value="123" onChange={() => {}} />
131
- <InputGroupAddon>each</InputGroupAddon>
132
- </InputGroup>
133
- </Field>
134
- <Field label="Menu" labelLeft={labelLeft} labelWidth={labelWidth}>
135
- <Menu
136
- menu={{
137
- label: 'Menu',
138
- trigger: 'DropDownButton',
139
- sections: [
140
- { type: 'Option', label: 'Lorem' },
141
- { type: 'Option', label: 'Ipsum' },
142
- ],
143
- small,
144
- }}
145
- />
146
- </Field>
147
- <Field label="CheckBox" labelLeft={labelLeft} labelWidth={labelWidth}>
148
- <CheckBox label="CheckBox" checked small={small} />
149
- </Field>
150
- <Field label="RadioButton" labelLeft={labelLeft} labelWidth={labelWidth}>
151
- <RadioButton
152
- options={[
153
- { label: 'Aardvarks', value: 'termites' },
154
- { label: 'Monkeys', value: 'bananas' },
155
- ]}
156
- value={{ label: 'Monkeys', value: 'bananas' }}
157
- inline
158
- small={small}
159
- />
160
- </Field>
161
- <Field label="Toggle" labelLeft={labelLeft} labelWidth={labelWidth}>
162
- <Toggle label="Toggle" checked onChange={() => {}} small={small} />
163
- </Field>
164
- <Field labelLeft={labelLeft} labelWidth={labelWidth}>
165
- <Button colored label="Button" onClick={() => {}} small={small} />
166
- </Field>
167
- </>
168
- );
169
- };
170
-
171
- const Template = (args) => {
172
- const { row, disabled } = args;
173
- return (
174
- <DisabledContext.Provider value={disabled}>
175
- {row ? <FormRow>{renderFields(args)}</FormRow> : renderFields(args)}
176
- </DisabledContext.Provider>
177
- );
178
- };
179
- export const Default = Template.bind({});
180
-
181
- export const Small = Template.bind({});
182
- Small.args = { small: true };
183
-
184
- export const Row = Template.bind({});
185
- Row.args = { row: true };
186
-
187
- export const SmallRow = Template.bind({});
188
- SmallRow.args = { row: true, small: true };
189
-
190
- export const DisabledWithContext = Template.bind({});
191
- DisabledWithContext.args = { disabled: true };
@@ -1,105 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import cx from 'classnames';
4
- import { FaQuestionCircle, FaBook } from 'react-icons/fa';
5
- import { Icon } from '../icon/icon';
6
- import { Tooltip } from '../tooltip/tooltip';
7
- import styles from './heading.module.less';
8
-
9
- export const IconWrapper = ({
10
- onClick,
11
- icon,
12
- isHelp,
13
- isLock,
14
- isFaint,
15
- testId,
16
- }) => {
17
- return (
18
- onClick && (
19
- <span
20
- onClick={(evt) => {
21
- evt.stopPropagation();
22
- if (onClick) {
23
- onClick(evt);
24
- }
25
- }}
26
- className={cx(
27
- styles.icon,
28
- isHelp ? styles.help : '',
29
- isLock ? styles.lock : '',
30
- isFaint ? styles.faint : '',
31
- )}
32
- data-testid={testId}
33
- >
34
- <Icon icon={icon} />
35
- </span>
36
- )
37
- );
38
- };
39
-
40
- export const Heading = ({
41
- children,
42
- onClickHelp,
43
- onClick,
44
- onIconClick,
45
- icon,
46
- libraryIcon,
47
- marginBottom,
48
- top,
49
- testId,
50
- }) => {
51
- return (
52
- <div
53
- className={cx(styles.heading, top ? styles.top : '')}
54
- style={{ marginBottom }}
55
- onClick={(evt) => {
56
- if (onClick) {
57
- onClick(evt);
58
- }
59
- }}
60
- data-testid={testId}
61
- >
62
- {children}
63
- <div className={styles.icons}>
64
- {icon && <IconWrapper onClick={onIconClick} icon={icon} />}
65
- {onClickHelp && (
66
- <IconWrapper
67
- onClick={onClickHelp}
68
- icon={<FaQuestionCircle />}
69
- isHelp
70
- />
71
- )}
72
- {libraryIcon && (
73
- <Tooltip text={libraryIcon?.tooltip ?? ''}>
74
- <IconWrapper onClick={libraryIcon.onClick} icon={<FaBook />} />
75
- </Tooltip>
76
- )}
77
- </div>
78
- </div>
79
- );
80
- };
81
-
82
- Heading.defaultProps = {
83
- onClick: null,
84
- onClickHelp: null,
85
- onIconClick: null,
86
- icon: null,
87
- libraryIcon: null,
88
- marginBottom: null,
89
- top: false,
90
- testId: null,
91
- };
92
-
93
- Heading.propTypes = {
94
- onClick: PropTypes.func,
95
- onClickHelp: PropTypes.func,
96
- onIconClick: PropTypes.func,
97
- icon: PropTypes.node,
98
- libraryIcon: PropTypes.shape({
99
- onClick: PropTypes.func,
100
- tooltip: PropTypes.string,
101
- }),
102
- marginBottom: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
103
- top: PropTypes.bool,
104
- testId: PropTypes.string,
105
- };
@@ -1,59 +0,0 @@
1
- @import '../../style/variables.less';
2
-
3
- .heading {
4
- color: var(--color-text);
5
- font-weight: 600;
6
- display: flex;
7
- align-items: center;
8
- user-select: none;
9
- padding: 0;
10
-
11
- &.top {
12
- font-size: 18px;
13
- margin-bottom: 20px;
14
- line-height: 1.2;
15
- }
16
-
17
- &:not(.top) {
18
- font-size: 13px;
19
- line-height: 20px;
20
- color: var(--color-text-muted);
21
- text-transform: uppercase;
22
- letter-spacing: 0.1em;
23
- }
24
- }
25
-
26
- .icons {
27
- display: inline-flex;
28
-
29
- > * {
30
- margin-left: 8px;
31
- }
32
- }
33
-
34
- .icon {
35
- color: var(--color-text-faint);
36
- cursor: pointer;
37
- line-height: 0;
38
- font-size: 13px;
39
- display: flex;
40
- align-items: center;
41
-
42
- &.lock {
43
- color: var(--color-text);
44
- }
45
-
46
- &.faint {
47
- color: var(--color-text-faint);
48
- }
49
-
50
- &:hover,
51
- &:focus {
52
- color: var(--color-text-primary-hover);
53
- }
54
-
55
- &:active,
56
- &.active {
57
- color: var(--color-text-primary-active);
58
- }
59
- }
@@ -1,60 +0,0 @@
1
- import React from 'react';
2
- import { FaCheckCircle, FaPlus } from 'react-icons/fa';
3
- import { Heading, Flex } from '../../..';
4
-
5
- export default {
6
- title: 'Basic/Heading',
7
- component: Heading,
8
- args: {
9
- children: 'Heading',
10
- top: false,
11
- },
12
- };
13
-
14
- const Template = (args) => (
15
- <Heading
16
- // eslint-disable-next-line react/jsx-props-no-spreading
17
- {...args}
18
- />
19
- );
20
-
21
- export const Default = Template.bind({});
22
-
23
- export const Top = Template.bind({});
24
- Top.args = {
25
- top: true,
26
- };
27
-
28
- export const CustomMargin = Template.bind({});
29
- CustomMargin.args = {
30
- marginBottom: 50,
31
- };
32
-
33
- export const Help = Template.bind({});
34
- Help.args = {
35
- onClickHelp: () => console.log('help!'),
36
- };
37
-
38
- export const LibraryIcon = Template.bind({});
39
- LibraryIcon.args = {
40
- libraryIcon: {
41
- onClick: () => {},
42
- tooltip: 'Edit in library',
43
- },
44
- };
45
-
46
- export const CustomIcon = Template.bind({});
47
- CustomIcon.args = {
48
- icon: <FaPlus />,
49
- onIconClick: () => console.log('clicked icon!'),
50
- };
51
-
52
- export const JSXContent = Template.bind({});
53
- JSXContent.args = {
54
- children: (
55
- <Flex alignItems="center" gap="10px">
56
- Subheading
57
- <FaCheckCircle />
58
- </Flex>
59
- ),
60
- };
@@ -1,97 +0,0 @@
1
- import React from 'react';
2
- import {
3
- FaArrowDown,
4
- FaArrowLeft,
5
- FaArrowRight,
6
- FaArrowUp,
7
- FaChartLine,
8
- FaCheck,
9
- FaChevronDown,
10
- FaChevronUp,
11
- FaClone,
12
- FaEdit,
13
- FaEye,
14
- FaEyeSlash,
15
- FaFileImport, // vertically flipped reply (used in import context)
16
- FaMinus,
17
- FaPencilAlt, //pencil
18
- FaPlus,
19
- FaQuestion,
20
- FaRegCircle, // for not found
21
- FaRegCopy, // copy outline
22
- FaSortAmountDown,
23
- FaSortAmountUp,
24
- FaStar,
25
- FaSync,
26
- FaTable,
27
- FaTimes,
28
- FaTrash,
29
- FaUndo,
30
- } from 'react-icons/fa';
31
-
32
- export const DeprecatedIcon = ({ icon }) => {
33
- switch (icon) {
34
- case 'arrow down':
35
- return <FaArrowDown />;
36
- case 'arrow left':
37
- return <FaArrowLeft />;
38
- case 'arrow right':
39
- return <FaArrowRight />;
40
- case 'arrow up':
41
- return <FaArrowUp />;
42
- case 'chart line':
43
- return <FaChartLine />;
44
- case 'check':
45
- case 'checkmark':
46
- return <FaCheck />;
47
- case 'close':
48
- case 'times':
49
- return <FaTimes />;
50
- case 'question':
51
- return <FaQuestion />;
52
- case 'sort amount down':
53
- return <FaSortAmountDown />;
54
- case 'table':
55
- return <FaTable />;
56
- case 'trash':
57
- return <FaTrash />;
58
- case 'minus':
59
- return <FaMinus />;
60
- case 'add':
61
- case 'plus':
62
- return <FaPlus />;
63
- case 'pencil':
64
- return <FaPencilAlt />;
65
- case 'edit':
66
- case 'edit outline':
67
- return <FaEdit />;
68
- case 'chevron up':
69
- return <FaChevronUp />;
70
- case 'chevron down':
71
- return <FaChevronDown />;
72
- case 'undo':
73
- return <FaUndo />;
74
- case 'eye':
75
- return <FaEye />;
76
- case 'eye slash':
77
- return <FaEyeSlash />;
78
- case 'star':
79
- return <FaStar />;
80
- case 'clone':
81
- case 'orange clone':
82
- return <FaClone />;
83
- case 'sort amount up':
84
- return <FaSortAmountUp />;
85
- case 'copy':
86
- case 'copy outline':
87
- return <FaRegCopy />;
88
- case 'vertically flipped reply':
89
- return <FaFileImport />;
90
- case 'refresh':
91
- return <FaSync />;
92
- case '':
93
- return null;
94
- default:
95
- return <FaRegCircle />; //just a default icon so it's obvious when missing
96
- }
97
- };
@@ -1,71 +0,0 @@
1
- import React, { isValidElement, useContext } from 'react';
2
- import cx from 'classnames';
3
- import PropTypes from 'prop-types';
4
- import { ReactSVG } from 'react-svg';
5
- import { DeprecatedIcon } from './deprecated-icon';
6
- import styles from './icon.module.less';
7
- import { DisabledContext } from '../../helpers/disabled-context';
8
-
9
- /*
10
- Icon wrapper component to support different icon formats:
11
- - react-icons (default recommendation)
12
- - SVG (for special cases)
13
- - deprecated string names (for backwards compatibility with Semantic UI)
14
- */
15
-
16
- export const Icon = ({ icon, onClick, clickable, color, size, testId }) => {
17
- const disabledContext = useContext(DisabledContext);
18
-
19
- return (
20
- <div
21
- className={cx(
22
- styles.wrapper,
23
- (clickable || onClick) && !disabledContext ? styles.clickable : '',
24
- )}
25
- style={{
26
- color,
27
- fill: color,
28
- fontSize: size || 'inherit',
29
- width: size || 'auto',
30
- height: size || 'auto',
31
- }}
32
- onClick={(evt) => (onClick && !disabledContext ? onClick(evt) : {})}
33
- data-testid={testId}
34
- >
35
- {isValidElement(icon) ? (
36
- icon //react-icon
37
- ) : typeof icon === 'string' && icon.includes('.svg') ? (
38
- <ReactSVG
39
- className={styles.customSvg}
40
- beforeInjection={(svg) => {
41
- if (size) {
42
- svg.setAttribute('width', size);
43
- svg.setAttribute('height', size);
44
- }
45
- }}
46
- src={icon}
47
- /> //SVG
48
- ) : typeof icon === 'string' && icon.includes('.png') ? (
49
- <img alt="icon" className={styles.customPng} src={icon} />
50
- ) : typeof icon === 'string' ? (
51
- <DeprecatedIcon icon={icon} /> //deprecated Semantic UI string name
52
- ) : null}
53
- </div>
54
- );
55
- };
56
-
57
- Icon.defaultProps = {
58
- clickable: false,
59
- onClick: null,
60
- testId: '',
61
- };
62
-
63
- Icon.propTypes = {
64
- icon: PropTypes.oneOfType([
65
- PropTypes.node, //JSX (react-icons)
66
- PropTypes.string, //SVG (or deprecated string name)
67
- ]).isRequired,
68
- onClick: PropTypes.func,
69
- clickable: PropTypes.bool,
70
- testId: PropTypes.string,
71
- };