@scm-manager/ui-components 2.27.3-20211113-092021 → 2.27.3

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.
@@ -77,7 +77,6 @@ const FilterInput: FC<Props> = ({ filter, value, testId, placeholder, autoFocus,
77
77
  onChange={event => setStateValue(event.target.value)}
78
78
  autoFocus={autoFocus || false}
79
79
  aria-describedby={id}
80
- aria-label={t("filterEntries")}
81
80
  {...createAttributesForTesting(testId)}
82
81
  />
83
82
  <span className="icon is-small is-left">
@@ -33,7 +33,7 @@ type BaseProps = {
33
33
  label?: string;
34
34
  name?: string;
35
35
  placeholder?: string;
36
- value?: string | number;
36
+ value?: string;
37
37
  type?: string;
38
38
  autofocus?: boolean;
39
39
  onReturnPressed?: () => void;
@@ -44,7 +44,7 @@ type BaseProps = {
44
44
  helpText?: string;
45
45
  className?: string;
46
46
  testId?: string;
47
- defaultValue?: string | number;
47
+ defaultValue?: string;
48
48
  readOnly?: boolean;
49
49
  };
50
50
 
@@ -69,7 +69,7 @@ const InnerSelect: FC<FieldProps<BaseProps, HTMLSelectElement, string>> = ({
69
69
  const field = useInnerRef(props.innerRef);
70
70
 
71
71
  let opts = options;
72
- if (value && addValueToOptions && !options.some(o => o.value === value)) {
72
+ if (value && addValueToOptions && !options.some((o) => o.value === value)) {
73
73
  opts = [{ label: value, value }, ...options];
74
74
  }
75
75
 
@@ -124,11 +124,11 @@ const InnerSelect: FC<FieldProps<BaseProps, HTMLSelectElement, string>> = ({
124
124
  onChange={handleInput}
125
125
  onBlur={handleBlur}
126
126
  disabled={disabled}
127
- aria-labelledby={label ? a11yId : undefined}
128
- aria-describedby={helpText ? helpId : undefined}
127
+ aria-labelledby={a11yId}
128
+ aria-describedby={helpId}
129
129
  {...createAttributesForTesting(testId)}
130
130
  >
131
- {opts.map(opt => {
131
+ {opts.map((opt) => {
132
132
  return (
133
133
  <option value={opt.value} key={"KEY_" + opt.value}>
134
134
  {opt.label}
package/src/index.ts CHANGED
@@ -37,7 +37,7 @@ import {
37
37
  DiffEventHandler,
38
38
  File,
39
39
  FileChangeType,
40
- Hunk
40
+ Hunk,
41
41
  } from "./repos";
42
42
 
43
43
  export { validation, repositories };
@@ -51,7 +51,6 @@ export { default as ErrorPage } from "./ErrorPage";
51
51
  export { default as Icon } from "./Icon";
52
52
  export { default as Image } from "./Image";
53
53
  export { default as Loading } from "./Loading";
54
- export { default as SmallLoadingSpinner } from "./SmallLoadingSpinner";
55
54
  export { default as Logo } from "./Logo";
56
55
  export { default as MailLink } from "./MailLink";
57
56
  export { default as Notification } from "./Notification";
@@ -114,7 +113,7 @@ export {
114
113
  AnnotationFactory,
115
114
  AnnotationFactoryContext,
116
115
  DiffEventHandler,
117
- DiffEventContext
116
+ DiffEventContext,
118
117
  };
119
118
 
120
119
  // Re-export from ui-api
@@ -131,7 +130,7 @@ export {
131
130
  MissingLinkError,
132
131
  createBackendError,
133
132
  isBackendError,
134
- TOKEN_EXPIRED_ERROR_CODE
133
+ TOKEN_EXPIRED_ERROR_CODE,
135
134
  } from "@scm-manager/ui-api";
136
135
 
137
136
  export { urls };
@@ -97,7 +97,7 @@ const Footer: FC<Props> = ({ me, version, links }) => {
97
97
  <div className="columns is-size-7">
98
98
  {me ? (
99
99
  <FooterSection title={meSectionTile}>
100
- <NavLink to="/me/settings/theme" label={t("footer.user.profile")} testId="footer-user-profile" />
100
+ <NavLink to="/me" label={t("footer.user.profile")} testId="footer-user-profile" />
101
101
  {me?._links?.password && (
102
102
  <NavLink to="/me/settings/password" label={t("profile.changePasswordNavLink")} />
103
103
  )}
@@ -37,7 +37,7 @@ const SmallHeader: FC<{ children: ReactNode }> = ({ children }) => {
37
37
 
38
38
  const LargeHeader: FC = () => {
39
39
  return (
40
- <div className="hero has-scm-background is-small">
40
+ <section className="hero has-scm-background is-small">
41
41
  <div className="hero-body">
42
42
  <div className="container">
43
43
  <div className="columns is-vcentered">
@@ -47,7 +47,7 @@ const LargeHeader: FC = () => {
47
47
  </div>
48
48
  </div>
49
49
  </div>
50
- </div>
50
+ </section>
51
51
  );
52
52
  };
53
53
 
@@ -29,9 +29,8 @@ export { default as Header } from "./Header";
29
29
  export { default as Level } from "./Level";
30
30
  export { default as Page } from "./Page";
31
31
  export { default as PageActions } from "./PageActions";
32
- export { default as Title } from "./Title";
33
32
  export { default as Subtitle } from "./Subtitle";
34
- export { default as SubSubtitle } from "./SubSubtitle";
33
+ export { default as Title } from "./Title";
35
34
  export { default as CustomQueryFlexWrappedColumns } from "./CustomQueryFlexWrappedColumns";
36
35
  export { default as PrimaryContentColumn } from "./PrimaryContentColumn";
37
36
  export { default as SecondaryNavigationColumn } from "./SecondaryNavigationColumn";
@@ -90,7 +90,7 @@ export const Modal: FC<Props> = ({
90
90
  <div className="modal-background" onClick={closeFunction} />
91
91
  <SizedModal className="modal-card" size={size}>
92
92
  <header className={classNames("modal-card-head", `has-background-${headColor}`)}>
93
- <h2 className={`modal-card-title m-0 has-text-${headTextColor}`}>{title}</h2>
93
+ <p className={`modal-card-title m-0 has-text-${headTextColor}`}>{title}</p>
94
94
  <button className="delete" aria-label="close" onClick={closeFunction} ref={initialFocusRef} autoFocus />
95
95
  </header>
96
96
  <section className="modal-card-body">{body}</section>
@@ -22,10 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
- import { RouteProps } from "react-router-dom";
26
-
27
25
  export type RoutingProps = {
28
26
  to: string;
29
27
  activeOnlyWhenExact?: boolean;
30
- activeWhenMatch?: (route: RouteProps) => boolean;
28
+ activeWhenMatch?: (route: any) => boolean;
31
29
  };
@@ -53,8 +53,8 @@ const withRoute = (route: string) => {
53
53
  };
54
54
 
55
55
  storiesOf("Secondary Navigation", module)
56
- .addDecorator(story => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
57
- .addDecorator(story => (
56
+ .addDecorator((story) => <StateMenuContextProvider>{story()}</StateMenuContextProvider>)
57
+ .addDecorator((story) => (
58
58
  <Columns className="columns">
59
59
  <div className="column is-3">{story()}</div>
60
60
  </Columns>
@@ -92,7 +92,7 @@ storiesOf("Secondary Navigation", module)
92
92
  <SecondaryNavigation label="Hitchhiker">
93
93
  <SecondaryNavigationItem to="/42" icon="fas fa-puzzle-piece" label="Puzzle 42" title="Puzzle 42" />
94
94
  <SecondaryNavigationItem
95
- activeWhenMatch={route => route.location?.pathname === "/hog"}
95
+ activeWhenMatch={(route) => route.location.pathname === "/hog"}
96
96
  to="/heart-of-gold"
97
97
  icon="fas fa-star"
98
98
  label="Heart Of Gold"
@@ -91,7 +91,7 @@ const SecondaryNavigation: FC<Props> = ({ label, children, collapsible = true })
91
91
  aria-label={menuAriaLabel}
92
92
  >
93
93
  {collapsible ? (
94
- <Icon className="is-medium" collapsed={isCollapsed}>
94
+ <Icon color="info" className="is-medium" collapsed={isCollapsed}>
95
95
  {arrowIcon}
96
96
  </Icon>
97
97
  ) : null}
@@ -81,7 +81,7 @@ const MarginlessModalContent = styled.div`
81
81
  class DiffFile extends React.Component<Props, State> {
82
82
  static defaultProps: Partial<Props> = {
83
83
  defaultCollapse: false,
84
- markConflicts: true
84
+ markConflicts: true,
85
85
  };
86
86
 
87
87
  constructor(props: Props) {
@@ -90,14 +90,14 @@ class DiffFile extends React.Component<Props, State> {
90
90
  collapsed: this.defaultCollapse(),
91
91
  sideBySide: props.sideBySide,
92
92
  diffExpander: new DiffExpander(props.file),
93
- file: props.file
93
+ file: props.file,
94
94
  };
95
95
  }
96
96
 
97
97
  componentDidUpdate(prevProps: Readonly<Props>) {
98
98
  if (!this.props.isCollapsed && this.props.defaultCollapse !== prevProps.defaultCollapse) {
99
99
  this.setState({
100
- collapsed: this.defaultCollapse()
100
+ collapsed: this.defaultCollapse(),
101
101
  });
102
102
  }
103
103
  }
@@ -120,8 +120,8 @@ class DiffFile extends React.Component<Props, State> {
120
120
  if (onCollapseStateChange) {
121
121
  onCollapseStateChange(file);
122
122
  } else {
123
- this.setState(state => ({
124
- collapsed: !state.collapsed
123
+ this.setState((state) => ({
124
+ collapsed: !state.collapsed,
125
125
  }));
126
126
  }
127
127
  }
@@ -129,8 +129,8 @@ class DiffFile extends React.Component<Props, State> {
129
129
 
130
130
  toggleSideBySide = (callback: () => void) => {
131
131
  this.setState(
132
- state => ({
133
- sideBySide: !state.sideBySide
132
+ (state) => ({
133
+ sideBySide: !state.sideBySide,
134
134
  }),
135
135
  () => callback()
136
136
  );
@@ -142,7 +142,7 @@ class DiffFile extends React.Component<Props, State> {
142
142
  onCollapseStateChange(this.state.file, collapsed);
143
143
  } else {
144
144
  this.setState({
145
- collapsed
145
+ collapsed,
146
146
  });
147
147
  }
148
148
  };
@@ -236,19 +236,13 @@ class DiffFile extends React.Component<Props, State> {
236
236
 
237
237
  expandHead = (expandableHunk: ExpandableHunk, count: number) => {
238
238
  return () => {
239
- return expandableHunk
240
- .expandHead(count)
241
- .then(this.diffExpanded)
242
- .catch(this.diffExpansionFailed);
239
+ return expandableHunk.expandHead(count).then(this.diffExpanded).catch(this.diffExpansionFailed);
243
240
  };
244
241
  };
245
242
 
246
243
  expandBottom = (expandableHunk: ExpandableHunk, count: number) => {
247
244
  return () => {
248
- return expandableHunk
249
- .expandBottom(count)
250
- .then(this.diffExpanded)
251
- .catch(this.diffExpansionFailed);
245
+ return expandableHunk.expandBottom(count).then(this.diffExpanded).catch(this.diffExpansionFailed);
252
246
  };
253
247
  };
254
248
 
@@ -266,7 +260,7 @@ class DiffFile extends React.Component<Props, State> {
266
260
  if (annotationFactory) {
267
261
  return annotationFactory({
268
262
  hunk,
269
- file
263
+ file,
270
264
  });
271
265
  } else {
272
266
  return EMPTY_ANNOTATION_FACTORY;
@@ -280,7 +274,7 @@ class DiffFile extends React.Component<Props, State> {
280
274
  changeId: getChangeKey(change),
281
275
  change,
282
276
  hunk,
283
- file
277
+ file,
284
278
  };
285
279
  if (onClick) {
286
280
  onClick(context);
@@ -293,7 +287,7 @@ class DiffFile extends React.Component<Props, State> {
293
287
  return {
294
288
  onClick: (event: ChangeEvent) => {
295
289
  this.handleClickEvent(event.change, hunk);
296
- }
290
+ },
297
291
  };
298
292
  }
299
293
  };
@@ -502,9 +496,9 @@ class DiffFile extends React.Component<Props, State> {
502
496
  title={this.hoverFileTitle(file)}
503
497
  >
504
498
  {collapseIcon}
505
- <h4 className={classNames("has-text-weight-bold", "is-ellipsis-overflow", "is-size-6", "ml-1")}>
499
+ <span className={classNames("is-ellipsis-overflow", "is-size-6", "ml-1")}>
506
500
  {this.renderFileTitle(file)}
507
- </h4>
501
+ </span>
508
502
  {this.renderChangeTag(file)}
509
503
  </FullWidthTitleHeader>
510
504
  {headerButtons}
@@ -86,13 +86,13 @@ const RepositoryFlags: FC<Props> = ({ repository, className, tooltipLocation = "
86
86
  );
87
87
 
88
88
  return (
89
- <div className={classNames("is-flex", "is-align-items-center", className)}>
89
+ <span className={classNames("is-flex", "is-align-items-center", className)}>
90
90
  {modal}
91
91
  <RepositoryFlagContainer>
92
92
  {repositoryFlags}
93
93
  <ExtensionPoint name="repository.flags" props={{ repository, tooltipLocation }} renderAll={true} />
94
94
  </RepositoryFlagContainer>
95
- </div>
95
+ </span>
96
96
  );
97
97
  };
98
98
 
@@ -30,7 +30,6 @@ import {
30
30
  AnnotationFactoryContext,
31
31
  DiffEventHandler,
32
32
  DiffEventContext,
33
- DiffObjectProps
34
33
  } from "./DiffTypes";
35
34
 
36
35
  import { FileDiff as File, FileChangeType, Hunk, Change, ChangeType } from "@scm-manager/ui-types";
@@ -65,5 +64,4 @@ export {
65
64
  AnnotationFactoryContext,
66
65
  DiffEventHandler,
67
66
  DiffEventContext,
68
- DiffObjectProps
69
67
  };
@@ -24,9 +24,6 @@
24
24
 
25
25
  import React, { FC } from "react";
26
26
 
27
- const PRE_TAG = "<|[[--";
28
- const POST_TAG = "--]]|>";
29
-
30
27
  type Props = {
31
28
  value: string;
32
29
  };
@@ -36,14 +33,14 @@ const HighlightedFragment: FC<Props> = ({ value }) => {
36
33
 
37
34
  const result = [];
38
35
  while (content.length > 0) {
39
- const start = content.indexOf(PRE_TAG);
40
- const end = content.indexOf(POST_TAG);
36
+ const start = content.indexOf("<>");
37
+ const end = content.indexOf("</>");
41
38
  if (start >= 0 && end > 0) {
42
39
  if (start > 0) {
43
40
  result.push(content.substring(0, start));
44
41
  }
45
- result.push(<strong>{content.substring(start + PRE_TAG.length, end)}</strong>);
46
- content = content.substring(end + POST_TAG.length);
42
+ result.push(<strong>{content.substring(start + 2, end)}</strong>);
43
+ content = content.substring(end + 3);
47
44
  } else {
48
45
  result.push(content);
49
46
  break;
@@ -1,4 +1,4 @@
1
- /*
1
+ /**
2
2
  * MIT License
3
3
  *
4
4
  * Copyright (c) 2020-present Cloudogu GmbH and Contributors
@@ -1,32 +0,0 @@
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 { storiesOf } from "@storybook/react";
25
- import React from "react";
26
- import SmallLoadingSpinner from "./SmallLoadingSpinner";
27
-
28
- storiesOf("SmallLoading", module).add("Default", () => (
29
- <div>
30
- <SmallLoadingSpinner />
31
- </div>
32
- ));
@@ -1,34 +0,0 @@
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, { FC } from "react";
25
-
26
- const SmallLoadingSpinner: FC = () => {
27
- return (
28
- <div className="loader-wrapper">
29
- <div className="loader is-loading" />
30
- </div>
31
- );
32
- };
33
-
34
- export default SmallLoadingSpinner;
@@ -1,41 +0,0 @@
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 from "react";
25
- import classNames from "classnames";
26
-
27
- type Props = {
28
- className?: string;
29
- };
30
-
31
- class SubSubtitle extends React.Component<Props> {
32
- render() {
33
- const { className, children } = this.props;
34
- if (children) {
35
- return <h3 className={classNames("is-size-5", className)}>{children}</h3>;
36
- }
37
- return null;
38
- }
39
- }
40
-
41
- export default SubSubtitle;