@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.
Files changed (46) hide show
  1. package/dist/@Types/Form.d.ts +1 -1
  2. package/dist/@Types/FormStep.d.ts +0 -1
  3. package/dist/App/App.d.ts +2 -0
  4. package/dist/App/App.js +1 -1
  5. package/dist/App/AppFunctions.js +2 -3
  6. package/dist/Form/Form.d.ts +3 -1
  7. package/dist/Form/Form.js +3 -3
  8. package/dist/Form/FormFunctions.d.ts +3 -0
  9. package/dist/Form/FormFunctions.js +19 -17
  10. package/dist/Form/FormTypes/StepperForm/StepperForm.d.ts +1 -1
  11. package/dist/Form/FormTypes/StepperForm/StepperForm.js +3 -1
  12. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.d.ts +8 -4
  13. package/dist/FormSteps/MapperStep/MaterialMapperStep/MaterialMapperStep.js +50 -79
  14. package/dist/FormSteps/StepFunctions.d.ts +2 -2
  15. package/dist/FormSteps/StepFunctions.js +1 -1
  16. package/dist/Shared/Navbar/Navbar.stories.d.ts +13 -0
  17. package/dist/Shared/Navbar/Navbar.stories.js +13 -0
  18. package/dist/Shared/Rating/Rating.stories.d.ts +15 -0
  19. package/dist/Shared/Rating/Rating.stories.js +59 -0
  20. package/dist/Shared/RoundedButton/RoundedButton.stories.d.ts +23 -0
  21. package/dist/Shared/RoundedButton/RoundedButton.stories.js +36 -0
  22. package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.d.ts +21 -0
  23. package/dist/Shared/RoundedCheckBox/RoundedCheckBox.stories.js +50 -0
  24. package/dist/Shared/RoundedDatePicker/RoundedDatePicker.d.ts +3 -2
  25. package/dist/Shared/RoundedDatePicker/RoundedDatePicker.js +3 -3
  26. package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.d.ts +36 -0
  27. package/dist/Shared/RoundedDatePicker/RoundedDatePicker.stories.js +223 -0
  28. package/dist/Shared/RoundedSelect/RoundedSelect.stories.d.ts +28 -0
  29. package/dist/Shared/RoundedSelect/RoundedSelect.stories.js +91 -0
  30. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.d.ts +0 -2
  31. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.js +3 -3
  32. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.d.ts +36 -0
  33. package/dist/Shared/RoundedSmartSelect/RoundedSmartSelect.stories.js +318 -0
  34. package/dist/Shared/RoundedTextField/RoundedTextField.js +2 -2
  35. package/dist/Shared/RoundedTextField/RoundedTextField.stories.d.ts +13 -0
  36. package/dist/Shared/RoundedTextField/RoundedTextField.stories.js +200 -1
  37. package/dist/Utils/TestUtils.d.ts +77 -0
  38. package/dist/Utils/TestUtils.js +65 -0
  39. package/dist/Utils/store.d.ts +2 -0
  40. package/dist/Utils/store.js +1 -1
  41. package/dist/__mocks__/axios.d.ts +2 -0
  42. package/dist/__mocks__/axios.js +2 -0
  43. package/dist/index.js +5 -1
  44. package/package.json +15 -1
  45. /package/dist/Form/{Hooks.d.ts → FormHooks.d.ts} +0 -0
  46. /package/dist/Form/{Hooks.js → FormHooks.js} +0 -0
@@ -0,0 +1,21 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import RoundedCheckBox from './RoundedCheckBox';
3
+ declare const meta: {
4
+ component: typeof RoundedCheckBox;
5
+ tags: string[];
6
+ args: {
7
+ checkedColor: string;
8
+ uncheckedColor: string;
9
+ disabledColor: string;
10
+ size: string;
11
+ errorColor: string;
12
+ };
13
+ };
14
+ export default meta;
15
+ type Story = StoryObj<typeof meta>;
16
+ export declare const Uncheked: Story;
17
+ export declare const Checked: Story;
18
+ export declare const Error: Story;
19
+ export declare const Disabled: Story;
20
+ export declare const ErrorColor: Story;
21
+ export declare const DifferentColors: Story;
@@ -0,0 +1,50 @@
1
+ import RoundedCheckBox from './RoundedCheckBox';
2
+ var meta = {
3
+ component: RoundedCheckBox,
4
+ tags: ['autodocs'],
5
+ args: {
6
+ checkedColor: '#3d5a7f',
7
+ uncheckedColor: '#787878',
8
+ disabledColor: '#A0A0A0',
9
+ size: '1.5rem',
10
+ errorColor: '#cc2936',
11
+ },
12
+ };
13
+ export default meta;
14
+ export var Uncheked = {
15
+ args: {
16
+ checked: false,
17
+ },
18
+ };
19
+ export var Checked = {
20
+ args: {
21
+ checked: true,
22
+ },
23
+ };
24
+ export var Error = {
25
+ args: {
26
+ checked: false,
27
+ error: true,
28
+ },
29
+ };
30
+ export var Disabled = {
31
+ args: {
32
+ checked: false,
33
+ disabled: true,
34
+ },
35
+ };
36
+ export var ErrorColor = {
37
+ args: {
38
+ checked: false,
39
+ error: true,
40
+ errorColor: 'blue',
41
+ },
42
+ };
43
+ export var DifferentColors = {
44
+ args: {
45
+ checked: true,
46
+ checkedColor: 'red',
47
+ uncheckedColor: 'blue',
48
+ disabledColor: '#A0A0A0',
49
+ },
50
+ };
@@ -37,12 +37,13 @@ interface StyleProps {
37
37
  /** Height of the component */
38
38
  height?: string;
39
39
  }
40
- interface RoundedDatePickerProps extends StyleProps {
40
+ interface RoundedDatePickerProps extends Omit<DatePickerProps, 'ref'>, StyleProps {
41
+ ref?: React.RefObject<HTMLDivElement>;
41
42
  }
42
43
  /**
43
44
  * Generic datepicker with apps designs. Is class do to the use in the react-hook-forms library
44
45
  */
45
- declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps & DatePickerProps> {
46
+ declare class RoundedDatePicker extends React.Component<RoundedDatePickerProps> {
46
47
  render(): JSX.Element;
47
48
  }
48
49
  export default RoundedDatePicker;
@@ -215,7 +215,7 @@ var useDatePickerDialogStyles = function (props) {
215
215
  }); });
216
216
  };
217
217
  function CustomDatePicker(_a) {
218
- var _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.secondaryColor, secondaryColor = _c === void 0 ? '#98c1d9' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? 'white' : _e, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.contrastColor, contrastColor = _g === void 0 ? '#ee6c4d' : _g, _h = _a.accentColor, accentColor = _h === void 0 ? '#293241' : _h, _j = _a.errorColor, errorColor = _j === void 0 ? '#cc2936' : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.padding, padding = _l === void 0 ? '6px 0px 6px 12px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, _o = _a.shrunkenFontSize, shrunkenFontSize = _o === void 0 ? '1rem' : _o, _p = _a.helperTextColor, helperTextColor = _p === void 0 ? '#989898' : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '300' : _q, _r = _a.height, height = _r === void 0 ? '31px' : _r, _s = _a.cantEdit, cantEdit = _s === void 0 ? false : _s, _t = _a.pickTime, pickTime = _t === void 0 ? false : _t, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["focusColor", "secondaryColor", "outlineColor", "backgroundColor", "textColor", "contrastColor", "accentColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "height", "cantEdit", "pickTime", "onChange", "required"]);
218
+ var ref = _a.ref, _b = _a.focusColor, focusColor = _b === void 0 ? '#3d5a7f' : _b, _c = _a.secondaryColor, secondaryColor = _c === void 0 ? '#98c1d9' : _c, _d = _a.outlineColor, outlineColor = _d === void 0 ? '#0000003b' : _d, _e = _a.backgroundColor, backgroundColor = _e === void 0 ? '#ffffff' : _e, _f = _a.textColor, textColor = _f === void 0 ? '#293241' : _f, _g = _a.contrastColor, contrastColor = _g === void 0 ? '#ee6c4d' : _g, _h = _a.accentColor, accentColor = _h === void 0 ? '#293241' : _h, _j = _a.errorColor, errorColor = _j === void 0 ? '#cc2936' : _j, _k = _a.borderRadius, borderRadius = _k === void 0 ? 10 : _k, _l = _a.padding, padding = _l === void 0 ? '6px 0px 6px 12px' : _l, _m = _a.fontSize, fontSize = _m === void 0 ? '1rem' : _m, _o = _a.shrunkenFontSize, shrunkenFontSize = _o === void 0 ? '1rem' : _o, _p = _a.helperTextColor, helperTextColor = _p === void 0 ? '#989898' : _p, _q = _a.fontWeight, fontWeight = _q === void 0 ? '300' : _q, _r = _a.height, height = _r === void 0 ? '31px' : _r, _s = _a.cantEdit, cantEdit = _s === void 0 ? false : _s, _t = _a.pickTime, pickTime = _t === void 0 ? false : _t, onChange = _a.onChange, required = _a.required, others = __rest(_a, ["ref", "focusColor", "secondaryColor", "outlineColor", "backgroundColor", "textColor", "contrastColor", "accentColor", "errorColor", "borderRadius", "padding", "fontSize", "shrunkenFontSize", "helperTextColor", "fontWeight", "height", "cantEdit", "pickTime", "onChange", "required"]);
219
219
  var classes = useDatePickerStyles({
220
220
  padding: padding,
221
221
  cantEdit: cantEdit,
@@ -282,7 +282,7 @@ function CustomDatePicker(_a) {
282
282
  height: height,
283
283
  })();
284
284
  if (pickTime) {
285
- return (_jsx(DateTimePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'Pp', { locale: getLocale() }), format: "Pp", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
285
+ return (_jsx(DateTimePicker, __assign({}, others, { ref: ref, inputVariant: "outlined", "data-testid": "date-picker", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'Pp', { locale: getLocale() }), format: "Pp", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
286
286
  disableEnforceFocus: true,
287
287
  className: datePicker,
288
288
  cancelLabel: '',
@@ -307,7 +307,7 @@ function CustomDatePicker(_a) {
307
307
  }, variant: "dialog" })));
308
308
  }
309
309
  else {
310
- return (_jsx(DatePicker, __assign({}, others, { inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'P', { locale: getLocale() }), format: "P", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
310
+ return (_jsx(DatePicker, __assign({}, others, { ref: ref, "data-testid": "date-picker", inputVariant: "outlined", size: "small", disabled: cantEdit, fullWidth: true, onChange: onChange, placeholder: format(new Date(), 'P', { locale: getLocale() }), format: "P", required: required, InputLabelProps: { classes: labelClasses }, DialogProps: {
311
311
  disableEnforceFocus: true,
312
312
  className: datePicker,
313
313
  cancelLabel: '',
@@ -0,0 +1,36 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import RoundedDatePicker from './RoundedDatePicker';
3
+ declare const meta: {
4
+ component: typeof RoundedDatePicker;
5
+ tags: string[];
6
+ args: {
7
+ focusColor: string;
8
+ secondaryColor: string;
9
+ helperTextColor: string;
10
+ outlineColor: string;
11
+ backgroundColor: string;
12
+ textColor: string;
13
+ contrastColor: string;
14
+ accentColor: string;
15
+ errorColor: string;
16
+ fontSize: string;
17
+ fontWeight: string;
18
+ cantEdit: false;
19
+ };
20
+ parameters: {
21
+ date: Date;
22
+ };
23
+ };
24
+ export default meta;
25
+ type Story = StoryObj<typeof meta>;
26
+ export declare const Empty: Story;
27
+ export declare const Default: Story;
28
+ export declare const ValueAndLabel: Story;
29
+ export declare const Full: Story;
30
+ export declare const FullDateTime: Story;
31
+ export declare const Error: Story;
32
+ export declare const Menu: Story;
33
+ export declare const DateTimeDateMenu: Story;
34
+ export declare const DateTimeTimeMenu: Story;
35
+ export declare const ErrorColor: Story;
36
+ export declare const DifferentColors: Story;
@@ -0,0 +1,223 @@
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 RoundedDatePicker from './RoundedDatePicker';
51
+ import { within, screen } from '@storybook/testing-library';
52
+ import { userEvent } from '@storybook/testing-library';
53
+ var meta = {
54
+ component: RoundedDatePicker,
55
+ tags: ['autodocs'],
56
+ args: {
57
+ focusColor: '#3d5a7f',
58
+ secondaryColor: '#98c1d9',
59
+ helperTextColor: '#989898',
60
+ outlineColor: '#0000003b',
61
+ backgroundColor: '#ffffff',
62
+ textColor: '#293241',
63
+ contrastColor: '#ee6c4d',
64
+ accentColor: '#293241',
65
+ errorColor: '#cc2936',
66
+ fontSize: '1rem',
67
+ fontWeight: '300',
68
+ cantEdit: false,
69
+ },
70
+ parameters: {
71
+ date: new Date('07-21-2021'),
72
+ },
73
+ };
74
+ export default meta;
75
+ export var Empty = {
76
+ args: {
77
+ value: null,
78
+ },
79
+ };
80
+ export var Default = {
81
+ args: {
82
+ label: 'Label',
83
+ value: new Date('07-21-2021'),
84
+ },
85
+ };
86
+ export var ValueAndLabel = {
87
+ args: {
88
+ label: 'Label',
89
+ value: null,
90
+ },
91
+ render: function Component(args) {
92
+ var _a = useArgs(), setArgs = _a[1];
93
+ var onValueChange = function (value) {
94
+ var _a;
95
+ (_a = args.onChange) === null || _a === void 0 ? void 0 : _a.call(args, value);
96
+ setArgs({ value: value });
97
+ };
98
+ return (_jsx(RoundedDatePicker, __assign({}, args, { ref: args.ref, onChange: onValueChange })));
99
+ },
100
+ };
101
+ export var Full = {
102
+ args: {
103
+ label: 'Label',
104
+ value: null,
105
+ helperText: 'Helper text',
106
+ },
107
+ };
108
+ export var FullDateTime = {
109
+ args: {
110
+ label: 'Label',
111
+ value: null,
112
+ helperText: 'Helper text',
113
+ pickTime: true,
114
+ },
115
+ };
116
+ export var Error = {
117
+ args: {
118
+ label: 'Label',
119
+ value: null,
120
+ helperText: 'Helper text',
121
+ error: true,
122
+ },
123
+ };
124
+ export var Menu = {
125
+ args: {
126
+ label: 'Label',
127
+ value: null,
128
+ },
129
+ play: function (_a) {
130
+ var canvasElement = _a.canvasElement;
131
+ return __awaiter(void 0, void 0, void 0, function () {
132
+ var canvas, selector;
133
+ return __generator(this, function (_b) {
134
+ switch (_b.label) {
135
+ case 0:
136
+ canvas = within(canvasElement);
137
+ selector = canvas.getByTestId('date-picker');
138
+ return [4 /*yield*/, userEvent.click(selector)];
139
+ case 1:
140
+ _b.sent();
141
+ return [2 /*return*/];
142
+ }
143
+ });
144
+ });
145
+ },
146
+ };
147
+ export var DateTimeDateMenu = {
148
+ args: {
149
+ label: 'Label',
150
+ value: null,
151
+ pickTime: true,
152
+ },
153
+ play: function (_a) {
154
+ var canvasElement = _a.canvasElement;
155
+ return __awaiter(void 0, void 0, void 0, function () {
156
+ var canvas, selector;
157
+ return __generator(this, function (_b) {
158
+ switch (_b.label) {
159
+ case 0:
160
+ canvas = within(canvasElement);
161
+ selector = canvas.getByTestId('date-picker');
162
+ return [4 /*yield*/, userEvent.click(selector)];
163
+ case 1:
164
+ _b.sent();
165
+ return [2 /*return*/];
166
+ }
167
+ });
168
+ });
169
+ },
170
+ };
171
+ export var DateTimeTimeMenu = {
172
+ args: {
173
+ label: 'Label',
174
+ value: null,
175
+ pickTime: true,
176
+ },
177
+ play: function (_a) {
178
+ var canvasElement = _a.canvasElement;
179
+ return __awaiter(void 0, void 0, void 0, function () {
180
+ var canvas, selector, time;
181
+ return __generator(this, function (_b) {
182
+ switch (_b.label) {
183
+ case 0:
184
+ canvas = within(canvasElement);
185
+ selector = canvas.getByTestId('date-picker');
186
+ return [4 /*yield*/, userEvent.click(selector)];
187
+ case 1:
188
+ _b.sent();
189
+ time = screen.getByText('12', {
190
+ selector: 'h3',
191
+ });
192
+ return [4 /*yield*/, userEvent.click(time)];
193
+ case 2:
194
+ _b.sent();
195
+ return [2 /*return*/];
196
+ }
197
+ });
198
+ });
199
+ },
200
+ };
201
+ export var ErrorColor = {
202
+ args: {
203
+ label: 'Label',
204
+ value: null,
205
+ helperText: 'Helper text',
206
+ error: true,
207
+ errorColor: 'blue',
208
+ },
209
+ };
210
+ export var DifferentColors = {
211
+ args: {
212
+ label: 'Label',
213
+ value: null,
214
+ helperText: 'Helper text',
215
+ helperTextColor: 'green',
216
+ outlineColor: 'purple',
217
+ backgroundColor: 'red',
218
+ textColor: 'blue',
219
+ },
220
+ render: function Component(args) {
221
+ return _jsx(RoundedDatePicker, __assign({}, args, { ref: args.ref }));
222
+ },
223
+ };
@@ -0,0 +1,28 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import RoundedSelect from './RoundedSelect';
3
+ declare const meta: {
4
+ component: typeof RoundedSelect;
5
+ tags: string[];
6
+ args: {
7
+ focusColor: string;
8
+ helperTextColor: string;
9
+ outlineColor: string;
10
+ backgroundColor: string;
11
+ color: string;
12
+ readOnly: false;
13
+ borderRadius: number;
14
+ fontSize: string;
15
+ errorColor: string;
16
+ fontWeight: string;
17
+ cantEdit: false;
18
+ };
19
+ };
20
+ export default meta;
21
+ type Story = StoryObj<typeof meta>;
22
+ export declare const Empty: Story;
23
+ export declare const Default: Story;
24
+ export declare const ValueAndLabel: Story;
25
+ export declare const Full: Story;
26
+ export declare const Error: Story;
27
+ export declare const ErrorColor: Story;
28
+ export declare const DifferentColors: Story;
@@ -0,0 +1,91 @@
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
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { useArgs } from '@storybook/preview-api';
14
+ import RoundedSelect from './RoundedSelect';
15
+ import { MenuItem } from '@material-ui/core';
16
+ var meta = {
17
+ component: RoundedSelect,
18
+ tags: ['autodocs'],
19
+ args: {
20
+ focusColor: '#3d5a7f',
21
+ helperTextColor: '#989898',
22
+ outlineColor: '#0000003b',
23
+ backgroundColor: '#ffffff',
24
+ color: '#293241',
25
+ readOnly: false,
26
+ borderRadius: 10,
27
+ fontSize: '1rem',
28
+ errorColor: '#cc2936',
29
+ fontWeight: '300',
30
+ cantEdit: false,
31
+ },
32
+ };
33
+ export default meta;
34
+ export var Empty = {
35
+ args: {},
36
+ };
37
+ export var Default = {
38
+ args: {
39
+ label: 'Label',
40
+ },
41
+ };
42
+ export var ValueAndLabel = {
43
+ args: {
44
+ label: 'Label',
45
+ value: 'option',
46
+ },
47
+ render: function Component(args) {
48
+ var _a = useArgs(), setArgs = _a[1];
49
+ var onValueChange = function (value) {
50
+ var _a;
51
+ (_a = args.handleUpdate) === null || _a === void 0 ? void 0 : _a.call(args, value);
52
+ setArgs({ value: value });
53
+ };
54
+ return (_jsx(RoundedSelect, __assign({}, args, { handleUpdate: onValueChange }, { children: _jsx(MenuItem, __assign({ value: 'option', style: { whiteSpace: 'normal' } }, { children: "Option" })) })));
55
+ },
56
+ };
57
+ export var Full = {
58
+ args: {
59
+ label: 'Label',
60
+ helperText: 'Helper text',
61
+ },
62
+ };
63
+ export var Error = {
64
+ args: {
65
+ label: 'Label',
66
+ helperText: 'Helper text',
67
+ error: true,
68
+ },
69
+ };
70
+ export var ErrorColor = {
71
+ args: {
72
+ label: 'Label',
73
+ helperText: 'Helper text',
74
+ error: true,
75
+ errorColor: 'blue',
76
+ },
77
+ };
78
+ export var DifferentColors = {
79
+ args: {
80
+ label: 'Label',
81
+ value: 'option',
82
+ helperText: 'Helper text',
83
+ helperTextColor: 'green',
84
+ outlineColor: 'purple',
85
+ backgroundColor: 'red',
86
+ color: 'blue',
87
+ },
88
+ render: function Component(args) {
89
+ return (_jsx(RoundedSelect, __assign({}, args, { children: _jsx(MenuItem, __assign({ value: 'option', style: { whiteSpace: 'normal' } }, { children: "Option" })) })));
90
+ },
91
+ };
@@ -41,8 +41,6 @@ export interface RoundedSmartSelectProps extends Omit<TextFieldProps, 'color' |
41
41
  handleUpdate?: (value: any) => void;
42
42
  /** Strig to place in the label */
43
43
  label: string;
44
- /** Minimum width in px of the component */
45
- minWidth?: number;
46
44
  /** The helper Text to display */
47
45
  helperText?: string;
48
46
  /** The margin around the selector */
@@ -161,7 +161,7 @@ export default function RoundedSmartSelect(_a) {
161
161
  };
162
162
  var textFieldClasses = useTextfieldStyles(props)();
163
163
  if (searchable) {
164
- return (_jsx(Autocomplete, { onFocus: onFocus, size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575', marginTop: 1 } })) : showIcon && icon ? (icon) : undefined, onOpen: function () { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options !== null && options !== void 0 ? options : [], getOptionLabel: function (option) {
164
+ return (_jsx(Autocomplete, { onFocus: onFocus, "data-testid": "smart-select", size: "small", fullWidth: true, openOnFocus: true, freeSolo: creatable, disabled: cantEdit || disabled, popupIcon: loading ? (_jsx(CircularProgress, { size: 22, style: { color: '#757575', marginTop: 1 } })) : showIcon && icon ? (icon) : undefined, onOpen: function () { }, loading: loading, loadingText: 'Cargando...', closeIcon: false, options: options !== null && options !== void 0 ? options : [], getOptionLabel: function (option) {
165
165
  var _a, _b;
166
166
  // Value selected with enter, right from the input
167
167
  if (typeof option === 'string') {
@@ -216,7 +216,7 @@ export default function RoundedSmartSelect(_a) {
216
216
  }, renderInput: function (params) { return (_jsx(TextField, __assign({ classes: textFieldClasses }, params, { inputRef: inputRef, onBlur: onBlur, name: name, variant: "outlined", label: label, required: required, error: !hidden && error, helperText: hidden ? undefined : helperText }))); }, noOptionsText: "No hay opciones" }));
217
217
  }
218
218
  else {
219
- return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, onFocus: onFocus, inputRef: inputRef, name: name, fullWidth: true, handleUpdate: function (event) {
219
+ return (_jsxs(RoundedSelect, __assign({ onBlur: onBlur, onFocus: onFocus, "data-testid": "smart-select", inputRef: inputRef, name: name, fullWidth: true, handleUpdate: function (event) {
220
220
  handleUpdate === null || handleUpdate === void 0 ? void 0 : handleUpdate(options === null || options === void 0 ? void 0 : options.find(function (option) {
221
221
  return getValueString(option) === event.target.value;
222
222
  }));
@@ -231,6 +231,6 @@ export default function RoundedSmartSelect(_a) {
231
231
  ? function (props) {
232
232
  return cloneElement(icon, props);
233
233
  }
234
- : undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' } }, { children: option.label }), getValueString(option))); }), options === undefined && value && !loading && (_jsx(MenuItem, __assign({ value: getValueString(value), style: { whiteSpace: 'normal' } }, { children: (_b = value.label) !== null && _b !== void 0 ? _b : '' }), getValueString(value)))] })));
234
+ : undefined, showIcon: showIcon }, { children: [_jsx(MenuItem, __assign({ value: '', "data-testid": 'smart-select-empty', style: { whiteSpace: 'normal' } }, { children: _jsx("em", { children: options ? 'Sin Seleccionar' : 'Cargando...' }) }), 'EMPTY'), options === null || options === void 0 ? void 0 : options.map(function (option) { return (_jsx(MenuItem, __assign({ value: getValueString(option), style: { whiteSpace: 'normal' }, "data-testid": 'smart-select-' + getValueString(option) }, { children: option.label }), getValueString(option))); }), options === undefined && value && !loading && (_jsx(MenuItem, __assign({ value: getValueString(value), style: { whiteSpace: 'normal' } }, { children: (_b = value.label) !== null && _b !== void 0 ? _b : '' }), getValueString(value)))] })));
235
235
  }
236
236
  }
@@ -0,0 +1,36 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import RoundedSmartSelect from './RoundedSmartSelect';
3
+ declare const meta: {
4
+ component: typeof RoundedSmartSelect;
5
+ tags: string[];
6
+ args: {
7
+ searchable: false;
8
+ focusColor: string;
9
+ helperTextColor: string;
10
+ outlineColor: string;
11
+ backgroundColor: string;
12
+ color: string;
13
+ readOnly: false;
14
+ borderRadius: number;
15
+ fontSize: string;
16
+ errorColor: string;
17
+ fontWeight: string;
18
+ cantEdit: false;
19
+ };
20
+ };
21
+ export default meta;
22
+ type Story = StoryObj<typeof meta>;
23
+ export declare const Empty: Story;
24
+ export declare const Default: Story;
25
+ export declare const Focused: Story;
26
+ export declare const FocusedSearchable: Story;
27
+ export declare const SearchableWithOptions: Story;
28
+ export declare const SearchableWithSearchAndOptions: Story;
29
+ export declare const Loading: Story;
30
+ export declare const LoadingOpened: Story;
31
+ export declare const SearchableLoadingOpened: Story;
32
+ export declare const WithValueandLabel: Story;
33
+ export declare const Full: Story;
34
+ export declare const Error: Story;
35
+ export declare const ErrorColor: Story;
36
+ export declare const DifferentColors: Story;