krl-alfred 2.17.49 → 2.17.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Accordion/stories/Accordion.stories.d.ts +170 -0
- package/dist/components/Accordion/stories/Accordion.stories.js +131 -1
- package/dist/components/ActionButton/ActionButton.js +1 -1
- package/dist/components/ActionButton/stories/ActionButton.stories.d.ts +112 -0
- package/dist/components/ActionButton/stories/ActionButton.stories.js +115 -3
- package/dist/components/AddressCard/stories/AddressCard.stories.d.ts +147 -0
- package/dist/components/AddressCard/stories/AddressCard.stories.js +144 -1
- package/dist/components/AutocompleteInput/AutocompleteInput.js +10 -13
- package/dist/components/AutocompleteInput/AutocompleteInput.styled.js +2 -2
- package/dist/components/Input/stories/Input.stories.d.ts +344 -4
- package/dist/components/Input/stories/Input.stories.js +398 -6
- package/dist/components/SearchBox/SearchBox.js +8 -9
- package/dist/components/SearchBox/SearchBox.styled.js +1 -1
- package/dist/components/Tabs/stories/Tabs.stories.d.ts +68 -8
- package/dist/style/style.min.css +1 -1
- package/package.json +9 -16
|
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
14
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.DateInput = exports.Default = void 0;
|
|
17
|
+
exports.ErrorWithCustomLink = exports.Complete = exports.CustomWidth = exports.Number = exports.Tel = exports.Email = exports.PatternFormatWithValue = exports.PatternFormat = exports.NumericFormat = exports.WithInfoText = exports.Clearable = exports.WithCopyButton = exports.DateWithMinMax = exports.DateInline = exports.DateInput = exports.PasswordWithValue = exports.Password = exports.WithCustomLink = exports.ReadOnly = exports.Disabled = exports.WithError = exports.WithLabel = exports.Default = void 0;
|
|
18
18
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
19
19
|
var Input_1 = __importDefault(require("../Input"));
|
|
20
20
|
exports.default = {
|
|
@@ -24,8 +24,13 @@ exports.default = {
|
|
|
24
24
|
argTypes: {
|
|
25
25
|
hasError: { control: 'boolean' },
|
|
26
26
|
hasCopyButton: { control: 'boolean' },
|
|
27
|
+
isClearable: { control: 'boolean' },
|
|
28
|
+
disabled: { control: 'boolean' },
|
|
29
|
+
readOnly: { control: 'boolean' },
|
|
30
|
+
inline: { control: 'boolean' },
|
|
31
|
+
hasNumericFormat: { control: 'boolean' },
|
|
27
32
|
onCustomLinkClick: { action: 'clicked' },
|
|
28
|
-
type: { control: 'select', options: ["text", "number", "password", "date"] },
|
|
33
|
+
type: { control: 'select', options: ["text", "number", "password", "date", "email", "tel"] },
|
|
29
34
|
}
|
|
30
35
|
};
|
|
31
36
|
exports.Default = {
|
|
@@ -37,15 +42,402 @@ exports.Default = {
|
|
|
37
42
|
isClearable: false,
|
|
38
43
|
label: "Label",
|
|
39
44
|
type: "text",
|
|
40
|
-
infoText:
|
|
41
|
-
id: "
|
|
42
|
-
format:
|
|
45
|
+
infoText: null,
|
|
46
|
+
id: "input_default",
|
|
47
|
+
format: null,
|
|
43
48
|
mask: null,
|
|
44
49
|
onChange: function (e) {
|
|
45
50
|
console.log(e, "onChange");
|
|
46
51
|
}
|
|
47
52
|
},
|
|
48
53
|
};
|
|
54
|
+
exports.WithLabel = {
|
|
55
|
+
args: {
|
|
56
|
+
placeholder: "Enter your name",
|
|
57
|
+
label: "Full Name",
|
|
58
|
+
hasError: false,
|
|
59
|
+
disabled: false,
|
|
60
|
+
readOnly: false,
|
|
61
|
+
isClearable: false,
|
|
62
|
+
type: "text",
|
|
63
|
+
infoText: null,
|
|
64
|
+
id: "input_with_label",
|
|
65
|
+
onChange: function (e) {
|
|
66
|
+
console.log(e, "onChange");
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
exports.WithError = {
|
|
71
|
+
args: {
|
|
72
|
+
placeholder: "Enter your email",
|
|
73
|
+
label: "Email",
|
|
74
|
+
hasError: true,
|
|
75
|
+
errorMessage: "Please enter a valid email address",
|
|
76
|
+
disabled: false,
|
|
77
|
+
readOnly: false,
|
|
78
|
+
isClearable: false,
|
|
79
|
+
type: "text",
|
|
80
|
+
infoText: null,
|
|
81
|
+
id: "input_with_error",
|
|
82
|
+
onChange: function (e) {
|
|
83
|
+
console.log(e, "onChange");
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
};
|
|
87
|
+
exports.Disabled = {
|
|
88
|
+
args: {
|
|
89
|
+
placeholder: "Disabled input",
|
|
90
|
+
label: "Disabled Field",
|
|
91
|
+
hasError: false,
|
|
92
|
+
disabled: true,
|
|
93
|
+
readOnly: false,
|
|
94
|
+
isClearable: false,
|
|
95
|
+
type: "text",
|
|
96
|
+
value: "This field is disabled",
|
|
97
|
+
infoText: null,
|
|
98
|
+
id: "input_disabled",
|
|
99
|
+
onChange: function (e) {
|
|
100
|
+
console.log(e, "onChange");
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
};
|
|
104
|
+
exports.ReadOnly = {
|
|
105
|
+
args: {
|
|
106
|
+
placeholder: "Read only input",
|
|
107
|
+
label: "Read Only Field",
|
|
108
|
+
hasError: false,
|
|
109
|
+
disabled: false,
|
|
110
|
+
readOnly: true,
|
|
111
|
+
isClearable: false,
|
|
112
|
+
type: "text",
|
|
113
|
+
value: "This field is read only",
|
|
114
|
+
infoText: null,
|
|
115
|
+
id: "input_readonly",
|
|
116
|
+
onChange: function (e) {
|
|
117
|
+
console.log(e, "onChange");
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
};
|
|
121
|
+
exports.WithCustomLink = {
|
|
122
|
+
args: {
|
|
123
|
+
placeholder: "Enter your password",
|
|
124
|
+
label: "Password",
|
|
125
|
+
customLinkText: "Forgot password?",
|
|
126
|
+
customLinkHref: "#",
|
|
127
|
+
onCustomLinkClick: function () { return console.log("Custom link clicked"); },
|
|
128
|
+
hasError: false,
|
|
129
|
+
disabled: false,
|
|
130
|
+
readOnly: false,
|
|
131
|
+
isClearable: false,
|
|
132
|
+
type: "text",
|
|
133
|
+
infoText: null,
|
|
134
|
+
id: "input_with_link",
|
|
135
|
+
onChange: function (e) {
|
|
136
|
+
console.log(e, "onChange");
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
exports.Password = {
|
|
141
|
+
args: {
|
|
142
|
+
placeholder: "Enter your password",
|
|
143
|
+
label: "Password",
|
|
144
|
+
hasError: false,
|
|
145
|
+
disabled: false,
|
|
146
|
+
readOnly: false,
|
|
147
|
+
isClearable: false,
|
|
148
|
+
type: "password",
|
|
149
|
+
infoText: null,
|
|
150
|
+
id: "input_password",
|
|
151
|
+
onChange: function (e) {
|
|
152
|
+
console.log(e, "onChange");
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
exports.PasswordWithValue = {
|
|
157
|
+
args: {
|
|
158
|
+
placeholder: "Enter your password",
|
|
159
|
+
label: "Password",
|
|
160
|
+
hasError: false,
|
|
161
|
+
disabled: false,
|
|
162
|
+
readOnly: false,
|
|
163
|
+
isClearable: false,
|
|
164
|
+
type: "password",
|
|
165
|
+
value: "mypassword123",
|
|
166
|
+
infoText: null,
|
|
167
|
+
id: "input_password_value",
|
|
168
|
+
onChange: function (e) {
|
|
169
|
+
console.log(e, "onChange");
|
|
170
|
+
}
|
|
171
|
+
},
|
|
172
|
+
};
|
|
49
173
|
exports.DateInput = {
|
|
50
|
-
args:
|
|
174
|
+
args: {
|
|
175
|
+
placeholder: "Select date",
|
|
176
|
+
label: "Date",
|
|
177
|
+
hasError: false,
|
|
178
|
+
disabled: false,
|
|
179
|
+
readOnly: false,
|
|
180
|
+
isClearable: false,
|
|
181
|
+
type: "date",
|
|
182
|
+
format: "dd.MM.yyyy",
|
|
183
|
+
infoText: null,
|
|
184
|
+
id: "input_date",
|
|
185
|
+
onChange: function (e) {
|
|
186
|
+
console.log(e, "onChange");
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
exports.DateInline = {
|
|
191
|
+
args: {
|
|
192
|
+
placeholder: "Select date",
|
|
193
|
+
label: "Date (Inline)",
|
|
194
|
+
hasError: false,
|
|
195
|
+
disabled: false,
|
|
196
|
+
readOnly: false,
|
|
197
|
+
isClearable: false,
|
|
198
|
+
type: "date",
|
|
199
|
+
format: "dd.MM.yyyy",
|
|
200
|
+
inline: true,
|
|
201
|
+
infoText: null,
|
|
202
|
+
id: "input_date_inline",
|
|
203
|
+
onChange: function (e) {
|
|
204
|
+
console.log(e, "onChange");
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
};
|
|
208
|
+
exports.DateWithMinMax = {
|
|
209
|
+
args: {
|
|
210
|
+
placeholder: "Select date",
|
|
211
|
+
label: "Date with Range",
|
|
212
|
+
hasError: false,
|
|
213
|
+
disabled: false,
|
|
214
|
+
readOnly: false,
|
|
215
|
+
isClearable: false,
|
|
216
|
+
type: "date",
|
|
217
|
+
format: "dd.MM.yyyy",
|
|
218
|
+
minDate: new Date(),
|
|
219
|
+
maxDate: new Date(new Date().setFullYear(new Date().getFullYear() + 1)),
|
|
220
|
+
infoText: null,
|
|
221
|
+
id: "input_date_range",
|
|
222
|
+
onChange: function (e) {
|
|
223
|
+
console.log(e, "onChange");
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
exports.WithCopyButton = {
|
|
228
|
+
args: {
|
|
229
|
+
placeholder: "Copy this text",
|
|
230
|
+
label: "Copyable Text",
|
|
231
|
+
hasError: false,
|
|
232
|
+
disabled: false,
|
|
233
|
+
readOnly: false,
|
|
234
|
+
isClearable: false,
|
|
235
|
+
hasCopyButton: true,
|
|
236
|
+
type: "text",
|
|
237
|
+
value: "This text can be copied",
|
|
238
|
+
infoText: null,
|
|
239
|
+
id: "input_copy",
|
|
240
|
+
onChange: function (e) {
|
|
241
|
+
console.log(e, "onChange");
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
};
|
|
245
|
+
exports.Clearable = {
|
|
246
|
+
args: {
|
|
247
|
+
placeholder: "Type something",
|
|
248
|
+
label: "Clearable Input",
|
|
249
|
+
hasError: false,
|
|
250
|
+
disabled: false,
|
|
251
|
+
readOnly: false,
|
|
252
|
+
isClearable: true,
|
|
253
|
+
type: "text",
|
|
254
|
+
value: "This can be cleared",
|
|
255
|
+
infoText: null,
|
|
256
|
+
id: "input_clearable",
|
|
257
|
+
onChange: function (e) {
|
|
258
|
+
console.log(e, "onChange");
|
|
259
|
+
},
|
|
260
|
+
onClear: function () {
|
|
261
|
+
console.log("Input cleared");
|
|
262
|
+
}
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
exports.WithInfoText = {
|
|
266
|
+
args: {
|
|
267
|
+
placeholder: "Enter your information",
|
|
268
|
+
label: "Input with Info",
|
|
269
|
+
hasError: false,
|
|
270
|
+
disabled: false,
|
|
271
|
+
readOnly: false,
|
|
272
|
+
isClearable: false,
|
|
273
|
+
type: "text",
|
|
274
|
+
infoText: "This is helpful information about this field",
|
|
275
|
+
id: "input_info",
|
|
276
|
+
onChange: function (e) {
|
|
277
|
+
console.log(e, "onChange");
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
};
|
|
281
|
+
exports.NumericFormat = {
|
|
282
|
+
args: {
|
|
283
|
+
placeholder: "Enter number",
|
|
284
|
+
label: "Numeric Input",
|
|
285
|
+
hasError: false,
|
|
286
|
+
disabled: false,
|
|
287
|
+
readOnly: false,
|
|
288
|
+
isClearable: false,
|
|
289
|
+
hasNumericFormat: true,
|
|
290
|
+
type: "text",
|
|
291
|
+
infoText: null,
|
|
292
|
+
id: "input_numeric",
|
|
293
|
+
onChange: function (e) {
|
|
294
|
+
console.log(e, "onChange");
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
exports.PatternFormat = {
|
|
299
|
+
args: {
|
|
300
|
+
placeholder: "Enter phone number",
|
|
301
|
+
label: "Phone Number",
|
|
302
|
+
hasError: false,
|
|
303
|
+
disabled: false,
|
|
304
|
+
readOnly: false,
|
|
305
|
+
isClearable: false,
|
|
306
|
+
type: "text",
|
|
307
|
+
format: "+90 (###) ### ## ##",
|
|
308
|
+
mask: "_",
|
|
309
|
+
infoText: null,
|
|
310
|
+
id: "input_pattern",
|
|
311
|
+
onChange: function (e) {
|
|
312
|
+
console.log(e, "onChange");
|
|
313
|
+
}
|
|
314
|
+
},
|
|
315
|
+
};
|
|
316
|
+
exports.PatternFormatWithValue = {
|
|
317
|
+
args: {
|
|
318
|
+
placeholder: "Enter phone number",
|
|
319
|
+
label: "Phone Number",
|
|
320
|
+
hasError: false,
|
|
321
|
+
disabled: false,
|
|
322
|
+
readOnly: false,
|
|
323
|
+
isClearable: false,
|
|
324
|
+
type: "text",
|
|
325
|
+
format: "+90 (###) ### ## ##",
|
|
326
|
+
mask: "_",
|
|
327
|
+
value: "+90 (555) 123 45 67",
|
|
328
|
+
infoText: null,
|
|
329
|
+
id: "input_pattern_value",
|
|
330
|
+
onChange: function (e) {
|
|
331
|
+
console.log(e, "onChange");
|
|
332
|
+
}
|
|
333
|
+
},
|
|
334
|
+
};
|
|
335
|
+
exports.Email = {
|
|
336
|
+
args: {
|
|
337
|
+
placeholder: "Enter your email",
|
|
338
|
+
label: "Email Address",
|
|
339
|
+
hasError: false,
|
|
340
|
+
disabled: false,
|
|
341
|
+
readOnly: false,
|
|
342
|
+
isClearable: false,
|
|
343
|
+
type: "email",
|
|
344
|
+
infoText: null,
|
|
345
|
+
id: "input_email",
|
|
346
|
+
onChange: function (e) {
|
|
347
|
+
console.log(e, "onChange");
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
};
|
|
351
|
+
exports.Tel = {
|
|
352
|
+
args: {
|
|
353
|
+
placeholder: "Enter phone number",
|
|
354
|
+
label: "Phone Number",
|
|
355
|
+
hasError: false,
|
|
356
|
+
disabled: false,
|
|
357
|
+
readOnly: false,
|
|
358
|
+
isClearable: false,
|
|
359
|
+
type: "tel",
|
|
360
|
+
infoText: null,
|
|
361
|
+
id: "input_tel",
|
|
362
|
+
onChange: function (e) {
|
|
363
|
+
console.log(e, "onChange");
|
|
364
|
+
}
|
|
365
|
+
},
|
|
366
|
+
};
|
|
367
|
+
exports.Number = {
|
|
368
|
+
args: {
|
|
369
|
+
placeholder: "Enter number",
|
|
370
|
+
label: "Number",
|
|
371
|
+
hasError: false,
|
|
372
|
+
disabled: false,
|
|
373
|
+
readOnly: false,
|
|
374
|
+
isClearable: false,
|
|
375
|
+
type: "number",
|
|
376
|
+
infoText: null,
|
|
377
|
+
id: "input_number",
|
|
378
|
+
onChange: function (e) {
|
|
379
|
+
console.log(e, "onChange");
|
|
380
|
+
}
|
|
381
|
+
},
|
|
382
|
+
};
|
|
383
|
+
exports.CustomWidth = {
|
|
384
|
+
args: {
|
|
385
|
+
placeholder: "Custom width input",
|
|
386
|
+
label: "Custom Width",
|
|
387
|
+
width: "200px",
|
|
388
|
+
hasError: false,
|
|
389
|
+
disabled: false,
|
|
390
|
+
readOnly: false,
|
|
391
|
+
isClearable: false,
|
|
392
|
+
type: "text",
|
|
393
|
+
infoText: null,
|
|
394
|
+
id: "input_custom_width",
|
|
395
|
+
onChange: function (e) {
|
|
396
|
+
console.log(e, "onChange");
|
|
397
|
+
}
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
exports.Complete = {
|
|
401
|
+
args: {
|
|
402
|
+
placeholder: "Complete input example",
|
|
403
|
+
label: "Complete Input",
|
|
404
|
+
customLinkText: "Need help?",
|
|
405
|
+
customLinkHref: "#",
|
|
406
|
+
onCustomLinkClick: function () { return console.log("Help clicked"); },
|
|
407
|
+
hasError: false,
|
|
408
|
+
disabled: false,
|
|
409
|
+
readOnly: false,
|
|
410
|
+
isClearable: true,
|
|
411
|
+
hasCopyButton: false,
|
|
412
|
+
type: "text",
|
|
413
|
+
value: "Complete example",
|
|
414
|
+
infoText: "This is a complete example with all features",
|
|
415
|
+
id: "input_complete",
|
|
416
|
+
onChange: function (e) {
|
|
417
|
+
console.log(e, "onChange");
|
|
418
|
+
},
|
|
419
|
+
onClear: function () {
|
|
420
|
+
console.log("Input cleared");
|
|
421
|
+
}
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
exports.ErrorWithCustomLink = {
|
|
425
|
+
args: {
|
|
426
|
+
placeholder: "Enter your email",
|
|
427
|
+
label: "Email",
|
|
428
|
+
customLinkText: "Forgot email?",
|
|
429
|
+
customLinkHref: "#",
|
|
430
|
+
onCustomLinkClick: function () { return console.log("Forgot email clicked"); },
|
|
431
|
+
hasError: true,
|
|
432
|
+
errorMessage: "Invalid email format",
|
|
433
|
+
disabled: false,
|
|
434
|
+
readOnly: false,
|
|
435
|
+
isClearable: false,
|
|
436
|
+
type: "email",
|
|
437
|
+
infoText: null,
|
|
438
|
+
id: "input_error_link",
|
|
439
|
+
onChange: function (e) {
|
|
440
|
+
console.log(e, "onChange");
|
|
441
|
+
}
|
|
442
|
+
},
|
|
51
443
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
"use client";
|
|
1
2
|
"use strict";
|
|
2
3
|
var __assign = (this && this.__assign) || function () {
|
|
3
4
|
__assign = Object.assign || function(t) {
|
|
@@ -42,7 +43,6 @@ var react_1 = __importStar(require("react"));
|
|
|
42
43
|
var props_1 = require("./props");
|
|
43
44
|
var SearchBox_styled_1 = require("./SearchBox.styled");
|
|
44
45
|
var Icon_1 = __importDefault(require("../Icon/Icon"));
|
|
45
|
-
var simplebar_react_1 = __importDefault(require("simplebar-react"));
|
|
46
46
|
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) {
|
|
@@ -50,7 +50,7 @@ var SearchBox = react_1.default.forwardRef(function (_a, ref) {
|
|
|
50
50
|
var _c = _a.onKeyUp, onKeyUp = _c === void 0 ? props_1.SearchBoxDefault.onKeyUp : _c, _d = _a.onBlur, onBlur = _d === void 0 ? props_1.SearchBoxDefault.onBlur : _d, _e = _a.onFocus, onFocus = _e === void 0 ? props_1.SearchBoxDefault.onFocus : _e, _f = _a.onChange, onChange = _f === void 0 ? props_1.SearchBoxDefault.onChange : _f, _g = _a.onButtonClick, onButtonClick = _g === void 0 ? props_1.SearchBoxDefault.onButtonClick : _g, children = _a.children, _h = _a.isLoading, isLoading = _h === void 0 ? props_1.SearchBoxDefault.isLoading : _h, _j = _a.showResultList, showResultList = _j === void 0 ? props_1.SearchBoxDefault.showResultList : _j, _k = _a.placeholder, placeholder = _k === void 0 ? props_1.SearchBoxDefault.placeholder : _k, _l = _a.size, size = _l === void 0 ? props_1.SearchBoxDefault.size : _l, _m = _a.value, value = _m === void 0 ? props_1.SearchBoxDefault.value : _m, _o = _a.maxResultHeight, maxResultHeight = _o === void 0 ? props_1.SearchBoxDefault.maxResultHeight : _o, _p = _a.minSearchLength, minSearchLength = _p === void 0 ? props_1.SearchBoxDefault.minSearchLength : _p, _q = _a.ariaLabel, ariaLabel = _q === void 0 ? props_1.SearchBoxDefault.ariaLabel : _q, _r = _a.id, id = _r === void 0 ? "searchbox" : _r, _s = _a.disabled, disabled = _s === void 0 ? props_1.SearchBoxDefault.disabled : _s, className = _a.className;
|
|
51
51
|
var t = (0, react_i18next_1.useTranslation)().t;
|
|
52
52
|
var resultRef = (0, react_1.useRef)(null);
|
|
53
|
-
var
|
|
53
|
+
var scrollContainerRef = (0, react_1.useRef)(null);
|
|
54
54
|
var innerRef = (0, react_1.useRef)(null);
|
|
55
55
|
var _t = (0, react_1.useState)(null), selectedIndex = _t[0], setSelectedIndex = _t[1];
|
|
56
56
|
// Forward the ref while maintaining internal ref
|
|
@@ -106,10 +106,9 @@ var SearchBox = react_1.default.forwardRef(function (_a, ref) {
|
|
|
106
106
|
return;
|
|
107
107
|
var list = resultRef.current.querySelectorAll(".productCard");
|
|
108
108
|
list.forEach(function (el, index) {
|
|
109
|
-
var _a;
|
|
110
109
|
if (index === selectedIndex) {
|
|
111
110
|
el.classList.add("selected");
|
|
112
|
-
var scrollContainer =
|
|
111
|
+
var scrollContainer = scrollContainerRef.current;
|
|
113
112
|
if (scrollContainer) {
|
|
114
113
|
var elementTop = el.offsetTop;
|
|
115
114
|
var elementHeight = el.offsetHeight;
|
|
@@ -136,11 +135,11 @@ var SearchBox = react_1.default.forwardRef(function (_a, ref) {
|
|
|
136
135
|
}, [selectedIndex]);
|
|
137
136
|
var shouldShowResults = showResultList &&
|
|
138
137
|
(!minSearchLength || ((_b = value === null || value === void 0 ? void 0 : value.length) !== null && _b !== void 0 ? _b : 0) >= minSearchLength);
|
|
139
|
-
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"
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
138
|
+
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) {
|
|
139
|
+
if (!react_1.default.isValidElement(child))
|
|
140
|
+
return child;
|
|
141
|
+
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));
|
|
142
|
+
})) })) })))] })));
|
|
144
143
|
});
|
|
145
144
|
SearchBox.displayName = 'SearchBox';
|
|
146
145
|
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: white;\n border-radius: 0.5rem;\n border: 1px solid var(--dark-opacity-10);\n padding: 8px 54px 8px 24px;\n color: var(--dark);\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(--dark-opacity-50);\n }\n\n &:disabled {\n ", ";\n background-color: var(--dark-opacity-5);\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: white;\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: hidden;\n border-radius: inherit;\n border: 1px solid var(--dark-opacity-10);\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: white;\n border-radius: 0.5rem;\n border: 1px solid var(--dark-opacity-10);\n padding: 8px 54px 8px 24px;\n color: var(--dark);\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(--dark-opacity-50);\n }\n\n &:disabled {\n ", ";\n background-color: var(--dark-opacity-5);\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: white;\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(--dark-opacity-10);\n max-height: 408px;\n padding: 1.5rem;\n background-color: white;\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(--dark-opacity-10);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--dark-opacity-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(--dark-opacity-3);\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: white;\n border-radius: 0.5rem;\n border: 1px solid var(--dark-opacity-10);\n padding: 8px 54px 8px 24px;\n color: var(--dark);\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(--dark-opacity-50);\n }\n\n &:disabled {\n ", ";\n background-color: var(--dark-opacity-5);\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: white;\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(--dark-opacity-10);\n max-height: 408px;\n padding: 1.5rem;\n background-color: white;\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(--dark-opacity-10);\n border-radius: 4px;\n }\n\n &::-webkit-scrollbar-thumb:hover {\n background: var(--dark-opacity-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(--dark-opacity-3);\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;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { StoryObj } from "@storybook/react";
|
|
2
1
|
declare const meta: {
|
|
3
2
|
title: string;
|
|
4
3
|
component: ({ tabs, activeTab, defaultTab, size, hasAutoFlex, isHideTabHeaderOnMobile, onChange, }: import("..").TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -8,10 +7,71 @@ declare const meta: {
|
|
|
8
7
|
tags: string[];
|
|
9
8
|
};
|
|
10
9
|
export default meta;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
10
|
+
export declare const Default: {
|
|
11
|
+
args: {
|
|
12
|
+
tabs: {
|
|
13
|
+
key: string;
|
|
14
|
+
title: string;
|
|
15
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
}[];
|
|
17
|
+
size: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export declare const WithDefaultTab: {
|
|
21
|
+
args: {
|
|
22
|
+
tabs: {
|
|
23
|
+
key: string;
|
|
24
|
+
title: string;
|
|
25
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
}[];
|
|
27
|
+
defaultTab: string;
|
|
28
|
+
size: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
export declare const WithDisabledTab: {
|
|
32
|
+
args: {
|
|
33
|
+
tabs: ({
|
|
34
|
+
key: string;
|
|
35
|
+
title: string;
|
|
36
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
isDisabled?: undefined;
|
|
38
|
+
} | {
|
|
39
|
+
key: string;
|
|
40
|
+
title: string;
|
|
41
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
42
|
+
isDisabled: boolean;
|
|
43
|
+
})[];
|
|
44
|
+
size: string;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export declare const WithAutoFlex: {
|
|
48
|
+
args: {
|
|
49
|
+
tabs: {
|
|
50
|
+
key: string;
|
|
51
|
+
title: string;
|
|
52
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
53
|
+
}[];
|
|
54
|
+
hasAutoFlex: boolean;
|
|
55
|
+
size: string;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
export declare const SmallSize: {
|
|
59
|
+
args: {
|
|
60
|
+
tabs: {
|
|
61
|
+
key: string;
|
|
62
|
+
title: string;
|
|
63
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
64
|
+
}[];
|
|
65
|
+
size: string;
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
export declare const LargeSize: {
|
|
69
|
+
args: {
|
|
70
|
+
tabs: {
|
|
71
|
+
key: string;
|
|
72
|
+
title: string;
|
|
73
|
+
content: import("react/jsx-runtime").JSX.Element;
|
|
74
|
+
}[];
|
|
75
|
+
size: string;
|
|
76
|
+
};
|
|
77
|
+
};
|