@torq-north/react-tools 1.4.4 → 1.4.5
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/dist/index.cjs
CHANGED
|
@@ -562,11 +562,11 @@ var RadioFormField = function (_a) {
|
|
|
562
562
|
var _c = reactFinalForm.useField(name, __assign({ validate: required
|
|
563
563
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)).meta, error = _c.error, visited = _c.visited;
|
|
564
564
|
return (jsxRuntime.jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxRuntime.jsxs(material.FormControl, { required: required, children: [label && (jsxRuntime.jsx(material.FormLabel, { id: "".concat(name, "-radio-buttons-group-label"), disabled: disabled, children: label })), jsxRuntime.jsx(material.RadioGroup, { "aria-labelledby": "".concat(name, "-radio-buttons-group-label"), row: !vertical, children: options.map(function (o) {
|
|
565
|
-
var _a
|
|
565
|
+
var _a;
|
|
566
566
|
return (jsxRuntime.jsx(material.FormControlLabel, { label: typeof o === "string" ? o : ((_a = o.text) !== null && _a !== void 0 ? _a : o.value), disabled: disabled, control: jsxRuntime.jsx(reactFinalForm.Field, __assign({ name: name, value: typeof o === "string" ? o : o.value, type: "radio", render: function (_a) {
|
|
567
567
|
var input = _a.input, meta = _a.meta;
|
|
568
568
|
return (jsxRuntime.jsx(RadioOption, { input: input, meta: meta, disabled: disabled, required: required, radioProps: slotProps === null || slotProps === void 0 ? void 0 : slotProps.radio }));
|
|
569
|
-
} }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.radioField)) }, typeof o === "string" ? o :
|
|
569
|
+
} }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.radioField)) }, typeof o === "string" ? o : o.value));
|
|
570
570
|
}) }), (((visited || disabled) && error) || helperText) && (jsxRuntime.jsx(material.FormHelperText, { error: error != null || forceError, sx: { marginTop: 0 }, children: error || helperText }))] }) }));
|
|
571
571
|
};
|
|
572
572
|
|
package/dist/index.es.js
CHANGED
|
@@ -560,11 +560,11 @@ var RadioFormField = function (_a) {
|
|
|
560
560
|
var _c = useField(name, __assign({ validate: required
|
|
561
561
|
? composeValidators.apply(void 0, __spreadArray(__spreadArray([], validators, false), [isRequired], false)) : composeValidators.apply(void 0, validators) }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.field)).meta, error = _c.error, visited = _c.visited;
|
|
562
562
|
return (jsx(FieldWrapper, { icon: icon, showSpace: showSpace, children: jsxs(FormControl, { required: required, children: [label && (jsx(FormLabel, { id: "".concat(name, "-radio-buttons-group-label"), disabled: disabled, children: label })), jsx(RadioGroup, { "aria-labelledby": "".concat(name, "-radio-buttons-group-label"), row: !vertical, children: options.map(function (o) {
|
|
563
|
-
var _a
|
|
563
|
+
var _a;
|
|
564
564
|
return (jsx(FormControlLabel, { label: typeof o === "string" ? o : ((_a = o.text) !== null && _a !== void 0 ? _a : o.value), disabled: disabled, control: jsx(Field, __assign({ name: name, value: typeof o === "string" ? o : o.value, type: "radio", render: function (_a) {
|
|
565
565
|
var input = _a.input, meta = _a.meta;
|
|
566
566
|
return (jsx(RadioOption, { input: input, meta: meta, disabled: disabled, required: required, radioProps: slotProps === null || slotProps === void 0 ? void 0 : slotProps.radio }));
|
|
567
|
-
} }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.radioField)) }, typeof o === "string" ? o :
|
|
567
|
+
} }, slotProps === null || slotProps === void 0 ? void 0 : slotProps.radioField)) }, typeof o === "string" ? o : o.value));
|
|
568
568
|
}) }), (((visited || disabled) && error) || helperText) && (jsx(FormHelperText, { error: error != null || forceError, sx: { marginTop: 0 }, children: error || helperText }))] }) }));
|
|
569
569
|
};
|
|
570
570
|
|
|
@@ -4,7 +4,7 @@ import { FieldProps } from "react-final-form";
|
|
|
4
4
|
import { CommonFieldProps } from "../Types";
|
|
5
5
|
export interface RadioFormFieldOption {
|
|
6
6
|
value: string | number;
|
|
7
|
-
text?:
|
|
7
|
+
text?: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
export interface RadioFormFieldProps extends CommonFieldProps<{
|
|
10
10
|
radio?: RadioProps;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { UseFieldConfig } from "react-final-form";
|
|
2
2
|
import { FieldWrapperProps } from "../Components";
|
|
3
3
|
import type { Validator } from "./Validator";
|
|
4
|
+
import React from "react";
|
|
4
5
|
export interface CommonFieldProps<AdditionalSlotProps = {}> extends Omit<FieldWrapperProps, "children"> {
|
|
5
6
|
name: string;
|
|
6
|
-
label?:
|
|
7
|
+
label?: React.ReactNode;
|
|
7
8
|
required?: boolean;
|
|
8
9
|
disabled?: boolean;
|
|
9
10
|
helperText?: string;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import React from "react";
|
|
1
2
|
export interface SelectFormFieldOption {
|
|
2
3
|
value?: number | string;
|
|
3
4
|
text: React.ReactNode;
|
|
4
|
-
subText?:
|
|
5
|
+
subText?: React.ReactNode;
|
|
5
6
|
disabled?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface GroupedSelectFormFieldOptions {
|
|
8
|
-
group?:
|
|
9
|
+
group?: React.ReactNode;
|
|
9
10
|
options: (SelectFormFieldOption | string)[];
|
|
10
11
|
}
|
|
11
12
|
export declare function isGroup(o: SelectFormFieldOption | GroupedSelectFormFieldOptions | string): o is GroupedSelectFormFieldOptions;
|
|
12
|
-
export declare function renderSelectOptions(options: (SelectFormFieldOption | GroupedSelectFormFieldOptions | string)[]): (string | number | bigint | boolean |
|
|
13
|
-
export declare function renderCheckboxSelectOptions(options: (SelectFormFieldOption | GroupedSelectFormFieldOptions | string)[], values: (string | number | undefined)[]): (string | number | bigint | boolean |
|
|
13
|
+
export declare function renderSelectOptions(options: (SelectFormFieldOption | GroupedSelectFormFieldOptions | string)[]): (string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined)[];
|
|
14
|
+
export declare function renderCheckboxSelectOptions(options: (SelectFormFieldOption | GroupedSelectFormFieldOptions | string)[], values: (string | number | undefined)[]): (string | number | bigint | boolean | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | null | undefined)[];
|
|
14
15
|
export declare function buildCheckboxOption(option: string | SelectFormFieldOption | GroupedSelectFormFieldOptions, values: (string | number | undefined)[]): React.ReactNode | React.ReactNode[];
|