@eccenca/gui-elements 23.0.0-rc.6 → 23.0.0-rc.7

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 (164) hide show
  1. package/CHANGELOG.md +3 -1
  2. package/dist/cjs/cmem/markdown/Markdown.js +14 -2
  3. package/dist/cjs/cmem/markdown/Markdown.js.map +1 -1
  4. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js +0 -4
  5. package/dist/cjs/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  6. package/dist/cjs/components/Accordion/Accordion.js +7 -2
  7. package/dist/cjs/components/Accordion/Accordion.js.map +1 -1
  8. package/dist/cjs/components/Accordion/AccordionItem.js.map +1 -1
  9. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js +59 -33
  10. package/dist/cjs/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  11. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js +10 -1
  12. package/dist/cjs/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  13. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js +10 -4
  14. package/dist/cjs/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
  15. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js +13 -8
  16. package/dist/cjs/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  17. package/dist/cjs/components/Button/Button.js.map +1 -1
  18. package/dist/cjs/components/Checkbox/Checkbox.js +1 -0
  19. package/dist/cjs/components/Checkbox/Checkbox.js.map +1 -1
  20. package/dist/cjs/components/Form/FieldItem.js.map +1 -1
  21. package/dist/cjs/components/Menu/Menu.js +2 -2
  22. package/dist/cjs/components/Menu/Menu.js.map +1 -1
  23. package/dist/cjs/components/Menu/MenuDivider.js +2 -2
  24. package/dist/cjs/components/Menu/MenuDivider.js.map +1 -1
  25. package/dist/cjs/components/Menu/MenuItem.js +5 -3
  26. package/dist/cjs/components/Menu/MenuItem.js.map +1 -1
  27. package/dist/cjs/components/MultiSelect/MultiSelect.js +17 -4
  28. package/dist/cjs/components/MultiSelect/MultiSelect.js.map +1 -1
  29. package/dist/cjs/components/Pagination/Pagination.js.map +1 -1
  30. package/dist/cjs/components/RadioButton/RadioButton.js +1 -0
  31. package/dist/cjs/components/RadioButton/RadioButton.js.map +1 -1
  32. package/dist/cjs/components/Separation/Spacing.js +4 -1
  33. package/dist/cjs/components/Separation/Spacing.js.map +1 -1
  34. package/dist/cjs/components/Spinner/Spinner.js +3 -3
  35. package/dist/cjs/components/Spinner/Spinner.js.map +1 -1
  36. package/dist/cjs/components/Switch/Switch.js.map +1 -1
  37. package/dist/cjs/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
  38. package/dist/esm/cmem/markdown/Markdown.js +13 -2
  39. package/dist/esm/cmem/markdown/Markdown.js.map +1 -1
  40. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js +0 -4
  41. package/dist/esm/cmem/react-flow/ReactFlow/ReactFlow.js.map +1 -1
  42. package/dist/esm/components/Accordion/Accordion.js +8 -3
  43. package/dist/esm/components/Accordion/Accordion.js.map +1 -1
  44. package/dist/esm/components/Accordion/AccordionItem.js +1 -1
  45. package/dist/esm/components/Accordion/AccordionItem.js.map +1 -1
  46. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js +71 -45
  47. package/dist/esm/components/AutoSuggestion/AutoSuggestion.js.map +1 -1
  48. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js +11 -2
  49. package/dist/esm/components/AutoSuggestion/AutoSuggestionList.js.map +1 -1
  50. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js +11 -5
  51. package/dist/esm/components/AutoSuggestion/SingleLineCodeEditor.js.map +1 -1
  52. package/dist/esm/components/AutocompleteField/AutoCompleteField.js +19 -14
  53. package/dist/esm/components/AutocompleteField/AutoCompleteField.js.map +1 -1
  54. package/dist/esm/components/Button/Button.js.map +1 -1
  55. package/dist/esm/components/Checkbox/Checkbox.js +1 -0
  56. package/dist/esm/components/Checkbox/Checkbox.js.map +1 -1
  57. package/dist/esm/components/Form/FieldItem.js.map +1 -1
  58. package/dist/esm/components/Menu/Menu.js +3 -3
  59. package/dist/esm/components/Menu/Menu.js.map +1 -1
  60. package/dist/esm/components/Menu/MenuDivider.js +3 -3
  61. package/dist/esm/components/Menu/MenuDivider.js.map +1 -1
  62. package/dist/esm/components/Menu/MenuItem.js +5 -3
  63. package/dist/esm/components/Menu/MenuItem.js.map +1 -1
  64. package/dist/esm/components/MultiSelect/MultiSelect.js +22 -9
  65. package/dist/esm/components/MultiSelect/MultiSelect.js.map +1 -1
  66. package/dist/esm/components/Pagination/Pagination.js +1 -1
  67. package/dist/esm/components/Pagination/Pagination.js.map +1 -1
  68. package/dist/esm/components/RadioButton/RadioButton.js +2 -1
  69. package/dist/esm/components/RadioButton/RadioButton.js.map +1 -1
  70. package/dist/esm/components/Separation/Spacing.js +4 -1
  71. package/dist/esm/components/Separation/Spacing.js.map +1 -1
  72. package/dist/esm/components/Spinner/Spinner.js +3 -4
  73. package/dist/esm/components/Spinner/Spinner.js.map +1 -1
  74. package/dist/esm/components/Switch/Switch.js +1 -1
  75. package/dist/esm/components/Switch/Switch.js.map +1 -1
  76. package/dist/esm/extensions/react-flow/edges/EdgeDefault.js.map +1 -1
  77. package/dist/types/cmem/markdown/Markdown.d.ts +3 -2
  78. package/dist/types/cmem/react-flow/ReactFlow/ReactFlow.d.ts +1 -1
  79. package/dist/types/components/Accordion/Accordion.d.ts +12 -1
  80. package/dist/types/components/Accordion/AccordionItem.d.ts +21 -6
  81. package/dist/types/components/AutoSuggestion/AutoSuggestionList.d.ts +4 -2
  82. package/dist/types/components/AutocompleteField/AutoCompleteField.d.ts +5 -0
  83. package/dist/types/components/Button/Button.d.ts +1 -1
  84. package/dist/types/components/Checkbox/Checkbox.d.ts +4 -1
  85. package/dist/types/components/Form/FieldItem.d.ts +32 -2
  86. package/dist/types/components/Menu/Menu.d.ts +4 -1
  87. package/dist/types/components/Menu/MenuDivider.d.ts +4 -1
  88. package/dist/types/components/Menu/MenuItem.d.ts +5 -2
  89. package/dist/types/components/Pagination/Pagination.d.ts +9 -5
  90. package/dist/types/components/RadioButton/RadioButton.d.ts +4 -1
  91. package/dist/types/components/Separation/Spacing.d.ts +17 -3
  92. package/dist/types/components/Spinner/Spinner.d.ts +38 -5
  93. package/dist/types/components/Switch/Switch.d.ts +6 -3
  94. package/dist/types/extensions/react-flow/edges/EdgeDefault.d.ts +15 -0
  95. package/package.json +4 -6
  96. package/src/cmem/markdown/Markdown.tsx +5 -4
  97. package/src/cmem/react-flow/ReactFlow/ReactFlow.stories.tsx +15 -86
  98. package/src/cmem/react-flow/ReactFlow/ReactFlow.tsx +1 -5
  99. package/src/components/Accordion/Accordion.tsx +33 -3
  100. package/src/components/Accordion/AccordionItem.tsx +23 -33
  101. package/src/components/Accordion/Stories/Accordion.stories.tsx +33 -0
  102. package/src/components/Accordion/Stories/AccordionItem.stories.tsx +27 -0
  103. package/src/components/Accordion/accordion.scss +20 -1
  104. package/src/components/AutoSuggestion/AutoSuggestion.tsx +73 -39
  105. package/src/components/AutoSuggestion/AutoSuggestionList.tsx +15 -2
  106. package/src/components/AutoSuggestion/SingleLineCodeEditor.tsx +17 -9
  107. package/src/components/AutoSuggestion/tests/AutoSuggestionList.test.tsx +9 -7
  108. package/src/components/AutocompleteField/AutoCompleteField.tsx +19 -6
  109. package/src/components/AutocompleteField/autoCompleteFieldUtils.tsx +1 -1
  110. package/src/components/AutocompleteField/stories/AutoCompleteField.stories.tsx +1 -1
  111. package/src/components/Button/Button.stories.tsx +1 -107
  112. package/src/components/Button/Button.tsx +2 -2
  113. package/src/components/Card/stories/Card.stories.tsx +2 -21
  114. package/src/components/Checkbox/Checkbox.tsx +9 -2
  115. package/src/components/Checkbox/Stories/Checkbox.stories.tsx +30 -0
  116. package/src/components/Checkbox/checkbox.scss +4 -0
  117. package/src/components/ContextOverlay/ContextMenu.stories.tsx +2 -2
  118. package/src/components/Dialog/stories/Modal.stories.tsx +1 -61
  119. package/src/components/Dialog/stories/SimpleDialog.stories.tsx +1 -2
  120. package/src/components/Form/FieldItem.tsx +32 -2
  121. package/src/components/Form/Stories/FieldItem.stories.tsx +27 -0
  122. package/src/components/Form/Stories/FieldItemRow.stories.tsx +31 -0
  123. package/src/components/Label/Label.stories.tsx +1 -1
  124. package/src/components/Menu/Menu.tsx +21 -3
  125. package/src/components/Menu/MenuDivider.tsx +20 -3
  126. package/src/components/Menu/MenuItem.tsx +13 -10
  127. package/src/components/Menu/Stories/Menu.stories.tsx +31 -0
  128. package/src/components/Menu/Stories/MenuItem.stories.tsx +25 -0
  129. package/src/components/MultiSelect/MultiSelect.stories.tsx +2 -21
  130. package/src/components/MultiSelect/MultiSelect.tsx +22 -5
  131. package/src/components/Notification/Notification.stories.tsx +1 -29
  132. package/src/components/Pagination/Pagination.tsx +13 -6
  133. package/src/components/Pagination/Stories/Pagination.stories.tsx +32 -0
  134. package/src/components/Pagination/pagination.scss +2 -2
  135. package/src/components/ProgressBar/Stories/ProgressBar.stories.tsx +25 -0
  136. package/src/components/RadioButton/RadioButton.tsx +9 -2
  137. package/src/components/RadioButton/Stories/RadioButton.stories.tsx +30 -0
  138. package/src/components/Select/Select.stories.tsx +1 -1
  139. package/src/components/Separation/Spacing.tsx +17 -4
  140. package/src/components/Separation/Stories/Spacing.stories.tsx +25 -0
  141. package/src/components/Spinner/Spinner.tsx +39 -7
  142. package/src/components/Spinner/Stories/spinner.stories.tsx +26 -0
  143. package/src/components/Switch/Stories/Switch.stories.tsx +27 -0
  144. package/src/components/Switch/Switch.tsx +9 -3
  145. package/src/components/Tabs/stories/Tab.stories.tsx +1 -32
  146. package/src/components/Tabs/stories/Tabs.stories.tsx +1 -39
  147. package/src/components/Tag/Tag.stories.tsx +1 -9
  148. package/src/components/TextField/stories/TextArea.stories.tsx +10 -25
  149. package/src/components/TextField/stories/TextField.stories.tsx +2 -73
  150. package/src/extensions/react-flow/edges/EdgeDefault.tsx +19 -0
  151. package/src/extensions/react-flow/edges/stories/EdgeDefault.stories.tsx +121 -0
  152. package/src/extensions/react-flow/nodes/stories/NodeContent.stories.tsx +1 -1
  153. package/dist/cjs/cmem/react-flow/configuration/customLabel.js +0 -13
  154. package/dist/cjs/cmem/react-flow/configuration/customLabel.js.map +0 -1
  155. package/dist/cjs/cmem/react-flow/configuration/inverseEdge.js +0 -13
  156. package/dist/cjs/cmem/react-flow/configuration/inverseEdge.js.map +0 -1
  157. package/dist/esm/cmem/react-flow/configuration/customLabel.js +0 -10
  158. package/dist/esm/cmem/react-flow/configuration/customLabel.js.map +0 -1
  159. package/dist/esm/cmem/react-flow/configuration/inverseEdge.js +0 -10
  160. package/dist/esm/cmem/react-flow/configuration/inverseEdge.js.map +0 -1
  161. package/dist/types/cmem/react-flow/configuration/customLabel.d.ts +0 -8
  162. package/dist/types/cmem/react-flow/configuration/inverseEdge.d.ts +0 -8
  163. package/src/cmem/react-flow/configuration/customLabel.ts +0 -11
  164. package/src/cmem/react-flow/configuration/inverseEdge.ts +0 -11
@@ -1,12 +1,19 @@
1
1
  import React from 'react';
2
- import { Checkbox as BlueprintCheckbox } from "@blueprintjs/core";
2
+ import {
3
+ Checkbox as BlueprintCheckbox,
4
+ CheckboxProps as BlueprintCheckboxProps
5
+ } from "@blueprintjs/core";
3
6
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
7
 
8
+ interface CheckboxProps extends BlueprintCheckboxProps {
9
+ // currently we do not alter it
10
+ };
11
+
5
12
  function Checkbox({
6
13
  children,
7
14
  className='',
8
15
  ...restProps
9
- }: any) {
16
+ }: CheckboxProps) {
10
17
  return (
11
18
  <BlueprintCheckbox
12
19
  {...restProps}
@@ -0,0 +1,30 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { Checkbox, HtmlContentBlock } from "../../../../index";
4
+ import { LoremIpsum } from 'react-lorem-ipsum';
5
+
6
+ export default {
7
+ title: "Forms/Checkbox",
8
+ component: Checkbox,
9
+ argTypes: {
10
+ onChange : {action : 'clicked'}
11
+ },
12
+ } as ComponentMeta<typeof Checkbox>
13
+
14
+ const Template:ComponentStory<typeof Checkbox> = (args) => (
15
+ <Checkbox {...args} />
16
+ );
17
+
18
+ export const SimpleTextLabel = Template.bind({});
19
+ SimpleTextLabel.args = {
20
+ label : "Checkbox label",
21
+ inline : true,
22
+ };
23
+
24
+ export const ElementsAsLabel = Template.bind({});
25
+ ElementsAsLabel.args = {
26
+ ...SimpleTextLabel.args,
27
+ label : undefined,
28
+ inline : false,
29
+ children: <HtmlContentBlock><LoremIpsum p={3} avgSentencesPerParagraph={3} random={false} /></HtmlContentBlock>
30
+ };
@@ -63,3 +63,7 @@ $switch-checked-background-color-disabled: rgba($switch-checked-background-color
63
63
  }
64
64
  }
65
65
  }
66
+
67
+ .#{$ns}-control-indicator + * {
68
+ margin-top: -1 * $eccgui-size-typo-text * $eccgui-size-typo-text-lineheight;
69
+ }
@@ -26,8 +26,8 @@ Default.args = {
26
26
  children: [
27
27
  <MenuItem key="m0" text={"First option"} />,
28
28
  <MenuItem key="m1" text={"Item two"}>
29
- <MenuItem key="m0" text={"First sub option"} />
30
- <MenuItem key="m1" text={"Sub item two"} />
29
+ <MenuItem key="m2" text={"First sub option"} />
30
+ <MenuItem key="m3" text={"Sub item two"} />
31
31
  </MenuItem>
32
32
  ]
33
33
  }
@@ -1,72 +1,12 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
-
4
- import Modal from "./../Modal";
5
- import Card from "../../Card/Card";
3
+ import { Modal, Card } from "./../../../../index";
6
4
  import { SimpleCard } from "../../Card/stories/Card.stories";
7
5
 
8
6
  export default {
9
7
  title: "Components/Dialog/Modal",
10
8
  component: Modal,
11
9
  argTypes: {
12
- autoFocus: {
13
- description: "Modal acquires application focus when it first opens.",
14
- control: "boolean",
15
- table: {
16
- type: { summary: "boolean" },
17
- defaultValue: { summary: true },
18
- }
19
- },
20
- canEscapeKeyClose: {
21
- description: "Pressing the `esc` key triggers `onClose` handler.",
22
- control: "boolean",
23
- table: {
24
- type: { summary: "boolean" },
25
- defaultValue: { summary: false },
26
- }
27
- },
28
- canOutsideClickClose: {
29
- description: "Clicking outside the modal triggers `onClose` handler.",
30
- control: "boolean",
31
- table: {
32
- type: { summary: "boolean" },
33
- defaultValue: { summary: false },
34
- }
35
- },
36
- enforceFocus: {
37
- description: "Prevent focus from leaving modal element. If an element outside the modal is focused then the modal will immediately bring focus back to itself. If you are nesting modal components, either disable this prop on the outermost modal or mark the nested ones `usePortal={false}`.",
38
- control: "boolean",
39
- table: {
40
- type: { summary: "boolean" },
41
- defaultValue: { summary: true },
42
- }
43
- },
44
- isOpen: {
45
- description: "Toggles the visibility of the overlay and its children, this prop is required because the component is controlled",
46
- },
47
- onClose: {
48
- description: "A callback that is invoked when user interaction causes the modal to close.",
49
- table: {
50
- type: { summary: "(event: SyntheticEvent<HTMLElement>) => void" },
51
- defaultValue: { summary: undefined },
52
- }
53
- },
54
- shouldReturnFocusOnClose: {
55
- description: "Return focus to the last active element in the document after modal closes.",
56
- control: "boolean",
57
- table: {
58
- type: { summary: "boolean" },
59
- defaultValue: { summary: true },
60
- }
61
- },
62
- usePortal: {
63
- description: "Whether the modal should be wrapped in a Portal, which renders its contents in a new element attached to `portalContainer` prop, by default to `document.body`.",
64
- control: "boolean",
65
- table: {
66
- type: { summary: "boolean" },
67
- defaultValue: { summary: true },
68
- }
69
- },
70
10
  children: {
71
11
  control: "none",
72
12
  description: "Elements to include into the modal container."
@@ -1,7 +1,6 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
-
4
- import SimpleDialog from "./../SimpleDialog";
3
+ import { SimpleDialog } from "./../../../../index";
5
4
  import storyModal from "./Modal.stories";
6
5
  import { Default as CardContentExample } from "./../../Card/stories/CardContent.stories";
7
6
  import { Default as CardActionsExample } from "./../../Card/stories/CardActions.stories";
@@ -14,15 +14,45 @@ import {TestableComponent} from "../interfaces";
14
14
  */
15
15
 
16
16
  export interface FieldItemProps extends React.HTMLAttributes<HTMLDivElement>, TestableComponent {
17
+ /**
18
+ * Set primary state.
19
+ * This is not routed through automatically.
20
+ */
17
21
  hasStatePrimary?: boolean
22
+ /**
23
+ * Set success state.
24
+ * This is not routed through automatically.
25
+ */
18
26
  hasStateSuccess?: boolean
27
+ /**
28
+ * Set warning state.
29
+ * This is not routed through automatically.
30
+ */
19
31
  hasStateWarning?: boolean
32
+ /**
33
+ * Set danger state.
34
+ * This is not routed through automatically.
35
+ */
20
36
  hasStateDanger?: boolean
21
- children: JSX.Element | JSX.Element[] | null
22
- className?: string
37
+ /**
38
+ * Is disabled.
39
+ * The included inout element nedd to set disabled directly itself.
40
+ * This is not routed through automatically.
41
+ */
23
42
  disabled?: boolean
43
+ /**
44
+ * Used to set properties for the `Label` element that is used.
45
+ */
24
46
  labelProps?: LabelProps
47
+ /**
48
+ * Text for user help.
49
+ * Is displayed between label and input element.
50
+ */
25
51
  helperText?: string | JSX.Element
52
+ /**
53
+ * Feedback notification.
54
+ * Is displayed below the included input element.
55
+ */
26
56
  messageText?: string
27
57
  }
28
58
 
@@ -0,0 +1,27 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { FieldItem, TextField } from '../../../../index';
4
+ import { LoremIpsum } from 'react-lorem-ipsum';
5
+
6
+ export default {
7
+ title: "Forms/FieldItem",
8
+ component: FieldItem,
9
+ argTypes: {
10
+ children: {
11
+ control: "none",
12
+ },
13
+ }
14
+ } as ComponentMeta<typeof FieldItem>;
15
+
16
+ const Template: ComponentStory<typeof FieldItem> = (args) => (
17
+ <FieldItem {...args} />
18
+ );
19
+ export const Default = Template.bind({});
20
+ Default.args = {
21
+ children : <TextField />,
22
+ messageText : <LoremIpsum p={1} avgSentencesPerParagraph={2} random={false} />,
23
+ helperText: <LoremIpsum p={1} avgSentencesPerParagraph={1} random={false} />,
24
+ labelProps: {
25
+ text: "Input label"
26
+ }
27
+ };
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import FieldItem from '../FieldItem'
4
+ import FieldItemRow from "../FieldItemRow";
5
+ import { Default as FieldItemStory } from "./FieldItem.stories";
6
+
7
+ export default {
8
+ title: "Forms/FieldItemRow",
9
+ component: FieldItemRow,
10
+ argTypes: {
11
+ children: {
12
+ control: "none",
13
+ description: "Elements to include into the Accordion component"
14
+ },
15
+ }
16
+
17
+ } as ComponentMeta<typeof FieldItemRow>;
18
+
19
+ const Template: ComponentStory<typeof FieldItemRow> = (args) => (
20
+ <FieldItemRow {...args} />
21
+ );
22
+ export const Default = Template.bind({});
23
+ Default.args = {
24
+ children : [
25
+ <>
26
+ <FieldItem {...FieldItemStory.args}/>
27
+ <FieldItem {...FieldItemStory.args}/>
28
+ <FieldItem {...FieldItemStory.args}/>
29
+ </>
30
+ ]
31
+ };
@@ -7,7 +7,7 @@ import {
7
7
  } from "../../index";
8
8
 
9
9
  export default {
10
- title: "Components/Label",
10
+ title: "Forms/Label",
11
11
  component: Label,
12
12
  argTypes: {
13
13
  },
@@ -1,9 +1,27 @@
1
1
  import React from 'react';
2
- import { Menu as BlueprintMenu } from "@blueprintjs/core";
2
+ import {
3
+ Menu as BlueprintMenu,
4
+ MenuProps as BlueprintMenuProps,
5
+ } from "@blueprintjs/core";
3
6
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
7
 
5
- function Menu({children, className='', ...restProps}: any) {
6
- return <BlueprintMenu {...restProps} className={`${eccgui}-menu__list ` + className}>{children}</BlueprintMenu>;
8
+ export interface MenuProps extends BlueprintMenuProps {
9
+ // we do not add own changes here currently
10
+ }
11
+
12
+ function Menu({
13
+ children,
14
+ className="",
15
+ ...restProps
16
+ }: MenuProps) {
17
+ return (
18
+ <BlueprintMenu
19
+ {...restProps}
20
+ className={`${eccgui}-menu__list ` + className}
21
+ >
22
+ {children}
23
+ </BlueprintMenu>
24
+ );
7
25
  }
8
26
 
9
27
  export default Menu;
@@ -1,9 +1,26 @@
1
1
  import React from 'react';
2
- import { MenuDivider as BlueprintMenuDivider } from "@blueprintjs/core";
2
+ import {
3
+ MenuDivider as BlueprintMenuDivider,
4
+ MenuDividerProps as BlueprintMenuDividerProps,
5
+ } from "@blueprintjs/core";
3
6
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
7
 
5
- function MenuDivider({children, className='', ...restProps}: any) {
6
- return <BlueprintMenuDivider {...restProps} className={`${eccgui}-menu__divider ` + className}>{children}</BlueprintMenuDivider>;
8
+ export interface MenuDividerProps extends BlueprintMenuDividerProps {
9
+ // we do not add own changes here currently
10
+ }
11
+
12
+ function MenuDivider({
13
+ children,
14
+ className="",
15
+ ...restProps
16
+ }: MenuDividerProps) {
17
+ return (
18
+ <BlueprintMenuDivider
19
+ {...restProps}
20
+ className={`${eccgui}-menu__divider ` + className}>
21
+ {children}
22
+ </BlueprintMenuDivider>
23
+ );
7
24
  }
8
25
 
9
26
  export default MenuDivider;
@@ -5,22 +5,25 @@ import Icon from '../Icon/Icon';
5
5
  import { openInNewTab } from '../../common/utils/openInNewTab';
6
6
  import {ValidIconName} from "../Icon/canonicalIconNames";
7
7
 
8
- export interface MenuItemProps extends Omit<BlueprintMenuItemProps, "icon">, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target"> {
8
+ export interface MenuItemProps extends Omit<BlueprintMenuItemProps, "icon" | "children">, Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, "onClick" | "target" | "children"> {
9
9
  /*
10
10
  * If set the icon is diplayed on the left side of the menu item.
11
11
  */
12
12
  icon?: ValidIconName | string[];
13
+ children?: React.ReactNode
13
14
  }
14
15
 
15
- /** A single item in a Menu. */
16
+ /**
17
+ * Single item, used as child inside `Menu`.
18
+ */
16
19
  function MenuItem({
17
- children,
18
- className = '',
19
- icon,
20
- onClick,
21
- href,
22
- ...restProps
23
- }: MenuItemProps) {
20
+ children,
21
+ className = "",
22
+ icon,
23
+ onClick,
24
+ href,
25
+ ...restProps
26
+ }: MenuItemProps) {
24
27
  return (
25
28
  <BlueprintMenuItem
26
29
  {...restProps}
@@ -31,7 +34,7 @@ function MenuItem({
31
34
  icon ? <Icon name={icon} /> : false
32
35
  }
33
36
  >
34
- {children}
37
+ {children ?? null}
35
38
  </BlueprintMenuItem>
36
39
  );
37
40
  }
@@ -0,0 +1,31 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { Menu, MenuItem, MenuDivider } from "../../../../index";
4
+ import { Default as MenuItemStory } from '../Stories/MenuItem.stories';
5
+ import { Default as ContentMenuStory } from '../../ContextOverlay/ContextMenu.stories';
6
+
7
+ export default {
8
+ title: "Components/Menu",
9
+ component: Menu,
10
+ subcomponents: {MenuItem, MenuDivider},
11
+ argTypes: {
12
+ children: {
13
+ control: "none",
14
+ },
15
+ }
16
+ } as ComponentMeta<typeof Menu>
17
+
18
+ const MenuExample: ComponentStory<typeof Menu> = (args) => (
19
+ <Menu style={{width: "200px"}} {...args} />
20
+ );
21
+
22
+ export const Default = MenuExample.bind({});
23
+ Default.args = {
24
+ children : (
25
+ <>
26
+ {ContentMenuStory.args.children}
27
+ <MenuDivider title ="Second menu part"/>
28
+ <MenuItem {...MenuItemStory.args} selected />
29
+ </>
30
+ ),
31
+ };
@@ -0,0 +1,25 @@
1
+ import React from "react";
2
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
3
+ import { Menu, MenuItem } from "../../../../index";
4
+ export default {
5
+ title: "Components/Menu/MenuItem",
6
+ component: MenuItem,
7
+ argTypes: {
8
+ }
9
+ } as ComponentMeta<typeof MenuItem>
10
+
11
+ const MenuExample: ComponentStory<typeof MenuItem> = (args) => (
12
+ <Menu style={{width: "200px"}}><MenuItem {...args} /></Menu>
13
+ );
14
+
15
+ export const Default = MenuExample.bind({});
16
+ Default.args = {
17
+ children: (
18
+ <>
19
+ <MenuItem key="m6" text={"Sub option 1"} />
20
+ <MenuItem key="m6" text={"Sub option 2"} />
21
+ </>
22
+ ),
23
+ text: "Parent option",
24
+ key: "m4"
25
+ };
@@ -1,32 +1,13 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
3
  import { loremIpsum } from "react-lorem-ipsum";
4
-
5
- import MultiSelectExample from "./MultiSelect";
4
+ import { MultiSelect as MultiSelectExample } from "./../../../index";
6
5
 
7
6
  export default {
8
- title: "Components/MultiSelect",
7
+ title: "Forms/MultiSelect",
9
8
  component: MultiSelectExample,
10
9
  argTypes: {
11
- placeholder: {
12
- description: "Input placeholder text",
13
- control: "text",
14
- table: {
15
- type: { summary: "string" },
16
- },
17
- },
18
- openOnKeyDown: {
19
- description:
20
- "If true, the component waits until a keydown event in the TagInput before opening its popover. If false, the popover opens immediately after a mouse click focuses the component's TagInput ",
21
- control: "boolean",
22
- defaultValue: false,
23
- table: {
24
- type: { summary: "boolean" },
25
- defaultValue: { summary: false },
26
- },
27
- },
28
10
  items: {
29
- description: "Array of items in the list",
30
11
  control: "none",
31
12
  },
32
13
  },
@@ -126,6 +126,7 @@ function MultiSelect<T>({
126
126
  ...otherProps
127
127
  }: IProps<T>) {
128
128
  const [createdItems, setCreatedItems] = React.useState<T[]>([]);
129
+ const [createdSelectedItems, setCreatedSelectedItems] = React.useState<T[]>([]);
129
130
  const [itemsCopy, setItemsCopy] = React.useState<T[]>([...items]);
130
131
  const [filteredItemList, setFilteredItemList] = React.useState<T[]>([]);
131
132
  const [selectedItems, setSelectedItems] = React.useState<T[]>(() => (prePopulateWithItems ? [...items] : []));
@@ -165,14 +166,14 @@ function MultiSelect<T>({
165
166
  onSelection &&
166
167
  onSelection({
167
168
  newlySelected: selectedItems.slice(-1)[0],
168
- createdItems,
169
+ createdItems: createdSelectedItems,
169
170
  selectedItems,
170
171
  });
171
172
  /* eslint-disable react-hooks/exhaustive-deps */
172
173
  }, [
173
174
  onSelection,
174
175
  selectedItems.map((item) => itemId(item)).join("|"),
175
- createdItems.map((item) => itemId(item)).join("|"),
176
+ createdSelectedItems.map((item) => itemId(item)).join("|"),
176
177
  ]);
177
178
 
178
179
  /**
@@ -192,18 +193,34 @@ function MultiSelect<T>({
192
193
  setSelectedItems((items) => items.filter((item) => itemId(item) !== matcher));
193
194
  };
194
195
 
196
+
197
+
195
198
  /**
196
199
  * selects and deselects an item from selection list
197
200
  * if the item exists it removes it instead
198
201
  * @param item
199
202
  */
200
203
  const onItemSelect = (item: T) => {
204
+
201
205
  if (itemHasBeenSelectedAlready(itemId(item))) {
202
206
  removeItemSelection(itemId(item));
203
207
  } else {
204
208
  setSelectedItems((items) => [...items, item]);
205
209
  }
206
- inputRef.current?.select()
210
+
211
+ //remove if already exist
212
+ if (createdSelectedItems.find((t) => itemLabel(t) === itemLabel(item))) {
213
+ setCreatedSelectedItems((prevItems) => prevItems.filter(prevItem => itemLabel(prevItem) !== itemLabel(item)))
214
+ }else {
215
+ 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
218
+ if(wasNewlyCreated){
219
+ setCreatedSelectedItems((prevItems) =>[...prevItems, item])
220
+ }
221
+ }
222
+
223
+ inputRef.current?.select();
207
224
  };
208
225
 
209
226
  /**
@@ -266,7 +283,7 @@ function MultiSelect<T>({
266
283
  */
267
284
  const removeTagFromSelectionViaIndex = (label: React.ReactNode, index: number) => {
268
285
  setSelectedItems([...selectedItems.slice(0, index), ...selectedItems.slice(index + 1)]);
269
- setCreatedItems(items => items.filter(item => itemLabel(item) !== label));
286
+ setCreatedSelectedItems(items => items.filter(item => itemLabel(item) !== label));
270
287
  };
271
288
 
272
289
  /**
@@ -276,8 +293,8 @@ function MultiSelect<T>({
276
293
  const newItem = createNewItemFromQuery!!(query);
277
294
  //set new items
278
295
  setCreatedItems((items) => [...items, newItem]);
296
+ setCreatedSelectedItems((items) => [...items, newItem])
279
297
  setQuery("");
280
- itemsCopy.push(newItem);
281
298
  return newItem;
282
299
  };
283
300
 
@@ -1,40 +1,12 @@
1
1
  import React from "react";
2
2
  import { ComponentStory, ComponentMeta } from "@storybook/react";
3
3
  import { LoremIpsum } from 'react-lorem-ipsum';
4
-
5
- import Notification from "./Notification";
6
- import HtmlContentBlock from "./../Typography/HtmlContentBlock";
7
- import Button from "./../Button/Button";
8
- import Spacing from "./../Separation/Spacing";
4
+ import { Notification, HtmlContentBlock, Button, Spacing} from "../../../index";
9
5
 
10
6
  export default {
11
7
  title: "Components/Notification",
12
8
  component: Notification,
13
9
  argTypes: {
14
- className: {
15
- description: "A space-delimited list of class names.",
16
- control: "text",
17
- table: {
18
- defaultValue: { summary: undefined },
19
- type: { summary: "string" },
20
- }
21
- },
22
- onDismiss: {
23
- description: "Callback invoked when the toast is dismissed, either by the user or by the timeout.",
24
- control: "none",
25
- table: {
26
- defaultValue: { summary: undefined },
27
- type: { summary: "(didTimeoutExpire: boolean) => void" },
28
- }
29
- },
30
- timeout: {
31
- description: "Milliseconds to wait before automatically dismissing toast. Providing a value less than or equal to 0 will disable the timeout.",
32
- control: "number",
33
- table: {
34
- defaultValue: { summary: 0 },
35
- type: { summary: "number" },
36
- }
37
- },
38
10
  message: {
39
11
  control: "none",
40
12
  },
@@ -1,22 +1,29 @@
1
1
  import React, { useState } from "react";
2
- import {Pagination as CarbonPagination, PaginationProps as CarbonPaginationProps} from "carbon-components-react";
2
+ import {
3
+ Pagination as CarbonPagination,
4
+ PaginationProps as CarbonPaginationProps,
5
+ } from "carbon-components-react";
3
6
  import { CLASSPREFIX as eccgui } from "../../configuration/constants";
4
7
 
5
- interface PaginationProps extends CarbonPaginationProps {
8
+ export interface PaginationProps extends CarbonPaginationProps {
6
9
  /**
7
- Hide the select option to set how many items per page are displayed.
10
+ * Additional class names.
11
+ */
12
+ className?: string;
13
+ /**
14
+ * Hide dropdown to select how many items will be shown per page.
8
15
  */
9
16
  hidePageSizeConfiguration?: boolean;
10
17
  /**
11
- Hide info about the item numbers that are currently displayed.
18
+ * Hide info block about the section of the displayed items.
12
19
  */
13
20
  hideInfoText?: boolean;
14
21
  /**
15
- Hide select box to switch between pages.
22
+ * Hide dropdown to select page number directly.
16
23
  */
17
24
  hidePageSelect?: boolean;
18
25
  /**
19
- Hide buttons to switch beteen nex/prev pages.
26
+ * Hide prev/next arrows to navigate through the pages.
20
27
  */
21
28
  hideNavigationArrows?: boolean;
22
29
  }
@@ -0,0 +1,32 @@
1
+ import React from "react";
2
+ import { Pagination } from "../../../../index";
3
+ import { ComponentStory, ComponentMeta } from "@storybook/react";
4
+ export default {
5
+ title: "Components/Pagination",
6
+ component: Pagination,
7
+ argTypes: {
8
+ }
9
+ } as ComponentMeta<typeof Pagination>
10
+
11
+ const PaginationExample = (args) => (
12
+ <Pagination {...args}/>
13
+ );
14
+
15
+ export const Default : ComponentStory<typeof Pagination> = PaginationExample.bind({});
16
+ Default.args = {
17
+ pageSizes:[10,20,50,100],
18
+ totalItems : 60,
19
+ backwardText:"Previous page",
20
+ forwardText : "Next page",
21
+ };
22
+
23
+ export const ExtendedPagesizeSelection : ComponentStory<typeof Pagination> = PaginationExample.bind({});
24
+ ExtendedPagesizeSelection.args = {
25
+ ...Default.args,
26
+ pageSizes:[
27
+ {text: "10", value : "10"},
28
+ {text: "20", value : "25"},
29
+ {text: "50", value : "50"},
30
+ {text : 'Large page with 100 items' , value : "100"}
31
+ ],
32
+ };