@allurereport/web-awesome 3.0.0-beta.3

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 (263) hide show
  1. package/.babelrc.js +46 -0
  2. package/.eslintrc.cjs +15 -0
  3. package/README.md +27 -0
  4. package/dist/multi/141.app-b6362ca0.js +1 -0
  5. package/dist/multi/222.app-b6362ca0.js +1 -0
  6. package/dist/multi/335.app-b6362ca0.js +1 -0
  7. package/dist/multi/34.app-b6362ca0.js +1 -0
  8. package/dist/multi/349.app-b6362ca0.js +1 -0
  9. package/dist/multi/378.app-b6362ca0.js +1 -0
  10. package/dist/multi/406.app-b6362ca0.js +1 -0
  11. package/dist/multi/476.app-b6362ca0.js +1 -0
  12. package/dist/multi/53.app-b6362ca0.js +1 -0
  13. package/dist/multi/584.app-b6362ca0.js +1 -0
  14. package/dist/multi/690.app-b6362ca0.js +1 -0
  15. package/dist/multi/747.app-b6362ca0.js +1 -0
  16. package/dist/multi/767.app-b6362ca0.js +1 -0
  17. package/dist/multi/816.app-b6362ca0.js +1 -0
  18. package/dist/multi/83.app-b6362ca0.js +1 -0
  19. package/dist/multi/873.app-b6362ca0.js +1 -0
  20. package/dist/multi/920.app-b6362ca0.js +1 -0
  21. package/dist/multi/991.app-b6362ca0.js +1 -0
  22. package/dist/multi/JetBrainsMono_vf-9e9649b6..woff2 +0 -0
  23. package/dist/multi/JetBrainsMono_vf-b9a9c326..woff +0 -0
  24. package/dist/multi/app-b6362ca0.js +2 -0
  25. package/dist/multi/app-b6362ca0.js.LICENSE.txt +16 -0
  26. package/dist/multi/manifest.json +26 -0
  27. package/dist/multi/pt-root-ui_vf-22fe60ca..woff +0 -0
  28. package/dist/multi/pt-root-ui_vf-9d251e8b..woff2 +0 -0
  29. package/dist/multi/styles-b6362ca0.css +363 -0
  30. package/dist/single/app-57ae0a60.js +2 -0
  31. package/dist/single/app-57ae0a60.js.LICENSE.txt +16 -0
  32. package/dist/single/manifest.json +3 -0
  33. package/package.json +93 -0
  34. package/postcss.config.js +5 -0
  35. package/src/assets/fonts/JetBrainsMono_vf.woff +0 -0
  36. package/src/assets/fonts/JetBrainsMono_vf.woff2 +0 -0
  37. package/src/assets/fonts/pt-root-ui_vf.woff +0 -0
  38. package/src/assets/fonts/pt-root-ui_vf.woff2 +0 -0
  39. package/src/assets/scss/_common.scss +134 -0
  40. package/src/assets/scss/code.css +71 -0
  41. package/src/assets/scss/day.scss +51 -0
  42. package/src/assets/scss/fonts.scss +21 -0
  43. package/src/assets/scss/index.scss +9 -0
  44. package/src/assets/scss/mixins.scss +26 -0
  45. package/src/assets/scss/night.scss +61 -0
  46. package/src/assets/scss/palette.scss +393 -0
  47. package/src/assets/scss/theme.scss +117 -0
  48. package/src/assets/scss/typography.scss +218 -0
  49. package/src/assets/scss/vars.scss +8 -0
  50. package/src/assets/svg/arrows-chevron-down.svg +5 -0
  51. package/src/assets/svg/github.svg +5 -0
  52. package/src/assets/svg/line-alerts-notification-box.svg +3 -0
  53. package/src/assets/svg/line-arrows-chevron-down-double.svg +3 -0
  54. package/src/assets/svg/line-arrows-chevron-down.svg +3 -0
  55. package/src/assets/svg/line-arrows-chevron-right.svg +3 -0
  56. package/src/assets/svg/line-arrows-chevron-up-double.svg +3 -0
  57. package/src/assets/svg/line-arrows-chevron-up.svg +3 -0
  58. package/src/assets/svg/line-arrows-corner-down-right.svg +3 -0
  59. package/src/assets/svg/line-arrows-expand-3.svg +3 -0
  60. package/src/assets/svg/line-arrows-refresh-ccw-1.svg +3 -0
  61. package/src/assets/svg/line-arrows-sort-line-asc.svg +3 -0
  62. package/src/assets/svg/line-arrows-sort-line-desc.svg +3 -0
  63. package/src/assets/svg/line-arrows-switch-vertical-1.svg +3 -0
  64. package/src/assets/svg/line-dev-bug-2.svg +3 -0
  65. package/src/assets/svg/line-dev-code-square.svg +3 -0
  66. package/src/assets/svg/line-files-file-attachment-2.svg +3 -0
  67. package/src/assets/svg/line-general-check.svg +3 -0
  68. package/src/assets/svg/line-general-checklist3.svg +3 -0
  69. package/src/assets/svg/line-general-copy-3.svg +3 -0
  70. package/src/assets/svg/line-general-download-cloud.svg +3 -0
  71. package/src/assets/svg/line-general-equal.svg +3 -0
  72. package/src/assets/svg/line-general-home-line.svg +3 -0
  73. package/src/assets/svg/line-general-link-1.svg +3 -0
  74. package/src/assets/svg/line-general-link-external.svg +3 -0
  75. package/src/assets/svg/line-general-search-md.svg +3 -0
  76. package/src/assets/svg/line-general-settings-1.svg +3 -0
  77. package/src/assets/svg/line-general-x-close.svg +3 -0
  78. package/src/assets/svg/line-general-zap.svg +3 -0
  79. package/src/assets/svg/line-helpers-flag.svg +4 -0
  80. package/src/assets/svg/line-helpers-play-circle.svg +4 -0
  81. package/src/assets/svg/line-images-image.svg +3 -0
  82. package/src/assets/svg/line-security-key.svg +3 -0
  83. package/src/assets/svg/line-shapes-dot-circle.svg +3 -0
  84. package/src/assets/svg/line-shapes-moon.svg +3 -0
  85. package/src/assets/svg/line-shapes-sun.svg +3 -0
  86. package/src/assets/svg/line-time-clock-stopwatch.svg +3 -0
  87. package/src/assets/svg/report-logo.svg +64 -0
  88. package/src/assets/svg/solid-alert-circle.svg +3 -0
  89. package/src/assets/svg/solid-check-circle.svg +3 -0
  90. package/src/assets/svg/solid-help-circle.svg +3 -0
  91. package/src/assets/svg/solid-minus-circle.svg +3 -0
  92. package/src/assets/svg/solid-x-circle.svg +3 -0
  93. package/src/assets/svg/spinner.svg +18 -0
  94. package/src/assets/svg/view-off.svg +12 -0
  95. package/src/assets/svg/view.svg +11 -0
  96. package/src/components/app/ArrowButton/index.tsx +36 -0
  97. package/src/components/app/ArrowButton/styles.scss +32 -0
  98. package/src/components/app/BaseLayout/index.tsx +60 -0
  99. package/src/components/app/BaseLayout/styles.scss +60 -0
  100. package/src/components/app/Footer/FooterLogo.tsx +16 -0
  101. package/src/components/app/Footer/FooterVersion.tsx +27 -0
  102. package/src/components/app/Footer/index.tsx +13 -0
  103. package/src/components/app/Footer/styles.scss +14 -0
  104. package/src/components/app/Header/index.tsx +17 -0
  105. package/src/components/app/Header/styles.scss +26 -0
  106. package/src/components/app/LanguagePicker/index.tsx +41 -0
  107. package/src/components/app/MainReport/index.tsx +19 -0
  108. package/src/components/app/Metadata/index.tsx +114 -0
  109. package/src/components/app/Metadata/styles.scss +146 -0
  110. package/src/components/app/MetadataButton/index.tsx +33 -0
  111. package/src/components/app/MetadataButton/styles.scss +53 -0
  112. package/src/components/app/Modal/index.tsx +184 -0
  113. package/src/components/app/Modal/styles.scss +126 -0
  114. package/src/components/app/ReportBody/Filters.tsx +94 -0
  115. package/src/components/app/ReportBody/HeaderActions.tsx +21 -0
  116. package/src/components/app/ReportBody/SortBy.tsx +134 -0
  117. package/src/components/app/ReportBody/context.tsx +107 -0
  118. package/src/components/app/ReportBody/index.tsx +71 -0
  119. package/src/components/app/ReportBody/styles.scss +64 -0
  120. package/src/components/app/ReportHeader/ReportHeaderLabelList.tsx +12 -0
  121. package/src/components/app/ReportHeader/ReportHeaderLogo.tsx +10 -0
  122. package/src/components/app/ReportHeader/ReportHeaderPie.tsx +14 -0
  123. package/src/components/app/ReportHeader/index.tsx +33 -0
  124. package/src/components/app/ReportHeader/styles.scss +49 -0
  125. package/src/components/app/ReportLogo/index.tsx +17 -0
  126. package/src/components/app/ReportLogo/styles.scss +20 -0
  127. package/src/components/app/ReportLogoFull/index.tsx +21 -0
  128. package/src/components/app/ReportLogoFull/styles.scss +7 -0
  129. package/src/components/app/ReportMetadata/MetadataItem.tsx +45 -0
  130. package/src/components/app/ReportMetadata/MetadataSummary.tsx +79 -0
  131. package/src/components/app/ReportMetadata/MetadataTestType.tsx +16 -0
  132. package/src/components/app/ReportMetadata/MetadataWithIcon.tsx +25 -0
  133. package/src/components/app/ReportMetadata/index.tsx +46 -0
  134. package/src/components/app/ReportMetadata/styles.scss +99 -0
  135. package/src/components/app/Tabs/index.tsx +58 -0
  136. package/src/components/app/Tabs/styles.scss +56 -0
  137. package/src/components/app/TestResult/TestResultAttachmentsView/index.tsx +27 -0
  138. package/src/components/app/TestResult/TestResultAttachmentsView/styles.scss +12 -0
  139. package/src/components/app/TestResult/TestResultDescription/index.tsx +27 -0
  140. package/src/components/app/TestResult/TestResultDescription/styles.scss +12 -0
  141. package/src/components/app/TestResult/TestResultDropdown/index.tsx +19 -0
  142. package/src/components/app/TestResult/TestResultDropdown/styles.scss +34 -0
  143. package/src/components/app/TestResult/TestResultEmpty/index.tsx +34 -0
  144. package/src/components/app/TestResult/TestResultEmpty/styles.scss +25 -0
  145. package/src/components/app/TestResult/TestResultError/index.tsx +51 -0
  146. package/src/components/app/TestResult/TestResultError/styles.scss +40 -0
  147. package/src/components/app/TestResult/TestResultHeader/index.tsx +55 -0
  148. package/src/components/app/TestResult/TestResultHeader/styles.scss +43 -0
  149. package/src/components/app/TestResult/TestResultHistory/TestResultHistoryItem.tsx +57 -0
  150. package/src/components/app/TestResult/TestResultHistory/index.tsx +26 -0
  151. package/src/components/app/TestResult/TestResultHistory/styles.scss +63 -0
  152. package/src/components/app/TestResult/TestResultInfo/index.tsx +79 -0
  153. package/src/components/app/TestResult/TestResultInfo/styles.scss +33 -0
  154. package/src/components/app/TestResult/TestResultLinks/index.tsx +60 -0
  155. package/src/components/app/TestResult/TestResultLinks/styles.scss +30 -0
  156. package/src/components/app/TestResult/TestResultMetadata/index.tsx +27 -0
  157. package/src/components/app/TestResult/TestResultMetadata/styles.scss +8 -0
  158. package/src/components/app/TestResult/TestResultNavigation/index.tsx +89 -0
  159. package/src/components/app/TestResult/TestResultNavigation/styles.scss +48 -0
  160. package/src/components/app/TestResult/TestResultOverview.tsx +40 -0
  161. package/src/components/app/TestResult/TestResultParameters/index.tsx +30 -0
  162. package/src/components/app/TestResult/TestResultParameters/styles.scss +8 -0
  163. package/src/components/app/TestResult/TestResultPrevStatuses/index.tsx +52 -0
  164. package/src/components/app/TestResult/TestResultPrevStatuses/styles.scss +57 -0
  165. package/src/components/app/TestResult/TestResultRetriesView/TestResultRetriesItem.tsx +50 -0
  166. package/src/components/app/TestResult/TestResultRetriesView/index.tsx +24 -0
  167. package/src/components/app/TestResult/TestResultRetriesView/styles.scss +69 -0
  168. package/src/components/app/TestResult/TestResultSetup/index.tsx +50 -0
  169. package/src/components/app/TestResult/TestResultSeverity/index.tsx +34 -0
  170. package/src/components/app/TestResult/TestResultSeverity/styles.scss +29 -0
  171. package/src/components/app/TestResult/TestResultStatus/index.tsx +26 -0
  172. package/src/components/app/TestResult/TestResultStatus/styles.scss +36 -0
  173. package/src/components/app/TestResult/TestResultSteps/HtmlAttachmentPreview.tsx +12 -0
  174. package/src/components/app/TestResult/TestResultSteps/attachment.tsx +70 -0
  175. package/src/components/app/TestResult/TestResultSteps/attachmentCode.tsx +15 -0
  176. package/src/components/app/TestResult/TestResultSteps/attachmentImage.tsx +29 -0
  177. package/src/components/app/TestResult/TestResultSteps/attachmentVideo.tsx +12 -0
  178. package/src/components/app/TestResult/TestResultSteps/index.tsx +49 -0
  179. package/src/components/app/TestResult/TestResultSteps/styles.scss +225 -0
  180. package/src/components/app/TestResult/TestResultSteps/testResultAttachment.tsx +79 -0
  181. package/src/components/app/TestResult/TestResultSteps/testResultAttachmentInfo.tsx +87 -0
  182. package/src/components/app/TestResult/TestResultSteps/testResultStep.tsx +71 -0
  183. package/src/components/app/TestResult/TestResultSteps/testResultStepInfo.tsx +33 -0
  184. package/src/components/app/TestResult/TestResultSteps/wrongAttachment.tsx +8 -0
  185. package/src/components/app/TestResult/TestResultTabs/index.tsx +59 -0
  186. package/src/components/app/TestResult/TestResultTabs/styles.scss +76 -0
  187. package/src/components/app/TestResult/TestResultTeardown/index.tsx +49 -0
  188. package/src/components/app/TestResult/index.tsx +56 -0
  189. package/src/components/app/ThemeButton/ThemeButton.tsx +22 -0
  190. package/src/components/app/Tree/Tree.tsx +122 -0
  191. package/src/components/app/Tree/TreeHeader.tsx +81 -0
  192. package/src/components/app/Tree/TreeItem.tsx +31 -0
  193. package/src/components/app/Tree/TreeItemIcon.tsx +35 -0
  194. package/src/components/app/Tree/index.tsx +40 -0
  195. package/src/components/app/Tree/styles.scss +170 -0
  196. package/src/components/commons/Button/index.tsx +176 -0
  197. package/src/components/commons/Button/styles.scss +558 -0
  198. package/src/components/commons/Counter/index.tsx +29 -0
  199. package/src/components/commons/Counter/styles.scss +21 -0
  200. package/src/components/commons/Label/index.tsx +11 -0
  201. package/src/components/commons/Label/styles.scss +7 -0
  202. package/src/components/commons/Link/index.tsx +20 -0
  203. package/src/components/commons/Link/styles.scss +46 -0
  204. package/src/components/commons/Loadable/index.tsx +32 -0
  205. package/src/components/commons/Menu/index.tsx +173 -0
  206. package/src/components/commons/Menu/styles.scss +94 -0
  207. package/src/components/commons/PageLoader/index.tsx +10 -0
  208. package/src/components/commons/PageLoader/styles.scss +29 -0
  209. package/src/components/commons/SearchBox/index.tsx +61 -0
  210. package/src/components/commons/SearchBox/styles.scss +58 -0
  211. package/src/components/commons/Spinner/index.tsx +8 -0
  212. package/src/components/commons/SuccessRatePieChart/index.tsx +52 -0
  213. package/src/components/commons/SuccessRatePieChart/styles.scss +12 -0
  214. package/src/components/commons/SvgIcon/index.tsx +46 -0
  215. package/src/components/commons/SvgIcon/styles.scss +26 -0
  216. package/src/components/commons/Toggle/index.tsx +29 -0
  217. package/src/components/commons/Toggle/styles.scss +48 -0
  218. package/src/components/commons/Tooltip/index.tsx +123 -0
  219. package/src/components/commons/Tooltip/styles.scss +38 -0
  220. package/src/components/commons/Typography/index.tsx +99 -0
  221. package/src/hooks/useDebouncedCallback.ts +31 -0
  222. package/src/i18n/constants.ts +105 -0
  223. package/src/i18n/locales/am.json +115 -0
  224. package/src/i18n/locales/az.json +115 -0
  225. package/src/i18n/locales/de.json +115 -0
  226. package/src/i18n/locales/en.json +115 -0
  227. package/src/i18n/locales/es.json +114 -0
  228. package/src/i18n/locales/fr.json +115 -0
  229. package/src/i18n/locales/he.json +115 -0
  230. package/src/i18n/locales/it.json +115 -0
  231. package/src/i18n/locales/ja.json +115 -0
  232. package/src/i18n/locales/ka.json +115 -0
  233. package/src/i18n/locales/kr.json +115 -0
  234. package/src/i18n/locales/nl.json +115 -0
  235. package/src/i18n/locales/pl.json +113 -0
  236. package/src/i18n/locales/pt.json +115 -0
  237. package/src/i18n/locales/ru.json +113 -0
  238. package/src/i18n/locales/sv.json +115 -0
  239. package/src/i18n/locales/tr.json +115 -0
  240. package/src/i18n/locales/zh.json +115 -0
  241. package/src/index.html +35 -0
  242. package/src/index.tsx +48 -0
  243. package/src/stores/chart.ts +32 -0
  244. package/src/stores/envInfo.ts +34 -0
  245. package/src/stores/index.ts +4 -0
  246. package/src/stores/locale.ts +79 -0
  247. package/src/stores/stats.ts +36 -0
  248. package/src/stores/testResults.ts +40 -0
  249. package/src/stores/theme.ts +33 -0
  250. package/src/stores/tree.ts +33 -0
  251. package/src/stores/types.ts +5 -0
  252. package/src/types/globals.d.ts +8 -0
  253. package/src/types/window.d.ts +8 -0
  254. package/src/utils/attachments.ts +156 -0
  255. package/src/utils/capitalize.ts +4 -0
  256. package/src/utils/copyToClipboard.ts +3 -0
  257. package/src/utils/isMac.ts +7 -0
  258. package/src/utils/statuses.ts +55 -0
  259. package/src/utils/time.ts +17 -0
  260. package/src/utils/treeFilters.ts +150 -0
  261. package/tsconfig.json +25 -0
  262. package/types.d.ts +53 -0
  263. package/webpack.config.js +108 -0
@@ -0,0 +1,32 @@
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
+ };
@@ -0,0 +1,173 @@
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 { useEffect, useRef, useState } from "preact/hooks";
5
+ import check from "@/assets/svg/line-general-check.svg";
6
+ import { SvgIcon } from "@/components/commons/SvgIcon";
7
+ import { Text } from "@/components/commons/Typography";
8
+ import * as styles from "./styles.scss";
9
+
10
+ export const Menu = (props: {
11
+ children: ComponentChildren;
12
+ isInitialOpened?: boolean;
13
+ size?: "s" | "m" | "l" | "xl";
14
+ placement?: "bottom-start" | "bottom-end";
15
+ menuTrigger: (props: { onClick: () => void; isOpened: boolean; setIsOpened: (isOpened: boolean) => void }) => VNode;
16
+ menuTriggerWrapper?: "div" | "span";
17
+ }) => {
18
+ const {
19
+ children,
20
+ menuTrigger,
21
+ menuTriggerWrapper: MenuTriggerWrapper = "div",
22
+ size = "m",
23
+ isInitialOpened = false,
24
+ placement = "bottom-end",
25
+ } = props;
26
+
27
+ const [isOpened, setIsOpened] = useState(isInitialOpened);
28
+ const menuRef = useRef<HTMLDivElement>(null);
29
+ const triggerRef = useRef<HTMLDivElement>(null);
30
+
31
+ const handleTriggerClick = () => {
32
+ setIsOpened(!isOpened);
33
+ };
34
+
35
+ useEffect(() => {
36
+ const handleEscape = (e: KeyboardEvent) => {
37
+ if (e.key === "Escape" && isOpened) {
38
+ setIsOpened(false);
39
+ }
40
+ };
41
+
42
+ document.addEventListener("keydown", handleEscape);
43
+
44
+ return () => {
45
+ document.removeEventListener("keydown", handleEscape);
46
+ };
47
+ }, []);
48
+
49
+ useEffect(() => {
50
+ const handleClickOutside = (e: MouseEvent) => {
51
+ if (!isOpened) {
52
+ return;
53
+ }
54
+
55
+ if (!menuRef.current) {
56
+ return;
57
+ }
58
+
59
+ if (!menuRef.current.contains(e.target as Node)) {
60
+ setIsOpened(false);
61
+ }
62
+ };
63
+
64
+ if (isOpened) {
65
+ document.addEventListener("click", handleClickOutside);
66
+ }
67
+
68
+ return () => {
69
+ document.removeEventListener("click", handleClickOutside);
70
+ };
71
+ }, [menuRef.current, isOpened]);
72
+
73
+ useEffect(() => {
74
+ const updatePosition = () => {
75
+ if (!menuRef.current && !triggerRef.current) {
76
+ return;
77
+ }
78
+
79
+ computePosition(triggerRef.current, menuRef.current, {
80
+ placement,
81
+ middleware: [offset(6), flip(), shift({ padding: 5 })],
82
+ }).then(({ x, y }) => {
83
+ if (menuRef.current) {
84
+ Object.assign(menuRef.current.style, {
85
+ left: `${x}px`,
86
+ top: `${y}px`,
87
+ position: "absolute",
88
+ "z-index": 10,
89
+ });
90
+ }
91
+ });
92
+ };
93
+
94
+ updatePosition();
95
+ return autoUpdate(triggerRef.current, menuRef.current, updatePosition);
96
+ }, [menuRef.current, triggerRef.current]);
97
+
98
+ return (
99
+ <>
100
+ {typeof menuTrigger === "function" && (
101
+ <MenuTriggerWrapper ref={triggerRef}>
102
+ {menuTrigger({
103
+ isOpened,
104
+ onClick: handleTriggerClick,
105
+ setIsOpened,
106
+ })}
107
+ </MenuTriggerWrapper>
108
+ )}
109
+ <div ref={menuRef}>
110
+ {isOpened && <aside className={clsx(styles.menu, styles[`size-${size}`])}>{children}</aside>}
111
+ </div>
112
+ </>
113
+ );
114
+ };
115
+
116
+ Menu.Section = (props: { children: ComponentChildren }) => {
117
+ return <ul className={styles.section}>{props.children}</ul>;
118
+ };
119
+
120
+ type ItemProps = {
121
+ children: ComponentChildren;
122
+ onClick?: () => void;
123
+ leadingIcon?: string;
124
+ rightSlot?: ComponentChildren;
125
+ closeMenuOnClick?: boolean;
126
+ ariaLabel?: string;
127
+ setIsOpened: (isOpened: boolean) => void;
128
+ };
129
+
130
+ Menu.Item = (props: ItemProps) => {
131
+ const { children, onClick, leadingIcon, rightSlot, ariaLabel, closeMenuOnClick = true } = props;
132
+ const isInteractive = typeof onClick === "function";
133
+ const hasLeadingIcon = typeof leadingIcon === "string";
134
+
135
+ const handleItemClick = (e: MouseEvent) => {
136
+ if (isInteractive && closeMenuOnClick) {
137
+ e.stopPropagation();
138
+ }
139
+
140
+ if (isInteractive) {
141
+ onClick?.();
142
+ }
143
+ };
144
+
145
+ return (
146
+ <li className={styles.menuListItem}>
147
+ <Text
148
+ aria-label={ariaLabel}
149
+ type="paragraph"
150
+ size="m"
151
+ tag={isInteractive ? "button" : "div"}
152
+ className={clsx(styles.menuItem, isInteractive && styles.interactive)}
153
+ onClick={handleItemClick}
154
+ data-interactive-menu-item={isInteractive ? true : undefined}
155
+ >
156
+ {hasLeadingIcon && <SvgIcon id={leadingIcon} className={styles.leadingIcon} size="m" />}
157
+ <div className={styles.content}>{children}</div>
158
+ {rightSlot && <div className={styles.right}>{rightSlot}</div>}
159
+ </Text>
160
+ </li>
161
+ );
162
+ };
163
+
164
+ Menu.ItemWithCheckmark = (
165
+ props: ItemProps & {
166
+ isChecked: boolean;
167
+ },
168
+ ) => {
169
+ const { isChecked = false, ...itemProps } = props;
170
+ return (
171
+ <Menu.Item {...itemProps} rightSlot={isChecked && <SvgIcon className={styles.checkmarkIcon} id={check.id} />} />
172
+ );
173
+ };
@@ -0,0 +1,94 @@
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
+ }
@@ -0,0 +1,10 @@
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
+ };
@@ -0,0 +1,29 @@
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
+ }
@@ -0,0 +1,61 @@
1
+ import { clsx } from "clsx";
2
+ import { 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
+
24
+ const onChangeDebounced = useDebouncedCallback(onChange, changeDebounce);
25
+
26
+ const handleChange = (e: Event) => {
27
+ const newValue = (e.target as HTMLInputElement).value;
28
+
29
+ setLocalValue(newValue);
30
+ onChangeDebounced(newValue);
31
+ };
32
+
33
+ const handleClear = (e: PointerEvent) => {
34
+ e.preventDefault();
35
+ e.stopPropagation();
36
+ setLocalValue("");
37
+ onChangeDebounced("");
38
+ };
39
+
40
+ const showClear = !!localValue;
41
+
42
+ return (
43
+ <Text className={styles.inputWrap} type="ui" size="m" tag="div">
44
+ <SvgIcon id={searchIcon.id} size="s" className={styles.leadingIcon} />
45
+ <input
46
+ className={clsx(styles.input, showClear && styles.inputClear)}
47
+ type="text"
48
+ placeholder={placeholder}
49
+ onInput={handleChange}
50
+ value={localValue}
51
+ name="search"
52
+ autocomplete="off"
53
+ />
54
+ {showClear && (
55
+ <div className={styles.clearButton}>
56
+ <IconButton size="s" icon={closeIcon.id} onClick={handleClear} style="ghost" />
57
+ </div>
58
+ )}
59
+ </Text>
60
+ );
61
+ };
@@ -0,0 +1,58 @@
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
+ }
@@ -0,0 +1,8 @@
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
+ }
@@ -0,0 +1,52 @@
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
+ };
@@ -0,0 +1,12 @@
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
+ display: flex;
12
+ }
@@ -0,0 +1,46 @@
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
+ };
@@ -0,0 +1,26 @@
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
+ }
@@ -0,0 +1,29 @@
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 } = 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
+ tabIndex={focusable ? 0 : -1}
21
+ className={styles.toggle}
22
+ role="switch"
23
+ type="checkbox"
24
+ checked={value}
25
+ aria-label={label}
26
+ onChange={handleChange}
27
+ />
28
+ );
29
+ };
@@ -0,0 +1,48 @@
1
+ .toggle {
2
+ padding: 0;
3
+ margin: 0;
4
+ appearance: none;
5
+ width: 28px;
6
+ height: 16px;
7
+ background-color: var(--bg-base-neutral);
8
+ position: relative;
9
+ border-radius: 9px;
10
+ padding: 2px;
11
+ transition: background-color var(--color-change-transition-duration);
12
+ cursor: pointer;
13
+
14
+ &:hover {
15
+ background-color: var(--on-icon-secondary);
16
+ }
17
+
18
+ &:active {
19
+ background-color: var(--on-icon-primary);
20
+ }
21
+
22
+ &:checked {
23
+ background-color: var(--bg-support-aldebaran);
24
+
25
+ &:hover {
26
+ background-color: var(--bg-support-aldebaran-medium);
27
+ }
28
+
29
+ &:active {
30
+ background-color: var(--bg-support-aldebaran-heavy);
31
+ }
32
+
33
+ &::after {
34
+ transform: translateX(12px);
35
+ }
36
+ }
37
+
38
+ &::after {
39
+ content: "";
40
+ display: block;
41
+ width: 12px;
42
+ height: 12px;
43
+ border-radius: 100px;
44
+ background-color: var(--constant-on-icon-primary);
45
+ box-shadow: 0px 1px 1px 0px rgba(0, 0, 0, 0.2);
46
+ transition: transform var(--interaction-transition-duration) ease-out;
47
+ }
48
+ }