@thecb/components 10.11.1 → 10.11.2-beta.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/dist/index.cjs.js +36 -22
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.esm.js +36 -22
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +6 -4
- package/src/components/atoms/form-layouts/FormInput.stories.js +33 -0
- package/src/components/atoms/form-layouts/index.d.ts +5 -0
- package/src/components/atoms/form-select/FormSelect.js +5 -3
- package/src/components/atoms/form-select/index.d.ts +3 -0
- package/src/components/molecules/radio-group/RadioGroup.js +8 -3
- package/src/components/molecules/radio-group/RadioGroup.stories.js +1 -0
- package/src/components/molecules/radio-group/index.d.ts +1 -0
- package/src/components/atoms/.DS_Store +0 -0
package/package.json
CHANGED
|
@@ -119,6 +119,8 @@ const FormInput = ({
|
|
|
119
119
|
isRequired = false,
|
|
120
120
|
errorFieldExtraStyles,
|
|
121
121
|
showFieldErrorRow = true,
|
|
122
|
+
labelTextVariant = "pS",
|
|
123
|
+
errorTextVariant = "pXS",
|
|
122
124
|
...props
|
|
123
125
|
}) => {
|
|
124
126
|
const [showPassword, setShowPassword] = useState(false);
|
|
@@ -148,7 +150,7 @@ const FormInput = ({
|
|
|
148
150
|
<Text
|
|
149
151
|
as="label"
|
|
150
152
|
color={themeValues.labelColor}
|
|
151
|
-
variant=
|
|
153
|
+
variant={labelTextVariant}
|
|
152
154
|
weight={themeValues.fontWeight}
|
|
153
155
|
extraStyles={`word-break: break-word;
|
|
154
156
|
font-family: Public Sans;
|
|
@@ -167,7 +169,7 @@ const FormInput = ({
|
|
|
167
169
|
<Text
|
|
168
170
|
as="label"
|
|
169
171
|
color={themeValues.labelColor}
|
|
170
|
-
variant=
|
|
172
|
+
variant={labelTextVariant}
|
|
171
173
|
fontWeight={themeValues.fontWeight}
|
|
172
174
|
extraStyles={`word-break: break-word;
|
|
173
175
|
font-family: Public Sans;
|
|
@@ -180,7 +182,7 @@ const FormInput = ({
|
|
|
180
182
|
</Text>
|
|
181
183
|
{type === "password" && (
|
|
182
184
|
<Text
|
|
183
|
-
variant=
|
|
185
|
+
variant={labelTextVariant}
|
|
184
186
|
color={themeValues.linkColor}
|
|
185
187
|
weight={themeValues.fontWeight}
|
|
186
188
|
hoverStyles={themeValues.hoverFocusStyles}
|
|
@@ -282,7 +284,7 @@ const FormInput = ({
|
|
|
282
284
|
(field.hasErrors && showErrors) ? (
|
|
283
285
|
<Text
|
|
284
286
|
color={ERROR_COLOR}
|
|
285
|
-
variant=
|
|
287
|
+
variant={errorTextVariant}
|
|
286
288
|
weight={themeValues.fontWeight}
|
|
287
289
|
extraStyles={`word-break: break-word;
|
|
288
290
|
font-family: Public Sans;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { text } from "@storybook/addon-knobs";
|
|
3
|
+
import FormInput from "./FormInput";
|
|
4
|
+
import { Box } from "../layouts";
|
|
5
|
+
import page from "../../../../.storybook/page";
|
|
6
|
+
const data = {
|
|
7
|
+
fieldOne: {
|
|
8
|
+
rawValue: "Form Input One"
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export const formInputs = () => {
|
|
12
|
+
return (
|
|
13
|
+
<Box padding="1rem">
|
|
14
|
+
<FormInput
|
|
15
|
+
labelTextWhenNoError={text(
|
|
16
|
+
"labelTextWhenNoError",
|
|
17
|
+
"Label Text When No Error",
|
|
18
|
+
"props"
|
|
19
|
+
)}
|
|
20
|
+
type="text"
|
|
21
|
+
labelTextVariant={text("labelTextVariant", "pS", "props")}
|
|
22
|
+
errorLabelTextVariant={text("errorLabelTextVariant", "pS", "props")}
|
|
23
|
+
field={data.fieldOne}
|
|
24
|
+
/>
|
|
25
|
+
</Box>
|
|
26
|
+
);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const story = page({
|
|
30
|
+
title: "Components|Atoms/FormInput",
|
|
31
|
+
Component: FormInput
|
|
32
|
+
});
|
|
33
|
+
export default story;
|
|
@@ -26,6 +26,11 @@ export interface FormInputProps {
|
|
|
26
26
|
autocompleteValue?: string;
|
|
27
27
|
removeFromValue?: RegExp;
|
|
28
28
|
dataQa?: string | null;
|
|
29
|
+
isRequired?: boolean;
|
|
30
|
+
errorFieldExtraStyles?: string;
|
|
31
|
+
showFieldErrorRow?: boolean;
|
|
32
|
+
labelTextVariant?: string;
|
|
33
|
+
errorTextVariant?: string;
|
|
29
34
|
}
|
|
30
35
|
|
|
31
36
|
export const FormInput: React.FC<Expand<FormInputProps> &
|
|
@@ -25,7 +25,9 @@ const FormSelect = ({
|
|
|
25
25
|
smoothScroll = true, // whether the browser should animate scroll to selected item on first open
|
|
26
26
|
dataQa = null,
|
|
27
27
|
widthFitOptions = false,
|
|
28
|
-
isRequired = false
|
|
28
|
+
isRequired = false,
|
|
29
|
+
labelTextVariant = "pS",
|
|
30
|
+
errorLabelTextVariant = "pXS"
|
|
29
31
|
}) => {
|
|
30
32
|
const [open, setOpen] = useState(false);
|
|
31
33
|
const dropdownRef = useRef(null);
|
|
@@ -54,7 +56,7 @@ const FormSelect = ({
|
|
|
54
56
|
<Cluster justify="space-between" align="center">
|
|
55
57
|
<Text
|
|
56
58
|
as="label"
|
|
57
|
-
variant=
|
|
59
|
+
variant={labelTextVariant}
|
|
58
60
|
color={themeValues.labelColor}
|
|
59
61
|
weight={themeValues.fontWeight}
|
|
60
62
|
extraStyles={`word-break: break-word;
|
|
@@ -101,7 +103,7 @@ const FormSelect = ({
|
|
|
101
103
|
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
102
104
|
<Text
|
|
103
105
|
color={ERROR_COLOR}
|
|
104
|
-
variant=
|
|
106
|
+
variant={errorLabelTextVariant}
|
|
105
107
|
weight={themeValues.fontWeight}
|
|
106
108
|
extraStyles={`
|
|
107
109
|
word-break: break-word;
|
|
@@ -24,6 +24,9 @@ export interface FormSelectProps {
|
|
|
24
24
|
smoothScroll?: boolean;
|
|
25
25
|
dataQa?: string | null;
|
|
26
26
|
widthFitOptions?: boolean;
|
|
27
|
+
isRequired?: boolean;
|
|
28
|
+
labelTextVariant?: string;
|
|
29
|
+
errorLabelTextVariant?: string;
|
|
27
30
|
}
|
|
28
31
|
|
|
29
32
|
export const FormSelect: React.FC<Expand<FormSelectProps> &
|
|
@@ -6,8 +6,8 @@ import styled from "styled-components";
|
|
|
6
6
|
import { noop } from "../../../util/general";
|
|
7
7
|
|
|
8
8
|
const DefaultHeading = styled.div`
|
|
9
|
-
font-size:
|
|
10
|
-
color: ${colors.CHARADE_GREY}
|
|
9
|
+
${({ fontSize }) => `font-size: ${fontSize};`}
|
|
10
|
+
color: ${colors.CHARADE_GREY};
|
|
11
11
|
margin: 0;
|
|
12
12
|
padding: 8px 0px;
|
|
13
13
|
`;
|
|
@@ -19,8 +19,13 @@ const StyledFieldset = styled.fieldset`
|
|
|
19
19
|
const RadioGroup = ({
|
|
20
20
|
headingText,
|
|
21
21
|
groupName,
|
|
22
|
+
headingFontSize = "0.875rem",
|
|
22
23
|
heading: Heading = (
|
|
23
|
-
<DefaultHeading
|
|
24
|
+
<DefaultHeading
|
|
25
|
+
role="heading"
|
|
26
|
+
id={`radio-group-${groupName}-heading`}
|
|
27
|
+
fontSize={headingFontSize}
|
|
28
|
+
>
|
|
24
29
|
{headingText}
|
|
25
30
|
</DefaultHeading>
|
|
26
31
|
),
|
|
Binary file
|