@allurereport/web-awesome 3.0.0-beta.3 → 3.0.0-beta.4

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 (35) hide show
  1. package/dist/multi/{app-b6362ca0.js → app-13f840d5.js} +2 -2
  2. package/dist/multi/manifest.json +20 -20
  3. package/dist/multi/{styles-b6362ca0.css → styles-13f840d5.css} +2 -2
  4. package/dist/single/app-d31bd53e.js +2 -0
  5. package/dist/single/manifest.json +1 -1
  6. package/package.json +3 -3
  7. package/src/assets/scss/_common.scss +9 -0
  8. package/src/components/app/ReportBody/SortBy.tsx +2 -2
  9. package/src/components/app/ReportHeader/index.tsx +1 -1
  10. package/src/components/commons/Menu/index.tsx +40 -15
  11. package/src/components/commons/SearchBox/index.tsx +1 -0
  12. package/src/components/commons/SuccessRatePieChart/styles.scss +0 -1
  13. package/src/components/commons/Toggle/index.tsx +1 -1
  14. package/src/utils/capitalize.ts +5 -3
  15. package/dist/single/app-57ae0a60.js +0 -2
  16. /package/dist/multi/{141.app-b6362ca0.js → 141.app-13f840d5.js} +0 -0
  17. /package/dist/multi/{222.app-b6362ca0.js → 222.app-13f840d5.js} +0 -0
  18. /package/dist/multi/{335.app-b6362ca0.js → 335.app-13f840d5.js} +0 -0
  19. /package/dist/multi/{34.app-b6362ca0.js → 34.app-13f840d5.js} +0 -0
  20. /package/dist/multi/{349.app-b6362ca0.js → 349.app-13f840d5.js} +0 -0
  21. /package/dist/multi/{378.app-b6362ca0.js → 378.app-13f840d5.js} +0 -0
  22. /package/dist/multi/{406.app-b6362ca0.js → 406.app-13f840d5.js} +0 -0
  23. /package/dist/multi/{476.app-b6362ca0.js → 476.app-13f840d5.js} +0 -0
  24. /package/dist/multi/{53.app-b6362ca0.js → 53.app-13f840d5.js} +0 -0
  25. /package/dist/multi/{584.app-b6362ca0.js → 584.app-13f840d5.js} +0 -0
  26. /package/dist/multi/{690.app-b6362ca0.js → 690.app-13f840d5.js} +0 -0
  27. /package/dist/multi/{747.app-b6362ca0.js → 747.app-13f840d5.js} +0 -0
  28. /package/dist/multi/{767.app-b6362ca0.js → 767.app-13f840d5.js} +0 -0
  29. /package/dist/multi/{816.app-b6362ca0.js → 816.app-13f840d5.js} +0 -0
  30. /package/dist/multi/{83.app-b6362ca0.js → 83.app-13f840d5.js} +0 -0
  31. /package/dist/multi/{873.app-b6362ca0.js → 873.app-13f840d5.js} +0 -0
  32. /package/dist/multi/{920.app-b6362ca0.js → 920.app-13f840d5.js} +0 -0
  33. /package/dist/multi/{991.app-b6362ca0.js → 991.app-13f840d5.js} +0 -0
  34. /package/dist/multi/{app-b6362ca0.js.LICENSE.txt → app-13f840d5.js.LICENSE.txt} +0 -0
  35. /package/dist/single/{app-57ae0a60.js.LICENSE.txt → app-d31bd53e.js.LICENSE.txt} +0 -0
@@ -1,3 +1,3 @@
1
1
  {
2
- "main.js": "app-57ae0a60.js"
2
+ "main.js": "app-d31bd53e.js"
3
3
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/web-awesome",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "The static files for Allure Awesome Report",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,8 +30,8 @@
30
30
  "IE 11"
31
31
  ],
32
32
  "dependencies": {
33
- "@allurereport/core-api": "3.0.0-beta.3",
34
- "@allurereport/web-commons": "3.0.0-beta.3",
33
+ "@allurereport/core-api": "3.0.0-beta.4",
34
+ "@allurereport/web-commons": "3.0.0-beta.4",
35
35
  "@preact/signals": "^1.3.0",
36
36
  "clsx": "^2.1.1",
37
37
  "d3-shape": "^3.2.0",
@@ -3,6 +3,7 @@
3
3
  *::after {
4
4
  box-sizing: border-box;
5
5
  }
6
+
6
7
  html,
7
8
  body,
8
9
  div,
@@ -91,6 +92,7 @@ video {
91
92
  font: inherit;
92
93
  vertical-align: baseline;
93
94
  }
95
+
94
96
  /* HTML5 display-role reset for older browsers */
95
97
  article,
96
98
  aside,
@@ -105,17 +107,21 @@ nav,
105
107
  section {
106
108
  display: block;
107
109
  }
110
+
108
111
  body {
109
112
  line-height: 1;
110
113
  }
114
+
111
115
  ol,
112
116
  ul {
113
117
  list-style: none;
114
118
  }
119
+
115
120
  blockquote,
116
121
  q {
117
122
  quotes: none;
118
123
  }
124
+
119
125
  blockquote:before,
120
126
  blockquote:after,
121
127
  q:before,
@@ -123,12 +129,15 @@ q:after {
123
129
  content: "";
124
130
  content: none;
125
131
  }
132
+
126
133
  table {
127
134
  border-collapse: collapse;
128
135
  border-spacing: 0;
129
136
  }
137
+
130
138
  body {
131
139
  color: var(--on-text-primary);
132
140
  background: var(--bg-base-secondary);
133
141
  font-family: var(--font-family);
142
+ -webkit-text-size-adjust: 100%;
134
143
  }
@@ -1,5 +1,5 @@
1
1
  import clsx from "clsx";
2
- import { ComponentChildren } from "preact";
2
+ import type { ComponentChildren } from "preact";
3
3
  import lineChevronDownIcon from "@/assets/svg/line-arrows-chevron-down.svg";
4
4
  import sortAscIcon from "@/assets/svg/line-arrows-sort-line-asc.svg";
5
5
  import sortDescIcon from "@/assets/svg/line-arrows-sort-line-desc.svg";
@@ -92,7 +92,7 @@ export const SortBy = () => {
92
92
  <Menu.Item
93
93
  closeMenuOnClick={false}
94
94
  onClick={onClick}
95
- leadingIcon={direction == "asc" ? sortAscIcon.id : sortDescIcon.id}
95
+ leadingIcon={direction === "asc" ? sortAscIcon.id : sortDescIcon.id}
96
96
  rightSlot={
97
97
  <BtnWrapper>
98
98
  <DropdownButton
@@ -19,7 +19,7 @@ export const ReportHeader = () => {
19
19
  <div className={styles["report-wrapper"]}>
20
20
  <ReportHeaderLogo />
21
21
  <div className={styles["report-wrapper-text"]}>
22
- <Heading size={"s"} tag={"h2"} className={styles["wrapper-header"]}>
22
+ <Heading size={"s"} tag={"h2"} className={styles["wrapper-header"]} data-testid="report-title">
23
23
  {reportName}
24
24
  </Heading>
25
25
  <Text type="paragraph" size="m" className={styles["report-date"]}>
@@ -1,12 +1,29 @@
1
1
  import { autoUpdate, computePosition, flip, offset, shift } from "@floating-ui/dom";
2
2
  import { clsx } from "clsx";
3
3
  import type { ComponentChildren, VNode } from "preact";
4
- import { useEffect, useRef, useState } from "preact/hooks";
4
+ import { createContext } from "preact";
5
+ import { useContext, useEffect, useRef, useState } from "preact/hooks";
5
6
  import check from "@/assets/svg/line-general-check.svg";
6
7
  import { SvgIcon } from "@/components/commons/SvgIcon";
7
8
  import { Text } from "@/components/commons/Typography";
8
9
  import * as styles from "./styles.scss";
9
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
+
10
27
  export const Menu = (props: {
11
28
  children: ComponentChildren;
12
29
  isInitialOpened?: boolean;
@@ -96,20 +113,26 @@ export const Menu = (props: {
96
113
  }, [menuRef.current, triggerRef.current]);
97
114
 
98
115
  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
- </>
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>
113
136
  );
114
137
  };
115
138
 
@@ -128,6 +151,7 @@ type ItemProps = {
128
151
  };
129
152
 
130
153
  Menu.Item = (props: ItemProps) => {
154
+ const { setIsOpened } = useMenuContext();
131
155
  const { children, onClick, leadingIcon, rightSlot, ariaLabel, closeMenuOnClick = true } = props;
132
156
  const isInteractive = typeof onClick === "function";
133
157
  const hasLeadingIcon = typeof leadingIcon === "string";
@@ -135,6 +159,7 @@ Menu.Item = (props: ItemProps) => {
135
159
  const handleItemClick = (e: MouseEvent) => {
136
160
  if (isInteractive && closeMenuOnClick) {
137
161
  e.stopPropagation();
162
+ setIsOpened(false);
138
163
  }
139
164
 
140
165
  if (isInteractive) {
@@ -50,6 +50,7 @@ export const SearchBox = (props: Props) => {
50
50
  value={localValue}
51
51
  name="search"
52
52
  autocomplete="off"
53
+ data-testid="search-input"
53
54
  />
54
55
  {showClear && (
55
56
  <div className={styles.clearButton}>
@@ -8,5 +8,4 @@
8
8
 
9
9
  .chart {
10
10
  position: relative;
11
- display: flex;
12
11
  }
@@ -23,7 +23,7 @@ export const Toggle = (props: Props) => {
23
23
  type="checkbox"
24
24
  checked={value}
25
25
  aria-label={label}
26
- onChange={handleChange}
26
+ onToggle={handleChange}
27
27
  />
28
28
  );
29
29
  };
@@ -1,4 +1,6 @@
1
- export function capitalize(str: string) {
2
- if (!str) return;
1
+ export const capitalize = (str: string) => {
2
+ if (!str) {
3
+ return;
4
+ }
3
5
  return str.charAt(0).toLocaleUpperCase() + str.slice(1);
4
- }
6
+ };