@unbxd-ui/unbxd-react-components 0.3.1 → 0.3.2-beta.10
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/assets/desktop.svg +6 -0
- package/assets/map-pin.svg +6 -0
- package/assets/p1.svg +20 -0
- package/assets/p2.svg +22 -0
- package/assets/p3.svg +19 -0
- package/assets/p4.svg +22 -0
- package/assets/p5.svg +23 -0
- package/components/Accordian/accordianCore.scss +8 -0
- package/components/Accordian/accordianTheme.scss +6 -0
- package/components/Button/button.css +1 -0
- package/components/Button/buttonTheme.scss +94 -0
- package/components/Form/Dropdown.js +77 -10
- package/components/Form/Input.js +11 -3
- package/components/Form/SearchableDropdown.js +22 -15
- package/components/Form/SelectedPills.js +128 -0
- package/components/Form/SummarySelection.js +46 -0
- package/components/Form/Textarea.js +13 -3
- package/components/Form/form.css +1 -0
- package/components/Form/formCore.css +1 -1
- package/components/Form/formCore.scss +713 -0
- package/components/Form/formTheme.scss +33 -0
- package/components/Form/stories/Dropdown.stories.js +242 -2
- package/components/Form/stories/SearchableDropdown.stories.js +173 -3
- package/components/Form/stories/ServerPaginatedDropdown.stories.js +166 -94
- package/components/Form/summarySelection.css +1 -0
- package/components/Form/summarySelection.scss +106 -0
- package/components/Form/variables.scss +116 -0
- package/components/InlineModal/inlineModal.css +1 -0
- package/components/InlineModal/inlineModalCore.scss +40 -0
- package/components/InlineModal/inlineModalTheme.scss +16 -0
- package/components/Link/linkCore.css +1 -1
- package/components/Link/linkCore.scss +66 -0
- package/components/Link/linkTheme.scss +79 -0
- package/components/List/list.css +1 -0
- package/components/List/listCore.scss +6 -0
- package/components/List/listTheme.scss +0 -0
- package/components/MetricCard/MetricCard.css +1 -0
- package/components/MetricCard/MetricCard.js +65 -0
- package/components/MetricCard/MetricCard.scss +118 -0
- package/components/MetricCard/MetriicCard.stories.js +131 -0
- package/components/MetricCard/index.js +9 -0
- package/components/Modal/modal.css +1 -0
- package/components/Modal/modalCore.scss +58 -0
- package/components/Modal/modalTheme.scss +0 -0
- package/components/NoDataPlaceholder/noDataPlaceholderCore.scss +33 -0
- package/components/NotificationComponent/notificationComponent.css +1 -0
- package/components/NotificationComponent/notificationTheme.scss +38 -0
- package/components/PIDItemComponent/PIDItemComponent.js +82 -0
- package/components/PIDItemComponent/PIDItemComponent.stories.js +175 -0
- package/components/PIDItemComponent/PIDItemComponentCore.css +1 -0
- package/components/PIDItemComponent/PIDItemComponentCore.scss +36 -0
- package/components/PIDItemComponent/index.js +9 -0
- package/components/PageLoader/pageLoaderCore.scss +34 -0
- package/components/ProgressBar/ProgressBar.scss +0 -0
- package/components/ProgressBar/progressBar.css +0 -0
- package/components/ProgressBar/progressBarCore.scss +22 -0
- package/components/ProgressBar/progressBarTheme.scss +0 -0
- package/components/Table/tableCore.scss +547 -0
- package/components/Table/tableTheme.scss +34 -0
- package/components/TabsComponent/tabs.css +1 -0
- package/components/TabsComponent/tabsCore.scss +59 -0
- package/components/TabsComponent/tabsTheme.scss +0 -0
- package/components/ToastNotification/toastNotificationCore.scss +273 -0
- package/components/Tooltip/tooltipCore.scss +207 -0
- package/components/Tooltip/tooltipTheme.scss +20 -0
- package/components/UIDItemComponent/UIDItemComponent.js +148 -0
- package/components/UIDItemComponent/UIDItemComponent.stories.js +51 -0
- package/components/UIDItemComponent/UIDItemComponentCore.css +1 -0
- package/components/UIDItemComponent/UIDItemComponentCore.scss +57 -0
- package/components/UIDItemComponent/index.js +9 -0
- package/components/common/common.scss +14 -0
- package/components/core.css +3 -2
- package/components/core.scss +13 -10
- package/components/index.js +32 -11
- package/components/theme.css +3 -2
- package/components/theme.scss +2 -1
- package/core/icon.js +17 -0
- package/core/index.js +14 -0
- package/core/lazyLoadImage.js +56 -0
- package/core/selection.json +1 -0
- package/core/utils.js +6 -1
- package/index.js +60 -0
- package/package.json +9 -4
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.WithPreselectedValue = exports.WithLabel = exports.WithCreateCTA = exports.Disabled = exports.Default = exports.CustomOptionRenderer = void 0;
|
|
6
|
+
exports["default"] = exports.WithoutCreateCTA = exports.WithUIDItemComponent = exports.WithPreselectedValue = exports.WithPIDItemComponent = exports.WithLabel = exports.WithCreateCTA = exports.Disabled = exports.Default = exports.CustomOptionRenderer = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
9
8
|
var _dataLoader = _interopRequireDefault(require("../../../core/dataLoader"));
|
|
9
|
+
var _PIDItemComponent = _interopRequireDefault(require("../../PIDItemComponent/PIDItemComponent"));
|
|
10
|
+
var _UIDItemComponent = _interopRequireDefault(require("../../UIDItemComponent/UIDItemComponent"));
|
|
11
|
+
var _Dropdown = _interopRequireDefault(require("../Dropdown"));
|
|
10
12
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
13
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
14
|
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
@@ -338,4 +340,242 @@ var WithCreateCTA = exports.WithCreateCTA = {
|
|
|
338
340
|
SelectionSummary: SelectionSummary
|
|
339
341
|
}, WithCreateCTA.args)));
|
|
340
342
|
}
|
|
343
|
+
};
|
|
344
|
+
var WithUIDItemComponent = exports.WithUIDItemComponent = {
|
|
345
|
+
render: function render() {
|
|
346
|
+
var _React$useState7 = _react["default"].useState(null),
|
|
347
|
+
_React$useState8 = _slicedToArray(_React$useState7, 2),
|
|
348
|
+
selectedValue = _React$useState8[0],
|
|
349
|
+
setSelectedValue = _React$useState8[1];
|
|
350
|
+
var userOptions = [{
|
|
351
|
+
id: 'user1',
|
|
352
|
+
user_id: 'A12B34C56D',
|
|
353
|
+
rank: 1,
|
|
354
|
+
user_behavior: {
|
|
355
|
+
user_types: 'returning',
|
|
356
|
+
session_count: 15,
|
|
357
|
+
total_events: 247
|
|
358
|
+
},
|
|
359
|
+
engagement_metrics: {
|
|
360
|
+
clicks: 42,
|
|
361
|
+
orders: 3,
|
|
362
|
+
revenue: '245.99'
|
|
363
|
+
},
|
|
364
|
+
device_info: {
|
|
365
|
+
platforms: ['Desktop'],
|
|
366
|
+
devices: ['Chrome']
|
|
367
|
+
},
|
|
368
|
+
location_info: {
|
|
369
|
+
countries: ['United States'],
|
|
370
|
+
regions: ['California'],
|
|
371
|
+
cities: ['San Francisco']
|
|
372
|
+
}
|
|
373
|
+
}, {
|
|
374
|
+
id: 'user2',
|
|
375
|
+
user_id: 'Z98Y76X54W',
|
|
376
|
+
rank: 2,
|
|
377
|
+
user_behavior: {
|
|
378
|
+
user_types: 'new',
|
|
379
|
+
session_count: 2,
|
|
380
|
+
total_events: 18
|
|
381
|
+
},
|
|
382
|
+
engagement_metrics: {
|
|
383
|
+
clicks: 8,
|
|
384
|
+
orders: 0,
|
|
385
|
+
revenue: '0.0'
|
|
386
|
+
},
|
|
387
|
+
device_info: {
|
|
388
|
+
platforms: ['Mobile'],
|
|
389
|
+
devices: ['Safari']
|
|
390
|
+
},
|
|
391
|
+
location_info: {
|
|
392
|
+
countries: ['United Kingdom'],
|
|
393
|
+
cities: ['London']
|
|
394
|
+
}
|
|
395
|
+
}, {
|
|
396
|
+
id: 'user3',
|
|
397
|
+
user_id: 'M45N67O89P',
|
|
398
|
+
rank: 3,
|
|
399
|
+
user_behavior: {
|
|
400
|
+
user_types: 'power',
|
|
401
|
+
session_count: 50,
|
|
402
|
+
total_events: 1250
|
|
403
|
+
},
|
|
404
|
+
engagement_metrics: {
|
|
405
|
+
clicks: 320,
|
|
406
|
+
orders: 15,
|
|
407
|
+
revenue: '1899.75'
|
|
408
|
+
},
|
|
409
|
+
device_info: {
|
|
410
|
+
platforms: ['Desktop', 'Mobile'],
|
|
411
|
+
devices: ['Chrome', 'Firefox']
|
|
412
|
+
},
|
|
413
|
+
location_info: {
|
|
414
|
+
countries: ['Canada'],
|
|
415
|
+
regions: ['Ontario'],
|
|
416
|
+
cities: ['Toronto']
|
|
417
|
+
}
|
|
418
|
+
}];
|
|
419
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
420
|
+
style: {
|
|
421
|
+
width: '500px'
|
|
422
|
+
}
|
|
423
|
+
}, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
424
|
+
label: "Select User",
|
|
425
|
+
idAttribute: "id",
|
|
426
|
+
nameAttribute: "user_id",
|
|
427
|
+
options: userOptions,
|
|
428
|
+
value: selectedValue,
|
|
429
|
+
onChange: function onChange(value) {
|
|
430
|
+
console.log('Selected User:', value);
|
|
431
|
+
setSelectedValue(value);
|
|
432
|
+
},
|
|
433
|
+
DropdownItem: _UIDItemComponent["default"],
|
|
434
|
+
placeholder: "Choose a user...",
|
|
435
|
+
className: "demo-dropdown",
|
|
436
|
+
showSearch: true,
|
|
437
|
+
searchPlaceholder: "Search users..."
|
|
438
|
+
}));
|
|
439
|
+
}
|
|
440
|
+
};
|
|
441
|
+
var WithPIDItemComponent = exports.WithPIDItemComponent = {
|
|
442
|
+
render: function render() {
|
|
443
|
+
var _React$useState9 = _react["default"].useState(null),
|
|
444
|
+
_React$useState0 = _slicedToArray(_React$useState9, 2),
|
|
445
|
+
selectedValue = _React$useState0[0],
|
|
446
|
+
setSelectedValue = _React$useState0[1];
|
|
447
|
+
var productOptions = [{
|
|
448
|
+
id: 'prod1',
|
|
449
|
+
uniqueId: 'PROD-12345',
|
|
450
|
+
imageUrl: 'https://images.unsplash.com/photo-1505740420928-5e560c06d30e?w=300',
|
|
451
|
+
title: 'Premium Wireless Headphones with Noise Cancellation'
|
|
452
|
+
}, {
|
|
453
|
+
id: 'prod2',
|
|
454
|
+
uniqueId: 'PROD-67890',
|
|
455
|
+
imageUrl: 'https://images.unsplash.com/photo-1523275335684-37898b6baf30?w=300',
|
|
456
|
+
title: 'Smartwatch with Fitness Tracking'
|
|
457
|
+
}, {
|
|
458
|
+
id: 'prod3',
|
|
459
|
+
uniqueId: 'PROD-11111',
|
|
460
|
+
imageUrl: 'https://images.unsplash.com/photo-1526170375885-4d8ecf77b99f?w=300',
|
|
461
|
+
title: 'Professional Camera Kit'
|
|
462
|
+
}, {
|
|
463
|
+
id: 'prod4',
|
|
464
|
+
uniqueId: 'PROD-22222',
|
|
465
|
+
imageUrl: 'https://images.unsplash.com/photo-1560343090-f0409e92791a?w=300',
|
|
466
|
+
title: 'Gaming Laptop'
|
|
467
|
+
}, {
|
|
468
|
+
id: 'prod5',
|
|
469
|
+
uniqueId: 'PROD-33333',
|
|
470
|
+
imageUrl: 'https://images.unsplash.com/photo-1572635196237-14b3f281503f?w=300',
|
|
471
|
+
title: 'Wireless Bluetooth Speaker with Bass Boost'
|
|
472
|
+
}];
|
|
473
|
+
var keysMap = {
|
|
474
|
+
uniqueIdMap: 'uniqueId',
|
|
475
|
+
imageUrlMap: 'imageUrl',
|
|
476
|
+
titleMap: 'title'
|
|
477
|
+
};
|
|
478
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
479
|
+
style: {
|
|
480
|
+
width: '300px'
|
|
481
|
+
}
|
|
482
|
+
}, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], {
|
|
483
|
+
label: "Select Product",
|
|
484
|
+
idAttribute: "uniqueId",
|
|
485
|
+
nameAttribute: "uniqueId",
|
|
486
|
+
options: productOptions,
|
|
487
|
+
value: selectedValue,
|
|
488
|
+
onChange: function onChange(value) {
|
|
489
|
+
console.log('Selected Product:', value);
|
|
490
|
+
setSelectedValue(value);
|
|
491
|
+
},
|
|
492
|
+
DropdownItem: _PIDItemComponent["default"],
|
|
493
|
+
placeholder: "Choose a product...",
|
|
494
|
+
className: "demo-dropdown",
|
|
495
|
+
showSearch: true,
|
|
496
|
+
searchPlaceholder: "Search products..."
|
|
497
|
+
}));
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
var WithoutCreateCTA = exports.WithoutCreateCTA = {
|
|
501
|
+
args: {
|
|
502
|
+
showCreateCTA: false,
|
|
503
|
+
label: 'Categories',
|
|
504
|
+
idAttribute: 'id',
|
|
505
|
+
nameAttribute: 'label',
|
|
506
|
+
showSearch: true,
|
|
507
|
+
searchPlaceholder: 'Search categories...',
|
|
508
|
+
multiSelect: true,
|
|
509
|
+
noSelectionLabel: 'Select categories'
|
|
510
|
+
},
|
|
511
|
+
render: function render() {
|
|
512
|
+
var _React$useState1 = _react["default"].useState([{
|
|
513
|
+
id: '1',
|
|
514
|
+
label: 'Electronics'
|
|
515
|
+
}, {
|
|
516
|
+
id: '2',
|
|
517
|
+
label: 'Clothing'
|
|
518
|
+
}, {
|
|
519
|
+
id: '3',
|
|
520
|
+
label: 'Books'
|
|
521
|
+
}, {
|
|
522
|
+
id: '4',
|
|
523
|
+
label: 'Food'
|
|
524
|
+
}, {
|
|
525
|
+
id: '5',
|
|
526
|
+
label: 'Furniture'
|
|
527
|
+
}, {
|
|
528
|
+
id: '6',
|
|
529
|
+
label: 'Electronics'
|
|
530
|
+
}, {
|
|
531
|
+
id: '7',
|
|
532
|
+
label: 'Clothing'
|
|
533
|
+
}, {
|
|
534
|
+
id: '8',
|
|
535
|
+
label: 'Books'
|
|
536
|
+
}, {
|
|
537
|
+
id: '9',
|
|
538
|
+
label: 'Food'
|
|
539
|
+
}, {
|
|
540
|
+
id: '10',
|
|
541
|
+
label: 'Furniture'
|
|
542
|
+
}]),
|
|
543
|
+
_React$useState10 = _slicedToArray(_React$useState1, 2),
|
|
544
|
+
options = _React$useState10[0],
|
|
545
|
+
setOptions = _React$useState10[1];
|
|
546
|
+
var _React$useState11 = _react["default"].useState([]),
|
|
547
|
+
_React$useState12 = _slicedToArray(_React$useState11, 2),
|
|
548
|
+
selectedValues = _React$useState12[0],
|
|
549
|
+
setSelectedValues = _React$useState12[1];
|
|
550
|
+
var handleChange = function handleChange(value, itemData) {
|
|
551
|
+
var id = itemData.id;
|
|
552
|
+
if (value) {
|
|
553
|
+
setSelectedValues([].concat(_toConsumableArray(selectedValues), [itemData]));
|
|
554
|
+
} else {
|
|
555
|
+
setSelectedValues(selectedValues.filter(function (val) {
|
|
556
|
+
return val.id !== id;
|
|
557
|
+
}));
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
var handleDelete = function handleDelete(value) {
|
|
561
|
+
setSelectedValues(selectedValues.filter(function (val) {
|
|
562
|
+
return val.id !== value;
|
|
563
|
+
}));
|
|
564
|
+
};
|
|
565
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
566
|
+
style: {
|
|
567
|
+
width: '300px'
|
|
568
|
+
}
|
|
569
|
+
}, /*#__PURE__*/_react["default"].createElement(_Dropdown["default"], _extends({
|
|
570
|
+
multiSelect: true,
|
|
571
|
+
options: options,
|
|
572
|
+
value: selectedValues,
|
|
573
|
+
nameAttribute: "label",
|
|
574
|
+
onChange: handleChange,
|
|
575
|
+
showCreateCTA: true,
|
|
576
|
+
showAllTags: false,
|
|
577
|
+
isDeletable: true,
|
|
578
|
+
onDelete: handleDelete
|
|
579
|
+
}, WithCreateCTA.args)));
|
|
580
|
+
}
|
|
341
581
|
};
|
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports["default"] = exports.Default = void 0;
|
|
6
|
+
exports["default"] = exports.UIDSearchableDropdown = exports.Default = void 0;
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
|
-
var _SearchableDropdown = _interopRequireDefault(require("../SearchableDropdown"));
|
|
9
8
|
var _dataLoader = _interopRequireDefault(require("../../../core/dataLoader"));
|
|
9
|
+
var _UIDItemComponent = _interopRequireDefault(require("../../UIDItemComponent/UIDItemComponent"));
|
|
10
|
+
var _SearchableDropdown = _interopRequireDefault(require("../SearchableDropdown"));
|
|
10
11
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
|
|
11
12
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
12
13
|
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
@@ -177,10 +178,179 @@ var Default = exports.Default = {
|
|
|
177
178
|
}),
|
|
178
179
|
DropdownItem: ValueDropdownItem,
|
|
179
180
|
responseFormatter: valuesResponseFormatter,
|
|
180
|
-
value: selectedValue
|
|
181
|
+
value: selectedValue,
|
|
182
|
+
showClear: true
|
|
181
183
|
// getUrlParams={getFieldValuesUrlParams}
|
|
182
184
|
,
|
|
183
185
|
|
|
186
|
+
onChange: function onChange(value) {
|
|
187
|
+
return setSelectedValue(value);
|
|
188
|
+
}
|
|
189
|
+
})));
|
|
190
|
+
}
|
|
191
|
+
};
|
|
192
|
+
var UIDSearchableDropdown = exports.UIDSearchableDropdown = {
|
|
193
|
+
args: {
|
|
194
|
+
paginationType: 'SERVER',
|
|
195
|
+
requestId: 'getFieldValue',
|
|
196
|
+
perPageKey: '_limit',
|
|
197
|
+
pageNoKey: '_page',
|
|
198
|
+
halign: 'right',
|
|
199
|
+
searchAttribute: 'id',
|
|
200
|
+
noSelectionLabel: 'Select user',
|
|
201
|
+
className: 'searchable-dd',
|
|
202
|
+
name: 'fieldValueDD',
|
|
203
|
+
label: 'Select User',
|
|
204
|
+
showLabel: true,
|
|
205
|
+
nameAttribute: 'id',
|
|
206
|
+
idAttribute: 'id',
|
|
207
|
+
pageSize: 10,
|
|
208
|
+
maxHeight: 400,
|
|
209
|
+
ddItemHeight: 120,
|
|
210
|
+
searchPlaceholder: "Search users "
|
|
211
|
+
},
|
|
212
|
+
argTypes: {
|
|
213
|
+
paginationType: {
|
|
214
|
+
control: 'select',
|
|
215
|
+
options: ['SERVER', 'CLIENT'],
|
|
216
|
+
description: 'Type of pagination'
|
|
217
|
+
},
|
|
218
|
+
requestId: {
|
|
219
|
+
control: 'text',
|
|
220
|
+
description: 'Identifier for the API request configuration'
|
|
221
|
+
},
|
|
222
|
+
perPageKey: {
|
|
223
|
+
control: 'text',
|
|
224
|
+
description: 'Query parameter for items per page'
|
|
225
|
+
},
|
|
226
|
+
pageNoKey: {
|
|
227
|
+
control: 'text',
|
|
228
|
+
description: 'Query parameter for page number'
|
|
229
|
+
},
|
|
230
|
+
halign: {
|
|
231
|
+
control: 'select',
|
|
232
|
+
options: ['left', 'right'],
|
|
233
|
+
description: 'Horizontal alignment of the dropdown'
|
|
234
|
+
},
|
|
235
|
+
searchAttribute: {
|
|
236
|
+
control: 'text',
|
|
237
|
+
description: 'Field to search against'
|
|
238
|
+
},
|
|
239
|
+
requestParams: {
|
|
240
|
+
control: 'object',
|
|
241
|
+
description: 'Additional request parameters'
|
|
242
|
+
},
|
|
243
|
+
noSelectionLabel: {
|
|
244
|
+
control: 'text',
|
|
245
|
+
description: 'Label shown when no value is selected'
|
|
246
|
+
},
|
|
247
|
+
className: {
|
|
248
|
+
control: 'text',
|
|
249
|
+
description: 'Additional CSS classes'
|
|
250
|
+
},
|
|
251
|
+
name: {
|
|
252
|
+
control: 'text',
|
|
253
|
+
description: 'Name attribute for the dropdown'
|
|
254
|
+
},
|
|
255
|
+
label: {
|
|
256
|
+
control: 'text',
|
|
257
|
+
description: 'Label text'
|
|
258
|
+
},
|
|
259
|
+
showLabel: {
|
|
260
|
+
control: 'boolean',
|
|
261
|
+
description: 'Whether to show the label'
|
|
262
|
+
},
|
|
263
|
+
nameAttribute: {
|
|
264
|
+
control: 'text',
|
|
265
|
+
description: 'Field to use as item label'
|
|
266
|
+
},
|
|
267
|
+
pageSize: {
|
|
268
|
+
control: 'number',
|
|
269
|
+
description: 'Number of items per page'
|
|
270
|
+
},
|
|
271
|
+
maxHeight: {
|
|
272
|
+
control: 'number',
|
|
273
|
+
description: 'Maximum height of dropdown list'
|
|
274
|
+
},
|
|
275
|
+
ddItemHeight: {
|
|
276
|
+
control: 'number',
|
|
277
|
+
description: 'Height of each dropdown item'
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
render: function render(args) {
|
|
281
|
+
var _React$useState3 = _react["default"].useState(null),
|
|
282
|
+
_React$useState4 = _slicedToArray(_React$useState3, 2),
|
|
283
|
+
selectedValue = _React$useState4[0],
|
|
284
|
+
setSelectedValue = _React$useState4[1];
|
|
285
|
+
var ddRef = _react["default"].useRef(null);
|
|
286
|
+
|
|
287
|
+
// Mock response formatter
|
|
288
|
+
var valuesResponseFormatter = function valuesResponseFormatter(response) {
|
|
289
|
+
var userTypes = ['new', 'returning', 'power', 'inactive'];
|
|
290
|
+
var platforms = [['Desktop'], ['Mobile'], ['Desktop', 'Mobile'], ['Tablet']];
|
|
291
|
+
var devices = [['Chrome'], ['Safari'], ['Firefox', 'Chrome'], ['Edge']];
|
|
292
|
+
var regions = ['California', 'New York', 'Texas', 'Florida', 'Ontario', 'British Columbia'];
|
|
293
|
+
var countries = ['United States', 'Canada', 'United Kingdom', 'Australia'];
|
|
294
|
+
var cities = ['San Francisco', 'New York', 'Austin', 'Miami', 'Toronto', 'London'];
|
|
295
|
+
return {
|
|
296
|
+
entries: response.map(function (user, index) {
|
|
297
|
+
return {
|
|
298
|
+
id: user.id,
|
|
299
|
+
name: user.name,
|
|
300
|
+
user_id: user.username || "USER-".concat(String(user.id).padStart(5, '0')),
|
|
301
|
+
rank: index + 1,
|
|
302
|
+
user_behavior: {
|
|
303
|
+
user_types: userTypes[index % userTypes.length],
|
|
304
|
+
session_count: Math.floor(Math.random() * 100) + 1,
|
|
305
|
+
total_events: Math.floor(Math.random() * 1000) + 50
|
|
306
|
+
},
|
|
307
|
+
engagement_metrics: {
|
|
308
|
+
clicks: Math.floor(Math.random() * 500) + 10,
|
|
309
|
+
orders: Math.floor(Math.random() * 20),
|
|
310
|
+
revenue: (Math.random() * 2000).toFixed(2)
|
|
311
|
+
},
|
|
312
|
+
device_info: {
|
|
313
|
+
platforms: platforms[index % platforms.length],
|
|
314
|
+
devices: devices[index % devices.length]
|
|
315
|
+
},
|
|
316
|
+
location_info: {
|
|
317
|
+
regions: [regions[index % regions.length]],
|
|
318
|
+
countries: [countries[index % countries.length]],
|
|
319
|
+
cities: [cities[index % cities.length]]
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
}),
|
|
323
|
+
total: response.length ? 10 : 0
|
|
324
|
+
};
|
|
325
|
+
};
|
|
326
|
+
|
|
327
|
+
// Mock loader component
|
|
328
|
+
var PageLoader = function PageLoader(_ref2) {
|
|
329
|
+
var className = _ref2.className;
|
|
330
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
331
|
+
className: className,
|
|
332
|
+
style: {
|
|
333
|
+
padding: '10px',
|
|
334
|
+
textAlign: 'center'
|
|
335
|
+
}
|
|
336
|
+
}, "Loading...");
|
|
337
|
+
};
|
|
338
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
339
|
+
style: {
|
|
340
|
+
width: '600px',
|
|
341
|
+
height: '400px'
|
|
342
|
+
}
|
|
343
|
+
}, /*#__PURE__*/_react["default"].createElement(_SearchableDropdown["default"], _extends({}, args, {
|
|
344
|
+
ref: ddRef,
|
|
345
|
+
LoaderComponent: /*#__PURE__*/_react["default"].createElement(PageLoader, {
|
|
346
|
+
className: "search-loader"
|
|
347
|
+
}),
|
|
348
|
+
DropdownItem: _UIDItemComponent["default"],
|
|
349
|
+
responseFormatter: valuesResponseFormatter,
|
|
350
|
+
value: selectedValue,
|
|
351
|
+
showClear: true,
|
|
352
|
+
ddItemHeight: 120,
|
|
353
|
+
paginationType: "SERVER",
|
|
184
354
|
onChange: function onChange(value) {
|
|
185
355
|
return setSelectedValue(value);
|
|
186
356
|
}
|