@allurereport/web-awesome 3.0.0-beta.6 → 3.0.0-beta.8

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 (251) hide show
  1. package/.eslintrc.cjs +4 -1
  2. package/dist/multi/141.app-4375537b.js +1 -0
  3. package/dist/multi/222.app-4375537b.js +1 -0
  4. package/dist/multi/335.app-4375537b.js +1 -0
  5. package/dist/multi/34.app-4375537b.js +1 -0
  6. package/dist/multi/349.app-4375537b.js +1 -0
  7. package/dist/multi/378.app-4375537b.js +1 -0
  8. package/dist/multi/406.app-4375537b.js +1 -0
  9. package/dist/multi/476.app-4375537b.js +1 -0
  10. package/dist/multi/53.app-4375537b.js +1 -0
  11. package/dist/multi/584.app-4375537b.js +1 -0
  12. package/dist/multi/690.app-4375537b.js +1 -0
  13. package/dist/multi/747.app-4375537b.js +1 -0
  14. package/dist/multi/767.app-4375537b.js +1 -0
  15. package/dist/multi/83.app-4375537b.js +1 -0
  16. package/dist/multi/873.app-4375537b.js +1 -0
  17. package/dist/multi/920.app-4375537b.js +1 -0
  18. package/dist/multi/991.app-4375537b.js +1 -0
  19. package/dist/multi/app-4375537b.js +2 -0
  20. package/dist/multi/manifest.json +20 -20
  21. package/dist/multi/styles-4375537b.css +283 -0
  22. package/dist/single/app-f16f6693.js +2 -0
  23. package/dist/single/manifest.json +1 -1
  24. package/package.json +6 -4
  25. package/src/assets/scss/fonts.scss +2 -20
  26. package/src/components/{app/ArrowButton → ArrowButton}/index.tsx +3 -4
  27. package/src/components/{app/BaseLayout → BaseLayout}/index.tsx +17 -16
  28. package/src/components/{app/Footer → Footer}/FooterLogo.tsx +2 -2
  29. package/src/components/Footer/FooterVersion.tsx +33 -0
  30. package/src/components/Footer/index.tsx +13 -0
  31. package/src/components/Header/index.tsx +14 -0
  32. package/src/components/{app/LanguagePicker → LanguagePicker}/index.tsx +2 -3
  33. package/src/components/MainReport/index.tsx +19 -0
  34. package/src/components/{app/Metadata → Metadata}/index.tsx +23 -16
  35. package/src/components/{app/Metadata → Metadata}/styles.scss +1 -1
  36. package/src/components/{app/MetadataButton → MetadataButton}/index.tsx +3 -4
  37. package/src/components/{app/Modal → Modal}/index.tsx +9 -19
  38. package/src/components/{app/ReportBody → ReportBody}/Filters.tsx +7 -11
  39. package/src/components/{app/ReportBody → ReportBody}/HeaderActions.tsx +1 -1
  40. package/src/components/{app/ReportBody → ReportBody}/SortBy.tsx +12 -14
  41. package/src/components/{app/ReportBody → ReportBody}/index.tsx +2 -2
  42. package/src/components/{app/ReportHeader → ReportHeader}/ReportHeaderLabelList.tsx +2 -2
  43. package/src/components/{app/ReportHeader → ReportHeader}/ReportHeaderLogo.tsx +2 -2
  44. package/src/components/{app/ReportHeader → ReportHeader}/ReportHeaderPie.tsx +2 -2
  45. package/src/components/{app/ReportHeader → ReportHeader}/index.tsx +5 -5
  46. package/src/components/{app/ReportLogo → ReportLogo}/index.tsx +3 -4
  47. package/src/components/{app/ReportLogoFull → ReportLogoFull}/index.tsx +3 -4
  48. package/src/components/{app/ReportMetadata → ReportMetadata}/MetadataItem.tsx +2 -2
  49. package/src/components/{app/ReportMetadata → ReportMetadata}/MetadataSummary.tsx +8 -10
  50. package/src/components/{app/ReportMetadata → ReportMetadata}/MetadataTestType.tsx +5 -5
  51. package/src/components/ReportMetadata/MetadataWithIcon.tsx +21 -0
  52. package/src/components/{app/ReportMetadata → ReportMetadata}/index.tsx +5 -5
  53. package/src/components/{app/ReportMetadata → ReportMetadata}/styles.scss +1 -1
  54. package/src/components/{app/Tabs → Tabs}/index.tsx +1 -1
  55. package/src/components/{app/TestResult → TestResult}/TestResultAttachmentsView/index.tsx +1 -1
  56. package/src/components/{app/TestResult → TestResult}/TestResultDescription/index.tsx +4 -4
  57. package/src/components/TestResult/TestResultDropdown/index.tsx +23 -0
  58. package/src/components/{app/TestResult → TestResult}/TestResultEmpty/index.tsx +5 -6
  59. package/src/components/TestResult/TestResultError/index.tsx +59 -0
  60. package/src/components/{app/TestResult → TestResult}/TestResultHeader/index.tsx +10 -10
  61. package/src/components/{app/TestResult → TestResult}/TestResultHistory/TestResultHistoryItem.tsx +16 -17
  62. package/src/components/{app/TestResult → TestResult}/TestResultHistory/index.tsx +2 -2
  63. package/src/components/{app/TestResult → TestResult}/TestResultInfo/TestResultInfoStatuses.tsx +8 -9
  64. package/src/components/{app/TestResult → TestResult}/TestResultInfo/index.tsx +8 -10
  65. package/src/components/{app/TestResult → TestResult}/TestResultLinks/index.tsx +12 -16
  66. package/src/components/{app/TestResult → TestResult}/TestResultMetadata/index.tsx +4 -4
  67. package/src/components/{app/TestResult → TestResult}/TestResultNavigation/index.tsx +7 -9
  68. package/src/components/{app/TestResult → TestResult}/TestResultOverview.tsx +13 -13
  69. package/src/components/{app/TestResult → TestResult}/TestResultParameters/index.tsx +4 -4
  70. package/src/components/{app/TestResult → TestResult}/TestResultPrevStatuses/index.tsx +6 -9
  71. package/src/components/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +52 -0
  72. package/src/components/TestResult/TestResultRetriesView/index.tsx +24 -0
  73. package/src/components/{app/TestResult → TestResult}/TestResultSetup/index.tsx +8 -9
  74. package/src/components/TestResult/TestResultSeverity/index.tsx +27 -0
  75. package/src/components/{app/TestResult → TestResult}/TestResultStatus/index.tsx +2 -2
  76. package/src/components/{app/TestResult → TestResult}/TestResultSteps/attachment.tsx +10 -10
  77. package/src/components/{app/TestResult → TestResult}/TestResultSteps/attachmentCode.tsx +7 -2
  78. package/src/components/{app/TestResult → TestResult}/TestResultSteps/attachmentImage.tsx +6 -3
  79. package/src/components/TestResult/TestResultSteps/attachmentVideo.tsx +15 -0
  80. package/src/components/{app/TestResult → TestResult}/TestResultSteps/index.tsx +5 -5
  81. package/src/components/{app/TestResult → TestResult}/TestResultSteps/testResultAttachment.tsx +25 -27
  82. package/src/components/{app/TestResult → TestResult}/TestResultSteps/testResultAttachmentInfo.tsx +8 -12
  83. package/src/components/{app/TestResult → TestResult}/TestResultSteps/testResultStep.tsx +25 -18
  84. package/src/components/TestResult/TestResultSteps/testResultStepInfo.tsx +30 -0
  85. package/src/components/{app/TestResult → TestResult}/TestResultSteps/wrongAttachment.tsx +1 -1
  86. package/src/components/{app/TestResult → TestResult}/TestResultTabs/index.tsx +1 -1
  87. package/src/components/{app/TestResult → TestResult}/TestResultTeardown/index.tsx +6 -6
  88. package/src/components/{app/TestResult → TestResult}/index.tsx +10 -10
  89. package/src/components/{app/ThemeButton → ThemeButton}/ThemeButton.tsx +2 -4
  90. package/src/components/{app/Tree → Tree}/Tree.tsx +3 -10
  91. package/src/components/{app/Tree → Tree}/TreeHeader.tsx +3 -3
  92. package/src/components/{app/Tree → Tree}/TreeItem.tsx +2 -2
  93. package/src/components/Tree/TreeItemIcon.tsx +32 -0
  94. package/src/components/{app/Tree → Tree}/index.tsx +7 -7
  95. package/src/i18n/locales/en.json +1 -0
  96. package/src/index.tsx +2 -2
  97. package/src/stores/index.ts +1 -1
  98. package/src/stores/testResults.ts +7 -3
  99. package/src/stores/tree.ts +1 -1
  100. package/src/utils/isMac.ts +6 -5
  101. package/src/utils/treeFilters.ts +107 -58
  102. package/test/utils/treeFilters.test.ts +25 -1
  103. package/tsconfig.json +5 -3
  104. package/vitest.config.ts +7 -1
  105. package/webpack.config.js +2 -0
  106. package/dist/multi/141.app-07a6d2ea.js +0 -1
  107. package/dist/multi/222.app-07a6d2ea.js +0 -1
  108. package/dist/multi/335.app-07a6d2ea.js +0 -1
  109. package/dist/multi/34.app-07a6d2ea.js +0 -1
  110. package/dist/multi/349.app-07a6d2ea.js +0 -1
  111. package/dist/multi/378.app-07a6d2ea.js +0 -1
  112. package/dist/multi/406.app-07a6d2ea.js +0 -1
  113. package/dist/multi/476.app-07a6d2ea.js +0 -1
  114. package/dist/multi/53.app-07a6d2ea.js +0 -1
  115. package/dist/multi/584.app-07a6d2ea.js +0 -1
  116. package/dist/multi/690.app-07a6d2ea.js +0 -1
  117. package/dist/multi/747.app-07a6d2ea.js +0 -1
  118. package/dist/multi/767.app-07a6d2ea.js +0 -1
  119. package/dist/multi/83.app-07a6d2ea.js +0 -1
  120. package/dist/multi/873.app-07a6d2ea.js +0 -1
  121. package/dist/multi/920.app-07a6d2ea.js +0 -1
  122. package/dist/multi/991.app-07a6d2ea.js +0 -1
  123. package/dist/multi/app-07a6d2ea.js +0 -2
  124. package/dist/multi/styles-07a6d2ea.css +0 -363
  125. package/dist/single/app-c2627b69.js +0 -2
  126. package/src/assets/fonts/JetBrainsMono_vf.woff +0 -0
  127. package/src/assets/fonts/JetBrainsMono_vf.woff2 +0 -0
  128. package/src/assets/fonts/pt-root-ui_vf.woff +0 -0
  129. package/src/assets/fonts/pt-root-ui_vf.woff2 +0 -0
  130. package/src/assets/scss/mixins.scss +0 -26
  131. package/src/assets/svg/arrows-chevron-down.svg +0 -5
  132. package/src/assets/svg/github.svg +0 -5
  133. package/src/assets/svg/line-alerts-notification-box.svg +0 -3
  134. package/src/assets/svg/line-arrows-chevron-down-double.svg +0 -3
  135. package/src/assets/svg/line-arrows-chevron-down.svg +0 -3
  136. package/src/assets/svg/line-arrows-chevron-right.svg +0 -3
  137. package/src/assets/svg/line-arrows-chevron-up-double.svg +0 -3
  138. package/src/assets/svg/line-arrows-chevron-up.svg +0 -3
  139. package/src/assets/svg/line-arrows-corner-down-right.svg +0 -3
  140. package/src/assets/svg/line-arrows-expand-3.svg +0 -3
  141. package/src/assets/svg/line-arrows-refresh-ccw-1.svg +0 -3
  142. package/src/assets/svg/line-arrows-sort-line-asc.svg +0 -3
  143. package/src/assets/svg/line-arrows-sort-line-desc.svg +0 -3
  144. package/src/assets/svg/line-arrows-switch-vertical-1.svg +0 -3
  145. package/src/assets/svg/line-dev-bug-2.svg +0 -3
  146. package/src/assets/svg/line-dev-code-square.svg +0 -3
  147. package/src/assets/svg/line-files-file-attachment-2.svg +0 -3
  148. package/src/assets/svg/line-general-check.svg +0 -3
  149. package/src/assets/svg/line-general-checklist3.svg +0 -3
  150. package/src/assets/svg/line-general-copy-3.svg +0 -3
  151. package/src/assets/svg/line-general-download-cloud.svg +0 -3
  152. package/src/assets/svg/line-general-equal.svg +0 -3
  153. package/src/assets/svg/line-general-home-line.svg +0 -3
  154. package/src/assets/svg/line-general-link-1.svg +0 -3
  155. package/src/assets/svg/line-general-link-external.svg +0 -3
  156. package/src/assets/svg/line-general-search-md.svg +0 -3
  157. package/src/assets/svg/line-general-settings-1.svg +0 -3
  158. package/src/assets/svg/line-general-x-close.svg +0 -3
  159. package/src/assets/svg/line-general-zap.svg +0 -3
  160. package/src/assets/svg/line-helpers-flag.svg +0 -4
  161. package/src/assets/svg/line-helpers-play-circle.svg +0 -4
  162. package/src/assets/svg/line-images-image.svg +0 -3
  163. package/src/assets/svg/line-security-key.svg +0 -3
  164. package/src/assets/svg/line-shapes-dot-circle.svg +0 -3
  165. package/src/assets/svg/line-shapes-moon.svg +0 -3
  166. package/src/assets/svg/line-shapes-sun.svg +0 -3
  167. package/src/assets/svg/line-time-clock-stopwatch.svg +0 -3
  168. package/src/assets/svg/report-logo.svg +0 -64
  169. package/src/assets/svg/solid-alert-circle.svg +0 -3
  170. package/src/assets/svg/solid-check-circle.svg +0 -3
  171. package/src/assets/svg/solid-help-circle.svg +0 -3
  172. package/src/assets/svg/solid-minus-circle.svg +0 -3
  173. package/src/assets/svg/solid-x-circle.svg +0 -3
  174. package/src/assets/svg/spinner.svg +0 -18
  175. package/src/assets/svg/view-off.svg +0 -12
  176. package/src/assets/svg/view.svg +0 -11
  177. package/src/components/app/Footer/FooterVersion.tsx +0 -27
  178. package/src/components/app/Footer/index.tsx +0 -13
  179. package/src/components/app/Header/index.tsx +0 -17
  180. package/src/components/app/MainReport/index.tsx +0 -19
  181. package/src/components/app/ReportMetadata/MetadataWithIcon.tsx +0 -25
  182. package/src/components/app/TestResult/TestResultDropdown/index.tsx +0 -19
  183. package/src/components/app/TestResult/TestResultError/index.tsx +0 -53
  184. package/src/components/app/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +0 -50
  185. package/src/components/app/TestResult/TestResultRetriesView/index.tsx +0 -24
  186. package/src/components/app/TestResult/TestResultSeverity/index.tsx +0 -34
  187. package/src/components/app/TestResult/TestResultSteps/attachmentVideo.tsx +0 -12
  188. package/src/components/app/TestResult/TestResultSteps/testResultStepInfo.tsx +0 -33
  189. package/src/components/app/Tree/TreeItemIcon.tsx +0 -35
  190. package/src/components/commons/Button/index.tsx +0 -176
  191. package/src/components/commons/Button/styles.scss +0 -560
  192. package/src/components/commons/Counter/index.tsx +0 -29
  193. package/src/components/commons/Counter/styles.scss +0 -21
  194. package/src/components/commons/Label/index.tsx +0 -11
  195. package/src/components/commons/Label/styles.scss +0 -7
  196. package/src/components/commons/Link/index.tsx +0 -20
  197. package/src/components/commons/Link/styles.scss +0 -46
  198. package/src/components/commons/Loadable/index.tsx +0 -32
  199. package/src/components/commons/Menu/index.tsx +0 -198
  200. package/src/components/commons/Menu/styles.scss +0 -94
  201. package/src/components/commons/PageLoader/index.tsx +0 -10
  202. package/src/components/commons/PageLoader/styles.scss +0 -29
  203. package/src/components/commons/SearchBox/index.tsx +0 -64
  204. package/src/components/commons/SearchBox/styles.scss +0 -58
  205. package/src/components/commons/Spinner/index.tsx +0 -8
  206. package/src/components/commons/SuccessRatePieChart/index.tsx +0 -52
  207. package/src/components/commons/SuccessRatePieChart/styles.scss +0 -11
  208. package/src/components/commons/SvgIcon/index.tsx +0 -46
  209. package/src/components/commons/SvgIcon/styles.scss +0 -26
  210. package/src/components/commons/Toggle/index.tsx +0 -30
  211. package/src/components/commons/Toggle/styles.scss +0 -48
  212. package/src/components/commons/Tooltip/index.tsx +0 -123
  213. package/src/components/commons/Tooltip/styles.scss +0 -38
  214. package/src/components/commons/Typography/index.tsx +0 -99
  215. package/src/hooks/useDebouncedCallback.ts +0 -31
  216. /package/dist/multi/{816.app-07a6d2ea.js → 816.app-4375537b.js} +0 -0
  217. /package/dist/multi/{app-07a6d2ea.js.LICENSE.txt → app-4375537b.js.LICENSE.txt} +0 -0
  218. /package/dist/single/{app-c2627b69.js.LICENSE.txt → app-f16f6693.js.LICENSE.txt} +0 -0
  219. /package/src/assets/scss/{code.css → code.scss} +0 -0
  220. /package/src/components/{app/ArrowButton → ArrowButton}/styles.scss +0 -0
  221. /package/src/components/{app/BaseLayout → BaseLayout}/styles.scss +0 -0
  222. /package/src/components/{app/Footer → Footer}/styles.scss +0 -0
  223. /package/src/components/{app/Header → Header}/styles.scss +0 -0
  224. /package/src/components/{app/MetadataButton → MetadataButton}/styles.scss +0 -0
  225. /package/src/components/{app/Modal → Modal}/styles.scss +0 -0
  226. /package/src/components/{app/ReportBody → ReportBody}/context.tsx +0 -0
  227. /package/src/components/{app/ReportBody → ReportBody}/styles.scss +0 -0
  228. /package/src/components/{app/ReportHeader → ReportHeader}/styles.scss +0 -0
  229. /package/src/components/{app/ReportLogo → ReportLogo}/styles.scss +0 -0
  230. /package/src/components/{app/ReportLogoFull → ReportLogoFull}/styles.scss +0 -0
  231. /package/src/components/{app/Tabs → Tabs}/styles.scss +0 -0
  232. /package/src/components/{app/TestResult → TestResult}/TestResultAttachmentsView/styles.scss +0 -0
  233. /package/src/components/{app/TestResult → TestResult}/TestResultDescription/styles.scss +0 -0
  234. /package/src/components/{app/TestResult → TestResult}/TestResultDropdown/styles.scss +0 -0
  235. /package/src/components/{app/TestResult → TestResult}/TestResultEmpty/styles.scss +0 -0
  236. /package/src/components/{app/TestResult → TestResult}/TestResultError/styles.scss +0 -0
  237. /package/src/components/{app/TestResult → TestResult}/TestResultHeader/styles.scss +0 -0
  238. /package/src/components/{app/TestResult → TestResult}/TestResultHistory/styles.scss +0 -0
  239. /package/src/components/{app/TestResult → TestResult}/TestResultInfo/styles.scss +0 -0
  240. /package/src/components/{app/TestResult → TestResult}/TestResultLinks/styles.scss +0 -0
  241. /package/src/components/{app/TestResult → TestResult}/TestResultMetadata/styles.scss +0 -0
  242. /package/src/components/{app/TestResult → TestResult}/TestResultNavigation/styles.scss +0 -0
  243. /package/src/components/{app/TestResult → TestResult}/TestResultParameters/styles.scss +0 -0
  244. /package/src/components/{app/TestResult → TestResult}/TestResultPrevStatuses/styles.scss +0 -0
  245. /package/src/components/{app/TestResult → TestResult}/TestResultRetriesView/styles.scss +0 -0
  246. /package/src/components/{app/TestResult → TestResult}/TestResultSeverity/styles.scss +0 -0
  247. /package/src/components/{app/TestResult → TestResult}/TestResultStatus/styles.scss +0 -0
  248. /package/src/components/{app/TestResult → TestResult}/TestResultSteps/HtmlAttachmentPreview.tsx +0 -0
  249. /package/src/components/{app/TestResult → TestResult}/TestResultSteps/styles.scss +0 -0
  250. /package/src/components/{app/TestResult → TestResult}/TestResultTabs/styles.scss +0 -0
  251. /package/src/components/{app/Tree → Tree}/styles.scss +0 -0
@@ -1,32 +0,0 @@
1
- import type { Signal } from "@preact/signals";
2
- import type { JSX } from "preact";
3
- import { type StoreSignalState } from "@/stores";
4
-
5
- export type LoadableProps<T, K = T> = {
6
- source: Signal<StoreSignalState<T>>;
7
- transformData?: (data: T) => K;
8
- renderData: (data: K) => JSX.Element;
9
- renderLoader?: () => JSX.Element;
10
- renderError?: (error: string) => JSX.Element;
11
- };
12
-
13
- export const Loadable = <T, K = T>(props: LoadableProps<T, K>) => {
14
- const {
15
- source,
16
- transformData = (data: T) => data as unknown as K,
17
- renderLoader = () => null,
18
- // TODO: https://github.com/qameta/allure3/issues/179
19
- renderError = (err) => <div>{err}</div>,
20
- renderData,
21
- } = props;
22
-
23
- if (source.value.loading) {
24
- return renderLoader();
25
- }
26
-
27
- if (source.value.error) {
28
- return renderError(source.value.error);
29
- }
30
-
31
- return renderData(transformData(source.value.data));
32
- };
@@ -1,198 +0,0 @@
1
- import { autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom";
2
- import { clsx } from "clsx";
3
- import type { ComponentChildren, VNode } from "preact";
4
- import { createContext } from "preact";
5
- import { useContext, useEffect, useRef, useState } from "preact/hooks";
6
- import check from "@/assets/svg/line-general-check.svg";
7
- import { SvgIcon } from "@/components/commons/SvgIcon";
8
- import { Text } from "@/components/commons/Typography";
9
- import * as styles from "./styles.scss";
10
-
11
- type MenuContextT = {
12
- setIsOpened: (isOpened: boolean) => void;
13
- };
14
-
15
- const MenuContext = createContext<MenuContextT | null>(null);
16
-
17
- export const useMenuContext = () => {
18
- const context = useContext(MenuContext);
19
-
20
- if (!context) {
21
- throw new Error("useMenuContext must be used within a Menu");
22
- }
23
-
24
- return context;
25
- };
26
-
27
- export const Menu = (props: {
28
- children: ComponentChildren;
29
- isInitialOpened?: boolean;
30
- size?: "s" | "m" | "l" | "xl";
31
- placement?: "bottom-start" | "bottom-end";
32
- menuTrigger: (props: { onClick: () => void; isOpened: boolean; setIsOpened: (isOpened: boolean) => void }) => VNode;
33
- menuTriggerWrapper?: "div" | "span";
34
- }) => {
35
- const {
36
- children,
37
- menuTrigger,
38
- menuTriggerWrapper: MenuTriggerWrapper = "div",
39
- size = "m",
40
- isInitialOpened = false,
41
- placement = "bottom-end",
42
- } = props;
43
-
44
- const [isOpened, setIsOpened] = useState(isInitialOpened);
45
- const menuRef = useRef<HTMLDivElement>(null);
46
- const triggerRef = useRef<HTMLDivElement>(null);
47
-
48
- const handleTriggerClick = () => {
49
- setIsOpened(!isOpened);
50
- };
51
-
52
- useEffect(() => {
53
- const handleEscape = (e: KeyboardEvent) => {
54
- if (e.key === "Escape" && isOpened) {
55
- setIsOpened(false);
56
- }
57
- };
58
-
59
- document.addEventListener("keydown", handleEscape);
60
-
61
- return () => {
62
- document.removeEventListener("keydown", handleEscape);
63
- };
64
- }, []);
65
-
66
- useEffect(() => {
67
- const handleClickOutside = (e: MouseEvent) => {
68
- if (!isOpened) {
69
- return;
70
- }
71
-
72
- if (!menuRef.current) {
73
- return;
74
- }
75
-
76
- if (!menuRef.current.contains(e.target as Node)) {
77
- setIsOpened(false);
78
- }
79
- };
80
-
81
- if (isOpened) {
82
- document.addEventListener("click", handleClickOutside);
83
- }
84
-
85
- return () => {
86
- document.removeEventListener("click", handleClickOutside);
87
- };
88
- }, [menuRef.current, isOpened]);
89
-
90
- useEffect(() => {
91
- const updatePosition = () => {
92
- if (!menuRef.current && !triggerRef.current) {
93
- return;
94
- }
95
-
96
- computePosition(triggerRef.current, menuRef.current, {
97
- placement,
98
- middleware: [offset(6), flip(), shift({ padding: 5 })],
99
- }).then(({ x, y }) => {
100
- if (menuRef.current) {
101
- Object.assign(menuRef.current.style, {
102
- "left": `${x}px`,
103
- "top": `${y}px`,
104
- "position": "absolute",
105
- "z-index": 10,
106
- });
107
- }
108
- });
109
- };
110
-
111
- updatePosition();
112
- return autoUpdate(triggerRef.current, menuRef.current, updatePosition);
113
- }, [menuRef.current, triggerRef.current]);
114
-
115
- return (
116
- <MenuContext.Provider
117
- value={{
118
- setIsOpened,
119
- }}
120
- >
121
- <>
122
- {typeof menuTrigger === "function" && (
123
- <MenuTriggerWrapper ref={triggerRef}>
124
- {menuTrigger({
125
- isOpened,
126
- onClick: handleTriggerClick,
127
- setIsOpened,
128
- })}
129
- </MenuTriggerWrapper>
130
- )}
131
- <div ref={menuRef}>
132
- {isOpened && <aside className={clsx(styles.menu, styles[`size-${size}`])}>{children}</aside>}
133
- </div>
134
- </>
135
- </MenuContext.Provider>
136
- );
137
- };
138
-
139
- Menu.Section = (props: { children: ComponentChildren }) => {
140
- return <ul className={styles.section}>{props.children}</ul>;
141
- };
142
-
143
- type ItemProps = {
144
- children: ComponentChildren;
145
- onClick?: () => void;
146
- leadingIcon?: string;
147
- rightSlot?: ComponentChildren;
148
- closeMenuOnClick?: boolean;
149
- ariaLabel?: string;
150
- setIsOpened?: (isOpened: boolean) => void;
151
- };
152
-
153
- Menu.Item = (props: ItemProps) => {
154
- const { setIsOpened } = useMenuContext();
155
- const { children, onClick, leadingIcon, rightSlot, ariaLabel, closeMenuOnClick = true } = props;
156
- const isInteractive = typeof onClick === "function";
157
- const hasLeadingIcon = typeof leadingIcon === "string";
158
-
159
- const handleItemClick = (e: MouseEvent) => {
160
- if (isInteractive && closeMenuOnClick) {
161
- e.stopPropagation();
162
- setIsOpened(false);
163
- }
164
-
165
- if (isInteractive) {
166
- onClick?.();
167
- }
168
- };
169
-
170
- return (
171
- <li className={styles.menuListItem}>
172
- <Text
173
- aria-label={ariaLabel}
174
- type="paragraph"
175
- size="m"
176
- tag={isInteractive ? "button" : "div"}
177
- className={clsx(styles.menuItem, isInteractive && styles.interactive)}
178
- onClick={handleItemClick}
179
- data-interactive-menu-item={isInteractive ? true : undefined}
180
- >
181
- {hasLeadingIcon && <SvgIcon id={leadingIcon} className={styles.leadingIcon} size="m" />}
182
- <div className={styles.content}>{children}</div>
183
- {rightSlot && <div className={styles.right}>{rightSlot}</div>}
184
- </Text>
185
- </li>
186
- );
187
- };
188
-
189
- Menu.ItemWithCheckmark = (
190
- props: ItemProps & {
191
- isChecked: boolean;
192
- },
193
- ) => {
194
- const { isChecked = false, ...itemProps } = props;
195
- return (
196
- <Menu.Item {...itemProps} rightSlot={isChecked && <SvgIcon className={styles.checkmarkIcon} id={check.id} />} />
197
- );
198
- };
@@ -1,94 +0,0 @@
1
- .menu {
2
- background-color: var(--bg-base-modal);
3
- border: 1px solid var(--on-border-primary);
4
- box-shadow: var(--shadow-medium);
5
- border-radius: 6px;
6
- padding-top: 4px;
7
- padding-bottom: 4px;
8
-
9
- &.size-s {
10
- width: 180px;
11
- }
12
-
13
- &.size-m {
14
- width: 200px;
15
- }
16
-
17
- &.size-l {
18
- width: 280px;
19
- }
20
-
21
- &.size-xl {
22
- width: 408px;
23
- }
24
- }
25
-
26
- .menuListItem {
27
- padding: 2px 4px;
28
- }
29
-
30
- .section {
31
- padding: 0;
32
- margin: 0;
33
- list-style: none;
34
- }
35
-
36
- .menuItem {
37
- background-color: var(--bg-control-flat);
38
- padding: 6px 8px;
39
- border-radius: 6px;
40
- display: flex;
41
- flex-direction: row;
42
- gap: 8px;
43
- user-select: none;
44
- appearance: none;
45
- width: 100%;
46
- border: none;
47
-
48
- &.interactive {
49
- transition: background-color var(--color-change-transition-duration);
50
- cursor: pointer;
51
-
52
- &:hover {
53
- background-color: var(--bg-control-flat-medium);
54
- }
55
-
56
- &:focus {
57
- outline: none;
58
- }
59
-
60
- &:focus-visible {
61
- background-color: var(--bg-control-flat-medium);
62
- }
63
-
64
- &:active {
65
- background-color: var(--bg-control-flat-heavy);
66
- }
67
- }
68
-
69
- & .leadingIcon {
70
- color: var(--on-icon-secondary);
71
- flex-shrink: 0;
72
- flex-grow: 0;
73
- }
74
-
75
- & .content {
76
- flex-grow: 1;
77
- font-size: inherit;
78
- line-height: inherit;
79
- font-weight: inherit;
80
- letter-spacing: inherit;
81
- font-family: inherit;
82
- text-align: left;
83
- }
84
-
85
- & .right {
86
- flex-shrink: 0;
87
- flex-grow: 0;
88
- }
89
-
90
- & .checkmarkIcon {
91
- color: var(--on-support-aldebaran);
92
- margin-top: 2px;
93
- }
94
- }
@@ -1,10 +0,0 @@
1
- import { Spinner } from "@/components/commons/Spinner";
2
- import * as styles from "./styles.scss";
3
-
4
- export const PageLoader = () => {
5
- return (
6
- <div className={styles["page-loader"]}>
7
- <Spinner size="m" />
8
- </div>
9
- );
10
- };
@@ -1,29 +0,0 @@
1
- .page-loader {
2
- display: flex;
3
- justify-content: center;
4
- align-items: center;
5
- height: 100vh;
6
- width: 100vw;
7
- background: var(--bg-base-secondary);
8
- }
9
-
10
- .spinner {
11
- width: 24px;
12
- height: 24px;
13
- border-radius: 100%;
14
- animation: spin 0.5s linear infinite;
15
- border-style: solid;
16
- border-width: 2px;
17
- border-color: var(--gray-200);
18
- border-bottom-color: var(--atlas-night-darken-6);
19
- }
20
-
21
- @keyframes spin {
22
- 0% {
23
- transform: rotate(0deg);
24
- }
25
-
26
- 100% {
27
- transform: rotate(360deg);
28
- }
29
- }
@@ -1,64 +0,0 @@
1
- import { clsx } from "clsx";
2
- import {useEffect, useState} from "preact/hooks";
3
- import searchIcon from "@/assets/svg/line-general-search-md.svg";
4
- import closeIcon from "@/assets/svg/line-general-x-close.svg";
5
- import { useDebouncedCallback } from "@/hooks/useDebouncedCallback";
6
- import { IconButton } from "../Button";
7
- import { SvgIcon } from "../SvgIcon";
8
- import { Text } from "../Typography";
9
- import * as styles from "./styles.scss";
10
-
11
- type Props = {
12
- placeholder?: string;
13
- invalid?: string;
14
- error?: string;
15
- value: string;
16
- onChange: (value: string) => void;
17
- changeDebounce?: number;
18
- };
19
-
20
- export const SearchBox = (props: Props) => {
21
- const { placeholder, value, onChange, changeDebounce = 300 } = props;
22
- const [localValue, setLocalValue] = useState(value);
23
- const onChangeDebounced = useDebouncedCallback(onChange, changeDebounce);
24
- const handleChange = (e: Event) => {
25
- const newValue = (e.target as HTMLInputElement).value;
26
-
27
- setLocalValue(newValue);
28
- onChangeDebounced(newValue);
29
- };
30
- const handleClear = (e: PointerEvent) => {
31
- e.preventDefault();
32
- e.stopPropagation();
33
- setLocalValue("");
34
- onChangeDebounced("");
35
- };
36
- const showClear = !!localValue;
37
-
38
- useEffect(() => {
39
- if (localValue !== value) {
40
- setLocalValue(value);
41
- }
42
- }, [value]);
43
-
44
- return (
45
- <Text className={styles.inputWrap} type="ui" size="m" tag="div">
46
- <SvgIcon id={searchIcon.id} size="s" className={styles.leadingIcon} />
47
- <input
48
- className={clsx(styles.input, showClear && styles.inputClear)}
49
- type="text"
50
- placeholder={placeholder}
51
- onInput={handleChange}
52
- value={localValue}
53
- name="search"
54
- autocomplete="off"
55
- data-testid="search-input"
56
- />
57
- {showClear && (
58
- <div className={styles.clearButton}>
59
- <IconButton size="s" icon={closeIcon.id} onClick={handleClear} style="ghost" />
60
- </div>
61
- )}
62
- </Text>
63
- );
64
- };
@@ -1,58 +0,0 @@
1
- .inputWrap {
2
- display: flex;
3
- flex-grow: 1;
4
- position: relative;
5
- }
6
-
7
- .input {
8
- color: var(--on-text-primary);
9
- font-size: inherit;
10
- line-height: inherit;
11
- font-weight: inherit;
12
- letter-spacing: inherit;
13
- font-family: inherit;
14
- flex-grow: 1;
15
- background-color: var(--bg-control-flat);
16
- border: 1px solid var(--on-border-control);
17
- padding: 7px;
18
- padding-left: calc(7px + 16px + 7px);
19
- border-radius: 6px;
20
- transition:
21
- background-color var(--color-change-transition-duration),
22
- border-color var(--color-change-transition-duration);
23
-
24
- &:hover:not(:focus) {
25
- background-color: var(--bg-control-flat-medium);
26
- }
27
-
28
- &:focus {
29
- outline: none;
30
- border-color: var(--on-border-heavy);
31
- }
32
-
33
- &::placeholder {
34
- color: var(--on-text-secondary);
35
- }
36
-
37
- &.inputClear {
38
- padding-right: calc(7px + 16px + 7px);
39
- }
40
- }
41
-
42
- .leadingIcon {
43
- display: block;
44
- top: 8px;
45
- left: 8px;
46
- position: absolute;
47
- user-select: none;
48
- pointer-events: none;
49
- color: var(--on-icon-primary);
50
- z-index: 0;
51
- }
52
-
53
- .clearButton {
54
- top: 4px;
55
- right: 4px;
56
- position: absolute;
57
- z-index: 0;
58
- }
@@ -1,8 +0,0 @@
1
- import spinnerIcon from "@/assets/svg/spinner.svg";
2
- import { SvgIcon } from "../SvgIcon";
3
-
4
- export function Spinner(props: { size?: "s" | "m" }) {
5
- const { size } = props;
6
-
7
- return <SvgIcon role="progressbar" id={spinnerIcon.id} size={size} />;
8
- }
@@ -1,52 +0,0 @@
1
- import type { TestStatus } from "@allurereport/core-api";
2
- import { Heading } from "@/components/commons/Typography";
3
- import * as styles from "./styles.scss";
4
-
5
- type Slice = {
6
- status: TestStatus;
7
- count: number;
8
- d: string;
9
- };
10
-
11
- type Props = {
12
- slices: Slice[];
13
- percentage: number;
14
- };
15
-
16
- function getColorFromStatus(status: TestStatus) {
17
- switch (status) {
18
- case "passed":
19
- return "var(--bg-support-castor)";
20
- case "failed":
21
- return "var(--bg-support-capella)";
22
- case "broken":
23
- return "var(--bg-support-atlas)";
24
- case "unknown":
25
- return "var(--bg-support-skat)";
26
- case "skipped":
27
- return "var(--bg-support-rau)";
28
- default:
29
- return "var(--bg-support-skat)";
30
- }
31
- }
32
-
33
- export const SuccessRatePieChart = (props: Props) => {
34
- const { slices, percentage } = props;
35
-
36
- return (
37
- <article aria-label="Success rate" role="presentation" className={styles.chart}>
38
- <svg aria-hidden viewBox="0 0 100 100">
39
- <g transform={`translate(50, 50)`}>
40
- {slices.map((slice) => (
41
- <path key={slice.status} d={slice.d} fill={getColorFromStatus(slice.status)} />
42
- ))}
43
- </g>
44
- </svg>
45
- {!!percentage && (
46
- <Heading className={styles.legend} size="s" tag="b">
47
- {percentage}%
48
- </Heading>
49
- )}
50
- </article>
51
- );
52
- };
@@ -1,11 +0,0 @@
1
- .legend {
2
- position: absolute;
3
- top: 50%;
4
- left: 50%;
5
- transform: translate(-50%, -50%);
6
- color: var(--on-text-primary);
7
- }
8
-
9
- .chart {
10
- position: relative;
11
- }
@@ -1,46 +0,0 @@
1
- import { clsx } from "clsx";
2
- import type { JSX } from "preact";
3
- import * as styles from "./styles.scss";
4
-
5
- export type SvgIconProps = Omit<JSX.HTMLAttributes<SVGElement>, "className" | "id" | "size" | "inline"> & {
6
- /**
7
- * "xs" is 12x12
8
- * "s" is 16x16
9
- * "m" size is 20x20
10
- *
11
- * @default s
12
- */
13
- size?: "xs" | "s" | "m";
14
- /**
15
- * Additional class name
16
- */
17
- className?: string;
18
- /**
19
- * Icon id
20
- *
21
- * @example
22
- * import lineShapesMoonIcon from "@/assets/svg/line-shapes-moon.svg";
23
- *
24
- * <SvgIcon id={lineShapesMoonIcon.id} />
25
- */
26
- id: string;
27
- /**
28
- * Inline icon
29
- */
30
- inline?: boolean;
31
- };
32
-
33
- /**
34
- * Renders SVG icon
35
- *
36
- * default size is 16x16
37
- */
38
- export const SvgIcon = (props: SvgIconProps) => {
39
- const { id, size = "s", inline = false, className = "" } = props;
40
-
41
- return (
42
- <svg className={clsx(styles.icon, styles[`size-${size}`], inline && styles.inline, className)}>
43
- <use xlinkHref={`#${id}`} />
44
- </svg>
45
- );
46
- };
@@ -1,26 +0,0 @@
1
- .icon {
2
- display: block;
3
- overflow: hidden;
4
-
5
- &.size-xs {
6
- width: 12px;
7
- height: 12px;
8
- }
9
-
10
- &.size-s {
11
- width: 16px;
12
- height: 16px;
13
- }
14
-
15
- &.size-m {
16
- width: 20px;
17
- height: 20px;
18
- }
19
-
20
- &.inline {
21
- display: inline-block;
22
- vertical-align: middle;
23
- position: relative;
24
- top: -1px;
25
- }
26
- }
@@ -1,30 +0,0 @@
1
- import * as styles from "./styles.scss";
2
-
3
- type Props = {
4
- value: boolean;
5
- label: string;
6
- onChange: (value: boolean) => void;
7
- focusable?: boolean;
8
- };
9
-
10
- export const Toggle = (props: Props) => {
11
- const { value, label, onChange, focusable = true, ...rest } = props;
12
-
13
- const handleChange = (e: Event) => {
14
- const newValue = !(e.target as HTMLInputElement).checked;
15
- onChange(newValue);
16
- };
17
-
18
- return (
19
- <input
20
- {...rest}
21
- tabIndex={focusable ? 0 : -1}
22
- className={styles.toggle}
23
- role="switch"
24
- type="checkbox"
25
- checked={value}
26
- aria-label={label}
27
- onToggle={handleChange}
28
- />
29
- );
30
- };