@bundle-stats/ui 4.4.2 → 4.5.0-beta.0

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 (152) hide show
  1. package/lib/assets/icons.svg +16 -10
  2. package/lib/assets/icons.svg.js +14 -10
  3. package/lib/assets/icons.svg.js.map +1 -1
  4. package/lib/components/bundle-assets/bundle-assets.js +2 -10
  5. package/lib/components/bundle-assets/bundle-assets.js.map +1 -1
  6. package/lib/components/bundle-assets/bundle-assets.utils.js +8 -20
  7. package/lib/components/bundle-assets/bundle-assets.utils.js.map +1 -1
  8. package/lib/components/bundle-assets/index.js +0 -2
  9. package/lib/components/bundle-assets/index.js.map +1 -1
  10. package/lib/components/bundle-modules/bundle-modules.js +2 -10
  11. package/lib/components/bundle-modules/bundle-modules.js.map +1 -1
  12. package/lib/components/bundle-modules/bundle-modules.utils.js +1 -13
  13. package/lib/components/bundle-modules/bundle-modules.utils.js.map +1 -1
  14. package/lib/components/bundle-modules/index.js +2 -4
  15. package/lib/components/bundle-modules/index.js.map +1 -1
  16. package/lib/components/bundle-packages/bundle-packages.js +2 -10
  17. package/lib/components/bundle-packages/bundle-packages.js.map +1 -1
  18. package/lib/components/bundle-packages/bundle-packages.utils.js +1 -13
  19. package/lib/components/bundle-packages/bundle-packages.utils.js.map +1 -1
  20. package/lib/components/bundle-packages/index.js +2 -4
  21. package/lib/components/bundle-packages/index.js.map +1 -1
  22. package/lib/components/metrics-table/metrics-table.js +41 -104
  23. package/lib/components/metrics-table/metrics-table.js.map +1 -1
  24. package/lib/components/metrics-table/metrics-table.module.css +10 -15
  25. package/lib/components/metrics-table-title/metrics-table-title.js +1 -1
  26. package/lib/components/metrics-table-title/metrics-table-title.js.map +1 -1
  27. package/lib/components/metrics-table-title/metrics-table-title.module.css +3 -1
  28. package/lib/{ui/sort-dropdown → components/sort-button}/index.js +1 -1
  29. package/lib/components/sort-button/index.js.map +1 -0
  30. package/lib/components/sort-button/sort-button.js +73 -0
  31. package/lib/components/sort-button/sort-button.js.map +1 -0
  32. package/lib/components/sort-button/sort-button.module.css +89 -0
  33. package/lib/constants.js +5 -1
  34. package/lib/constants.js.map +1 -1
  35. package/lib/hooks/rows-sort.js +13 -5
  36. package/lib/hooks/rows-sort.js.map +1 -1
  37. package/lib/ui/icon/icon.js +2 -0
  38. package/lib/ui/icon/icon.js.map +1 -1
  39. package/lib/ui/index.js +1 -3
  40. package/lib/ui/index.js.map +1 -1
  41. package/lib-esm/assets/icons.svg +16 -10
  42. package/lib-esm/assets/icons.svg.js +14 -10
  43. package/lib-esm/assets/icons.svg.js.map +1 -1
  44. package/lib-esm/components/bundle-assets/bundle-assets.js +2 -10
  45. package/lib-esm/components/bundle-assets/bundle-assets.js.map +1 -1
  46. package/lib-esm/components/bundle-assets/bundle-assets.utils.js +8 -21
  47. package/lib-esm/components/bundle-assets/bundle-assets.utils.js.map +1 -1
  48. package/lib-esm/components/bundle-assets/index.js +0 -2
  49. package/lib-esm/components/bundle-assets/index.js.map +1 -1
  50. package/lib-esm/components/bundle-modules/bundle-modules.js +2 -10
  51. package/lib-esm/components/bundle-modules/bundle-modules.js.map +1 -1
  52. package/lib-esm/components/bundle-modules/bundle-modules.utils.js +1 -14
  53. package/lib-esm/components/bundle-modules/bundle-modules.utils.js.map +1 -1
  54. package/lib-esm/components/bundle-modules/index.js +2 -4
  55. package/lib-esm/components/bundle-modules/index.js.map +1 -1
  56. package/lib-esm/components/bundle-packages/bundle-packages.js +2 -10
  57. package/lib-esm/components/bundle-packages/bundle-packages.js.map +1 -1
  58. package/lib-esm/components/bundle-packages/bundle-packages.utils.js +1 -14
  59. package/lib-esm/components/bundle-packages/bundle-packages.utils.js.map +1 -1
  60. package/lib-esm/components/bundle-packages/index.js +2 -4
  61. package/lib-esm/components/bundle-packages/index.js.map +1 -1
  62. package/lib-esm/components/metrics-table/metrics-table.js +41 -81
  63. package/lib-esm/components/metrics-table/metrics-table.js.map +1 -1
  64. package/lib-esm/components/metrics-table/metrics-table.module.css +10 -15
  65. package/lib-esm/components/metrics-table-title/metrics-table-title.js +1 -1
  66. package/lib-esm/components/metrics-table-title/metrics-table-title.js.map +1 -1
  67. package/lib-esm/components/metrics-table-title/metrics-table-title.module.css +3 -1
  68. package/lib-esm/components/sort-button/index.js +2 -0
  69. package/lib-esm/components/sort-button/index.js.map +1 -0
  70. package/lib-esm/components/sort-button/sort-button.js +43 -0
  71. package/lib-esm/components/sort-button/sort-button.js.map +1 -0
  72. package/lib-esm/components/sort-button/sort-button.module.css +89 -0
  73. package/lib-esm/constants.js +4 -0
  74. package/lib-esm/constants.js.map +1 -1
  75. package/lib-esm/hooks/rows-sort.js +11 -4
  76. package/lib-esm/hooks/rows-sort.js.map +1 -1
  77. package/lib-esm/ui/icon/icon.js +2 -0
  78. package/lib-esm/ui/icon/icon.js.map +1 -1
  79. package/lib-esm/ui/index.js +0 -1
  80. package/lib-esm/ui/index.js.map +1 -1
  81. package/package.json +3 -3
  82. package/src/assets/icons/chevron-down.svg +1 -0
  83. package/src/assets/icons/chevron-up.svg +1 -0
  84. package/src/assets/icons.svg +16 -10
  85. package/src/assets/icons.svg.jsx +24 -10
  86. package/src/components/bundle-assets/bundle-assets.jsx +2 -9
  87. package/src/components/bundle-assets/bundle-assets.utils.js +8 -24
  88. package/src/components/bundle-assets/index.jsx +0 -2
  89. package/src/components/bundle-modules/bundle-modules.jsx +2 -14
  90. package/src/components/bundle-modules/bundle-modules.utils.js +1 -17
  91. package/src/components/bundle-modules/index.jsx +2 -4
  92. package/src/components/bundle-packages/bundle-packages.jsx +2 -9
  93. package/src/components/bundle-packages/bundle-packages.utils.js +1 -17
  94. package/src/components/bundle-packages/index.jsx +2 -4
  95. package/src/components/metrics-table/metrics-table.jsx +134 -131
  96. package/src/components/metrics-table/metrics-table.module.css +10 -15
  97. package/src/components/metrics-table-title/metrics-table-title.jsx +1 -1
  98. package/src/components/metrics-table-title/metrics-table-title.module.css +3 -1
  99. package/src/components/sort-button/index.ts +1 -0
  100. package/src/components/sort-button/sort-button.module.css +89 -0
  101. package/src/components/sort-button/sort-button.tsx +108 -0
  102. package/src/constants.js +5 -0
  103. package/src/hooks/rows-sort.ts +48 -0
  104. package/src/types.d.ts +4 -0
  105. package/src/ui/icon/icon.tsx +2 -0
  106. package/src/ui/index.js +0 -1
  107. package/types/components/bundle-assets/bundle-assets.d.ts +0 -1
  108. package/types/components/bundle-assets/bundle-assets.utils.d.ts +1 -1
  109. package/types/components/bundle-modules/bundle-modules.d.ts +1 -3
  110. package/types/components/bundle-modules/bundle-modules.utils.d.ts +1 -1
  111. package/types/components/bundle-packages/bundle-packages.d.ts +0 -1
  112. package/types/components/bundle-packages/bundle-packages.utils.d.ts +1 -1
  113. package/types/components/metrics-table/metrics-table.d.ts +3 -7
  114. package/types/components/sort-button/index.d.ts +1 -0
  115. package/types/components/sort-button/sort-button.d.ts +11 -0
  116. package/types/constants.d.ts +4 -0
  117. package/types/hooks/rows-sort.d.ts +14 -11
  118. package/types/ui/icon/icon.d.ts +4 -0
  119. package/types/ui/index.d.ts +0 -1
  120. package/lib/components/bundle-assets/bundle-assets.constants.js +0 -21
  121. package/lib/components/bundle-assets/bundle-assets.constants.js.map +0 -1
  122. package/lib/components/bundle-modules/bundle-modules.constants.js +0 -21
  123. package/lib/components/bundle-modules/bundle-modules.constants.js.map +0 -1
  124. package/lib/components/bundle-packages/bundle-packages.constants.js +0 -21
  125. package/lib/components/bundle-packages/bundle-packages.constants.js.map +0 -1
  126. package/lib/ui/sort-dropdown/index.js.map +0 -1
  127. package/lib/ui/sort-dropdown/sort-dropdown.js +0 -101
  128. package/lib/ui/sort-dropdown/sort-dropdown.js.map +0 -1
  129. package/lib/ui/sort-dropdown/sort-dropdown.module.css +0 -22
  130. package/lib-esm/components/bundle-assets/bundle-assets.constants.js +0 -18
  131. package/lib-esm/components/bundle-assets/bundle-assets.constants.js.map +0 -1
  132. package/lib-esm/components/bundle-modules/bundle-modules.constants.js +0 -18
  133. package/lib-esm/components/bundle-modules/bundle-modules.constants.js.map +0 -1
  134. package/lib-esm/components/bundle-packages/bundle-packages.constants.js +0 -18
  135. package/lib-esm/components/bundle-packages/bundle-packages.constants.js.map +0 -1
  136. package/lib-esm/ui/sort-dropdown/index.js +0 -2
  137. package/lib-esm/ui/sort-dropdown/index.js.map +0 -1
  138. package/lib-esm/ui/sort-dropdown/sort-dropdown.js +0 -71
  139. package/lib-esm/ui/sort-dropdown/sort-dropdown.js.map +0 -1
  140. package/lib-esm/ui/sort-dropdown/sort-dropdown.module.css +0 -22
  141. package/src/components/bundle-assets/bundle-assets.constants.js +0 -18
  142. package/src/components/bundle-modules/bundle-modules.constants.js +0 -18
  143. package/src/components/bundle-packages/bundle-packages.constants.js +0 -18
  144. package/src/hooks/rows-sort.js +0 -24
  145. package/src/ui/sort-dropdown/index.js +0 -1
  146. package/src/ui/sort-dropdown/sort-dropdown.jsx +0 -121
  147. package/src/ui/sort-dropdown/sort-dropdown.module.css +0 -22
  148. package/types/components/bundle-assets/bundle-assets.constants.d.ts +0 -21
  149. package/types/components/bundle-modules/bundle-modules.constants.d.ts +0 -21
  150. package/types/components/bundle-packages/bundle-packages.constants.d.ts +0 -21
  151. package/types/ui/sort-dropdown/index.d.ts +0 -1
  152. package/types/ui/sort-dropdown/sort-dropdown.d.ts +0 -24
@@ -18,8 +18,10 @@
18
18
  }
19
19
 
20
20
  .info {
21
+ color: var(--color-text-light);
22
+ font-family: var(--font-family-fixed);
21
23
  font-size: var(--size-xsmall);
22
- font-weight: normal;
24
+ font-weight: bold;
23
25
  }
24
26
 
25
27
  .readMoreLink {
@@ -0,0 +1,2 @@
1
+ export * from './sort-button';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/sort-button/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC"}
@@ -0,0 +1,43 @@
1
+ import React, { useCallback } from 'react';
2
+ import cx from 'classnames';
3
+ import { SORT } from '../../constants';
4
+ import { Icon } from '../../ui/icon';
5
+ import { Tooltip } from '../../ui/tooltip';
6
+ import css from './sort-button.module.css';
7
+ const getToggleAction = (sort, field, label) => {
8
+ if ((sort === null || sort === void 0 ? void 0 : sort.field) !== field) {
9
+ return { direction: SORT.DESC, title: `Order ${label} descending` };
10
+ }
11
+ if ((sort === null || sort === void 0 ? void 0 : sort.direction) === SORT.DESC) {
12
+ return { direction: SORT.ASC, title: `Order ${label} ascending` };
13
+ }
14
+ return { direction: '', title: 'Reset order' };
15
+ };
16
+ const getAscAction = (label) => {
17
+ return { direction: SORT.ASC, title: `Order ${label} ascending` };
18
+ };
19
+ const getDescAction = (label) => {
20
+ return { direction: SORT.DESC, title: `Order ${label} descending` };
21
+ };
22
+ export const SortButton = (props) => {
23
+ const { className = '', children, fieldPath, fieldName, label, sort, updateSort } = props;
24
+ const field = `${fieldPath}.${fieldName}`;
25
+ const toggleAction = getToggleAction(sort, field, label);
26
+ const ascAction = getAscAction(label);
27
+ const descAction = getDescAction(label);
28
+ const isSorted = sort.field === field;
29
+ const getOrderOnClick = useCallback((action) => () => {
30
+ if (action.direction) {
31
+ updateSort({ field, direction: action.direction });
32
+ return;
33
+ }
34
+ updateSort({ field: '', direction: '' });
35
+ }, [field, updateSort, toggleAction]);
36
+ return (React.createElement("div", { className: cx(css.root, className, isSorted && css.active) },
37
+ React.createElement(Tooltip, { title: toggleAction.title, as: "button", type: "button", onClick: getOrderOnClick(toggleAction), className: cx(css.button, css.toggle) }, children),
38
+ React.createElement(Tooltip, { title: ascAction.title, as: "button", type: "button", onClick: getOrderOnClick(ascAction), className: cx(css.button, css.direction, css.directionAsc, isSorted && sort.direction === SORT.ASC && css.directionActive) },
39
+ React.createElement(Icon, { glyph: Icon.ICONS.CHEVRON_UP, size: "small", className: css.directionIcon })),
40
+ React.createElement(Tooltip, { title: descAction.title, as: "button", type: "button", onClick: getOrderOnClick(descAction), className: cx(css.button, css.direction, css.directionDesc, isSorted && sort.direction === SORT.DESC && css.directionActive) },
41
+ React.createElement(Icon, { glyph: Icon.ICONS.CHEVRON_DOWN, size: "small", className: css.directionIcon }))));
42
+ };
43
+ //# sourceMappingURL=sort-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sort-button.js","sourceRoot":"","sources":["../../../src/components/sort-button/sort-button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAC3C,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,GAAG,MAAM,0BAA0B,CAAC;AAO3C,MAAM,eAAe,GAAG,CAAC,IAAgB,EAAE,KAAa,EAAE,KAAa,EAAY,EAAE;IAEnF,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,KAAK,MAAK,KAAK,EAAE;QACzB,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,KAAK,aAAa,EAAE,CAAC;KACrE;IAGD,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,SAAS,MAAK,IAAI,CAAC,IAAI,EAAE;QACjC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,KAAK,YAAY,EAAE,CAAC;KACnE;IAGD,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,KAAa,EAAY,EAAE;IAC/C,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,KAAK,EAAE,SAAS,KAAK,YAAY,EAAE,CAAC;AACpE,CAAC,CAAC;AAEF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all));
5
+ margin-right: calc(0px - 1px - var(--icon-dimension));
6
+ border-radius: var(--radius-small);
7
+ position: relative;
8
+ }
9
+
10
+ .button {
11
+ appearance: none;
12
+ cursor: pointer;
13
+ border: 0;
14
+ padding: 0;
15
+ margin: 0;
16
+ background: transparent;
17
+ transition: var(--transition-out);
18
+ }
19
+
20
+ .toggle {
21
+ padding: var(--space-xxxsmall);
22
+ padding-right: calc(1px + var(--icon-dimension));
23
+ }
24
+
25
+ .direction {
26
+ position: absolute;
27
+ padding: 2px;
28
+ display: block;
29
+ overflow: hidden;
30
+ right: -2px; /* compensate for the button padding */
31
+ color: var(--color-text-ultra-light);
32
+ transition: var(--transition-out);
33
+ }
34
+
35
+ .directionIcon {
36
+ display: block;
37
+ width: var(--icon-dimension);
38
+ height: var(--icon-dimension);
39
+ }
40
+
41
+ .directionActive {
42
+ color: var(--color-text);
43
+ transition: var(--transition-in);
44
+ }
45
+
46
+ .direction:hover,
47
+ .direction:active,
48
+ .direction:focus {
49
+ color: var(--color-text-dark);
50
+ transition: var(--transition-in);
51
+ }
52
+
53
+ .directionAsc {
54
+ padding-bottom: 0;
55
+ bottom: 50%;
56
+ }
57
+
58
+ .directionAsc .directionIcon {
59
+ transform: translateY(3px);
60
+ }
61
+
62
+ .directionDesc {
63
+ padding-top: 0;
64
+ top: 50%;
65
+ }
66
+
67
+ .directionDesc .directionIcon {
68
+ transform: translateY(-5px);
69
+ }
70
+
71
+ .root:hover,
72
+ .root:active,
73
+ .root:focus {
74
+ background: var(--color-outline);
75
+ }
76
+
77
+ .direction {
78
+ pointer-events: none;
79
+ opacity: 0;
80
+ }
81
+
82
+ .active .direction,
83
+ .root:hover .direction,
84
+ .root:active .direction,
85
+ .root:focus .direction {
86
+ pointer-events: auto;
87
+ opacity: 1;
88
+ transition: var(--transition-in);
89
+ }
@@ -28,4 +28,8 @@ export const METRICS_WEBPACK_MODULES = [
28
28
  'webpack.duplicateCode',
29
29
  ];
30
30
  export const METRICS_WEBPACK_PACKAGES = ['webpack.packageCount', 'webpack.duplicatePackagesCount'];
31
+ export const SORT = {
32
+ ASC: 'asc',
33
+ DESC: 'desc',
34
+ };
31
35
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE3D,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,QAAQ,EAAE,GAAG;IACb,MAAM,EAAE,SAAS;IACjB,OAAO,EAAE,UAAU;IACnB,QAAQ,EAAE,WAAW;CACtB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,QAAQ;IAChC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,MAAM;IAC9B,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,OAAO;IAChC,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,QAAQ;CACnC,CAAC;AAEF,MAAM,CAAC,MAAM,0BAA0B,GAAG,UAAU,CAAC,MAAM,CACzD,CAAC,GAAG,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC;IAClB,GAAG,GAAG;IACN,CAAC,gCAAgC,QAAQ,EAAE,CAAC,EAAE,QAAQ;CACvD,CAAC,EACF,EAAE,CACH,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,4BAA4B;IAC5B,4BAA4B;IAC5B,6BAA6B;IAC7B,2BAA2B;CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,CAAC;AACnF,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,qBAAqB;IACrB,+BAA+B;IAC/B,uBAAuB;CACxB,CAAC;AACF,MAAM,CAAC,MAAM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AAM,IAAI,GAAG;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;CACb,CAAC"}
@@ -1,10 +1,17 @@
1
1
  import { useState, useMemo } from 'react';
2
+ import get from 'lodash/get';
2
3
  import orderBy from 'lodash/orderBy';
3
- export const useRowsSort = ({ rows, sortFields, sortBy = 'size', sortDirection = 'desc', getCustomSort, }) => {
4
- const [sort, updateSort] = useState({ field: sortBy, direction: sortDirection });
5
- const orderedRows = useMemo(() => orderBy(rows, getCustomSort(sort.field), sort.direction), [rows, sort]);
4
+ import { SORT } from '../constants';
5
+ export const getSortFn = (fieldPath, getCustomSort) => (item) => {
6
+ if (!fieldPath) {
7
+ return getCustomSort(item);
8
+ }
9
+ return Math.abs(get(item, fieldPath) || 0);
10
+ };
11
+ export const useRowsSort = ({ rows, fieldPath = 'runs[0].delta', direction = 'desc', getCustomSort, }) => {
12
+ const [sort, updateSort] = useState({ field: fieldPath, direction });
13
+ const orderedRows = useMemo(() => orderBy(rows, getSortFn(sort.field, getCustomSort), direction !== '' ? direction : SORT.ASC), [rows, sort]);
6
14
  return {
7
- sortFields,
8
15
  sort,
9
16
  updateSort,
10
17
  items: orderedRows,
@@ -1 +1 @@
1
- {"version":3,"file":"rows-sort.js","sourceRoot":"","sources":["../../src/hooks/rows-sort.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,OAAO,MAAM,gBAAgB,CAAC;AAErC,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,EAC1B,IAAI,EACJ,UAAU,EACV,MAAM,GAAG,MAAM,EACf,aAAa,GAAG,MAAM,EACtB,aAAa,GACd,EAAE,EAAE;IACH,MAAM,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;IAEjF,MAAM,WAAW,GAAG,OAAO,CACzB,GAA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C,SAAS,CAAC,CAAC,CAAE,IAAI,CAAC,GAAW,CACjD,EACH,CAAC,IAAI,EAAE,IAAI,CAAC,CACb,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,UAAU;QACV,KAAK,EAAE,WAAW;KACnB,CAAC;AACJ,CAAC,CAAC"}
@@ -5,6 +5,8 @@ const ICONS = {
5
5
  ARROW: 'arrow',
6
6
  ARROW_RIGHT_CIRLCE: 'arrow-right-circle',
7
7
  CANCEL: 'close',
8
+ CHEVRON_DOWN: 'chevron-down',
9
+ CHEVRON_UP: 'chevron-up',
8
10
  CLOSE: 'close',
9
11
  CLOCK: 'clock',
10
12
  COMMIT: 'commit',
@@ -1 +1 @@
1
- {"version":3,"file":"icon.js","sourceRoot":"","sources":["../../../src/ui/icon/icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,GAAG,MAAM,mBAAmB,CAAC;AAEpC,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,OAAO;IACd,kBAAkB,EAAE,oBAAoB;IACxC,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,OAAO;IACd,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;IACd,aAAa,EAAE,eAAe;IAC9B,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC;AAUX,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAA+C,EAAE,EAAE;IACtE,MAAM,EAAE,SAAS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IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,SAAS;CACV,CAAC;AAEX,MAAM,IAAI,GAAG;IACX,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,KAAK,EAAE,OAAO;CACN,CAAC;AAUX,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,KAA+C,EAAE,EAAE;IACtE,MAAM,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,SAAS,GAAG,MAAM,EAAE,IAAI,GAAG,IAAI,CAAC,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,KAAK,CAAC;IAElG,OAAO,CACL,oBAAC,SAAS,IAAC,SAAS,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,KAAM,SAAS;QACrE,6BAAK,SAAS,EAAE,GAAG,CAAC,IAAI;YACtB,6BAAK,SAAS,EAAE,IAAI,KAAK,EAAE,GAAI,CAC3B,CACI,CACb,CAAC;AACJ,CAAC,CAAC;AAEF,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;AAEnB,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7B,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;AAC/B,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC;AAC7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC"}
@@ -10,7 +10,6 @@ export { Icon } from './icon';
10
10
  export { Input } from './input';
11
11
  export { Loader } from './loader';
12
12
  export { Skeleton } from './skeleton';
13
- export { SortDropdown } from './sort-dropdown';
14
13
  export { Table } from './table';
15
14
  export { Tabs } from './tabs';
16
15
  export { Tag } from './tag';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ui/index.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bundle-stats/ui",
3
- "version": "4.4.2",
3
+ "version": "4.5.0-beta.0",
4
4
  "description": "UI components for BundleStats projects.",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib-esm/index.js",
@@ -76,11 +76,11 @@
76
76
  "react-router-dom": "^5.0.0"
77
77
  },
78
78
  "dependencies": {
79
- "@bundle-stats/utils": "^4.4.2",
79
+ "@bundle-stats/utils": "^4.5.0-beta.0",
80
80
  "ariakit": "2.0.0-next.44",
81
81
  "modern-css-reset": "1.4.0",
82
82
  "query-string": "7.1.3",
83
83
  "use-query-params": "2.2.1"
84
84
  },
85
- "gitHead": "0c227cc1fbf945e5e710f27ad77c70e7c3507bca"
85
+ "gitHead": "f39dbde3efbbb3457bb99536c94ad06830f8ee88"
86
86
  }
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-down"><path d="m6 9 6 6 6-6"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-chevron-up"><path d="m18 15-6-6-6 6"/></svg>
@@ -1,20 +1,26 @@
1
1
  <svg width="0" height="0" style="position:absolute">
2
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-down" id="arrow" xmlns="http://www.w3.org/2000/svg">
2
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="arrow" xmlns="http://www.w3.org/2000/svg">
3
3
  <path d="M12 5v14M19 12l-7 7-7-7"/>
4
4
  </symbol>
5
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-arrow-right-circle" viewBox="0 0 24 24" id="arrow-right-circle" xmlns="http://www.w3.org/2000/svg">
5
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="arrow-right-circle" xmlns="http://www.w3.org/2000/svg">
6
6
  <circle cx="12" cy="12" r="10"/>
7
7
  <path d="M12 16l4-4-4-4M8 12h8"/>
8
8
  </symbol>
9
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-clock" id="clock" xmlns="http://www.w3.org/2000/svg">
9
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="chevron-down" xmlns="http://www.w3.org/2000/svg">
10
+ <path d="M6 9l6 6 6-6"/>
11
+ </symbol>
12
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="chevron-up" xmlns="http://www.w3.org/2000/svg">
13
+ <path d="M18 15l-6-6-6 6"/>
14
+ </symbol>
15
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="clock" xmlns="http://www.w3.org/2000/svg">
10
16
  <circle cx="12" cy="12" r="10"/>
11
17
  <path d="M12 6v6l4 2"/>
12
18
  </symbol>
13
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-x-circle" viewBox="0 0 24 24" id="close" xmlns="http://www.w3.org/2000/svg">
19
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="close" xmlns="http://www.w3.org/2000/svg">
14
20
  <circle cx="12" cy="12" r="10"/>
15
21
  <path d="M15 9l-6 6M9 9l6 6"/>
16
22
  </symbol>
17
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-git-commit" id="commit" xmlns="http://www.w3.org/2000/svg">
23
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="commit" xmlns="http://www.w3.org/2000/svg">
18
24
  <circle cx="12" cy="12" r="4"/>
19
25
  <path d="M1.05 12H7M17.01 12h5.95"/>
20
26
  </symbol>
@@ -22,16 +28,16 @@
22
28
  <circle cx="12" cy="12" r="10"/>
23
29
  <path d="M12 8v4M12 16h.01"/>
24
30
  </symbol>
25
- <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-external-link" viewBox="0 0 24 24" id="external-link" xmlns="http://www.w3.org/2000/svg">
31
+ <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="external-link" xmlns="http://www.w3.org/2000/svg">
26
32
  <path d="M18 13v6a2 2 0 01-2 2H5a2 2 0 01-2-2V8a2 2 0 012-2h6M15 3h6v6M10 14L21 3"/>
27
33
  </symbol>
28
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-bar-chart" id="filter" xmlns="http://www.w3.org/2000/svg">
34
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="filter" xmlns="http://www.w3.org/2000/svg">
29
35
  <path d="M12 20V10M18 20V4M6 20v-4"/>
30
36
  </symbol>
31
37
  <symbol viewBox="0 0 98 96" id="github" xmlns="http://www.w3.org/2000/svg">
32
38
  <path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0112.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="currentColor"/>
33
39
  </symbol>
34
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-help-circle" id="help" xmlns="http://www.w3.org/2000/svg">
40
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="help" xmlns="http://www.w3.org/2000/svg">
35
41
  <circle cx="12" cy="12" r="10"/>
36
42
  <path d="M9.09 9a3 3 0 015.83 1c0 2-3 3-3 3M12 17h.01"/>
37
43
  </symbol>
@@ -39,7 +45,7 @@
39
45
  <circle cx="12" cy="12" r="10"/>
40
46
  <path d="M12 16v-4M12 8h.01"/>
41
47
  </symbol>
42
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu" id="menu" xmlns="http://www.w3.org/2000/svg">
48
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="menu" xmlns="http://www.w3.org/2000/svg">
43
49
  <path d="M3 12h18M3 6h18M3 18h18"/>
44
50
  </symbol>
45
51
  <symbol fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24" id="more-vertical" xmlns="http://www.w3.org/2000/svg">
@@ -51,7 +57,7 @@
51
57
  <path d="M3 18h6v-2H3v2zM3 6v2h18V6H3zm0 7h12v-2H3v2z"/>
52
58
  <path d="M0 0h24v24H0z" fill="none"/>
53
59
  </symbol>
54
- <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-alert-triangle" id="warning" xmlns="http://www.w3.org/2000/svg">
60
+ <symbol viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" id="warning" xmlns="http://www.w3.org/2000/svg">
55
61
  <path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0zM12 9v4M12 17h.01"/>
56
62
  </symbol>
57
63
  </svg>
@@ -9,7 +9,6 @@ export const SvgIcons = (props) => (
9
9
  stroke-width="2"
10
10
  stroke-linecap="round"
11
11
  stroke-linejoin="round"
12
- class="feather feather-arrow-down"
13
12
  id="arrow"
14
13
  xmlns="http://www.w3.org/2000/svg"
15
14
  >
@@ -21,7 +20,6 @@ export const SvgIcons = (props) => (
21
20
  stroke-width="2"
22
21
  stroke-linecap="round"
23
22
  stroke-linejoin="round"
24
- class="feather feather-arrow-right-circle"
25
23
  viewBox="0 0 24 24"
26
24
  id="arrow-right-circle"
27
25
  xmlns="http://www.w3.org/2000/svg"
@@ -29,6 +27,30 @@ export const SvgIcons = (props) => (
29
27
  <circle cx="12" cy="12" r="10" />
30
28
  <path d="M12 16l4-4-4-4M8 12h8" />
31
29
  </symbol>
30
+ <symbol
31
+ fill="none"
32
+ stroke="currentColor"
33
+ stroke-width="2"
34
+ stroke-linecap="round"
35
+ stroke-linejoin="round"
36
+ viewBox="0 0 24 24"
37
+ id="chevron-down"
38
+ xmlns="http://www.w3.org/2000/svg"
39
+ >
40
+ <path d="M6 9l6 6 6-6" />
41
+ </symbol>
42
+ <symbol
43
+ fill="none"
44
+ stroke="currentColor"
45
+ stroke-width="2"
46
+ stroke-linecap="round"
47
+ stroke-linejoin="round"
48
+ viewBox="0 0 24 24"
49
+ id="chevron-up"
50
+ xmlns="http://www.w3.org/2000/svg"
51
+ >
52
+ <path d="M18 15l-6-6-6 6" />
53
+ </symbol>
32
54
  <symbol
33
55
  viewBox="0 0 24 24"
34
56
  fill="none"
@@ -36,7 +58,6 @@ export const SvgIcons = (props) => (
36
58
  stroke-width="2"
37
59
  stroke-linecap="round"
38
60
  stroke-linejoin="round"
39
- class="feather feather-clock"
40
61
  id="clock"
41
62
  xmlns="http://www.w3.org/2000/svg"
42
63
  >
@@ -49,7 +70,6 @@ export const SvgIcons = (props) => (
49
70
  stroke-width="2"
50
71
  stroke-linecap="round"
51
72
  stroke-linejoin="round"
52
- class="feather feather-x-circle"
53
73
  viewBox="0 0 24 24"
54
74
  id="close"
55
75
  xmlns="http://www.w3.org/2000/svg"
@@ -64,7 +84,6 @@ export const SvgIcons = (props) => (
64
84
  stroke-width="2"
65
85
  stroke-linecap="round"
66
86
  stroke-linejoin="round"
67
- class="feather feather-git-commit"
68
87
  id="commit"
69
88
  xmlns="http://www.w3.org/2000/svg"
70
89
  >
@@ -90,7 +109,6 @@ export const SvgIcons = (props) => (
90
109
  stroke-width="2"
91
110
  stroke-linecap="round"
92
111
  stroke-linejoin="round"
93
- class="feather feather-external-link"
94
112
  viewBox="0 0 24 24"
95
113
  id="external-link"
96
114
  xmlns="http://www.w3.org/2000/svg"
@@ -104,7 +122,6 @@ export const SvgIcons = (props) => (
104
122
  stroke-width="2"
105
123
  stroke-linecap="round"
106
124
  stroke-linejoin="round"
107
- class="feather feather-bar-chart"
108
125
  id="filter"
109
126
  xmlns="http://www.w3.org/2000/svg"
110
127
  >
@@ -125,7 +142,6 @@ export const SvgIcons = (props) => (
125
142
  stroke-width="2"
126
143
  stroke-linecap="round"
127
144
  stroke-linejoin="round"
128
- class="feather feather-help-circle"
129
145
  id="help"
130
146
  xmlns="http://www.w3.org/2000/svg"
131
147
  >
@@ -152,7 +168,6 @@ export const SvgIcons = (props) => (
152
168
  stroke-width="2"
153
169
  stroke-linecap="round"
154
170
  stroke-linejoin="round"
155
- class="feather feather-menu"
156
171
  id="menu"
157
172
  xmlns="http://www.w3.org/2000/svg"
158
173
  >
@@ -183,7 +198,6 @@ export const SvgIcons = (props) => (
183
198
  stroke-width="2"
184
199
  stroke-linecap="round"
185
200
  stroke-linejoin="round"
186
- class="feather feather-alert-triangle"
187
201
  id="warning"
188
202
  xmlns="http://www.w3.org/2000/svg"
189
203
  >
@@ -19,7 +19,6 @@ import { FileName } from '../../ui/file-name';
19
19
  import { HoverCard } from '../../ui/hover-card';
20
20
  import { Tag } from '../../ui/tag';
21
21
  import { Filters } from '../../ui/filters';
22
- import { SortDropdown } from '../../ui/sort-dropdown';
23
22
  import { EmptySet } from '../../ui/empty-set';
24
23
  import { Toolbar } from '../../ui/toolbar';
25
24
  import { AssetInfo } from '../asset-info';
@@ -170,7 +169,6 @@ export const BundleAssets = (props) => {
170
169
  filters,
171
170
  entryId,
172
171
  hasActiveFilters,
173
- sortFields,
174
172
  sort,
175
173
  updateSort,
176
174
  search,
@@ -221,7 +219,6 @@ export const BundleAssets = (props) => {
221
219
  className={css.toolbar}
222
220
  renderActions={({ actionClassName }) => (
223
221
  <FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
224
- <SortDropdown fields={sortFields} {...sort} onChange={updateSort} />
225
222
  <MetricsTableOptions
226
223
  handleViewAll={resetAllFilters}
227
224
  handleResetFilters={resetFilters}
@@ -252,6 +249,8 @@ export const BundleAssets = (props) => {
252
249
  emptyMessage={emptyMessage}
253
250
  showHeaderSum
254
251
  title={metricsTableTitle}
252
+ sort={sort}
253
+ updateSort={updateSort}
255
254
  />
256
255
  </main>
257
256
  </section>
@@ -313,12 +312,6 @@ BundleAssets.propTypes = {
313
312
  }).isRequired,
314
313
  entryId: PropTypes.string,
315
314
  hasActiveFilters: PropTypes.bool,
316
- sortFields: PropTypes.shape({
317
- [PropTypes.string]: PropTypes.shape({
318
- label: PropTypes.string,
319
- defaultDirection: PropTypes.bool,
320
- }),
321
- }).isRequired,
322
315
  search: PropTypes.string.isRequired,
323
316
  updateSearch: PropTypes.func.isRequired,
324
317
  sort: PropTypes.shape({
@@ -1,7 +1,5 @@
1
1
  import { ASSET_ENTRY_TYPE, ASSET_FILE_TYPE, ASSET_FILTERS, getFileType } from '@bundle-stats/utils';
2
2
 
3
- import { SORT_BY_NAME, SORT_BY_DELTA, SORT_BY_SIZE } from './bundle-assets.constants';
4
-
5
3
  export const addRowAssetFlags = (row) => {
6
4
  const { runs } = row;
7
5
 
@@ -72,25 +70,11 @@ export const getRowFilter = (filters) => (item) => {
72
70
  return true;
73
71
  };
74
72
 
75
- export const getCustomSort = (sortId) => (item) => {
76
- if (sortId === SORT_BY_NAME) {
77
- return item.key;
78
- }
79
-
80
- if (sortId === SORT_BY_DELTA) {
81
- return item?.runs?.[0]?.delta ? Math.abs(item.runs[0].delta) : 0;
82
- }
83
-
84
- if (sortId === SORT_BY_SIZE) {
85
- return item?.runs?.[0]?.value || 0;
86
- }
87
-
88
- return [
89
- !item.isNotPredictive,
90
- !item.changed,
91
- !item.isInitial,
92
- !item.isEntry,
93
- !item.isChunk,
94
- item.key,
95
- ];
96
- };
73
+ export const getCustomSort = (item) => [
74
+ !item.isNotPredictive,
75
+ !item.changed,
76
+ !item.isInitial,
77
+ !item.isEntry,
78
+ !item.isChunk,
79
+ item.key,
80
+ ];
@@ -12,7 +12,6 @@ import { useRowsSort } from '../../hooks/rows-sort';
12
12
  import { useSearchParams } from '../../hooks/search-params';
13
13
  import { BundleAssets as BundleAssetsComponent } from './bundle-assets';
14
14
  import { addRowAssetFlags, addRowIsNotPredictive, getRowFilter, getCustomSort } from './bundle-assets.utils';
15
- import { SORT_BY } from './bundle-assets.constants';
16
15
 
17
16
  export const BundleAssets = (props) => {
18
17
  const { jobs, filters, search, setState, sortBy, direction, ...restProps } = props;
@@ -55,7 +54,6 @@ export const BundleAssets = (props) => {
55
54
 
56
55
  const sortParams = useRowsSort({
57
56
  rows: filteredRows,
58
- sortFields: SORT_BY,
59
57
  sortBy,
60
58
  sortDirection: direction,
61
59
  getCustomSort,
@@ -21,7 +21,6 @@ import { FlexStack } from '../../layout/flex-stack';
21
21
  import { EmptySet } from '../../ui/empty-set';
22
22
  import { FileName } from '../../ui/file-name';
23
23
  import { Filters } from '../../ui/filters';
24
- import { SortDropdown } from '../../ui/sort-dropdown';
25
24
  import { Tag } from '../../ui/tag';
26
25
  import { Toolbar } from '../../ui/toolbar';
27
26
  import { MetricsTable } from '../metrics-table';
@@ -125,7 +124,6 @@ export const BundleModules = ({
125
124
  resetAllFilters,
126
125
  filters,
127
126
  entryId,
128
- sortFields,
129
127
  sort,
130
128
  updateSort,
131
129
  search,
@@ -179,12 +177,6 @@ export const BundleModules = ({
179
177
  className={css.toolbar}
180
178
  renderActions={({ actionClassName }) => (
181
179
  <FlexStack space="xxsmall" className={cx(css.dropdown, actionClassName)}>
182
- <SortDropdown
183
- className={css.tableDropdown}
184
- fields={sortFields}
185
- onChange={updateSort}
186
- {...sort}
187
- />
188
180
  <MetricsTableOptions
189
181
  handleViewAll={resetAllFilters}
190
182
  handleResetFilters={resetFilters}
@@ -216,6 +208,8 @@ export const BundleModules = ({
216
208
  emptyMessage={emptyMessage}
217
209
  showHeaderSum
218
210
  title={metricsTableTitle}
211
+ sort={sort}
212
+ updateSort={updateSort}
219
213
  />
220
214
  </div>
221
215
  {entryId && (
@@ -277,12 +271,6 @@ BundleModules.propTypes = {
277
271
 
278
272
  hasActiveFilters: PropTypes.bool,
279
273
 
280
- sortFields: PropTypes.shape({
281
- [PropTypes.string]: PropTypes.shape({
282
- label: PropTypes.string,
283
- defaultDirection: PropTypes.bool,
284
- }),
285
- }).isRequired,
286
274
  sort: PropTypes.shape({
287
275
  sortBy: PropTypes.string,
288
276
  direction: PropTypes.string,
@@ -11,8 +11,6 @@ import {
11
11
  getModuleSourceFileType,
12
12
  } from '@bundle-stats/utils';
13
13
 
14
- import { SORT_BY_NAME, SORT_BY_SIZE, SORT_BY_DELTA } from './bundle-modules.constants';
15
-
16
14
  export const addRowFlags = (row) => {
17
15
  const { key, runs } = row;
18
16
 
@@ -28,21 +26,7 @@ export const addRowFlags = (row) => {
28
26
  return row;
29
27
  };
30
28
 
31
- export const getCustomSort = (sortBy) => (item) => {
32
- if (sortBy === SORT_BY_NAME) {
33
- return item.key;
34
- }
35
-
36
- if (sortBy === SORT_BY_SIZE) {
37
- return item?.runs?.[0]?.value || 0;
38
- }
39
-
40
- if (sortBy === SORT_BY_DELTA) {
41
- return item?.runs?.[0]?.delta ? Math.abs(item.runs[0].delta) : 0;
42
- }
43
-
44
- return [!item.changed, item.key];
45
- };
29
+ export const getCustomSort = (item) => [!item.changed, item.key];
46
30
 
47
31
  export const getRowFilter = (filters) => (row) => {
48
32
  // Skip not changed rows