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
@@ -53,66 +53,175 @@ Object.defineProperty(exports, "__esModule", { value: true });
53
53
  var jsx_runtime_1 = require("react/jsx-runtime");
54
54
  var react_1 = require("@testing-library/react");
55
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"));
56
60
  var QuantitySelector_1 = __importDefault(require("./QuantitySelector"));
57
- var renderSelector = function (props) {
61
+ var customLabels = {
62
+ incrementAriaLabel: 'Kenya AA adedini artır',
63
+ decrementAriaLabel: 'Kenya AA adedini azalt',
64
+ removeAriaLabel: 'Kenya AA ürününü sepetten kaldır',
65
+ };
66
+ var createTestI18n = function (language) {
67
+ var instance = (0, i18next_1.createInstance)();
68
+ instance.init({
69
+ lng: language,
70
+ fallbackLng: 'en',
71
+ initImmediate: false,
72
+ resources: {
73
+ tr: { translation: turkish_json_1.default },
74
+ en: { translation: english_json_1.default },
75
+ },
76
+ });
77
+ return instance;
78
+ };
79
+ var renderSelector = function (props, language) {
58
80
  if (props === void 0) { props = {}; }
59
- return (0, react_1.render)((0, jsx_runtime_1.jsx)(QuantitySelector_1.default, __assign({ quantity: 2 }, props)));
81
+ if (language === void 0) { language = 'tr'; }
82
+ return (0, react_1.render)((0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, __assign({ i18n: createTestI18n(language) }, { children: (0, jsx_runtime_1.jsx)(QuantitySelector_1.default, __assign({ quantity: 2 }, props)) })));
60
83
  };
61
84
  describe('QuantitySelector', function () {
62
- it('renders the quantity', function () {
63
- renderSelector();
64
- expect(react_1.screen.getByText('2')).toBeInTheDocument();
85
+ it('renders custom increment and decrement accessible names', function () {
86
+ renderSelector(customLabels);
87
+ expect(react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel })).toBeInTheDocument();
88
+ expect(react_1.screen.getByRole('button', { name: customLabels.decrementAriaLabel })).toBeInTheDocument();
89
+ });
90
+ it('uses the remove name instead of the decrement name when removable', function () {
91
+ renderSelector(__assign(__assign({}, customLabels), { hasRemove: true }));
92
+ expect(react_1.screen.getByRole('button', { name: customLabels.removeAriaLabel })).toBeInTheDocument();
93
+ expect(react_1.screen.queryByRole('button', { name: customLabels.decrementAriaLabel })).not.toBeInTheDocument();
94
+ });
95
+ it.each([
96
+ ['tr', 'Adedi artır', 'Adedi azalt', 'Ürünü kaldır'],
97
+ ['en', 'Increase quantity', 'Decrease quantity', 'Remove item'],
98
+ ])('uses %s fallback names when custom labels are omitted', function (language, increment, decrement, remove) {
99
+ renderSelector({}, language);
100
+ expect(react_1.screen.getByRole('button', { name: increment })).toBeInTheDocument();
101
+ expect(react_1.screen.getByRole('button', { name: decrement })).toBeInTheDocument();
102
+ renderSelector({ hasRemove: true }, language);
103
+ expect(react_1.screen.getByRole('button', { name: remove })).toBeInTheDocument();
65
104
  });
66
- it('calls onIncrement and onDecrement', function () { return __awaiter(void 0, void 0, void 0, function () {
67
- var onIncrement, onDecrement, _a, increment, decrement;
68
- return __generator(this, function (_b) {
69
- switch (_b.label) {
105
+ it.each(['horizontal', 'vertical'])('keeps accessible names connected to the correct actions when %s', function (orientation) { return __awaiter(void 0, void 0, void 0, function () {
106
+ var user, onIncrement, onDecrement;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
70
109
  case 0:
110
+ user = user_event_1.default.setup();
71
111
  onIncrement = jest.fn();
72
112
  onDecrement = jest.fn();
73
- renderSelector({ onIncrement: onIncrement, onDecrement: onDecrement });
74
- _a = react_1.screen.getAllByRole('button'), increment = _a[0], decrement = _a[1];
75
- return [4 /*yield*/, user_event_1.default.click(increment)];
113
+ renderSelector(__assign(__assign({}, customLabels), { orientation: orientation, onIncrement: onIncrement, onDecrement: onDecrement }));
114
+ return [4 /*yield*/, user.click(react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel }))];
76
115
  case 1:
77
- _b.sent();
78
- return [4 /*yield*/, user_event_1.default.click(decrement)];
116
+ _a.sent();
117
+ return [4 /*yield*/, user.click(react_1.screen.getByRole('button', { name: customLabels.decrementAriaLabel }))];
79
118
  case 2:
80
- _b.sent();
119
+ _a.sent();
81
120
  expect(onIncrement).toHaveBeenCalledTimes(1);
82
121
  expect(onDecrement).toHaveBeenCalledTimes(1);
83
122
  return [2 /*return*/];
84
123
  }
85
124
  });
86
125
  }); });
87
- it('places decrement before increment when horizontal', function () { return __awaiter(void 0, void 0, void 0, function () {
88
- var onIncrement, onDecrement, _a, first, second;
89
- return __generator(this, function (_b) {
90
- switch (_b.label) {
126
+ it('calls the named remove action once', function () { return __awaiter(void 0, void 0, void 0, function () {
127
+ var user, onRemove;
128
+ return __generator(this, function (_a) {
129
+ switch (_a.label) {
130
+ case 0:
131
+ user = user_event_1.default.setup();
132
+ onRemove = jest.fn();
133
+ renderSelector(__assign(__assign({}, customLabels), { hasRemove: true, onRemove: onRemove }));
134
+ return [4 /*yield*/, user.click(react_1.screen.getByRole('button', { name: customLabels.removeAriaLabel }))];
135
+ case 1:
136
+ _a.sent();
137
+ expect(onRemove).toHaveBeenCalledTimes(1);
138
+ return [2 /*return*/];
139
+ }
140
+ });
141
+ }); });
142
+ it('keeps action icons decorative', function () {
143
+ var _a, _b;
144
+ renderSelector(__assign(__assign({}, customLabels), { hasRemove: true }));
145
+ var increment = react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel });
146
+ var remove = react_1.screen.getByRole('button', { name: customLabels.removeAriaLabel });
147
+ expect((_a = increment.querySelector('svg')) === null || _a === void 0 ? void 0 : _a.closest('[aria-hidden="true"]')).toBeInTheDocument();
148
+ expect((_b = remove.querySelector('svg')) === null || _b === void 0 ? void 0 : _b.closest('[aria-hidden="true"]')).toBeInTheDocument();
149
+ });
150
+ it('supports tab focus, Enter, and Space for enabled actions', function () { return __awaiter(void 0, void 0, void 0, function () {
151
+ var user, onIncrement, onDecrement, increment, decrement;
152
+ return __generator(this, function (_a) {
153
+ switch (_a.label) {
91
154
  case 0:
155
+ user = user_event_1.default.setup();
92
156
  onIncrement = jest.fn();
93
157
  onDecrement = jest.fn();
94
- renderSelector({ orientation: 'horizontal', onIncrement: onIncrement, onDecrement: onDecrement });
95
- _a = react_1.screen.getAllByRole('button'), first = _a[0], second = _a[1];
96
- return [4 /*yield*/, user_event_1.default.click(first)];
158
+ renderSelector(__assign(__assign({}, customLabels), { onIncrement: onIncrement, onDecrement: onDecrement }));
159
+ increment = react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel });
160
+ decrement = react_1.screen.getByRole('button', { name: customLabels.decrementAriaLabel });
161
+ return [4 /*yield*/, user.tab()];
97
162
  case 1:
98
- _b.sent();
99
- return [4 /*yield*/, user_event_1.default.click(second)];
163
+ _a.sent();
164
+ expect(increment).toHaveFocus();
165
+ return [4 /*yield*/, user.keyboard('{Enter}')];
100
166
  case 2:
101
- _b.sent();
102
- expect(onDecrement).toHaveBeenCalledTimes(1);
167
+ _a.sent();
168
+ return [4 /*yield*/, user.tab()];
169
+ case 3:
170
+ _a.sent();
171
+ expect(decrement).toHaveFocus();
172
+ return [4 /*yield*/, user.keyboard(' ')];
173
+ case 4:
174
+ _a.sent();
103
175
  expect(onIncrement).toHaveBeenCalledTimes(1);
176
+ expect(onDecrement).toHaveBeenCalledTimes(1);
177
+ return [2 /*return*/];
178
+ }
179
+ });
180
+ }); });
181
+ it('keeps loading button names while disabling focus and callbacks', function () { return __awaiter(void 0, void 0, void 0, function () {
182
+ var user, onIncrement, onDecrement, increment, decrement;
183
+ return __generator(this, function (_a) {
184
+ switch (_a.label) {
185
+ case 0:
186
+ user = user_event_1.default.setup();
187
+ onIncrement = jest.fn();
188
+ onDecrement = jest.fn();
189
+ renderSelector(__assign(__assign({}, customLabels), { hasLoading: true, onIncrement: onIncrement, onDecrement: onDecrement }));
190
+ increment = react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel });
191
+ decrement = react_1.screen.getByRole('button', { name: customLabels.decrementAriaLabel });
192
+ expect(increment).toBeDisabled();
193
+ expect(decrement).toBeDisabled();
194
+ return [4 /*yield*/, user.tab()];
195
+ case 1:
196
+ _a.sent();
197
+ expect(increment).not.toHaveFocus();
198
+ expect(decrement).not.toHaveFocus();
199
+ return [4 /*yield*/, user.click(increment)];
200
+ case 2:
201
+ _a.sent();
202
+ return [4 /*yield*/, user.click(decrement)];
203
+ case 3:
204
+ _a.sent();
205
+ expect(onIncrement).not.toHaveBeenCalled();
206
+ expect(onDecrement).not.toHaveBeenCalled();
104
207
  return [2 /*return*/];
105
208
  }
106
209
  });
107
210
  }); });
108
- it('does not call onIncrement when increment is disabled', function () { return __awaiter(void 0, void 0, void 0, function () {
109
- var onIncrement;
211
+ it.each([
212
+ ['error', { hasError: true }],
213
+ ['disabled increment', { hasDisableIncrement: true }],
214
+ ])('keeps the increment name and callback disabled by %s', function (_state, props) { return __awaiter(void 0, void 0, void 0, function () {
215
+ var user, onIncrement, increment;
110
216
  return __generator(this, function (_a) {
111
217
  switch (_a.label) {
112
218
  case 0:
219
+ user = user_event_1.default.setup();
113
220
  onIncrement = jest.fn();
114
- renderSelector({ onIncrement: onIncrement, hasDisableIncrement: true });
115
- return [4 /*yield*/, user_event_1.default.click(react_1.screen.getAllByRole('button')[0])];
221
+ renderSelector(__assign(__assign(__assign({}, customLabels), props), { onIncrement: onIncrement }));
222
+ increment = react_1.screen.getByRole('button', { name: customLabels.incrementAriaLabel });
223
+ expect(increment).toBeDisabled();
224
+ return [4 /*yield*/, user.click(increment)];
116
225
  case 1:
117
226
  _a.sent();
118
227
  expect(onIncrement).not.toHaveBeenCalled();
@@ -121,15 +230,12 @@ describe('QuantitySelector', function () {
121
230
  });
122
231
  }); });
123
232
  it('hides action buttons when actions are disabled', function () {
124
- renderSelector({ hasDisableActions: true });
233
+ renderSelector(__assign(__assign({}, customLabels), { hasDisableActions: true }));
125
234
  expect(react_1.screen.queryByRole('button')).not.toBeInTheDocument();
126
235
  expect(react_1.screen.getByText('2')).toBeInTheDocument();
127
236
  });
128
237
  it('does not execute script tags in errorText', function () {
129
- renderSelector({
130
- hasError: true,
131
- errorText: '<img src="x" onerror="window.__qtyXss = true"><script>window.__qtyXss = true</script>Max',
132
- });
238
+ renderSelector(__assign(__assign({}, customLabels), { hasError: true, errorText: '<img src="x" onerror="window.__qtyXss = true"><script>window.__qtyXss = true</script>Max' }));
133
239
  expect(window.__qtyXss).toBeUndefined();
134
240
  });
135
241
  });
@@ -8,6 +8,12 @@ export interface QuantitySelector {
8
8
  onIncrement?(): void;
9
9
  onDecrement?(): void;
10
10
  onRemove?(): void;
11
+ /** Accessible name for the increment button */
12
+ incrementAriaLabel?: string;
13
+ /** Accessible name for the decrement button */
14
+ decrementAriaLabel?: string;
15
+ /** Accessible name for the remove button */
16
+ removeAriaLabel?: string;
11
17
  hasRemove?: boolean;
12
18
  hasLoading?: boolean;
13
19
  hasError?: boolean;
@@ -10,6 +10,9 @@ exports.QuantitySelectorDefault = {
10
10
  onIncrement: null,
11
11
  onDecrement: null,
12
12
  onRemove: null,
13
+ incrementAriaLabel: null,
14
+ decrementAriaLabel: null,
15
+ removeAriaLabel: null,
13
16
  hasRemove: false,
14
17
  hasLoading: false,
15
18
  hasError: false,
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  declare const _default: {
3
3
  title: string;
4
- component: ({ label, id, orientation, quantity, onIncrement, onDecrement, onRemove, hasRemove, hasLoading, hasError, errorText, hasDisableActions, hasDisableIncrement, }: import("../props").QuantitySelector) => React.JSX.Element;
4
+ component: ({ label, id, orientation, quantity, onIncrement, onDecrement, onRemove, incrementAriaLabel, decrementAriaLabel, removeAriaLabel, hasRemove, hasLoading, hasError, errorText, hasDisableActions, hasDisableIncrement, }: import("../props").QuantitySelector) => React.JSX.Element;
5
5
  tags: string[];
6
6
  argTypes: {
7
7
  label: {
@@ -35,6 +35,15 @@ declare const _default: {
35
35
  hasDisableIncrement: {
36
36
  control: string;
37
37
  };
38
+ incrementAriaLabel: {
39
+ control: string;
40
+ };
41
+ decrementAriaLabel: {
42
+ control: string;
43
+ };
44
+ removeAriaLabel: {
45
+ control: string;
46
+ };
38
47
  onIncrement: {
39
48
  action: string;
40
49
  };
@@ -59,6 +68,9 @@ export declare const Horizontal: {
59
68
  errorText: string;
60
69
  hasDisableActions: boolean;
61
70
  hasDisableIncrement: boolean;
71
+ incrementAriaLabel: string;
72
+ decrementAriaLabel: string;
73
+ removeAriaLabel: string;
62
74
  };
63
75
  };
64
76
  export declare const Vertical: {
@@ -73,6 +85,9 @@ export declare const Vertical: {
73
85
  errorText: string;
74
86
  hasDisableActions: boolean;
75
87
  hasDisableIncrement: boolean;
88
+ incrementAriaLabel: string;
89
+ decrementAriaLabel: string;
90
+ removeAriaLabel: string;
76
91
  };
77
92
  };
78
93
  export declare const WithRemove: {
@@ -87,6 +102,9 @@ export declare const WithRemove: {
87
102
  errorText: string;
88
103
  hasDisableActions: boolean;
89
104
  hasDisableIncrement: boolean;
105
+ incrementAriaLabel: string;
106
+ decrementAriaLabel: string;
107
+ removeAriaLabel: string;
90
108
  };
91
109
  };
92
110
  export declare const DisabledActions: {
@@ -101,6 +119,9 @@ export declare const DisabledActions: {
101
119
  hasError: boolean;
102
120
  errorText: string;
103
121
  hasDisableIncrement: boolean;
122
+ incrementAriaLabel: string;
123
+ decrementAriaLabel: string;
124
+ removeAriaLabel: string;
104
125
  };
105
126
  };
106
127
  export declare const DisabledIncrement: {
@@ -115,6 +136,9 @@ export declare const DisabledIncrement: {
115
136
  hasError: boolean;
116
137
  errorText: string;
117
138
  hasDisableActions: boolean;
139
+ incrementAriaLabel: string;
140
+ decrementAriaLabel: string;
141
+ removeAriaLabel: string;
118
142
  };
119
143
  };
120
144
  export declare const WithError: {
@@ -129,6 +153,9 @@ export declare const WithError: {
129
153
  hasLoading: boolean;
130
154
  hasDisableActions: boolean;
131
155
  hasDisableIncrement: boolean;
156
+ incrementAriaLabel: string;
157
+ decrementAriaLabel: string;
158
+ removeAriaLabel: string;
132
159
  };
133
160
  };
134
161
  export declare const Loading: {
@@ -143,6 +170,9 @@ export declare const Loading: {
143
170
  errorText: string;
144
171
  hasDisableActions: boolean;
145
172
  hasDisableIncrement: boolean;
173
+ incrementAriaLabel: string;
174
+ decrementAriaLabel: string;
175
+ removeAriaLabel: string;
146
176
  };
147
177
  };
148
178
  export declare const Empty: {
@@ -157,6 +187,9 @@ export declare const Empty: {
157
187
  errorText: string;
158
188
  hasDisableActions: boolean;
159
189
  hasDisableIncrement: boolean;
190
+ incrementAriaLabel: string;
191
+ decrementAriaLabel: string;
192
+ removeAriaLabel: string;
160
193
  };
161
194
  };
162
195
  export declare const WithoutLabel: {
@@ -171,6 +204,9 @@ export declare const WithoutLabel: {
171
204
  errorText: string;
172
205
  hasDisableActions: boolean;
173
206
  hasDisableIncrement: boolean;
207
+ incrementAriaLabel: string;
208
+ decrementAriaLabel: string;
209
+ removeAriaLabel: string;
174
210
  };
175
211
  };
176
212
  export declare const Complete: {
@@ -185,6 +221,9 @@ export declare const Complete: {
185
221
  id: string;
186
222
  hasLoading: boolean;
187
223
  hasDisableActions: boolean;
224
+ incrementAriaLabel: string;
225
+ decrementAriaLabel: string;
226
+ removeAriaLabel: string;
188
227
  };
189
228
  };
190
229
  export declare const Interactive: {
@@ -200,5 +239,8 @@ export declare const Interactive: {
200
239
  errorText: string;
201
240
  hasDisableActions: boolean;
202
241
  hasDisableIncrement: boolean;
242
+ incrementAriaLabel: string;
243
+ decrementAriaLabel: string;
244
+ removeAriaLabel: string;
203
245
  };
204
246
  };
@@ -30,6 +30,9 @@ var baseArgs = {
30
30
  errorText: '',
31
31
  hasDisableActions: false,
32
32
  hasDisableIncrement: false,
33
+ incrementAriaLabel: 'Adedi artır',
34
+ decrementAriaLabel: 'Adedi azalt',
35
+ removeAriaLabel: 'Ürünü kaldır',
33
36
  };
34
37
  exports.default = {
35
38
  title: 'Components/QuantitySelector',
@@ -46,6 +49,9 @@ exports.default = {
46
49
  errorText: { control: 'text' },
47
50
  hasDisableActions: { control: 'boolean' },
48
51
  hasDisableIncrement: { control: 'boolean' },
52
+ incrementAriaLabel: { control: 'text' },
53
+ decrementAriaLabel: { control: 'text' },
54
+ removeAriaLabel: { control: 'text' },
49
55
  onIncrement: { action: 'incremented' },
50
56
  onDecrement: { action: 'decremented' },
51
57
  onRemove: { action: 'removed' },
@@ -47,12 +47,20 @@ var react_i18next_1 = require("react-i18next");
47
47
  var ProductCardHorizontal_1 = __importDefault(require("../ProductCardHorizontal"));
48
48
  var SearchBox = react_1.default.forwardRef(function (_a, ref) {
49
49
  var _b;
50
- var _c = _a.onKeyUp, onKeyUp = _c === void 0 ? props_1.SearchBoxDefault.onKeyUp : _c, _d = _a.onKeyDown, onKeyDown = _d === void 0 ? props_1.SearchBoxDefault.onKeyDown : _d, _e = _a.onBlur, onBlur = _e === void 0 ? props_1.SearchBoxDefault.onBlur : _e, _f = _a.onFocus, onFocus = _f === void 0 ? props_1.SearchBoxDefault.onFocus : _f, _g = _a.onChange, onChange = _g === void 0 ? props_1.SearchBoxDefault.onChange : _g, _h = _a.onButtonClick, onButtonClick = _h === void 0 ? props_1.SearchBoxDefault.onButtonClick : _h, children = _a.children, _j = _a.isLoading, isLoading = _j === void 0 ? props_1.SearchBoxDefault.isLoading : _j, _k = _a.showResultList, showResultList = _k === void 0 ? props_1.SearchBoxDefault.showResultList : _k, _l = _a.placeholder, placeholder = _l === void 0 ? props_1.SearchBoxDefault.placeholder : _l, _m = _a.size, size = _m === void 0 ? props_1.SearchBoxDefault.size : _m, _o = _a.value, value = _o === void 0 ? props_1.SearchBoxDefault.value : _o, _p = _a.maxResultHeight, maxResultHeight = _p === void 0 ? props_1.SearchBoxDefault.maxResultHeight : _p, _q = _a.minSearchLength, minSearchLength = _q === void 0 ? props_1.SearchBoxDefault.minSearchLength : _q, _r = _a.ariaLabel, ariaLabel = _r === void 0 ? props_1.SearchBoxDefault.ariaLabel : _r, _s = _a.id, id = _s === void 0 ? "searchbox" : _s, _t = _a.disabled, disabled = _t === void 0 ? props_1.SearchBoxDefault.disabled : _t, className = _a.className;
50
+ var _c = _a.onKeyUp, onKeyUp = _c === void 0 ? props_1.SearchBoxDefault.onKeyUp : _c, _d = _a.onKeyDown, onKeyDown = _d === void 0 ? props_1.SearchBoxDefault.onKeyDown : _d, _e = _a.onOptionSelect, onOptionSelect = _e === void 0 ? props_1.SearchBoxDefault.onOptionSelect : _e, _f = _a.onEscape, onEscape = _f === void 0 ? props_1.SearchBoxDefault.onEscape : _f, _g = _a.onBlur, onBlur = _g === void 0 ? props_1.SearchBoxDefault.onBlur : _g, _h = _a.onFocus, onFocus = _h === void 0 ? props_1.SearchBoxDefault.onFocus : _h, _j = _a.onChange, onChange = _j === void 0 ? props_1.SearchBoxDefault.onChange : _j, _k = _a.onButtonClick, onButtonClick = _k === void 0 ? props_1.SearchBoxDefault.onButtonClick : _k, children = _a.children, _l = _a.isLoading, isLoading = _l === void 0 ? props_1.SearchBoxDefault.isLoading : _l, _m = _a.loadingAnnouncement, loadingAnnouncement = _m === void 0 ? props_1.SearchBoxDefault.loadingAnnouncement : _m, _o = _a.showResultList, showResultList = _o === void 0 ? props_1.SearchBoxDefault.showResultList : _o, _p = _a.placeholder, placeholder = _p === void 0 ? props_1.SearchBoxDefault.placeholder : _p, _q = _a.size, size = _q === void 0 ? props_1.SearchBoxDefault.size : _q, _r = _a.value, value = _r === void 0 ? props_1.SearchBoxDefault.value : _r, _s = _a.maxResultHeight, maxResultHeight = _s === void 0 ? props_1.SearchBoxDefault.maxResultHeight : _s, _t = _a.minSearchLength, minSearchLength = _t === void 0 ? props_1.SearchBoxDefault.minSearchLength : _t, _u = _a.ariaLabel, ariaLabel = _u === void 0 ? props_1.SearchBoxDefault.ariaLabel : _u, _v = _a.id, id = _v === void 0 ? "searchbox" : _v, _w = _a.disabled, disabled = _w === void 0 ? props_1.SearchBoxDefault.disabled : _w, className = _a.className;
51
51
  var t = (0, react_i18next_1.useTranslation)().t;
52
52
  var resultRef = (0, react_1.useRef)(null);
53
53
  var scrollContainerRef = (0, react_1.useRef)(null);
54
54
  var innerRef = (0, react_1.useRef)(null);
55
- var _u = (0, react_1.useState)(null), selectedIndex = _u[0], setSelectedIndex = _u[1];
55
+ var suppressEnterKeyUpRef = (0, react_1.useRef)(false);
56
+ var _x = (0, react_1.useState)(null), selectedIndex = _x[0], setSelectedIndex = _x[1];
57
+ var optionChildren = react_1.default.Children.toArray(children).filter(react_1.default.isValidElement);
58
+ var optionCount = optionChildren.length;
59
+ var shouldShowResults = showResultList &&
60
+ (!minSearchLength || ((_b = value === null || value === void 0 ? void 0 : value.length) !== null && _b !== void 0 ? _b : 0) >= minSearchLength);
61
+ var activeIndex = shouldShowResults && !isLoading && selectedIndex !== null && selectedIndex < optionCount
62
+ ? selectedIndex
63
+ : null;
56
64
  // Forward the ref while maintaining internal ref
57
65
  var handleRef = function (element) {
58
66
  innerRef.current = element;
@@ -64,78 +72,94 @@ var SearchBox = react_1.default.forwardRef(function (_a, ref) {
64
72
  }
65
73
  };
66
74
  var handleKeyUp = (0, react_1.useCallback)(function (e) {
67
- if (![38, 40].includes(e.keyCode)) {
68
- onKeyUp(e);
75
+ if (e.key === "Enter" && suppressEnterKeyUpRef.current) {
76
+ suppressEnterKeyUpRef.current = false;
77
+ e.preventDefault();
78
+ e.stopPropagation();
79
+ return;
69
80
  }
70
- else {
81
+ if (["ArrowUp", "ArrowDown", "Escape"].includes(e.key)) {
71
82
  e.preventDefault();
83
+ return;
72
84
  }
85
+ onKeyUp(e);
73
86
  }, [onKeyUp]);
74
87
  var handleKeyDown = (0, react_1.useCallback)(function (e) {
75
- var _a;
76
- if (!showResultList)
88
+ onKeyDown(e);
89
+ if (e.defaultPrevented || !shouldShowResults)
77
90
  return;
78
- var list = (_a = resultRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll(".productCard");
79
- if (!(list === null || list === void 0 ? void 0 : list.length))
80
- return;
81
- switch (e.keyCode) {
82
- case 38: // up
91
+ switch (e.key) {
92
+ case "ArrowUp":
93
+ if (!optionCount || isLoading)
94
+ return;
83
95
  e.preventDefault();
84
96
  setSelectedIndex(function (prev) {
85
- return prev === null ? list.length - 1 :
97
+ return prev === null || prev >= optionCount ? optionCount - 1 :
86
98
  prev === 0 ? 0 : prev - 1;
87
99
  });
88
100
  break;
89
- case 40: // down
101
+ case "ArrowDown":
102
+ if (!optionCount || isLoading)
103
+ return;
90
104
  e.preventDefault();
91
105
  setSelectedIndex(function (prev) {
92
- return prev === null ? 0 :
93
- prev === list.length - 1 ? list.length - 1 : prev + 1;
106
+ return prev === null || prev >= optionCount ? 0 :
107
+ prev === optionCount - 1 ? optionCount - 1 : prev + 1;
94
108
  });
95
109
  break;
110
+ case "Enter":
111
+ if (activeIndex === null)
112
+ return;
113
+ e.preventDefault();
114
+ e.stopPropagation();
115
+ suppressEnterKeyUpRef.current = true;
116
+ onOptionSelect(activeIndex, e);
117
+ break;
118
+ case "Escape":
119
+ e.preventDefault();
120
+ setSelectedIndex(null);
121
+ onEscape(e);
122
+ break;
96
123
  default:
97
124
  setSelectedIndex(null);
98
125
  }
99
- }, [showResultList, selectedIndex]);
126
+ }, [activeIndex, isLoading, onEscape, onKeyDown, onOptionSelect, optionCount, shouldShowResults]);
127
+ (0, react_1.useEffect)(function () {
128
+ setSelectedIndex(null);
129
+ }, [value]);
100
130
  (0, react_1.useEffect)(function () {
101
- if (!resultRef.current || selectedIndex === null)
131
+ if (!shouldShowResults || isLoading || (selectedIndex !== null && selectedIndex >= optionCount)) {
132
+ setSelectedIndex(null);
133
+ }
134
+ }, [isLoading, optionCount, selectedIndex, shouldShowResults]);
135
+ (0, react_1.useEffect)(function () {
136
+ if (!resultRef.current || activeIndex === null)
102
137
  return;
103
- var list = resultRef.current.querySelectorAll(".productCard");
104
- list.forEach(function (el, index) {
105
- if (index === selectedIndex) {
106
- el.classList.add("selected");
107
- var scrollContainer = scrollContainerRef.current;
108
- if (scrollContainer) {
109
- var elementTop = el.offsetTop;
110
- var elementHeight = el.offsetHeight;
111
- var containerHeight = scrollContainer.clientHeight;
112
- var scrollTop = scrollContainer.scrollTop;
113
- if (elementTop < scrollTop) {
114
- scrollContainer.scrollTo({
115
- top: elementTop,
116
- behavior: 'smooth'
117
- });
118
- }
119
- else if (elementTop + elementHeight > scrollTop + containerHeight) {
120
- scrollContainer.scrollTo({
121
- top: elementTop + elementHeight - containerHeight,
122
- behavior: 'smooth'
123
- });
124
- }
125
- }
138
+ var selectedElement = document.getElementById("".concat(id, "-result-").concat(activeIndex));
139
+ var scrollContainer = scrollContainerRef.current;
140
+ if (selectedElement && resultRef.current.contains(selectedElement) && scrollContainer) {
141
+ var elementTop = selectedElement.offsetTop;
142
+ var elementHeight = selectedElement.offsetHeight;
143
+ var containerHeight = scrollContainer.clientHeight;
144
+ var scrollTop = scrollContainer.scrollTop;
145
+ if (elementTop < scrollTop) {
146
+ scrollContainer.scrollTo({
147
+ top: elementTop,
148
+ behavior: 'smooth'
149
+ });
126
150
  }
127
- else {
128
- el.classList.remove("selected");
151
+ else if (elementTop + elementHeight > scrollTop + containerHeight) {
152
+ scrollContainer.scrollTo({
153
+ top: elementTop + elementHeight - containerHeight,
154
+ behavior: 'smooth'
155
+ });
129
156
  }
130
- });
131
- }, [selectedIndex]);
132
- var shouldShowResults = showResultList &&
133
- (!minSearchLength || ((_b = value === null || value === void 0 ? void 0 : value.length) !== null && _b !== void 0 ? _b : 0) >= minSearchLength);
134
- return ((0, jsx_runtime_1.jsxs)(SearchBox_styled_1.SearchBoxStyled, __assign({ "$showResultList": shouldShowResults, "$size": size, "$disabled": disabled, className: className }, { children: [(0, jsx_runtime_1.jsx)("div", { className: "shadowBox" }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "inputWrapper" }, { children: [(0, jsx_runtime_1.jsx)("input", { ref: handleRef, type: "text", id: id, "aria-label": ariaLabel, "aria-expanded": shouldShowResults, "aria-controls": shouldShowResults ? "".concat(id, "-results") : undefined, "aria-activedescendant": selectedIndex !== null ? "".concat(id, "-result-").concat(selectedIndex) : undefined, role: "combobox", placeholder: placeholder, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onBlur: onBlur, onFocus: onFocus, value: value, onChange: onChange, disabled: disabled, autoComplete: "off" }), (0, jsx_runtime_1.jsx)("button", __assign({ onClick: onButtonClick, className: "icon", "aria-label": t("SEARCH"), disabled: disabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Searchsmall" }) }))] })), shouldShowResults && ((0, jsx_runtime_1.jsx)("div", __assign({ ref: resultRef, className: "resultList", id: "".concat(id, "-results"), role: "listbox" }, { children: (0, jsx_runtime_1.jsx)("div", __assign({ className: "resultListInner", ref: scrollContainerRef }, { children: isLoading ? (Array.from({ length: 4 }, function (_, index) { return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "productCard", "data-id": "".concat(id, "-result-").concat(index), "data-role": "option", "data-selected": selectedIndex === index }, { children: (0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { hasLoading: true, size: size }) }), index)); })) : (react_1.default.Children.map(children, function (child, index) {
135
- if (!react_1.default.isValidElement(child))
136
- return child;
137
- return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "productCard", "data-id": "".concat(id, "-result-").concat(index), "data-role": "option", "data-selected": selectedIndex === index, tabIndex: -1 }, { children: child }), index));
138
- })) })) })))] })));
157
+ }
158
+ }, [activeIndex, id]);
159
+ return ((0, jsx_runtime_1.jsxs)(SearchBox_styled_1.SearchBoxStyled, __assign({ "$showResultList": shouldShowResults, "$size": size, "$disabled": disabled, className: className }, { children: [(0, jsx_runtime_1.jsx)("div", { className: "shadowBox" }), (0, jsx_runtime_1.jsxs)("div", __assign({ className: "inputWrapper" }, { children: [(0, jsx_runtime_1.jsx)("input", { ref: handleRef, type: "text", id: id, "aria-label": ariaLabel, "aria-expanded": shouldShowResults, "aria-controls": shouldShowResults ? "".concat(id, "-results") : undefined, "aria-activedescendant": activeIndex !== null ? "".concat(id, "-result-").concat(activeIndex) : undefined, role: "combobox", placeholder: placeholder, onKeyDown: handleKeyDown, onKeyUp: handleKeyUp, onBlur: onBlur, onFocus: onFocus, value: value, onChange: onChange, disabled: disabled, autoComplete: "off" }), (0, jsx_runtime_1.jsx)("button", __assign({ onClick: onButtonClick, className: "icon", "aria-label": t("SEARCH"), disabled: disabled }, { children: (0, jsx_runtime_1.jsx)(Icon_1.default, { name: "Searchsmall" }) }))] })), shouldShowResults && ((0, jsx_runtime_1.jsx)("div", __assign({ ref: resultRef, className: "resultList", id: "".concat(id, "-results"), role: "listbox", "aria-busy": isLoading }, { children: (0, jsx_runtime_1.jsxs)("div", __assign({ className: "resultListInner", ref: scrollContainerRef }, { children: [(0, jsx_runtime_1.jsx)("span", __assign({ className: "srOnly", role: "status", "aria-live": "polite" }, { children: isLoading ? (loadingAnnouncement || t("SEARCH_LOADING")) : "" })), isLoading ? (Array.from({ length: 4 }, function (_, index) { return ((0, jsx_runtime_1.jsx)("div", __assign({ className: "productCard", "aria-hidden": "true" }, { children: (0, jsx_runtime_1.jsx)(ProductCardHorizontal_1.default, { hasLoading: true, size: size }) }), index)); })) : (optionChildren.map(function (child, index) {
160
+ var _a;
161
+ return ((0, jsx_runtime_1.jsx)("div", __assign({ id: "".concat(id, "-result-").concat(index), role: "option", "aria-selected": activeIndex === index, className: "productCard".concat(activeIndex === index ? " selected" : ""), tabIndex: -1 }, { children: child }), (_a = child.key) !== null && _a !== void 0 ? _a : index));
162
+ }))] })) })))] })));
139
163
  });
140
164
  SearchBox.displayName = 'SearchBox';
141
165
  exports.default = react_1.default.memo(SearchBox);
@@ -31,6 +31,6 @@ exports.LoadingStyled = exports.SearchBoxStyled = void 0;
31
31
  var styled_components_1 = __importStar(require("styled-components"));
32
32
  var devices_1 = require("../../constants/devices");
33
33
  var disabledStyles = (0, styled_components_1.css)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n opacity: 0.6;\n pointer-events: none;\n cursor: not-allowed;\n"], ["\n opacity: 0.6;\n pointer-events: none;\n cursor: not-allowed;\n"])));
34
- exports.SearchBoxStyled = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n\n .shadowBox {\n height: 48px;\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n transform: translateX(-50%);\n border-radius: 0.5rem;\n box-shadow: ", ";\n display: ", ";\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .inputWrapper {\n position: relative;\n z-index: 5;\n border-radius: 0.5rem;\n input {\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n background: var(--bg);\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n padding: 8px 54px 8px 24px;\n color: var(--text);\n font: var(--body-medium-14-17);\n line-height: normal;\n outline: none;\n transition: all 0.2s ease;\n\n &::placeholder {\n color: var(--text-soft);\n }\n\n &:disabled {\n ", ";\n background-color: var(--surface);\n }\n }\n\n .icon {\n position: absolute;\n right: 1rem;\n top: 50%;\n transform: translateY(-50%);\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 0;\n outline: none;\n cursor: pointer;\n padding: 0;\n color: var(--primary);\n &:hover{\n color: var(--primary-hover);\n }\n }\n }\n\n .resultList {\n padding: 0;\n border-radius: 0.5rem;\n background: var(--bg);\n box-sizing: border-box;\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 4;\n display: grid;\n row-gap: 1.5rem;\n &:before{\n content: \"\";\n height: calc(100% + 48px);\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n border-radius: inherit;\n box-shadow: ", ";\n user-select: none;\n pointer-events: none;\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .resultListInner {\n position: relative;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: inherit;\n border: 1px solid var(--border);\n max-height: 408px;\n padding: 1.5rem;\n background-color: var(--bg);\n z-index: 1;\n\n // Custom scrollbar styling\n &::-webkit-scrollbar {\n width: 9px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: var(--border);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--grey-20);\n }\n\n .productCard {\n border-radius: 0.5rem;\n transition: all 0.2s ease;\n outline: none;\n\n &:is(.selected) {\n background: var(--surface-subtle);\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--primary-opacity-20);\n }\n }\n\n ", "\n\n @media only screen and ", " {\n row-gap: 0.5rem;\n max-height: 256px;\n }\n }\n }\n\n ", "\n"], ["\n position: relative;\n width: 100%;\n\n .shadowBox {\n height: 48px;\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n transform: translateX(-50%);\n border-radius: 0.5rem;\n box-shadow: ", ";\n display: ", ";\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .inputWrapper {\n position: relative;\n z-index: 5;\n border-radius: 0.5rem;\n input {\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n background: var(--bg);\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n padding: 8px 54px 8px 24px;\n color: var(--text);\n font: var(--body-medium-14-17);\n line-height: normal;\n outline: none;\n transition: all 0.2s ease;\n\n &::placeholder {\n color: var(--text-soft);\n }\n\n &:disabled {\n ", ";\n background-color: var(--surface);\n }\n }\n\n .icon {\n position: absolute;\n right: 1rem;\n top: 50%;\n transform: translateY(-50%);\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 0;\n outline: none;\n cursor: pointer;\n padding: 0;\n color: var(--primary);\n &:hover{\n color: var(--primary-hover);\n }\n }\n }\n\n .resultList {\n padding: 0;\n border-radius: 0.5rem;\n background: var(--bg);\n box-sizing: border-box;\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 4;\n display: grid;\n row-gap: 1.5rem;\n &:before{\n content: \"\";\n height: calc(100% + 48px);\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n border-radius: inherit;\n box-shadow: ", ";\n user-select: none;\n pointer-events: none;\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .resultListInner {\n position: relative;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: inherit;\n border: 1px solid var(--border);\n max-height: 408px;\n padding: 1.5rem;\n background-color: var(--bg);\n z-index: 1;\n\n // Custom scrollbar styling\n &::-webkit-scrollbar {\n width: 9px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: var(--border);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--grey-20);\n }\n\n .productCard {\n border-radius: 0.5rem;\n transition: all 0.2s ease;\n outline: none;\n\n &:is(.selected) {\n background: var(--surface-subtle);\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--primary-opacity-20);\n }\n }\n\n ", "\n\n @media only screen and ", " {\n row-gap: 0.5rem;\n max-height: 256px;\n }\n }\n }\n\n ", "\n"])), function (props) { return props.$size === "small" ? "0 0 16px 0 var(--icon-shadow-color)" : "0 6px 30px 0 var(--icon-shadow-color)"; }, function (props) { return props.$showResultList ? "none" : "block"; }, devices_1.devices.xl, disabledStyles, function (props) { return props.$size === "small" ? "0 0 16px 0 var(--icon-shadow-color)" : "0 6px 30px 0 var(--icon-shadow-color)"; }, devices_1.devices.xl, function (props) { return props.$size === "small" && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n row-gap: 0.5rem;\n max-height: 256px;\n "], ["\n row-gap: 0.5rem;\n max-height: 256px;\n "]))); }, devices_1.devices.xl, function (props) { return props.$disabled && disabledStyles; });
34
+ exports.SearchBoxStyled = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n position: relative;\n width: 100%;\n\n .srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n\n .shadowBox {\n height: 48px;\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n transform: translateX(-50%);\n border-radius: 0.5rem;\n box-shadow: ", ";\n display: ", ";\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .inputWrapper {\n position: relative;\n z-index: 5;\n border-radius: 0.5rem;\n input {\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n background: var(--bg);\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n padding: 8px 54px 8px 24px;\n color: var(--text);\n font: var(--body-medium-14-17);\n line-height: normal;\n outline: none;\n transition: all 0.2s ease;\n\n &::placeholder {\n color: var(--text-soft);\n }\n\n &:disabled {\n ", ";\n background-color: var(--surface);\n }\n }\n\n .icon {\n position: absolute;\n right: 1rem;\n top: 50%;\n transform: translateY(-50%);\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 0;\n outline: none;\n cursor: pointer;\n padding: 0;\n color: var(--primary);\n &:hover{\n color: var(--primary-hover);\n }\n }\n }\n\n .resultList {\n padding: 0;\n border-radius: 0.5rem;\n background: var(--bg);\n box-sizing: border-box;\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 4;\n display: grid;\n row-gap: 1.5rem;\n &:before{\n content: \"\";\n height: calc(100% + 48px);\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n border-radius: inherit;\n box-shadow: ", ";\n user-select: none;\n pointer-events: none;\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .resultListInner {\n position: relative;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: inherit;\n border: 1px solid var(--border);\n max-height: 408px;\n padding: 1.5rem;\n background-color: var(--bg);\n z-index: 1;\n\n // Custom scrollbar styling\n &::-webkit-scrollbar {\n width: 9px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: var(--border);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--grey-20);\n }\n\n .productCard {\n border-radius: 0.5rem;\n transition: all 0.2s ease;\n outline: none;\n\n &:is(.selected) {\n background: var(--surface-subtle);\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--primary-opacity-20);\n }\n }\n\n ", "\n\n @media only screen and ", " {\n row-gap: 0.5rem;\n max-height: 256px;\n }\n }\n }\n\n ", "\n"], ["\n position: relative;\n width: 100%;\n\n .srOnly {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n }\n\n .shadowBox {\n height: 48px;\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n transform: translateX(-50%);\n border-radius: 0.5rem;\n box-shadow: ", ";\n display: ", ";\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .inputWrapper {\n position: relative;\n z-index: 5;\n border-radius: 0.5rem;\n input {\n box-sizing: border-box;\n width: 100%;\n height: 48px;\n background: var(--bg);\n border-radius: 0.5rem;\n border: 1px solid var(--border);\n padding: 8px 54px 8px 24px;\n color: var(--text);\n font: var(--body-medium-14-17);\n line-height: normal;\n outline: none;\n transition: all 0.2s ease;\n\n &::placeholder {\n color: var(--text-soft);\n }\n\n &:disabled {\n ", ";\n background-color: var(--surface);\n }\n }\n\n .icon {\n position: absolute;\n right: 1rem;\n top: 50%;\n transform: translateY(-50%);\n width: 32px;\n height: 32px;\n display: flex;\n align-items: center;\n justify-content: center;\n background: transparent;\n border: 0;\n outline: none;\n cursor: pointer;\n padding: 0;\n color: var(--primary);\n &:hover{\n color: var(--primary-hover);\n }\n }\n }\n\n .resultList {\n padding: 0;\n border-radius: 0.5rem;\n background: var(--bg);\n box-sizing: border-box;\n position: absolute;\n top: 100%;\n left: 0;\n right: 0;\n z-index: 4;\n display: grid;\n row-gap: 1.5rem;\n &:before{\n content: \"\";\n height: calc(100% + 48px);\n position: absolute;\n width: calc(100% - 10px);\n left: 50%;\n bottom: 0;\n transform: translateX(-50%);\n border-radius: inherit;\n box-shadow: ", ";\n user-select: none;\n pointer-events: none;\n @media only screen and ", " {\n box-shadow: 0 0 16px 0 var(--icon-shadow-color);\n }\n }\n\n .resultListInner {\n position: relative;\n overflow-y: auto;\n overflow-x: hidden;\n border-radius: inherit;\n border: 1px solid var(--border);\n max-height: 408px;\n padding: 1.5rem;\n background-color: var(--bg);\n z-index: 1;\n\n // Custom scrollbar styling\n &::-webkit-scrollbar {\n width: 9px;\n }\n\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n\n &::-webkit-scrollbar-thumb {\n background: var(--border);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--grey-20);\n }\n\n .productCard {\n border-radius: 0.5rem;\n transition: all 0.2s ease;\n outline: none;\n\n &:is(.selected) {\n background: var(--surface-subtle);\n }\n\n &:focus-visible {\n box-shadow: 0 0 0 2px var(--primary-opacity-20);\n }\n }\n\n ", "\n\n @media only screen and ", " {\n row-gap: 0.5rem;\n max-height: 256px;\n }\n }\n }\n\n ", "\n"])), function (props) { return props.$size === "small" ? "0 0 16px 0 var(--icon-shadow-color)" : "0 6px 30px 0 var(--icon-shadow-color)"; }, function (props) { return props.$showResultList ? "none" : "block"; }, devices_1.devices.xl, disabledStyles, function (props) { return props.$size === "small" ? "0 0 16px 0 var(--icon-shadow-color)" : "0 6px 30px 0 var(--icon-shadow-color)"; }, devices_1.devices.xl, function (props) { return props.$size === "small" && (0, styled_components_1.css)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n row-gap: 0.5rem;\n max-height: 256px;\n "], ["\n row-gap: 0.5rem;\n max-height: 256px;\n "]))); }, devices_1.devices.xl, function (props) { return props.$disabled && disabledStyles; });
35
35
  exports.LoadingStyled = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"], ["\n text-align: center;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n"])));
36
36
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -0,0 +1 @@
1
+ export {};