@arquimedes.co/eureka-forms 2.0.24 → 2.0.25
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/@Types/Form.d.ts +1 -1
- package/dist/@Types/FormStep.d.ts +0 -1
- package/dist/App/App.d.ts +2 -0
- package/dist/App/App.js +1 -1
- package/dist/App/AppFunctions.js +2 -3
- package/dist/Form/Form.d.ts +3 -1
- package/dist/Form/Form.js +3 -3
- package/dist/Form/FormFunctions.d.ts +3 -0
- package/dist/Form/FormFunctions.js +19 -17
- package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -1
- package/dist/Form/FormTypes/StepperForm/StepperForm.js +3 -1
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +8 -4
- package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +50 -79
- package/dist/FormSteps/StepFunctions.d.ts +2 -2
- package/dist/FormSteps/StepFunctions.js +1 -1
- package/dist/Shared/Navbar/Navbar.stories.d.ts +13 -0
- package/dist/Shared/Navbar/Navbar.stories.js +13 -0
- package/dist/Shared/Rating/Rating.stories.d.ts +15 -0
- package/dist/Shared/Rating/Rating.stories.js +59 -0
- package/dist/Shared/RoundedButton/RoundedButton.stories.d.ts +23 -0
- package/dist/Shared/RoundedButton/RoundedButton.stories.js +36 -0
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.d.ts +21 -0
- package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.js +50 -0
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.d.ts +3 -2
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.js +3 -3
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.d.ts +36 -0
- package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.js +223 -0
- package/dist/Shared/RoundedSelect/RoundedSelect.stories.d.ts +28 -0
- package/dist/Shared/RoundedSelect/RoundedSelect.stories.js +91 -0
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -2
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +3 -3
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.d.ts +36 -0
- package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.js +318 -0
- package/dist/Shared/RoundedTextField/RoundedTextField.js +2 -2
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +13 -0
- package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +200 -1
- package/dist/Utils/TestUtils.d.ts +77 -0
- package/dist/Utils/TestUtils.js +65 -0
- package/dist/Utils/store.d.ts +2 -0
- package/dist/Utils/store.js +1 -1
- package/dist/__mocks__/axios.d.ts +2 -0
- package/dist/__mocks__/axios.js +2 -0
- package/dist/index.js +5 -1
- package/package.json +15 -1
- /package/dist/Form/{Hooks.d.ts → FormHooks.d.ts} +0 -0
- /package/dist/Form/{Hooks.js → FormHooks.js} +0 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import { useArgs } from '@storybook/preview-api';
|
|
50
|
+
import RoundedSmartSelect from './RoundedSmartSelect';
|
|
51
|
+
import { within, userEvent, screen } from '@storybook/testing-library';
|
|
52
|
+
var meta = {
|
|
53
|
+
component: RoundedSmartSelect,
|
|
54
|
+
tags: ['autodocs'],
|
|
55
|
+
args: {
|
|
56
|
+
searchable: false,
|
|
57
|
+
focusColor: '#3d5a7f',
|
|
58
|
+
helperTextColor: '#989898',
|
|
59
|
+
outlineColor: '#0000003b',
|
|
60
|
+
backgroundColor: '#ffffff',
|
|
61
|
+
color: '#293241',
|
|
62
|
+
readOnly: false,
|
|
63
|
+
borderRadius: 10,
|
|
64
|
+
fontSize: '1rem',
|
|
65
|
+
errorColor: '#cc2936',
|
|
66
|
+
fontWeight: '300',
|
|
67
|
+
cantEdit: false,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
export default meta;
|
|
71
|
+
export var Empty = {
|
|
72
|
+
args: {
|
|
73
|
+
label: 'Label',
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
export var Default = {
|
|
77
|
+
args: {
|
|
78
|
+
label: 'Label',
|
|
79
|
+
options: [
|
|
80
|
+
{
|
|
81
|
+
label: 'Option',
|
|
82
|
+
value: 'option',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
},
|
|
86
|
+
play: function (_a) {
|
|
87
|
+
var canvasElement = _a.canvasElement;
|
|
88
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
89
|
+
var canvas, selector, option;
|
|
90
|
+
return __generator(this, function (_b) {
|
|
91
|
+
switch (_b.label) {
|
|
92
|
+
case 0:
|
|
93
|
+
canvas = within(canvasElement);
|
|
94
|
+
selector = canvas.getByTestId('smart-select');
|
|
95
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
96
|
+
case 1:
|
|
97
|
+
_b.sent();
|
|
98
|
+
option = screen.getByTestId('smart-select-option');
|
|
99
|
+
return [4 /*yield*/, userEvent.click(option)];
|
|
100
|
+
case 2:
|
|
101
|
+
_b.sent();
|
|
102
|
+
return [2 /*return*/];
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
render: function Component(args) {
|
|
108
|
+
var _a = useArgs(), setArgs = _a[1];
|
|
109
|
+
var onValueChange = function (value) {
|
|
110
|
+
var _a;
|
|
111
|
+
(_a = args.handleUpdate) === null || _a === void 0 ? void 0 : _a.call(args, value);
|
|
112
|
+
setArgs({ value: value });
|
|
113
|
+
};
|
|
114
|
+
return (_jsx(RoundedSmartSelect, __assign({}, args, { ref: undefined, handleUpdate: onValueChange })));
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
export var Focused = {
|
|
118
|
+
args: {
|
|
119
|
+
label: 'Label',
|
|
120
|
+
},
|
|
121
|
+
play: function (_a) {
|
|
122
|
+
var canvasElement = _a.canvasElement;
|
|
123
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var canvas, selector, option;
|
|
125
|
+
return __generator(this, function (_b) {
|
|
126
|
+
switch (_b.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
canvas = within(canvasElement);
|
|
129
|
+
selector = canvas.getByTestId('smart-select');
|
|
130
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
131
|
+
case 1:
|
|
132
|
+
_b.sent();
|
|
133
|
+
option = screen.getByTestId('smart-select-empty');
|
|
134
|
+
return [4 /*yield*/, userEvent.click(option)];
|
|
135
|
+
case 2:
|
|
136
|
+
_b.sent();
|
|
137
|
+
return [2 /*return*/];
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
},
|
|
142
|
+
};
|
|
143
|
+
export var FocusedSearchable = {
|
|
144
|
+
args: {
|
|
145
|
+
label: 'Label',
|
|
146
|
+
searchable: true,
|
|
147
|
+
},
|
|
148
|
+
play: function (_a) {
|
|
149
|
+
var canvasElement = _a.canvasElement;
|
|
150
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
151
|
+
var canvas, selector;
|
|
152
|
+
return __generator(this, function (_b) {
|
|
153
|
+
switch (_b.label) {
|
|
154
|
+
case 0:
|
|
155
|
+
canvas = within(canvasElement);
|
|
156
|
+
selector = canvas.getByTestId('smart-select');
|
|
157
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
158
|
+
case 1:
|
|
159
|
+
_b.sent();
|
|
160
|
+
return [2 /*return*/];
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
});
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
export var SearchableWithOptions = {
|
|
167
|
+
args: {
|
|
168
|
+
label: 'Label',
|
|
169
|
+
searchable: true,
|
|
170
|
+
options: [
|
|
171
|
+
{
|
|
172
|
+
label: 'Option',
|
|
173
|
+
value: 'option',
|
|
174
|
+
},
|
|
175
|
+
],
|
|
176
|
+
},
|
|
177
|
+
play: function (_a) {
|
|
178
|
+
var canvasElement = _a.canvasElement;
|
|
179
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
180
|
+
var canvas, selector;
|
|
181
|
+
return __generator(this, function (_b) {
|
|
182
|
+
switch (_b.label) {
|
|
183
|
+
case 0:
|
|
184
|
+
canvas = within(canvasElement);
|
|
185
|
+
selector = canvas.getByTestId('smart-select');
|
|
186
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
187
|
+
case 1:
|
|
188
|
+
_b.sent();
|
|
189
|
+
return [2 /*return*/];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
});
|
|
193
|
+
},
|
|
194
|
+
};
|
|
195
|
+
export var SearchableWithSearchAndOptions = {
|
|
196
|
+
args: {
|
|
197
|
+
label: 'Label',
|
|
198
|
+
searchable: true,
|
|
199
|
+
value: 'Opt',
|
|
200
|
+
options: [
|
|
201
|
+
{
|
|
202
|
+
label: 'Option',
|
|
203
|
+
value: 'option',
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
},
|
|
207
|
+
play: function (_a) {
|
|
208
|
+
var canvasElement = _a.canvasElement;
|
|
209
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
210
|
+
var canvas, selector;
|
|
211
|
+
return __generator(this, function (_b) {
|
|
212
|
+
switch (_b.label) {
|
|
213
|
+
case 0:
|
|
214
|
+
canvas = within(canvasElement);
|
|
215
|
+
selector = canvas.getByTestId('smart-select');
|
|
216
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
217
|
+
case 1:
|
|
218
|
+
_b.sent();
|
|
219
|
+
return [2 /*return*/];
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
export var Loading = {
|
|
226
|
+
args: {
|
|
227
|
+
label: 'Label',
|
|
228
|
+
loading: true,
|
|
229
|
+
},
|
|
230
|
+
};
|
|
231
|
+
export var LoadingOpened = {
|
|
232
|
+
args: {
|
|
233
|
+
label: 'Label',
|
|
234
|
+
loading: true,
|
|
235
|
+
},
|
|
236
|
+
play: function (_a) {
|
|
237
|
+
var canvasElement = _a.canvasElement;
|
|
238
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
239
|
+
var canvas, selector;
|
|
240
|
+
return __generator(this, function (_b) {
|
|
241
|
+
switch (_b.label) {
|
|
242
|
+
case 0:
|
|
243
|
+
canvas = within(canvasElement);
|
|
244
|
+
selector = canvas.getByTestId('smart-select');
|
|
245
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
246
|
+
case 1:
|
|
247
|
+
_b.sent();
|
|
248
|
+
return [2 /*return*/];
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
});
|
|
252
|
+
},
|
|
253
|
+
};
|
|
254
|
+
export var SearchableLoadingOpened = {
|
|
255
|
+
args: {
|
|
256
|
+
label: 'Label',
|
|
257
|
+
searchable: true,
|
|
258
|
+
loading: true,
|
|
259
|
+
},
|
|
260
|
+
play: function (_a) {
|
|
261
|
+
var canvasElement = _a.canvasElement;
|
|
262
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
263
|
+
var canvas, selector;
|
|
264
|
+
return __generator(this, function (_b) {
|
|
265
|
+
switch (_b.label) {
|
|
266
|
+
case 0:
|
|
267
|
+
canvas = within(canvasElement);
|
|
268
|
+
selector = canvas.getByTestId('smart-select');
|
|
269
|
+
return [4 /*yield*/, userEvent.click(selector)];
|
|
270
|
+
case 1:
|
|
271
|
+
_b.sent();
|
|
272
|
+
return [2 /*return*/];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
});
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
export var WithValueandLabel = {
|
|
279
|
+
args: {
|
|
280
|
+
label: 'Label',
|
|
281
|
+
value: 'Textinput Value',
|
|
282
|
+
},
|
|
283
|
+
};
|
|
284
|
+
export var Full = {
|
|
285
|
+
args: {
|
|
286
|
+
label: 'Label',
|
|
287
|
+
value: 'Value',
|
|
288
|
+
helperText: 'Helper text',
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
export var Error = {
|
|
292
|
+
args: {
|
|
293
|
+
label: 'Label',
|
|
294
|
+
value: 'Value',
|
|
295
|
+
helperText: 'Helper text',
|
|
296
|
+
error: true,
|
|
297
|
+
},
|
|
298
|
+
};
|
|
299
|
+
export var ErrorColor = {
|
|
300
|
+
args: {
|
|
301
|
+
label: 'Label',
|
|
302
|
+
value: 'Value',
|
|
303
|
+
helperText: 'Helper text',
|
|
304
|
+
error: true,
|
|
305
|
+
errorColor: 'blue',
|
|
306
|
+
},
|
|
307
|
+
};
|
|
308
|
+
export var DifferentColors = {
|
|
309
|
+
args: {
|
|
310
|
+
label: 'Label',
|
|
311
|
+
value: 'Value',
|
|
312
|
+
helperText: 'Helper text',
|
|
313
|
+
helperTextColor: 'green',
|
|
314
|
+
outlineColor: 'purple',
|
|
315
|
+
backgroundColor: 'red',
|
|
316
|
+
color: 'blue',
|
|
317
|
+
},
|
|
318
|
+
};
|
|
@@ -144,9 +144,9 @@ function CustomTextfield(_a) {
|
|
|
144
144
|
if (maxLength) {
|
|
145
145
|
inputProps.inputProps = { maxLength: maxLength };
|
|
146
146
|
}
|
|
147
|
-
return (_jsxs("div", __assign({ style: { position: 'relative', width: '100%', maxWidth: '100%' } }, { children: [_jsx(TextField, __assign({ classes: classes }, others, { value: value !== null && value !== void 0 ? value : '', multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: inputProps, helperText: others.helperText ? (_jsxs(React.Fragment, { children: [others.helperText, length !== null && (_jsxs("
|
|
147
|
+
return (_jsxs("div", __assign({ style: { position: 'relative', width: '100%', maxWidth: '100%' } }, { children: [_jsx(TextField, __assign({ classes: classes }, others, { value: value !== null && value !== void 0 ? value : '', multiline: multiline, variant: "outlined", size: "small", fullWidth: true, InputProps: inputProps, helperText: others.helperText ? (_jsxs(React.Fragment, { children: [others.helperText, length !== null && (_jsxs("label", __assign({ style: {
|
|
148
148
|
position: 'absolute',
|
|
149
|
-
top: '
|
|
149
|
+
top: '1px',
|
|
150
150
|
right: '-32px',
|
|
151
151
|
fontSize: '12px',
|
|
152
152
|
color: helperTextColor,
|
|
@@ -21,4 +21,17 @@ declare const meta: {
|
|
|
21
21
|
};
|
|
22
22
|
export default meta;
|
|
23
23
|
type Story = StoryObj<typeof meta>;
|
|
24
|
+
export declare const Empty: Story;
|
|
25
|
+
export declare const EmptyLabel: Story;
|
|
24
26
|
export declare const Default: Story;
|
|
27
|
+
export declare const Focused: Story;
|
|
28
|
+
export declare const FocusedNoLabel: Story;
|
|
29
|
+
export declare const WithValue: Story;
|
|
30
|
+
export declare const Multiline: Story;
|
|
31
|
+
export declare const WithHelperText: Story;
|
|
32
|
+
export declare const WithValueandLabel: Story;
|
|
33
|
+
export declare const WithMaxLength: Story;
|
|
34
|
+
export declare const Full: Story;
|
|
35
|
+
export declare const Error: Story;
|
|
36
|
+
export declare const ErrorColor: Story;
|
|
37
|
+
export declare const DifferentColors: Story;
|
|
@@ -1,5 +1,54 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
13
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
14
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
15
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
16
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
17
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
18
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
22
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
23
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
24
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
25
|
+
function step(op) {
|
|
26
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
27
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
28
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
29
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
30
|
+
switch (op[0]) {
|
|
31
|
+
case 0: case 1: t = op; break;
|
|
32
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
33
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
34
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
35
|
+
default:
|
|
36
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
37
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
38
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
39
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
40
|
+
if (t[2]) _.ops.pop();
|
|
41
|
+
_.trys.pop(); continue;
|
|
42
|
+
}
|
|
43
|
+
op = body.call(thisArg, _);
|
|
44
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
45
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
49
|
+
import { useArgs } from '@storybook/preview-api';
|
|
1
50
|
import RoundedTextField from './RoundedTextField';
|
|
2
|
-
|
|
51
|
+
import { within, userEvent } from '@storybook/testing-library';
|
|
3
52
|
var meta = {
|
|
4
53
|
component: RoundedTextField,
|
|
5
54
|
tags: ['autodocs'],
|
|
@@ -20,6 +69,156 @@ var meta = {
|
|
|
20
69
|
},
|
|
21
70
|
};
|
|
22
71
|
export default meta;
|
|
72
|
+
export var Empty = {
|
|
73
|
+
args: {},
|
|
74
|
+
};
|
|
75
|
+
export var EmptyLabel = {
|
|
76
|
+
args: {
|
|
77
|
+
label: 'Label',
|
|
78
|
+
},
|
|
79
|
+
};
|
|
23
80
|
export var Default = {
|
|
81
|
+
args: {
|
|
82
|
+
label: 'Label',
|
|
83
|
+
},
|
|
84
|
+
play: function (_a) {
|
|
85
|
+
var canvasElement = _a.canvasElement;
|
|
86
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
87
|
+
var canvas, emailInput;
|
|
88
|
+
return __generator(this, function (_b) {
|
|
89
|
+
switch (_b.label) {
|
|
90
|
+
case 0:
|
|
91
|
+
canvas = within(canvasElement);
|
|
92
|
+
emailInput = canvas.getByRole('textbox');
|
|
93
|
+
return [4 /*yield*/, userEvent.click(emailInput)];
|
|
94
|
+
case 1:
|
|
95
|
+
_b.sent();
|
|
96
|
+
return [4 /*yield*/, userEvent.type(emailInput, 'example-email@email.com', {
|
|
97
|
+
delay: 100,
|
|
98
|
+
})];
|
|
99
|
+
case 2:
|
|
100
|
+
_b.sent();
|
|
101
|
+
return [2 /*return*/];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
render: function Component(args) {
|
|
107
|
+
var _a = useArgs(), setArgs = _a[1];
|
|
108
|
+
var onValueChange = function (event) {
|
|
109
|
+
var _a;
|
|
110
|
+
var value = event.target.value;
|
|
111
|
+
(_a = args.onChange) === null || _a === void 0 ? void 0 : _a.call(args, event);
|
|
112
|
+
setArgs({ value: value });
|
|
113
|
+
};
|
|
114
|
+
return (_jsx(RoundedTextField, __assign({}, args, { ref: undefined, onChange: onValueChange })));
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
export var Focused = {
|
|
118
|
+
args: {
|
|
119
|
+
label: 'Label',
|
|
120
|
+
},
|
|
121
|
+
play: function (_a) {
|
|
122
|
+
var canvasElement = _a.canvasElement;
|
|
123
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
124
|
+
var canvas, emailInput;
|
|
125
|
+
return __generator(this, function (_b) {
|
|
126
|
+
switch (_b.label) {
|
|
127
|
+
case 0:
|
|
128
|
+
canvas = within(canvasElement);
|
|
129
|
+
emailInput = canvas.getByRole('textbox');
|
|
130
|
+
return [4 /*yield*/, userEvent.click(emailInput)];
|
|
131
|
+
case 1:
|
|
132
|
+
_b.sent();
|
|
133
|
+
return [2 /*return*/];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
export var FocusedNoLabel = {
|
|
24
140
|
args: {},
|
|
141
|
+
play: function (_a) {
|
|
142
|
+
var canvasElement = _a.canvasElement;
|
|
143
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
144
|
+
var canvas, emailInput;
|
|
145
|
+
return __generator(this, function (_b) {
|
|
146
|
+
switch (_b.label) {
|
|
147
|
+
case 0:
|
|
148
|
+
canvas = within(canvasElement);
|
|
149
|
+
emailInput = canvas.getByRole('textbox');
|
|
150
|
+
return [4 /*yield*/, userEvent.click(emailInput)];
|
|
151
|
+
case 1:
|
|
152
|
+
_b.sent();
|
|
153
|
+
return [2 /*return*/];
|
|
154
|
+
}
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
};
|
|
159
|
+
export var WithValue = {
|
|
160
|
+
args: {
|
|
161
|
+
value: 'Textinput Value',
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
export var Multiline = {
|
|
165
|
+
args: {
|
|
166
|
+
value: 'TextArea Value',
|
|
167
|
+
multiline: true,
|
|
168
|
+
minRows: 4,
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
export var WithHelperText = {
|
|
172
|
+
args: {
|
|
173
|
+
helperText: 'Helper text',
|
|
174
|
+
},
|
|
175
|
+
};
|
|
176
|
+
export var WithValueandLabel = {
|
|
177
|
+
args: {
|
|
178
|
+
label: 'Label',
|
|
179
|
+
value: 'Textinput Value',
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
export var WithMaxLength = {
|
|
183
|
+
args: {
|
|
184
|
+
value: 'Value',
|
|
185
|
+
maxLength: 10,
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
export var Full = {
|
|
189
|
+
args: {
|
|
190
|
+
label: 'Label',
|
|
191
|
+
value: 'Value',
|
|
192
|
+
helperText: 'Helper text',
|
|
193
|
+
maxLength: 10,
|
|
194
|
+
},
|
|
195
|
+
};
|
|
196
|
+
export var Error = {
|
|
197
|
+
args: {
|
|
198
|
+
label: 'Label',
|
|
199
|
+
value: 'Value',
|
|
200
|
+
helperText: 'Helper text',
|
|
201
|
+
error: true,
|
|
202
|
+
},
|
|
203
|
+
};
|
|
204
|
+
export var ErrorColor = {
|
|
205
|
+
args: {
|
|
206
|
+
label: 'Label',
|
|
207
|
+
value: 'Value',
|
|
208
|
+
helperText: 'Helper text',
|
|
209
|
+
error: true,
|
|
210
|
+
errorColor: 'blue',
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
export var DifferentColors = {
|
|
214
|
+
args: {
|
|
215
|
+
label: 'Label',
|
|
216
|
+
value: 'Value',
|
|
217
|
+
helperText: 'Helper text',
|
|
218
|
+
maxLength: 10,
|
|
219
|
+
helperTextColor: 'green',
|
|
220
|
+
outlineColor: 'purple',
|
|
221
|
+
backgroundColor: 'red',
|
|
222
|
+
textColor: 'blue',
|
|
223
|
+
},
|
|
25
224
|
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { RenderOptions } from '@testing-library/react';
|
|
3
|
+
import { AppStore } from './store';
|
|
4
|
+
import { RenderHookOptions } from '@testing-library/react-hooks';
|
|
5
|
+
interface ExtendedRenderOptions extends Omit<RenderOptions, 'queries'> {
|
|
6
|
+
store?: AppStore;
|
|
7
|
+
}
|
|
8
|
+
export declare function renderWithProviders(ui: React.ReactElement, { store, ...renderOptions }?: ExtendedRenderOptions): {
|
|
9
|
+
container: HTMLElement;
|
|
10
|
+
baseElement: HTMLElement;
|
|
11
|
+
debug: (baseElement?: Element | DocumentFragment | (Element | DocumentFragment)[] | undefined, maxLength?: number | undefined, options?: import("pretty-format").PrettyFormatOptions | undefined) => void;
|
|
12
|
+
rerender: (ui: React.ReactElement<any, string | React.JSXElementConstructor<any>>) => void;
|
|
13
|
+
unmount: () => void;
|
|
14
|
+
asFragment: () => DocumentFragment;
|
|
15
|
+
getByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
16
|
+
getAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
17
|
+
queryByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
18
|
+
queryAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
19
|
+
findByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
20
|
+
findAllByLabelText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
21
|
+
getByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
22
|
+
getAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
23
|
+
queryByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
24
|
+
queryAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
25
|
+
findByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
26
|
+
findAllByPlaceholderText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
27
|
+
getByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement;
|
|
28
|
+
getAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
29
|
+
queryByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement | null;
|
|
30
|
+
queryAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined) => HTMLElement[];
|
|
31
|
+
findByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
32
|
+
findAllByText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").SelectorMatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
33
|
+
getByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
34
|
+
getAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
35
|
+
queryByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
36
|
+
queryAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
37
|
+
findByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
38
|
+
findAllByAltText: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
39
|
+
getByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
40
|
+
getAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
41
|
+
queryByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
42
|
+
queryAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
43
|
+
findByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
44
|
+
findAllByTitle: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
45
|
+
getByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
46
|
+
getAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
47
|
+
queryByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
48
|
+
queryAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
49
|
+
findByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
50
|
+
findAllByDisplayValue: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
51
|
+
getByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement;
|
|
52
|
+
getAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
|
|
53
|
+
queryByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement | null;
|
|
54
|
+
queryAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined) => HTMLElement[];
|
|
55
|
+
findByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
56
|
+
findAllByRole: (role: import("@testing-library/react").ByRoleMatcher, options?: import("@testing-library/react").ByRoleOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
57
|
+
getByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement;
|
|
58
|
+
getAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
59
|
+
queryByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement | null;
|
|
60
|
+
queryAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined) => HTMLElement[];
|
|
61
|
+
findByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement>;
|
|
62
|
+
findAllByTestId: (id: import("@testing-library/react").Matcher, options?: import("@testing-library/react").MatcherOptions | undefined, waitForElementOptions?: import("@testing-library/react").waitForOptions | undefined) => Promise<HTMLElement[]>;
|
|
63
|
+
store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("./store").EurekaFormsState, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<import("./store").EurekaFormsState, import("redux").AnyAction, undefined>]>;
|
|
64
|
+
};
|
|
65
|
+
interface ExtendedRenderHookOptions<TProps> extends Omit<RenderHookOptions<TProps>, 'wrapper'> {
|
|
66
|
+
store?: AppStore;
|
|
67
|
+
}
|
|
68
|
+
export declare function renderHookWithProviders<TProps, TResult>(callback: (props: TProps) => TResult, { store, ...renderHookOptions }?: ExtendedRenderHookOptions<TProps>): {
|
|
69
|
+
result: import("@testing-library/react-hooks").RenderResult<TResult>;
|
|
70
|
+
rerender: (props?: TProps | undefined) => void;
|
|
71
|
+
unmount: () => void;
|
|
72
|
+
waitFor: import("@testing-library/react-hooks").WaitFor;
|
|
73
|
+
waitForValueToChange: import("@testing-library/react-hooks").WaitForValueToChange;
|
|
74
|
+
waitForNextUpdate: import("@testing-library/react-hooks").WaitForNextUpdate;
|
|
75
|
+
store: import("@reduxjs/toolkit/dist/configureStore").ToolkitStore<import("./store").EurekaFormsState, import("redux").AnyAction, [import("@reduxjs/toolkit").ThunkMiddleware<import("./store").EurekaFormsState, import("redux").AnyAction, undefined>]>;
|
|
76
|
+
};
|
|
77
|
+
export {};
|