@uxf/ui 1.0.0-beta.42 → 1.0.0-beta.43
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.
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ReactElement, ReactNode } from "react";
|
|
2
|
-
interface FormControlProps {
|
|
1
|
+
import React, { ReactElement, ReactNode } from "react";
|
|
2
|
+
export interface FormControlProps {
|
|
3
3
|
children?: ReactElement;
|
|
4
4
|
className?: string;
|
|
5
5
|
errorId?: string;
|
|
@@ -9,5 +9,4 @@ interface FormControlProps {
|
|
|
9
9
|
isRequired?: boolean;
|
|
10
10
|
label?: ReactNode;
|
|
11
11
|
}
|
|
12
|
-
export declare
|
|
13
|
-
export {};
|
|
12
|
+
export declare const FormControl: React.ForwardRefExoticComponent<FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -4,16 +4,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.FormControl = void 0;
|
|
7
|
+
const classes_1 = require("@uxf/core/constants/classes");
|
|
8
|
+
const cx_1 = require("@uxf/core/utils/cx");
|
|
7
9
|
const react_1 = __importDefault(require("react"));
|
|
8
10
|
const label_1 = require("../label");
|
|
9
|
-
const
|
|
10
|
-
const classes_1 = require("@uxf/core/constants/classes");
|
|
11
|
+
const forward_ref_1 = require("../utils/forward-ref");
|
|
11
12
|
// TODO - tohle asi ještě nějak předělám (ten interface je trochu nelogickej)
|
|
12
|
-
|
|
13
|
+
exports.FormControl = (0, forward_ref_1.forwardRef)("FormControl", (props, ref) => {
|
|
13
14
|
const helperTextClassName = (0, cx_1.cx)("uxf-helper-text", props.errorId && classes_1.CLASSES.IS_INVALID);
|
|
14
|
-
return (react_1.default.createElement("div", { className: props.className },
|
|
15
|
+
return (react_1.default.createElement("div", { className: props.className, ref: ref },
|
|
15
16
|
react_1.default.createElement(label_1.Label, { isRequired: props.isRequired, htmlFor: props.inputId, form: props.form }, props.label),
|
|
16
17
|
props.children,
|
|
17
18
|
props.helperText && (react_1.default.createElement("div", { className: helperTextClassName, id: props.errorId }, props.helperText))));
|
|
18
|
-
}
|
|
19
|
-
exports.FormControl = FormControl;
|
|
19
|
+
});
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import { FormControl } from "./form-control";
|
|
1
|
+
import React from "react";
|
|
3
2
|
declare const _default: {
|
|
4
3
|
title: string;
|
|
5
|
-
component:
|
|
4
|
+
component: React.ForwardRefExoticComponent<import("./form-control").FormControlProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
5
|
parameters: {
|
|
7
6
|
actions: {
|
|
8
7
|
argTypesRegex: string;
|