krl-alfred 2.25.2 → 2.25.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/dist/components/Dropdown/Dropdown.d.ts +2 -2
  2. package/dist/components/Dropdown/Dropdown.js +89 -19
  3. package/dist/components/Dropdown/Dropdown.styled.d.ts +2 -1
  4. package/dist/components/Dropdown/Dropdown.styled.js +4 -39
  5. package/dist/components/Dropdown/Dropdown.test.d.ts +1 -0
  6. package/dist/components/Dropdown/Dropdown.test.js +254 -0
  7. package/dist/components/Dropdown/props.d.ts +17 -9
  8. package/dist/components/Dropdown/props.js +3 -0
  9. package/dist/components/Dropdown/stories/Dropdown.stories.d.ts +44 -2
  10. package/dist/components/Dropdown/stories/Dropdown.stories.js +6 -3
  11. package/dist/components/Input/Input.d.ts +1 -1
  12. package/dist/components/Input/Input.js +45 -17
  13. package/dist/components/Input/Input.styled.js +1 -1
  14. package/dist/components/Input/Input.test.js +290 -7
  15. package/dist/components/Input/props.d.ts +5 -0
  16. package/dist/components/Input/props.js +5 -0
  17. package/dist/components/Input/stories/Input.stories.d.ts +74 -0
  18. package/dist/components/Input/stories/Input.stories.js +69 -1
  19. package/dist/components/PaymentCart/PaymentCart.d.ts +1 -1
  20. package/dist/components/PaymentCart/PaymentCart.js +4 -4
  21. package/dist/components/PaymentCart/PaymentCart.styled.js +1 -1
  22. package/dist/components/PaymentCart/PaymentCart.test.d.ts +1 -0
  23. package/dist/components/PaymentCart/PaymentCart.test.js +137 -0
  24. package/dist/components/PaymentCart/props.d.ts +3 -1
  25. package/dist/components/PaymentCart/props.js +2 -0
  26. package/dist/components/PaymentCart/stories/PaymentCart.stories.d.ts +63 -0
  27. package/dist/components/PaymentCart/stories/PaymentCart.stories.js +10 -2
  28. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.js +1 -1
  29. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.d.ts +1 -0
  30. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.js +32 -0
  31. package/dist/components/QuantitySelector/QuantitySelector.d.ts +1 -1
  32. package/dist/components/QuantitySelector/QuantitySelector.js +5 -3
  33. package/dist/components/QuantitySelector/QuantitySelector.test.js +141 -35
  34. package/dist/components/QuantitySelector/props.d.ts +6 -0
  35. package/dist/components/QuantitySelector/props.js +3 -0
  36. package/dist/components/QuantitySelector/stories/QuantitySelector.stories.d.ts +43 -1
  37. package/dist/components/QuantitySelector/stories/QuantitySelector.stories.js +6 -0
  38. package/dist/components/SearchBox/SearchBox.js +76 -52
  39. package/dist/components/SearchBox/SearchBox.styled.js +1 -1
  40. package/dist/components/SearchBox/SearchBox.test.d.ts +1 -0
  41. package/dist/components/SearchBox/SearchBox.test.js +371 -0
  42. package/dist/components/SearchBox/props.d.ts +6 -0
  43. package/dist/components/SearchBox/props.js +3 -0
  44. package/dist/components/SearchBox/stories/SearchBox.stories.d.ts +23 -0
  45. package/dist/components/SearchBox/stories/SearchBox.stories.js +4 -0
  46. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.d.ts +1 -1
  47. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.js +2 -2
  48. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.test.js +67 -0
  49. package/dist/components/ShoppingCartProduct/props.d.ts +6 -0
  50. package/dist/components/ShoppingCartProduct/props.js +3 -0
  51. package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.d.ts +78 -0
  52. package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.js +6 -0
  53. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  54. package/dist/components/Tooltip/Tooltip.js +34 -3
  55. package/dist/components/Tooltip/Tooltip.styled.d.ts +1 -1
  56. package/dist/components/Tooltip/Tooltip.styled.js +3 -3
  57. package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
  58. package/dist/components/Tooltip/Tooltip.test.js +152 -0
  59. package/dist/components/Tooltip/props.d.ts +1 -0
  60. package/dist/components/Tooltip/props.js +1 -0
  61. package/dist/components/Tooltip/stories/Tooltip.stories.d.ts +22 -0
  62. package/dist/components/Tooltip/stories/Tooltip.stories.js +2 -0
  63. package/dist/i18n/locales/english.json +12 -0
  64. package/dist/i18n/locales/turkish.json +12 -0
  65. package/package.json +1 -1
@@ -0,0 +1,137 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ var __importDefault = (this && this.__importDefault) || function (mod) {
50
+ return (mod && mod.__esModule) ? mod : { "default": mod };
51
+ };
52
+ Object.defineProperty(exports, "__esModule", { value: true });
53
+ var jsx_runtime_1 = require("react/jsx-runtime");
54
+ var react_1 = require("@testing-library/react");
55
+ var user_event_1 = __importDefault(require("@testing-library/user-event"));
56
+ var i18next_1 = require("i18next");
57
+ var react_i18next_1 = require("react-i18next");
58
+ var english_json_1 = __importDefault(require("../../i18n/locales/english.json"));
59
+ var turkish_json_1 = __importDefault(require("../../i18n/locales/turkish.json"));
60
+ var PaymentCart_1 = __importDefault(require("./PaymentCart"));
61
+ var createTestI18n = function (language) {
62
+ if (language === void 0) { language = 'tr'; }
63
+ var instance = (0, i18next_1.createInstance)();
64
+ instance.init({
65
+ lng: language,
66
+ fallbackLng: 'en',
67
+ initImmediate: false,
68
+ resources: { tr: { translation: turkish_json_1.default }, en: { translation: english_json_1.default } },
69
+ });
70
+ return instance;
71
+ };
72
+ var labels = {
73
+ actionMenuAriaLabel: '1234 ile biten kartın işlemleri',
74
+ infoTooltipAriaLabel: '1234 ile biten kart hakkında bilgi',
75
+ };
76
+ var renderCard = function (props, language) {
77
+ if (props === void 0) { props = {}; }
78
+ if (language === void 0) { language = 'tr'; }
79
+ return (0, react_1.render)((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: createTestI18n(language) }, { children: (0, jsx_runtime_1.jsx)(PaymentCart_1.default, __assign({ title: "**** 1234", infoText: "Kart bilgisi" }, labels, props)) })));
80
+ };
81
+ describe('PaymentCart accessibility', function () {
82
+ it('forwards card-specific names to its action and info buttons', function () {
83
+ renderCard();
84
+ expect(react_1.screen.getByRole('button', { name: labels.actionMenuAriaLabel })).toBeInTheDocument();
85
+ expect(react_1.screen.getByRole('button', { name: labels.infoTooltipAriaLabel })).toBeInTheDocument();
86
+ });
87
+ it('keeps action and information icons decorative', function () {
88
+ var _a, _b;
89
+ renderCard({ cartIcon: (0, jsx_runtime_1.jsx)("svg", { "aria-label": "Card brand" }) });
90
+ var action = react_1.screen.getByRole('button', { name: labels.actionMenuAriaLabel });
91
+ var info = react_1.screen.getByRole('button', { name: labels.infoTooltipAriaLabel });
92
+ expect((_a = action.querySelector('svg')) === null || _a === void 0 ? void 0 : _a.closest('[aria-hidden="true"]')).toBeInTheDocument();
93
+ expect((_b = info.querySelector('svg')) === null || _b === void 0 ? void 0 : _b.closest('[aria-hidden="true"]')).toBeInTheDocument();
94
+ expect(react_1.screen.getByLabelText('Card brand').closest('[aria-hidden="true"]')).toBeInTheDocument();
95
+ });
96
+ it('only renders the action control when dropdown is enabled', function () {
97
+ renderCard({ isShowDropdown: false });
98
+ expect(react_1.screen.queryByRole('button', { name: labels.actionMenuAriaLabel })).not.toBeInTheDocument();
99
+ });
100
+ it('runs payment actions from the keyboard', function () { return __awaiter(void 0, void 0, void 0, function () {
101
+ var user, onClickChoosePrimary, onClickChooseSpare, onClickDelete, trigger;
102
+ return __generator(this, function (_a) {
103
+ switch (_a.label) {
104
+ case 0:
105
+ user = user_event_1.default.setup();
106
+ onClickChoosePrimary = jest.fn();
107
+ onClickChooseSpare = jest.fn();
108
+ onClickDelete = jest.fn();
109
+ renderCard({ onClickChoosePrimary: onClickChoosePrimary, onClickChooseSpare: onClickChooseSpare, onClickDelete: onClickDelete });
110
+ trigger = react_1.screen.getByRole('button', { name: labels.actionMenuAriaLabel });
111
+ trigger.focus();
112
+ return [4 /*yield*/, user.keyboard('[ArrowDown]')];
113
+ case 1:
114
+ _a.sent();
115
+ return [4 /*yield*/, user.keyboard('[End]')];
116
+ case 2:
117
+ _a.sent();
118
+ return [4 /*yield*/, user.keyboard('[Enter]')];
119
+ case 3:
120
+ _a.sent();
121
+ expect(onClickDelete).toHaveBeenCalledTimes(1);
122
+ expect(onClickChoosePrimary).not.toHaveBeenCalled();
123
+ expect(onClickChooseSpare).not.toHaveBeenCalled();
124
+ expect(trigger).toHaveFocus();
125
+ return [2 /*return*/];
126
+ }
127
+ });
128
+ }); });
129
+ it.each([
130
+ ['tr', 'Ödeme kartı işlemleri', 'Ödeme kartı hakkında bilgi'],
131
+ ['en', 'Payment card actions', 'Payment card information'],
132
+ ])('uses localized %s fallback names', function (language, actionLabel, infoLabel) {
133
+ renderCard({ actionMenuAriaLabel: null, infoTooltipAriaLabel: null }, language);
134
+ expect(react_1.screen.getByRole('button', { name: actionLabel })).toBeInTheDocument();
135
+ expect(react_1.screen.getByRole('button', { name: infoLabel })).toBeInTheDocument();
136
+ });
137
+ });
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  interface PaymentCart {
3
- title?: string;
3
+ title?: React.ReactNode;
4
4
  infoText?: string;
5
5
  badgeText?: string;
6
6
  badgeVariant?: string;
@@ -22,6 +22,8 @@ interface PaymentCart {
22
22
  name?: string;
23
23
  value?: string;
24
24
  isHideMobileBadge?: boolean;
25
+ actionMenuAriaLabel?: string;
26
+ infoTooltipAriaLabel?: string;
25
27
  }
26
28
  export interface PaymentCartStyledProps {
27
29
  $checked?: boolean;
@@ -24,4 +24,6 @@ exports.PaymentCartDefault = {
24
24
  name: null,
25
25
  value: null,
26
26
  isHideMobileBadge: true,
27
+ actionMenuAriaLabel: null,
28
+ infoTooltipAriaLabel: null,
27
29
  };
@@ -41,6 +41,12 @@ declare const _default: {
41
41
  onChange: {
42
42
  action: string;
43
43
  };
44
+ actionMenuAriaLabel: {
45
+ control: string;
46
+ };
47
+ infoTooltipAriaLabel: {
48
+ control: string;
49
+ };
44
50
  };
45
51
  };
46
52
  export default _default;
@@ -68,6 +74,8 @@ export declare const Default: {
68
74
  name: string;
69
75
  value: string;
70
76
  onChange: (e: any) => void;
77
+ actionMenuAriaLabel: string;
78
+ infoTooltipAriaLabel: string;
71
79
  };
72
80
  };
73
81
  export declare const Checked: {
@@ -94,6 +102,8 @@ export declare const Checked: {
94
102
  name: string;
95
103
  value: string;
96
104
  onChange: (e: any) => void;
105
+ actionMenuAriaLabel: string;
106
+ infoTooltipAriaLabel: string;
97
107
  };
98
108
  };
99
109
  export declare const WithRadio: {
@@ -120,6 +130,8 @@ export declare const WithRadio: {
120
130
  name: string;
121
131
  value: string;
122
132
  onChange: (e: any) => void;
133
+ actionMenuAriaLabel: string;
134
+ infoTooltipAriaLabel: string;
123
135
  };
124
136
  };
125
137
  export declare const WithTextLink: {
@@ -146,6 +158,8 @@ export declare const WithTextLink: {
146
158
  name: string;
147
159
  value: string;
148
160
  onChange: (e: any) => void;
161
+ actionMenuAriaLabel: string;
162
+ infoTooltipAriaLabel: string;
149
163
  };
150
164
  };
151
165
  export declare const WithoutBadge: {
@@ -172,6 +186,8 @@ export declare const WithoutBadge: {
172
186
  name: string;
173
187
  value: string;
174
188
  onChange: (e: any) => void;
189
+ actionMenuAriaLabel: string;
190
+ infoTooltipAriaLabel: string;
175
191
  };
176
192
  };
177
193
  export declare const WithoutInfo: {
@@ -198,6 +214,8 @@ export declare const WithoutInfo: {
198
214
  name: string;
199
215
  value: string;
200
216
  onChange: (e: any) => void;
217
+ actionMenuAriaLabel: string;
218
+ infoTooltipAriaLabel: string;
201
219
  };
202
220
  };
203
221
  export declare const WithoutDropdown: {
@@ -224,6 +242,8 @@ export declare const WithoutDropdown: {
224
242
  name: string;
225
243
  value: string;
226
244
  onChange: (e: any) => void;
245
+ actionMenuAriaLabel: string;
246
+ infoTooltipAriaLabel: string;
227
247
  };
228
248
  };
229
249
  export declare const SecondaryBadge: {
@@ -250,6 +270,8 @@ export declare const SecondaryBadge: {
250
270
  name: string;
251
271
  value: string;
252
272
  onChange: (e: any) => void;
273
+ actionMenuAriaLabel: string;
274
+ infoTooltipAriaLabel: string;
253
275
  };
254
276
  };
255
277
  export declare const Minimal: {
@@ -276,6 +298,8 @@ export declare const Minimal: {
276
298
  name: string;
277
299
  value: string;
278
300
  onChange: (e: any) => void;
301
+ actionMenuAriaLabel: string;
302
+ infoTooltipAriaLabel: string;
279
303
  };
280
304
  };
281
305
  export declare const HideMobileBadge: {
@@ -302,6 +326,8 @@ export declare const HideMobileBadge: {
302
326
  name: string;
303
327
  value: string;
304
328
  onChange: (e: any) => void;
329
+ actionMenuAriaLabel: string;
330
+ infoTooltipAriaLabel: string;
305
331
  };
306
332
  };
307
333
  export declare const ShowMobileBadge: {
@@ -328,6 +354,8 @@ export declare const ShowMobileBadge: {
328
354
  name: string;
329
355
  value: string;
330
356
  onChange: (e: any) => void;
357
+ actionMenuAriaLabel: string;
358
+ infoTooltipAriaLabel: string;
331
359
  };
332
360
  };
333
361
  export declare const DeleteOnly: {
@@ -354,6 +382,8 @@ export declare const DeleteOnly: {
354
382
  name: string;
355
383
  value: string;
356
384
  onChange: (e: any) => void;
385
+ actionMenuAriaLabel: string;
386
+ infoTooltipAriaLabel: string;
357
387
  };
358
388
  };
359
389
  export declare const CheckedWithTextLink: {
@@ -380,6 +410,8 @@ export declare const CheckedWithTextLink: {
380
410
  name: string;
381
411
  value: string;
382
412
  onChange: (e: any) => void;
413
+ actionMenuAriaLabel: string;
414
+ infoTooltipAriaLabel: string;
383
415
  };
384
416
  };
385
417
  export declare const Interactive: {
@@ -407,5 +439,36 @@ export declare const Interactive: {
407
439
  name: string;
408
440
  value: string;
409
441
  onChange: (e: any) => void;
442
+ actionMenuAriaLabel: string;
443
+ infoTooltipAriaLabel: string;
444
+ };
445
+ };
446
+ export declare const AccessibleActionsInTwoLanguages: {
447
+ render: (args: any) => React.JSX.Element;
448
+ args: {
449
+ infoText: string;
450
+ badgeText: string;
451
+ title: string;
452
+ cartIcon: React.JSX.Element;
453
+ isShowChoosePrimary: boolean;
454
+ isShowChooseSpare: boolean;
455
+ isShowDelete: boolean;
456
+ badgeVariant: string;
457
+ onClickChoosePrimary: () => void;
458
+ onClickChooseSpare: () => void;
459
+ onClickDelete: () => void;
460
+ onClickTextLink: () => void;
461
+ isShowTextLink: boolean;
462
+ isShowDropdown: boolean;
463
+ checked: boolean;
464
+ isShowRadio: boolean;
465
+ textLinkText: string;
466
+ id: string;
467
+ isHideMobileBadge: boolean;
468
+ name: string;
469
+ value: string;
470
+ onChange: (e: any) => void;
471
+ actionMenuAriaLabel: string;
472
+ infoTooltipAriaLabel: string;
410
473
  };
411
474
  };
@@ -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.CheckedWithTextLink = exports.DeleteOnly = exports.ShowMobileBadge = exports.HideMobileBadge = exports.Minimal = exports.SecondaryBadge = exports.WithoutDropdown = exports.WithoutInfo = exports.WithoutBadge = exports.WithTextLink = exports.WithRadio = exports.Checked = exports.Default = void 0;
17
+ exports.AccessibleActionsInTwoLanguages = exports.Interactive = exports.CheckedWithTextLink = exports.DeleteOnly = exports.ShowMobileBadge = exports.HideMobileBadge = exports.Minimal = exports.SecondaryBadge = exports.WithoutDropdown = exports.WithoutInfo = exports.WithoutBadge = exports.WithTextLink = exports.WithRadio = exports.Checked = 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 PaymentCart_1 = __importDefault(require("../PaymentCart"));
@@ -43,6 +43,8 @@ var baseArgs = {
43
43
  name: "payment",
44
44
  value: "card_1",
45
45
  onChange: function (e) { return console.log("onChange", e); },
46
+ actionMenuAriaLabel: "5967 ile biten kartın işlemleri",
47
+ infoTooltipAriaLabel: "5967 ile biten kart hakkında bilgi",
46
48
  };
47
49
  var defaultArgs = baseArgs;
48
50
  exports.default = {
@@ -62,6 +64,8 @@ exports.default = {
62
64
  isShowDelete: { control: "boolean" },
63
65
  isHideMobileBadge: { control: "boolean" },
64
66
  onChange: { action: "changed" },
67
+ actionMenuAriaLabel: { control: "text" },
68
+ infoTooltipAriaLabel: { control: "text" },
65
69
  },
66
70
  };
67
71
  exports.Default = {
@@ -108,9 +112,13 @@ var InteractiveStory = function (args) {
108
112
  return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { display: "flex", flexDirection: "column", gap: 12, maxWidth: 674 } }, { children: [[
109
113
  { id: "payment_a", title: "**** 5967", badgeText: "Birincil" },
110
114
  { id: "payment_b", title: "**** 1244", badgeText: "Yedek", badgeVariant: "secondary" },
111
- ].map(function (card) { return ((0, jsx_runtime_1.jsx)(PaymentCart_1.default, __assign({}, args, card, { name: "payment_interactive", value: card.id, isShowRadio: true, checked: selected === card.id, onChange: function () { return setSelected(card.id); } }), card.id)); }), (0, jsx_runtime_1.jsxs)("p", __assign({ style: { margin: 0, font: "var(--caption-semi-bold-12-15)", color: "var(--text-soft)" } }, { children: ["Se\u00E7ili: ", selected] }))] })));
115
+ ].map(function (card) { return ((0, jsx_runtime_1.jsx)(PaymentCart_1.default, __assign({}, args, card, { name: "payment_interactive", value: card.id, isShowRadio: true, checked: selected === card.id, onChange: function () { return setSelected(card.id); }, actionMenuAriaLabel: "".concat(card.title.slice(-4), " ile biten kart\u0131n i\u015Flemleri"), infoTooltipAriaLabel: "".concat(card.title.slice(-4), " ile biten kart hakk\u0131nda bilgi") }), card.id)); }), (0, jsx_runtime_1.jsxs)("p", __assign({ style: { margin: 0, font: "var(--caption-semi-bold-12-15)", color: "var(--text-soft)" } }, { children: ["Se\u00E7ili: ", selected] }))] })));
112
116
  };
113
117
  exports.Interactive = {
114
118
  render: function (args) { return (0, jsx_runtime_1.jsx)(InteractiveStory, __assign({}, args)); },
115
119
  args: __assign(__assign({}, defaultArgs), { isShowRadio: true }),
116
120
  };
121
+ exports.AccessibleActionsInTwoLanguages = {
122
+ render: function (args) { return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: { display: "flex", flexDirection: "column", gap: 12, maxWidth: 674 } }, { children: [(0, jsx_runtime_1.jsx)(PaymentCart_1.default, __assign({}, args, { title: "**** 1234", badgeText: "Yedek", infoText: null, actionMenuAriaLabel: "1234 ile biten kart\u0131n i\u015Flemleri" })), (0, jsx_runtime_1.jsx)(PaymentCart_1.default, __assign({}, args, { title: "**** 5678", badgeText: "Primary", badgeVariant: "secondary", isShowDropdown: false, infoText: "This card is currently primary", infoTooltipAriaLabel: "Information about the card ending in 5678" }))] }))); },
123
+ args: defaultArgs,
124
+ };
@@ -25,6 +25,6 @@ var ProductCardHorizontal = function (_a) {
25
25
  var item = _a.item, children = _a.children;
26
26
  return item.component ? ((0, jsx_runtime_1.jsx)(item.component, { children: children })) : ((0, jsx_runtime_1.jsx)("a", __assign({ href: item.slug }, { children: children })));
27
27
  };
28
- return (hasLoading ? ((0, jsx_runtime_1.jsx)(ProductCardHorizontal_styled_1.ProductCardHorizontalStyled, __assign({ "$size": size, "$hasLoading": hasLoading }, { children: (0, jsx_runtime_1.jsx)("a", { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "horizontalWrapper" }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ className: "img" }, { children: ["x", (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: size === "small" ? "71px" : "142px", height: size === "small" ? "50px" : "77px", hasInset: true })] })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "text" }, { children: [(0, jsx_runtime_1.jsxs)("strong", __assign({ className: "title" }, { children: ["x", (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "400px", height: size === "small" ? "15px" : "19px", hasInset: true })] })), (0, jsx_runtime_1.jsxs)("p", __assign({ className: "description" }, { children: ["x", (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "300px", height: "17px", hasInset: true })] })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "priceContent", style: { marginTop: 4 } }, { children: (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "150px", height: size === "small" ? "13px" : "17px" }) }))] }))] })) }) }))) : ((0, jsx_runtime_1.jsx)(ProductCardHorizontal_styled_1.ProductCardHorizontalStyled, __assign({ "$size": size, onClick: onClick }, { children: (0, jsx_runtime_1.jsx)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "horizontalWrapper" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "img" }, { children: image })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "text" }, { children: [(0, jsx_runtime_1.jsx)("strong", __assign({ className: "title" }, { children: title })), (0, jsx_runtime_1.jsx)("p", __assign({ className: "description" }, { children: description })), price && period && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "priceContent" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "price" }, { children: price })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "period" }, { children: "/".concat(period) }))] })))] }))] })) })) }))));
28
+ return (hasLoading ? ((0, jsx_runtime_1.jsx)(ProductCardHorizontal_styled_1.ProductCardHorizontalStyled, __assign({ "$size": size, "$hasLoading": hasLoading, "aria-hidden": "true" }, { children: (0, jsx_runtime_1.jsx)("div", { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "horizontalWrapper" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "img" }, { children: (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: size === "small" ? "71px" : "142px", height: size === "small" ? "50px" : "77px", hasInset: true }) })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "text" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "title" }, { children: (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "400px", height: size === "small" ? "15px" : "19px", hasInset: true }) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "description" }, { children: (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "300px", height: "17px", hasInset: true }) })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "priceContent", style: { marginTop: 4 } }, { children: (0, jsx_runtime_1.jsx)(SkeletonLoader_1.default, { width: "150px", height: size === "small" ? "13px" : "17px" }) }))] }))] })) }) }))) : ((0, jsx_runtime_1.jsx)(ProductCardHorizontal_styled_1.ProductCardHorizontalStyled, __assign({ "$size": size, onClick: onClick }, { children: (0, jsx_runtime_1.jsx)(LinkComponent, __assign({ item: { component: component, slug: slug } }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "horizontalWrapper" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "img" }, { children: image })), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "text" }, { children: [(0, jsx_runtime_1.jsx)("strong", __assign({ className: "title" }, { children: title })), (0, jsx_runtime_1.jsx)("p", __assign({ className: "description" }, { children: description })), price && period && ((0, jsx_runtime_1.jsxs)("div", __assign({ className: "priceContent" }, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ className: "price" }, { children: price })), (0, jsx_runtime_1.jsx)("div", __assign({ className: "period" }, { children: "/".concat(period) }))] })))] }))] })) })) }))));
29
29
  };
30
30
  exports.default = ProductCardHorizontal;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ var jsx_runtime_1 = require("react/jsx-runtime");
7
+ var react_1 = require("@testing-library/react");
8
+ var ProductCardHorizontal_1 = __importDefault(require("./ProductCardHorizontal"));
9
+ describe("ProductCardHorizontal", function () {
10
+ it("renders product content", function () {
11
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { title: "Product title", description: "Product description", price: "100 TL", period: "month", slug: "/product" }));
12
+ expect(react_1.screen.getByRole("link")).toHaveAttribute("href", "/product");
13
+ expect(react_1.screen.getByText("Product title")).toBeInTheDocument();
14
+ expect(react_1.screen.getByText("100 TL")).toBeInTheDocument();
15
+ });
16
+ it("calls onClick when the card is clicked", function () {
17
+ var onClick = jest.fn();
18
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { title: "Product title", onClick: onClick }));
19
+ react_1.fireEvent.click(react_1.screen.getByText("Product title"));
20
+ expect(onClick).toHaveBeenCalledTimes(1);
21
+ });
22
+ it("hides loading placeholders without rendering filler text", function () {
23
+ var container = (0, react_1.render)((0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { hasLoading: true })).container;
24
+ expect(container.firstChild).toHaveAttribute("aria-hidden", "true");
25
+ expect(container).not.toHaveTextContent("x");
26
+ });
27
+ it("renders untrusted title text without creating executable markup", function () {
28
+ (0, react_1.render)((0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { title: '<script>alert("xss")</script>' }));
29
+ expect(react_1.screen.getByText('<script>alert("xss")</script>')).toBeInTheDocument();
30
+ expect(document.querySelector("script")).not.toBeInTheDocument();
31
+ });
32
+ });
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { QuantitySelectorProps } from "./props";
3
- declare const QuantitySelector: ({ label, id, orientation, quantity, onIncrement, onDecrement, onRemove, hasRemove, hasLoading, hasError, errorText, hasDisableActions, hasDisableIncrement, }: QuantitySelectorProps) => React.JSX.Element;
3
+ declare const QuantitySelector: ({ label, id, orientation, quantity, onIncrement, onDecrement, onRemove, incrementAriaLabel, decrementAriaLabel, removeAriaLabel, hasRemove, hasLoading, hasError, errorText, hasDisableActions, hasDisableIncrement, }: QuantitySelectorProps) => React.JSX.Element;
4
4
  export default QuantitySelector;
@@ -19,14 +19,16 @@ var props_1 = require("./props");
19
19
  var QuantitySelector_styled_1 = require("./QuantitySelector.styled");
20
20
  var Icon_1 = __importDefault(require("../Icon/Icon"));
21
21
  var Loader_1 = __importDefault(require("../Loader"));
22
+ var react_i18next_1 = require("react-i18next");
22
23
  var QuantitySelector = function (_a) {
23
- var _b = _a.label, label = _b === void 0 ? props_1.QuantitySelectorDefault.label : _b, _c = _a.id, id = _c === void 0 ? props_1.QuantitySelectorDefault.id : _c, _d = _a.orientation, orientation = _d === void 0 ? props_1.QuantitySelectorDefault.orientation : _d, _e = _a.quantity, quantity = _e === void 0 ? props_1.QuantitySelectorDefault.quantity : _e, _f = _a.onIncrement, onIncrement = _f === void 0 ? props_1.QuantitySelectorDefault.onIncrement : _f, _g = _a.onDecrement, onDecrement = _g === void 0 ? props_1.QuantitySelectorDefault.onDecrement : _g, _h = _a.onRemove, onRemove = _h === void 0 ? props_1.QuantitySelectorDefault.onRemove : _h, _j = _a.hasRemove, hasRemove = _j === void 0 ? props_1.QuantitySelectorDefault.hasRemove : _j, _k = _a.hasLoading, hasLoading = _k === void 0 ? props_1.QuantitySelectorDefault.hasLoading : _k, _l = _a.hasError, hasError = _l === void 0 ? props_1.QuantitySelectorDefault.hasError : _l, _m = _a.errorText, errorText = _m === void 0 ? props_1.QuantitySelectorDefault.errorText : _m, _o = _a.hasDisableActions, hasDisableActions = _o === void 0 ? props_1.QuantitySelectorDefault.hasDisableActions : _o, _p = _a.hasDisableIncrement, hasDisableIncrement = _p === void 0 ? props_1.QuantitySelectorDefault.hasDisableIncrement : _p;
24
+ var _b = _a.label, label = _b === void 0 ? props_1.QuantitySelectorDefault.label : _b, _c = _a.id, id = _c === void 0 ? props_1.QuantitySelectorDefault.id : _c, _d = _a.orientation, orientation = _d === void 0 ? props_1.QuantitySelectorDefault.orientation : _d, _e = _a.quantity, quantity = _e === void 0 ? props_1.QuantitySelectorDefault.quantity : _e, _f = _a.onIncrement, onIncrement = _f === void 0 ? props_1.QuantitySelectorDefault.onIncrement : _f, _g = _a.onDecrement, onDecrement = _g === void 0 ? props_1.QuantitySelectorDefault.onDecrement : _g, _h = _a.onRemove, onRemove = _h === void 0 ? props_1.QuantitySelectorDefault.onRemove : _h, _j = _a.incrementAriaLabel, incrementAriaLabel = _j === void 0 ? props_1.QuantitySelectorDefault.incrementAriaLabel : _j, _k = _a.decrementAriaLabel, decrementAriaLabel = _k === void 0 ? props_1.QuantitySelectorDefault.decrementAriaLabel : _k, _l = _a.removeAriaLabel, removeAriaLabel = _l === void 0 ? props_1.QuantitySelectorDefault.removeAriaLabel : _l, _m = _a.hasRemove, hasRemove = _m === void 0 ? props_1.QuantitySelectorDefault.hasRemove : _m, _o = _a.hasLoading, hasLoading = _o === void 0 ? props_1.QuantitySelectorDefault.hasLoading : _o, _p = _a.hasError, hasError = _p === void 0 ? props_1.QuantitySelectorDefault.hasError : _p, _q = _a.errorText, errorText = _q === void 0 ? props_1.QuantitySelectorDefault.errorText : _q, _r = _a.hasDisableActions, hasDisableActions = _r === void 0 ? props_1.QuantitySelectorDefault.hasDisableActions : _r, _s = _a.hasDisableIncrement, hasDisableIncrement = _s === void 0 ? props_1.QuantitySelectorDefault.hasDisableIncrement : _s;
25
+ var t = (0, react_i18next_1.useTranslation)().t;
24
26
  var styledProps = {
25
27
  $orientation: orientation,
26
28
  $hasDisableActions: hasDisableActions,
27
29
  };
28
- var decrementButton = hasRemove ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading, onClick: onRemove }, styledProps, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading, onClick: onDecrement }, styledProps, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "NegativeSmall" }) })));
29
- var incrementButton = ((0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", disabled: hasLoading || hasError || hasDisableIncrement, onClick: onIncrement }, styledProps, { children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }), hasError && ((0, jsx_runtime_1.jsx)("div", { className: "popup", dangerouslySetInnerHTML: { __html: errorText } }))] })));
30
+ var decrementButton = hasRemove ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "aria-label": removeAriaLabel || t("REMOVE_ITEM"), disabled: hasLoading, onClick: onRemove }, styledProps, { children: (0, jsx_runtime_1.jsx)("div", __assign({ "aria-hidden": "true" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) })) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "aria-label": decrementAriaLabel || t("DECREASE_QUANTITY"), disabled: hasLoading, onClick: onDecrement }, styledProps, { children: (0, jsx_runtime_1.jsx)("div", __assign({ "aria-hidden": "true" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "NegativeSmall" }) })) })));
31
+ var incrementButton = ((0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "aria-label": incrementAriaLabel || t("INCREASE_QUANTITY"), disabled: hasLoading || hasError || hasDisableIncrement, onClick: onIncrement }, styledProps, { children: [(0, jsx_runtime_1.jsx)("div", __assign({ "aria-hidden": "true" }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })), hasError && ((0, jsx_runtime_1.jsx)("div", { className: "popup", dangerouslySetInnerHTML: { __html: errorText } }))] })));
30
32
  var isHorizontal = orientation === 'horizontal';
31
33
  return ((0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.Container, { children: [label && (0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.Label, __assign({ htmlFor: id }, { children: label })), (0, jsx_runtime_1.jsxs)(QuantitySelector_styled_1.Controls, __assign({}, styledProps, { children: [!hasDisableActions && (isHorizontal ? decrementButton : incrementButton), (0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.QuantityValue, __assign({}, styledProps, { children: hasLoading ? (0, jsx_runtime_1.jsx)(Loader_1.default, { variant: "primary", width: "16px", height: "16px" }) : quantity })), !hasDisableActions && (isHorizontal ? incrementButton : decrementButton)] }))] }));
32
34
  };