@eccenca/gui-elements 23.0.0 → 23.1.0-rc.2

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 (248) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +7 -0
  3. package/dist/cjs/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  4. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
  5. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  6. package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -7
  7. package/dist/cjs/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  8. package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js +200 -0
  9. package/dist/cjs/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
  10. package/dist/cjs/common/Intent/index.js +7 -3
  11. package/dist/cjs/common/Intent/index.js.map +1 -1
  12. package/dist/cjs/common/utils/characters.js +82 -0
  13. package/dist/cjs/common/utils/characters.js.map +1 -0
  14. package/dist/cjs/components/Application/ApplicationTitle.js +2 -2
  15. package/dist/cjs/components/Application/ApplicationTitle.js.map +1 -1
  16. package/dist/cjs/components/Badge/Badge.js +44 -0
  17. package/dist/cjs/components/Badge/Badge.js.map +1 -0
  18. package/dist/cjs/components/Depiction/Depiction.js +111 -0
  19. package/dist/cjs/components/Depiction/Depiction.js.map +1 -0
  20. package/dist/cjs/components/Grid/Grid.js +7 -2
  21. package/dist/cjs/components/Grid/Grid.js.map +1 -1
  22. package/dist/cjs/components/Grid/GridColumn.js +6 -2
  23. package/dist/cjs/components/Grid/GridColumn.js.map +1 -1
  24. package/dist/cjs/components/Grid/GridRow.js +3 -0
  25. package/dist/cjs/components/Grid/GridRow.js.map +1 -1
  26. package/dist/cjs/components/Icon/BaseIcon.js +38 -0
  27. package/dist/cjs/components/Icon/BaseIcon.js.map +1 -0
  28. package/dist/cjs/components/Icon/Icon.js +9 -24
  29. package/dist/cjs/components/Icon/Icon.js.map +1 -1
  30. package/dist/cjs/components/Icon/IconButton.js +8 -1
  31. package/dist/cjs/components/Icon/IconButton.js.map +1 -1
  32. package/dist/cjs/components/Icon/TestIcon.js +35 -0
  33. package/dist/cjs/components/Icon/TestIcon.js.map +1 -0
  34. package/dist/cjs/components/Icon/canonicalIconNames.js +123 -621
  35. package/dist/cjs/components/Icon/canonicalIconNames.js.map +1 -1
  36. package/dist/cjs/components/Icon/index.js +11 -0
  37. package/dist/cjs/components/Icon/index.js.map +1 -0
  38. package/dist/cjs/components/Menu/MenuItem.js +1 -1
  39. package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
  40. package/dist/cjs/components/MultiSelect/MultiSelect.js +56 -23
  41. package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  42. package/dist/cjs/components/Notification/Notification.js +10 -2
  43. package/dist/cjs/components/Notification/Notification.js.map +1 -1
  44. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js +24 -0
  45. package/dist/cjs/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  46. package/dist/cjs/components/Tag/Tag.js +6 -2
  47. package/dist/cjs/components/Tag/Tag.js.map +1 -1
  48. package/dist/cjs/components/TextField/TextArea.js +4 -2
  49. package/dist/cjs/components/TextField/TextArea.js.map +1 -1
  50. package/dist/cjs/components/TextField/TextField.js +4 -2
  51. package/dist/cjs/components/TextField/TextField.js.map +1 -1
  52. package/dist/cjs/components/TextField/useTextValidation.js +84 -0
  53. package/dist/cjs/components/TextField/useTextValidation.js.map +1 -0
  54. package/dist/cjs/components/Tree/Tree.js.map +1 -1
  55. package/dist/cjs/components/Typography/Highlighter.js.map +1 -1
  56. package/dist/cjs/components/Typography/OverflowText.js.map +1 -1
  57. package/dist/cjs/components/Typography/WhiteSpaceContainer.js +35 -12
  58. package/dist/cjs/components/Typography/WhiteSpaceContainer.js.map +1 -1
  59. package/dist/cjs/components/Typography/index.js +21 -0
  60. package/dist/cjs/components/Typography/index.js.map +1 -0
  61. package/dist/cjs/components/Workspace/WorkspaceContent.js +1 -1
  62. package/dist/cjs/components/Workspace/WorkspaceContent.js.map +1 -1
  63. package/dist/cjs/components/index.js +18 -0
  64. package/dist/cjs/components/index.js.map +1 -0
  65. package/dist/cjs/index.js +7 -17
  66. package/dist/cjs/index.js.map +1 -1
  67. package/dist/esm/cmem/ActivityControl/ActivityControlWidget.js.map +1 -1
  68. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +7 -2
  69. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  70. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js +3 -6
  71. package/dist/esm/cmem/react-flow/StickyNoteModal/StickyNoteModal.js.map +1 -1
  72. package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js +194 -0
  73. package/dist/esm/cmem/react-flow/extensions/scrollOnDragHook.js.map +1 -0
  74. package/dist/esm/common/Intent/index.js +5 -13
  75. package/dist/esm/common/Intent/index.js.map +1 -1
  76. package/dist/esm/common/utils/characters.js +96 -0
  77. package/dist/esm/common/utils/characters.js.map +1 -0
  78. package/dist/esm/components/Application/ApplicationTitle.js +2 -2
  79. package/dist/esm/components/Application/ApplicationTitle.js.map +1 -1
  80. package/dist/esm/components/Badge/Badge.js +48 -0
  81. package/dist/esm/components/Badge/Badge.js.map +1 -0
  82. package/dist/esm/components/Depiction/Depiction.js +96 -0
  83. package/dist/esm/components/Depiction/Depiction.js.map +1 -0
  84. package/dist/esm/components/Grid/Grid.js +7 -2
  85. package/dist/esm/components/Grid/Grid.js.map +1 -1
  86. package/dist/esm/components/Grid/GridColumn.js +6 -2
  87. package/dist/esm/components/Grid/GridColumn.js.map +1 -1
  88. package/dist/esm/components/Grid/GridRow.js +3 -0
  89. package/dist/esm/components/Grid/GridRow.js.map +1 -1
  90. package/dist/esm/components/Icon/BaseIcon.js +44 -0
  91. package/dist/esm/components/Icon/BaseIcon.js.map +1 -0
  92. package/dist/esm/components/Icon/Icon.js +9 -24
  93. package/dist/esm/components/Icon/Icon.js.map +1 -1
  94. package/dist/esm/components/Icon/IconButton.js +8 -1
  95. package/dist/esm/components/Icon/IconButton.js.map +1 -1
  96. package/dist/esm/components/Icon/TestIcon.js +41 -0
  97. package/dist/esm/components/Icon/TestIcon.js.map +1 -0
  98. package/dist/esm/components/Icon/canonicalIconNames.js +123 -621
  99. package/dist/esm/components/Icon/canonicalIconNames.js.map +1 -1
  100. package/dist/esm/components/Icon/index.js +4 -0
  101. package/dist/esm/components/Icon/index.js.map +1 -0
  102. package/dist/esm/components/Menu/MenuItem.js +1 -1
  103. package/dist/esm/components/Menu/MenuItem.js.map +1 -1
  104. package/dist/esm/components/MultiSelect/MultiSelect.js +61 -44
  105. package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  106. package/dist/esm/components/Notification/Notification.js +12 -4
  107. package/dist/esm/components/Notification/Notification.js.map +1 -1
  108. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js +24 -0
  109. package/dist/esm/components/OverviewItem/OverviewItemDepiction.js.map +1 -1
  110. package/dist/esm/components/Tag/Tag.js +6 -2
  111. package/dist/esm/components/Tag/Tag.js.map +1 -1
  112. package/dist/esm/components/TextField/TextArea.js +4 -2
  113. package/dist/esm/components/TextField/TextArea.js.map +1 -1
  114. package/dist/esm/components/TextField/TextField.js +4 -2
  115. package/dist/esm/components/TextField/TextField.js.map +1 -1
  116. package/dist/esm/components/TextField/useTextValidation.js +78 -0
  117. package/dist/esm/components/TextField/useTextValidation.js.map +1 -0
  118. package/dist/esm/components/Tree/Tree.js.map +1 -1
  119. package/dist/esm/components/Typography/Highlighter.js.map +1 -1
  120. package/dist/esm/components/Typography/OverflowText.js.map +1 -1
  121. package/dist/esm/components/Typography/WhiteSpaceContainer.js +16 -14
  122. package/dist/esm/components/Typography/WhiteSpaceContainer.js.map +1 -1
  123. package/dist/esm/components/Typography/index.js +12 -0
  124. package/dist/esm/components/Typography/index.js.map +1 -0
  125. package/dist/esm/components/Workspace/WorkspaceContent.js +1 -1
  126. package/dist/esm/components/Workspace/WorkspaceContent.js.map +1 -1
  127. package/dist/esm/components/index.js +6 -0
  128. package/dist/esm/components/index.js.map +1 -0
  129. package/dist/esm/index.js +5 -10
  130. package/dist/esm/index.js.map +1 -1
  131. package/dist/types/cmem/ActivityControl/ActivityControlWidget.d.ts +2 -1
  132. package/dist/types/cmem/react-flow/ReactFlow/ReactFlow.d.ts +14 -0
  133. package/dist/types/cmem/react-flow/extensions/scrollOnDragHook.d.ts +22 -0
  134. package/dist/types/common/Intent/index.d.ts +4 -3
  135. package/dist/types/common/utils/characters.d.ts +19 -0
  136. package/dist/types/components/Badge/Badge.d.ts +42 -0
  137. package/dist/types/components/Depiction/Depiction.d.ts +71 -0
  138. package/dist/types/components/Grid/Grid.d.ts +21 -2
  139. package/dist/types/components/Grid/GridColumn.d.ts +20 -2
  140. package/dist/types/components/Grid/GridRow.d.ts +17 -1
  141. package/dist/types/components/Icon/BaseIcon.d.ts +45 -0
  142. package/dist/types/components/Icon/Icon.d.ts +7 -34
  143. package/dist/types/components/Icon/IconButton.d.ts +3 -2
  144. package/dist/types/components/Icon/TestIcon.d.ts +20 -0
  145. package/dist/types/components/Icon/canonicalIconNames.d.ts +9 -7
  146. package/dist/types/components/Icon/index.d.ts +4 -0
  147. package/dist/types/components/Menu/MenuItem.d.ts +2 -1
  148. package/dist/types/components/MultiSelect/MultiSelect.d.ts +3 -1
  149. package/dist/types/components/Notification/Notification.d.ts +13 -4
  150. package/dist/types/components/Tabs/Tab.d.ts +2 -0
  151. package/dist/types/components/Tag/Tag.d.ts +16 -3
  152. package/dist/types/components/TextField/TextArea.d.ts +7 -2
  153. package/dist/types/components/TextField/TextField.d.ts +6 -1
  154. package/dist/types/components/TextField/useTextValidation.d.ts +28 -0
  155. package/dist/types/components/Tree/Tree.d.ts +2 -1
  156. package/dist/types/components/Typography/Highlighter.d.ts +2 -2
  157. package/dist/types/components/Typography/OverflowText.d.ts +2 -2
  158. package/dist/types/components/Typography/WhiteSpaceContainer.d.ts +45 -4
  159. package/dist/types/components/Typography/index.d.ts +12 -0
  160. package/dist/types/components/index.d.ts +5 -0
  161. package/dist/types/index.d.ts +6 -11
  162. package/package.json +13 -16
  163. package/scripts/compile-sass.ts +9 -1
  164. package/src/_shame.scss +1 -1
  165. package/src/cmem/ActivityControl/ActivityControlWidget.stories.tsx +6 -4
  166. package/src/cmem/ActivityControl/ActivityControlWidget.tsx +3 -2
  167. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +26 -1
  168. package/src/cmem/react-flow/StickyNoteModal/StickyNoteModal.tsx +10 -6
  169. package/src/cmem/react-flow/extensions/scrollOnDragHook.ts +247 -0
  170. package/src/common/Intent/index.ts +16 -12
  171. package/src/common/utils/characters.ts +111 -0
  172. package/src/components/Accordion/accordion.scss +4 -3
  173. package/src/components/Application/ApplicationTitle.tsx +2 -2
  174. package/src/components/Application/_config.scss +1 -1
  175. package/src/components/Application/_content.scss +1 -1
  176. package/src/components/Application/_header.scss +2 -2
  177. package/src/components/Application/_sidebar.scss +2 -9
  178. package/src/components/Application/_toolbar.scss +1 -1
  179. package/src/components/Application/application.scss +4 -4
  180. package/src/components/AutocompleteField/autoCompleteFieldUtils.tsx +13 -8
  181. package/src/components/Badge/Badge.stories.tsx +47 -0
  182. package/src/components/Badge/Badge.tsx +93 -0
  183. package/src/components/Badge/badge.scss +44 -0
  184. package/src/components/Depiction/Depiction.tsx +198 -0
  185. package/src/components/Depiction/depiction.scss +176 -0
  186. package/src/components/Depiction/stories/Depiction.stories.tsx +69 -0
  187. package/src/components/Depiction/stories/test-16to9.png +0 -0
  188. package/src/components/Depiction/stories/test-16to9.svg +41 -0
  189. package/src/components/Depiction/stories/test-16to9.tobase64.svg +41 -0
  190. package/src/components/Depiction/stories/test-16to9.tsx +44 -0
  191. package/src/components/Depiction/stories/test-9to16.png +0 -0
  192. package/src/components/Depiction/stories/test-9to16.svg +44 -0
  193. package/src/components/Depiction/stories/test-9to16.tobase64.svg +44 -0
  194. package/src/components/Depiction/stories/test-9to16.tsx +48 -0
  195. package/src/components/Grid/Grid.tsx +22 -4
  196. package/src/components/Grid/GridColumn.tsx +23 -6
  197. package/src/components/Grid/GridRow.tsx +17 -2
  198. package/src/components/Grid/grid.scss +14 -13
  199. package/src/components/Grid/stories/Grid.stories.tsx +27 -0
  200. package/src/components/Grid/stories/GridColumn.stories.tsx +66 -0
  201. package/src/components/Grid/stories/GridRow.stories.tsx +47 -0
  202. package/src/components/Icon/BaseIcon.tsx +84 -0
  203. package/src/components/Icon/Icon.tsx +23 -82
  204. package/src/components/Icon/IconButton.tsx +18 -14
  205. package/src/components/Icon/TestIcon.tsx +39 -0
  206. package/src/components/Icon/canonicalIconNames.tsx +132 -633
  207. package/src/components/Icon/index.ts +5 -0
  208. package/src/components/Icon/stories/Icon.stories.tsx +13 -0
  209. package/src/components/Icon/stories/IconButton.stories.tsx +14 -7
  210. package/src/components/Icon/stories/TestIcon.stories.tsx +28 -0
  211. package/src/components/Link/link.scss +2 -1
  212. package/src/components/Menu/MenuItem.tsx +14 -4
  213. package/src/components/Menu/Stories/MenuItem.stories.tsx +16 -2
  214. package/src/components/MultiSelect/MultiSelect.tsx +58 -27
  215. package/src/components/Notification/Notification.stories.tsx +4 -0
  216. package/src/components/Notification/Notification.tsx +26 -6
  217. package/src/components/OverviewItem/OverviewItemDepiction.tsx +31 -0
  218. package/src/components/OverviewItem/overviewitem.scss +2 -1
  219. package/src/components/OverviewItem/stories/OverviewItem.stories.tsx +22 -1
  220. package/src/components/OverviewItem/stories/OverviewItemDepiction.stories.tsx +8 -3
  221. package/src/components/Pagination/pagination.scss +3 -2
  222. package/src/components/SimpleTable/simpletable.scss +11 -12
  223. package/src/components/Tag/Tag.stories.tsx +7 -2
  224. package/src/components/Tag/Tag.tsx +24 -4
  225. package/src/components/Tag/tag.scss +84 -3
  226. package/src/components/TagInput/taginput.scss +6 -0
  227. package/src/components/TextField/TextArea.tsx +10 -1
  228. package/src/components/TextField/TextField.tsx +9 -0
  229. package/src/components/TextField/stories/SearchField.stories.tsx +1 -1
  230. package/src/components/TextField/textfield.scss +12 -0
  231. package/src/components/TextField/useTextValidation.ts +103 -0
  232. package/src/components/Tooltip/tooltip.scss +1 -1
  233. package/src/components/Tree/Tree.stories.tsx +7 -1
  234. package/src/components/Tree/Tree.tsx +2 -1
  235. package/src/components/Typography/Highlighter.tsx +2 -2
  236. package/src/components/Typography/OverflowText.tsx +2 -2
  237. package/src/components/Typography/WhiteSpaceContainer.tsx +69 -21
  238. package/src/components/Typography/index.ts +25 -0
  239. package/src/components/Typography/stories/WhiteSpaceContainer.stories.tsx +55 -0
  240. package/src/components/Typography/typography.scss +3 -2
  241. package/src/components/Workspace/WorkspaceContent.tsx +1 -1
  242. package/src/components/index.scss +5 -0
  243. package/src/components/index.ts +5 -0
  244. package/src/includes/carbon-components/_components.scss +11 -0
  245. package/src/includes/carbon-components/_requisits.scss +18 -0
  246. package/src/includes/carbon-components/_variables.scss +50 -53
  247. package/src/index.scss +4 -105
  248. package/src/index.ts +6 -16
@@ -0,0 +1,5 @@
1
+ import Icon, { IconProps } from "./Icon";
2
+ import TestIcon, { TestIconProps } from "./TestIcon";
3
+
4
+ export { Icon, TestIcon };
5
+ export type { IconProps, TestIconProps };
@@ -32,6 +32,19 @@ Default.args = {
32
32
  name: "undefined"
33
33
  }
34
34
 
35
+ const TemplateSizes: ComponentStory<typeof Icon> = (args) => (
36
+ <>
37
+ <Icon {...args} small />
38
+ <Icon {...args} />
39
+ <Icon {...args} large />
40
+ </>
41
+ );
42
+
43
+ export const IconSizes = TemplateSizes.bind({});
44
+ IconSizes.args = {
45
+ name: "undefined"
46
+ }
47
+
35
48
  export const IconsOverview = () => {
36
49
  return (
37
50
  <>
@@ -1,27 +1,34 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
-
4
- import {
5
- IconButton,
6
- } from "../../../index";
3
+ import { LogoReact } from "@carbon/icons-react";
4
+ import { IconButton,TestIcon } from "../../../index";
7
5
  import canonicalIcons from "./../canonicalIconNames";
8
6
 
9
7
  export default {
10
8
  title: "Components/IconButton",
11
9
  component: IconButton,
12
10
  argTypes: {
11
+ text: { control: "text" },
13
12
  name: {
14
13
  control: "select",
15
- options: [...(Object.keys(canonicalIcons))],
14
+ options: [
15
+ "Test icon",
16
+ ...(Object.keys(canonicalIcons)),
17
+ ],
18
+ mapping: {
19
+ "Test icon": <TestIcon tryout={LogoReact} className="testclass-icon"/>,
20
+ ...(Object.keys(canonicalIcons)),
21
+ }
16
22
  },
17
23
  },
18
24
  } as ComponentMeta<typeof IconButton>;
19
25
 
20
26
  const Template: ComponentStory<typeof IconButton> = (args) => (
21
- <IconButton {...args} text={args.name?.toString()}/>
27
+ <IconButton {...args} />
22
28
  );
23
29
 
24
30
  export const Default = Template.bind({});
25
31
  Default.args = {
26
- name: "item-moremenu"
32
+ name: "item-moremenu",
33
+ text: "Tooltip text"
27
34
  }
@@ -0,0 +1,28 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { LogoReact } from "@carbon/icons-react";
4
+ import { TestIcon } from "../../../index";
5
+ import { Definitions } from "../../../common/Intent";
6
+
7
+ export default {
8
+ title: "Components/Icon",
9
+ component: TestIcon,
10
+ argTypes: {
11
+ tryout: {
12
+ control: "none",
13
+ },
14
+ intent: {
15
+ control: "select",
16
+ options: {...Definitions},
17
+ },
18
+ },
19
+ } as ComponentMeta<typeof TestIcon>;
20
+
21
+ const Template: ComponentStory<typeof TestIcon> = (args) => (
22
+ <TestIcon {...args} />
23
+ );
24
+
25
+ export const TestingAnIcon = Template.bind({});
26
+ TestingAnIcon.args = {
27
+ tryout: LogoReact,
28
+ }
@@ -1,4 +1,5 @@
1
- @import "~carbon-components/scss/components/link/link";
1
+ @use "~@carbon/styles/scss/components/link/link";
2
+ @include link.link;
2
3
 
3
4
  .#{$prefix}--link {
4
5
  font-size: 1em;
@@ -1,15 +1,19 @@
1
1
  import React from 'react';
2
- import {MenuItem as BlueprintMenuItem, MenuItemProps as BlueprintMenuItemProps} from "@blueprintjs/core";
2
+ import {
3
+ MenuItem as BlueprintMenuItem,
4
+ MenuItemProps as BlueprintMenuItemProps
5
+ } from "@blueprintjs/core";
3
6
  import {CLASSPREFIX as eccgui} from "../../configuration/constants";
4
7
  import Icon from '../Icon/Icon';
8
+ import { TestIconProps } from "./../Icon/TestIcon";
5
9
  import { openInNewTab } from '../../common/utils/openInNewTab';
6
- import {ValidIconName} from "../Icon/canonicalIconNames";
10
+ import { ValidIconName } from "../Icon/canonicalIconNames";
7
11
 
8
12
  export interface MenuItemProps extends Omit<BlueprintMenuItemProps, "icon" | "children">, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target" | "children"> {
9
13
  /*
10
14
  * If set the icon is diplayed on the left side of the menu item.
11
15
  */
12
- icon?: ValidIconName | string[];
16
+ icon?: ValidIconName | string[] | React.ReactElement<TestIconProps>;
13
17
  children?: React.ReactNode
14
18
  }
15
19
 
@@ -31,7 +35,13 @@ function MenuItem({
31
35
  onClick={(e) => openInNewTab(e, onClick, href)}
32
36
  className={`${eccgui}-menu__item ` + className}
33
37
  icon={
34
- icon ? <Icon name={icon} /> : false
38
+ icon ? (
39
+ (typeof icon === "string" || Array.isArray(icon)) ? (
40
+ <Icon name={icon} />
41
+ ) : (
42
+ icon
43
+ )
44
+ ) : false
35
45
  }
36
46
  >
37
47
  {children ?? null}
@@ -1,10 +1,24 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
- import { Menu, MenuItem } from "../../../../index";
3
+ import { LogoReact } from "@carbon/icons-react";
4
+ import { Menu, MenuItem, TestIcon } from "../../../../index";
5
+ import canonicalIcons from "./../../Icon/canonicalIconNames";
6
+
4
7
  export default {
5
8
  title: "Components/Menu/MenuItem",
6
9
  component: MenuItem,
7
10
  argTypes: {
11
+ icon: {
12
+ control: "select",
13
+ options: [
14
+ "Test icon",
15
+ ...(Object.keys(canonicalIcons)),
16
+ ],
17
+ mapping: {
18
+ "Test icon": <TestIcon tryout={LogoReact} className="testclass-icon"/>,
19
+ ...(Object.keys(canonicalIcons)),
20
+ }
21
+ },
8
22
  }
9
23
  } as ComponentMeta<typeof MenuItem>
10
24
 
@@ -17,7 +31,7 @@ Default.args = {
17
31
  children: (
18
32
  <>
19
33
  <MenuItem key="m6" text={"Sub option 1"} />
20
- <MenuItem key="m6" text={"Sub option 2"} />
34
+ <MenuItem key="m7" text={"Sub option 2"} />
21
35
  </>
22
36
  ),
23
37
  text: "Parent option",
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React, {useRef} from "react";
2
2
  import {
3
3
  Intent as BlueprintIntent,
4
4
  HTMLInputProps as BlueprintHTMLInputProps
@@ -14,6 +14,7 @@ import {
14
14
  Button,
15
15
  OverflowText,
16
16
  ContextOverlayProps,
17
+ Spinner,
17
18
  } from "./../../index";
18
19
 
19
20
  import {removeExtraSpaces} from "../../common/utils/stringUtils";
@@ -101,6 +102,9 @@ interface IProps<T> extends Pick<BlueprintMultiSelectProps<T>, "items" | "placeh
101
102
  * Disables the input element
102
103
  */
103
104
  disabled?: boolean;
105
+
106
+ /** Delay in ms how long the request for the given query should be delayed. */
107
+ requestDelay?: number
104
108
  }
105
109
 
106
110
  function MultiSelect<T>({
@@ -123,6 +127,7 @@ function MultiSelect<T>({
123
127
  hasStateWarning,
124
128
  disabled,
125
129
  createNewItemFromQuery,
130
+ requestDelay = 0,
126
131
  ...otherProps
127
132
  }: IProps<T>) {
128
133
  const [createdItems, setCreatedItems] = React.useState<T[]>([]);
@@ -130,10 +135,14 @@ function MultiSelect<T>({
130
135
  const [itemsCopy, setItemsCopy] = React.useState<T[]>([...items]);
131
136
  const [filteredItemList, setFilteredItemList] = React.useState<T[]>([]);
132
137
  const [selectedItems, setSelectedItems] = React.useState<T[]>(() => (prePopulateWithItems ? [...items] : []));
133
- const [query, setQuery] = React.useState<string | undefined>(undefined);
134
138
  //currently focused element in popover list
135
139
  const [focusedItem, setFocusedItem] = React.useState<T | null>(null);
140
+ const [showSpinner, setShowSpinner] = React.useState(false)
136
141
  const inputRef = React.useRef<HTMLInputElement>(null);
142
+ const requestState = useRef<{
143
+ query?: string,
144
+ timeoutId?: number
145
+ }>({})
137
146
 
138
147
  let intent;
139
148
  switch (true) {
@@ -193,7 +202,7 @@ function MultiSelect<T>({
193
202
  setSelectedItems((items) => items.filter((item) => itemId(item) !== matcher));
194
203
  };
195
204
 
196
-
205
+
197
206
 
198
207
  /**
199
208
  * selects and deselects an item from selection list
@@ -201,25 +210,25 @@ function MultiSelect<T>({
201
210
  * @param item
202
211
  */
203
212
  const onItemSelect = (item: T) => {
204
-
213
+
205
214
  if (itemHasBeenSelectedAlready(itemId(item))) {
206
215
  removeItemSelection(itemId(item));
207
216
  } else {
208
217
  setSelectedItems((items) => [...items, item]);
209
218
  }
210
-
219
+
211
220
  //remove if already exist
212
221
  if (createdSelectedItems.find((t) => itemLabel(t) === itemLabel(item))) {
213
222
  setCreatedSelectedItems((prevItems) => prevItems.filter(prevItem => itemLabel(prevItem) !== itemLabel(item)))
214
223
  }else {
215
224
  const wasNewlyCreated = createdItems.find((t) => itemLabel(t) === itemLabel(item));
216
- //only add to createdSelectedItems if it was previously created and not
217
- // from the initial items or a possible query response
225
+ //only add to createdSelectedItems if it was previously created and not
226
+ // from the initial items or a possible query response
218
227
  if(wasNewlyCreated){
219
228
  setCreatedSelectedItems((prevItems) =>[...prevItems, item])
220
229
  }
221
230
  }
222
-
231
+
223
232
  inputRef.current?.select();
224
233
  };
225
234
 
@@ -227,22 +236,33 @@ function MultiSelect<T>({
227
236
  * search through item list using "label prop" and update the items popover
228
237
  * @param query
229
238
  */
230
- const onQueryChange = async (query: string) => {
231
- if (query.length) {
232
- setQuery(query);
233
- setFilteredItemList([])
234
- const resultFromQuery = runOnQueryChange && (await runOnQueryChange(removeExtraSpaces(query)));
235
- setFilteredItemList(() =>
236
- [...(resultFromQuery ?? itemsCopy), ...createdItems].filter(item =>
237
- itemLabel(item).toLowerCase().includes(query.toLowerCase())
238
- )
239
- );
239
+ const onQueryChange = (query: string) => {
240
+ if (query.length && query !== requestState.current.query) {
241
+ requestState.current.query = query
242
+ if(requestState.current.timeoutId) {
243
+ clearTimeout(requestState.current.timeoutId)
244
+ }
245
+ const fn = async () => {
246
+ setShowSpinner(true)
247
+ setFilteredItemList([])
248
+ const resultFromQuery = runOnQueryChange && (await runOnQueryChange(removeExtraSpaces(query)));
249
+ if (requestState.current.query === query) {
250
+ // Only use most recent request
251
+ setFilteredItemList(() =>
252
+ [...(resultFromQuery ?? itemsCopy), ...createdItems].filter(item =>
253
+ itemLabel(item).toLowerCase().includes(query.toLowerCase())
254
+ )
255
+ );
256
+ setShowSpinner(false)
257
+ }
258
+ }
259
+ requestState.current.timeoutId = window.setTimeout(fn, requestDelay && requestDelay > 0 ? requestDelay : 0)
240
260
  }
241
261
  };
242
262
 
243
263
  // Renders the entries of the (search) options list
244
264
  const optionRenderer = (label: string) => {
245
- return <Highlighter label={label} searchValue={query} />;
265
+ return <Highlighter label={label} searchValue={requestState.current.query} />;
246
266
  };
247
267
 
248
268
  /**
@@ -294,7 +314,7 @@ function MultiSelect<T>({
294
314
  //set new items
295
315
  setCreatedItems((items) => [...items, newItem]);
296
316
  setCreatedSelectedItems((items) => [...items, newItem])
297
- setQuery("");
317
+ requestState.current.query = ""
298
318
  return newItem;
299
319
  };
300
320
 
@@ -303,8 +323,8 @@ function MultiSelect<T>({
303
323
  * @param event
304
324
  */
305
325
  const handleOnKeyUp = (event: React.KeyboardEvent<HTMLElement>) => {
306
- if (event.key === "Enter" && !filteredItemList.length && !!query && createNewItemFromQuery) {
307
- createNewItem(query);
326
+ if (event.key === "Enter" && !filteredItemList.length && !!requestState.current.query && createNewItemFromQuery) {
327
+ createNewItem(requestState.current.query);
308
328
  }
309
329
  inputRef.current?.focus();
310
330
  };
@@ -315,10 +335,10 @@ function MultiSelect<T>({
315
335
  * @param event
316
336
  */
317
337
  const handleOnKeyDown = (event: React.KeyboardEvent<HTMLElement>) => {
318
- if (event.key === "Tab" && !!query) {
338
+ if (event.key === "Tab" && !!requestState.current.query) {
319
339
  event.preventDefault();
320
- focusedItem ? onItemSelect(focusedItem) : onItemSelect(createNewItem(query));
321
- setQuery("");
340
+ focusedItem ? onItemSelect(focusedItem) : onItemSelect(createNewItem(requestState.current.query));
341
+ requestState.current.query = "";
322
342
  setTimeout(() => inputRef.current?.focus());
323
343
  }
324
344
  };
@@ -348,15 +368,25 @@ function MultiSelect<T>({
348
368
  );
349
369
  };
350
370
 
371
+ // Clear button and spinner are both shown as "right element"
351
372
  const clearButton =
352
373
  selectedItems.length > 0 ? (
353
374
  <Button icon="operation-clear" data-test-id="clear-all-items" minimal={true} onClick={handleClear} />
354
375
  ) : undefined;
355
376
 
377
+ const spinnerProps = showSpinner ? {
378
+ rightElement: (
379
+ <>
380
+ <Spinner position={"inline"} size={"tiny"} />
381
+ {clearButton ?? null}
382
+ </>
383
+ )
384
+ } : {}
385
+
356
386
  return (
357
387
  <BlueprintMultiSelect<T>
358
388
  {...otherProps}
359
- query={query}
389
+ query={requestState.current.query}
360
390
  onQueryChange={onQueryChange}
361
391
  items={filteredItemList}
362
392
  onItemSelect={onItemSelect}
@@ -385,11 +415,12 @@ function MultiSelect<T>({
385
415
  tagProps: { minimal: true },
386
416
  disabled,
387
417
  ...tagInputProps,
418
+ ...spinnerProps
388
419
  }}
420
+
389
421
  popoverProps={{
390
422
  minimal: true,
391
423
  placement: "bottom-start",
392
- hasBackdrop: true,
393
424
  fill: true,
394
425
  ...contextOverlayProps,
395
426
  }}
@@ -2,6 +2,7 @@ import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
3
  import { LoremIpsum } from 'react-lorem-ipsum';
4
4
  import { Notification, HtmlContentBlock, Button, Spacing} from "../../../index";
5
+ import { helpersArgTypes } from "../../../.storybook/helpers";
5
6
 
6
7
  export default {
7
8
  title: "Components/Notification",
@@ -10,6 +11,9 @@ export default {
10
11
  message: {
11
12
  control: "none",
12
13
  },
14
+ icon: {
15
+ ...helpersArgTypes.exampleIcon,
16
+ },
13
17
  },
14
18
  } as ComponentMeta<typeof Notification>;
15
19
 
@@ -6,7 +6,8 @@ import {
6
6
  } from "@blueprintjs/core";
7
7
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
8
8
  import {ClassNames as IntentClassNames} from "../../common/Intent";
9
- import Icon from "./../Icon/Icon";
9
+ import Icon, { IconProps } from "./../Icon/Icon";
10
+ import { TestIconProps } from "./../Icon/TestIcon";
10
11
  import { ValidIconName } from "./../Icon/canonicalIconNames";
11
12
 
12
13
  export interface NotificationProps extends Omit<BlueprintToastProps, "message" | "action" | "icon" | "intent">, React.HTMLAttributes<HTMLDivElement> {
@@ -38,19 +39,25 @@ export interface NotificationProps extends Omit<BlueprintToastProps, "message" |
38
39
  */
39
40
  danger?: boolean;
40
41
  /**
42
+ * @deprecated
41
43
  * Notification uses the the given space more flexible.
42
- * Depracation notice: Property name will removed in futire versions.
44
+ * Deprecation notice: Property name will removed in future versions.
43
45
  * Please use `flexWidth`.
44
- * @depracted
45
46
  */
46
47
  fullWidth?: boolean;
47
48
  /**
48
49
  * Notification uses the the given space more flexible.
49
- * Default notifcation is displayed in min and max limits.
50
+ * Default notification is displayed in min and max limits.
50
51
  * Those limits are removed by setting this property to `true`.
51
52
  */
52
53
  flexWidth?: boolean;
53
54
  /**
55
+ * Icon displayed with the notification.
56
+ * Set it to false if you need to prevent automatically set icon regarding the notification type.
57
+ */
58
+ icon?: false | React.ReactElement<IconProps> | React.ReactElement<TestIconProps>;
59
+ /**
60
+ * @deprecated
54
61
  * Icon used as depiction that is displayed with the notification.
55
62
  */
56
63
  iconName?: ValidIconName | null;
@@ -71,7 +78,8 @@ function Notification({
71
78
  neutral = false,
72
79
  fullWidth = false, // deprecated
73
80
  flexWidth = false,
74
- iconName = "state-info",
81
+ iconName = "state-info", // deprecated
82
+ icon,
75
83
  timeout,
76
84
  ...otherProps
77
85
  }: NotificationProps) {
@@ -95,6 +103,11 @@ function Notification({
95
103
  break;
96
104
  }
97
105
 
106
+ let notificationIcon = icon !== false ? icon : undefined;
107
+ if (icon !== false && !notificationIcon && !!iconSymbol) {
108
+ notificationIcon = <Icon name={iconSymbol} />;
109
+ }
110
+
98
111
  const content = actions ? (
99
112
  <div className={`${eccgui}-notification__content`}>
100
113
  <div className={`${eccgui}-notification__messagebody`}>{message ? message : children}</div>
@@ -118,7 +131,14 @@ function Notification({
118
131
  }
119
132
  message={content}
120
133
  timeout={timeout ? timeout : 0}
121
- icon={!!iconSymbol ? <Icon name={iconSymbol} className={BlueprintClassNames.ICON} /> : undefined}
134
+ icon={
135
+ !!notificationIcon ? React.cloneElement(
136
+ notificationIcon as JSX.Element,
137
+ {
138
+ className: (notificationIcon.props.className??"") + ` ${BlueprintClassNames.ICON}`
139
+ }
140
+ ) : undefined
141
+ }
122
142
  {...otherProps}
123
143
  />
124
144
  );
@@ -1,4 +1,7 @@
1
1
  import React from "react";
2
+ import { Depiction } from "./../Depiction/Depiction";
3
+ import Icon from "./../Icon/Icon";
4
+ import TestIcon from "./../Icon/TestIcon";
2
5
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
3
6
 
4
7
  export interface OverviewItemDepictionProps extends React.HTMLAttributes<HTMLDivElement> {
@@ -12,6 +15,34 @@ function OverviewItemDepiction({
12
15
  keepColors = false,
13
16
  ...restProps
14
17
  }: OverviewItemDepictionProps) {
18
+ const defaultDepictionDisplay = {
19
+ // mimic OverviewItemDepiction "behaviour"
20
+ border: false,
21
+ backgroundColor: keepColors ? undefined : "dark",
22
+ ratio: "1:1" as "1:1",
23
+ padding: "medium" as "medium"
24
+ }
25
+ // only return Depiction element if it is wrapped inside OverviewItemDepiction
26
+ if (
27
+ typeof children === "object" &&
28
+ !!children &&
29
+ "type" in children &&
30
+ children.type === Depiction
31
+ ) {
32
+ return React.cloneElement(
33
+ children,
34
+ defaultDepictionDisplay
35
+ );
36
+ }
37
+ // use Depiction element for basic icons
38
+ if (
39
+ typeof children === "object" &&
40
+ !!children &&
41
+ "type" in children &&
42
+ (children.type === Icon || children.type === TestIcon)
43
+ ) {
44
+ return <Depiction image={children} {...defaultDepictionDisplay} />
45
+ }
15
46
  return (
16
47
  <div
17
48
  {...restProps}
@@ -62,7 +62,8 @@ $eccgui-size-overviewitem-line-typo-large-lineheight: $eccgui-size-typo-subtitle
62
62
 
63
63
  .#{$ns}-menu > & {
64
64
  // TODO: discuss if this should be enabled via explicit element property
65
- @extend .#{$ns}-menu-item;
65
+ // remove this because reason was not clear and it lead to wrong display
66
+ // @extend .#{$ns}-menu-item;
66
67
 
67
68
  &--active {
68
69
  background-color: $eccgui-color-accent;
@@ -2,17 +2,20 @@ import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
3
 
4
4
  import {
5
+ Badge,
5
6
  OverviewItem,
6
7
  OverviewItemActions,
7
8
  OverviewItemDepiction,
8
9
  OverviewItemDescription,
9
- } from "./../";
10
+ Depiction,
11
+ } from "./../../../index";
10
12
 
11
13
  import Card from "../../Card/Card";
12
14
 
13
15
  import { Default as DepictionExample } from "./OverviewItemDepiction.stories";
14
16
  import { Default as DescriptionExample } from "./OverviewItemDescription.stories";
15
17
  import { Default as ActionsExample } from "./OverviewItemActions.stories";
18
+ import { FullExample as OtherDepictionExample } from "./../../Depiction/stories/Depiction.stories";
16
19
 
17
20
  export default {
18
21
  title: "Components/OverviewItem",
@@ -45,6 +48,24 @@ ItemExample.args = {
45
48
  ]
46
49
  }
47
50
 
51
+ export const ItemWithDepictionElement = Template.bind({});
52
+ ItemWithDepictionElement.args = {
53
+ children: [
54
+ <Depiction
55
+ { ...OtherDepictionExample.args }
56
+ badge={<Badge position="top-right" intent="accent">B</Badge>}
57
+ ratio="1:1"
58
+ resizing="stretch"
59
+ captionPosition="tooltip"
60
+ border
61
+ rounded
62
+ />,
63
+ <OverviewItemDescription { ...DescriptionExample.args } />,
64
+ <OverviewItemActions children={ ActionsExample.args.children[0] } hiddenInteractions />,
65
+ <OverviewItemActions children={ ActionsExample.args.children[1] } />
66
+ ]
67
+ }
68
+
48
69
  const TemplateCard: ComponentStory<typeof OverviewItem> = (args) => (
49
70
  <Card isOnlyLayout><OverviewItem {...args}></OverviewItem></Card>
50
71
  );
@@ -1,8 +1,8 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
- import Icon from "../../Icon/Icon";
3
+ import { Depiction, Icon, OverviewItemDepiction } from "../../../index";
4
4
 
5
- import OverviewItemDepiction from "./../OverviewItemDepiction";
5
+ import { FullExample as DepictionExample } from "./../../Depiction/stories/Depiction.stories";
6
6
 
7
7
  export default {
8
8
  title: "Components/OverviewItem/OverviewItemDepiction",
@@ -22,5 +22,10 @@ const Template: ComponentStory<typeof OverviewItemDepiction> = (args) => (
22
22
 
23
23
  export const Default = Template.bind({});
24
24
  Default.args = {
25
- children: <Icon name="artefact-dataset" />
25
+ children: <><Icon name="artefact-dataset" /></>
26
+ }
27
+
28
+ export const UseDepictionElement = Template.bind({});
29
+ UseDepictionElement.args = {
30
+ children: <Depiction {...DepictionExample.args} resizing="contain" />
26
31
  }
@@ -1,9 +1,10 @@
1
+ @use "~@carbon/styles/scss/components/pagination/pagination";
2
+ @include pagination.pagination;
3
+
1
4
  $eccgui-color-pagination-background: transparent !default;
2
5
  $eccgui-color-pagination-text: $eccgui-color-workspace-text !default;
3
6
  $eccgui-size-typo-pagination: $eccgui-size-typo-caption !default;
4
7
 
5
- @import "~carbon-components/scss/components/pagination/pagination";
6
-
7
8
  .#{$prefix}--pagination {
8
9
  background-color: $eccgui-color-pagination-background;
9
10
  font-size: $eccgui-size-typo-pagination;
@@ -1,10 +1,18 @@
1
+ // import libs
2
+ @use "~@carbon/styles/scss/components/data-table/data-table";
3
+ // currently not needed @import '~@carbon/styles/scss/components/data-table/action';
4
+ // currently not needed @import '~@carbon/styles/scss/components/data-table/expandable';
5
+ // currently not needed @import '~@carbon/styles/scss/components/data-table/skeleton';
6
+ // currently not needed @import '~@carbon/styles/scss/components/data-table/sort';
7
+ @include data-table.data-table;
8
+
1
9
  // own vars
2
10
  $eccgui-size-tablecell-height-regular: mini-units(5) !default;
3
- $eccgui-size-tablecell-padding-regular: ($eccgui-size-tablecell-height-regular - carbon--rem($eccgui-size-typo-text)) * 0.5 !default;
11
+ $eccgui-size-tablecell-padding-regular: ($eccgui-size-tablecell-height-regular - rem($eccgui-size-typo-text)) * 0.5 !default;
4
12
  $eccgui-size-tablecell-height-compact: mini-units(4) !default;
5
- $eccgui-size-tablecell-padding-compact: ($eccgui-size-tablecell-height-compact - carbon--rem($eccgui-size-typo-text)) * 0.5 !default;
13
+ $eccgui-size-tablecell-padding-compact: ($eccgui-size-tablecell-height-compact - rem($eccgui-size-typo-text)) * 0.5 !default;
6
14
  $eccgui-size-tablecell-height-tall: mini-units(6) !default;
7
- $eccgui-size-tablecell-padding-tall: ($eccgui-size-tablecell-height-tall - carbon--rem($eccgui-size-typo-text)) * 0.5 !default;
15
+ $eccgui-size-tablecell-padding-tall: ($eccgui-size-tablecell-height-tall - rem($eccgui-size-typo-text)) * 0.5 !default;
8
16
  $eccgui-size-tablecell-font-weight: $eccgui-font-weight-regular !default;
9
17
  $eccgui-size-tableheader-font-weight: $eccgui-font-weight-bold !default;
10
18
  $eccgui-color-tableheader-background: lighten($menu-item-color-hover, 15%) !default; // rgba($ui-03, alpha($ui-03) * $eccgui-opacity-muted);
@@ -14,15 +22,6 @@ $eccgui-color-tablerow-hover: $menu-item-color-hover !default;
14
22
  $eccgui-color-tablerow-selected: rgba($eccgui-color-accent, 0.1) !default;
15
23
  $eccgui-color-tablerow-selected-hover: mix($eccgui-color-tablerow-selected, $eccgui-color-tablerow-hover, 50%) !default;
16
24
 
17
- // lib vars
18
- // import libs
19
- // currently not needed @import '~carbon-components/scss/components/data-table/data-table-action';
20
- @import "~carbon-components/scss/components/data-table/data-table-core";
21
- // currently not needed @import '~carbon-components/scss/components/data-table/data-table-expandable';
22
- // currently not needed @import '~carbon-components/scss/components/data-table/data-table-sort';
23
- // currently not needed @import '~carbon-components/scss/components/data-table/data-table-inline-edit';
24
- // currently not needed @import '~carbon-components/scss/components/data-table/data-table-skeleton';
25
-
26
25
  // changes
27
26
  .#{$eccgui}-simpletable__container {
28
27
  min-width: unset;