@scm-manager/ui-core 4.0.0-REACT19 → 4.0.0-REACT19-20250910-113025

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 (60) hide show
  1. package/.turbo/turbo-typecheck.log +1 -1
  2. package/package.json +5 -5
  3. package/src/base/buttons/Button.tsx +74 -60
  4. package/src/base/buttons/Icon.tsx +4 -3
  5. package/src/base/forms/ConfigurationForm.tsx +7 -7
  6. package/src/base/forms/FormRow.tsx +9 -9
  7. package/src/base/forms/base/Control.tsx +7 -3
  8. package/src/base/forms/base/ExpandableText.tsx +11 -12
  9. package/src/base/forms/checkbox/Checkbox.tsx +63 -65
  10. package/src/base/forms/checkbox/CheckboxField.tsx +4 -4
  11. package/src/base/forms/chip-input/ChipInputField.tsx +28 -30
  12. package/src/base/forms/chip-input/ControlledChipInputField.tsx +20 -22
  13. package/src/base/forms/combobox/Combobox.tsx +3 -13
  14. package/src/base/forms/combobox/ComboboxField.tsx +11 -14
  15. package/src/base/forms/headless-chip-input/ChipInput.tsx +49 -46
  16. package/src/base/forms/helpers.ts +3 -7
  17. package/src/base/forms/input/Input.tsx +4 -3
  18. package/src/base/forms/input/InputField.tsx +55 -43
  19. package/src/base/forms/input/Textarea.tsx +4 -3
  20. package/src/base/forms/radio-button/RadioButton.tsx +37 -27
  21. package/src/base/forms/radio-button/RadioGroup.tsx +4 -3
  22. package/src/base/forms/radio-button/RadioGroupField.tsx +15 -16
  23. package/src/base/forms/select/Select.tsx +15 -16
  24. package/src/base/forms/select/SelectField.tsx +19 -19
  25. package/src/base/layout/_helpers/with-classes.tsx +15 -12
  26. package/src/base/layout/card/Card.tsx +28 -21
  27. package/src/base/layout/card/CardDetail.tsx +65 -76
  28. package/src/base/layout/card/CardRow.tsx +9 -9
  29. package/src/base/layout/card/CardTitle.tsx +5 -5
  30. package/src/base/layout/card-list/CardList.tsx +9 -9
  31. package/src/base/layout/collapsible/Collapsible.tsx +42 -35
  32. package/src/base/layout/tabs/TabTrigger.tsx +5 -4
  33. package/src/base/layout/tabs/Tabs.tsx +4 -4
  34. package/src/base/layout/tabs/TabsList.tsx +5 -3
  35. package/src/base/layout/templates/data-page/DataPageHeader.tsx +10 -11
  36. package/src/base/misc/Image.tsx +5 -5
  37. package/src/base/misc/Level.tsx +4 -3
  38. package/src/base/misc/Loading.tsx +25 -25
  39. package/src/base/misc/SubSubtitle.tsx +9 -9
  40. package/src/base/misc/Subtitle.tsx +10 -10
  41. package/src/base/misc/Title.tsx +22 -14
  42. package/src/base/notifications/Notification.tsx +12 -13
  43. package/src/base/overlays/dialog/Dialog.tsx +39 -40
  44. package/src/base/overlays/menu/Menu.tsx +49 -52
  45. package/src/base/overlays/menu/MenuTrigger.tsx +6 -6
  46. package/src/base/overlays/popover/Popover.tsx +4 -6
  47. package/src/base/overlays/tooltip/ExpandableHint.tsx +7 -8
  48. package/src/base/overlays/tooltip/Tooltip.tsx +5 -3
  49. package/src/base/status/StatusIcon.tsx +46 -39
  50. package/src/index.ts +1 -0
  51. package/src/routing/admin.ts +38 -0
  52. package/src/routing/group.ts +22 -0
  53. package/src/routing/help.ts +21 -0
  54. package/src/routing/import.ts +17 -0
  55. package/src/routing/index.ts +24 -0
  56. package/src/routing/me.ts +26 -0
  57. package/src/routing/namespace.ts +39 -0
  58. package/src/routing/repository.ts +91 -0
  59. package/src/routing/user.ts +22 -0
  60. package/.turbo/turbo-test.log +0 -164
@@ -1,3 +1,3 @@
1
1
  yarn run v1.22.22
2
2
  $ tsc
3
- Done in 32.87s.
3
+ Done in 32.72s.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scm-manager/ui-core",
3
- "version": "4.0.0-REACT19",
3
+ "version": "4.0.0-REACT19-20250910-113025",
4
4
  "main": "./src/index.ts",
5
5
  "license": "AGPL-3.0-only",
6
6
  "scripts": {
@@ -30,16 +30,16 @@
30
30
  "@radix-ui/react-tabs": "^1.0.4",
31
31
  "@radix-ui/react-tooltip": "1.0.2",
32
32
  "@radix-ui/react-visually-hidden": "^1.0.3",
33
- "@scm-manager/ui-api": "4.0.0-REACT19",
33
+ "@scm-manager/ui-api": "4.0.0-REACT19-20250910-113025",
34
34
  "mousetrap": "1.6.5"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@babel/core": "^7.19.0",
38
38
  "@scm-manager/babel-preset": "^2.13.1",
39
- "@scm-manager/eslint-config": "^2.17.0",
39
+ "@scm-manager/eslint-config": "^2.18.2",
40
40
  "@scm-manager/prettier-config": "^2.12.0",
41
41
  "@scm-manager/tsconfig": "^2.12.0",
42
- "@scm-manager/ui-types": "4.0.0-REACT19",
42
+ "@scm-manager/ui-types": "4.0.0-REACT19-20250910-113025",
43
43
  "@storybook/addon-actions": "^9.0.8",
44
44
  "@storybook/addon-docs": "^9.1.5",
45
45
  "@storybook/addon-essentials": "^9.0.0-alpha.12",
@@ -75,4 +75,4 @@
75
75
  "jest-extended/all"
76
76
  ]
77
77
  }
78
- }
78
+ }
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, ReactNode } from "react";
17
+ import React, { AnchorHTMLAttributes, ButtonHTMLAttributes, FC, ReactNode, Ref } from "react";
18
18
  import { Link as ReactRouterLink, LinkProps as ReactRouterLinkProps } from "react-router";
19
19
  import classNames from "classnames";
20
20
  import { createAttributesForTesting } from "../helpers";
@@ -54,7 +54,10 @@ type BaseButtonProps = {
54
54
  testId?: string;
55
55
  };
56
56
 
57
- type ButtonProps = BaseButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;
57
+ type ButtonProps = BaseButtonProps &
58
+ ButtonHTMLAttributes<HTMLButtonElement> & {
59
+ ref?: Ref<HTMLButtonElement>;
60
+ };
58
61
 
59
62
  /**
60
63
  * Styled html button.
@@ -64,21 +67,19 @@ type ButtonProps = BaseButtonProps & ButtonHTMLAttributes<HTMLButtonElement>;
64
67
  * @beta
65
68
  * @since 2.41.0
66
69
  */
67
- export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
68
- ({ className, variant, isLoading, testId, type, children, ...props }, ref) => (
69
- <button
70
- type={type ?? "button"}
71
- {...props}
72
- className={classNames(createButtonClasses(variant, isLoading), className)}
73
- ref={ref}
74
- {...createAttributesForTesting(testId)}
75
- >
76
- {children}
77
- </button>
78
- ),
70
+ export const Button: FC<ButtonProps> = ({ className, variant, isLoading, testId, type, children, ref, ...props }) => (
71
+ <button
72
+ type={type ?? "button"}
73
+ {...props}
74
+ className={classNames(createButtonClasses(variant, isLoading), className)}
75
+ ref={ref}
76
+ {...createAttributesForTesting(testId)}
77
+ >
78
+ {children}
79
+ </button>
79
80
  );
80
81
 
81
- type LinkButtonProps = BaseButtonProps & ReactRouterLinkProps;
82
+ type LinkButtonProps = BaseButtonProps & ReactRouterLinkProps & { ref?: Ref<HTMLAnchorElement> };
82
83
 
83
84
  /**
84
85
  * Styled react router link.
@@ -88,34 +89,33 @@ type LinkButtonProps = BaseButtonProps & ReactRouterLinkProps;
88
89
  * @beta
89
90
  * @since 2.41.0
90
91
  */
91
- export const LinkButton = React.forwardRef<HTMLAnchorElement, LinkButtonProps>(
92
- ({ className, variant, isLoading, testId, children, ...props }, ref) => (
93
- <ReactRouterLink
94
- {...props}
95
- className={classNames(createButtonClasses(variant, isLoading), className)}
96
- ref={ref}
97
- {...createAttributesForTesting(testId)}
98
- >
99
- {children}
100
- </ReactRouterLink>
101
- ),
92
+ export const LinkButton: FC<LinkButtonProps> = ({ className, variant, isLoading, testId, children, ref, ...props }) => (
93
+ <ReactRouterLink
94
+ {...props}
95
+ className={classNames(createButtonClasses(variant, isLoading), className)}
96
+ ref={ref}
97
+ {...createAttributesForTesting(testId)}
98
+ >
99
+ {children}
100
+ </ReactRouterLink>
102
101
  );
103
102
 
103
+ type ExternalLinkProps = AnchorHTMLAttributes<HTMLAnchorElement> & { ref?: Ref<HTMLAnchorElement> };
104
+
104
105
  /**
105
106
  * External links open in a new browser tab with rel flags "noopener" and "noreferrer" set by default.
106
107
  *
107
108
  * @beta
108
109
  * @since 2.44.0
109
110
  */
110
- export const ExternalLink = React.forwardRef<HTMLAnchorElement, AnchorHTMLAttributes<HTMLAnchorElement>>(
111
- ({ children, ...props }, ref) => (
112
- <a target="_blank" rel="noreferrer noopener" {...props} ref={ref}>
113
- {children}
114
- </a>
115
- ),
111
+ export const ExternalLink: FC<ExternalLinkProps> = ({ children, ref, ...props }) => (
112
+ <a target="_blank" rel="noreferrer noopener" {...props} ref={ref}>
113
+ {children}
114
+ </a>
116
115
  );
117
116
 
118
- type ExternalLinkButtonProps = BaseButtonProps & AnchorHTMLAttributes<HTMLAnchorElement>;
117
+ type ExternalLinkButtonProps = BaseButtonProps &
118
+ AnchorHTMLAttributes<HTMLAnchorElement> & { ref?: Ref<HTMLAnchorElement> };
119
119
 
120
120
  /**
121
121
  * Styled {@link ExternalLink}.
@@ -126,17 +126,23 @@ type ExternalLinkButtonProps = BaseButtonProps & AnchorHTMLAttributes<HTMLAnchor
126
126
  * @since 2.41.0
127
127
  * @see ExternalLink
128
128
  */
129
- export const ExternalLinkButton = React.forwardRef<HTMLAnchorElement, ExternalLinkButtonProps>(
130
- ({ className, variant, isLoading, testId, children, ...props }, ref) => (
131
- <ExternalLink
132
- {...props}
133
- className={classNames(createButtonClasses(variant, isLoading), className)}
134
- ref={ref}
135
- {...createAttributesForTesting(testId)}
136
- >
137
- {children}
138
- </ExternalLink>
139
- ),
129
+ export const ExternalLinkButton: FC<ExternalLinkButtonProps> = ({
130
+ className,
131
+ variant,
132
+ isLoading,
133
+ testId,
134
+ children,
135
+ ref,
136
+ ...props
137
+ }) => (
138
+ <ExternalLink
139
+ {...props}
140
+ className={classNames(createButtonClasses(variant, isLoading), className)}
141
+ ref={ref}
142
+ {...createAttributesForTesting(testId)}
143
+ >
144
+ {children}
145
+ </ExternalLink>
140
146
  );
141
147
 
142
148
  const StyledIconButton = styled.button`
@@ -194,6 +200,7 @@ type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
194
200
  variant?: IconButtonVariant;
195
201
  children: ReactNode;
196
202
  size?: IconButtonSize;
203
+ ref?: Ref<HTMLButtonElement>;
197
204
  };
198
205
 
199
206
  /**
@@ -204,19 +211,26 @@ type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
204
211
  * @beta
205
212
  * @since 3.2.0
206
213
  */
207
- export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
208
- ({ className, variant = "default", size = "medium", testId, type, children, ...props }, ref) => {
209
- const elementAttributes = {
210
- type: type ?? "button",
211
- ...props,
212
- className: classNames(createIconButtonClasses(variant), "button", "has-background-transparent"),
213
- ref: ref,
214
- ...createAttributesForTesting(testId),
215
- };
216
- return size === "small" ? (
217
- <StyledIconButtonCircle {...elementAttributes}>{children}</StyledIconButtonCircle>
218
- ) : (
219
- <StyledIconButton {...elementAttributes}>{children}</StyledIconButton>
220
- );
221
- },
222
- );
214
+ export const IconButton: FC<IconButtonProps> = ({
215
+ className,
216
+ variant = "default",
217
+ size = "medium",
218
+ testId,
219
+ type,
220
+ ref,
221
+ children,
222
+ ...props
223
+ }) => {
224
+ const elementAttributes = {
225
+ type: type ?? "button",
226
+ ...props,
227
+ className: classNames(createIconButtonClasses(variant), "button", "has-background-transparent"),
228
+ ref: ref,
229
+ ...createAttributesForTesting(testId),
230
+ };
231
+ return size === "small" ? (
232
+ <StyledIconButtonCircle {...elementAttributes}>{children}</StyledIconButtonCircle>
233
+ ) : (
234
+ <StyledIconButton {...elementAttributes}>{children}</StyledIconButton>
235
+ );
236
+ };
@@ -14,12 +14,13 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React from "react";
17
+ import React, { Ref, FC } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
20
  type Props = React.HTMLProps<HTMLElement> & {
21
21
  children?: string;
22
22
  type?: string;
23
+ ref?: Ref<HTMLElement>;
23
24
  };
24
25
 
25
26
  /**
@@ -34,7 +35,7 @@ type Props = React.HTMLProps<HTMLElement> & {
34
35
  * @see https://bulma.io/documentation/elements/icon/
35
36
  * @see https://fontawesome.com/search?o=r&m=free
36
37
  */
37
- const Icon = React.forwardRef<HTMLElement, Props>(({ children, className, type = "fas", ...props }, ref) => {
38
+ const Icon: FC<Props> = ({ children, className, type = "fas", ref, ...props }) => {
38
39
  return (
39
40
  <span className={classNames(className, "icon")} aria-hidden="true" {...props} ref={ref}>
40
41
  <i
@@ -46,6 +47,6 @@ const Icon = React.forwardRef<HTMLElement, Props>(({ children, className, type =
46
47
  />
47
48
  </span>
48
49
  );
49
- });
50
+ };
50
51
 
51
52
  export default Icon;
@@ -23,20 +23,20 @@ import { useTranslation } from "react-i18next";
23
23
  import { DefaultValues, FieldValues } from "react-hook-form";
24
24
 
25
25
  type Props<T extends HalRepresentation> =
26
- // eslint-disable-next-line prettier/prettier
26
+ // eslint-disable-next-line prettier/prettier
27
27
  Omit<ComponentProps<typeof Form<T>>, "onSubmit" | "defaultValues" | "readOnly" | "successMessageFallback"> & {
28
- link: string;
29
- };
28
+ link: string;
29
+ };
30
30
 
31
31
  /**
32
32
  * @beta
33
33
  * @since 2.41.0
34
34
  */
35
35
  export function ConfigurationForm<T extends HalRepresentation & FieldValues>({
36
- link,
37
- children,
38
- ...formProps
39
- }: Props<T>) {
36
+ link,
37
+ children,
38
+ ...formProps
39
+ }: Props<T>) {
40
40
  const { initialConfiguration, isReadOnly, update, isLoading } = useConfigLink<T>(link);
41
41
  const [t] = useTranslation("commons", { keyPrefix: "form" });
42
42
 
@@ -14,16 +14,16 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLProps } from "react";
17
+ import React, { FC, HTMLProps, Ref } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
- const FormRow = React.forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(
21
- ({ className, children, hidden, ...rest }, ref) =>
22
- hidden ? null : (
23
- <div ref={ref} className={classNames("columns", className)} {...rest}>
24
- {children}
25
- </div>
26
- )
27
- );
20
+ type Props = HTMLProps<HTMLDivElement> & { ref?: Ref<HTMLDivElement> };
21
+
22
+ const FormRow: FC<Props> = ({ className, children, hidden, ref, ...rest }) =>
23
+ hidden ? null : (
24
+ <div ref={ref} className={classNames("columns", className)} {...rest}>
25
+ {children}
26
+ </div>
27
+ );
28
28
 
29
29
  export default FormRow;
@@ -14,13 +14,17 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLProps } from "react";
17
+ import React, { HTMLProps, Ref, FC } from "react";
18
18
  import classNames from "classnames";
19
19
 
20
- const Control = React.forwardRef<HTMLDivElement, HTMLProps<HTMLDivElement>>(({ className, children, ...rest }, ref) => (
20
+ type ControlProps = HTMLProps<HTMLDivElement> & {
21
+ ref?: Ref<HTMLDivElement>;
22
+ };
23
+
24
+ const Control: FC<ControlProps> = ({ className, children, ref, ...rest }) => (
21
25
  <div className={classNames("control", className)} {...rest} ref={ref}>
22
26
  {children}
23
27
  </div>
24
- ));
28
+ );
25
29
 
26
30
  export default Control;
@@ -14,12 +14,13 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { HTMLAttributes } from "react";
17
+ import React, { HTMLAttributes, FC, Ref } from "react";
18
18
 
19
19
  interface Props extends HTMLAttributes<HTMLParagraphElement> {
20
20
  descriptionText: string;
21
21
  extendedDescriptionText: string;
22
22
  id?: string;
23
+ ref?: Ref<HTMLDetailsElement>;
23
24
  }
24
25
 
25
26
  /**
@@ -29,22 +30,20 @@ interface Props extends HTMLAttributes<HTMLParagraphElement> {
29
30
  * with an icon to toggle the visibility of the extended text.
30
31
  *
31
32
  * @param desription - The text content that will always be displayed.
32
- * @param extended - The text content that will be displayed after you toggle details.
33
+ * @param extendedDescriptionText - The text content that will be displayed after you toggle details.
33
34
  * @param id - Additional props to pass to the `<details>` element.
34
35
  * @param ref - A ref to the `<details>` element.
35
36
  *
36
37
  * @beta
37
38
  * @since 3.9.0
38
39
  */
39
- const ExpandableText = React.forwardRef<HTMLDetailsElement, Props>(
40
- ({ descriptionText, extendedDescriptionText, id }, ref) => {
41
- return (
42
- <details className="mb-2" id={id} ref={ref}>
43
- <summary>{descriptionText}</summary>
44
- <span>{extendedDescriptionText}</span>
45
- </details>
46
- );
47
- }
48
- );
40
+ const ExpandableText: FC<Props> = ({ descriptionText, extendedDescriptionText, id, ref }) => {
41
+ return (
42
+ <details className="mb-2" id={id} ref={ref}>
43
+ <summary>{descriptionText}</summary>
44
+ <span>{extendedDescriptionText}</span>
45
+ </details>
46
+ );
47
+ };
49
48
 
50
49
  export default ExpandableText;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { InputHTMLAttributes } from "react";
17
+ import React, { InputHTMLAttributes, Ref, FC } from "react";
18
18
  import { createAttributesForTesting } from "../../helpers";
19
19
  import Help from "../base/help/Help";
20
20
  import styled from "styled-components";
@@ -36,71 +36,53 @@ type InputFieldProps = {
36
36
  descriptionText?: string;
37
37
  testId?: string;
38
38
  labelClassName?: string;
39
+ ref?: Ref<HTMLInputElement>;
39
40
  } & Omit<InputHTMLAttributes<HTMLInputElement>, "type">;
40
41
 
41
42
  /**
42
43
  * @see https://bulma.io/documentation/form/checkbox/
43
44
  */
44
- const Checkbox = React.forwardRef<HTMLInputElement, InputFieldProps>(
45
- (
46
- {
47
- readOnly,
48
- label,
49
- descriptionText,
50
- className,
51
- labelClassName,
52
- value,
53
- name,
54
- checked,
55
- defaultChecked,
56
- defaultValue,
57
- testId,
58
- helpText,
59
- ...props
60
- },
61
- ref
62
- ) => {
63
- const descriptionId = descriptionText ? `checkbox-description-${name}` : undefined;
64
- return (
65
- <>
66
- {descriptionText ? <p id={descriptionId}>{descriptionText}</p> : null}
67
- <StyledLabel
68
- className={classNames("checkbox is-align-items-center", labelClassName)}
69
- // @ts-ignore bulma uses the disabled attribute on labels, although it is not part of the html spec
70
- disabled={readOnly || props.disabled}
71
- >
72
- {readOnly ? (
73
- <>
74
- <input
75
- type="hidden"
76
- name={name}
77
- value={value}
78
- defaultValue={defaultValue}
79
- checked={checked}
80
- defaultChecked={defaultChecked}
81
- aria-describedby={descriptionId}
82
- readOnly
83
- />
84
- <StyledInput
85
- type="checkbox"
86
- className={classNames("m-3", className)}
87
- ref={ref}
88
- value={value}
89
- defaultValue={defaultValue}
90
- checked={checked}
91
- defaultChecked={defaultChecked}
92
- aria-describedby={descriptionId}
93
- {...props}
94
- {...createAttributesForTesting(testId)}
95
- disabled
96
- />
97
- </>
98
- ) : (
45
+ const Checkbox: FC<InputFieldProps> = ({
46
+ readOnly,
47
+ label,
48
+ descriptionText,
49
+ className,
50
+ labelClassName,
51
+ value,
52
+ name,
53
+ checked,
54
+ defaultChecked,
55
+ defaultValue,
56
+ testId,
57
+ helpText,
58
+ ref,
59
+ ...props
60
+ }) => {
61
+ const descriptionId = descriptionText ? `checkbox-description-${name}` : undefined;
62
+ return (
63
+ <>
64
+ {descriptionText ? <p id={descriptionId}>{descriptionText}</p> : null}
65
+ <StyledLabel
66
+ className={classNames("checkbox is-align-items-center", labelClassName)}
67
+ // @ts-ignore bulma uses the disabled attribute on labels, although it is not part of the html spec
68
+ disabled={readOnly || props.disabled}
69
+ >
70
+ {readOnly ? (
71
+ <>
72
+ <input
73
+ type="hidden"
74
+ name={name}
75
+ value={value}
76
+ defaultValue={defaultValue}
77
+ checked={checked}
78
+ defaultChecked={defaultChecked}
79
+ aria-describedby={descriptionId}
80
+ readOnly
81
+ />
99
82
  <StyledInput
100
83
  type="checkbox"
101
84
  className={classNames("m-3", className)}
102
85
  ref={ref}
103
- name={name}
104
86
  value={value}
105
87
  defaultValue={defaultValue}
106
88
  checked={checked}
@@ -108,14 +90,30 @@ const Checkbox = React.forwardRef<HTMLInputElement, InputFieldProps>(
108
90
  aria-describedby={descriptionId}
109
91
  {...props}
110
92
  {...createAttributesForTesting(testId)}
93
+ disabled
111
94
  />
112
- )}
95
+ </>
96
+ ) : (
97
+ <StyledInput
98
+ type="checkbox"
99
+ className={classNames("m-3", className)}
100
+ ref={ref}
101
+ name={name}
102
+ value={value}
103
+ defaultValue={defaultValue}
104
+ checked={checked}
105
+ defaultChecked={defaultChecked}
106
+ aria-describedby={descriptionId}
107
+ {...props}
108
+ {...createAttributesForTesting(testId)}
109
+ />
110
+ )}
111
+
112
+ {label}
113
+ {helpText ? <Help className="ml-1" text={helpText} /> : null}
114
+ </StyledLabel>
115
+ </>
116
+ );
117
+ };
113
118
 
114
- {label}
115
- {helpText ? <Help className="ml-1" text={helpText} /> : null}
116
- </StyledLabel>
117
- </>
118
- );
119
- }
120
- );
121
119
  export default Checkbox;
@@ -14,18 +14,18 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React from "react";
17
+ import React, { Ref, FC } from "react";
18
18
  import Field from "../base/Field";
19
19
  import Control from "../base/Control";
20
20
  import Checkbox from "./Checkbox";
21
21
 
22
- type Props = React.ComponentProps<typeof Checkbox>;
22
+ type Props = React.ComponentProps<typeof Checkbox> & { ref?: Ref<HTMLInputElement> };
23
23
 
24
- const CheckboxField = React.forwardRef<HTMLInputElement, Props>(({ className, ...props }, ref) => (
24
+ const CheckboxField: FC<Props> = ({ className, ref, ...props }) => (
25
25
  <Field className={className}>
26
26
  <Control>
27
27
  <Checkbox ref={ref} {...props} />
28
28
  </Control>
29
29
  </Field>
30
- ));
30
+ );
31
31
  export default CheckboxField;
@@ -14,7 +14,7 @@
14
14
  * along with this program. If not, see https://www.gnu.org/licenses/.
15
15
  */
16
16
 
17
- import React, { KeyboardEventHandler, PropsWithRef, ReactElement, Ref, useCallback } from "react";
17
+ import React, { KeyboardEventHandler, ReactElement, Ref, useCallback, FC } from "react";
18
18
  import { createAttributesForTesting, useAriaId } from "../../helpers";
19
19
  import Field from "../base/Field";
20
20
  import Label from "../base/label/Label";
@@ -26,18 +26,17 @@ import { createVariantClass, Variant } from "../variants";
26
26
  import ChipInput, { NewChipInput } from "../headless-chip-input/ChipInput";
27
27
  import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
28
28
  import { useTranslation } from "react-i18next";
29
- import { withForwardRef } from "../helpers";
30
29
  import { Option } from "@scm-manager/ui-types";
31
30
 
32
- const ChipInputWrapper = React.forwardRef<HTMLUListElement, any>((props, ref) => (
31
+ const ChipInputWrapper: FC<any> = ({ ref, ...props }) => (
33
32
  // @ts-ignore
34
33
  <ChipInput ref={ref} {...props} />
35
- ));
34
+ );
36
35
 
37
- const NewChipInputWrapper = React.forwardRef<HTMLUListElement, any>((props, ref) => (
36
+ const NewChipInputWrapper: FC<any> = ({ ref, ...props }) => (
38
37
  // @ts-ignore
39
38
  <NewChipInput ref={ref} {...props} />
40
- ));
39
+ );
41
40
 
42
41
  const StyledChipInput = styled(ChipInputWrapper)`
43
42
  min-height: 40px;
@@ -102,29 +101,27 @@ const determineVariant = (error: string | undefined, warning: string | undefined
102
101
  * @beta
103
102
  * @since 2.44.0
104
103
  */
105
- const ChipInputField = function ChipInputField<T>(
106
- {
107
- label,
108
- helpText,
109
- information,
110
- readOnly,
111
- disabled,
112
- error,
113
- warning,
114
- createDeleteText,
115
- onChange,
116
- placeholder,
117
- value,
118
- className,
119
- testId,
120
- id,
121
- children,
122
- isLoading,
123
- isNewItemDuplicate,
124
- ...props
125
- }: PropsWithRef<InputFieldProps<T>>,
126
- ref: React.ForwardedRef<HTMLInputElement>,
127
- ) {
104
+ const ChipInputField = function ChipInputField<T>({
105
+ label,
106
+ helpText,
107
+ information,
108
+ readOnly,
109
+ disabled,
110
+ error,
111
+ warning,
112
+ createDeleteText,
113
+ onChange,
114
+ placeholder,
115
+ value,
116
+ className,
117
+ testId,
118
+ id,
119
+ children,
120
+ isLoading,
121
+ isNewItemDuplicate,
122
+ ref,
123
+ ...props
124
+ }: InputFieldProps<T>) {
128
125
  const [t] = useTranslation("commons", { keyPrefix: "form.chipList" });
129
126
  const deleteTextCallback = useCallback(
130
127
  (item: any) => (createDeleteText ? createDeleteText(item) : t("delete", { item })),
@@ -185,4 +182,5 @@ const ChipInputField = function ChipInputField<T>(
185
182
  </Field>
186
183
  );
187
184
  };
188
- export default withForwardRef(ChipInputField);
185
+
186
+ export default ChipInputField;