@thecb/components 10.1.0-beta.0 → 10.1.1-beta.0
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 +22 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +22 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.js +3 -1
- package/src/components/atoms/button-with-action/ButtonWithAction.stories.js +4 -1
- package/src/components/atoms/button-with-link/ButtonWithLink.js +5 -1
- package/src/components/atoms/checkbox/Checkbox.js +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +7 -1
- package/src/components/atoms/layouts/Box.styled.js +15 -0
package/package.json
CHANGED
|
@@ -68,6 +68,7 @@ const ButtonWithAction = forwardRef(
|
|
|
68
68
|
text,
|
|
69
69
|
textWrap = false,
|
|
70
70
|
isLoading = false,
|
|
71
|
+
disabled = false,
|
|
71
72
|
loadingColor = "white",
|
|
72
73
|
dataQa = null,
|
|
73
74
|
textExtraStyles,
|
|
@@ -132,8 +133,9 @@ const ButtonWithAction = forwardRef(
|
|
|
132
133
|
hoverStyles={hoverStyles}
|
|
133
134
|
activeStyles={activeStyles}
|
|
134
135
|
disabledStyles={disabledStyles}
|
|
136
|
+
aria-disabled={disabled}
|
|
135
137
|
as="button"
|
|
136
|
-
onClick={isLoading ? undefined : action}
|
|
138
|
+
onClick={isLoading || disabled ? undefined : action}
|
|
137
139
|
borderRadius="2px"
|
|
138
140
|
theme={themeContext}
|
|
139
141
|
extraStyles={`margin: 0.5rem; ${extraStyles}`}
|
|
@@ -18,12 +18,15 @@ const variants = {
|
|
|
18
18
|
const defaultValue = "primary";
|
|
19
19
|
const groupId = "props";
|
|
20
20
|
|
|
21
|
+
const buttonHandler = () => console.log("Button selected");
|
|
22
|
+
|
|
21
23
|
export const buttonWithAction = () => (
|
|
22
24
|
<ButtonWithAction
|
|
23
25
|
variant={select(variantsLabel, variants, defaultValue, groupId)}
|
|
24
26
|
text={text("text", "button", "props")}
|
|
25
27
|
isLoading={boolean("isLoading", false, "props")}
|
|
26
|
-
action={text("action",
|
|
28
|
+
action={text("action", buttonHandler, "props")}
|
|
29
|
+
disabled={boolean("disabled", false, "props")}
|
|
27
30
|
/>
|
|
28
31
|
);
|
|
29
32
|
|
|
@@ -57,7 +57,11 @@ const ButtonWithLink = ({
|
|
|
57
57
|
text-decoration: none; }`}
|
|
58
58
|
dataQa={dataQa}
|
|
59
59
|
>
|
|
60
|
-
<ButtonWithAction
|
|
60
|
+
<ButtonWithAction
|
|
61
|
+
{...otherProps}
|
|
62
|
+
disabled={disabled}
|
|
63
|
+
extraStyles={extraStyles}
|
|
64
|
+
/>
|
|
61
65
|
</ButtonWithLinkWrapper>
|
|
62
66
|
);
|
|
63
67
|
};
|
|
@@ -7,7 +7,7 @@ import Box from "../layouts/Box";
|
|
|
7
7
|
import Text from "../text";
|
|
8
8
|
import { themeComponent } from "../../../util/themeUtils";
|
|
9
9
|
|
|
10
|
-
const CheckboxContainer = styled.
|
|
10
|
+
const CheckboxContainer = styled.div`
|
|
11
11
|
display: inline-block;
|
|
12
12
|
vertical-align: middle;
|
|
13
13
|
`;
|
|
@@ -147,7 +147,13 @@ const FormInput = ({
|
|
|
147
147
|
>
|
|
148
148
|
{labelTextWhenNoError}
|
|
149
149
|
</Text>
|
|
150
|
-
|
|
150
|
+
<Text
|
|
151
|
+
color={themeValues.linkColor}
|
|
152
|
+
variant="pS"
|
|
153
|
+
weight={themeValues.fontWeight}
|
|
154
|
+
>
|
|
155
|
+
{helperModal()}
|
|
156
|
+
</Text>
|
|
151
157
|
</Cluster>
|
|
152
158
|
) : (
|
|
153
159
|
<Box padding="0" minWidth="100%">
|
|
@@ -107,6 +107,21 @@ export const BoxWrapper = styled(
|
|
|
107
107
|
: ``}
|
|
108
108
|
`}
|
|
109
109
|
}
|
|
110
|
+
|
|
111
|
+
&[aria-disabled="true"] {
|
|
112
|
+
${({ disabledStyles, as }) =>
|
|
113
|
+
css`
|
|
114
|
+
${disabledStyles}
|
|
115
|
+
${as === "button"
|
|
116
|
+
? ` > * > span {
|
|
117
|
+
${disabledStyles}
|
|
118
|
+
border: none;
|
|
119
|
+
outline: none;
|
|
120
|
+
box-shadow: none;
|
|
121
|
+
}`
|
|
122
|
+
: ``}
|
|
123
|
+
`}
|
|
124
|
+
}
|
|
110
125
|
|
|
111
126
|
& * {
|
|
112
127
|
color: ${({ color }) => color};
|