@trackunit/react-form-components 0.0.37 → 0.0.38
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/index.cjs
CHANGED
|
@@ -1164,7 +1164,7 @@ ${({ $inline }) => ($inline ? tailwindStyledComponents.tws `tu-radiogroup--inlin
|
|
|
1164
1164
|
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
1165
1165
|
* @returns {JSX.Element} RadioItem component
|
|
1166
1166
|
*/
|
|
1167
|
-
const RadioItem = ({ label, value, dataTestId, className, description }) => {
|
|
1167
|
+
const RadioItem = ({ label, value, dataTestId, className, description, }) => {
|
|
1168
1168
|
const groupCtx = React__namespace.useContext(RadioGroupContext);
|
|
1169
1169
|
const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
|
|
1170
1170
|
return (jsxRuntime.jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Wrapper` }, { children: [jsxRuntime.jsx(Input, { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, type: "radio", role: "radio", value: value, checked: isChecked, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid, onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange, "data-testid": dataTestId, "$checked": isChecked }), jsxRuntime.jsxs(LabelContainer$1, { children: [jsxRuntime.jsx(Label$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid }, { children: label })), description && (jsxRuntime.jsx(Description$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }, { children: description })))] })] })));
|
package/index.js
CHANGED
|
@@ -1135,7 +1135,7 @@ ${({ $inline }) => ($inline ? tws `tu-radiogroup--inline` : tws `tu-radiogroup`)
|
|
|
1135
1135
|
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
1136
1136
|
* @returns {JSX.Element} RadioItem component
|
|
1137
1137
|
*/
|
|
1138
|
-
const RadioItem = ({ label, value, dataTestId, className, description }) => {
|
|
1138
|
+
const RadioItem = ({ label, value, dataTestId, className, description, }) => {
|
|
1139
1139
|
const groupCtx = React.useContext(RadioGroupContext);
|
|
1140
1140
|
const isChecked = (groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.value) === value;
|
|
1141
1141
|
return (jsxs(InputWrapper, Object.assign({ className: className, htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Wrapper` }, { children: [jsx(Input, { id: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, type: "radio", role: "radio", value: value, checked: isChecked, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, "$isInvalid": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid, onChange: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.onChange, "data-testid": dataTestId, "$checked": isChecked }), jsxs(LabelContainer$1, { children: [jsx(Label$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, dataTestId: dataTestId && `${dataTestId}-Label`, disabled: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled, isInvalid: groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.isInvalid }, { children: label })), description && (jsx(Description$1, Object.assign({ htmlFor: `${groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.id}-${value}`, "data-testid": dataTestId && `${dataTestId}-Description`, "$disabled": groupCtx === null || groupCtx === void 0 ? void 0 : groupCtx.disabled }, { children: description })))] })] })));
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trackunit/react-form-components",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"repository": "https://github.com/Trackunit/manager",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@trackunit/i18n-library-translation": "0.0.
|
|
8
|
-
"@trackunit/react-components": "0.1.
|
|
7
|
+
"@trackunit/i18n-library-translation": "0.0.52",
|
|
8
|
+
"@trackunit/react-components": "0.1.96",
|
|
9
9
|
"@trackunit/tailwind-styled-components": "0.0.56",
|
|
10
10
|
"date-fns": "2.29.3",
|
|
11
11
|
"libphonenumber-js": "1.10.30",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import "./RadioGroup.css";
|
|
4
|
-
export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
4
|
+
export interface RadioGroupProps<V extends string | number> extends CommonProps, React.InputHTMLAttributes<HTMLInputElement> {
|
|
5
5
|
/**
|
|
6
6
|
*/
|
|
7
7
|
children: React.ReactNode;
|
|
@@ -12,11 +12,11 @@ export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<
|
|
|
12
12
|
/**
|
|
13
13
|
* onChange handler for the radio group.
|
|
14
14
|
*/
|
|
15
|
-
onChange: (e: React.
|
|
15
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
16
16
|
/**
|
|
17
17
|
* The value of the radio group.
|
|
18
18
|
*/
|
|
19
|
-
value:
|
|
19
|
+
value: V;
|
|
20
20
|
/**
|
|
21
21
|
* The name of the radio group.
|
|
22
22
|
*/
|
|
@@ -52,6 +52,6 @@ export interface RadioGroupProps extends CommonProps, React.InputHTMLAttributes<
|
|
|
52
52
|
* @returns {JSX.Element} RadioGroup component
|
|
53
53
|
*/
|
|
54
54
|
export declare const RadioGroup: {
|
|
55
|
-
({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }: RadioGroupProps): JSX.Element;
|
|
55
|
+
<V extends string | number = string>({ children, id, name, value, disabled, onChange, label, inline, className, dataTestId, isInvalid, }: RadioGroupProps<V>): JSX.Element;
|
|
56
56
|
displayName: string;
|
|
57
57
|
};
|
|
@@ -5,7 +5,7 @@ interface RadioGroupContextProps {
|
|
|
5
5
|
value: string | number;
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
isInvalid?: boolean;
|
|
8
|
-
onChange: (e: React.
|
|
8
|
+
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
9
9
|
}
|
|
10
10
|
export declare const RadioGroupContext: React.Context<RadioGroupContextProps | null>;
|
|
11
11
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CommonProps } from "@trackunit/react-components";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
export interface RadioItemProps extends CommonProps {
|
|
3
|
+
export interface RadioItemProps<V extends string | number = string> extends CommonProps {
|
|
4
4
|
/**
|
|
5
5
|
* The label of the radio item.
|
|
6
6
|
*/
|
|
@@ -8,7 +8,7 @@ export interface RadioItemProps extends CommonProps {
|
|
|
8
8
|
/**
|
|
9
9
|
* The value of the radio item.
|
|
10
10
|
*/
|
|
11
|
-
value:
|
|
11
|
+
value: V;
|
|
12
12
|
/**
|
|
13
13
|
* The description of the radio item.
|
|
14
14
|
*/
|
|
@@ -20,4 +20,4 @@ export interface RadioItemProps extends CommonProps {
|
|
|
20
20
|
* @param {RadioItemProps} props - The props for the RadioItem component
|
|
21
21
|
* @returns {JSX.Element} RadioItem component
|
|
22
22
|
*/
|
|
23
|
-
export declare const RadioItem: ({ label, value, dataTestId, className, description }: RadioItemProps) => JSX.Element;
|
|
23
|
+
export declare const RadioItem: <V extends string | number>({ label, value, dataTestId, className, description, }: RadioItemProps<V>) => JSX.Element;
|