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.
Files changed (67) hide show
  1. package/dist/components/Button/Button.js +1 -1
  2. package/dist/components/Button/Button.test.js +40 -2
  3. package/dist/components/Dropdown/Dropdown.d.ts +2 -2
  4. package/dist/components/Dropdown/Dropdown.js +89 -19
  5. package/dist/components/Dropdown/Dropdown.styled.d.ts +2 -1
  6. package/dist/components/Dropdown/Dropdown.styled.js +4 -39
  7. package/dist/components/Dropdown/Dropdown.test.d.ts +1 -0
  8. package/dist/components/Dropdown/Dropdown.test.js +254 -0
  9. package/dist/components/Dropdown/props.d.ts +17 -9
  10. package/dist/components/Dropdown/props.js +3 -0
  11. package/dist/components/Dropdown/stories/Dropdown.stories.d.ts +44 -2
  12. package/dist/components/Dropdown/stories/Dropdown.stories.js +6 -3
  13. package/dist/components/Input/Input.d.ts +1 -1
  14. package/dist/components/Input/Input.js +45 -17
  15. package/dist/components/Input/Input.styled.js +1 -1
  16. package/dist/components/Input/Input.test.js +290 -7
  17. package/dist/components/Input/props.d.ts +5 -0
  18. package/dist/components/Input/props.js +5 -0
  19. package/dist/components/Input/stories/Input.stories.d.ts +74 -0
  20. package/dist/components/Input/stories/Input.stories.js +69 -1
  21. package/dist/components/PaymentCart/PaymentCart.d.ts +1 -1
  22. package/dist/components/PaymentCart/PaymentCart.js +4 -4
  23. package/dist/components/PaymentCart/PaymentCart.styled.js +1 -1
  24. package/dist/components/PaymentCart/PaymentCart.test.d.ts +1 -0
  25. package/dist/components/PaymentCart/PaymentCart.test.js +137 -0
  26. package/dist/components/PaymentCart/props.d.ts +3 -1
  27. package/dist/components/PaymentCart/props.js +2 -0
  28. package/dist/components/PaymentCart/stories/PaymentCart.stories.d.ts +63 -0
  29. package/dist/components/PaymentCart/stories/PaymentCart.stories.js +10 -2
  30. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.js +1 -1
  31. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.d.ts +1 -0
  32. package/dist/components/ProductCardHorizontal/ProductCardHorizontal.test.js +32 -0
  33. package/dist/components/QuantitySelector/QuantitySelector.d.ts +1 -1
  34. package/dist/components/QuantitySelector/QuantitySelector.js +5 -3
  35. package/dist/components/QuantitySelector/QuantitySelector.test.js +141 -35
  36. package/dist/components/QuantitySelector/props.d.ts +6 -0
  37. package/dist/components/QuantitySelector/props.js +3 -0
  38. package/dist/components/QuantitySelector/stories/QuantitySelector.stories.d.ts +43 -1
  39. package/dist/components/QuantitySelector/stories/QuantitySelector.stories.js +6 -0
  40. package/dist/components/SearchBox/SearchBox.js +76 -52
  41. package/dist/components/SearchBox/SearchBox.styled.js +1 -1
  42. package/dist/components/SearchBox/SearchBox.test.d.ts +1 -0
  43. package/dist/components/SearchBox/SearchBox.test.js +371 -0
  44. package/dist/components/SearchBox/props.d.ts +6 -0
  45. package/dist/components/SearchBox/props.js +3 -0
  46. package/dist/components/SearchBox/stories/SearchBox.stories.d.ts +23 -0
  47. package/dist/components/SearchBox/stories/SearchBox.stories.js +4 -0
  48. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.d.ts +1 -1
  49. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.js +2 -2
  50. package/dist/components/ShoppingCartProduct/ShoppingCartProduct.test.js +67 -0
  51. package/dist/components/ShoppingCartProduct/props.d.ts +6 -0
  52. package/dist/components/ShoppingCartProduct/props.js +3 -0
  53. package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.d.ts +78 -0
  54. package/dist/components/ShoppingCartProduct/stories/ShoppingCartProduct.stories.js +6 -0
  55. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  56. package/dist/components/Tooltip/Tooltip.js +34 -3
  57. package/dist/components/Tooltip/Tooltip.styled.d.ts +1 -1
  58. package/dist/components/Tooltip/Tooltip.styled.js +3 -3
  59. package/dist/components/Tooltip/Tooltip.test.d.ts +1 -0
  60. package/dist/components/Tooltip/Tooltip.test.js +152 -0
  61. package/dist/components/Tooltip/props.d.ts +1 -0
  62. package/dist/components/Tooltip/props.js +1 -0
  63. package/dist/components/Tooltip/stories/Tooltip.stories.d.ts +22 -0
  64. package/dist/components/Tooltip/stories/Tooltip.stories.js +2 -0
  65. package/dist/i18n/locales/english.json +12 -0
  66. package/dist/i18n/locales/turkish.json +12 -0
  67. package/package.json +1 -1
@@ -0,0 +1,371 @@
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 SearchBox_1 = __importDefault(require("./SearchBox"));
57
+ jest.mock("react-i18next", function () { return ({
58
+ useTranslation: function () { return ({ t: function (key) { return key; } }); },
59
+ }); });
60
+ var results = ["First result", "Second result", "Third result"].map(function (label) { return ((0, jsx_runtime_1.jsx)("div", { children: label }, label)); });
61
+ var defaultProps = {
62
+ id: "products",
63
+ ariaLabel: "Search products",
64
+ value: "ipad",
65
+ minSearchLength: 2,
66
+ showResultList: true,
67
+ loadingAnnouncement: "Results are loading",
68
+ children: results,
69
+ };
70
+ var renderSearchBox = function (props) {
71
+ if (props === void 0) { props = {}; }
72
+ return (0, react_1.render)((0, jsx_runtime_1.jsx)(SearchBox_1.default, __assign({}, defaultProps, props)));
73
+ };
74
+ var getInput = function () { return react_1.screen.getByRole("combobox", { name: "Search products" }); };
75
+ var pressKeys = function (user) {
76
+ var keys = [];
77
+ for (var _i = 1; _i < arguments.length; _i++) {
78
+ keys[_i - 1] = arguments[_i];
79
+ }
80
+ return __awaiter(void 0, void 0, void 0, function () {
81
+ var _loop_1, _a, keys_1, key;
82
+ return __generator(this, function (_b) {
83
+ switch (_b.label) {
84
+ case 0:
85
+ _loop_1 = function (key) {
86
+ return __generator(this, function (_c) {
87
+ switch (_c.label) {
88
+ case 0: return [4 /*yield*/, (0, react_1.act)(function () { return __awaiter(void 0, void 0, void 0, function () {
89
+ return __generator(this, function (_a) {
90
+ switch (_a.label) {
91
+ case 0: return [4 /*yield*/, user.keyboard(key)];
92
+ case 1:
93
+ _a.sent();
94
+ return [2 /*return*/];
95
+ }
96
+ });
97
+ }); })];
98
+ case 1:
99
+ _c.sent();
100
+ return [2 /*return*/];
101
+ }
102
+ });
103
+ };
104
+ _a = 0, keys_1 = keys;
105
+ _b.label = 1;
106
+ case 1:
107
+ if (!(_a < keys_1.length)) return [3 /*break*/, 4];
108
+ key = keys_1[_a];
109
+ return [5 /*yield**/, _loop_1(key)];
110
+ case 2:
111
+ _b.sent();
112
+ _b.label = 3;
113
+ case 3:
114
+ _a++;
115
+ return [3 /*break*/, 1];
116
+ case 4: return [2 /*return*/];
117
+ }
118
+ });
119
+ });
120
+ };
121
+ describe("SearchBox", function () {
122
+ it("hides loading skeleton content from the accessibility tree", function () {
123
+ renderSearchBox({ isLoading: true });
124
+ expect(react_1.screen.queryAllByRole("option")).toHaveLength(0);
125
+ expect(react_1.screen.queryByRole("link")).not.toBeInTheDocument();
126
+ expect(react_1.screen.queryByText("x")).not.toBeInTheDocument();
127
+ });
128
+ it("marks the list busy and announces loading once", function () {
129
+ renderSearchBox({ isLoading: true });
130
+ expect(react_1.screen.getByRole("listbox")).toHaveAttribute("aria-busy", "true");
131
+ expect(react_1.screen.getAllByRole("status")).toHaveLength(1);
132
+ expect(react_1.screen.getByRole("status")).toHaveTextContent("Results are loading");
133
+ });
134
+ it("exposes real options after loading finishes", function () {
135
+ var rerender = renderSearchBox({ isLoading: true }).rerender;
136
+ rerender((0, jsx_runtime_1.jsx)(SearchBox_1.default, __assign({}, defaultProps, { isLoading: false })));
137
+ expect(react_1.screen.getByRole("listbox")).toHaveAttribute("aria-busy", "false");
138
+ expect(react_1.screen.getAllByRole("option")).toHaveLength(3);
139
+ });
140
+ it("selects the first option with ArrowDown and Enter", function () { return __awaiter(void 0, void 0, void 0, function () {
141
+ var user, onOptionSelect;
142
+ return __generator(this, function (_a) {
143
+ switch (_a.label) {
144
+ case 0:
145
+ user = user_event_1.default.setup();
146
+ onOptionSelect = jest.fn();
147
+ renderSearchBox({ onOptionSelect: onOptionSelect });
148
+ return [4 /*yield*/, user.click(getInput())];
149
+ case 1:
150
+ _a.sent();
151
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{Enter}")];
152
+ case 2:
153
+ _a.sent();
154
+ expect(onOptionSelect).toHaveBeenCalledTimes(1);
155
+ expect(onOptionSelect).toHaveBeenCalledWith(0, expect.any(Object));
156
+ return [2 /*return*/];
157
+ }
158
+ });
159
+ }); });
160
+ it("selects the next option after repeated ArrowDown presses", function () { return __awaiter(void 0, void 0, void 0, function () {
161
+ var user, onOptionSelect;
162
+ return __generator(this, function (_a) {
163
+ switch (_a.label) {
164
+ case 0:
165
+ user = user_event_1.default.setup();
166
+ onOptionSelect = jest.fn();
167
+ renderSearchBox({ onOptionSelect: onOptionSelect });
168
+ return [4 /*yield*/, user.click(getInput())];
169
+ case 1:
170
+ _a.sent();
171
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{ArrowDown}", "{Enter}")];
172
+ case 2:
173
+ _a.sent();
174
+ expect(onOptionSelect).toHaveBeenCalledWith(1, expect.any(Object));
175
+ return [2 /*return*/];
176
+ }
177
+ });
178
+ }); });
179
+ it("selects the last option when navigation starts with ArrowUp", function () { return __awaiter(void 0, void 0, void 0, function () {
180
+ var user, onOptionSelect;
181
+ return __generator(this, function (_a) {
182
+ switch (_a.label) {
183
+ case 0:
184
+ user = user_event_1.default.setup();
185
+ onOptionSelect = jest.fn();
186
+ renderSearchBox({ onOptionSelect: onOptionSelect });
187
+ return [4 /*yield*/, user.click(getInput())];
188
+ case 1:
189
+ _a.sent();
190
+ return [4 /*yield*/, pressKeys(user, "{ArrowUp}", "{Enter}")];
191
+ case 2:
192
+ _a.sent();
193
+ expect(onOptionSelect).toHaveBeenCalledWith(2, expect.any(Object));
194
+ return [2 /*return*/];
195
+ }
196
+ });
197
+ }); });
198
+ it("does not forward the keyup event for a selected option", function () { return __awaiter(void 0, void 0, void 0, function () {
199
+ var user, onKeyUp;
200
+ return __generator(this, function (_a) {
201
+ switch (_a.label) {
202
+ case 0:
203
+ user = user_event_1.default.setup();
204
+ onKeyUp = jest.fn();
205
+ renderSearchBox({ onKeyUp: onKeyUp });
206
+ return [4 /*yield*/, user.click(getInput())];
207
+ case 1:
208
+ _a.sent();
209
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{Enter}")];
210
+ case 2:
211
+ _a.sent();
212
+ expect(onKeyUp).not.toHaveBeenCalled();
213
+ return [2 /*return*/];
214
+ }
215
+ });
216
+ }); });
217
+ it("forwards Enter when there is no active option", function () { return __awaiter(void 0, void 0, void 0, function () {
218
+ var user, onKeyUp;
219
+ return __generator(this, function (_a) {
220
+ switch (_a.label) {
221
+ case 0:
222
+ user = user_event_1.default.setup();
223
+ onKeyUp = jest.fn();
224
+ renderSearchBox({ onKeyUp: onKeyUp });
225
+ return [4 /*yield*/, user.click(getInput())];
226
+ case 1:
227
+ _a.sent();
228
+ return [4 /*yield*/, pressKeys(user, "{Enter}")];
229
+ case 2:
230
+ _a.sent();
231
+ expect(onKeyUp).toHaveBeenCalledTimes(1);
232
+ return [2 /*return*/];
233
+ }
234
+ });
235
+ }); });
236
+ it("clears selection on Escape without changing the input value", function () { return __awaiter(void 0, void 0, void 0, function () {
237
+ var user, onEscape;
238
+ return __generator(this, function (_a) {
239
+ switch (_a.label) {
240
+ case 0:
241
+ user = user_event_1.default.setup();
242
+ onEscape = jest.fn();
243
+ renderSearchBox({ onEscape: onEscape });
244
+ return [4 /*yield*/, user.click(getInput())];
245
+ case 1:
246
+ _a.sent();
247
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{Escape}")];
248
+ case 2:
249
+ _a.sent();
250
+ expect(onEscape).toHaveBeenCalledTimes(1);
251
+ expect(getInput()).toHaveValue("ipad");
252
+ expect(getInput()).not.toHaveAttribute("aria-activedescendant");
253
+ return [2 /*return*/];
254
+ }
255
+ });
256
+ }); });
257
+ it("does not select options for empty or loading results", function () { return __awaiter(void 0, void 0, void 0, function () {
258
+ var user, onOptionSelect, rerender;
259
+ return __generator(this, function (_a) {
260
+ switch (_a.label) {
261
+ case 0:
262
+ user = user_event_1.default.setup();
263
+ onOptionSelect = jest.fn();
264
+ rerender = renderSearchBox({ children: [], onOptionSelect: onOptionSelect }).rerender;
265
+ return [4 /*yield*/, user.click(getInput())];
266
+ case 1:
267
+ _a.sent();
268
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{Enter}")];
269
+ case 2:
270
+ _a.sent();
271
+ rerender((0, jsx_runtime_1.jsx)(SearchBox_1.default, __assign({}, defaultProps, { isLoading: true, onOptionSelect: onOptionSelect })));
272
+ return [4 /*yield*/, pressKeys(user, "{ArrowUp}", "{Enter}")];
273
+ case 3:
274
+ _a.sent();
275
+ expect(onOptionSelect).not.toHaveBeenCalled();
276
+ expect(getInput()).not.toHaveAttribute("aria-activedescendant");
277
+ return [2 /*return*/];
278
+ }
279
+ });
280
+ }); });
281
+ it("keeps navigation within a single result", function () { return __awaiter(void 0, void 0, void 0, function () {
282
+ var user, onOptionSelect;
283
+ return __generator(this, function (_a) {
284
+ switch (_a.label) {
285
+ case 0:
286
+ user = user_event_1.default.setup();
287
+ onOptionSelect = jest.fn();
288
+ renderSearchBox({ children: results.slice(0, 1), onOptionSelect: onOptionSelect });
289
+ return [4 /*yield*/, user.click(getInput())];
290
+ case 1:
291
+ _a.sent();
292
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}", "{ArrowDown}", "{Enter}")];
293
+ case 2:
294
+ _a.sent();
295
+ expect(onOptionSelect).toHaveBeenCalledWith(0, expect.any(Object));
296
+ return [2 /*return*/];
297
+ }
298
+ });
299
+ }); });
300
+ it("clears an active descendant when results close or shrink", function () { return __awaiter(void 0, void 0, void 0, function () {
301
+ var user, rerender;
302
+ return __generator(this, function (_a) {
303
+ switch (_a.label) {
304
+ case 0:
305
+ user = user_event_1.default.setup();
306
+ rerender = renderSearchBox().rerender;
307
+ return [4 /*yield*/, user.click(getInput())];
308
+ case 1:
309
+ _a.sent();
310
+ return [4 /*yield*/, pressKeys(user, "{ArrowUp}")];
311
+ case 2:
312
+ _a.sent();
313
+ rerender((0, jsx_runtime_1.jsx)(SearchBox_1.default, __assign({}, defaultProps, { children: results.slice(0, 1) })));
314
+ return [4 /*yield*/, (0, react_1.waitFor)(function () { return expect(getInput()).not.toHaveAttribute("aria-activedescendant"); })];
315
+ case 3:
316
+ _a.sent();
317
+ rerender((0, jsx_runtime_1.jsx)(SearchBox_1.default, __assign({}, defaultProps, { showResultList: false })));
318
+ expect(react_1.screen.queryByRole("listbox")).not.toBeInTheDocument();
319
+ expect(getInput()).not.toHaveAttribute("aria-activedescendant");
320
+ return [2 /*return*/];
321
+ }
322
+ });
323
+ }); });
324
+ it("connects the active descendant to the selected option", function () { return __awaiter(void 0, void 0, void 0, function () {
325
+ var user, options;
326
+ return __generator(this, function (_a) {
327
+ switch (_a.label) {
328
+ case 0:
329
+ user = user_event_1.default.setup();
330
+ renderSearchBox();
331
+ return [4 /*yield*/, user.click(getInput())];
332
+ case 1:
333
+ _a.sent();
334
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}")];
335
+ case 2:
336
+ _a.sent();
337
+ options = react_1.screen.getAllByRole("option");
338
+ expect(getInput()).toHaveAttribute("aria-activedescendant", options[0].id);
339
+ expect(options[0]).toHaveAttribute("id", "products-result-0");
340
+ expect(options[0]).toHaveAttribute("aria-selected", "true");
341
+ expect(options[1]).toHaveAttribute("aria-selected", "false");
342
+ return [2 /*return*/];
343
+ }
344
+ });
345
+ }); });
346
+ it("lets a consumer prevent internal keyboard navigation", function () { return __awaiter(void 0, void 0, void 0, function () {
347
+ var user, onKeyDown;
348
+ return __generator(this, function (_a) {
349
+ switch (_a.label) {
350
+ case 0:
351
+ user = user_event_1.default.setup();
352
+ onKeyDown = jest.fn(function (event) { return event.preventDefault(); });
353
+ renderSearchBox({ onKeyDown: onKeyDown });
354
+ return [4 /*yield*/, user.click(getInput())];
355
+ case 1:
356
+ _a.sent();
357
+ return [4 /*yield*/, pressKeys(user, "{ArrowDown}")];
358
+ case 2:
359
+ _a.sent();
360
+ expect(onKeyDown).toHaveBeenCalledTimes(1);
361
+ expect(getInput()).not.toHaveAttribute("aria-activedescendant");
362
+ return [2 /*return*/];
363
+ }
364
+ });
365
+ }); });
366
+ it("renders input text as data instead of executable markup", function () {
367
+ renderSearchBox({ value: '<script>alert("xss")</script>', showResultList: false });
368
+ expect(getInput()).toHaveValue('<script>alert("xss")</script>');
369
+ expect(document.querySelector("script")).not.toBeInTheDocument();
370
+ });
371
+ });
@@ -8,6 +8,10 @@ export interface SearchBoxProps {
8
8
  onKeyUp?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
9
9
  /** Handler for keydown events */
10
10
  onKeyDown?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
11
+ /** Handler called when the active result is selected with Enter */
12
+ onOptionSelect?: (index: number, event: React.KeyboardEvent<HTMLInputElement>) => void;
13
+ /** Handler called when Escape is pressed */
14
+ onEscape?: (event: React.KeyboardEvent<HTMLInputElement>) => void;
11
15
  /** Handler for blur events */
12
16
  onBlur?: (event: React.FocusEvent<HTMLInputElement>) => void;
13
17
  /** Handler for focus events */
@@ -20,6 +24,8 @@ export interface SearchBoxProps {
20
24
  children?: React.ReactNode;
21
25
  /** Whether the search is currently loading */
22
26
  isLoading?: boolean;
27
+ /** Accessible loading status announcement */
28
+ loadingAnnouncement?: string;
23
29
  /** Whether to show the result list */
24
30
  showResultList?: boolean;
25
31
  /** Placeholder text for the input */
@@ -6,11 +6,14 @@ exports.SearchBoxDefault = {
6
6
  size: "medium",
7
7
  onKeyUp: function () { },
8
8
  onKeyDown: function () { },
9
+ onOptionSelect: function () { },
10
+ onEscape: function () { },
9
11
  onBlur: function () { },
10
12
  onFocus: function () { },
11
13
  onChange: function () { },
12
14
  onButtonClick: function () { },
13
15
  isLoading: false,
16
+ loadingAnnouncement: "",
14
17
  showResultList: false,
15
18
  placeholder: "Teknolojik ürün ara...",
16
19
  value: "",
@@ -29,9 +29,18 @@ declare const _default: {
29
29
  ariaLabel: {
30
30
  control: string;
31
31
  };
32
+ loadingAnnouncement: {
33
+ control: string;
34
+ };
32
35
  onChange: {
33
36
  action: string;
34
37
  };
38
+ onOptionSelect: {
39
+ action: string;
40
+ };
41
+ onEscape: {
42
+ action: string;
43
+ };
35
44
  onButtonClick: {
36
45
  action: string;
37
46
  };
@@ -53,6 +62,7 @@ export declare const Default: {
53
62
  onButtonClick: (e: any) => void;
54
63
  placeholder: string;
55
64
  isLoading: boolean;
65
+ loadingAnnouncement: string;
56
66
  showResultList: boolean;
57
67
  size: string;
58
68
  value: string;
@@ -72,6 +82,7 @@ export declare const Medium: {
72
82
  onButtonClick: (e: any) => void;
73
83
  placeholder: string;
74
84
  isLoading: boolean;
85
+ loadingAnnouncement: string;
75
86
  showResultList: boolean;
76
87
  value: string;
77
88
  children: React.JSX.Element[];
@@ -90,6 +101,7 @@ export declare const Small: {
90
101
  onButtonClick: (e: any) => void;
91
102
  placeholder: string;
92
103
  isLoading: boolean;
104
+ loadingAnnouncement: string;
93
105
  showResultList: boolean;
94
106
  value: string;
95
107
  children: React.JSX.Element[];
@@ -109,6 +121,7 @@ export declare const WithResults: {
109
121
  onButtonClick: (e: any) => void;
110
122
  placeholder: string;
111
123
  isLoading: boolean;
124
+ loadingAnnouncement: string;
112
125
  size: string;
113
126
  children: React.JSX.Element[];
114
127
  disabled: boolean;
@@ -128,6 +141,7 @@ export declare const MediumWithResults: {
128
141
  onButtonClick: (e: any) => void;
129
142
  placeholder: string;
130
143
  isLoading: boolean;
144
+ loadingAnnouncement: string;
131
145
  children: React.JSX.Element[];
132
146
  disabled: boolean;
133
147
  minSearchLength: number;
@@ -146,6 +160,7 @@ export declare const FewResults: {
146
160
  onButtonClick: (e: any) => void;
147
161
  placeholder: string;
148
162
  isLoading: boolean;
163
+ loadingAnnouncement: string;
149
164
  size: string;
150
165
  disabled: boolean;
151
166
  minSearchLength: number;
@@ -164,6 +179,7 @@ export declare const EmptyResults: {
164
179
  onButtonClick: (e: any) => void;
165
180
  placeholder: string;
166
181
  isLoading: boolean;
182
+ loadingAnnouncement: string;
167
183
  size: string;
168
184
  disabled: boolean;
169
185
  minSearchLength: number;
@@ -182,6 +198,7 @@ export declare const BelowMinSearchLength: {
182
198
  onButtonClick: (e: any) => void;
183
199
  placeholder: string;
184
200
  isLoading: boolean;
201
+ loadingAnnouncement: string;
185
202
  size: string;
186
203
  children: React.JSX.Element[];
187
204
  disabled: boolean;
@@ -199,6 +216,7 @@ export declare const Loading: {
199
216
  onChange: (e: any) => void;
200
217
  onButtonClick: (e: any) => void;
201
218
  placeholder: string;
219
+ loadingAnnouncement: string;
202
220
  size: string;
203
221
  children: React.JSX.Element[];
204
222
  disabled: boolean;
@@ -216,6 +234,7 @@ export declare const Disabled: {
216
234
  onButtonClick: (e: any) => void;
217
235
  placeholder: string;
218
236
  isLoading: boolean;
237
+ loadingAnnouncement: string;
219
238
  showResultList: boolean;
220
239
  size: string;
221
240
  value: string;
@@ -233,6 +252,7 @@ export declare const CustomPlaceholder: {
233
252
  onChange: (e: any) => void;
234
253
  onButtonClick: (e: any) => void;
235
254
  isLoading: boolean;
255
+ loadingAnnouncement: string;
236
256
  showResultList: boolean;
237
257
  size: string;
238
258
  value: string;
@@ -252,6 +272,7 @@ export declare const WithValue: {
252
272
  onButtonClick: (e: any) => void;
253
273
  placeholder: string;
254
274
  isLoading: boolean;
275
+ loadingAnnouncement: string;
255
276
  showResultList: boolean;
256
277
  size: string;
257
278
  children: React.JSX.Element[];
@@ -275,6 +296,7 @@ export declare const Complete: {
275
296
  onKeyUp: (e: any) => void;
276
297
  onChange: (e: any) => void;
277
298
  onButtonClick: (e: any) => void;
299
+ loadingAnnouncement: string;
278
300
  disabled: boolean;
279
301
  };
280
302
  };
@@ -290,6 +312,7 @@ export declare const Interactive: {
290
312
  onChange: (e: any) => void;
291
313
  onButtonClick: (e: any) => void;
292
314
  isLoading: boolean;
315
+ loadingAnnouncement: string;
293
316
  showResultList: boolean;
294
317
  size: string;
295
318
  children: React.JSX.Element[];
@@ -34,6 +34,7 @@ var baseArgs = {
34
34
  onButtonClick: function (e) { return console.log(e, "onButtonClick"); },
35
35
  placeholder: "Teknolojik ürün ara...",
36
36
  isLoading: false,
37
+ loadingAnnouncement: "Arama sonuçları yükleniyor",
37
38
  showResultList: false,
38
39
  size: "small",
39
40
  value: "",
@@ -55,7 +56,10 @@ exports.default = {
55
56
  disabled: { control: 'boolean' },
56
57
  minSearchLength: { control: 'number' },
57
58
  ariaLabel: { control: 'text' },
59
+ loadingAnnouncement: { control: 'text' },
58
60
  onChange: { action: 'changed' },
61
+ onOptionSelect: { action: 'optionSelected' },
62
+ onEscape: { action: 'escaped' },
59
63
  onButtonClick: { action: 'buttonClicked' },
60
64
  onFocus: { action: 'focused' },
61
65
  onBlur: { action: 'blurred' },
@@ -1,4 +1,4 @@
1
1
  import React from "react";
2
2
  import { ShoppingCartProductProps } from "./props";
3
- declare const ShoppingCartProduct: ({ title, priceSm, price, period, oldPrice, oldPriceSm, oldPricePeriod, discountRate, slug, image, component, hasRemove, hasInsurance, insuranceType, insuranceText, insurancePrice, insuranceQuantity, insuranceOption1Title, insuranceOption1Description, insuranceOption1Price, insuranceOption1PricePeriod, hasInsuranceOption1PriceLoading, insuranceOption1TooltipText, insuranceOption2Title, insuranceOption2Description, selectedInsuranceOption, onInsuranceOptionSelect, upfrontAddonTitle, upfrontAddonChecked, onUpfrontAddonChange, upfrontAddonDiscountBadge, upfrontAddonSummaryText, upfrontAddonOldPrice, upfrontAddonPrice, hasUpfrontAddonPriceLoading, deliveryText, quantity, hasLoading, deliveryDangerText, hasError, errorText, hasInsuranceActions, hasInsuranceTooltip, hasDisableActions, hasInsuranceTooltipClickAction, insuranceTooltipText, insuranceTooltipWidth, onRemove, onIncrement, onDecrement, toggleInsurance, toggleInsuranceLogo, hasInsurancePriceAdded, hasInsuranceLoading, hasDisableIncrement, insuranceOption1TooltipTitle, campaigns, onCampaignCountClick, }: ShoppingCartProductProps) => React.JSX.Element;
3
+ declare const ShoppingCartProduct: ({ title, priceSm, price, period, oldPrice, oldPriceSm, oldPricePeriod, discountRate, slug, image, component, hasRemove, hasInsurance, insuranceType, insuranceText, insurancePrice, insuranceQuantity, insuranceOption1Title, insuranceOption1Description, insuranceOption1Price, insuranceOption1PricePeriod, hasInsuranceOption1PriceLoading, insuranceOption1TooltipText, insuranceOption2Title, insuranceOption2Description, selectedInsuranceOption, onInsuranceOptionSelect, upfrontAddonTitle, upfrontAddonChecked, onUpfrontAddonChange, upfrontAddonDiscountBadge, upfrontAddonSummaryText, upfrontAddonOldPrice, upfrontAddonPrice, hasUpfrontAddonPriceLoading, deliveryText, quantity, hasLoading, deliveryDangerText, hasError, errorText, hasInsuranceActions, hasInsuranceTooltip, hasDisableActions, hasInsuranceTooltipClickAction, insuranceTooltipText, insuranceTooltipWidth, onRemove, onIncrement, onDecrement, incrementAriaLabel, decrementAriaLabel, removeAriaLabel, toggleInsurance, toggleInsuranceLogo, hasInsurancePriceAdded, hasInsuranceLoading, hasDisableIncrement, insuranceOption1TooltipTitle, campaigns, onCampaignCountClick, }: ShoppingCartProductProps) => React.JSX.Element;
4
4
  export default ShoppingCartProduct;
@@ -30,7 +30,7 @@ var LinkComponent = function (_a) {
30
30
  return item.component ? ((0, jsx_runtime_1.jsx)(item.component, { children: children })) : ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.ProductCardLink, __assign({ href: item.slug }, { children: children })));
31
31
  };
32
32
  var ShoppingCartProduct = function (_a) {
33
- var _b = _a.title, title = _b === void 0 ? props_1.ShoppingCartProductDefault.title : _b, _c = _a.priceSm, priceSm = _c === void 0 ? props_1.ShoppingCartProductDefault.priceSm : _c, _d = _a.price, price = _d === void 0 ? props_1.ShoppingCartProductDefault.price : _d, _e = _a.period, period = _e === void 0 ? props_1.ShoppingCartProductDefault.period : _e, _f = _a.oldPrice, oldPrice = _f === void 0 ? props_1.ShoppingCartProductDefault.oldPrice : _f, _g = _a.oldPriceSm, oldPriceSm = _g === void 0 ? props_1.ShoppingCartProductDefault.oldPriceSm : _g, _h = _a.oldPricePeriod, oldPricePeriod = _h === void 0 ? props_1.ShoppingCartProductDefault.oldPricePeriod : _h, _j = _a.discountRate, discountRate = _j === void 0 ? props_1.ShoppingCartProductDefault.discountRate : _j, _k = _a.slug, slug = _k === void 0 ? props_1.ShoppingCartProductDefault.slug : _k, _l = _a.image, image = _l === void 0 ? props_1.ShoppingCartProductDefault.image : _l, _m = _a.component, component = _m === void 0 ? props_1.ShoppingCartProductDefault.component : _m, _o = _a.hasRemove, hasRemove = _o === void 0 ? props_1.ShoppingCartProductDefault.hasRemove : _o, _p = _a.hasInsurance, hasInsurance = _p === void 0 ? props_1.ShoppingCartProductDefault.hasInsurance : _p, _q = _a.insuranceType, insuranceType = _q === void 0 ? props_1.ShoppingCartProductDefault.insuranceType : _q, _r = _a.insuranceText, insuranceText = _r === void 0 ? props_1.ShoppingCartProductDefault.insuranceText : _r, _s = _a.insurancePrice, insurancePrice = _s === void 0 ? props_1.ShoppingCartProductDefault.insurancePrice : _s, _t = _a.insuranceQuantity, insuranceQuantity = _t === void 0 ? props_1.ShoppingCartProductDefault.insuranceQuantity : _t, _u = _a.insuranceOption1Title, insuranceOption1Title = _u === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Title : _u, _v = _a.insuranceOption1Description, insuranceOption1Description = _v === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Description : _v, _w = _a.insuranceOption1Price, insuranceOption1Price = _w === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Price : _w, _x = _a.insuranceOption1PricePeriod, insuranceOption1PricePeriod = _x === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1PricePeriod : _x, _y = _a.hasInsuranceOption1PriceLoading, hasInsuranceOption1PriceLoading = _y === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceOption1PriceLoading : _y, _z = _a.insuranceOption1TooltipText, insuranceOption1TooltipText = _z === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1TooltipText : _z, _0 = _a.insuranceOption2Title, insuranceOption2Title = _0 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption2Title : _0, _1 = _a.insuranceOption2Description, insuranceOption2Description = _1 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption2Description : _1, _2 = _a.selectedInsuranceOption, selectedInsuranceOption = _2 === void 0 ? props_1.ShoppingCartProductDefault.selectedInsuranceOption : _2, _3 = _a.onInsuranceOptionSelect, onInsuranceOptionSelect = _3 === void 0 ? props_1.ShoppingCartProductDefault.onInsuranceOptionSelect : _3, _4 = _a.upfrontAddonTitle, upfrontAddonTitle = _4 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonTitle : _4, _5 = _a.upfrontAddonChecked, upfrontAddonChecked = _5 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonChecked : _5, _6 = _a.onUpfrontAddonChange, onUpfrontAddonChange = _6 === void 0 ? props_1.ShoppingCartProductDefault.onUpfrontAddonChange : _6, _7 = _a.upfrontAddonDiscountBadge, upfrontAddonDiscountBadge = _7 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonDiscountBadge : _7, _8 = _a.upfrontAddonSummaryText, upfrontAddonSummaryText = _8 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonSummaryText : _8, _9 = _a.upfrontAddonOldPrice, upfrontAddonOldPrice = _9 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonOldPrice : _9, _10 = _a.upfrontAddonPrice, upfrontAddonPrice = _10 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonPrice : _10, _11 = _a.hasUpfrontAddonPriceLoading, hasUpfrontAddonPriceLoading = _11 === void 0 ? props_1.ShoppingCartProductDefault.hasUpfrontAddonPriceLoading : _11, _12 = _a.deliveryText, deliveryText = _12 === void 0 ? props_1.ShoppingCartProductDefault.deliveryText : _12, _13 = _a.quantity, quantity = _13 === void 0 ? props_1.ShoppingCartProductDefault.quantity : _13, _14 = _a.hasLoading, hasLoading = _14 === void 0 ? props_1.ShoppingCartProductDefault.hasLoading : _14, _15 = _a.deliveryDangerText, deliveryDangerText = _15 === void 0 ? props_1.ShoppingCartProductDefault.deliveryDangerText : _15, _16 = _a.hasError, hasError = _16 === void 0 ? props_1.ShoppingCartProductDefault.hasError : _16, _17 = _a.errorText, errorText = _17 === void 0 ? props_1.ShoppingCartProductDefault.errorText : _17, _18 = _a.hasInsuranceActions, hasInsuranceActions = _18 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceActions : _18, _19 = _a.hasInsuranceTooltip, hasInsuranceTooltip = _19 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceTooltip : _19, _20 = _a.hasDisableActions, hasDisableActions = _20 === void 0 ? props_1.ShoppingCartProductDefault.hasDisableActions : _20, _21 = _a.hasInsuranceTooltipClickAction, hasInsuranceTooltipClickAction = _21 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceTooltipClickAction : _21, _22 = _a.insuranceTooltipText, insuranceTooltipText = _22 === void 0 ? props_1.ShoppingCartProductDefault.insuranceTooltipText : _22, _23 = _a.insuranceTooltipWidth, insuranceTooltipWidth = _23 === void 0 ? props_1.ShoppingCartProductDefault.insuranceTooltipWidth : _23, _24 = _a.onRemove, onRemove = _24 === void 0 ? props_1.ShoppingCartProductDefault.onRemove : _24, _25 = _a.onIncrement, onIncrement = _25 === void 0 ? props_1.ShoppingCartProductDefault.onIncrement : _25, _26 = _a.onDecrement, onDecrement = _26 === void 0 ? props_1.ShoppingCartProductDefault.onDecrement : _26, _27 = _a.toggleInsurance, toggleInsurance = _27 === void 0 ? props_1.ShoppingCartProductDefault.toggleInsurance : _27, _28 = _a.toggleInsuranceLogo, toggleInsuranceLogo = _28 === void 0 ? props_1.ShoppingCartProductDefault.toggleInsuranceLogo : _28, _29 = _a.hasInsurancePriceAdded, hasInsurancePriceAdded = _29 === void 0 ? props_1.ShoppingCartProductDefault.hasInsurancePriceAdded : _29, _30 = _a.hasInsuranceLoading, hasInsuranceLoading = _30 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceLoading : _30, _31 = _a.hasDisableIncrement, hasDisableIncrement = _31 === void 0 ? props_1.ShoppingCartProductDefault.hasDisableIncrement : _31, _32 = _a.insuranceOption1TooltipTitle, insuranceOption1TooltipTitle = _32 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1TooltipTitle : _32, _33 = _a.campaigns, campaigns = _33 === void 0 ? props_1.ShoppingCartProductDefault.campaigns : _33, _34 = _a.onCampaignCountClick, onCampaignCountClick = _34 === void 0 ? props_1.ShoppingCartProductDefault.onCampaignCountClick : _34;
33
+ var _b = _a.title, title = _b === void 0 ? props_1.ShoppingCartProductDefault.title : _b, _c = _a.priceSm, priceSm = _c === void 0 ? props_1.ShoppingCartProductDefault.priceSm : _c, _d = _a.price, price = _d === void 0 ? props_1.ShoppingCartProductDefault.price : _d, _e = _a.period, period = _e === void 0 ? props_1.ShoppingCartProductDefault.period : _e, _f = _a.oldPrice, oldPrice = _f === void 0 ? props_1.ShoppingCartProductDefault.oldPrice : _f, _g = _a.oldPriceSm, oldPriceSm = _g === void 0 ? props_1.ShoppingCartProductDefault.oldPriceSm : _g, _h = _a.oldPricePeriod, oldPricePeriod = _h === void 0 ? props_1.ShoppingCartProductDefault.oldPricePeriod : _h, _j = _a.discountRate, discountRate = _j === void 0 ? props_1.ShoppingCartProductDefault.discountRate : _j, _k = _a.slug, slug = _k === void 0 ? props_1.ShoppingCartProductDefault.slug : _k, _l = _a.image, image = _l === void 0 ? props_1.ShoppingCartProductDefault.image : _l, _m = _a.component, component = _m === void 0 ? props_1.ShoppingCartProductDefault.component : _m, _o = _a.hasRemove, hasRemove = _o === void 0 ? props_1.ShoppingCartProductDefault.hasRemove : _o, _p = _a.hasInsurance, hasInsurance = _p === void 0 ? props_1.ShoppingCartProductDefault.hasInsurance : _p, _q = _a.insuranceType, insuranceType = _q === void 0 ? props_1.ShoppingCartProductDefault.insuranceType : _q, _r = _a.insuranceText, insuranceText = _r === void 0 ? props_1.ShoppingCartProductDefault.insuranceText : _r, _s = _a.insurancePrice, insurancePrice = _s === void 0 ? props_1.ShoppingCartProductDefault.insurancePrice : _s, _t = _a.insuranceQuantity, insuranceQuantity = _t === void 0 ? props_1.ShoppingCartProductDefault.insuranceQuantity : _t, _u = _a.insuranceOption1Title, insuranceOption1Title = _u === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Title : _u, _v = _a.insuranceOption1Description, insuranceOption1Description = _v === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Description : _v, _w = _a.insuranceOption1Price, insuranceOption1Price = _w === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1Price : _w, _x = _a.insuranceOption1PricePeriod, insuranceOption1PricePeriod = _x === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1PricePeriod : _x, _y = _a.hasInsuranceOption1PriceLoading, hasInsuranceOption1PriceLoading = _y === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceOption1PriceLoading : _y, _z = _a.insuranceOption1TooltipText, insuranceOption1TooltipText = _z === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1TooltipText : _z, _0 = _a.insuranceOption2Title, insuranceOption2Title = _0 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption2Title : _0, _1 = _a.insuranceOption2Description, insuranceOption2Description = _1 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption2Description : _1, _2 = _a.selectedInsuranceOption, selectedInsuranceOption = _2 === void 0 ? props_1.ShoppingCartProductDefault.selectedInsuranceOption : _2, _3 = _a.onInsuranceOptionSelect, onInsuranceOptionSelect = _3 === void 0 ? props_1.ShoppingCartProductDefault.onInsuranceOptionSelect : _3, _4 = _a.upfrontAddonTitle, upfrontAddonTitle = _4 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonTitle : _4, _5 = _a.upfrontAddonChecked, upfrontAddonChecked = _5 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonChecked : _5, _6 = _a.onUpfrontAddonChange, onUpfrontAddonChange = _6 === void 0 ? props_1.ShoppingCartProductDefault.onUpfrontAddonChange : _6, _7 = _a.upfrontAddonDiscountBadge, upfrontAddonDiscountBadge = _7 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonDiscountBadge : _7, _8 = _a.upfrontAddonSummaryText, upfrontAddonSummaryText = _8 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonSummaryText : _8, _9 = _a.upfrontAddonOldPrice, upfrontAddonOldPrice = _9 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonOldPrice : _9, _10 = _a.upfrontAddonPrice, upfrontAddonPrice = _10 === void 0 ? props_1.ShoppingCartProductDefault.upfrontAddonPrice : _10, _11 = _a.hasUpfrontAddonPriceLoading, hasUpfrontAddonPriceLoading = _11 === void 0 ? props_1.ShoppingCartProductDefault.hasUpfrontAddonPriceLoading : _11, _12 = _a.deliveryText, deliveryText = _12 === void 0 ? props_1.ShoppingCartProductDefault.deliveryText : _12, _13 = _a.quantity, quantity = _13 === void 0 ? props_1.ShoppingCartProductDefault.quantity : _13, _14 = _a.hasLoading, hasLoading = _14 === void 0 ? props_1.ShoppingCartProductDefault.hasLoading : _14, _15 = _a.deliveryDangerText, deliveryDangerText = _15 === void 0 ? props_1.ShoppingCartProductDefault.deliveryDangerText : _15, _16 = _a.hasError, hasError = _16 === void 0 ? props_1.ShoppingCartProductDefault.hasError : _16, _17 = _a.errorText, errorText = _17 === void 0 ? props_1.ShoppingCartProductDefault.errorText : _17, _18 = _a.hasInsuranceActions, hasInsuranceActions = _18 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceActions : _18, _19 = _a.hasInsuranceTooltip, hasInsuranceTooltip = _19 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceTooltip : _19, _20 = _a.hasDisableActions, hasDisableActions = _20 === void 0 ? props_1.ShoppingCartProductDefault.hasDisableActions : _20, _21 = _a.hasInsuranceTooltipClickAction, hasInsuranceTooltipClickAction = _21 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceTooltipClickAction : _21, _22 = _a.insuranceTooltipText, insuranceTooltipText = _22 === void 0 ? props_1.ShoppingCartProductDefault.insuranceTooltipText : _22, _23 = _a.insuranceTooltipWidth, insuranceTooltipWidth = _23 === void 0 ? props_1.ShoppingCartProductDefault.insuranceTooltipWidth : _23, _24 = _a.onRemove, onRemove = _24 === void 0 ? props_1.ShoppingCartProductDefault.onRemove : _24, _25 = _a.onIncrement, onIncrement = _25 === void 0 ? props_1.ShoppingCartProductDefault.onIncrement : _25, _26 = _a.onDecrement, onDecrement = _26 === void 0 ? props_1.ShoppingCartProductDefault.onDecrement : _26, _27 = _a.incrementAriaLabel, incrementAriaLabel = _27 === void 0 ? props_1.ShoppingCartProductDefault.incrementAriaLabel : _27, _28 = _a.decrementAriaLabel, decrementAriaLabel = _28 === void 0 ? props_1.ShoppingCartProductDefault.decrementAriaLabel : _28, _29 = _a.removeAriaLabel, removeAriaLabel = _29 === void 0 ? props_1.ShoppingCartProductDefault.removeAriaLabel : _29, _30 = _a.toggleInsurance, toggleInsurance = _30 === void 0 ? props_1.ShoppingCartProductDefault.toggleInsurance : _30, _31 = _a.toggleInsuranceLogo, toggleInsuranceLogo = _31 === void 0 ? props_1.ShoppingCartProductDefault.toggleInsuranceLogo : _31, _32 = _a.hasInsurancePriceAdded, hasInsurancePriceAdded = _32 === void 0 ? props_1.ShoppingCartProductDefault.hasInsurancePriceAdded : _32, _33 = _a.hasInsuranceLoading, hasInsuranceLoading = _33 === void 0 ? props_1.ShoppingCartProductDefault.hasInsuranceLoading : _33, _34 = _a.hasDisableIncrement, hasDisableIncrement = _34 === void 0 ? props_1.ShoppingCartProductDefault.hasDisableIncrement : _34, _35 = _a.insuranceOption1TooltipTitle, insuranceOption1TooltipTitle = _35 === void 0 ? props_1.ShoppingCartProductDefault.insuranceOption1TooltipTitle : _35, _36 = _a.campaigns, campaigns = _36 === void 0 ? props_1.ShoppingCartProductDefault.campaigns : _36, _37 = _a.onCampaignCountClick, onCampaignCountClick = _37 === void 0 ? props_1.ShoppingCartProductDefault.onCampaignCountClick : _37;
34
34
  var tooltipWrapperRef = (0, react_1.useRef)(null);
35
35
  var generatedId = (0, react_1.useId)();
36
36
  var upfrontAddonId = "upfront-addon".concat(generatedId);
@@ -63,6 +63,6 @@ var ShoppingCartProduct = function (_a) {
63
63
  e.preventDefault();
64
64
  e.stopPropagation();
65
65
  onCampaignCountClick === null || onCampaignCountClick === void 0 ? void 0 : onCampaignCountClick();
66
- } }, { children: ["+", extraCampaignCount] })))] }))] }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: upfrontAddonId }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: upfrontAddonId, size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonOldPrice, { children: upfrontAddonOldPrice })] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: ["yerine \u015Fimdi", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] })] })) : ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, upfrontAddonPrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice }))] })) }))] })) }))] }));
66
+ } }, { children: ["+", extraCampaignCount] })))] }))] }), (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, { orientation: "vertical", quantity: quantity, onIncrement: onIncrement, onDecrement: onDecrement, onRemove: onRemove, incrementAriaLabel: incrementAriaLabel, decrementAriaLabel: decrementAriaLabel, removeAriaLabel: removeAriaLabel, hasRemove: hasRemove, hasLoading: hasLoading, hasError: hasError, errorText: errorText, hasDisableActions: hasDisableActions, hasDisableIncrement: hasDisableIncrement })] }), hasInsurance && insuranceType === 1 && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceSection, __assign({ "$hasInsurance": hasInsurancePointer }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceImage, __assign({ onClick: !hasLoading ? toggleInsuranceLogo : undefined }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { color: "var(--primary)", name: "Tamamlarsin", width: "80px", height: "9.14px" }) })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceContent, __assign({ onClick: !hasLoading ? toggleInsurance : undefined }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceText, { children: [insuranceText, insurancePrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePrice, { children: hasInsuranceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsurancePriceValue, { dangerouslySetInnerHTML: { __html: insurancePrice } }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceQuantity, { children: insuranceQuantity })] })) }))] }), hasInsuranceActions && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceActions, { children: hasInsuranceTooltip ? ((0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", hasClickAction: hasInsuranceTooltipClickAction, popupWidth: insuranceTooltipWidth, position: "bottomRight" }, { children: insuranceTooltipText }))) : (hasInsurancePriceAdded ? ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "DeleteSmall" }) }))) : ((0, jsx_runtime_1.jsx)(QuantitySelector_styled_1.SelectorButton, __assign({ type: "button", "$hasShadow": true, disabled: hasLoading }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "PlusSmall" }) })))) }))] }))] }))), hasInsurance && insuranceType === 2 && !hasLoading && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Wrapper, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 1 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 1, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(1); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption1Title }), insuranceOption1TooltipText && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2TooltipWrapper, __assign({ ref: tooltipWrapperRef, htmlFor: "insurance-option-1-tooltip", onClick: handleTooltipWrapperClick, onMouseDown: function (e) { return e.stopPropagation(); } }, { children: (0, jsx_runtime_1.jsx)(Tooltip_1.default, __assign({ popupRight: "-16px", popupWidth: "302px", position: "bottomRight", iconWidth: "24px", iconHeight: "24px", title: insuranceOption1TooltipTitle, popupSize: "medium", hasClickAction: hasInsuranceTooltipClickAction }, { children: insuranceOption1TooltipText })) })))] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption1Description }), (insuranceOption1Price || hasInsuranceOption1PriceLoading) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Price, { children: hasInsuranceOption1PriceLoading ? ((0, jsx_runtime_1.jsx)(Loader_1.default, { type: "wave", variant: "primary" })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2PriceValue, { children: insuranceOption1Price }), insuranceOption1PricePeriod && ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2PricePeriod, { children: [" ", insuranceOption1PricePeriod] }))] })) }))] })] })), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Card, __assign({ "$selected": selectedInsuranceOption === 2 }, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2RadioInput, { name: "insurance-option", checked: selectedInsuranceOption === 2, onChange: function () { return onInsuranceOptionSelect === null || onInsuranceOptionSelect === void 0 ? void 0 : onInsuranceOptionSelect(2); } }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.InsuranceType2Header, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Indicator, {}), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Title, { children: insuranceOption2Title })] }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Content, { children: (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.InsuranceType2Description, { children: insuranceOption2Description }) })] }))] })), hasInsurance && insuranceType === 3 && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonWrapper, { children: (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonCard, __assign({ htmlFor: upfrontAddonId }, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonHeader, { children: [(0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonCheckboxWrapper, { children: (0, jsx_runtime_1.jsx)(Checkbox_1.default, { id: upfrontAddonId, size: "medium", checked: upfrontAddonChecked, onChange: onUpfrontAddonChange }) }), (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonTitle, { children: upfrontAddonTitle }), upfrontAddonDiscountBadge && ((0, jsx_runtime_1.jsx)(Badges_1.default, { layout: "text", variant: "light", title: upfrontAddonDiscountBadge }))] }), (upfrontAddonSummaryText || upfrontAddonPrice) && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonPriceBlock, { children: hasUpfrontAddonDiscount ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonOldPrice, { children: upfrontAddonOldPrice })] }), (0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: ["yerine \u015Fimdi", (0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice })] })] })) : ((0, jsx_runtime_1.jsxs)(ShoppingCartProduct_styled_1.UpfrontAddonPriceLine, { children: [upfrontAddonSummaryText, upfrontAddonPrice && ((0, jsx_runtime_1.jsx)(ShoppingCartProduct_styled_1.UpfrontAddonDiscountedPrice, { children: upfrontAddonPrice }))] })) }))] })) }))] }));
67
67
  };
68
68
  exports.default = ShoppingCartProduct;