@scm-manager/ui-core 3.0.0-20240024-101702

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 (128) hide show
  1. package/.storybook/.babelrc +3 -0
  2. package/.storybook/RemoveThemesPlugin.js +57 -0
  3. package/.storybook/main.js +92 -0
  4. package/.storybook/preview-head.html +25 -0
  5. package/.storybook/preview.js +95 -0
  6. package/.storybook/withApiProvider.js +46 -0
  7. package/docs/introduction.stories.mdx +64 -0
  8. package/docs/usage.stories.mdx +22 -0
  9. package/package.json +81 -0
  10. package/src/base/buttons/Button.stories.tsx +89 -0
  11. package/src/base/buttons/Button.test.stories.mdx +74 -0
  12. package/src/base/buttons/Button.tsx +143 -0
  13. package/src/base/buttons/Icon.tsx +58 -0
  14. package/src/base/buttons/a11y.test.ts +34 -0
  15. package/src/base/buttons/docs/introduction.stories.mdx +64 -0
  16. package/src/base/buttons/docs/usage.stories.mdx +22 -0
  17. package/src/base/buttons/image-snapshot.test.ts +33 -0
  18. package/src/base/buttons/index.ts +26 -0
  19. package/src/base/forms/AddListEntryForm.tsx +127 -0
  20. package/src/base/forms/ConfigurationForm.tsx +59 -0
  21. package/src/base/forms/Form.stories.tsx +453 -0
  22. package/src/base/forms/Form.tsx +215 -0
  23. package/src/base/forms/FormPathContext.tsx +73 -0
  24. package/src/base/forms/FormRow.tsx +37 -0
  25. package/src/base/forms/ScmFormContext.tsx +43 -0
  26. package/src/base/forms/ScmFormListContext.tsx +65 -0
  27. package/src/base/forms/base/Control.tsx +34 -0
  28. package/src/base/forms/base/Field.tsx +35 -0
  29. package/src/base/forms/base/field-message/FieldMessage.tsx +34 -0
  30. package/src/base/forms/base/help/Help.tsx +34 -0
  31. package/src/base/forms/base/label/Label.tsx +35 -0
  32. package/src/base/forms/checkbox/Checkbox.stories.mdx +26 -0
  33. package/src/base/forms/checkbox/Checkbox.tsx +118 -0
  34. package/src/base/forms/checkbox/CheckboxField.tsx +39 -0
  35. package/src/base/forms/checkbox/ControlledCheckboxField.stories.mdx +36 -0
  36. package/src/base/forms/checkbox/ControlledCheckboxField.tsx +82 -0
  37. package/src/base/forms/chip-input/ChipInputField.stories.tsx +75 -0
  38. package/src/base/forms/chip-input/ChipInputField.tsx +169 -0
  39. package/src/base/forms/chip-input/ControlledChipInputField.tsx +111 -0
  40. package/src/base/forms/combobox/Combobox.stories.tsx +125 -0
  41. package/src/base/forms/combobox/Combobox.tsx +223 -0
  42. package/src/base/forms/combobox/ComboboxField.tsx +62 -0
  43. package/src/base/forms/combobox/ControlledComboboxField.tsx +96 -0
  44. package/src/base/forms/headless-chip-input/ChipInput.tsx +237 -0
  45. package/src/base/forms/helpers.ts +74 -0
  46. package/src/base/forms/index.ts +85 -0
  47. package/src/base/forms/input/ControlledInputField.stories.mdx +36 -0
  48. package/src/base/forms/input/ControlledInputField.tsx +87 -0
  49. package/src/base/forms/input/ControlledSecretConfirmationField.stories.mdx +39 -0
  50. package/src/base/forms/input/ControlledSecretConfirmationField.tsx +138 -0
  51. package/src/base/forms/input/Input.stories.mdx +22 -0
  52. package/src/base/forms/input/Input.tsx +46 -0
  53. package/src/base/forms/input/InputField.stories.mdx +22 -0
  54. package/src/base/forms/input/InputField.tsx +61 -0
  55. package/src/base/forms/input/Textarea.stories.mdx +28 -0
  56. package/src/base/forms/input/Textarea.tsx +46 -0
  57. package/src/base/forms/list/ControlledList.tsx +88 -0
  58. package/src/base/forms/radio-button/ControlledRadioGroupField.tsx +94 -0
  59. package/src/base/forms/radio-button/RadioButton.stories.tsx +226 -0
  60. package/src/base/forms/radio-button/RadioButton.tsx +116 -0
  61. package/src/base/forms/radio-button/RadioButtonContext.tsx +42 -0
  62. package/src/base/forms/radio-button/RadioGroup.tsx +49 -0
  63. package/src/base/forms/radio-button/RadioGroupField.tsx +58 -0
  64. package/src/base/forms/resourceHooks.ts +164 -0
  65. package/src/base/forms/select/ControlledSelectField.tsx +87 -0
  66. package/src/base/forms/select/Select.tsx +57 -0
  67. package/src/base/forms/select/SelectField.tsx +63 -0
  68. package/src/base/forms/table/ControlledColumn.tsx +49 -0
  69. package/src/base/forms/table/ControlledTable.tsx +99 -0
  70. package/src/base/forms/variants.ts +27 -0
  71. package/src/base/helpers/devbuild.ts +44 -0
  72. package/src/base/helpers/index.ts +26 -0
  73. package/src/base/helpers/useAriaId.tsx +31 -0
  74. package/src/base/index.ts +34 -0
  75. package/src/base/layout/_helpers/with-classes.tsx +52 -0
  76. package/src/base/layout/card/Card.stories.tsx +113 -0
  77. package/src/base/layout/card/Card.tsx +76 -0
  78. package/src/base/layout/card/CardDetail.tsx +196 -0
  79. package/src/base/layout/card/CardRow.tsx +46 -0
  80. package/src/base/layout/card/CardTitle.tsx +59 -0
  81. package/src/base/layout/card-list/CardList.stories.tsx +201 -0
  82. package/src/base/layout/card-list/CardList.tsx +76 -0
  83. package/src/base/layout/collapsible/Collapsible.stories.tsx +45 -0
  84. package/src/base/layout/collapsible/Collapsible.tsx +87 -0
  85. package/src/base/layout/index.ts +93 -0
  86. package/src/base/layout/tabs/TabTrigger.tsx +46 -0
  87. package/src/base/layout/tabs/Tabs.stories.tsx +48 -0
  88. package/src/base/layout/tabs/Tabs.tsx +52 -0
  89. package/src/base/layout/tabs/TabsContent.tsx +33 -0
  90. package/src/base/layout/tabs/TabsList.tsx +41 -0
  91. package/src/base/layout/templates/data-page/DataPage.stories.tsx +201 -0
  92. package/src/base/layout/templates/data-page/DataPageHeader.tsx +100 -0
  93. package/src/base/misc/Image.tsx +32 -0
  94. package/src/base/misc/Level.tsx +40 -0
  95. package/src/base/misc/Loading.tsx +64 -0
  96. package/src/base/misc/SubSubtitle.tsx +36 -0
  97. package/src/base/misc/Subtitle.tsx +37 -0
  98. package/src/base/misc/Title.tsx +56 -0
  99. package/src/base/misc/index.ts +30 -0
  100. package/src/base/notifications/BackendErrorNotification.tsx +160 -0
  101. package/src/base/notifications/ErrorNotification.tsx +73 -0
  102. package/src/base/notifications/Notification.tsx +48 -0
  103. package/src/base/notifications/index.tsx +27 -0
  104. package/src/base/overlays/dialog/Dialog.stories.tsx +64 -0
  105. package/src/base/overlays/dialog/Dialog.tsx +85 -0
  106. package/src/base/overlays/index.ts +44 -0
  107. package/src/base/overlays/menu/Menu.stories.tsx +78 -0
  108. package/src/base/overlays/menu/Menu.tsx +213 -0
  109. package/src/base/overlays/menu/MenuTrigger.tsx +63 -0
  110. package/src/base/overlays/popover/Popover.stories.tsx +69 -0
  111. package/src/base/overlays/popover/Popover.tsx +95 -0
  112. package/src/base/overlays/tooltip/Tooltip.examples.js +41 -0
  113. package/src/base/overlays/tooltip/Tooltip.stories.mdx +52 -0
  114. package/src/base/overlays/tooltip/Tooltip.tsx +96 -0
  115. package/src/base/shortcuts/index.ts +28 -0
  116. package/src/base/shortcuts/iterator/callbackIterator.ts +220 -0
  117. package/src/base/shortcuts/iterator/keyboardIterator.test.tsx +431 -0
  118. package/src/base/shortcuts/iterator/keyboardIterator.tsx +141 -0
  119. package/src/base/shortcuts/usePauseShortcuts.ts +44 -0
  120. package/src/base/shortcuts/useShortcut.ts +110 -0
  121. package/src/base/shortcuts/useShortcutDocs.tsx +54 -0
  122. package/src/base/text/SplitAndReplace.stories.tsx +83 -0
  123. package/src/base/text/SplitAndReplace.tsx +65 -0
  124. package/src/base/text/index.ts +25 -0
  125. package/src/base/text/textSplitAndReplace.test.ts +134 -0
  126. package/src/base/text/textSplitAndReplace.ts +86 -0
  127. package/src/index.ts +25 -0
  128. package/tsconfig.json +6 -0
@@ -0,0 +1,41 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React, { HTMLAttributes } from "react";
26
+ import * as RadixTabs from "@radix-ui/react-tabs";
27
+ import classNames from "classnames";
28
+
29
+ /**
30
+ * @beta
31
+ * @since 2.47.0
32
+ */
33
+ const TabsList = React.forwardRef<HTMLUListElement, HTMLAttributes<HTMLUListElement>>(({ children, ...props }, ref) => (
34
+ <RadixTabs.List className={classNames("tabs", /* required for focus-outline */ "p-1")}>
35
+ <ul {...props} ref={ref}>
36
+ {children}
37
+ </ul>
38
+ </RadixTabs.List>
39
+ ));
40
+
41
+ export default TabsList;
@@ -0,0 +1,201 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import React from "react";
26
+ import {
27
+ DataPageHeader,
28
+ DataPageHeaderCreateButton,
29
+ DataPageHeaderSetting,
30
+ DataPageHeaderSettingField,
31
+ DataPageHeaderSettingLabel,
32
+ DataPageHeaderSettings,
33
+ } from "./DataPageHeader";
34
+ import { Select } from "../../../forms";
35
+ import { ComponentMeta, ComponentStory } from "@storybook/react";
36
+ import { Loading, Subtitle, Title } from "../../../misc";
37
+ import { ErrorNotification, Notification } from "../../../notifications"
38
+ import { Button, Icon } from "../../../buttons";
39
+ import { CardListBox, CardListCard } from "../../card-list/CardList";
40
+ import CardRow, { SecondaryRow, TertiaryRow } from "../../card/CardRow";
41
+ import CardTitle from "../../card/CardTitle";
42
+ import { Link } from "react-router-dom";
43
+ import StoryRouter from "storybook-react-router";
44
+ import { CardDetail, CardDetailLabel, CardDetails, CardDetailTag } from "../../card/CardDetail";
45
+
46
+ export default {
47
+ title: "Data Page Template",
48
+ component: DataPageHeader,
49
+ decorators: [StoryRouter()],
50
+ } as ComponentMeta<typeof DataPageHeader>;
51
+
52
+ // @ts-ignore Storybook is not cooperating
53
+ export const Example: ComponentStory<{ error: Error; isLoading: boolean; isEmpty: boolean }> = ({
54
+ error,
55
+ isLoading,
56
+ isEmpty,
57
+ }: any) => {
58
+ let content;
59
+ if (error) {
60
+ content = <ErrorNotification error={error} />;
61
+ } else if (isLoading) {
62
+ content = <Loading />;
63
+ } else if (isEmpty) {
64
+ content = <Notification type="info">There is no data, consider adjusting the filters</Notification>;
65
+ } else {
66
+ content = (
67
+ <CardListBox>
68
+ <CardListCard avatar={<Icon>trash</Icon>} action={<Icon>ellipsis-v</Icon>}>
69
+ <CardRow>
70
+ <CardTitle>
71
+ <Link to="/item">
72
+ The title may contain a link but most importantly does not contain any information except the "display
73
+ name" of the entity. It is also text-only
74
+ </Link>
75
+ </CardTitle>
76
+ </CardRow>
77
+ <SecondaryRow>
78
+ This contains more important details about the card, but not quite as important as the title.
79
+ </SecondaryRow>
80
+ <TertiaryRow>This contains less important information about the card</TertiaryRow>
81
+ <CardRow>
82
+ <CardDetails>
83
+ <CardDetail>
84
+ <CardDetailLabel>Tags are great for numbers.</CardDetailLabel>
85
+ <CardDetailTag>7/3</CardDetailTag>
86
+ </CardDetail>
87
+ <CardDetail>
88
+ {({ labelId }) => (
89
+ <>
90
+ <CardDetailLabel id={labelId}>
91
+ Interactive details need 'is-relative' and 'aria-labelledby'
92
+ </CardDetailLabel>
93
+ <Button aria-labelledby={labelId} className="is-relative has-background-transparent is-borderless">
94
+ <Icon>edit</Icon>
95
+ </Button>
96
+ </>
97
+ )}
98
+ </CardDetail>
99
+ </CardDetails>
100
+ </CardRow>
101
+ </CardListCard>
102
+ <CardListCard avatar={<Icon>users</Icon>} action={<Icon>ellipsis-v</Icon>}>
103
+ <CardRow>
104
+ <CardTitle>
105
+ <Link to="/item">
106
+ We can also enter insane text without whitespace
107
+ ssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss
108
+ </Link>
109
+ </CardTitle>
110
+ </CardRow>
111
+ <SecondaryRow>
112
+ SCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCM
113
+ </SecondaryRow>
114
+ <TertiaryRow>
115
+ SCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCM
116
+ </TertiaryRow>
117
+ <CardRow>
118
+ <CardDetails>
119
+ <CardDetail>
120
+ <CardDetailLabel>SCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCM</CardDetailLabel>
121
+ <CardDetailTag>7/3</CardDetailTag>
122
+ </CardDetail>
123
+ <CardDetail>
124
+ {({ labelId }) => (
125
+ <>
126
+ <CardDetailLabel id={labelId}>SCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCMSCM</CardDetailLabel>
127
+ <Button aria-labelledby={labelId} className="is-relative has-background-transparent is-borderless">
128
+ <Icon>trash</Icon>
129
+ </Button>
130
+ </>
131
+ )}
132
+ </CardDetail>
133
+ </CardDetails>
134
+ </CardRow>
135
+ </CardListCard>
136
+ </CardListBox>
137
+ );
138
+ }
139
+
140
+ return (
141
+ <>
142
+ <Title>My Page</Title>
143
+ <Subtitle subtitle="All the data" />
144
+ <DataPageHeader>
145
+ <DataPageHeaderSettings>
146
+ <DataPageHeaderSetting>
147
+ {({ formFieldId }) => (
148
+ <>
149
+ <DataPageHeaderSettingLabel htmlFor={formFieldId}>Filter by</DataPageHeaderSettingLabel>
150
+ <DataPageHeaderSettingField>
151
+ <Select
152
+ id={formFieldId}
153
+ options={[
154
+ {
155
+ label: "Yes",
156
+ value: 1,
157
+ },
158
+ {
159
+ label: "No",
160
+ value: 0,
161
+ },
162
+ ]}
163
+ />
164
+ </DataPageHeaderSettingField>
165
+ </>
166
+ )}
167
+ </DataPageHeaderSetting>
168
+ <DataPageHeaderSetting>
169
+ {({ formFieldId }) => (
170
+ <>
171
+ <DataPageHeaderSettingLabel htmlFor={formFieldId}>Sort by</DataPageHeaderSettingLabel>
172
+ <DataPageHeaderSettingField>
173
+ <Select
174
+ id={formFieldId}
175
+ options={[
176
+ {
177
+ label: "Blue",
178
+ value: 1,
179
+ },
180
+ {
181
+ label: "Red",
182
+ value: 0,
183
+ },
184
+ ]}
185
+ />
186
+ </DataPageHeaderSettingField>
187
+ </>
188
+ )}
189
+ </DataPageHeaderSetting>
190
+ </DataPageHeaderSettings>
191
+ <DataPageHeaderCreateButton to="/mydata/create">Create New Data</DataPageHeaderCreateButton>
192
+ </DataPageHeader>
193
+ {content}
194
+ </>
195
+ );
196
+ };
197
+ Example.args = {
198
+ error: undefined,
199
+ isLoading: false,
200
+ isEmpty: false,
201
+ };
@@ -0,0 +1,100 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ import withClasses from "../../_helpers/with-classes";
26
+ import React, { HTMLAttributes } from "react";
27
+ import classNames from "classnames";
28
+ import { useAriaId } from "../../../helpers";
29
+ import { LinkButton } from "../../../buttons";
30
+
31
+ /**
32
+ * @beta
33
+ * @since 2.47.0
34
+ */
35
+ export const DataPageHeader = withClasses("div", [
36
+ "is-flex",
37
+ "is-flex-wrap-wrap",
38
+ "is-justify-content-space-between",
39
+ "mb-3",
40
+ "has-row-gap-2",
41
+ "has-column-gap-4",
42
+ ]);
43
+
44
+ /**
45
+ * @beta
46
+ * @since 2.47.0
47
+ */
48
+ export const DataPageHeaderSettings = withClasses("div", [
49
+ "is-flex",
50
+ "is-flex-wrap-wrap",
51
+ "is-align-items-center",
52
+ "has-row-gap-2",
53
+ "has-column-gap-4",
54
+ "is-flex-grow-1",
55
+ "is-flex-shrink-1",
56
+ "is-flex-basis-0",
57
+ ]);
58
+
59
+ type DataPageHeaderSettingProps = HTMLAttributes<HTMLDivElement> & {
60
+ children?: React.ReactNode | ((props: { formFieldId: string }) => React.ReactNode);
61
+ };
62
+
63
+ /**
64
+ * @beta
65
+ * @since 2.47.0
66
+ */
67
+ export const DataPageHeaderSetting = React.forwardRef<HTMLSpanElement, DataPageHeaderSettingProps>(
68
+ ({ className, children, ...props }, ref) => {
69
+ const formFieldId = useAriaId();
70
+ return (
71
+ <span {...props} className={classNames(className, "is-flex", "is-align-items-center", "has-gap-2")} ref={ref}>
72
+ {typeof children === "function" ? children({ formFieldId }) : children}
73
+ </span>
74
+ );
75
+ }
76
+ );
77
+
78
+ /**
79
+ * @beta
80
+ * @since 2.47.0
81
+ */
82
+ export const DataPageHeaderSettingLabel = withClasses("label", [
83
+ "is-flex",
84
+ "is-align-items-center",
85
+ "is-text-wrap-no-wrap",
86
+ ]);
87
+
88
+ /**
89
+ * @beta
90
+ * @since 2.47.0
91
+ */
92
+ export const DataPageHeaderSettingField = React.Fragment;
93
+
94
+ /**
95
+ * @beta
96
+ * @since 2.47.0
97
+ */
98
+ export const DataPageHeaderCreateButton = withClasses(LinkButton, ["is-flex-grow-0", "is-flex-shrink-0"], {
99
+ variant: "primary",
100
+ });
@@ -0,0 +1,32 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { ImgHTMLAttributes } from "react";
25
+ import { urls } from "@scm-manager/ui-api";
26
+
27
+ const Image = React.forwardRef<HTMLImageElement, ImgHTMLAttributes<HTMLImageElement> & { src: string }>(
28
+ ({ src, alt, ...props }, ref) => (
29
+ <img src={src?.startsWith("http") ? src : urls.withContextPath(src)} {...props} ref={ref} alt={alt} />
30
+ )
31
+ );
32
+ export default Image;
@@ -0,0 +1,40 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { HTMLAttributes, ReactNode } from "react";
25
+ import classNames from "classnames";
26
+
27
+ type Props = HTMLAttributes<HTMLDivElement> & {
28
+ left?: ReactNode;
29
+ right?: ReactNode;
30
+ };
31
+
32
+ const Level = React.forwardRef<HTMLDivElement, Props>(({ right, left, children, className, ...props }, ref) => (
33
+ <div className={classNames("level", className)} {...props} ref={ref}>
34
+ <div className="level-left">{left}</div>
35
+ {children ? <div className="level-item">{children}</div> : null}
36
+ <div className="level-right">{right}</div>
37
+ </div>
38
+ ));
39
+
40
+ export default Level;
@@ -0,0 +1,64 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { HTMLAttributes } from "react";
25
+ import { useTranslation } from "react-i18next";
26
+ import classNames from "classnames";
27
+ import styled from "styled-components";
28
+ import Image from "./Image";
29
+
30
+ const Wrapper = styled.div`
31
+ min-height: 256px;
32
+ `;
33
+
34
+ const FixedSizedImage = styled(Image)`
35
+ width: 128px;
36
+ height: 128px;
37
+ `;
38
+
39
+ const Loading = React.forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement> & { message?: string }>(
40
+ ({ message, children, className, ...props }, ref) => {
41
+ const [t] = useTranslation("commons");
42
+ return (
43
+ <Wrapper
44
+ className={classNames(
45
+ "is-flex",
46
+ "is-flex-direction-column",
47
+ "is-justify-content-center",
48
+ "is-align-items-center",
49
+ className
50
+ )}
51
+ {...props}
52
+ ref={ref}
53
+ >
54
+ <FixedSizedImage className="mb-3" src="/images/loading.svg" alt={t("loading.alt")} />
55
+ <p className="has-text-centered">
56
+ {message}
57
+ {children}
58
+ </p>
59
+ </Wrapper>
60
+ );
61
+ }
62
+ );
63
+
64
+ export default Loading;
@@ -0,0 +1,36 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { HTMLAttributes } from "react";
25
+ import classNames from "classnames";
26
+
27
+ const SubSubtitle = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement>>(
28
+ ({ className, children, ...props }, ref) =>
29
+ children ? (
30
+ <h3 className={classNames("is-size-5", className)} ref={ref} {...props}>
31
+ {children}
32
+ </h3>
33
+ ) : null
34
+ );
35
+
36
+ export default SubSubtitle;
@@ -0,0 +1,37 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { HTMLAttributes } from "react";
25
+ import classNames from "classnames";
26
+
27
+ const Subtitle = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & { subtitle?: string }>(
28
+ ({ subtitle, className, children, ...props }, ref) =>
29
+ !(subtitle || children) ? null : (
30
+ <h2 className={classNames("subtitle", className)} {...props} ref={ref}>
31
+ {subtitle}
32
+ {children}
33
+ </h2>
34
+ )
35
+ );
36
+
37
+ export default Subtitle;
@@ -0,0 +1,56 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import React, { HTMLAttributes, useEffect } from "react";
25
+ import classNames from "classnames";
26
+
27
+ type Props = {
28
+ title?: string;
29
+ customPageTitle?: string;
30
+ preventRefreshingPageTitle?: boolean;
31
+ };
32
+ const Title = React.forwardRef<HTMLHeadingElement, HTMLAttributes<HTMLHeadingElement> & Props>(
33
+ ({ title, customPageTitle, preventRefreshingPageTitle, children, className, ...props }, ref) => {
34
+ useEffect(() => {
35
+ if (!preventRefreshingPageTitle) {
36
+ if (customPageTitle) {
37
+ document.title = customPageTitle;
38
+ } else if (title) {
39
+ document.title = title;
40
+ }
41
+ }
42
+ }, [title, preventRefreshingPageTitle, customPageTitle]);
43
+
44
+ if (children || title) {
45
+ return (
46
+ <h1 className={classNames("title", className)} {...props} ref={ref}>
47
+ {title}
48
+ {children}
49
+ </h1>
50
+ );
51
+ }
52
+ return null;
53
+ }
54
+ );
55
+
56
+ export default Title;
@@ -0,0 +1,30 @@
1
+ /*
2
+ * MIT License
3
+ *
4
+ * Copyright (c) 2020-present Cloudogu GmbH and Contributors
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ export { default as Image } from "./Image";
26
+ export { default as Loading } from "./Loading";
27
+ export { default as Subtitle } from "./Subtitle";
28
+ export { default as Title } from "./Title";
29
+ export { default as SubSubtitle } from "./SubSubtitle";
30
+ export { default as Level } from "./Level";