@activecollab/components 1.0.304 → 1.0.306

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/index.js CHANGED
@@ -1589,14 +1589,16 @@
1589
1589
  return /*#__PURE__*/React__default["default"].createElement("svg", _extends({
1590
1590
  width: 24,
1591
1591
  height: 24,
1592
+ viewBox: "0 0 24 24",
1592
1593
  xmlns: "http://www.w3.org/2000/svg",
1593
1594
  "data-testid": "ArrowRefreshIcon",
1594
1595
  fill: "var(--color-theme-600)",
1595
1596
  focusable: false,
1596
1597
  ref: svgRef
1597
1598
  }, props), /*#__PURE__*/React__default["default"].createElement("path", {
1598
- d: "M12 3a9 9 0 00-9 9H1l3 3.89L7 12H5a7 7 0 117 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.896 8.896 0 0012 21a9 9 0 000-18z",
1599
- fillRule: "evenodd"
1599
+ fillRule: "evenodd",
1600
+ clipRule: "evenodd",
1601
+ d: "M12 3a9 9 0 00-9 9H1l3 3.89L7 12H5a7 7 0 117 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42A8.896 8.896 0 0012 21a9 9 0 100-18z"
1600
1602
  }));
1601
1603
  });
1602
1604
  ArrowRefreshIcon.displayName = "ArrowRefreshIcon";
@@ -10377,51 +10379,61 @@
10377
10379
  return [selected];
10378
10380
  }, [selected]);
10379
10381
  var handleSort = React.useCallback(function (opts) {
10382
+ var _opts$;
10380
10383
  if (keepSameOptionsOrder) {
10381
10384
  return opts;
10382
10385
  }
10383
- var selectedIdsSet = new Set(selectedOptions);
10384
- if (opts.every(function (opt) {
10385
- return !opt.options;
10386
- })) {
10387
- var sortedOptions = opts.filter(function (opt) {
10388
- return selectedIdsSet.has(opt.id);
10389
- }).concat(opts.filter(function (opt) {
10390
- return !selectedIdsSet.has(opt.id);
10391
- }));
10392
- var selectedOptionsInOrder = sortedOptions.filter(function (opt) {
10393
- return selectedIdsSet.has(opt.id);
10394
- }).sort(function (a, b) {
10395
- return selectedOptions.indexOf(a.id) - selectedOptions.indexOf(b.id);
10396
- });
10397
- return selectedOptionsInOrder.concat(sortedOptions.filter(function (opt) {
10398
- return !selectedIdsSet.has(opt.id);
10399
- }));
10400
- }
10401
- return opts.map(function (group) {
10402
- var groupSelectedOptions = group.options.filter(function (opt) {
10403
- return selectedIdsSet.has(opt.id);
10404
- });
10405
- var groupUnselectedOptions = group.options.filter(function (opt) {
10406
- return !selectedIdsSet.has(opt.id);
10407
- });
10408
- var selectedOptionsInOrder = groupSelectedOptions.sort(function (a, b) {
10409
- return selectedOptions.indexOf(a.id) - selectedOptions.indexOf(b.id);
10386
+ var isGrouped = Array.isArray((_opts$ = opts[0]) === null || _opts$ === void 0 ? void 0 : _opts$.options);
10387
+ if (isGrouped) {
10388
+ return opts.map(function (group) {
10389
+ var sortedGroupOptions = group.options.sort(function (a, b) {
10390
+ if (selectedOptions.includes(b.id) && !selectedOptions.includes(a.id)) {
10391
+ return 1;
10392
+ }
10393
+ if (selectedOptions.includes(a.id) && !selectedOptions.includes(b.id)) {
10394
+ return -1;
10395
+ }
10396
+ return 0;
10397
+ });
10398
+ return _objectSpread2(_objectSpread2({}, group), {}, {
10399
+ options: sortedGroupOptions
10400
+ });
10410
10401
  });
10411
- var finalOptionsInGroup = selectedOptionsInOrder.concat(groupUnselectedOptions);
10412
- return _objectSpread2(_objectSpread2({}, group), {}, {
10413
- options: finalOptionsInGroup
10402
+ } else {
10403
+ return opts.sort(function (a, b) {
10404
+ if (selectedOptions.includes(b.id) && !selectedOptions.includes(a.id)) {
10405
+ return 1;
10406
+ }
10407
+ if (selectedOptions.includes(a.id) && !selectedOptions.includes(b.id)) {
10408
+ return -1;
10409
+ }
10410
+ return 0;
10414
10411
  });
10415
- });
10412
+ }
10416
10413
  // eslint-disable-next-line react-hooks/exhaustive-deps
10417
10414
  }, []);
10418
10415
  var sortList = React.useCallback(function (options) {
10416
+ var _options$;
10419
10417
  if (disabledInternalSort) {
10420
10418
  return handleSort(_toConsumableArray(options));
10421
10419
  }
10422
- return handleSort(_toConsumableArray(options).sort(function (a, b) {
10423
- return sortDirection === "asc" ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name);
10424
- }));
10420
+ var isGrouped = Array.isArray((_options$ = options[0]) === null || _options$ === void 0 ? void 0 : _options$.options);
10421
+ if (isGrouped) {
10422
+ var sortedOptions = options.map(function (group) {
10423
+ var sortedGroupOptions = group.options.sort(function (a, b) {
10424
+ return sortDirection === "asc" ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name);
10425
+ });
10426
+ return _objectSpread2(_objectSpread2({}, group), {}, {
10427
+ options: handleSort(sortedGroupOptions)
10428
+ });
10429
+ });
10430
+ return handleSort(sortedOptions);
10431
+ } else {
10432
+ var _sortedOptions = options.sort(function (a, b) {
10433
+ return sortDirection === "asc" ? a.name.localeCompare(b.name) : b.name.localeCompare(a.name);
10434
+ });
10435
+ return handleSort(_sortedOptions);
10436
+ }
10425
10437
  }, [sortDirection, disabledInternalSort, handleSort]);
10426
10438
  var sortedList = React.useMemo(function () {
10427
10439
  return sortList(options);