@spaced-out/ui-design-system 0.1.65 → 0.1.66

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.
@@ -22,7 +22,7 @@ jobs:
22
22
  - name: Check Permissions
23
23
  id: check-permissions
24
24
  env:
25
- ALLOWED_USERS: superrover, Anant-Raj, nsfmc, ashwini-sensehq, aditya-kaushal
25
+ ALLOWED_USERS: superrover, Anant-Raj, nsfmc, ashwini-sensehq, aditya-kaushal, vish-sah
26
26
  if: ${{ !contains(env.ALLOWED_USERS, github.actor) }}
27
27
  run: |
28
28
  echo "You don't have correct permissions to do this release"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.1.66](https://github.com/spaced-out/ui-design-system/compare/v0.1.65...v0.1.66) (2023-11-06)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * enable case-insensitive sorting in table ([#152](https://github.com/spaced-out/ui-design-system/issues/152)) ([6e229a0](https://github.com/spaced-out/ui-design-system/commit/6e229a084b78964fc62e65a0ac09a367166ce03b))
11
+
5
12
  ### [0.1.65](https://github.com/spaced-out/ui-design-system/compare/v0.1.64...v0.1.65) (2023-10-31)
6
13
 
7
14
 
@@ -51,12 +51,14 @@ function useSortableEntries(entries, idName, _ref) {
51
51
  if (sortDirection === 'original') {
52
52
  return entries;
53
53
  }
54
- const sortedDesc = (0, _sortBy.default)(entries, sortKey);
55
- if (sortDirection === 'asc') {
56
- return sortedDesc;
57
- } else {
58
- return sortedDesc.reverse();
59
- }
54
+ const caseInsensitiveSortFunction = entry => {
55
+ if (typeof entry[sortKey] === 'string') {
56
+ return entry[sortKey].toLowerCase();
57
+ }
58
+ return entry[sortKey];
59
+ };
60
+ const sortedDesc = (0, _sortBy.default)(entries, caseInsensitiveSortFunction);
61
+ return sortDirection === 'asc' ? sortedDesc : sortedDesc.reverse();
60
62
  }, [sortDirection, sortKey, entries]);
61
63
  const sortedKeys = React.useMemo(() => sortedEntries.map(ent => (0, _get.default)(ent, idName)), [sortedEntries]);
62
64
  return {
@@ -69,12 +69,14 @@ export function useSortableEntries<T: GenericObject>(
69
69
  if (sortDirection === 'original') {
70
70
  return entries;
71
71
  }
72
- const sortedDesc = sortBy(entries, sortKey);
73
- if (sortDirection === 'asc') {
74
- return sortedDesc;
75
- } else {
76
- return sortedDesc.reverse();
77
- }
72
+ const caseInsensitiveSortFunction = (entry) => {
73
+ if (typeof entry[sortKey] === 'string') {
74
+ return entry[sortKey].toLowerCase();
75
+ }
76
+ return entry[sortKey];
77
+ };
78
+ const sortedDesc = sortBy(entries, caseInsensitiveSortFunction);
79
+ return sortDirection === 'asc' ? sortedDesc : sortedDesc.reverse();
78
80
  }, [sortDirection, sortKey, entries]);
79
81
 
80
82
  const sortedKeys = React.useMemo(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spaced-out/ui-design-system",
3
- "version": "0.1.65",
3
+ "version": "0.1.66",
4
4
  "main": "index.js",
5
5
  "description": "Sense UI components library",
6
6
  "author": {