@scm-manager/ui-core 3.7.2-20250123-163137 → 3.7.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.
- package/.turbo/turbo-typecheck.log +1 -1
- package/package.json +3 -3
- package/src/base/forms/Form.tsx +3 -3
- package/src/base/forms/checkbox/Checkbox.tsx +48 -59
- package/src/base/forms/checkbox/ControlledCheckboxField.tsx +0 -4
- package/src/base/forms/chip-input/ChipInputField.tsx +1 -0
- package/src/base/forms/input/ControlledInputField.tsx +0 -4
- package/src/base/forms/input/InputField.tsx +2 -9
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
@scm-manager/ui-core:typecheck: cache hit, replaying output
|
|
1
|
+
@scm-manager/ui-core:typecheck: cache hit, replaying output 466dc99013690e25
|
|
2
2
|
@scm-manager/ui-core:typecheck: $ tsc
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scm-manager/ui-core",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.3",
|
|
4
4
|
"main": "./src/index.ts",
|
|
5
5
|
"license": "AGPL-3.0-only",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"styled-components": "5"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@scm-manager/ui-api": "3.7.
|
|
23
|
+
"@scm-manager/ui-api": "3.7.3",
|
|
24
24
|
"@radix-ui/react-radio-group": "^1.1.3",
|
|
25
25
|
"@radix-ui/react-slot": "^1.0.1",
|
|
26
26
|
"@radix-ui/react-visually-hidden": "^1.0.3",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@scm-manager/eslint-config": "^2.17.0",
|
|
38
38
|
"@scm-manager/tsconfig": "^2.12.0",
|
|
39
39
|
"@scm-manager/babel-preset": "^2.13.1",
|
|
40
|
-
"@scm-manager/ui-types": "3.7.
|
|
40
|
+
"@scm-manager/ui-types": "3.7.3",
|
|
41
41
|
"@types/mousetrap": "1.6.5",
|
|
42
42
|
"@testing-library/react-hooks": "8.0.1",
|
|
43
43
|
"@testing-library/react": "12.1.5",
|
package/src/base/forms/Form.tsx
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import React, { FC, useCallback, useEffect, useState } from "react";
|
|
18
18
|
import { DeepPartial, SubmitHandler, useForm, UseFormReturn } from "react-hook-form";
|
|
19
19
|
import { ErrorNotification } from "../notifications";
|
|
20
|
-
import { Level } from
|
|
20
|
+
import { Level } from "../misc";
|
|
21
21
|
import { ScmFormContextProvider } from "./ScmFormContext";
|
|
22
22
|
import { useTranslation } from "react-i18next";
|
|
23
23
|
import { Button } from "../buttons";
|
|
@@ -135,10 +135,10 @@ function Form<FormType extends Record<string, unknown>, DefaultValues extends Fo
|
|
|
135
135
|
|
|
136
136
|
// See https://react-hook-form.com/api/useform/reset/
|
|
137
137
|
useEffect(() => {
|
|
138
|
-
if (isSubmitSuccessful
|
|
138
|
+
if (isSubmitSuccessful) {
|
|
139
139
|
setShowSuccessNotification(true);
|
|
140
140
|
}
|
|
141
|
-
}, [isSubmitSuccessful
|
|
141
|
+
}, [isSubmitSuccessful]);
|
|
142
142
|
|
|
143
143
|
useEffect(() => reset(defaultValues as never), [defaultValues, reset]);
|
|
144
144
|
|
|
@@ -33,7 +33,6 @@ const StyledLabel = styled.label`
|
|
|
33
33
|
type InputFieldProps = {
|
|
34
34
|
label: string;
|
|
35
35
|
helpText?: string;
|
|
36
|
-
descriptionText?: string;
|
|
37
36
|
testId?: string;
|
|
38
37
|
labelClassName?: string;
|
|
39
38
|
} & Omit<InputHTMLAttributes<HTMLInputElement>, "type">;
|
|
@@ -46,7 +45,6 @@ const Checkbox = React.forwardRef<HTMLInputElement, InputFieldProps>(
|
|
|
46
45
|
{
|
|
47
46
|
readOnly,
|
|
48
47
|
label,
|
|
49
|
-
descriptionText,
|
|
50
48
|
className,
|
|
51
49
|
labelClassName,
|
|
52
50
|
value,
|
|
@@ -59,63 +57,54 @@ const Checkbox = React.forwardRef<HTMLInputElement, InputFieldProps>(
|
|
|
59
57
|
...props
|
|
60
58
|
},
|
|
61
59
|
ref
|
|
62
|
-
) =>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
checked={checked}
|
|
107
|
-
defaultChecked={defaultChecked}
|
|
108
|
-
aria-describedby={descriptionId}
|
|
109
|
-
{...props}
|
|
110
|
-
{...createAttributesForTesting(testId)}
|
|
111
|
-
/>
|
|
112
|
-
)}
|
|
60
|
+
) => (
|
|
61
|
+
<StyledLabel
|
|
62
|
+
className={classNames("checkbox is-align-items-center", labelClassName)}
|
|
63
|
+
// @ts-ignore bulma uses the disabled attribute on labels, although it is not part of the html spec
|
|
64
|
+
disabled={readOnly || props.disabled}
|
|
65
|
+
>
|
|
66
|
+
{readOnly ? (
|
|
67
|
+
<>
|
|
68
|
+
<input
|
|
69
|
+
type="hidden"
|
|
70
|
+
name={name}
|
|
71
|
+
value={value}
|
|
72
|
+
defaultValue={defaultValue}
|
|
73
|
+
checked={checked}
|
|
74
|
+
defaultChecked={defaultChecked}
|
|
75
|
+
readOnly
|
|
76
|
+
/>
|
|
77
|
+
<StyledInput
|
|
78
|
+
type="checkbox"
|
|
79
|
+
className={classNames("m-3", className)}
|
|
80
|
+
ref={ref}
|
|
81
|
+
value={value}
|
|
82
|
+
defaultValue={defaultValue}
|
|
83
|
+
checked={checked}
|
|
84
|
+
defaultChecked={defaultChecked}
|
|
85
|
+
{...props}
|
|
86
|
+
{...createAttributesForTesting(testId)}
|
|
87
|
+
disabled
|
|
88
|
+
/>
|
|
89
|
+
</>
|
|
90
|
+
) : (
|
|
91
|
+
<StyledInput
|
|
92
|
+
type="checkbox"
|
|
93
|
+
className={classNames("m-3", className)}
|
|
94
|
+
ref={ref}
|
|
95
|
+
name={name}
|
|
96
|
+
value={value}
|
|
97
|
+
defaultValue={defaultValue}
|
|
98
|
+
checked={checked}
|
|
99
|
+
defaultChecked={defaultChecked}
|
|
100
|
+
{...props}
|
|
101
|
+
{...createAttributesForTesting(testId)}
|
|
102
|
+
/>
|
|
103
|
+
)}
|
|
113
104
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
);
|
|
119
|
-
}
|
|
105
|
+
{label}
|
|
106
|
+
{helpText ? <Help className="ml-1" text={helpText} /> : null}
|
|
107
|
+
</StyledLabel>
|
|
108
|
+
)
|
|
120
109
|
);
|
|
121
110
|
export default Checkbox;
|
|
@@ -35,7 +35,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
35
35
|
name,
|
|
36
36
|
label,
|
|
37
37
|
helpText,
|
|
38
|
-
descriptionText,
|
|
39
38
|
rules,
|
|
40
39
|
testId,
|
|
41
40
|
defaultChecked,
|
|
@@ -49,8 +48,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
49
48
|
const prefixedNameWithoutIndices = prefixWithoutIndices(nameWithPrefix);
|
|
50
49
|
const labelTranslation = label || t(`${prefixedNameWithoutIndices}.label`) || "";
|
|
51
50
|
const helpTextTranslation = helpText || t(`${prefixedNameWithoutIndices}.helpText`);
|
|
52
|
-
const descriptionTextTranslation = descriptionText || t(`${prefixedNameWithoutIndices}.descriptionText`);
|
|
53
|
-
|
|
54
51
|
return (
|
|
55
52
|
<Controller
|
|
56
53
|
control={control}
|
|
@@ -67,7 +64,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
67
64
|
{...field}
|
|
68
65
|
label={labelTranslation}
|
|
69
66
|
helpText={helpTextTranslation}
|
|
70
|
-
descriptionText={descriptionTextTranslation}
|
|
71
67
|
testId={testId ?? `checkbox-${nameWithPrefix}`}
|
|
72
68
|
/>
|
|
73
69
|
)}
|
|
@@ -28,6 +28,7 @@ import { VisuallyHidden } from "@radix-ui/react-visually-hidden";
|
|
|
28
28
|
import { useTranslation } from "react-i18next";
|
|
29
29
|
import { withForwardRef } from "../helpers";
|
|
30
30
|
import { Option } from "@scm-manager/ui-types";
|
|
31
|
+
import { waitForRestartAfter } from "@scm-manager/ui-api";
|
|
31
32
|
|
|
32
33
|
const StyledChipInput: typeof ChipInput = styled(ChipInput)`
|
|
33
34
|
min-height: 40px;
|
|
@@ -35,7 +35,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
35
35
|
name,
|
|
36
36
|
label,
|
|
37
37
|
helpText,
|
|
38
|
-
descriptionText,
|
|
39
38
|
rules,
|
|
40
39
|
testId,
|
|
41
40
|
defaultValue,
|
|
@@ -49,8 +48,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
49
48
|
const prefixedNameWithoutIndices = prefixWithoutIndices(nameWithPrefix);
|
|
50
49
|
const labelTranslation = label || t(`${prefixedNameWithoutIndices}.label`) || "";
|
|
51
50
|
const helpTextTranslation = helpText || t(`${prefixedNameWithoutIndices}.helpText`);
|
|
52
|
-
const descriptionTextTranslation = descriptionText || t(`${prefixedNameWithoutIndices}.descriptionText`);
|
|
53
|
-
|
|
54
51
|
return (
|
|
55
52
|
<Controller
|
|
56
53
|
control={control}
|
|
@@ -67,7 +64,6 @@ function ControlledInputField<T extends Record<string, unknown>>({
|
|
|
67
64
|
form={formId}
|
|
68
65
|
label={labelTranslation}
|
|
69
66
|
helpText={helpTextTranslation}
|
|
70
|
-
descriptionText={descriptionTextTranslation}
|
|
71
67
|
error={
|
|
72
68
|
fieldState.error
|
|
73
69
|
? fieldState.error.message || t(`${prefixedNameWithoutIndices}.error.${fieldState.error.type}`)
|
|
@@ -26,7 +26,6 @@ import { useAriaId } from "../../helpers";
|
|
|
26
26
|
type InputFieldProps = {
|
|
27
27
|
label: string;
|
|
28
28
|
helpText?: string;
|
|
29
|
-
descriptionText?: string;
|
|
30
29
|
error?: string;
|
|
31
30
|
} & React.ComponentProps<typeof Input>;
|
|
32
31
|
|
|
@@ -34,9 +33,8 @@ type InputFieldProps = {
|
|
|
34
33
|
* @see https://bulma.io/documentation/form/input/
|
|
35
34
|
*/
|
|
36
35
|
const InputField = React.forwardRef<HTMLInputElement, InputFieldProps>(
|
|
37
|
-
({
|
|
36
|
+
({ label, helpText, error, className, id, ...props }, ref) => {
|
|
38
37
|
const inputId = useAriaId(id ?? props.testId);
|
|
39
|
-
const descriptionId = descriptionText ? `input-description-${name}` : undefined;
|
|
40
38
|
const variant = error ? "danger" : undefined;
|
|
41
39
|
return (
|
|
42
40
|
<Field className={className}>
|
|
@@ -44,13 +42,8 @@ const InputField = React.forwardRef<HTMLInputElement, InputFieldProps>(
|
|
|
44
42
|
{label}
|
|
45
43
|
{helpText ? <Help className="ml-1" text={helpText} /> : null}
|
|
46
44
|
</Label>
|
|
47
|
-
{descriptionText ? (
|
|
48
|
-
<p className="mb-2" id={descriptionId}>
|
|
49
|
-
{descriptionText}
|
|
50
|
-
</p>
|
|
51
|
-
) : null}
|
|
52
45
|
<Control>
|
|
53
|
-
<Input variant={variant} ref={ref} id={inputId}
|
|
46
|
+
<Input variant={variant} ref={ref} id={inputId} {...props}></Input>
|
|
54
47
|
</Control>
|
|
55
48
|
{error ? <FieldMessage variant={variant}>{error}</FieldMessage> : null}
|
|
56
49
|
</Field>
|