@thecb/components 9.0.4-beta.4 → 9.0.4
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 +8 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +8 -10
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/atoms/alert/Alert.js +1 -1
- package/src/components/atoms/form-layouts/FormInput.js +25 -25
- package/src/components/molecules/partial-amount-form/PartialAmountForm.stories.js +0 -146
package/package.json
CHANGED
|
@@ -95,8 +95,8 @@ const Alert = ({
|
|
|
95
95
|
borderSize={noBorder ? "0px" : "1px"}
|
|
96
96
|
boxShadow={enableBoxShadow ? generateShadows()?.inset?.base : ""}
|
|
97
97
|
extraStyles={extraStyles}
|
|
98
|
+
aria-live={ariaLive}
|
|
98
99
|
{...(ariaAtomic !== null ? { "aria-atomic": ariaAtomic } : {})}
|
|
99
|
-
{...(ariaLive !== null ? { "aria-live": ariaLive } : {})}
|
|
100
100
|
{...(ariaRole !== null ? { role: ariaRole } : {})}
|
|
101
101
|
>
|
|
102
102
|
{maxContentWidth ? (
|
|
@@ -251,31 +251,31 @@ const FormInput = ({
|
|
|
251
251
|
/>
|
|
252
252
|
)}
|
|
253
253
|
</Box>
|
|
254
|
-
<
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
</
|
|
278
|
-
</
|
|
254
|
+
<Stack
|
|
255
|
+
direction="row"
|
|
256
|
+
justify="space-between"
|
|
257
|
+
aria-live="polite"
|
|
258
|
+
aria-atomic={true}
|
|
259
|
+
>
|
|
260
|
+
{(field.hasErrors && field.dirty) || (field.hasErrors && showErrors) ? (
|
|
261
|
+
<Text
|
|
262
|
+
color={ERROR_COLOR}
|
|
263
|
+
variant="pXS"
|
|
264
|
+
weight={themeValues.fontWeight}
|
|
265
|
+
extraStyles={`word-break: break-word;
|
|
266
|
+
font-family: Public Sans;
|
|
267
|
+
&::first-letter {
|
|
268
|
+
text-transform: uppercase;
|
|
269
|
+
}`}
|
|
270
|
+
id={createIdFromString(labelTextWhenNoError, "error message")}
|
|
271
|
+
>
|
|
272
|
+
{errorMessages[field.errors[0]]}
|
|
273
|
+
</Text>
|
|
274
|
+
) : (
|
|
275
|
+
<Text extraStyles={`height: ${themeValues.lineHeight};`} />
|
|
276
|
+
)}
|
|
277
|
+
{!isMobile && decorator && <Box padding="0 0 0 auto">{decorator}</Box>}
|
|
278
|
+
</Stack>
|
|
279
279
|
</Stack>
|
|
280
280
|
);
|
|
281
281
|
};
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { connect } from "react-redux";
|
|
3
|
-
import { boolean } from "@storybook/addon-knobs";
|
|
4
|
-
import { createFormState, required } from "redux-freeform";
|
|
5
|
-
import PartialAmountForm from "./PartialAmountForm";
|
|
6
|
-
import page from "../../../../.storybook/page";
|
|
7
|
-
import * as PartialAmountFormState from "./PartialAmountForm.state";
|
|
8
|
-
|
|
9
|
-
const { mapStateToProps, mapDispatchToProps, reducer } = createFormState({
|
|
10
|
-
thing: {
|
|
11
|
-
validators: [required()]
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
const errorMessages = {
|
|
15
|
-
[required.error]: "thing is required"
|
|
16
|
-
};
|
|
17
|
-
const partialAmountFormFields = {
|
|
18
|
-
"3cd98097-1c95-43c6-848a-d44f95d312ec": {
|
|
19
|
-
dirty: false,
|
|
20
|
-
rawValue: "5000",
|
|
21
|
-
validators: [
|
|
22
|
-
{
|
|
23
|
-
type: "validator/REQUIRED",
|
|
24
|
-
args: [],
|
|
25
|
-
error: "error/REQUIRED"
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
type: "validator/VALIDATE_SUM",
|
|
29
|
-
args: [
|
|
30
|
-
{
|
|
31
|
-
type: "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO",
|
|
32
|
-
args: [1],
|
|
33
|
-
error: "error/NUMBER_GREATER_THAN_OR_EQUAL_TO"
|
|
34
|
-
},
|
|
35
|
-
[
|
|
36
|
-
"ff4b6d84-7f6a-4692-8d50-05eab56a6351",
|
|
37
|
-
"4396e95d-e0eb-44e6-8691-f94d72c2f7e7"
|
|
38
|
-
]
|
|
39
|
-
],
|
|
40
|
-
error: "error/NUMBER_GREATER_THAN_OR_EQUAL_TO"
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
type: "validator/VALIDATE_SUM",
|
|
44
|
-
args: [
|
|
45
|
-
{
|
|
46
|
-
type: "validator/NUMBER_LESS_THAN_OR_EQUAL_TO",
|
|
47
|
-
args: [50000],
|
|
48
|
-
error: "error/NUMBER_LESS_THAN_OR_EQUAL_TO"
|
|
49
|
-
},
|
|
50
|
-
[
|
|
51
|
-
"ff4b6d84-7f6a-4692-8d50-05eab56a6351",
|
|
52
|
-
"4396e95d-e0eb-44e6-8691-f94d72c2f7e7"
|
|
53
|
-
]
|
|
54
|
-
],
|
|
55
|
-
error: "error/NUMBER_LESS_THAN_OR_EQUAL_TO"
|
|
56
|
-
}
|
|
57
|
-
],
|
|
58
|
-
constraints: [
|
|
59
|
-
{
|
|
60
|
-
type: "validator/ONLY_NATURALS",
|
|
61
|
-
args: [],
|
|
62
|
-
error: "error/ONLY_NATURALS"
|
|
63
|
-
}
|
|
64
|
-
],
|
|
65
|
-
errors: ["error/NUMBER_LESS_THAN_OR_EQUAL_TO"],
|
|
66
|
-
hasErrors: true,
|
|
67
|
-
id: "3cd98097-1c95-43c6-848a-d44f95d312ec"
|
|
68
|
-
},
|
|
69
|
-
"ff4b6d84-7f6a-4692-8d50-05eab56a6351": {
|
|
70
|
-
dirty: false,
|
|
71
|
-
rawValue: "25000",
|
|
72
|
-
id: "ff4b6d84-7f6a-4692-8d50-05eab56a6351",
|
|
73
|
-
validators: [
|
|
74
|
-
{
|
|
75
|
-
type: "validator/REQUIRED",
|
|
76
|
-
args: [],
|
|
77
|
-
error: "error/REQUIRED"
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
type: "validator/VALIDATE_SUM",
|
|
81
|
-
args: [
|
|
82
|
-
{
|
|
83
|
-
type: "validator/NUMBER_GREATER_THAN_OR_EQUAL_TO",
|
|
84
|
-
args: [1],
|
|
85
|
-
error: "error/NUMBER_GREATER_THAN_OR_EQUAL_TO"
|
|
86
|
-
},
|
|
87
|
-
[
|
|
88
|
-
"3cd98097-1c95-43c6-848a-d44f95d312ec",
|
|
89
|
-
"4396e95d-e0eb-44e6-8691-f94d72c2f7e7"
|
|
90
|
-
]
|
|
91
|
-
],
|
|
92
|
-
error: "error/NUMBER_GREATER_THAN_OR_EQUAL_TO"
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
type: "validator/VALIDATE_SUM",
|
|
96
|
-
args: [
|
|
97
|
-
{
|
|
98
|
-
type: "validator/NUMBER_LESS_THAN_OR_EQUAL_TO",
|
|
99
|
-
args: [50000],
|
|
100
|
-
error: "error/NUMBER_LESS_THAN_OR_EQUAL_TO"
|
|
101
|
-
},
|
|
102
|
-
[
|
|
103
|
-
"3cd98097-1c95-43c6-848a-d44f95d312ec",
|
|
104
|
-
"4396e95d-e0eb-44e6-8691-f94d72c2f7e7"
|
|
105
|
-
]
|
|
106
|
-
],
|
|
107
|
-
error: "error/NUMBER_LESS_THAN_OR_EQUAL_TO"
|
|
108
|
-
}
|
|
109
|
-
],
|
|
110
|
-
constraints: [
|
|
111
|
-
{
|
|
112
|
-
type: "validator/ONLY_NATURALS",
|
|
113
|
-
args: [],
|
|
114
|
-
error: "error/ONLY_NATURALS"
|
|
115
|
-
}
|
|
116
|
-
],
|
|
117
|
-
errors: ["error/NUMBER_LESS_THAN_OR_EQUAL_TO"],
|
|
118
|
-
hasErrors: true
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
const options = [
|
|
122
|
-
{ value: "", text: "choose name" },
|
|
123
|
-
{ value: "foo", text: "foo" },
|
|
124
|
-
{ value: "bar", text: "bar" },
|
|
125
|
-
{ value: "baz", text: "baz" },
|
|
126
|
-
{ value: "disabled", text: "disabled" }
|
|
127
|
-
];
|
|
128
|
-
const story = page({
|
|
129
|
-
title: "Components|Molecules/PartialAmountForm",
|
|
130
|
-
Component: PartialAmountForm,
|
|
131
|
-
reducer: PartialAmountFormState.reducer,
|
|
132
|
-
mapStateToProps: PartialAmountFormState.mapStateToProps,
|
|
133
|
-
mapDispatchToProps: PartialAmountFormState.mapDispatchToProps
|
|
134
|
-
});
|
|
135
|
-
export default story;
|
|
136
|
-
|
|
137
|
-
const ConnectedPartialAmountForm = connect(
|
|
138
|
-
PartialAmountFormState.mapStateToProps,
|
|
139
|
-
PartialAmountFormState.mapDispatchToProps
|
|
140
|
-
)(PartialAmountForm);
|
|
141
|
-
export const partialAmountForm = () => (
|
|
142
|
-
<ConnectedPartialAmountForm
|
|
143
|
-
showErrors={boolean("showErrors", false, "props")}
|
|
144
|
-
lineItems={options}
|
|
145
|
-
/>
|
|
146
|
-
);
|