krl-alfred 2.25.2 → 2.25.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Button/Button.js +1 -1
- package/dist/components/Button/Button.test.js +40 -2
- package/dist/components/Dropdown/Dropdown.d.ts +2 -2
- package/dist/components/Dropdown/Dropdown.js +89 -19
- package/dist/components/Dropdown/Dropdown.styled.d.ts +2 -1
- package/dist/components/Dropdown/Dropdown.styled.js +4 -39
- package/dist/components/Dropdown/Dropdown.test.d.ts +1 -0
- package/dist/components/Dropdown/Dropdown.test.js +254 -0
- package/dist/components/Dropdown/props.d.ts +17 -9
- package/dist/components/Dropdown/props.js +3 -0
- package/dist/components/Dropdown/stories/Dropdown.stories.d.ts +44 -2
- package/dist/components/Dropdown/stories/Dropdown.stories.js +6 -3
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Input/Input.js +45 -17
- package/dist/components/Input/Input.styled.js +1 -1
- package/dist/components/Input/Input.test.js +290 -7
- package/dist/components/Input/props.d.ts +5 -0
- package/dist/components/Input/props.js +5 -0
- package/dist/components/Input/stories/Input.stories.d.ts +74 -0
- package/dist/components/Input/stories/Input.stories.js +69 -1
- package/dist/components/PaymentCart/PaymentCart.d.ts +1 -1
- package/dist/components/PaymentCart/PaymentCart.js +4 -4
- package/dist/components/PaymentCart/PaymentCart.styled.js +1 -1
- package/dist/components/PaymentCart/PaymentCart.test.d.ts +1 -0
- package/dist/components/PaymentCart/PaymentCart.test.js +137 -0
- package/dist/components/PaymentCart/props.d.ts +3 -1
- package/dist/components/PaymentCart/props.js +2 -0
- package/dist/components/PaymentCart/stories/PaymentCart.stories.d.ts +63 -0
- package/dist/components/PaymentCart/stories/PaymentCart.stories.js +10 -2
- package/dist/components/ProductCardHorizontal/ProductCardHorizontal.js +1 -1
- package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.d.ts +1 -0
- package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.js +32 -0
- package/dist/components/QuantitySelector/QuantitySelector.d.ts +1 -1
- package/dist/components/QuantitySelector/QuantitySelector.js +5 -3
- package/dist/components/QuantitySelector/QuantitySelector.test.js +141 -35
- package/dist/components/QuantitySelector/props.d.ts +6 -0
- package/dist/components/QuantitySelector/props.js +3 -0
- package/dist/components/QuantitySelector/stories/QuantitySelector.stories.d.ts +43 -1
- package/dist/components/QuantitySelector/stories/QuantitySelector.stories.js +6 -0
- package/dist/components/SearchBox/SearchBox.js +76 -52
- package/dist/components/SearchBox/SearchBox.styled.js +1 -1
- package/dist/components/SearchBox/SearchBox.test.d.ts +1 -0
- package/dist/components/SearchBox/SearchBox.test.js +371 -0
- package/dist/components/SearchBox/props.d.ts +6 -0
- package/dist/components/SearchBox/props.js +3 -0
- package/dist/components/SearchBox/stories/SearchBox.stories.d.ts +23 -0
- package/dist/components/SearchBox/stories/SearchBox.stories.js +4 -0
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.d.ts +1 -1
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.js +2 -2
- package/dist/components/ShoppingCartProduct/ShoppingCartProduct.test.js +67 -0
- package/dist/components/ShoppingCartProduct/props.d.ts +6 -0
- package/dist/components/ShoppingCartProduct/props.js +3 -0
- package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.d.ts +78 -0
- package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.js +6 -0
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +34 -3
- package/dist/components/Tooltip/Tooltip.styled.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.styled.js +3 -3
- package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
- package/dist/components/Tooltip/Tooltip.test.js +152 -0
- package/dist/components/Tooltip/props.d.ts +1 -0
- package/dist/components/Tooltip/props.js +1 -0
- package/dist/components/Tooltip/stories/Tooltip.stories.d.ts +22 -0
- package/dist/components/Tooltip/stories/Tooltip.stories.js +2 -0
- package/dist/i18n/locales/english.json +12 -0
- package/dist/i18n/locales/turkish.json +12 -0
- package/package.json +1 -1
|
@@ -54,16 +54,30 @@ var jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
54
54
|
var react_1 = __importDefault(require("react"));
|
|
55
55
|
var react_2 = require("@testing-library/react");
|
|
56
56
|
var user_event_1 = __importDefault(require("@testing-library/user-event"));
|
|
57
|
+
var i18next_1 = require("i18next");
|
|
58
|
+
var react_i18next_1 = require("react-i18next");
|
|
59
|
+
var english_json_1 = __importDefault(require("../../i18n/locales/english.json"));
|
|
60
|
+
var turkish_json_1 = __importDefault(require("../../i18n/locales/turkish.json"));
|
|
57
61
|
var Input_1 = __importDefault(require("./Input"));
|
|
58
62
|
var props_1 = require("./props");
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
var createTestI18n = function (language) {
|
|
64
|
+
var instance = (0, i18next_1.createInstance)();
|
|
65
|
+
instance.init({
|
|
66
|
+
lng: language,
|
|
67
|
+
fallbackLng: 'en',
|
|
68
|
+
initImmediate: false,
|
|
69
|
+
resources: {
|
|
70
|
+
tr: { translation: turkish_json_1.default },
|
|
71
|
+
en: { translation: english_json_1.default },
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
return instance;
|
|
75
|
+
};
|
|
76
|
+
var renderInput = function (props, language) {
|
|
65
77
|
if (props === void 0) { props = {}; }
|
|
66
|
-
|
|
78
|
+
if (language === void 0) { language = 'tr'; }
|
|
79
|
+
var instance = createTestI18n(language);
|
|
80
|
+
return __assign({ i18n: instance }, (0, react_2.render)((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: instance }, { children: (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { id: "input-test", label: "Label", onChange: jest.fn() }, props)) }))));
|
|
67
81
|
};
|
|
68
82
|
describe('Input', function () {
|
|
69
83
|
it('renders label and placeholder', function () {
|
|
@@ -224,3 +238,272 @@ describe('Input', function () {
|
|
|
224
238
|
});
|
|
225
239
|
}); });
|
|
226
240
|
});
|
|
241
|
+
describe('Input accessibility relationships', function () {
|
|
242
|
+
it('preserves an explicit id and connects the visible label', function () {
|
|
243
|
+
renderInput({ id: 'checkoutCardNumber', label: 'Kart numarası', mask: null });
|
|
244
|
+
var input = react_2.screen.getByRole('textbox', { name: 'Kart numarası' });
|
|
245
|
+
expect(input).toHaveAttribute('id', 'checkoutCardNumber');
|
|
246
|
+
expect(react_2.screen.getByText('Kart numarası')).toHaveAttribute('for', 'checkoutCardNumber');
|
|
247
|
+
});
|
|
248
|
+
it('generates a unique id when one is not provided', function () {
|
|
249
|
+
var instance = createTestI18n('tr');
|
|
250
|
+
(0, react_2.render)((0, jsx_runtime_1.jsxs)(react_i18next_1.I18nextProvider, __assign({ i18n: instance }, { children: [(0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { id: undefined, label: "\u0130lk alan", mask: null })), (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { id: undefined, label: "\u0130kinci alan", mask: null }))] })));
|
|
251
|
+
var first = react_2.screen.getByRole('textbox', { name: 'İlk alan' });
|
|
252
|
+
var second = react_2.screen.getByRole('textbox', { name: 'İkinci alan' });
|
|
253
|
+
expect(first.id).toMatch(/^alfred-input-/);
|
|
254
|
+
expect(second.id).toMatch(/^alfred-input-/);
|
|
255
|
+
expect(first.id).not.toBe(second.id);
|
|
256
|
+
expect(react_2.screen.getByText('İlk alan')).toHaveAttribute('for', first.id);
|
|
257
|
+
expect(react_2.screen.getByText('İkinci alan')).toHaveAttribute('for', second.id);
|
|
258
|
+
});
|
|
259
|
+
it('keeps an automatic id stable in Strict Mode rerenders', function () {
|
|
260
|
+
var instance = createTestI18n('tr');
|
|
261
|
+
var input = ((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: instance }, { children: (0, jsx_runtime_1.jsx)(react_1.default.StrictMode, { children: (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { id: undefined, label: "Kararl\u0131 alan", mask: null })) }) })));
|
|
262
|
+
var rerender = (0, react_2.render)(input).rerender;
|
|
263
|
+
var initialId = react_2.screen.getByRole('textbox', { name: 'Kararlı alan' }).id;
|
|
264
|
+
rerender(input);
|
|
265
|
+
expect(react_2.screen.getByRole('textbox', { name: 'Kararlı alan' })).toHaveAttribute('id', initialId);
|
|
266
|
+
});
|
|
267
|
+
it('focuses the input when its label is clicked', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
268
|
+
var user;
|
|
269
|
+
return __generator(this, function (_a) {
|
|
270
|
+
switch (_a.label) {
|
|
271
|
+
case 0:
|
|
272
|
+
user = user_event_1.default.setup();
|
|
273
|
+
renderInput({ id: undefined, label: 'Kart sahibi', mask: null });
|
|
274
|
+
return [4 /*yield*/, user.click(react_2.screen.getByText('Kart sahibi'))];
|
|
275
|
+
case 1:
|
|
276
|
+
_a.sent();
|
|
277
|
+
expect(react_2.screen.getByRole('textbox', { name: 'Kart sahibi' })).toHaveFocus();
|
|
278
|
+
return [2 /*return*/];
|
|
279
|
+
}
|
|
280
|
+
});
|
|
281
|
+
}); });
|
|
282
|
+
it('connects invalid state and the visible error to the input', function () {
|
|
283
|
+
var _a;
|
|
284
|
+
renderInput({
|
|
285
|
+
id: 'checkoutCardNumber',
|
|
286
|
+
label: 'Kart numarası',
|
|
287
|
+
mask: null,
|
|
288
|
+
hasError: true,
|
|
289
|
+
errorMessage: 'Geçerli bir kart numarası gir',
|
|
290
|
+
});
|
|
291
|
+
var input = react_2.screen.getByRole('textbox', { name: 'Kart numarası' });
|
|
292
|
+
var error = react_2.screen.getByText('Geçerli bir kart numarası gir').closest('.error');
|
|
293
|
+
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
294
|
+
expect(input).toHaveAttribute('aria-describedby', 'checkoutCardNumber-error');
|
|
295
|
+
expect(input).toHaveAttribute('aria-errormessage', 'checkoutCardNumber-error');
|
|
296
|
+
expect(error).toHaveAttribute('id', 'checkoutCardNumber-error');
|
|
297
|
+
expect((_a = error === null || error === void 0 ? void 0 : error.querySelector('svg')) === null || _a === void 0 ? void 0 : _a.closest('[aria-hidden="true"]')).toBeInTheDocument();
|
|
298
|
+
});
|
|
299
|
+
it('does not reference an error node when error text is absent', function () {
|
|
300
|
+
renderInput({ id: 'field', mask: null, hasError: true, errorMessage: null });
|
|
301
|
+
var input = react_2.screen.getByRole('textbox', { name: 'Label' });
|
|
302
|
+
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
303
|
+
expect(input).not.toHaveAttribute('aria-describedby');
|
|
304
|
+
expect(input).not.toHaveAttribute('aria-errormessage');
|
|
305
|
+
});
|
|
306
|
+
it('removes invalid and error relationships when the error clears', function () {
|
|
307
|
+
var props = __assign(__assign({}, props_1.InputDefault), { id: 'field', label: 'Alan', mask: null, hasError: true, errorMessage: 'Hata' });
|
|
308
|
+
var _a = renderInput(props), i18n = _a.i18n, rerender = _a.rerender;
|
|
309
|
+
rerender((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: i18n }, { children: (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props, { hasError: false, errorMessage: null })) })));
|
|
310
|
+
var input = react_2.screen.getByRole('textbox', { name: 'Alan' });
|
|
311
|
+
expect(input).not.toHaveAttribute('aria-invalid');
|
|
312
|
+
expect(input).not.toHaveAttribute('aria-describedby');
|
|
313
|
+
expect(input).not.toHaveAttribute('aria-errormessage');
|
|
314
|
+
expect(document.getElementById('field-error')).not.toBeInTheDocument();
|
|
315
|
+
});
|
|
316
|
+
it('deduplicates consumer, description, and error ids', function () {
|
|
317
|
+
renderInput({
|
|
318
|
+
id: 'field',
|
|
319
|
+
mask: null,
|
|
320
|
+
description: 'Yardımcı açıklama',
|
|
321
|
+
hasError: true,
|
|
322
|
+
errorMessage: 'Hata mesajı',
|
|
323
|
+
'aria-describedby': 'external-hint field-description external-hint field-error',
|
|
324
|
+
});
|
|
325
|
+
var input = react_2.screen.getByRole('textbox', { name: 'Label' });
|
|
326
|
+
expect(input).toHaveAttribute('aria-describedby', 'external-hint field-description field-error');
|
|
327
|
+
expect(react_2.screen.getByText('Yardımcı açıklama')).toHaveAttribute('id', 'field-description');
|
|
328
|
+
expect(react_2.screen.getByText('Hata mesajı').closest('.error')).toHaveAttribute('id', 'field-error');
|
|
329
|
+
});
|
|
330
|
+
it('uses consumer ARIA naming only when there is no visible label', function () {
|
|
331
|
+
var _a = renderInput({
|
|
332
|
+
label: null,
|
|
333
|
+
mask: null,
|
|
334
|
+
'aria-label': 'Etiketsiz alan',
|
|
335
|
+
'aria-required': true,
|
|
336
|
+
}), rerender = _a.rerender, i18n = _a.i18n;
|
|
337
|
+
expect(react_2.screen.getByRole('textbox', { name: 'Etiketsiz alan' })).toHaveAttribute('aria-required', 'true');
|
|
338
|
+
rerender((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: i18n }, { children: (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { label: "G\u00F6r\u00FCn\u00FCr etiket", mask: null, "aria-label": "Ge\u00E7ersiz k\u0131lma" })) })));
|
|
339
|
+
expect(react_2.screen.getByRole('textbox', { name: 'Görünür etiket' })).toBeInTheDocument();
|
|
340
|
+
expect(react_2.screen.queryByRole('textbox', { name: 'Geçersiz kılma' })).not.toBeInTheDocument();
|
|
341
|
+
});
|
|
342
|
+
it('preserves aria-labelledby when there is no visible label', function () {
|
|
343
|
+
var instance = createTestI18n('tr');
|
|
344
|
+
(0, react_2.render)((0, jsx_runtime_1.jsxs)(react_i18next_1.I18nextProvider, __assign({ i18n: instance }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ id: "external-label" }, { children: "Harici alan ad\u0131" })), (0, jsx_runtime_1.jsx)(Input_1.default, __assign({}, props_1.InputDefault, { label: null, mask: null, "aria-labelledby": "external-label" }))] })));
|
|
345
|
+
expect(react_2.screen.getByRole('textbox', { name: 'Harici alan adı' })).toHaveAttribute('aria-labelledby', 'external-label');
|
|
346
|
+
});
|
|
347
|
+
it.each([
|
|
348
|
+
['text', { type: 'text', mask: null }],
|
|
349
|
+
['numeric', { hasNumericFormat: true, mask: null }],
|
|
350
|
+
['pattern', { format: '#### ####', mask: '_' }],
|
|
351
|
+
['password', { type: 'password', mask: null }],
|
|
352
|
+
['date popover', { type: 'date', format: 'dd.MM.yyyy', mask: null, inline: false }],
|
|
353
|
+
['date inline', { type: 'date', format: 'dd.MM.yyyy', mask: null, inline: true }],
|
|
354
|
+
])('applies the same relationships to the %s variant', function (_variant, variantProps) {
|
|
355
|
+
renderInput(__assign(__assign({}, variantProps), { id: 'variant-field', label: 'Varyant alanı', hasError: true, errorMessage: 'Varyant hatası', description: 'Varyant açıklaması' }));
|
|
356
|
+
var input = react_2.screen.getByLabelText('Varyant alanı');
|
|
357
|
+
expect(input.tagName).toBe('INPUT');
|
|
358
|
+
expect(input).toHaveAttribute('id', 'variant-field');
|
|
359
|
+
expect(input).toHaveAttribute('aria-invalid', 'true');
|
|
360
|
+
expect(input).toHaveAttribute('aria-describedby', 'variant-field-description variant-field-error');
|
|
361
|
+
});
|
|
362
|
+
});
|
|
363
|
+
var dateInputProps = {
|
|
364
|
+
type: 'date',
|
|
365
|
+
inline: true,
|
|
366
|
+
value: '15.06.2026',
|
|
367
|
+
format: 'dd.MM.yyyy',
|
|
368
|
+
mask: null,
|
|
369
|
+
};
|
|
370
|
+
describe('Input date picker accessibility', function () {
|
|
371
|
+
it('uses Turkish navigation and day accessible names', function () {
|
|
372
|
+
var _a;
|
|
373
|
+
renderInput(__assign(__assign({}, dateInputProps), { filterDate: function (date) { return date.getDate() !== 16; } }), 'tr');
|
|
374
|
+
expect(react_2.screen.getByRole('button', { name: 'Önceki yıl' })).toBeInTheDocument();
|
|
375
|
+
expect(react_2.screen.getByRole('button', { name: 'Önceki ay' })).toBeInTheDocument();
|
|
376
|
+
expect(react_2.screen.getByRole('button', { name: 'Sonraki ay' })).toBeInTheDocument();
|
|
377
|
+
expect(react_2.screen.getByRole('button', { name: 'Sonraki yıl' })).toBeInTheDocument();
|
|
378
|
+
expect((_a = react_2.screen.getByRole('button', { name: 'Sonraki ay' }).querySelector('svg')) === null || _a === void 0 ? void 0 : _a.closest('[aria-hidden="true"]')).toBeInTheDocument();
|
|
379
|
+
expect(react_2.screen.getByRole('option', { name: /^Tarih seç .*15 Haziran 2026/i })).toBeInTheDocument();
|
|
380
|
+
expect(react_2.screen.getByRole('option', { name: /^Seçilemez .*16 Haziran 2026/i })).toHaveAttribute('aria-disabled', 'true');
|
|
381
|
+
expect(react_2.screen.queryByRole('option', { name: /^(Choose|Not available)/i })).not.toBeInTheDocument();
|
|
382
|
+
});
|
|
383
|
+
it('uses English navigation and day accessible names', function () {
|
|
384
|
+
renderInput(__assign(__assign({}, dateInputProps), { filterDate: function (date) { return date.getDate() !== 16; } }), 'en');
|
|
385
|
+
expect(react_2.screen.getByRole('button', { name: 'Previous year' })).toBeInTheDocument();
|
|
386
|
+
expect(react_2.screen.getByRole('button', { name: 'Previous month' })).toBeInTheDocument();
|
|
387
|
+
expect(react_2.screen.getByRole('button', { name: 'Next month' })).toBeInTheDocument();
|
|
388
|
+
expect(react_2.screen.getByRole('button', { name: 'Next year' })).toBeInTheDocument();
|
|
389
|
+
expect(react_2.screen.getByRole('option', { name: /^Choose date .*15 June 2026/i })).toBeInTheDocument();
|
|
390
|
+
expect(react_2.screen.getByRole('option', { name: /^Not available .*16 June 2026/i })).toHaveAttribute('aria-disabled', 'true');
|
|
391
|
+
expect(react_2.screen.queryByRole('button', { name: 'Önceki ay' })).not.toBeInTheDocument();
|
|
392
|
+
});
|
|
393
|
+
it('updates accessible names when the active language changes', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
394
|
+
var i18n;
|
|
395
|
+
return __generator(this, function (_a) {
|
|
396
|
+
switch (_a.label) {
|
|
397
|
+
case 0:
|
|
398
|
+
i18n = renderInput(dateInputProps, 'tr').i18n;
|
|
399
|
+
expect(react_2.screen.getByRole('button', { name: 'Sonraki ay' })).toBeInTheDocument();
|
|
400
|
+
return [4 /*yield*/, (0, react_2.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
401
|
+
return __generator(this, function (_a) {
|
|
402
|
+
switch (_a.label) {
|
|
403
|
+
case 0: return [4 /*yield*/, i18n.changeLanguage('en')];
|
|
404
|
+
case 1:
|
|
405
|
+
_a.sent();
|
|
406
|
+
return [2 /*return*/];
|
|
407
|
+
}
|
|
408
|
+
});
|
|
409
|
+
}); })];
|
|
410
|
+
case 1:
|
|
411
|
+
_a.sent();
|
|
412
|
+
expect(react_2.screen.getByRole('button', { name: 'Next month' })).toBeInTheDocument();
|
|
413
|
+
expect(react_2.screen.getByRole('option', { name: /^Choose date .*15 June 2026/i })).toBeInTheDocument();
|
|
414
|
+
return [2 /*return*/];
|
|
415
|
+
}
|
|
416
|
+
});
|
|
417
|
+
}); });
|
|
418
|
+
it('keeps month and year navigation behavior', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
419
|
+
var user;
|
|
420
|
+
return __generator(this, function (_a) {
|
|
421
|
+
switch (_a.label) {
|
|
422
|
+
case 0:
|
|
423
|
+
user = user_event_1.default.setup();
|
|
424
|
+
renderInput(dateInputProps, 'tr');
|
|
425
|
+
expect(react_2.screen.getByText('Haziran, 2026')).toBeInTheDocument();
|
|
426
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Sonraki ay' }))];
|
|
427
|
+
case 1:
|
|
428
|
+
_a.sent();
|
|
429
|
+
expect(react_2.screen.getByText('Temmuz, 2026')).toBeInTheDocument();
|
|
430
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Sonraki yıl' }))];
|
|
431
|
+
case 2:
|
|
432
|
+
_a.sent();
|
|
433
|
+
expect(react_2.screen.getByText('Temmuz, 2027')).toBeInTheDocument();
|
|
434
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Önceki yıl' }))];
|
|
435
|
+
case 3:
|
|
436
|
+
_a.sent();
|
|
437
|
+
expect(react_2.screen.getByText('Temmuz, 2026')).toBeInTheDocument();
|
|
438
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Önceki ay' }))];
|
|
439
|
+
case 4:
|
|
440
|
+
_a.sent();
|
|
441
|
+
expect(react_2.screen.getByText('Haziran, 2026')).toBeInTheDocument();
|
|
442
|
+
return [2 /*return*/];
|
|
443
|
+
}
|
|
444
|
+
});
|
|
445
|
+
}); });
|
|
446
|
+
it('keeps bounded navigation buttons named and disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
447
|
+
var user, boundary, navigationNames;
|
|
448
|
+
return __generator(this, function (_a) {
|
|
449
|
+
switch (_a.label) {
|
|
450
|
+
case 0:
|
|
451
|
+
user = user_event_1.default.setup();
|
|
452
|
+
boundary = new Date(2026, 5, 15);
|
|
453
|
+
renderInput(__assign(__assign({}, dateInputProps), { minDate: boundary, maxDate: boundary }), 'tr');
|
|
454
|
+
navigationNames = ['Önceki yıl', 'Önceki ay', 'Sonraki ay', 'Sonraki yıl'];
|
|
455
|
+
navigationNames.forEach(function (name) { return expect(react_2.screen.getByRole('button', { name: name })).toBeDisabled(); });
|
|
456
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('button', { name: 'Sonraki ay' }))];
|
|
457
|
+
case 1:
|
|
458
|
+
_a.sent();
|
|
459
|
+
expect(react_2.screen.getByText('Haziran, 2026')).toBeInTheDocument();
|
|
460
|
+
return [2 /*return*/];
|
|
461
|
+
}
|
|
462
|
+
});
|
|
463
|
+
}); });
|
|
464
|
+
it('keeps filtered dates disabled and returns the existing formatted value on selection', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
465
|
+
var user, onChange;
|
|
466
|
+
return __generator(this, function (_a) {
|
|
467
|
+
switch (_a.label) {
|
|
468
|
+
case 0:
|
|
469
|
+
user = user_event_1.default.setup();
|
|
470
|
+
onChange = jest.fn();
|
|
471
|
+
renderInput(__assign(__assign({}, dateInputProps), { onChange: onChange, filterDate: function (date) { return date.getDate() !== 16; } }), 'tr');
|
|
472
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('option', { name: /^Seçilemez .*16 Haziran 2026/i }))];
|
|
473
|
+
case 1:
|
|
474
|
+
_a.sent();
|
|
475
|
+
expect(onChange).not.toHaveBeenCalled();
|
|
476
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('option', { name: /^Tarih seç .*17 Haziran 2026/i }))];
|
|
477
|
+
case 2:
|
|
478
|
+
_a.sent();
|
|
479
|
+
expect(onChange).toHaveBeenCalledWith('17.06.2026');
|
|
480
|
+
return [2 /*return*/];
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
}); });
|
|
484
|
+
it('preserves popover keyboard navigation and selection', function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
485
|
+
var user, onChange;
|
|
486
|
+
return __generator(this, function (_a) {
|
|
487
|
+
switch (_a.label) {
|
|
488
|
+
case 0:
|
|
489
|
+
user = user_event_1.default.setup();
|
|
490
|
+
onChange = jest.fn();
|
|
491
|
+
renderInput(__assign(__assign({}, dateInputProps), { inline: false, onChange: onChange }), 'tr');
|
|
492
|
+
return [4 /*yield*/, user.click(react_2.screen.getByRole('textbox', { name: 'Label' }))];
|
|
493
|
+
case 1:
|
|
494
|
+
_a.sent();
|
|
495
|
+
expect(react_2.screen.getByRole('button', { name: 'Sonraki ay' })).toBeInTheDocument();
|
|
496
|
+
return [4 /*yield*/, user.keyboard('{ArrowDown}')];
|
|
497
|
+
case 2:
|
|
498
|
+
_a.sent();
|
|
499
|
+
expect(document.activeElement).toHaveAttribute('role', 'option');
|
|
500
|
+
return [4 /*yield*/, user.keyboard('{ArrowRight}{Enter}')];
|
|
501
|
+
case 3:
|
|
502
|
+
_a.sent();
|
|
503
|
+
expect(onChange).toHaveBeenCalledWith('23.06.2026');
|
|
504
|
+
expect(react_2.screen.queryByRole('button', { name: 'Sonraki ay' })).not.toBeInTheDocument();
|
|
505
|
+
return [2 /*return*/];
|
|
506
|
+
}
|
|
507
|
+
});
|
|
508
|
+
}); });
|
|
509
|
+
});
|
|
@@ -39,6 +39,11 @@ export interface Input {
|
|
|
39
39
|
description?: string;
|
|
40
40
|
allowEmptyFormatting?: boolean;
|
|
41
41
|
valueIsNumericString?: boolean;
|
|
42
|
+
'aria-describedby'?: string;
|
|
43
|
+
'aria-errormessage'?: string;
|
|
44
|
+
'aria-label'?: string;
|
|
45
|
+
'aria-labelledby'?: string;
|
|
46
|
+
'aria-required'?: boolean | 'true' | 'false';
|
|
42
47
|
}
|
|
43
48
|
export interface InputStyledProps {
|
|
44
49
|
disabled?: boolean;
|
|
@@ -56,6 +56,15 @@ declare const _default: {
|
|
|
56
56
|
value: {
|
|
57
57
|
control: string;
|
|
58
58
|
};
|
|
59
|
+
"aria-label": {
|
|
60
|
+
control: string;
|
|
61
|
+
};
|
|
62
|
+
"aria-describedby": {
|
|
63
|
+
control: string;
|
|
64
|
+
};
|
|
65
|
+
"aria-required": {
|
|
66
|
+
control: string;
|
|
67
|
+
};
|
|
59
68
|
};
|
|
60
69
|
};
|
|
61
70
|
export default _default;
|
|
@@ -94,6 +103,23 @@ export declare const Empty: {
|
|
|
94
103
|
onChange: (e: any) => void;
|
|
95
104
|
};
|
|
96
105
|
};
|
|
106
|
+
export declare const LabelWithAutomaticId: {
|
|
107
|
+
args: {
|
|
108
|
+
label: string;
|
|
109
|
+
placeholder: string;
|
|
110
|
+
type: string;
|
|
111
|
+
mask: any;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
export declare const LabelWithExplicitId: {
|
|
115
|
+
args: {
|
|
116
|
+
label: string;
|
|
117
|
+
placeholder: string;
|
|
118
|
+
type: string;
|
|
119
|
+
mask: any;
|
|
120
|
+
id: string;
|
|
121
|
+
};
|
|
122
|
+
};
|
|
97
123
|
export declare const WithValue: {
|
|
98
124
|
args: {
|
|
99
125
|
label: string;
|
|
@@ -141,6 +167,28 @@ export declare const WithError: {
|
|
|
141
167
|
onChange: (e: any) => void;
|
|
142
168
|
};
|
|
143
169
|
};
|
|
170
|
+
export declare const WithDescriptionAndError: {
|
|
171
|
+
args: {
|
|
172
|
+
label: string;
|
|
173
|
+
description: string;
|
|
174
|
+
hasError: boolean;
|
|
175
|
+
errorMessage: string;
|
|
176
|
+
type: string;
|
|
177
|
+
mask: any;
|
|
178
|
+
id: string;
|
|
179
|
+
};
|
|
180
|
+
};
|
|
181
|
+
export declare const MaskedCardNumberError: {
|
|
182
|
+
args: {
|
|
183
|
+
label: string;
|
|
184
|
+
placeholder: string;
|
|
185
|
+
format: string;
|
|
186
|
+
mask: string;
|
|
187
|
+
hasError: boolean;
|
|
188
|
+
errorMessage: string;
|
|
189
|
+
id: string;
|
|
190
|
+
};
|
|
191
|
+
};
|
|
144
192
|
export declare const Disabled: {
|
|
145
193
|
args: {
|
|
146
194
|
placeholder: string;
|
|
@@ -250,6 +298,32 @@ export declare const DateInline: {
|
|
|
250
298
|
onChange: (e: any) => void;
|
|
251
299
|
};
|
|
252
300
|
};
|
|
301
|
+
export declare const DateLocalizedAccessibility: {
|
|
302
|
+
args: {
|
|
303
|
+
placeholder: string;
|
|
304
|
+
label: string;
|
|
305
|
+
type: string;
|
|
306
|
+
value: string;
|
|
307
|
+
format: string;
|
|
308
|
+
mask: any;
|
|
309
|
+
inline: boolean;
|
|
310
|
+
id: string;
|
|
311
|
+
filterDate: (date: any) => boolean;
|
|
312
|
+
onChange: (value: any) => void;
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
export declare const DateWithError: {
|
|
316
|
+
args: {
|
|
317
|
+
placeholder: string;
|
|
318
|
+
label: string;
|
|
319
|
+
type: string;
|
|
320
|
+
format: string;
|
|
321
|
+
mask: any;
|
|
322
|
+
hasError: boolean;
|
|
323
|
+
errorMessage: string;
|
|
324
|
+
id: string;
|
|
325
|
+
};
|
|
326
|
+
};
|
|
253
327
|
export declare const DateWithMinMax: {
|
|
254
328
|
args: {
|
|
255
329
|
placeholder: string;
|
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Interactive = exports.PercentageMaskWithValue = exports.PercentageMask = exports.WithMaxLengthAndDescription = exports.ErrorWithCustomLink = exports.Complete = exports.CustomWidth = exports.Number = exports.Tel = exports.Email = exports.PatternFormatWithValue = exports.PatternFormat = exports.PriceFormat = exports.NumericFormat = exports.WithTooltip = exports.WithInfoText = exports.Clearable = exports.WithCopyButton = exports.TimeWithValue = exports.Time = exports.DateWithMinMax = exports.DateInline = exports.DateInput = exports.PasswordWithValue = exports.Password = exports.WithCustomLink = exports.ReadOnly = exports.Disabled = exports.WithError = exports.WithLabel = exports.WithValue = exports.Empty = exports.Default = void 0;
|
|
17
|
+
exports.Interactive = exports.PercentageMaskWithValue = exports.PercentageMask = exports.WithMaxLengthAndDescription = exports.ErrorWithCustomLink = exports.Complete = exports.CustomWidth = exports.Number = exports.Tel = exports.Email = exports.PatternFormatWithValue = exports.PatternFormat = exports.PriceFormat = exports.NumericFormat = exports.WithTooltip = exports.WithInfoText = exports.Clearable = exports.WithCopyButton = exports.TimeWithValue = exports.Time = exports.DateWithMinMax = exports.DateWithError = exports.DateLocalizedAccessibility = exports.DateInline = exports.DateInput = exports.PasswordWithValue = exports.Password = exports.WithCustomLink = exports.ReadOnly = exports.Disabled = exports.MaskedCardNumberError = exports.WithDescriptionAndError = exports.WithError = exports.WithLabel = exports.WithValue = exports.LabelWithExplicitId = exports.LabelWithAutomaticId = exports.Empty = exports.Default = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var react_1 = __importDefault(require("react"));
|
|
20
20
|
var Input_1 = __importDefault(require("../Input"));
|
|
@@ -57,6 +57,9 @@ exports.default = {
|
|
|
57
57
|
label: { control: "text" },
|
|
58
58
|
placeholder: { control: "text" },
|
|
59
59
|
value: { control: "text" },
|
|
60
|
+
"aria-label": { control: "text" },
|
|
61
|
+
"aria-describedby": { control: "text" },
|
|
62
|
+
"aria-required": { control: "boolean" },
|
|
60
63
|
},
|
|
61
64
|
};
|
|
62
65
|
exports.Default = {
|
|
@@ -65,6 +68,23 @@ exports.Default = {
|
|
|
65
68
|
exports.Empty = {
|
|
66
69
|
args: __assign(__assign({}, baseArgs), { label: "Boş input", placeholder: "Bir şey yaz...", value: "", id: "input_empty" }),
|
|
67
70
|
};
|
|
71
|
+
exports.LabelWithAutomaticId = {
|
|
72
|
+
args: {
|
|
73
|
+
label: "Otomatik kimlikli alan",
|
|
74
|
+
placeholder: "Bir değer gir",
|
|
75
|
+
type: "text",
|
|
76
|
+
mask: null,
|
|
77
|
+
},
|
|
78
|
+
};
|
|
79
|
+
exports.LabelWithExplicitId = {
|
|
80
|
+
args: {
|
|
81
|
+
label: "Kart numarası",
|
|
82
|
+
placeholder: "0000 0000 0000 0000",
|
|
83
|
+
type: "text",
|
|
84
|
+
mask: null,
|
|
85
|
+
id: "checkoutCardNumber",
|
|
86
|
+
},
|
|
87
|
+
};
|
|
68
88
|
exports.WithValue = {
|
|
69
89
|
args: __assign(__assign({}, baseArgs), { label: "Dolu input", value: "Örnek değer", id: "input_with_value" }),
|
|
70
90
|
};
|
|
@@ -101,6 +121,28 @@ exports.WithError = {
|
|
|
101
121
|
}
|
|
102
122
|
},
|
|
103
123
|
};
|
|
124
|
+
exports.WithDescriptionAndError = {
|
|
125
|
+
args: {
|
|
126
|
+
label: "Kart sahibi",
|
|
127
|
+
description: "Kartın üzerinde yazdığı biçimde girin.",
|
|
128
|
+
hasError: true,
|
|
129
|
+
errorMessage: "Kart sahibi adı zorunludur.",
|
|
130
|
+
type: "text",
|
|
131
|
+
mask: null,
|
|
132
|
+
id: "checkoutCardHolderName",
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
exports.MaskedCardNumberError = {
|
|
136
|
+
args: {
|
|
137
|
+
label: "Kart numarası",
|
|
138
|
+
placeholder: "0000 0000 0000 0000",
|
|
139
|
+
format: "#### #### #### ####",
|
|
140
|
+
mask: "_",
|
|
141
|
+
hasError: true,
|
|
142
|
+
errorMessage: "Geçerli bir kart numarası girin.",
|
|
143
|
+
id: "checkoutMaskedCardNumber",
|
|
144
|
+
},
|
|
145
|
+
};
|
|
104
146
|
exports.Disabled = {
|
|
105
147
|
args: {
|
|
106
148
|
placeholder: "Disabled input",
|
|
@@ -224,6 +266,32 @@ exports.DateInline = {
|
|
|
224
266
|
}
|
|
225
267
|
},
|
|
226
268
|
};
|
|
269
|
+
exports.DateLocalizedAccessibility = {
|
|
270
|
+
args: {
|
|
271
|
+
placeholder: "Teslimat tarihi seç",
|
|
272
|
+
label: "Teslimat tarihi",
|
|
273
|
+
type: "date",
|
|
274
|
+
value: "15.06.2026",
|
|
275
|
+
format: "dd.MM.yyyy",
|
|
276
|
+
mask: null,
|
|
277
|
+
inline: true,
|
|
278
|
+
id: "input_date_localized",
|
|
279
|
+
filterDate: function (date) { return date.getDay() !== 0 && date.getDay() !== 6; },
|
|
280
|
+
onChange: function (value) { return console.log(value, "onChange"); },
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
exports.DateWithError = {
|
|
284
|
+
args: {
|
|
285
|
+
placeholder: "Teslimat tarihi seç",
|
|
286
|
+
label: "Teslimat tarihi",
|
|
287
|
+
type: "date",
|
|
288
|
+
format: "dd.MM.yyyy",
|
|
289
|
+
mask: null,
|
|
290
|
+
hasError: true,
|
|
291
|
+
errorMessage: "Teslimat tarihi seçin.",
|
|
292
|
+
id: "checkoutDeliveryDate",
|
|
293
|
+
},
|
|
294
|
+
};
|
|
227
295
|
exports.DateWithMinMax = {
|
|
228
296
|
args: {
|
|
229
297
|
placeholder: "Select date",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PaymentCartProps } from "./props";
|
|
3
|
-
declare const PaymentCart: ({ title, infoText, badgeText, badgeVariant, cartIcon, onClickChoosePrimary, onClickChooseSpare, onClickDelete, isShowChoosePrimary, isShowChooseSpare, isShowDelete, isShowDropdown, isShowTextLink, isShowRadio, onClickTextLink, textLinkText, id, onChange, checked, name, value, isHideMobileBadge }: PaymentCartProps) => React.JSX.Element;
|
|
3
|
+
declare const PaymentCart: ({ title, infoText, badgeText, badgeVariant, cartIcon, onClickChoosePrimary, onClickChooseSpare, onClickDelete, isShowChoosePrimary, isShowChooseSpare, isShowDelete, isShowDropdown, isShowTextLink, isShowRadio, onClickTextLink, textLinkText, id, onChange, checked, name, value, isHideMobileBadge, actionMenuAriaLabel, infoTooltipAriaLabel }: PaymentCartProps) => React.JSX.Element;
|
|
4
4
|
export default PaymentCart;
|
|
@@ -26,9 +26,9 @@ var react_i18next_1 = require("react-i18next");
|
|
|
26
26
|
var TextLink_1 = __importDefault(require("../TextLink"));
|
|
27
27
|
var RadioButton_1 = __importDefault(require("../RadioButton"));
|
|
28
28
|
var PaymentCart = function (_a) {
|
|
29
|
-
var _b = _a.title, title = _b === void 0 ? props_1.PaymentCartDefault.title : _b, _c = _a.infoText, infoText = _c === void 0 ? props_1.PaymentCartDefault.infoText : _c, _d = _a.badgeText, badgeText = _d === void 0 ? props_1.PaymentCartDefault.badgeText : _d, _e = _a.badgeVariant, badgeVariant = _e === void 0 ? props_1.PaymentCartDefault.badgeVariant : _e, _f = _a.cartIcon, cartIcon = _f === void 0 ? props_1.PaymentCartDefault.cartIcon : _f, _g = _a.onClickChoosePrimary, onClickChoosePrimary = _g === void 0 ? props_1.PaymentCartDefault.onClickChoosePrimary : _g, _h = _a.onClickChooseSpare, onClickChooseSpare = _h === void 0 ? props_1.PaymentCartDefault.onClickChooseSpare : _h, _j = _a.onClickDelete, onClickDelete = _j === void 0 ? props_1.PaymentCartDefault.onClickDelete : _j, _k = _a.isShowChoosePrimary, isShowChoosePrimary = _k === void 0 ? props_1.PaymentCartDefault.isShowChoosePrimary : _k, _l = _a.isShowChooseSpare, isShowChooseSpare = _l === void 0 ? props_1.PaymentCartDefault.isShowChooseSpare : _l, _m = _a.isShowDelete, isShowDelete = _m === void 0 ? props_1.PaymentCartDefault.isShowDelete : _m, _o = _a.isShowDropdown, isShowDropdown = _o === void 0 ? props_1.PaymentCartDefault.isShowDropdown : _o, _p = _a.isShowTextLink, isShowTextLink = _p === void 0 ? props_1.PaymentCartDefault.isShowTextLink : _p, _q = _a.isShowRadio, isShowRadio = _q === void 0 ? props_1.PaymentCartDefault.isShowRadio : _q, _r = _a.onClickTextLink, onClickTextLink = _r === void 0 ? props_1.PaymentCartDefault.onClickTextLink : _r, _s = _a.textLinkText, textLinkText = _s === void 0 ? props_1.PaymentCartDefault.textLinkText : _s, _t = _a.id, id = _t === void 0 ? props_1.PaymentCartDefault.id : _t, _u = _a.onChange, onChange = _u === void 0 ? props_1.PaymentCartDefault.onChange : _u, _v = _a.checked, checked = _v === void 0 ? props_1.PaymentCartDefault.checked : _v, _w = _a.name, name = _w === void 0 ? props_1.PaymentCartDefault.name : _w, _x = _a.value, value = _x === void 0 ? props_1.PaymentCartDefault.value : _x, _y = _a.isHideMobileBadge, isHideMobileBadge = _y === void 0 ? props_1.PaymentCartDefault.isHideMobileBadge : _y;
|
|
29
|
+
var _b = _a.title, title = _b === void 0 ? props_1.PaymentCartDefault.title : _b, _c = _a.infoText, infoText = _c === void 0 ? props_1.PaymentCartDefault.infoText : _c, _d = _a.badgeText, badgeText = _d === void 0 ? props_1.PaymentCartDefault.badgeText : _d, _e = _a.badgeVariant, badgeVariant = _e === void 0 ? props_1.PaymentCartDefault.badgeVariant : _e, _f = _a.cartIcon, cartIcon = _f === void 0 ? props_1.PaymentCartDefault.cartIcon : _f, _g = _a.onClickChoosePrimary, onClickChoosePrimary = _g === void 0 ? props_1.PaymentCartDefault.onClickChoosePrimary : _g, _h = _a.onClickChooseSpare, onClickChooseSpare = _h === void 0 ? props_1.PaymentCartDefault.onClickChooseSpare : _h, _j = _a.onClickDelete, onClickDelete = _j === void 0 ? props_1.PaymentCartDefault.onClickDelete : _j, _k = _a.isShowChoosePrimary, isShowChoosePrimary = _k === void 0 ? props_1.PaymentCartDefault.isShowChoosePrimary : _k, _l = _a.isShowChooseSpare, isShowChooseSpare = _l === void 0 ? props_1.PaymentCartDefault.isShowChooseSpare : _l, _m = _a.isShowDelete, isShowDelete = _m === void 0 ? props_1.PaymentCartDefault.isShowDelete : _m, _o = _a.isShowDropdown, isShowDropdown = _o === void 0 ? props_1.PaymentCartDefault.isShowDropdown : _o, _p = _a.isShowTextLink, isShowTextLink = _p === void 0 ? props_1.PaymentCartDefault.isShowTextLink : _p, _q = _a.isShowRadio, isShowRadio = _q === void 0 ? props_1.PaymentCartDefault.isShowRadio : _q, _r = _a.onClickTextLink, onClickTextLink = _r === void 0 ? props_1.PaymentCartDefault.onClickTextLink : _r, _s = _a.textLinkText, textLinkText = _s === void 0 ? props_1.PaymentCartDefault.textLinkText : _s, _t = _a.id, id = _t === void 0 ? props_1.PaymentCartDefault.id : _t, _u = _a.onChange, onChange = _u === void 0 ? props_1.PaymentCartDefault.onChange : _u, _v = _a.checked, checked = _v === void 0 ? props_1.PaymentCartDefault.checked : _v, _w = _a.name, name = _w === void 0 ? props_1.PaymentCartDefault.name : _w, _x = _a.value, value = _x === void 0 ? props_1.PaymentCartDefault.value : _x, _y = _a.isHideMobileBadge, isHideMobileBadge = _y === void 0 ? props_1.PaymentCartDefault.isHideMobileBadge : _y, _z = _a.actionMenuAriaLabel, actionMenuAriaLabel = _z === void 0 ? props_1.PaymentCartDefault.actionMenuAriaLabel : _z, _0 = _a.infoTooltipAriaLabel, infoTooltipAriaLabel = _0 === void 0 ? props_1.PaymentCartDefault.infoTooltipAriaLabel : _0;
|
|
30
30
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
31
|
-
var
|
|
31
|
+
var _1 = (0, react_1.useState)([]), paymentDropdownList = _1[0], setPaymentDropdownList = _1[1];
|
|
32
32
|
(0, react_1.useEffect)(function () {
|
|
33
33
|
var list = [];
|
|
34
34
|
if (isShowChoosePrimary) {
|
|
@@ -50,7 +50,7 @@ var PaymentCart = function (_a) {
|
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
52
|
setPaymentDropdownList(list);
|
|
53
|
-
}, [isShowChoosePrimary, isShowChooseSpare, isShowDelete]);
|
|
54
|
-
return ((0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.PaymentCartStyled, __assign({ "$checked": checked, htmlFor: id, "$isShowRadio": isShowRadio }, { children: [(0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.LeftFrame, { children: [isShowRadio && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.RadioButtonWrapper, { children: (0, jsx_runtime_1.jsx)(RadioButton_1.default, { id: id, onChange: onChange, checked: checked, isWrapText: false, layout: "basic", size: "small", name: name, value: value }) })), (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.ImageWrapper, { children: cartIcon }), (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.Title, { children: (0, jsx_runtime_1.jsx)("span", { children: title }) })] }), (0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.RightFrame, { children: [badgeText && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.BadgeWrapper, __assign({ "$isHideMobileBadge": isHideMobileBadge }, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { title: badgeText, layout: "text", variant: badgeVariant }) }))), infoText && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TooltipWrapper, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupSize: "small", position: "topRight", popupWidth: "147px", iconWidth: "24px", iconHeight: "24px", popupRight: "-8px" }, { children: (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TooltipDescription, { children: infoText }) })) })), isShowTextLink && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TextLinkWrapper, { children: (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({ onClick: onClickTextLink }, { children: textLinkText })) })), isShowDropdown && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.DropdownWrapper, { children: (0, jsx_runtime_1.jsx)(Dropdown_1.default, { size: "small", list: paymentDropdownList, isShowTopChevron: true, Toggle: function () { return (0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.DropdownToggleButton, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "MoreCircle" }), " "] }); }, childrenVariant: "primary", right: "-12px", width: "170px", top: "calc(100% + 10px)" }) }))] })] })));
|
|
53
|
+
}, [isShowChoosePrimary, isShowChooseSpare, isShowDelete, onClickChoosePrimary, onClickChooseSpare, onClickDelete, t]);
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.PaymentCartStyled, __assign({ "$checked": checked, htmlFor: id, "$isShowRadio": isShowRadio }, { children: [(0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.LeftFrame, { children: [isShowRadio && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.RadioButtonWrapper, { children: (0, jsx_runtime_1.jsx)(RadioButton_1.default, { id: id, onChange: onChange, checked: checked, isWrapText: false, layout: "basic", size: "small", name: name, value: value }) })), (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.ImageWrapper, __assign({ "aria-hidden": "true" }, { children: cartIcon })), (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.Title, { children: (0, jsx_runtime_1.jsx)("span", { children: title }) })] }), (0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.RightFrame, { children: [badgeText && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.BadgeWrapper, __assign({ "$isHideMobileBadge": isHideMobileBadge }, { children: (0, jsx_runtime_1.jsx)(Badges_1.default, { title: badgeText, layout: "text", variant: badgeVariant }) }))), infoText && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TooltipWrapper, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ hasClickAction: true, selectorAriaLabel: infoTooltipAriaLabel || t("PAYMENT_CARD_INFORMATION"), popupSize: "small", position: "topRight", popupWidth: "147px", iconWidth: "24px", iconHeight: "24px", popupRight: "-8px" }, { children: (0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TooltipDescription, { children: infoText }) })) })), isShowTextLink && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.TextLinkWrapper, { children: (0, jsx_runtime_1.jsx)(TextLink_1.default, __assign({ onClick: onClickTextLink }, { children: textLinkText })) })), isShowDropdown && ((0, jsx_runtime_1.jsx)(PaymentCart_styled_1.DropdownWrapper, { children: (0, jsx_runtime_1.jsx)(Dropdown_1.default, { toggleAriaLabel: actionMenuAriaLabel || t("PAYMENT_CARD_ACTIONS"), menuAriaLabel: actionMenuAriaLabel || t("PAYMENT_CARD_ACTIONS"), size: "small", list: paymentDropdownList, isShowTopChevron: true, Toggle: function () { return (0, jsx_runtime_1.jsxs)(PaymentCart_styled_1.DropdownToggleButton, __assign({ "aria-hidden": "true" }, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "MoreCircle" }), " "] })); }, childrenVariant: "primary", right: "-12px", width: "170px", top: "calc(100% + 10px)" }) }))] })] })));
|
|
55
55
|
};
|
|
56
56
|
exports.default = PaymentCart;
|
|
@@ -17,7 +17,7 @@ exports.RightFrame = styled_components_1.default.div(templateObject_4 || (templa
|
|
|
17
17
|
exports.BadgeWrapper = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n > * {\n display: block !important;\n }\n ", ";\n"], ["\n > * {\n display: block !important;\n }\n ", ";\n"])), function (props) { return props.$isHideMobileBadge && "\n @media only screen and ".concat(devices_1.devices.lg, " {\n display: none !important;\n }\n "); });
|
|
18
18
|
exports.TooltipWrapper = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n margin-left: 1rem;\n"], ["\n margin-left: 1rem;\n"])));
|
|
19
19
|
exports.DropdownWrapper = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n margin-left: 1rem;\n"], ["\n margin-left: 1rem;\n"])));
|
|
20
|
-
exports.DropdownToggleButton = styled_components_1.default.span(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n box-sizing: border-box;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 0;\n padding: 0;\n cursor: pointer;\n transition: all .2s;\n
|
|
20
|
+
exports.DropdownToggleButton = styled_components_1.default.span(templateObject_8 || (templateObject_8 = __makeTemplateObject(["\n box-sizing: border-box;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 0;\n padding: 0;\n cursor: pointer;\n transition: all .2s;\n border:0;\n background: none;\n color: var(--primary);\n"], ["\n box-sizing: border-box;\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 0;\n padding: 0;\n cursor: pointer;\n transition: all .2s;\n border:0;\n background: none;\n color: var(--primary);\n"])));
|
|
21
21
|
exports.Title = styled_components_1.default.strong(templateObject_9 || (templateObject_9 = __makeTemplateObject(["\n font: var(--body-bold-14-17);\n span{\n display: inline-block;\n vertical-align: middle;\n position: relative;\n line-height: 17px;\n }\n"], ["\n font: var(--body-bold-14-17);\n span{\n display: inline-block;\n vertical-align: middle;\n position: relative;\n line-height: 17px;\n }\n"])));
|
|
22
22
|
exports.TooltipDescription = styled_components_1.default.div(templateObject_10 || (templateObject_10 = __makeTemplateObject(["\n text-align: center;\n font: var(--caption-semi-bold-11-13);\n"], ["\n text-align: center;\n font: var(--caption-semi-bold-11-13);\n"])));
|
|
23
23
|
exports.TextLinkWrapper = styled_components_1.default.div(templateObject_11 || (templateObject_11 = __makeTemplateObject(["\n font: var(--body-bold-14-17);\n margin-left: 1rem;\n"], ["\n font: var(--body-bold-14-17);\n margin-left: 1rem;\n"])));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|