@kylincloud/flamegraph 0.35.6

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 (267) hide show
  1. package/CHANGELOG.md +1211 -0
  2. package/LICENSE +202 -0
  3. package/README.md +251 -0
  4. package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts +2 -0
  5. package/dist/FlameGraph/FlameGraphComponent/CheckIcon.d.ts.map +1 -0
  6. package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts +17 -0
  7. package/dist/FlameGraph/FlameGraphComponent/ContextMenu.d.ts.map +1 -0
  8. package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts +14 -0
  9. package/dist/FlameGraph/FlameGraphComponent/ContextMenuHighlight.d.ts.map +1 -0
  10. package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts +9 -0
  11. package/dist/FlameGraph/FlameGraphComponent/DiffLegend.d.ts.map +1 -0
  12. package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts +8 -0
  13. package/dist/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.d.ts.map +1 -0
  14. package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts +96 -0
  15. package/dist/FlameGraph/FlameGraphComponent/Flamegraph.d.ts.map +1 -0
  16. package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts +27 -0
  17. package/dist/FlameGraph/FlameGraphComponent/Flamegraph_render.d.ts.map +1 -0
  18. package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts +7 -0
  19. package/dist/FlameGraph/FlameGraphComponent/GraphVizPane.d.ts.map +1 -0
  20. package/dist/FlameGraph/FlameGraphComponent/Header.d.ts +12 -0
  21. package/dist/FlameGraph/FlameGraphComponent/Header.d.ts.map +1 -0
  22. package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts +18 -0
  23. package/dist/FlameGraph/FlameGraphComponent/Highlight.d.ts.map +1 -0
  24. package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts +2 -0
  25. package/dist/FlameGraph/FlameGraphComponent/LogoLink.d.ts.map +1 -0
  26. package/dist/FlameGraph/FlameGraphComponent/color.d.ts +20 -0
  27. package/dist/FlameGraph/FlameGraphComponent/color.d.ts.map +1 -0
  28. package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts +11 -0
  29. package/dist/FlameGraph/FlameGraphComponent/colorPalette.d.ts.map +1 -0
  30. package/dist/FlameGraph/FlameGraphComponent/constants.d.ts +6 -0
  31. package/dist/FlameGraph/FlameGraphComponent/constants.d.ts.map +1 -0
  32. package/dist/FlameGraph/FlameGraphComponent/index.d.ts +37 -0
  33. package/dist/FlameGraph/FlameGraphComponent/index.d.ts.map +1 -0
  34. package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts +2 -0
  35. package/dist/FlameGraph/FlameGraphComponent/murmur3.d.ts.map +1 -0
  36. package/dist/FlameGraph/FlameGraphComponent/testData.d.ts +53 -0
  37. package/dist/FlameGraph/FlameGraphComponent/testData.d.ts.map +1 -0
  38. package/dist/FlameGraph/FlameGraphComponent/utils.d.ts +6 -0
  39. package/dist/FlameGraph/FlameGraphComponent/utils.d.ts.map +1 -0
  40. package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts +2 -0
  41. package/dist/FlameGraph/FlameGraphComponent/viewTypes.d.ts.map +1 -0
  42. package/dist/FlameGraph/FlameGraphRenderer.d.ts +86 -0
  43. package/dist/FlameGraph/FlameGraphRenderer.d.ts.map +1 -0
  44. package/dist/FlameGraph/decode.d.ts +27 -0
  45. package/dist/FlameGraph/decode.d.ts.map +1 -0
  46. package/dist/FlameGraph/normalize.d.ts +6 -0
  47. package/dist/FlameGraph/normalize.d.ts.map +1 -0
  48. package/dist/FlameGraph/uniqueness.d.ts +3 -0
  49. package/dist/FlameGraph/uniqueness.d.ts.map +1 -0
  50. package/dist/FlamegraphRenderer.d.ts +19 -0
  51. package/dist/FlamegraphRenderer.d.ts.map +1 -0
  52. package/dist/Icons.d.ts +9 -0
  53. package/dist/Icons.d.ts.map +1 -0
  54. package/dist/ProfilerTable.d.ts +21 -0
  55. package/dist/ProfilerTable.d.ts.map +1 -0
  56. package/dist/SharedQueryInput.d.ts +10 -0
  57. package/dist/SharedQueryInput.d.ts.map +1 -0
  58. package/dist/Toolbar.d.ts +31 -0
  59. package/dist/Toolbar.d.ts.map +1 -0
  60. package/dist/Tooltip/FlamegraphTooltip.d.ts +59 -0
  61. package/dist/Tooltip/FlamegraphTooltip.d.ts.map +1 -0
  62. package/dist/Tooltip/LeftClickIcon.d.ts +2 -0
  63. package/dist/Tooltip/LeftClickIcon.d.ts.map +1 -0
  64. package/dist/Tooltip/RightClickIcon.d.ts +2 -0
  65. package/dist/Tooltip/RightClickIcon.d.ts.map +1 -0
  66. package/dist/Tooltip/TableTooltip.d.ts +12 -0
  67. package/dist/Tooltip/TableTooltip.d.ts.map +1 -0
  68. package/dist/Tooltip/Tooltip.d.ts +29 -0
  69. package/dist/Tooltip/Tooltip.d.ts.map +1 -0
  70. package/dist/convert/convertJaegerTraceToProfile.d.ts +3 -0
  71. package/dist/convert/convertJaegerTraceToProfile.d.ts.map +1 -0
  72. package/dist/convert/diffTwoProfiles.d.ts +3 -0
  73. package/dist/convert/diffTwoProfiles.d.ts.map +1 -0
  74. package/dist/convert/flamebearersToTree.d.ts +11 -0
  75. package/dist/convert/flamebearersToTree.d.ts.map +1 -0
  76. package/dist/convert/sandwichViewProfiles.d.ts +14 -0
  77. package/dist/convert/sandwichViewProfiles.d.ts.map +1 -0
  78. package/dist/convert/subtract.d.ts +3 -0
  79. package/dist/convert/subtract.d.ts.map +1 -0
  80. package/dist/convert/testData.d.ts +50 -0
  81. package/dist/convert/testData.d.ts.map +1 -0
  82. package/dist/convert/toGraphviz.d.ts +3 -0
  83. package/dist/convert/toGraphviz.d.ts.map +1 -0
  84. package/dist/fitMode/fitMode.d.ts +42 -0
  85. package/dist/fitMode/fitMode.d.ts.map +1 -0
  86. package/dist/format/format.d.ts +42 -0
  87. package/dist/format/format.d.ts.map +1 -0
  88. package/dist/i18n.d.ts +55 -0
  89. package/dist/i18n.d.ts.map +1 -0
  90. package/dist/index.cjs.css +792 -0
  91. package/dist/index.cjs.js +5087 -0
  92. package/dist/index.d.ts +4 -0
  93. package/dist/index.d.ts.map +1 -0
  94. package/dist/index.esm.css +792 -0
  95. package/dist/index.esm.js +5079 -0
  96. package/dist/index.node.d.ts +9 -0
  97. package/dist/index.node.d.ts.map +1 -0
  98. package/dist/logo-v3-small-T5VXIMRR.svg +32 -0
  99. package/dist/models/decode.d.ts +3 -0
  100. package/dist/models/decode.d.ts.map +1 -0
  101. package/dist/models/flamebearer.d.ts +63 -0
  102. package/dist/models/flamebearer.d.ts.map +1 -0
  103. package/dist/models/groups.d.ts +37 -0
  104. package/dist/models/groups.d.ts.map +1 -0
  105. package/dist/models/index.d.ts +8 -0
  106. package/dist/models/index.d.ts.map +1 -0
  107. package/dist/models/profile.d.ts +152 -0
  108. package/dist/models/profile.d.ts.map +1 -0
  109. package/dist/models/spyName.d.ts +8 -0
  110. package/dist/models/spyName.d.ts.map +1 -0
  111. package/dist/models/trace.d.ts +357 -0
  112. package/dist/models/trace.d.ts.map +1 -0
  113. package/dist/models/units.d.ts +6 -0
  114. package/dist/models/units.d.ts.map +1 -0
  115. package/dist/search.d.ts +2 -0
  116. package/dist/search.d.ts.map +1 -0
  117. package/dist/shims/Box.d.ts +38 -0
  118. package/dist/shims/Box.d.ts.map +1 -0
  119. package/dist/shims/Button.d.ts +26 -0
  120. package/dist/shims/Button.d.ts.map +1 -0
  121. package/dist/shims/Dropdown.d.ts +30 -0
  122. package/dist/shims/Dropdown.d.ts.map +1 -0
  123. package/dist/shims/Input.d.ts +19 -0
  124. package/dist/shims/Input.d.ts.map +1 -0
  125. package/dist/shims/LoadingSpinner.d.ts +7 -0
  126. package/dist/shims/LoadingSpinner.d.ts.map +1 -0
  127. package/dist/shims/Menu.d.ts +4 -0
  128. package/dist/shims/Menu.d.ts.map +1 -0
  129. package/dist/shims/NoData.d.ts +2 -0
  130. package/dist/shims/NoData.d.ts.map +1 -0
  131. package/dist/shims/Table.d.ts +52 -0
  132. package/dist/shims/Table.d.ts.map +1 -0
  133. package/dist/shims/Tooltip.d.ts +9 -0
  134. package/dist/shims/Tooltip.d.ts.map +1 -0
  135. package/package.json +84 -0
  136. package/src/FlameGraph/FlameGraphComponent/CheckIcon.tsx +27 -0
  137. package/src/FlameGraph/FlameGraphComponent/ContextMenu.module.scss +10 -0
  138. package/src/FlameGraph/FlameGraphComponent/ContextMenu.spec.tsx +84 -0
  139. package/src/FlameGraph/FlameGraphComponent/ContextMenu.tsx +86 -0
  140. package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.module.css +8 -0
  141. package/src/FlameGraph/FlameGraphComponent/ContextMenuHighlight.tsx +47 -0
  142. package/src/FlameGraph/FlameGraphComponent/DiffLegend.module.css +21 -0
  143. package/src/FlameGraph/FlameGraphComponent/DiffLegend.tsx +52 -0
  144. package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.module.css +40 -0
  145. package/src/FlameGraph/FlameGraphComponent/DiffLegendPaletteDropdown.tsx +129 -0
  146. package/src/FlameGraph/FlameGraphComponent/Flamegraph.spec.ts +552 -0
  147. package/src/FlameGraph/FlameGraphComponent/Flamegraph.ts +446 -0
  148. package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.spec.tsx +233 -0
  149. package/src/FlameGraph/FlameGraphComponent/Flamegraph_render.ts +478 -0
  150. package/src/FlameGraph/FlameGraphComponent/GraphVizPane.tsx +56 -0
  151. package/src/FlameGraph/FlameGraphComponent/GraphVizPanel.module.scss +55 -0
  152. package/src/FlameGraph/FlameGraphComponent/Header.module.css +27 -0
  153. package/src/FlameGraph/FlameGraphComponent/Header.tsx +71 -0
  154. package/src/FlameGraph/FlameGraphComponent/Highlight.module.css +7 -0
  155. package/src/FlameGraph/FlameGraphComponent/Highlight.spec.tsx +53 -0
  156. package/src/FlameGraph/FlameGraphComponent/Highlight.tsx +94 -0
  157. package/src/FlameGraph/FlameGraphComponent/LogoLink.module.scss +10 -0
  158. package/src/FlameGraph/FlameGraphComponent/LogoLink.tsx +101 -0
  159. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-collapses-small-blocks-into-one-1-snap.png +0 -0
  160. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-diff-mode-1-snap.png +0 -0
  161. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-highlighted-flamegraph-1-snap.png +0 -0
  162. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-normal-flamegraph-1-snap.png +0 -0
  163. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/canvas-renderer-spec-tsx-canvas-renderer-group-snapshot-works-with-selected-node-1-snap.png +0 -0
  164. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-also-zooms-1-snap.png +0 -0
  165. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-in-the-beginning-1-snap.png +0 -0
  166. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-when-node-is-not-in-the-beginning-1-snap.png +0 -0
  167. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-focused-renders-a-focused-node-zoom-top-level-1-snap.png +0 -0
  168. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-complex-flamegraph-1-snap.png +0 -0
  169. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-double-diff-flamegraph-1-snap.png +0 -0
  170. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-double-flamegraph-1-snap.png +0 -0
  171. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-highlighted-flamegraph-1-snap.png +0 -0
  172. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-flamegraph-1-snap.png +0 -0
  173. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-simple-tree-1-snap.png +0 -0
  174. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-flamegraph-1-snap.png +0 -0
  175. package/src/FlameGraph/FlameGraphComponent/__image_snapshots__/flamegraph-render-spec-tsx-render-group-snapshot-renders-a-zoomed-with-fit-mode-tail-1-snap.png +0 -0
  176. package/src/FlameGraph/FlameGraphComponent/canvas.module.css +6 -0
  177. package/src/FlameGraph/FlameGraphComponent/color.spec.ts +308 -0
  178. package/src/FlameGraph/FlameGraphComponent/color.ts +167 -0
  179. package/src/FlameGraph/FlameGraphComponent/colorPalette.ts +58 -0
  180. package/src/FlameGraph/FlameGraphComponent/constants.ts +5 -0
  181. package/src/FlameGraph/FlameGraphComponent/index.spec.tsx +291 -0
  182. package/src/FlameGraph/FlameGraphComponent/index.tsx +411 -0
  183. package/src/FlameGraph/FlameGraphComponent/murmur3.ts +97 -0
  184. package/src/FlameGraph/FlameGraphComponent/styles.module.scss +10 -0
  185. package/src/FlameGraph/FlameGraphComponent/testData.ts +427 -0
  186. package/src/FlameGraph/FlameGraphComponent/utils.ts +31 -0
  187. package/src/FlameGraph/FlameGraphComponent/viewTypes.ts +6 -0
  188. package/src/FlameGraph/FlameGraphRenderer.tsx +603 -0
  189. package/src/FlameGraph/FlamegraphRenderer.module.scss +93 -0
  190. package/src/FlameGraph/decode.ts +78 -0
  191. package/src/FlameGraph/normalize.spec.ts +76 -0
  192. package/src/FlameGraph/normalize.ts +60 -0
  193. package/src/FlameGraph/testData.json +423 -0
  194. package/src/FlameGraph/uniqueness.spec.ts +16 -0
  195. package/src/FlameGraph/uniqueness.ts +84 -0
  196. package/src/FlamegraphRenderer.tsx +61 -0
  197. package/src/Icons.tsx +74 -0
  198. package/src/ProfilerTable.tsx +527 -0
  199. package/src/SharedQueryInput.module.scss +82 -0
  200. package/src/SharedQueryInput.tsx +127 -0
  201. package/src/Toolbar.module.scss +117 -0
  202. package/src/Toolbar.spec.tsx +217 -0
  203. package/src/Toolbar.tsx +471 -0
  204. package/src/Tooltip/FlamegraphTooltip.spec.tsx +81 -0
  205. package/src/Tooltip/FlamegraphTooltip.tsx +257 -0
  206. package/src/Tooltip/LeftClickIcon.tsx +18 -0
  207. package/src/Tooltip/RightClickIcon.tsx +18 -0
  208. package/src/Tooltip/TableTooltip.spec.tsx +44 -0
  209. package/src/Tooltip/TableTooltip.tsx +145 -0
  210. package/src/Tooltip/Tooltip.module.scss +71 -0
  211. package/src/Tooltip/Tooltip.spec.tsx +395 -0
  212. package/src/Tooltip/Tooltip.tsx +336 -0
  213. package/src/__snapshots__/Toolbar.spec.tsx.snap +297 -0
  214. package/src/convert/convertJaegerTraceToProfile.ts +97 -0
  215. package/src/convert/diffTwoProfiles.ts +81 -0
  216. package/src/convert/flamebearersToTree.ts +78 -0
  217. package/src/convert/sandwichViewProfiles.spec.ts +65 -0
  218. package/src/convert/sandwichViewProfiles.ts +191 -0
  219. package/src/convert/subtract.ts +87 -0
  220. package/src/convert/testData.ts +145 -0
  221. package/src/convert/toGraphviz.ts +485 -0
  222. package/src/fitMode/fitMode.spec.ts +93 -0
  223. package/src/fitMode/fitMode.ts +122 -0
  224. package/src/format/format.spec.ts +291 -0
  225. package/src/format/format.ts +303 -0
  226. package/src/globals.d.ts +13 -0
  227. package/src/i18n.tsx +293 -0
  228. package/src/index.node.ts +19 -0
  229. package/src/index.spec.tsx +383 -0
  230. package/src/index.tsx +10 -0
  231. package/src/logo-v3-small.svg +32 -0
  232. package/src/models/decode.ts +45 -0
  233. package/src/models/flamebearer.ts +86 -0
  234. package/src/models/groups.ts +14 -0
  235. package/src/models/index.ts +7 -0
  236. package/src/models/profile.spec.ts +32 -0
  237. package/src/models/profile.ts +48 -0
  238. package/src/models/spyName.spec.ts +18 -0
  239. package/src/models/spyName.ts +32 -0
  240. package/src/models/trace.ts +45 -0
  241. package/src/models/units.spec.ts +21 -0
  242. package/src/models/units.ts +24 -0
  243. package/src/sass/_common.scss +206 -0
  244. package/src/sass/_css-variables.scss +201 -0
  245. package/src/sass/_mixins.scss +15 -0
  246. package/src/sass/_sanitize.scss +407 -0
  247. package/src/sass/_variables.scss +53 -0
  248. package/src/sass/flamegraph.scss +18 -0
  249. package/src/search.spec.ts +11 -0
  250. package/src/search.ts +4 -0
  251. package/src/shameful-any.d.ts +2 -0
  252. package/src/shims/Box.module.scss +57 -0
  253. package/src/shims/Box.tsx +105 -0
  254. package/src/shims/Button.module.scss +129 -0
  255. package/src/shims/Button.tsx +128 -0
  256. package/src/shims/Dropdown.module.scss +63 -0
  257. package/src/shims/Dropdown.tsx +96 -0
  258. package/src/shims/Input.module.scss +15 -0
  259. package/src/shims/Input.tsx +55 -0
  260. package/src/shims/LoadingSpinner.tsx +19 -0
  261. package/src/shims/Menu.tsx +9 -0
  262. package/src/shims/NoData.module.scss +6 -0
  263. package/src/shims/NoData.tsx +11 -0
  264. package/src/shims/Table.module.scss +82 -0
  265. package/src/shims/Table.spec.tsx +121 -0
  266. package/src/shims/Table.tsx +252 -0
  267. package/src/shims/Tooltip.tsx +51 -0
@@ -0,0 +1,129 @@
1
+ $border: 1px solid var(--ps-ui-border);
2
+ $border-radius: 4px;
3
+
4
+ .button {
5
+ white-space: nowrap;
6
+ overflow: hidden;
7
+ text-overflow: ellipsis;
8
+ cursor: pointer;
9
+ border: $border;
10
+ border-radius: $border-radius;
11
+
12
+ &[type='button'],
13
+ &[type='reset'],
14
+ &[type='submit'] {
15
+ -webkit-appearance: button;
16
+ }
17
+ }
18
+
19
+ .noIcon {
20
+ min-width: 48px;
21
+ }
22
+
23
+ .noBox {
24
+ border: none;
25
+ border-radius: none;
26
+ background: inherit !important;
27
+ }
28
+
29
+ .customIcon svg {
30
+ width: 1rem;
31
+ margin-right: 5px;
32
+ vertical-align: -0.125em;
33
+ }
34
+
35
+ .iconWithText {
36
+ // icon is on the left
37
+ // some space between the icon and text
38
+ margin-right: 5px;
39
+ }
40
+
41
+ .default {
42
+ background: var(--ps-ui-element-bg-primary);
43
+
44
+ &:hover:not(:disabled) {
45
+ background-color: var(--ps-ui-element-bg-highlight);
46
+ }
47
+
48
+ &:disabled {
49
+ color: var(--ps-disabled-button-text);
50
+ pointer-events: none;
51
+ }
52
+ }
53
+
54
+ .primary {
55
+ border-color: transparent;
56
+ color: var(--ps-button-switch-text) !important;
57
+ background-color: var(--ps-button-switch-bg);
58
+
59
+ &:hover {
60
+ background-color: var(--ps-button-switch-bg-highlight);
61
+ }
62
+ &:disabled {
63
+ background-color: var(--ps-green-disabled);
64
+ pointer-events: none;
65
+ }
66
+ }
67
+
68
+ .secondary {
69
+ border-color: transparent;
70
+ color: var(--ps-immutable-off-white);
71
+ background-color: var(--ps-blue-primary);
72
+
73
+ &:hover {
74
+ background-color: var(--ps-blue-highlight);
75
+ }
76
+ &:disabled {
77
+ background-color: var(--ps-blue-disabled);
78
+ pointer-events: none;
79
+ }
80
+ }
81
+
82
+ .float {
83
+ @extend .default;
84
+ border-color: transparent;
85
+ background-color: transparent;
86
+ }
87
+
88
+ .danger {
89
+ border-color: transparent;
90
+ color: var(--ps-neutral-2);
91
+ background-color: var(--ps-red-primary);
92
+ &:hover {
93
+ background-color: var(--ps-red-highlight);
94
+ }
95
+ &:disabled {
96
+ background-color: var(--ps-red-disabled);
97
+ pointer-events: none;
98
+ }
99
+ }
100
+
101
+ .outline {
102
+ @extend .default;
103
+ background-color: transparent;
104
+
105
+ &:hover:not(:disabled) {
106
+ background-color: rgba(144, 202, 249, 0.08);
107
+ }
108
+ }
109
+
110
+ // only the first and last elements should have styling
111
+ .grouped {
112
+ margin: 0;
113
+ border-right: 0;
114
+ border-radius: 0;
115
+
116
+ // give it a bit more room to breath
117
+ padding-left: 12px;
118
+ padding-right: 12px;
119
+ }
120
+ .grouped:first-child {
121
+ border-left: $border;
122
+
123
+ border-radius: $border-radius 0 0 $border-radius;
124
+ }
125
+ .grouped:last-child {
126
+ border-right: $border;
127
+
128
+ border-radius: 0 $border-radius $border-radius 0;
129
+ }
@@ -0,0 +1,128 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
3
+ import type { IconDefinition } from '@fortawesome/fontawesome-common-types';
4
+ import cx from 'classnames';
5
+ import styles from './Button.module.scss';
6
+
7
+ export interface ButtonProps {
8
+ kind?: 'default' | 'primary' | 'secondary' | 'danger' | 'outline' | 'float';
9
+ // kind?: 'default' | 'primary' | 'secondary' | 'danger' | 'float' | 'outline';
10
+ /** Whether the button is disabled or not */
11
+ disabled?: boolean;
12
+ icon?: IconDefinition;
13
+ iconNode?: ReactNode;
14
+
15
+ children?: React.ReactNode;
16
+
17
+ /** Buttons are grouped so that only the first and last have clear limits */
18
+ grouped?: boolean;
19
+
20
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
21
+
22
+ // TODO
23
+ // for the full list use refer to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input
24
+ type?: 'button' | 'submit';
25
+ ['data-testid']?: string;
26
+
27
+ ['aria-label']?: string;
28
+
29
+ className?: string;
30
+
31
+ id?: string;
32
+ form?: React.ButtonHTMLAttributes<HTMLButtonElement>['form'];
33
+
34
+ /** disable a box around it */
35
+ noBox?: boolean;
36
+
37
+ /** ONLY use this if within a modal (https://stackoverflow.com/a/71848275 and https://citizensadvice.github.io/react-dialogs/modal/auto_focus/index.html) */
38
+ autoFocus?: React.ButtonHTMLAttributes<HTMLButtonElement>['autoFocus'];
39
+ }
40
+
41
+ const Button = React.forwardRef(function Button(
42
+ {
43
+ disabled = false,
44
+ kind = 'default',
45
+ type = 'button',
46
+ icon,
47
+ iconNode,
48
+ children,
49
+ grouped,
50
+ onClick,
51
+ id,
52
+ className,
53
+ form,
54
+ noBox,
55
+ autoFocus,
56
+ ...props
57
+ }: ButtonProps,
58
+ ref: React.LegacyRef<HTMLButtonElement>
59
+ ) {
60
+ return (
61
+ <button
62
+ // needed for tooltip
63
+ // eslint-disable-next-line react/jsx-props-no-spreading
64
+ {...props}
65
+ id={id}
66
+ ref={ref}
67
+ type={type}
68
+ data-testid={props['data-testid']}
69
+ disabled={disabled}
70
+ onClick={onClick}
71
+ form={form}
72
+ autoFocus={autoFocus} // eslint-disable-line jsx-a11y/no-autofocus
73
+ aria-label={props['aria-label']}
74
+ className={cx(
75
+ styles.button,
76
+ grouped ? styles.grouped : '',
77
+ getKindStyles(kind),
78
+ className,
79
+ noBox && styles.noBox,
80
+ iconNode && styles.customIcon,
81
+ !icon && !iconNode && styles.noIcon
82
+ )}
83
+ >
84
+ {icon ? (
85
+ <FontAwesomeIcon
86
+ icon={icon}
87
+ className={children ? styles.iconWithText : ''}
88
+ />
89
+ ) : null}
90
+ {iconNode}
91
+ {children}
92
+ </button>
93
+ );
94
+ });
95
+
96
+ function getKindStyles(kind: ButtonProps['kind']) {
97
+ switch (kind) {
98
+ case 'default': {
99
+ return styles.default;
100
+ }
101
+
102
+ case 'primary': {
103
+ return styles.primary;
104
+ }
105
+
106
+ case 'secondary': {
107
+ return styles.secondary;
108
+ }
109
+
110
+ case 'danger': {
111
+ return styles.danger;
112
+ }
113
+
114
+ case 'outline': {
115
+ return styles.outline;
116
+ }
117
+
118
+ case 'float': {
119
+ return styles.float;
120
+ }
121
+
122
+ default: {
123
+ throw Error(`Unsupported kind ${kind}`);
124
+ }
125
+ }
126
+ }
127
+
128
+ export default Button;
@@ -0,0 +1,63 @@
1
+ .dropdownMenu {
2
+ padding: 0.25rem 0;
3
+ box-shadow: 0px 2px 6px var(--ps-dropdown-shadow) !important;
4
+ background-color: var(--ps-dropdown-background) !important;
5
+ color: var(--ps-neutral-2) !important;
6
+
7
+ & ul[class*='szh-menu'] {
8
+ color: var(--ps-neutral-2) !important;
9
+ background-color: var(--ps-dropdown-background) !important;
10
+ }
11
+
12
+ li[class='szh-menu__header'] {
13
+ text-align: left;
14
+ }
15
+
16
+ & li[class*='hover'],
17
+ div[class*='hover'] {
18
+ background-color: var(--ps-ui-element-bg-highlight);
19
+ }
20
+
21
+ [class*='szh-menu--open']:empty {
22
+ display: none;
23
+ }
24
+
25
+ [class*='szh-menu__item active'] {
26
+ background-color: var(--ps-ui-element-bg-highlight);
27
+ color: var(--ps-selected-app);
28
+ }
29
+
30
+ [class*='szh-menu__item--focusable'] {
31
+ // important to ignore the hover effect
32
+ background-color: inherit !important;
33
+ padding-top: 1rem;
34
+ padding-bottom: 1rem;
35
+
36
+ input {
37
+ width: 100%;
38
+ }
39
+ }
40
+ }
41
+
42
+ .dropdownMenuButton {
43
+ outline: none;
44
+ display: flex;
45
+ flex-shrink: 0;
46
+ position: relative;
47
+ border-radius: 4px;
48
+ background-color: var(--ps-ui-element-bg-primary);
49
+ border: 1px solid var(--ps-ui-border);
50
+ margin-right: 5px;
51
+ padding-right: 20px;
52
+ &::after {
53
+ content: '▾';
54
+ position: absolute;
55
+ top: 3px;
56
+ right: 5px;
57
+ }
58
+
59
+ &:hover {
60
+ cursor: pointer;
61
+ background-color: var(--ps-ui-element-bg-highlight);
62
+ }
63
+ }
@@ -0,0 +1,96 @@
1
+ import '@szhsin/react-menu/dist/index.css';
2
+ import React from 'react';
3
+ import {
4
+ ClickEvent,
5
+ Menu,
6
+ MenuProps,
7
+ MenuHeader,
8
+ SubMenu as LibSubmenu,
9
+ MenuItem as LibMenuItem,
10
+ MenuButton as LibMenuButton,
11
+ FocusableItem as LibFocusableItem,
12
+ MenuGroup as LibMenuGroup,
13
+ } from '@szhsin/react-menu';
14
+
15
+ import cx from 'classnames';
16
+ import styles from './Dropdown.module.scss';
17
+
18
+ // 删除 offsetX 和 offsetY 相关代码
19
+ export interface DropdownProps {
20
+ id?: string;
21
+ disabled?: boolean;
22
+ ['data-testid']?: string;
23
+ className?: string;
24
+ menuButtonClassName?: string;
25
+ label: string;
26
+ value?: string;
27
+ children?: JSX.Element[] | JSX.Element;
28
+ onItemClick?: (event: ClickEvent) => void;
29
+ overflow?: MenuProps['overflow'];
30
+ position?: MenuProps['position'];
31
+ direction?: MenuProps['direction'];
32
+ align?: MenuProps['align'];
33
+ viewScroll?: MenuProps['viewScroll'];
34
+ arrow?: MenuProps['arrow'];
35
+ ariaLabel?: MenuProps['aria-label'];
36
+ menuButton?: JSX.Element;
37
+ portal?: MenuProps['portal'];
38
+ }
39
+
40
+ export default function Dropdown({
41
+ id,
42
+ children,
43
+ className,
44
+ disabled,
45
+ value,
46
+ label,
47
+ onItemClick,
48
+ overflow,
49
+ position,
50
+ direction,
51
+ align,
52
+ viewScroll,
53
+ arrow,
54
+ menuButtonClassName = '',
55
+ ariaLabel,
56
+ portal,
57
+ ...props
58
+ }: DropdownProps) {
59
+ const menuButtonComponent = props.menuButton || (
60
+ <MenuButton
61
+ aria-label={ariaLabel}
62
+ className={`${styles.dropdownMenuButton} ${menuButtonClassName}`}
63
+ disabled={disabled}
64
+ type="button"
65
+ >
66
+ {value || label}
67
+ </MenuButton>
68
+ );
69
+
70
+ return (
71
+ <Menu
72
+ id={id}
73
+ aria-label={ariaLabel}
74
+ className={cx(className, styles.dropdownMenu)}
75
+ data-testid={props['data-testid']}
76
+ onItemClick={onItemClick}
77
+ overflow={overflow}
78
+ position={position}
79
+ direction={direction}
80
+ align={align}
81
+ viewScroll={viewScroll}
82
+ arrow={arrow}
83
+ menuButton={menuButtonComponent}
84
+ portal={portal}
85
+ >
86
+ <MenuHeader>{label}</MenuHeader>
87
+ {children}
88
+ </Menu>
89
+ );
90
+ }
91
+
92
+ export const SubMenu = LibSubmenu;
93
+ export const MenuItem = LibMenuItem;
94
+ export const MenuButton = LibMenuButton as ShamefulAny;
95
+ export const FocusableItem = LibFocusableItem;
96
+ export const MenuGroup = LibMenuGroup;
@@ -0,0 +1,15 @@
1
+ @use '../sass/_mixins' as *;
2
+
3
+ .input {
4
+ @include outline;
5
+ display: inline-block;
6
+ position: relative;
7
+ border-radius: 4px;
8
+ padding: 0.25em 0.375em;
9
+ border: 1px solid var(--ps-ui-border);
10
+
11
+ &[type='search'] {
12
+ -webkit-appearance: textfield;
13
+ outline-offset: -2px;
14
+ }
15
+ }
@@ -0,0 +1,55 @@
1
+ import React, { Ref, ChangeEvent } from 'react';
2
+ import { DebounceInput } from 'react-debounce-input';
3
+ import styles from './Input.module.scss';
4
+
5
+ interface InputProps {
6
+ testId?: string;
7
+ className?: string;
8
+ type: 'search' | 'text' | 'password' | 'email' | 'number';
9
+ name: string;
10
+ placeholder?: string;
11
+ minLength?: number;
12
+ debounceTimeout?: number;
13
+ onChange: (e: ChangeEvent<HTMLInputElement>) => void;
14
+ value: string | number;
15
+ htmlId?: string;
16
+ }
17
+
18
+ /**
19
+ * @deprecated use TextField instead
20
+ */
21
+ const Input = React.forwardRef(
22
+ (
23
+ {
24
+ testId,
25
+ className,
26
+ type,
27
+ name,
28
+ placeholder,
29
+ minLength = 0,
30
+ debounceTimeout = 100,
31
+ onChange,
32
+ value,
33
+ htmlId,
34
+ }: InputProps,
35
+ ref?: Ref<HTMLInputElement>
36
+ ) => {
37
+ return (
38
+ <DebounceInput
39
+ inputRef={ref}
40
+ data-testid={testId}
41
+ className={`${styles.input} ${className || ''}`}
42
+ type={type}
43
+ name={name}
44
+ placeholder={placeholder}
45
+ minLength={minLength}
46
+ debounceTimeout={debounceTimeout}
47
+ onChange={onChange}
48
+ value={value}
49
+ id={htmlId}
50
+ />
51
+ );
52
+ }
53
+ );
54
+
55
+ export default Input;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+ import Spinner from 'react-svg-spinner';
3
+
4
+ interface LoadingSpinnerProps {
5
+ className?: string;
6
+ size?: string;
7
+ }
8
+
9
+ export default function LoadingSpinner({
10
+ className,
11
+ size = '20px',
12
+ }: LoadingSpinnerProps) {
13
+ // TODO ditch the library and create ourselves
14
+ return (
15
+ <span role="progressbar" className={className}>
16
+ <Spinner color="rgba(255,255,255,0.6)" size={size} />
17
+ </span>
18
+ );
19
+ }
@@ -0,0 +1,9 @@
1
+ import {
2
+ Menu,
3
+ MenuItem,
4
+ ControlledMenu,
5
+ useMenuState,
6
+ } from '@szhsin/react-menu';
7
+ import type { ClickEvent } from '@szhsin/react-menu';
8
+
9
+ export { ControlledMenu, Menu, MenuItem, useMenuState, ClickEvent };
@@ -0,0 +1,6 @@
1
+ .noData {
2
+ width: 100%;
3
+ height: 100%;
4
+ text-align: center;
5
+ padding: 60px 0;
6
+ }
@@ -0,0 +1,11 @@
1
+ import React from 'react';
2
+
3
+ import styles from './NoData.module.scss';
4
+
5
+ export default function NoData() {
6
+ return (
7
+ <div data-testid="no-data" className={styles.noData}>
8
+ <span>No data available</span>
9
+ </div>
10
+ );
11
+ }
@@ -0,0 +1,82 @@
1
+ .table {
2
+ width: 100%;
3
+ table-layout: fixed;
4
+
5
+ thead th {
6
+ &.sortable {
7
+ cursor: pointer;
8
+ user-select: none;
9
+ }
10
+
11
+ .sortArrow {
12
+ display: inline-block;
13
+ border: 5px solid transparent;
14
+ border-top-color: var(--ps-ui-foreground-text);
15
+ top: 3px;
16
+ position: relative;
17
+ margin-left: 7px;
18
+
19
+ &.asc {
20
+ border-top-color: transparent;
21
+ border-bottom-color: var(--ps-button-switch-bg-highlight);
22
+ top: -2px;
23
+ }
24
+
25
+ &.desc {
26
+ border-top-color: var(--ps-button-switch-bg-highlight);
27
+ top: 3px;
28
+ }
29
+ }
30
+ }
31
+
32
+ thead,
33
+ tbody tr:nth-child(2n) {
34
+ background-color: var(--ps-neutral-9);
35
+ }
36
+
37
+ tbody {
38
+ cursor: pointer;
39
+
40
+ td {
41
+ font-weight: initial;
42
+ text-align: center;
43
+ }
44
+
45
+ tr {
46
+ &.isRowSelected {
47
+ cursor: pointer;
48
+ background: var(--ps-table-highlight-row-bg) !important;
49
+ color: var(--ps-table-highlight-row-text);
50
+ }
51
+
52
+ &.isRowDisabled td {
53
+ text-decoration: line-through;
54
+ }
55
+
56
+ &:not(.isRowSelected) {
57
+ &:hover {
58
+ cursor: pointer;
59
+ color: var(--ps-neutral-2);
60
+ background: var(--ps-ui-element-bg-highlight);
61
+ }
62
+ }
63
+ }
64
+
65
+ td,
66
+ th {
67
+ border: 1px solid var(--ps-ui-border);
68
+ padding: 4px 10px;
69
+ width: 10%;
70
+ }
71
+ }
72
+ }
73
+
74
+ .loadingSpinner {
75
+ text-align: center;
76
+ margin-top: 50px;
77
+ }
78
+
79
+ .pagination {
80
+ display: flex;
81
+ justify-content: flex-end;
82
+ }