@scm-manager/ui-components 2.43.1 → 2.43.2-20230419-125637

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-components",
3
- "version": "2.43.1",
3
+ "version": "2.43.2-20230419-125637",
4
4
  "description": "UI Components for SCM-Manager and its plugins",
5
5
  "main": "src/index.ts",
6
6
  "files": [
@@ -20,15 +20,15 @@
20
20
  "update-storyshots": "jest --testPathPattern=\"storyshots.test.ts\" --collectCoverage=false -u"
21
21
  },
22
22
  "devDependencies": {
23
- "@scm-manager/ui-syntaxhighlighting": "2.43.1",
24
- "@scm-manager/ui-shortcuts": "2.43.1",
25
- "@scm-manager/ui-text": "2.43.1",
23
+ "@scm-manager/ui-syntaxhighlighting": "2.43.2-20230419-125637",
24
+ "@scm-manager/ui-shortcuts": "2.43.2-20230419-125637",
25
+ "@scm-manager/ui-text": "2.43.2-20230419-125637",
26
26
  "@scm-manager/babel-preset": "^2.13.1",
27
27
  "@scm-manager/eslint-config": "^2.17.0",
28
28
  "@scm-manager/jest-preset": "^2.13.0",
29
29
  "@scm-manager/prettier-config": "^2.10.1",
30
30
  "@scm-manager/tsconfig": "^2.13.0",
31
- "@scm-manager/ui-tests": "2.43.1",
31
+ "@scm-manager/ui-tests": "2.43.2-20230419-125637",
32
32
  "@storybook/addon-actions": "^6.4.20",
33
33
  "@storybook/addon-essentials": "^6.4.20",
34
34
  "@storybook/addon-interactions": "^6.4.20",
@@ -67,9 +67,9 @@
67
67
  },
68
68
  "dependencies": {
69
69
  "@headlessui/react": "^1.4.3",
70
- "@scm-manager/ui-api": "2.43.1",
71
- "@scm-manager/ui-extensions": "2.43.1",
72
- "@scm-manager/ui-types": "2.43.1",
70
+ "@scm-manager/ui-api": "2.43.2-20230419-125637",
71
+ "@scm-manager/ui-extensions": "2.43.2-20230419-125637",
72
+ "@scm-manager/ui-types": "2.43.2-20230419-125637",
73
73
  "classnames": "^2.2.6",
74
74
  "date-fns": "^2.4.1",
75
75
  "deepmerge": "^4.2.2",
@@ -55,7 +55,7 @@ class ConfigurationBinder {
55
55
 
56
56
  route(path: string, Component: any) {
57
57
  return (
58
- <Route path={urls.escapeUrlForRoute(path)} exact>
58
+ <Route path={urls.escapeUrlForRoute(path)}>
59
59
  {Component}
60
60
  </Route>
61
61
  );
@@ -70,7 +70,7 @@ class ConfigurationBinder {
70
70
 
71
71
  // create NavigationLink with translated label
72
72
  const ConfigNavLink = withTranslation(this.i18nNamespace)(({ t }) => {
73
- return this.navLink("/admin/settings" + to, labelI18nKey, t);
73
+ return this.navLink("/admin/settings" + to, labelI18nKey, t, { activeOnlyWhenExact: false });
74
74
  });
75
75
 
76
76
  // bind navigation link to extension point
@@ -151,7 +151,7 @@ class ConfigurationBinder {
151
151
 
152
152
  // create NavigationLink with translated label
153
153
  const RepoNavLink = withTranslation(this.i18nNamespace)(({ t, url }: RepositoryNavProps) => {
154
- return this.navLink(url + "/settings" + to, labelI18nKey, t);
154
+ return this.navLink(url + "/settings" + to, labelI18nKey, t, { activeOnlyWhenExact: false });
155
155
  });
156
156
 
157
157
  // bind navigation link to extension point
@@ -21,7 +21,7 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- import React, { ChangeEvent, FC, FocusEvent, useState } from "react";
24
+ import React, { ChangeEvent, FocusEvent, useState } from "react";
25
25
  import { useTranslation } from "react-i18next";
26
26
  import classNames from "classnames";
27
27
  import { createAttributesForTesting } from "../devBuild";
@@ -39,77 +39,66 @@ type Props = {
39
39
  testId?: string;
40
40
  onChange?: (event: ChangeEvent<HTMLInputElement>) => void;
41
41
  onBlur?: (event: FocusEvent<HTMLInputElement>) => void;
42
- ref?: React.Ref<HTMLInputElement>;
43
42
  };
44
43
 
45
- const FileInput: FC<Props> = ({
46
- name,
47
- filenamePlaceholder,
48
- testId,
49
- helpText,
50
- placeholder,
51
- disabled,
52
- label,
53
- className,
54
- ref,
55
- onBlur,
56
- onChange,
57
- }) => {
58
- const [t] = useTranslation("commons");
59
- const [file, setFile] = useState<File | null>(null);
44
+ const FileInput = React.forwardRef<HTMLInputElement, Props>(
45
+ ({ name, filenamePlaceholder, testId, helpText, placeholder, disabled, label, className, onBlur, onChange }, ref) => {
46
+ const [t] = useTranslation("commons");
47
+ const [file, setFile] = useState<File | null>(null);
60
48
 
61
- const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
62
- const uploadedFile = event?.target?.files![0];
63
- // @ts-ignore the uploaded file doesn't match our types
64
- setFile(uploadedFile);
49
+ const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
50
+ const uploadedFile = event?.target?.files![0];
51
+ // @ts-ignore the uploaded file doesn't match our types
52
+ setFile(uploadedFile);
65
53
 
66
- if (onChange && event.target.files) {
67
- onChange(event);
68
- }
69
- };
54
+ if (onChange && event.target.files) {
55
+ onChange(event);
56
+ }
57
+ };
70
58
 
71
- const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
72
- if (onBlur && event.target.files) {
73
- onBlur(event);
74
- }
75
- };
59
+ const handleBlur = (event: FocusEvent<HTMLInputElement>) => {
60
+ if (onBlur && event.target.files) {
61
+ onBlur(event);
62
+ }
63
+ };
76
64
 
77
- const id = createA11yId("file-input");
65
+ const id = createA11yId("file-input");
78
66
 
79
- return (
80
- <div className={classNames("field", className)}>
81
- <LabelWithHelpIcon label={label} helpText={helpText} id={id} />
82
- <div className="file is-info has-name is-fullwidth">
83
- <label className="file-label">
84
- <input
85
- ref={ref}
86
- name={name}
87
- className="file-input"
88
- type="file"
89
- placeholder={placeholder}
90
- disabled={disabled}
91
- onChange={handleChange}
92
- onBlur={handleBlur}
93
- aria-describedby={id}
94
- {...createAttributesForTesting(testId)}
95
- />
96
- <span className="file-cta">
97
- <span className="file-icon">
98
- <i className="fas fa-arrow-circle-up" />
67
+ return (
68
+ <div className={classNames("field", className)}>
69
+ <LabelWithHelpIcon label={label} helpText={helpText} id={id} />
70
+ <div className="file is-info has-name is-fullwidth">
71
+ <label className="file-label">
72
+ <input
73
+ ref={ref}
74
+ name={name}
75
+ className="file-input"
76
+ type="file"
77
+ placeholder={placeholder}
78
+ disabled={disabled}
79
+ onChange={handleChange}
80
+ onBlur={handleBlur}
81
+ aria-describedby={id}
82
+ {...createAttributesForTesting(testId)}
83
+ />
84
+ <span className="file-cta">
85
+ <span className="file-icon">
86
+ <i className="fas fa-arrow-circle-up" />
87
+ </span>
88
+ <span className="file-label has-text-weight-bold">{t("fileInput.label")}</span>
99
89
  </span>
100
- <span className="file-label has-text-weight-bold">{t("fileInput.label")}</span>
101
- </span>
102
- {file?.name ? (
103
- <span className="file-name">{file?.name}</span>
104
- ) : (
105
- <span className="file-name has-text-weight-light has-text-secondary">
106
- {filenamePlaceholder || t("fileInput.noFileChosen")}
107
- </span>
108
- )}
109
- </label>
90
+ {file?.name ? (
91
+ <span className="file-name">{file?.name}</span>
92
+ ) : (
93
+ <span className="file-name has-text-weight-light has-text-secondary">
94
+ {filenamePlaceholder || t("fileInput.noFileChosen")}
95
+ </span>
96
+ )}
97
+ </label>
98
+ </div>
110
99
  </div>
111
- </div>
112
- );
113
- };
100
+ );
101
+ }
102
+ );
114
103
 
115
104
  export default FileInput;