@vectara/vectara-ui 16.0.0 → 16.0.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.
|
@@ -33,5 +33,5 @@ export const VuiFormGroup = ({ children, labelFor, helpText, label, labelSize =
|
|
|
33
33
|
cloneProps.isInvalid = errors && errors.length > 0;
|
|
34
34
|
}
|
|
35
35
|
const content = cloneElement(children, cloneProps);
|
|
36
|
-
return (_jsxs("div", { children: [_jsxs(VuiLabel, Object.assign({ labelFor: labelFor, size: labelSize }, { children: [label, isRequired && " (required)"] })), _jsx(VuiSpacer, { size: labelSize === "s" ? "xs" : "xxs" }), helpText && (_jsxs(_Fragment, { children: [_jsx(VuiText, Object.assign({ size: "xs", id: ariaDescribedByLabel }, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: "subdued" }, { children: helpText })) }) })), _jsx(VuiSpacer, { size: "xs" })] })), errorMessages && (_jsxs(_Fragment, { children: [errorMessages, _jsx(VuiSpacer, { size: "xs" })] })), content] }));
|
|
36
|
+
return (_jsxs("div", { children: [label && (_jsxs(_Fragment, { children: [_jsxs(VuiLabel, Object.assign({ labelFor: labelFor, size: labelSize }, { children: [label, isRequired && " (required)"] })), _jsx(VuiSpacer, { size: labelSize === "s" ? "xs" : "xxs" })] })), helpText && (_jsxs(_Fragment, { children: [_jsx(VuiText, Object.assign({ size: "xs", id: ariaDescribedByLabel }, { children: _jsx("p", { children: _jsx(VuiTextColor, Object.assign({ color: "subdued" }, { children: helpText })) }) })), _jsx(VuiSpacer, { size: "xs" })] })), errorMessages && (_jsxs(_Fragment, { children: [errorMessages, _jsx(VuiSpacer, { size: "xs" })] })), content] }));
|
|
37
37
|
};
|
package/package.json
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { VuiFormGroup, VuiSpacer, VuiTextInput, VuiToggle } from "../../../lib";
|
|
3
|
+
|
|
4
|
+
export const NoLabel = () => {
|
|
5
|
+
const [showError, setShowError] = useState(false);
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<>
|
|
9
|
+
<VuiToggle label="Show error message" onChange={(e) => setShowError(e.target.checked)} />
|
|
10
|
+
|
|
11
|
+
<VuiSpacer size="m" />
|
|
12
|
+
|
|
13
|
+
<VuiFormGroup errors={showError ? ["This is an error message."] : []}>
|
|
14
|
+
<VuiTextInput value="Text input" onChange={() => undefined} />
|
|
15
|
+
</VuiFormGroup>
|
|
16
|
+
</>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { FormGroup } from "./FormGroup";
|
|
2
2
|
import { NonFormElement } from "./NonFormElement";
|
|
3
|
+
import { NoLabel } from "./NoLabel";
|
|
3
4
|
import { Size } from "./Size";
|
|
4
5
|
|
|
5
6
|
const FormGroupSource = require("!!raw-loader!./FormGroup");
|
|
6
7
|
const NonFormElementSource = require("!!raw-loader!./NonFormElement");
|
|
8
|
+
const NoLabelSource = require("!!raw-loader!./NoLabel");
|
|
7
9
|
const SizeSource = require("!!raw-loader!./Size");
|
|
8
10
|
|
|
9
11
|
export const formGroup = {
|
|
@@ -20,6 +22,11 @@ export const formGroup = {
|
|
|
20
22
|
component: <NonFormElement />,
|
|
21
23
|
source: NonFormElementSource.default.toString()
|
|
22
24
|
},
|
|
25
|
+
{
|
|
26
|
+
name: "Without label",
|
|
27
|
+
component: <NoLabel />,
|
|
28
|
+
source: NoLabelSource.default.toString()
|
|
29
|
+
},
|
|
23
30
|
{
|
|
24
31
|
name: "Label size",
|
|
25
32
|
component: <Size />,
|