@popsure/dirty-swan 0.45.0-alpha → 0.47.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/cjs/index.js +421 -362
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/components/button/index.d.ts +4 -9
- package/dist/cjs/lib/components/button/index.stories.d.ts +2 -10
- package/dist/cjs/lib/components/dateSelector/components/Calendar.d.ts +16 -0
- package/dist/cjs/lib/components/dateSelector/index.d.ts +5 -7
- package/dist/cjs/lib/components/dateSelector/index.stories.d.ts +1 -1
- package/dist/cjs/lib/components/input/currency/input.stories.d.ts +7 -0
- package/dist/cjs/lib/components/input/index.d.ts +5 -3
- package/dist/cjs/lib/components/input/input.stories.d.ts +11 -3
- package/dist/cjs/lib/components/input/stories/config.d.ts +7 -0
- package/dist/esm/{index-f0e3bc9a.js → Calendar-62c6cf21.js} +24 -150
- package/dist/esm/Calendar-62c6cf21.js.map +1 -0
- package/dist/esm/components/button/index.js +2 -3
- package/dist/esm/components/button/index.js.map +1 -1
- package/dist/esm/components/button/index.stories.js +3 -16
- package/dist/esm/components/button/index.stories.js.map +1 -1
- package/dist/esm/components/card/index.js.map +1 -1
- package/dist/esm/components/card/index.stories.js +2 -2
- package/dist/esm/components/card/index.stories.js.map +1 -1
- package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js +7 -10
- package/dist/esm/components/comparisonTable/components/TableInfoButton/index.js.map +1 -1
- package/dist/esm/components/comparisonTable/index.js +2 -0
- package/dist/esm/components/comparisonTable/index.js.map +1 -1
- package/dist/esm/components/dateSelector/components/Calendar.js +11 -0
- package/dist/esm/components/dateSelector/components/Calendar.js.map +1 -0
- package/dist/esm/components/dateSelector/index.js +203 -7
- package/dist/esm/components/dateSelector/index.js.map +1 -1
- package/dist/esm/components/dateSelector/index.stories.js +14 -5
- package/dist/esm/components/dateSelector/index.stories.js.map +1 -1
- package/dist/esm/components/dateSelector/index.test.js +177 -23
- package/dist/esm/components/dateSelector/index.test.js.map +1 -1
- package/dist/esm/components/icon/icons/Info.js +2 -2
- package/dist/esm/components/icon/icons/Info.js.map +1 -1
- package/dist/esm/components/icon/icons.stories.js +1 -1
- package/dist/esm/components/icon/index.stories.js +1 -1
- package/dist/esm/components/input/currency/input.stories.js +1 -1
- package/dist/esm/components/input/iban/index.js +1 -1
- package/dist/esm/components/input/iban/index.js.map +1 -1
- package/dist/esm/components/input/index.js +10 -7
- package/dist/esm/components/input/index.js.map +1 -1
- package/dist/esm/components/input/input.stories.js +3 -3
- package/dist/esm/components/input/input.stories.js.map +1 -1
- package/dist/esm/{config-56f12c98.js → config-1d276a9d.js} +7 -2
- package/dist/esm/config-1d276a9d.js.map +1 -0
- package/dist/esm/{index-03b0133a.js → index-e506c4ca.js} +3 -3
- package/dist/esm/{index-03b0133a.js.map → index-e506c4ca.js.map} +1 -1
- package/dist/esm/index.js +4 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/components/button/index.d.ts +4 -9
- package/dist/esm/lib/components/button/index.stories.d.ts +2 -10
- package/dist/esm/lib/components/dateSelector/components/Calendar.d.ts +16 -0
- package/dist/esm/lib/components/dateSelector/index.d.ts +5 -7
- package/dist/esm/lib/components/dateSelector/index.stories.d.ts +1 -1
- package/dist/esm/lib/components/input/currency/input.stories.d.ts +7 -0
- package/dist/esm/lib/components/input/index.d.ts +5 -3
- package/dist/esm/lib/components/input/input.stories.d.ts +11 -3
- package/dist/esm/lib/components/input/stories/config.d.ts +7 -0
- package/package.json +1 -1
- package/src/lib/components/button/index.stories.tsx +1 -26
- package/src/lib/components/button/index.tsx +10 -21
- package/src/lib/components/card/index.tsx +1 -1
- package/src/lib/components/comparisonTable/components/TableInfoButton/index.tsx +5 -30
- package/src/lib/components/comparisonTable/components/TableInfoButton/style.module.scss +6 -2
- package/src/lib/components/dateSelector/components/Calendar.tsx +112 -0
- package/src/lib/components/dateSelector/{datepicker.scss → components/datepicker.scss} +4 -4
- package/src/lib/components/dateSelector/components/style.module.scss +3 -0
- package/src/lib/components/dateSelector/index.stories.tsx +18 -8
- package/src/lib/components/dateSelector/index.test.tsx +118 -20
- package/src/lib/components/dateSelector/index.tsx +196 -227
- package/src/lib/components/dateSelector/style.module.scss +6 -79
- package/src/lib/components/input/iban/index.tsx +1 -1
- package/src/lib/components/input/index.tsx +13 -7
- package/src/lib/components/input/input.stories.tsx +2 -0
- package/src/lib/components/input/stories/config.ts +6 -1
- package/src/lib/components/input/style.module.scss +8 -1
- package/dist/esm/config-56f12c98.js.map +0 -1
- package/dist/esm/index-f0e3bc9a.js.map +0 -1
- package/src/lib/components/dateSelector/icons/chevron-left.svg +0 -3
- package/src/lib/components/dateSelector/icons/chevron-right.svg +0 -3
- package/src/lib/components/dateSelector/index.test.ts +0 -33
|
@@ -1,68 +1,222 @@
|
|
|
1
1
|
import { b as __awaiter, c as __generator } from '../../tslib.es6-5bc94358.js';
|
|
2
2
|
import { jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { c as customRender } from '../../customRender-9fd06f5b.js';
|
|
4
|
-
import {
|
|
4
|
+
import { DateSelector } from './index.js';
|
|
5
5
|
import 'react';
|
|
6
6
|
import 'react-dom';
|
|
7
7
|
import '../../_commonjsHelpers-e7f67fd8.js';
|
|
8
8
|
import 'react-dom/test-utils';
|
|
9
|
+
import '../../Calendar-62c6cf21.js';
|
|
9
10
|
import '../icon/icons/Calendar.js';
|
|
10
11
|
import '../icon/IconWrapper/IconWrapper.js';
|
|
11
12
|
import '../../index-6ea95111.js';
|
|
12
13
|
import '../../style-inject.es-1f59c1d0.js';
|
|
14
|
+
import '../button/index.js';
|
|
15
|
+
import '../input/index.js';
|
|
16
|
+
import '../../index-fb46adf9.js';
|
|
13
17
|
|
|
14
18
|
var setup = function (date, onChange) {
|
|
15
19
|
if (onChange === void 0) { onChange = function () { }; }
|
|
16
20
|
return customRender(jsx(DateSelector, { value: date, yearBoundaries: { min: 2020, max: 2025 }, onChange: onChange, displayCalendar: true }, void 0));
|
|
17
21
|
};
|
|
18
22
|
describe('DateSelector component', function () {
|
|
19
|
-
it('should
|
|
20
|
-
var
|
|
23
|
+
it('should show the value inside the inputs', function () {
|
|
24
|
+
var date = '2024-01-01';
|
|
25
|
+
var getByTestId = setup(date).getByTestId;
|
|
26
|
+
expect(getByTestId('date-selector-day')).toHaveValue('1');
|
|
27
|
+
expect(getByTestId('date-selector-month')).toHaveValue('1');
|
|
28
|
+
expect(getByTestId('date-selector-year')).toHaveValue('2024');
|
|
29
|
+
});
|
|
30
|
+
it('should call onChange with the value changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
31
|
+
var callback, _a, getByTestId, user;
|
|
32
|
+
return __generator(this, function (_b) {
|
|
33
|
+
switch (_b.label) {
|
|
34
|
+
case 0:
|
|
35
|
+
callback = jest.fn();
|
|
36
|
+
_a = setup(undefined, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
37
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-day'), '5')];
|
|
38
|
+
case 1:
|
|
39
|
+
_b.sent();
|
|
40
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-month'), '7')];
|
|
41
|
+
case 2:
|
|
42
|
+
_b.sent();
|
|
43
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-year'), '2023')];
|
|
44
|
+
case 3:
|
|
45
|
+
_b.sent();
|
|
46
|
+
expect(getByTestId('date-selector-day')).toHaveValue('5');
|
|
47
|
+
expect(getByTestId('date-selector-month')).toHaveValue('7');
|
|
48
|
+
expect(getByTestId('date-selector-year')).toHaveValue('2023');
|
|
49
|
+
expect(callback).toHaveBeenCalledWith('2023-07-05');
|
|
50
|
+
return [2 /*return*/];
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
}); });
|
|
54
|
+
it('should call onChange with the value changed with initial value', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
55
|
+
var callback, date, _a, getByTestId, user;
|
|
21
56
|
return __generator(this, function (_b) {
|
|
22
57
|
switch (_b.label) {
|
|
23
58
|
case 0:
|
|
24
59
|
callback = jest.fn();
|
|
25
60
|
date = '2024-01-01';
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
button = getByTestId('calendar-button');
|
|
29
|
-
return [4 /*yield*/, user.click(button)];
|
|
61
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
62
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-day'), '{backspace}3')];
|
|
30
63
|
case 1:
|
|
31
64
|
_b.sent();
|
|
32
|
-
|
|
33
|
-
return [4 /*yield*/, user.click(calendarCell)];
|
|
65
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-month'), '{backspace}7')];
|
|
34
66
|
case 2:
|
|
35
67
|
_b.sent();
|
|
36
|
-
|
|
37
|
-
|
|
68
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-year'), '{backspace}3')];
|
|
69
|
+
case 3:
|
|
70
|
+
_b.sent();
|
|
71
|
+
expect(getByTestId('date-selector-day')).toHaveValue('3');
|
|
72
|
+
expect(getByTestId('date-selector-month')).toHaveValue('7');
|
|
73
|
+
expect(getByTestId('date-selector-year')).toHaveValue('2023');
|
|
74
|
+
expect(callback).toHaveBeenCalledWith('2023-07-03');
|
|
38
75
|
return [2 /*return*/];
|
|
39
76
|
}
|
|
40
77
|
});
|
|
41
78
|
}); });
|
|
42
|
-
it('should
|
|
43
|
-
var callback,
|
|
79
|
+
it('should call onChange empty when invalid date', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
80
|
+
var callback, _a, getByTestId, user;
|
|
81
|
+
return __generator(this, function (_b) {
|
|
82
|
+
switch (_b.label) {
|
|
83
|
+
case 0:
|
|
84
|
+
callback = jest.fn();
|
|
85
|
+
_a = setup(undefined, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
86
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-day'), '5')];
|
|
87
|
+
case 1:
|
|
88
|
+
_b.sent();
|
|
89
|
+
expect(getByTestId('date-selector-day')).toHaveValue('5');
|
|
90
|
+
expect(callback).toHaveBeenCalledWith('');
|
|
91
|
+
return [2 /*return*/];
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}); });
|
|
95
|
+
it('should call onChange empty when year out of boundaries', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
96
|
+
var callback, date, _a, getByTestId, user;
|
|
44
97
|
return __generator(this, function (_b) {
|
|
45
98
|
switch (_b.label) {
|
|
46
99
|
case 0:
|
|
47
100
|
callback = jest.fn();
|
|
48
101
|
date = '2024-01-01';
|
|
49
|
-
_a = setup(date, callback), getByTestId = _a.getByTestId,
|
|
50
|
-
|
|
51
|
-
return [4 /*yield*/, user.click(button)];
|
|
102
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
103
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-year'), '{backspace}{backspace}30')];
|
|
52
104
|
case 1:
|
|
53
105
|
_b.sent();
|
|
54
|
-
|
|
55
|
-
expect(
|
|
56
|
-
|
|
57
|
-
|
|
106
|
+
expect(getByTestId('date-selector-year')).toHaveValue('2030');
|
|
107
|
+
expect(callback).toHaveBeenCalledWith('');
|
|
108
|
+
return [2 /*return*/];
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}); });
|
|
112
|
+
it('should call onChange when year in boundaries after being out of boundaries', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
113
|
+
var callback, date, _a, getByTestId, user;
|
|
114
|
+
return __generator(this, function (_b) {
|
|
115
|
+
switch (_b.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
callback = jest.fn();
|
|
118
|
+
date = '2030-01-01';
|
|
119
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
120
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-year'), '{backspace}{backspace}23')];
|
|
121
|
+
case 1:
|
|
122
|
+
_b.sent();
|
|
123
|
+
expect(getByTestId('date-selector-year')).toHaveValue('2023');
|
|
124
|
+
expect(callback).toHaveBeenCalledWith('2023-01-01');
|
|
125
|
+
return [2 /*return*/];
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}); });
|
|
129
|
+
it('should call onChange with the value changed', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
130
|
+
var callback, date, _a, getByTestId, user;
|
|
131
|
+
return __generator(this, function (_b) {
|
|
132
|
+
switch (_b.label) {
|
|
133
|
+
case 0:
|
|
134
|
+
callback = jest.fn();
|
|
135
|
+
date = '2024-01-01';
|
|
136
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
137
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-day'), '{backspace}3')];
|
|
138
|
+
case 1:
|
|
139
|
+
_b.sent();
|
|
140
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-month'), '{backspace}7')];
|
|
58
141
|
case 2:
|
|
59
|
-
// click outside the calendar
|
|
60
142
|
_b.sent();
|
|
61
|
-
|
|
62
|
-
|
|
143
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-year'), '{backspace}3')];
|
|
144
|
+
case 3:
|
|
145
|
+
_b.sent();
|
|
146
|
+
expect(getByTestId('date-selector-day')).toHaveValue('3');
|
|
147
|
+
expect(getByTestId('date-selector-month')).toHaveValue('7');
|
|
148
|
+
expect(callback).toHaveBeenCalledWith('2023-07-03');
|
|
149
|
+
return [2 /*return*/];
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
}); });
|
|
153
|
+
it('should navigate inputs from day to month when day is over 3', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
154
|
+
var callback, date, _a, getByTestId, user;
|
|
155
|
+
return __generator(this, function (_b) {
|
|
156
|
+
switch (_b.label) {
|
|
157
|
+
case 0:
|
|
158
|
+
callback = jest.fn();
|
|
159
|
+
date = '2024-01-01';
|
|
160
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, user = _a.user;
|
|
161
|
+
return [4 /*yield*/, user.type(getByTestId('date-selector-day'), '{backspace}45')];
|
|
162
|
+
case 1:
|
|
163
|
+
_b.sent();
|
|
164
|
+
expect(getByTestId('date-selector-day')).toHaveValue('4');
|
|
165
|
+
expect(getByTestId('date-selector-month')).toHaveValue('5');
|
|
166
|
+
expect(callback).toHaveBeenCalledWith('2024-05-04');
|
|
63
167
|
return [2 /*return*/];
|
|
64
168
|
}
|
|
65
169
|
});
|
|
66
170
|
}); });
|
|
171
|
+
describe('Calendar button', function () {
|
|
172
|
+
it('should return the selected date when clicking on the calendar', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
|
+
var callback, date, expectedDate, _a, getByTestId, getByLabelText, user, button, calendarCell;
|
|
174
|
+
return __generator(this, function (_b) {
|
|
175
|
+
switch (_b.label) {
|
|
176
|
+
case 0:
|
|
177
|
+
callback = jest.fn();
|
|
178
|
+
date = '2024-01-01';
|
|
179
|
+
expectedDate = '2024-01-17';
|
|
180
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, getByLabelText = _a.getByLabelText, user = _a.user;
|
|
181
|
+
button = getByTestId('calendar-button');
|
|
182
|
+
return [4 /*yield*/, user.click(button)];
|
|
183
|
+
case 1:
|
|
184
|
+
_b.sent();
|
|
185
|
+
calendarCell = getByLabelText(/17 2024/);
|
|
186
|
+
return [4 /*yield*/, user.click(calendarCell)];
|
|
187
|
+
case 2:
|
|
188
|
+
_b.sent();
|
|
189
|
+
expect(callback).toHaveBeenCalledWith(expectedDate);
|
|
190
|
+
expect(calendarCell).not.toBeVisible();
|
|
191
|
+
return [2 /*return*/];
|
|
192
|
+
}
|
|
193
|
+
});
|
|
194
|
+
}); });
|
|
195
|
+
it('should close the calendar when clicking outside', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
196
|
+
var callback, date, _a, getByTestId, getByLabelText, user, button, calendarCell;
|
|
197
|
+
return __generator(this, function (_b) {
|
|
198
|
+
switch (_b.label) {
|
|
199
|
+
case 0:
|
|
200
|
+
callback = jest.fn();
|
|
201
|
+
date = '2024-01-01';
|
|
202
|
+
_a = setup(date, callback), getByTestId = _a.getByTestId, getByLabelText = _a.getByLabelText, user = _a.user;
|
|
203
|
+
button = getByTestId('calendar-button');
|
|
204
|
+
return [4 /*yield*/, user.click(button)];
|
|
205
|
+
case 1:
|
|
206
|
+
_b.sent();
|
|
207
|
+
calendarCell = getByLabelText(/17 2024/);
|
|
208
|
+
expect(calendarCell).toBeVisible();
|
|
209
|
+
// click outside the calendar
|
|
210
|
+
return [4 /*yield*/, user.click(document.body)];
|
|
211
|
+
case 2:
|
|
212
|
+
// click outside the calendar
|
|
213
|
+
_b.sent();
|
|
214
|
+
expect(callback).not.toHaveBeenCalled();
|
|
215
|
+
expect(calendarCell).not.toBeVisible();
|
|
216
|
+
return [2 /*return*/];
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}); });
|
|
220
|
+
});
|
|
67
221
|
});
|
|
68
222
|
//# sourceMappingURL=index.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.test.js","sources":["../../../../../src/lib/components/dateSelector/index.test.tsx"],"sourcesContent":["import { render } from '../../util/testUtils';\n\nimport { DateSelector } from '.';\n\nconst setup = (date: string, onChange: (date: string) => void = () => {}) => {\n return render(\n <DateSelector\n value={date}\n yearBoundaries={{ min: 2020, max: 2025 }}\n onChange={onChange}\n displayCalendar\n />\n );\n};\n\ndescribe('DateSelector component', () => {\n it('should return the selected date when clicking on the calendar', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const expectedDate = '2024-01-17';\n const { getByTestId, getByLabelText, user } = setup(date, callback);\n const button = getByTestId('calendar-button');\n\n await user.click(button);\n\n const calendarCell = getByLabelText(/17 2024/);\n\n await user.click(calendarCell);\n\n expect(callback).toHaveBeenCalledWith(expectedDate);\n\n expect(calendarCell).not.toBeVisible();\n });\n\n it('should close the calendar when clicking outside', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, getByLabelText, user } = setup(date, callback);\n const button = getByTestId('calendar-button');\n\n await user.click(button);\n\n const calendarCell = getByLabelText(/17 2024/);\n expect(calendarCell).toBeVisible();\n\n // click outside the calendar\n await user.click(document.body);\n\n expect(callback).not.toHaveBeenCalled();\n\n expect(calendarCell).not.toBeVisible();\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;AAIA,IAAM,KAAK,GAAG,UAAC,IAAY,EAAE,QAA2C;IAA3C,yBAAA,EAAA,0BAA2C;IACtE,OAAOA,YAAM,CACXC,IAAC,YAAY,IACX,KAAK,EAAE,IAAI,EACX,cAAc,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,EACxC,QAAQ,EAAE,QAAQ,EAClB,eAAe,iBACf,CACH,CAAC;AACJ,CAAC,CAAC;AAEF,QAAQ,CAAC,wBAAwB,EAAE;IACjC,EAAE,CAAC,+DAA+D,EAAE;;;;;oBAC5D,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;oBACrB,IAAI,GAAG,YAAY,CAAC;oBACpB,YAAY,GAAG,YAAY,CAAC;oBAC5B,KAAwC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAA3D,WAAW,iBAAA,EAAE,cAAc,oBAAA,EAAE,IAAI,UAAA,CAA2B;oBAC9D,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;oBAE9C,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAA;;oBAAxB,SAAwB,CAAC;oBAEnB,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;oBAE/C,qBAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,EAAA;;oBAA9B,SAA8B,CAAC;oBAE/B,MAAM,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,YAAY,CAAC,CAAC;oBAEpD,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;;;;SACxC,CAAC,CAAC;IAEH,EAAE,CAAC,iDAAiD,EAAE;;;;;oBAC9C,QAAQ,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;oBACrB,IAAI,GAAG,YAAY,CAAC;oBACpB,KAAwC,KAAK,CAAC,IAAI,EAAE,QAAQ,CAAC,EAA3D,WAAW,iBAAA,EAAE,cAAc,oBAAA,EAAE,IAAI,UAAA,CAA2B;oBAC9D,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;oBAE9C,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAA;;oBAAxB,SAAwB,CAAC;oBAEnB,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;oBAC/C,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;;oBAGnC,qBAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAA;;;oBAA/B,SAA+B,CAAC;oBAEhC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;oBAExC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;;;;SACxC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.test.js","sources":["../../../../../src/lib/components/dateSelector/index.test.tsx"],"sourcesContent":["import { render } from '../../util/testUtils';\n\nimport { DateSelector } from '.';\n\nconst setup = (date?: string, onChange: (date: string) => void = () => {}) => {\n return render(\n <DateSelector\n value={date}\n yearBoundaries={{ min: 2020, max: 2025 }}\n onChange={onChange}\n displayCalendar\n />\n );\n};\n\ndescribe('DateSelector component', () => {\n it('should show the value inside the inputs', () => {\n const date = '2024-01-01';\n const { getByTestId } = setup(date);\n\n expect(getByTestId('date-selector-day')).toHaveValue('1');\n expect(getByTestId('date-selector-month')).toHaveValue('1');\n expect(getByTestId('date-selector-year')).toHaveValue('2024');\n });\n\n it('should call onChange with the value changed', async () => {\n const callback = jest.fn();\n const { getByTestId, user } = setup(undefined, callback);\n\n await user.type(getByTestId('date-selector-day'), '5');\n await user.type(getByTestId('date-selector-month'), '7');\n await user.type(getByTestId('date-selector-year'), '2023');\n\n expect(getByTestId('date-selector-day')).toHaveValue('5');\n expect(getByTestId('date-selector-month')).toHaveValue('7');\n expect(getByTestId('date-selector-year')).toHaveValue('2023');\n expect(callback).toHaveBeenCalledWith('2023-07-05');\n });\n\n it('should call onChange with the value changed with initial value', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, user } = setup(date, callback);\n\n await user.type(getByTestId('date-selector-day'), '{backspace}3');\n await user.type(getByTestId('date-selector-month'), '{backspace}7');\n await user.type(getByTestId('date-selector-year'), '{backspace}3');\n\n expect(getByTestId('date-selector-day')).toHaveValue('3');\n expect(getByTestId('date-selector-month')).toHaveValue('7');\n expect(getByTestId('date-selector-year')).toHaveValue('2023');\n expect(callback).toHaveBeenCalledWith('2023-07-03');\n });\n\n it('should call onChange empty when invalid date', async () => {\n const callback = jest.fn();\n const { getByTestId, user } = setup(undefined, callback);\n\n await user.type(getByTestId('date-selector-day'), '5');\n\n expect(getByTestId('date-selector-day')).toHaveValue('5');\n expect(callback).toHaveBeenCalledWith('');\n });\n\n it('should call onChange empty when year out of boundaries', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, user } = setup(date, callback);\n\n await user.type(getByTestId('date-selector-year'), '{backspace}{backspace}30');\n\n expect(getByTestId('date-selector-year')).toHaveValue('2030');\n expect(callback).toHaveBeenCalledWith('');\n });\n\n it('should call onChange when year in boundaries after being out of boundaries', async () => {\n const callback = jest.fn();\n const date = '2030-01-01';\n const { getByTestId, user } = setup(date, callback);\n\n await user.type(getByTestId('date-selector-year'), '{backspace}{backspace}23');\n\n expect(getByTestId('date-selector-year')).toHaveValue('2023');\n expect(callback).toHaveBeenCalledWith('2023-01-01');\n });\n\n it('should call onChange with the value changed', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, user } = setup(date, callback);\n\n await user.type(getByTestId('date-selector-day'), '{backspace}3');\n await user.type(getByTestId('date-selector-month'), '{backspace}7');\n await user.type(getByTestId('date-selector-year'), '{backspace}3');\n\n expect(getByTestId('date-selector-day')).toHaveValue('3');\n expect(getByTestId('date-selector-month')).toHaveValue('7');\n expect(callback).toHaveBeenCalledWith('2023-07-03');\n });\n\n it('should navigate inputs from day to month when day is over 3', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, user } = setup(date, callback);\n\n await user.type(getByTestId('date-selector-day'), '{backspace}45');\n\n expect(getByTestId('date-selector-day')).toHaveValue('4');\n expect(getByTestId('date-selector-month')).toHaveValue('5');\n expect(callback).toHaveBeenCalledWith('2024-05-04');\n });\n\n describe('Calendar button', () => {\n it('should return the selected date when clicking on the calendar', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const expectedDate = '2024-01-17';\n const { getByTestId, getByLabelText, user } = setup(date, callback);\n const button = getByTestId('calendar-button');\n\n await user.click(button);\n\n const calendarCell = getByLabelText(/17 2024/);\n\n await user.click(calendarCell);\n\n expect(callback).toHaveBeenCalledWith(expectedDate);\n\n expect(calendarCell).not.toBeVisible();\n });\n\n it('should close the calendar when clicking outside', async () => {\n const callback = jest.fn();\n const date = '2024-01-01';\n const { getByTestId, getByLabelText, user } = setup(date, callback);\n const button = getByTestId('calendar-button');\n\n await user.click(button);\n\n const calendarCell = getByLabelText(/17 2024/);\n expect(calendarCell).toBeVisible();\n\n // click outside the calendar\n await user.click(document.body);\n\n expect(callback).not.toHaveBeenCalled();\n\n expect(calendarCell).not.toBeVisible();\n });\n });\n});\n"],"names":["render","_jsx"],"mappings":";;;;;;;;;;;;;;;;;AAIA,IAAM,KAAK,GAAG,UAAC,IAAa,EAAE,QAA2C;IAA3C,yBAAA,EAAA,0BAA2C;IACvE,OAAOA,YAAM,CACXC,IAAC,YAAY,IACX,KAAK,EAAE,IAAI,EACX,cAAc,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EA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IAAI,EAAE,QAAQ,CAAC,EAA3D,WAAW,iBAAA,EAAE,cAAc,oBAAA,EAAE,IAAI,UAAA,CAA2B;wBAC9D,MAAM,GAAG,WAAW,CAAC,iBAAiB,CAAC,CAAC;wBAE9C,qBAAM,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,EAAA;;wBAAxB,SAAwB,CAAC;wBAEnB,YAAY,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;wBAC/C,MAAM,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;;wBAGnC,qBAAM,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAA;;;wBAA/B,SAA+B,CAAC;wBAEhC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;wBAExC,MAAM,CAAC,YAAY,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;;;;aACxC,CAAC,CAAC;KACJ,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -5,9 +5,9 @@ import '../../../tslib.es6-5bc94358.js';
|
|
|
5
5
|
import '../../../index-6ea95111.js';
|
|
6
6
|
import '../../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var Info = (function (props) {
|
|
9
9
|
return createElement(IconWrapper, props, jsx("path", { fill: "currentColor", d: "M11 16v1h2v-1h-2Zm2-8.041a1 1 0 1 0-2 0h2Zm-2 .04a1 1 0 1 0 2 0h-2ZM23 12c0-6.075-4.925-11-11-11v2a9 9 0 0 1 9 9h2ZM12 1C5.925 1 1 5.925 1 12h2a9 9 0 0 1 9-9V1ZM1 12c0 6.075 4.925 11 11 11v-2a9 9 0 0 1-9-9H1Zm11 11c6.075 0 11-4.925 11-11h-2a9 9 0 0 1-9 9v2Zm1-7v-5.5h-2V16h2Zm-2-8.041v.04h2v-.04h-2Z" }, void 0));
|
|
10
10
|
});
|
|
11
11
|
|
|
12
|
-
export default
|
|
12
|
+
export default Info;
|
|
13
13
|
//# sourceMappingURL=Info.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Info.js","sources":["../../../../../../src/lib/components/icon/icons/Info.tsx"],"sourcesContent":["/* Generated file. Do not modify. */\nimport { createElement } from 'react';\nimport { IconWrapper } from '../IconWrapper';\nimport type { IconWrapperProps } from '../IconWrapper';\nexport default (props: IconWrapperProps) =>\n createElement(\n IconWrapper,\n props,\n <path\n fill=\"currentColor\"\n d=\"M11 16v1h2v-1h-2Zm2-8.041a1 1 0 1 0-2 0h2Zm-2 .04a1 1 0 1 0 2 0h-2ZM23 12c0-6.075-4.925-11-11-11v2a9 9 0 0 1 9 9h2ZM12 1C5.925 1 1 5.925 1 12h2a9 9 0 0 1 9-9V1ZM1 12c0 6.075 4.925 11 11 11v-2a9 9 0 0 1-9-9H1Zm11 11c6.075 0 11-4.925 11-11h-2a9 9 0 0 1-9 9v2Zm1-7v-5.5h-2V16h2Zm-2-8.041v.04h2v-.04h-2Z\"\n />\n );\n"],"names":["_jsx"],"mappings":";;;;;;;AAIA,
|
|
1
|
+
{"version":3,"file":"Info.js","sources":["../../../../../../src/lib/components/icon/icons/Info.tsx"],"sourcesContent":["/* Generated file. Do not modify. */\nimport { createElement } from 'react';\nimport { IconWrapper } from '../IconWrapper';\nimport type { IconWrapperProps } from '../IconWrapper';\nexport default (props: IconWrapperProps) =>\n createElement(\n IconWrapper,\n props,\n <path\n fill=\"currentColor\"\n d=\"M11 16v1h2v-1h-2Zm2-8.041a1 1 0 1 0-2 0h2Zm-2 .04a1 1 0 1 0 2 0h-2ZM23 12c0-6.075-4.925-11-11-11v2a9 9 0 0 1 9 9h2ZM12 1C5.925 1 1 5.925 1 12h2a9 9 0 0 1 9-9V1ZM1 12c0 6.075 4.925 11 11 11v-2a9 9 0 0 1-9-9H1Zm11 11c6.075 0 11-4.925 11-11h-2a9 9 0 0 1-9 9v2Zm1-7v-5.5h-2V16h2Zm-2-8.041v.04h2v-.04h-2Z\"\n />\n );\n"],"names":["_jsx"],"mappings":";;;;;;;AAIA,YAAe,UAAC,KAAuB;IACrC,OAAA,aAAa,CACX,WAAW,EACX,KAAK,EACLA,cACE,IAAI,EAAC,cAAc,EACnB,CAAC,EAAC,6SAA6S,WAC/S,CACH;AAPD,CAOC;;;;"}
|
|
@@ -2,7 +2,7 @@ import { _ as __assign } from '../../tslib.es6-5bc94358.js';
|
|
|
2
2
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Input } from '../input/index.js';
|
|
5
|
-
import { i as icons } from '../../index-
|
|
5
|
+
import { i as icons } from '../../index-e506c4ca.js';
|
|
6
6
|
import { Button } from '../button/index.js';
|
|
7
7
|
import { c as classNames } from '../../index-6ea95111.js';
|
|
8
8
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { IconWrapper } from './IconWrapper/IconWrapper.js';
|
|
3
|
-
import { i as icons } from '../../index-
|
|
3
|
+
import { i as icons } from '../../index-e506c4ca.js';
|
|
4
4
|
import '../../tslib.es6-5bc94358.js';
|
|
5
5
|
import '../../index-6ea95111.js';
|
|
6
6
|
import '../../style-inject.es-1f59c1d0.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { CurrencyInput } from './index.js';
|
|
4
|
-
import { s as sharedConfig } from '../../../config-
|
|
4
|
+
import { s as sharedConfig } from '../../../config-1d276a9d.js';
|
|
5
5
|
import '../../../tslib.es6-5bc94358.js';
|
|
6
6
|
import '../index.js';
|
|
7
7
|
import '../../../index-6ea95111.js';
|
|
@@ -26,7 +26,7 @@ var formatIban = function (iban) {
|
|
|
26
26
|
|
|
27
27
|
var IbanInput = function (_a) {
|
|
28
28
|
var value = _a.value, onChange = _a.onChange, props = __rest(_a, ["value", "onChange"]);
|
|
29
|
-
return (jsx(Input, __assign({ value: formatIban(value), onChange: function (e) { return onChange(formatIban(e.target.value)); } }, props), void 0));
|
|
29
|
+
return (jsx(Input, __assign({ value: formatIban(value), onChange: function (e) { return onChange === null || onChange === void 0 ? void 0 : onChange(formatIban(e.target.value)); } }, props), void 0));
|
|
30
30
|
};
|
|
31
31
|
|
|
32
32
|
export default IbanInput;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/input/iban/formatIban/index.ts","../../../../../../src/lib/components/input/iban/index.tsx"],"sourcesContent":["const IBAN_CHAR_LIMIT = 4;\n\nexport const formatIban = (iban?: string): string => {\n if (iban) {\n const cleanIban = iban\n .replace(/\\s\\s+/g, ' ')\n .replace(/[^0-9a-zA-Z]/gi, '')\n .toUpperCase();\n\n const values: string[] = [];\n\n cleanIban.split('').forEach((char, idx) => {\n if (idx % IBAN_CHAR_LIMIT === 0) {\n values.push(cleanIban.substring(idx, idx + IBAN_CHAR_LIMIT));\n }\n });\n\n return values.join(' ');\n }\n\n return '';\n};\n","import { Input, InputProps } from '..';\n\nimport { formatIban } from './formatIban';\n\nconst IbanInput = ({\n value,\n onChange,\n ...props\n}: {\n value?: string;\n onChange: (value: string) => void;\n} & Omit<InputProps, 'onChange' | 'value' | 'ref'>) => (\n <Input\n value={formatIban(value)}\n onChange={(e) => onChange(formatIban(e.target.value))}\n {...props}\n />\n);\n\nexport default IbanInput;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAAA,IAAM,eAAe,GAAG,CAAC,CAAC;AAEnB,IAAM,UAAU,GAAG,UAAC,IAAa;IACtC,IAAI,IAAI,EAAE;QACR,IAAM,WAAS,GAAG,IAAI;aACnB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;aACtB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;aAC7B,WAAW,EAAE,CAAC;QAEjB,IAAM,QAAM,GAAa,EAAE,CAAC;QAE5B,WAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,GAAG;YACpC,IAAI,GAAG,GAAG,eAAe,KAAK,CAAC,EAAE;gBAC/B,QAAM,CAAC,IAAI,CAAC,WAAS,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC;aAC9D;SACF,CAAC,CAAC;QAEH,OAAO,QAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;;ICjBK,SAAS,GAAG,UAAC,EAO+B;IANhD,IAAA,KAAK,WAAA,EACL,QAAQ,cAAA,EACL,KAAK,cAHS,qBAIlB,CADS;IAI6C,QACrDA,IAAC,KAAK,aACJ,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,EACxB,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../../src/lib/components/input/iban/formatIban/index.ts","../../../../../../src/lib/components/input/iban/index.tsx"],"sourcesContent":["const IBAN_CHAR_LIMIT = 4;\n\nexport const formatIban = (iban?: string): string => {\n if (iban) {\n const cleanIban = iban\n .replace(/\\s\\s+/g, ' ')\n .replace(/[^0-9a-zA-Z]/gi, '')\n .toUpperCase();\n\n const values: string[] = [];\n\n cleanIban.split('').forEach((char, idx) => {\n if (idx % IBAN_CHAR_LIMIT === 0) {\n values.push(cleanIban.substring(idx, idx + IBAN_CHAR_LIMIT));\n }\n });\n\n return values.join(' ');\n }\n\n return '';\n};\n","import { Input, InputProps } from '..';\n\nimport { formatIban } from './formatIban';\n\nconst IbanInput = ({\n value,\n onChange,\n ...props\n}: {\n value?: string;\n onChange: (value: string) => void;\n} & Omit<InputProps, 'onChange' | 'value' | 'ref'>) => (\n <Input\n value={formatIban(value)}\n onChange={(e) => onChange?.(formatIban(e.target.value))}\n {...props}\n />\n);\n\nexport default IbanInput;\n"],"names":["_jsx"],"mappings":";;;;;;;;AAAA,IAAM,eAAe,GAAG,CAAC,CAAC;AAEnB,IAAM,UAAU,GAAG,UAAC,IAAa;IACtC,IAAI,IAAI,EAAE;QACR,IAAM,WAAS,GAAG,IAAI;aACnB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;aACtB,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC;aAC7B,WAAW,EAAE,CAAC;QAEjB,IAAM,QAAM,GAAa,EAAE,CAAC;QAE5B,WAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,UAAC,IAAI,EAAE,GAAG;YACpC,IAAI,GAAG,GAAG,eAAe,KAAK,CAAC,EAAE;gBAC/B,QAAM,CAAC,IAAI,CAAC,WAAS,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,GAAG,eAAe,CAAC,CAAC,CAAC;aAC9D;SACF,CAAC,CAAC;QAEH,OAAO,QAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;KACzB;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;;ICjBK,SAAS,GAAG,UAAC,EAO+B;IANhD,IAAA,KAAK,WAAA,EACL,QAAQ,cAAA,EACL,KAAK,cAHS,qBAIlB,CADS;IAI6C,QACrDA,IAAC,KAAK,aACJ,KAAK,EAAE,UAAU,CAAC,KAAK,CAAC,EACxB,QAAQ,EAAE,UAAC,CAAC,IAAK,OAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,GAAA,IACnD,KAAK,UACT,EACH;;;;;"}
|
|
@@ -5,23 +5,26 @@ import { c as classNames } from '../../index-6ea95111.js';
|
|
|
5
5
|
import { g as generateId } from '../../index-fb46adf9.js';
|
|
6
6
|
import { s as styleInject } from '../../style-inject.es-1f59c1d0.js';
|
|
7
7
|
|
|
8
|
-
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-grey-500);\n transition: 0.3s top;\n}\n.style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n.style-module_prefix--disabled__2-gcw {\n color: var(--ds-grey-600);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_placeholder__1U2z0,\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n top: 7px;\n left: 16px;\n transform: translateY(0);\n font-size: 10px;\n line-height: 12px;\n opacity: 1;\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n color: var(--ds-primary-500);\n}\n.style-module_input__1eJO5:focus ~ .style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n color: var(--ds-primary-500);\n}\n.style-module_input__1eJO5:focus ~ .style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ,\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n top: 28px;\n}\n\n.style-module_input__1eJO5 {\n box-sizing: border-box;\n padding-top: 9px;\n font-family: inherit;\n}\n.style-module_input--no-placeholder__3EGwh {\n padding-top: 0px;\n}\n.style-module_input--with-prefix__38e0j {\n padding-left: 32px !important;\n}\n\n.style-module_placeholder__1U2z0 {\n position: absolute;\n pointer-events: none;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n transition: 0.3s ease all;\n color: var(--ds-grey-500);\n}\n.style-module_placeholder--with-prefix__2PquQ {\n left: 32px;\n}\n.style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_label__3FEZ1 {\n display: inline-block;\n margin-bottom: 8px;\n color: var(--ds-grey-600);\n}\n.style-module_label--with-error__166bP {\n color: var(--ds-red-500);\n}\n\n.style-module_error__167Zc {\n margin-top: 4px;\n}";
|
|
9
|
-
var styles = {"container":"style-module_container__2L4SP","prefix":"style-module_prefix__3jAFZ","prefix--with-error":"style-module_prefix--with-error__1yTTM","prefix--disabled":"style-module_prefix--disabled__2-gcw","input":"style-module_input__1eJO5","placeholder":"style-module_placeholder__1U2z0","placeholder--with-error":"style-module_placeholder--with-error__2ieRU","input--no-placeholder":"style-module_input--no-placeholder__3EGwh","input--with-prefix":"style-module_input--with-prefix__38e0j","placeholder--with-prefix":"style-module_placeholder--with-prefix__2PquQ","label":"style-module_label__3FEZ1","label--with-error":"style-module_label--with-error__166bP","error":"style-module_error__167Zc"};
|
|
8
|
+
var css_248z = ".style-module_container__2L4SP {\n position: relative;\n}\n\n.style-module_prefix__3jAFZ {\n position: absolute;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n color: var(--ds-grey-500);\n transition: 0.3s top;\n}\n.style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n.style-module_prefix--disabled__2-gcw {\n color: var(--ds-grey-600);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_placeholder__1U2z0,\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0,\n.style-module_input--with-inside-label__253bZ ~ .style-module_placeholder__1U2z0 {\n top: 7px;\n left: 16px;\n transform: translateY(0);\n font-size: 10px;\n line-height: 12px;\n opacity: 1;\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_placeholder__1U2z0 {\n color: var(--ds-primary-500);\n}\n.style-module_input__1eJO5:focus ~ .style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n color: var(--ds-primary-500);\n}\n.style-module_input__1eJO5:focus ~ .style-module_prefix--with-error__1yTTM {\n color: var(--ds-red-500);\n}\n\n.style-module_input__1eJO5:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ,\n.style-module_input__1eJO5:focus ~ .style-module_prefix__3jAFZ {\n top: 28px;\n}\n\n.style-module_input--with-inside-label__253bZ ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:focus ~ .style-module_prefix__3jAFZ,\n.style-module_input--with-inside-label__253bZ:not(:placeholder-shown) ~ .style-module_prefix__3jAFZ {\n top: 29px;\n}\n\n.style-module_input__1eJO5 {\n box-sizing: border-box;\n padding-top: 9px;\n font-family: inherit;\n}\n.style-module_input--no-placeholder__3EGwh {\n padding-top: 0px;\n}\n.style-module_input--with-prefix__38e0j {\n padding-left: 32px !important;\n}\n\n.style-module_placeholder__1U2z0 {\n position: absolute;\n pointer-events: none;\n left: 16px;\n top: 50%;\n transform: translateY(-50%);\n transition: 0.3s ease all;\n color: var(--ds-grey-500);\n}\n.style-module_placeholder--with-prefix__2PquQ {\n left: 32px;\n}\n.style-module_placeholder--with-error__2ieRU {\n color: var(--ds-red-500);\n}\n\n.style-module_label__3FEZ1 {\n display: inline-block;\n margin-bottom: 8px;\n color: var(--ds-grey-600);\n}\n.style-module_label--with-error__166bP {\n color: var(--ds-red-500);\n}\n\n.style-module_error__167Zc {\n margin-top: 4px;\n}";
|
|
9
|
+
var styles = {"container":"style-module_container__2L4SP","prefix":"style-module_prefix__3jAFZ","prefix--with-error":"style-module_prefix--with-error__1yTTM","prefix--disabled":"style-module_prefix--disabled__2-gcw","input":"style-module_input__1eJO5","placeholder":"style-module_placeholder__1U2z0","input--with-inside-label":"style-module_input--with-inside-label__253bZ","placeholder--with-error":"style-module_placeholder--with-error__2ieRU","input--no-placeholder":"style-module_input--no-placeholder__3EGwh","input--with-prefix":"style-module_input--with-prefix__38e0j","placeholder--with-prefix":"style-module_placeholder--with-prefix__2PquQ","label":"style-module_label__3FEZ1","label--with-error":"style-module_label--with-error__166bP","error":"style-module_error__167Zc"};
|
|
10
10
|
styleInject(css_248z);
|
|
11
11
|
|
|
12
12
|
var Input = require$$0__default.forwardRef(function (_a, ref) {
|
|
13
13
|
var _b, _c, _d, _e, _f, _g;
|
|
14
|
-
var className = _a.className, placeholder = _a.placeholder, label = _a.label, id = _a.id, prefix = _a.prefix, error = _a.error, disabled = _a.disabled, _h = _a.hideLabel, hideLabel = _h === void 0 ? false : _h, props = __rest(_a, ["className", "placeholder", "label", "id", "prefix", "error", "disabled", "hideLabel"]);
|
|
14
|
+
var className = _a.className, placeholder = _a.placeholder, label = _a.label, id = _a.id, prefix = _a.prefix, error = _a.error, disabled = _a.disabled, _h = _a.hideLabel, hideLabel = _h === void 0 ? false : _h, _j = _a.labelInsideInput, labelInsideInput = _j === void 0 ? false : _j, props = __rest(_a, ["className", "placeholder", "label", "id", "prefix", "error", "disabled", "hideLabel", "labelInsideInput"]);
|
|
15
15
|
var uniqueId = useState(id !== null && id !== void 0 ? id : generateId())[0];
|
|
16
|
-
return (jsxs("div", __assign({ className: styles.container + " " + (className !== null && className !== void 0 ? className : '') }, { children: [label && (jsx("label", __assign({ htmlFor: uniqueId, className: classNames('p-p', styles.label, (_b = {},
|
|
16
|
+
return (jsxs("div", __assign({ className: styles.container + " " + (className !== null && className !== void 0 ? className : '') }, { children: [label && !labelInsideInput && (jsx("label", __assign({ htmlFor: uniqueId, className: classNames('p-p', styles.label, (_b = {},
|
|
17
17
|
_b[styles['label--with-error']] = error,
|
|
18
18
|
_b['sr-only'] = hideLabel,
|
|
19
19
|
_b)) }, { children: label }), void 0)),
|
|
20
|
-
jsxs("div", __assign({ style: { position: 'relative' } }, { children: [jsx("input", __assign({ id: uniqueId, "data-testid": "ds-input-input", type: "text", ref: ref, className: classNames(error ? 'p-input--error' : 'p-input', !label && placeholder && placeholder.length > 0
|
|
20
|
+
jsxs("div", __assign({ style: { position: 'relative' } }, { children: [jsx("input", __assign({ id: uniqueId, "data-testid": "ds-input-input", type: "text", ref: ref, className: classNames(error ? 'p-input--error' : 'p-input', (!label || labelInsideInput) && placeholder && placeholder.length > 0
|
|
21
21
|
? styles.input
|
|
22
|
-
: styles['input--no-placeholder'], (_c = {},
|
|
22
|
+
: styles['input--no-placeholder'], (_c = {},
|
|
23
|
+
_c[styles['input--with-prefix']] = prefix,
|
|
24
|
+
_c[styles['input--with-inside-label']] = labelInsideInput,
|
|
25
|
+
_c)), placeholder: label || labelInsideInput ? placeholder : ' ', disabled: disabled }, props), void 0),
|
|
23
26
|
prefix && (jsx("span", __assign({ className: classNames(styles.prefix, (_d = {}, _d[styles['prefix--with-error']] = error, _d), (_e = {}, _e[styles['prefix--disabled']] = disabled, _e)) }, { children: prefix }), void 0)),
|
|
24
|
-
!label && (jsx("label", __assign({ htmlFor: uniqueId, className: classNames(styles.placeholder, (_f = {}, _f[styles['placeholder--with-prefix']] = prefix, _f), (_g = {}, _g[styles['placeholder--with-error']] = error, _g)) }, { children: placeholder }), void 0))] }), void 0),
|
|
27
|
+
(!label || labelInsideInput) && (jsx("label", __assign({ htmlFor: uniqueId, className: classNames(styles.placeholder, (_f = {}, _f[styles['placeholder--with-prefix']] = prefix, _f), (_g = {}, _g[styles['placeholder--with-error']] = error, _g)) }, { children: labelInsideInput ? label : placeholder }), void 0))] }), void 0),
|
|
25
28
|
error && (jsx("p", __assign({ className: "p-p--small tc-red-500 w100 " + styles.error }, { children: error }), void 0))] }), void 0));
|
|
26
29
|
});
|
|
27
30
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/input/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classnames from 'classnames';\nimport generateId from '../../util/generateId';\n\nimport styles from './style.module.scss';\n\n// Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.\nexport type InputProps = Omit<JSX.IntrinsicElements['input'], 'enterKeyHint'> &\n Partial<Pick<JSX.IntrinsicElements['input'], 'enterKeyHint'>> & {\n error?: string;\n prefix?: string;\n label?: string;\n id?: string;\n hideLabel?: boolean;\n};\n\nexport const Input = React.forwardRef(\n (\n {\n className,\n placeholder,\n label,\n id,\n prefix,\n error,\n disabled,\n hideLabel = false,\n ...props\n }: InputProps,\n ref?: React.ForwardedRef<HTMLInputElement>\n ) => {\n const [uniqueId] = useState(id ?? generateId());\n return (\n <div className={`${styles.container} ${className ?? ''}`}>\n {label && (\n <label\n htmlFor={uniqueId}\n className={classnames('p-p', styles.label, {\n [styles['label--with-error']]: error,\n 'sr-only': hideLabel,\n })}\n >\n {label}\n </label>\n )}\n <div style={{ position: 'relative' }}>\n <input\n id={uniqueId}\n data-testid=\"ds-input-input\"\n type=\"text\"\n ref={ref}\n className={classnames(\n error ? 'p-input--error' : 'p-input',\n !label && placeholder && placeholder.length > 0\n ? styles.input\n : styles['input--no-placeholder'],\n {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/lib/components/input/index.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport classnames from 'classnames';\nimport generateId from '../../util/generateId';\n\nimport styles from './style.module.scss';\n\n// Something weird is going on with enterKeyHint that makes it a required field under certain circumstances. The & Omit<…> and & Pick<…> is a hacky way to go around that.\nexport type InputProps = Omit<JSX.IntrinsicElements['input'], 'enterKeyHint'> &\n Partial<Pick<JSX.IntrinsicElements['input'], 'enterKeyHint'>> & {\n error?: string | boolean;\n prefix?: string;\n label?: string;\n id?: string;\n hideLabel?: boolean;\n labelInsideInput?: boolean;\n};\n\nexport const Input = React.forwardRef(\n (\n {\n className,\n placeholder,\n label,\n id,\n prefix,\n error,\n disabled,\n hideLabel = false,\n labelInsideInput = false,\n ...props\n }: InputProps,\n ref?: React.ForwardedRef<HTMLInputElement>\n ) => {\n const [uniqueId] = useState(id ?? generateId());\n\n return (\n <div className={`${styles.container} ${className ?? ''}`}>\n {label && !labelInsideInput && (\n <label\n htmlFor={uniqueId}\n className={classnames('p-p', styles.label, {\n [styles['label--with-error']]: error,\n 'sr-only': hideLabel,\n })}\n >\n {label}\n </label>\n )}\n <div style={{ position: 'relative' }}>\n <input\n id={uniqueId}\n data-testid=\"ds-input-input\"\n type=\"text\"\n ref={ref}\n className={classnames(\n error ? 'p-input--error' : 'p-input',\n (!label || labelInsideInput) && placeholder && placeholder.length > 0\n ? styles.input\n : styles['input--no-placeholder'],\n {\n [styles['input--with-prefix']]: prefix, \n [styles['input--with-inside-label']]: labelInsideInput\n }\n )}\n placeholder={label || labelInsideInput ? placeholder : ' '}\n disabled={disabled}\n {...props}\n />\n {prefix && (\n <span\n className={classnames(\n styles.prefix,\n { [styles['prefix--with-error']]: error },\n { [styles['prefix--disabled']]: disabled }\n )}\n >\n {prefix}\n </span>\n )}\n {(!label || labelInsideInput) && (\n <label\n htmlFor={uniqueId}\n className={classnames(\n styles.placeholder,\n { [styles['placeholder--with-prefix']]: prefix },\n { [styles['placeholder--with-error']]: error }\n )}\n >\n {labelInsideInput ? label : placeholder}\n </label>\n )}\n </div>\n {error && (\n <p className={`p-p--small tc-red-500 w100 ${styles.error}`}>\n {error}\n </p>\n )}\n </div>\n );\n }\n);\n"],"names":["React","_jsxs","_jsx","classnames"],"mappings":";;;;;;;;;;;IAiBa,KAAK,GAAGA,mBAAK,CAAC,UAAU,CACnC,UACE,EAWa,EACb,GAA0C;;IAXxC,IAAA,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,EAAE,QAAA,EACF,MAAM,YAAA,EACN,KAAK,WAAA,EACL,QAAQ,cAAA,EACR,iBAAiB,EAAjB,SAAS,mBAAG,KAAK,KAAA,EACjB,wBAAwB,EAAxB,gBAAgB,mBAAG,KAAK,KAAA,EACrB,KAAK,cAVV,2GAWC,CADS;IAIH,IAAA,QAAQ,GAAI,QAAQ,CAAC,EAAE,aAAF,EAAE,cAAF,EAAE,GAAI,UAAU,EAAE,CAAC,GAAhC,CAAiC;IAEhD,QACEC,uBAAK,SAAS,EAAK,MAAM,CAAC,SAAS,UAAI,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAE,iBACrD,KAAK,IAAI,CAAC,gBAAgB,KACzBC,wBACE,OAAO,EAAE,QAAQ,EACjB,SAAS,EAAEC,UA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AAG,SAAS,EAAE,gCAA8B,MAAM,CAAC,KAAO,gBACvD,KAAK,YACJ,CACL,aACG,EACN;AACJ,CAAC;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { useState } from 'react';
|
|
3
3
|
import { Input } from './index.js';
|
|
4
|
-
import { s as sharedConfig } from '../../config-
|
|
4
|
+
import { s as sharedConfig } from '../../config-1d276a9d.js';
|
|
5
5
|
import '../../tslib.es6-5bc94358.js';
|
|
6
6
|
import '../../index-6ea95111.js';
|
|
7
7
|
import '../../index-fb46adf9.js';
|
|
@@ -16,13 +16,13 @@ var story = {
|
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
18
|
var InputStory = function (_a) {
|
|
19
|
-
var onChange = _a.onChange, className = _a.className, placeholder = _a.placeholder, value = _a.value, label = _a.label, hideLabel = _a.hideLabel, prefix = _a.prefix, error = _a.error;
|
|
19
|
+
var onChange = _a.onChange, className = _a.className, placeholder = _a.placeholder, value = _a.value, label = _a.label, hideLabel = _a.hideLabel, labelInsideInput = _a.labelInsideInput, prefix = _a.prefix, error = _a.error;
|
|
20
20
|
var _b = useState(value), newValue = _b[0], setValue = _b[1];
|
|
21
21
|
var handleOnChange = function (event) {
|
|
22
22
|
setValue(event.target.value);
|
|
23
23
|
onChange === null || onChange === void 0 ? void 0 : onChange(event);
|
|
24
24
|
};
|
|
25
|
-
return (jsx(Input, { onChange: handleOnChange, value: newValue, className: className, placeholder: placeholder, label: label, hideLabel: hideLabel, prefix: prefix, error: error }, void 0));
|
|
25
|
+
return (jsx(Input, { onChange: handleOnChange, value: newValue, className: className, placeholder: placeholder, label: label, hideLabel: hideLabel, labelInsideInput: labelInsideInput, prefix: prefix, error: error }, void 0));
|
|
26
26
|
};
|
|
27
27
|
InputStory.storyName = 'Input';
|
|
28
28
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input.stories.js","sources":["../../../../../src/lib/components/input/input.stories.tsx"],"sourcesContent":["\nimport { ChangeEvent, useState } from 'react';\nimport { Input, InputProps } from '.';\nimport sharedConfig from './stories/config';\n\nconst story = {\n title: 'JSX/Inputs/Input',\n component: Input,\n argTypes: sharedConfig,\n parameters: {\n componentSubtitle: 'The default input component is used to gather informations from the user.'\n }\n};\n\nexport const InputStory = ({ \n onChange,\n className,\n placeholder,\n value,\n label,\n hideLabel,\n prefix,\n error\n}: InputProps) => {\n const [newValue, setValue] = useState(value);\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value)\n onChange?.(event);\n }\n\n return (\n <Input \n onChange={handleOnChange}\n value={newValue}\n className={className}\n placeholder={placeholder}\n label={label}\n hideLabel={hideLabel}\n prefix={prefix}\n error={error}\n />\n );\n};\n\nInputStory.storyName = 'Input';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,YAAY;IACtB,UAAU,EAAE;QACV,iBAAiB,EAAE,2EAA2E;KAC/F;EACD;IAEW,UAAU,GAAG,UAAC,
|
|
1
|
+
{"version":3,"file":"input.stories.js","sources":["../../../../../src/lib/components/input/input.stories.tsx"],"sourcesContent":["\nimport { ChangeEvent, useState } from 'react';\nimport { Input, InputProps } from '.';\nimport sharedConfig from './stories/config';\n\nconst story = {\n title: 'JSX/Inputs/Input',\n component: Input,\n argTypes: sharedConfig,\n parameters: {\n componentSubtitle: 'The default input component is used to gather informations from the user.'\n }\n};\n\nexport const InputStory = ({ \n onChange,\n className,\n placeholder,\n value,\n label,\n hideLabel,\n labelInsideInput,\n prefix,\n error\n}: InputProps) => {\n const [newValue, setValue] = useState(value);\n\n const handleOnChange = (event: ChangeEvent<HTMLInputElement>) => {\n setValue(event.target.value)\n onChange?.(event);\n }\n\n return (\n <Input \n onChange={handleOnChange}\n value={newValue}\n className={className}\n placeholder={placeholder}\n label={label}\n hideLabel={hideLabel}\n labelInsideInput={labelInsideInput}\n prefix={prefix}\n error={error}\n />\n );\n};\n\nInputStory.storyName = 'Input';\n\nexport default story;\n"],"names":["_jsx"],"mappings":";;;;;;;;;IAKM,KAAK,GAAG;IACZ,KAAK,EAAE,kBAAkB;IACzB,SAAS,EAAE,KAAK;IAChB,QAAQ,EAAE,YAAY;IACtB,UAAU,EAAE;QACV,iBAAiB,EAAE,2EAA2E;KAC/F;EACD;IAEW,UAAU,GAAG,UAAC,EAUd;QATX,QAAQ,cAAA,EACR,SAAS,eAAA,EACT,WAAW,iBAAA,EACX,KAAK,WAAA,EACL,KAAK,WAAA,EACL,SAAS,eAAA,EACT,gBAAgB,sBAAA,EAChB,MAAM,YAAA,EACN,KAAK,WAAA;IAEC,IAAA,KAAuB,QAAQ,CAAC,KAAK,CAAC,EAArC,QAAQ,QAAA,EAAE,QAAQ,QAAmB,CAAC;IAE7C,IAAM,cAAc,GAAG,UAAC,KAAoC;QAC1D,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;QAC5B,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAG,KAAK,CAAC,CAAC;KACnB,CAAA;IAED,QACEA,IAAC,KAAK,IACJ,QAAQ,EAAE,cAAc,EACxB,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,WACZ,EACF;AACJ,EAAE;AAEF,UAAU,CAAC,SAAS,GAAG,OAAO;;;;;"}
|
|
@@ -20,7 +20,12 @@ var sharedConfig = {
|
|
|
20
20
|
control: { type: 'text' }
|
|
21
21
|
},
|
|
22
22
|
hideLabel: {
|
|
23
|
-
description: 'Whether or not a label should be hidden
|
|
23
|
+
description: 'Whether or not a label should be hidden. This is needed for accessibility purposes and a label should always be provided',
|
|
24
|
+
defaultValue: false,
|
|
25
|
+
control: { type: 'boolean' }
|
|
26
|
+
},
|
|
27
|
+
labelInsideInput: {
|
|
28
|
+
description: 'Whether or not a label should be visually displayed inside the input borders.',
|
|
24
29
|
defaultValue: false,
|
|
25
30
|
control: { type: 'boolean' }
|
|
26
31
|
},
|
|
@@ -54,4 +59,4 @@ var sharedConfig = {
|
|
|
54
59
|
};
|
|
55
60
|
|
|
56
61
|
export { sharedConfig as s };
|
|
57
|
-
//# sourceMappingURL=config-
|
|
62
|
+
//# sourceMappingURL=config-1d276a9d.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-1d276a9d.js","sources":["../../../src/lib/components/input/stories/config.ts"],"sourcesContent":["const sharedConfig = {\n value: {\n defaultValue: '',\n description: 'Current input value.',\n control: { type: 'text' }\n },\n className: {\n description: 'Wrapper classNames for custom styling',\n defaultValue: '',\n control: { type: 'text' }\n },\n placeholder: {\n description: 'Placeholder for DirtySwan Input component',\n defaultValue: 'Placeholder',\n control: { type: 'text' }\n },\n label: {\n description: 'Label of the Input component',\n defaultValue: 'Input Label',\n control: { type: 'text' }\n },\n hideLabel: {\n description: 'Whether or not a label should be hidden. This is needed for accessibility purposes and a label should always be provided',\n defaultValue: false,\n control: { type: 'boolean' }\n },\n labelInsideInput: {\n description: 'Whether or not a label should be visually displayed inside the input borders.',\n defaultValue: false,\n control: { type: 'boolean' }\n },\n prefix: {\n description: 'A prefix that can be displayed on the left of the input. Specially useful for currencies.',\n defaultValue: '£',\n control: { type: 'text' }\n },\n id: {\n description: 'Unique ID identifier of the input. Relevant for accessibility.',\n defaultValue: '1234567890',\n control: { type: 'text' }\n },\n error: {\n description: 'Error message that will also make input show on error state.',\n defaultValue: '',\n control: { type: 'text' },\n table: {\n type: { \n summary: 'string | boolean'\n },\n },\n },\n onChange: {\n description: 'Function that is called when value of current input changes',\n action: true,\n table: {\n category: \"Callbacks\",\n },\n },\n} \n\nex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Q,EAAE;QACR,WAAW,EAAE,6DAA6D;QAC1E,MAAM,EAAE,IAAI;QACZ,KAAK,EAAE;YACL,QAAQ,EAAE,WAAW;SACtB;KACF;;;;;"}
|
|
@@ -175,7 +175,7 @@ import HospitalBuilding from './components/icon/icons/HospitalBuilding.js';
|
|
|
175
175
|
import ImagePicture from './components/icon/icons/ImagePicture.js';
|
|
176
176
|
import Inbox from './components/icon/icons/Inbox.js';
|
|
177
177
|
import InfoFilled from './components/icon/icons/InfoFilled.js';
|
|
178
|
-
import
|
|
178
|
+
import Info from './components/icon/icons/Info.js';
|
|
179
179
|
import Instagram from './components/icon/icons/Instagram.js';
|
|
180
180
|
import Italic from './components/icon/icons/Italic.js';
|
|
181
181
|
import Key from './components/icon/icons/Key.js';
|
|
@@ -539,7 +539,7 @@ var icons = /*#__PURE__*/Object.freeze({
|
|
|
539
539
|
ImagePictureIcon: ImagePicture,
|
|
540
540
|
InboxIcon: Inbox,
|
|
541
541
|
InfoFilledIcon: InfoFilled,
|
|
542
|
-
InfoIcon:
|
|
542
|
+
InfoIcon: Info,
|
|
543
543
|
InstagramIcon: Instagram,
|
|
544
544
|
ItalicIcon: Italic,
|
|
545
545
|
KeyIcon: Key,
|
|
@@ -726,4 +726,4 @@ var icons = /*#__PURE__*/Object.freeze({
|
|
|
726
726
|
});
|
|
727
727
|
|
|
728
728
|
export { icons as i };
|
|
729
|
-
//# sourceMappingURL=index-
|
|
729
|
+
//# sourceMappingURL=index-e506c4ca.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-
|
|
1
|
+
{"version":3,"file":"index-e506c4ca.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { DateSelector } from './components/dateSelector/index.js';
|
|
2
2
|
export { SignaturePad } from './components/signaturePad/index.js';
|
|
3
3
|
export { AutocompleteAddress } from './components/autocompleteAddress/index.js';
|
|
4
4
|
export { Input } from './components/input/index.js';
|
|
@@ -397,15 +397,16 @@ export { default as TableInfoButton } from './components/comparisonTable/compone
|
|
|
397
397
|
import './tslib.es6-5bc94358.js';
|
|
398
398
|
import 'react/jsx-runtime';
|
|
399
399
|
import 'react';
|
|
400
|
+
import './Calendar-62c6cf21.js';
|
|
400
401
|
import './_commonjsHelpers-e7f67fd8.js';
|
|
401
402
|
import './style-inject.es-1f59c1d0.js';
|
|
402
403
|
import './index-6ea95111.js';
|
|
403
|
-
import './
|
|
404
|
+
import './components/icon/IconWrapper/IconWrapper.js';
|
|
404
405
|
import './index-fb46adf9.js';
|
|
406
|
+
import './index-1463d5e9.js';
|
|
405
407
|
import './index-dd80248b.js';
|
|
406
408
|
import './index-a0ef2ab4.js';
|
|
407
409
|
import './components/multiDropzone/UploadFileCell/index.js';
|
|
408
|
-
import './components/icon/IconWrapper/IconWrapper.js';
|
|
409
410
|
import './useOnClose-d818a54f.js';
|
|
410
411
|
import './feather-logo-a3f07990.js';
|
|
411
412
|
import './index-171a0108.js';
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|