@sebgroup/green-react 3.27.0 → 3.27.1
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
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"name": "@sebgroup/green-react",
|
|
3
3
|
"main": "./src/index.js",
|
|
4
4
|
"module": "./src/index.js",
|
|
5
|
-
"version": "3.27.
|
|
5
|
+
"version": "3.27.1",
|
|
6
6
|
"peerDependencies": {
|
|
7
7
|
"react": "^17 || ^18 || ^19",
|
|
8
8
|
"react-dom": "^17 || ^18 || ^19"
|
|
9
9
|
},
|
|
10
10
|
"dependencies": {
|
|
11
|
-
"@sebgroup/green-core": "^1.
|
|
11
|
+
"@sebgroup/green-core": "^1.72.0",
|
|
12
12
|
"@sebgroup/chlorophyll": "^3.6.16",
|
|
13
13
|
"@sebgroup/extract": "^3.0.1",
|
|
14
14
|
"@lit/react": "^1.0.2",
|
|
@@ -1,31 +1,44 @@
|
|
|
1
1
|
import { DetailedHTMLProps, InputHTMLAttributes, ReactNode } from 'react';
|
|
2
2
|
import { IExpandableInformation, IValidator } from '@sebgroup/extract';
|
|
3
3
|
export interface InputProps extends IExpandableInformation, DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement> {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Data test id used for finding elements in test
|
|
6
|
+
*/
|
|
5
7
|
testId?: string;
|
|
6
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Function to format the value on change
|
|
10
|
+
*/
|
|
7
11
|
formatter?: (value: string) => string;
|
|
8
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Additional descriptive text displayed below the label
|
|
14
|
+
*/
|
|
9
15
|
info?: ReactNode;
|
|
10
|
-
/**
|
|
16
|
+
/**
|
|
17
|
+
* Label text describing the input field
|
|
18
|
+
*/
|
|
11
19
|
label?: string;
|
|
12
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Text displayed on the right side of the input, typically used for units like 'kr' or '%'
|
|
22
|
+
*/
|
|
13
23
|
unit?: string;
|
|
14
|
-
/**
|
|
24
|
+
/**
|
|
25
|
+
* Validation object for input validation
|
|
26
|
+
*/
|
|
15
27
|
validator?: IValidator;
|
|
16
28
|
/**
|
|
17
|
-
*
|
|
29
|
+
* Current value of the input field
|
|
18
30
|
*/
|
|
19
31
|
value?: string | number;
|
|
20
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Callback function triggered when the input value changes
|
|
34
|
+
*/
|
|
21
35
|
onChangeInput?: (value: string) => string;
|
|
22
36
|
/**
|
|
23
|
-
*
|
|
37
|
+
* ID of another element that describes the input field
|
|
24
38
|
*/
|
|
25
39
|
'aria-describedby'?: string;
|
|
26
40
|
/**
|
|
27
|
-
*
|
|
28
|
-
* @default 'assertive'
|
|
41
|
+
* ARIA live region attribute for the form control footer, affecting how error messages are read by screen readers
|
|
29
42
|
*/
|
|
30
43
|
'aria-live'?: React.AriaAttributes['aria-live'];
|
|
31
44
|
}
|
|
@@ -70,7 +70,7 @@ var Input = /*#__PURE__*/forwardRef(function (_a, ref) {
|
|
|
70
70
|
if (onChangeInput) onChangeInput(formattedValue);
|
|
71
71
|
}, [formatter, setLocalValue, onChange, onChangeInput]);
|
|
72
72
|
var showSimpleInput = !label && !info && !expandableInfo;
|
|
73
|
-
var describedBy = classNames(ariaDescribedBy, _defineProperty(_defineProperty(_defineProperty({}, "".concat(uuid, "_message"), !showSimpleInput
|
|
73
|
+
var describedBy = classNames(ariaDescribedBy, _defineProperty(_defineProperty(_defineProperty({}, "".concat(uuid, "_message"), !showSimpleInput), "".concat(uuid, "_info"), !showSimpleInput && info), "gds-expandable-info-".concat(uuid), !showSimpleInput && expandableInfo));
|
|
74
74
|
var inputClassName = classNames(className, _defineProperty({}, validateClassName(validator === null || validator === void 0 ? void 0 : validator.indicator), validator));
|
|
75
75
|
var input = jsx("input", Object.assign({
|
|
76
76
|
"aria-describedby": describedBy || undefined,
|