@etsoo/materialui 1.5.24 → 1.5.26

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.
@@ -20,11 +20,7 @@ export interface TabBoxPanel extends Omit<TabProps, "value" | "children"> {
20
20
  /**
21
21
  * Tabs with box props
22
22
  */
23
- export interface TabBoxPros extends BoxProps {
24
- /**
25
- * Container props
26
- */
27
- container?: Omit<TabsProps, "value">;
23
+ export interface TabBoxPros extends Omit<TabsProps, "value"> {
28
24
  /**
29
25
  * Default selected index
30
26
  */
package/lib/cjs/TabBox.js CHANGED
@@ -20,8 +20,7 @@ function isActionTab(children) {
20
20
  */
21
21
  function TabBox(props) {
22
22
  // Destruct
23
- const { index, inputName, root, container = {}, defaultIndex = 0, tabProps, tabs } = props;
24
- const { onChange, ...rest } = container;
23
+ const { index, inputName, root, defaultIndex = 0, onChange, tabProps, tabs, ...rest } = props;
25
24
  // State
26
25
  const [value, setValue] = react_1.default.useState(defaultIndex);
27
26
  react_1.default.useEffect(() => {
@@ -5,6 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.HtmlDiv = HtmlDiv;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const shared_1 = require("@etsoo/shared");
8
9
  const dompurify_1 = __importDefault(require("dompurify"));
9
10
  class HtmlDivElement extends HTMLElement {
10
11
  constructor() {
@@ -15,10 +16,16 @@ class HtmlDivElement extends HTMLElement {
15
16
  const shadow = this.attachShadow({ mode: "open" });
16
17
  // Create a wrapper element to hold the sanitized HTML content
17
18
  const wrapper = document.createElement("div");
18
- if (this.textContent) {
19
+ const html = this.innerHTML;
20
+ if (shared_1.Utils.hasHtmlEntity(html) &&
21
+ !shared_1.Utils.hasHtmlTag(html) &&
22
+ this.textContent) {
19
23
  wrapper.innerHTML = dompurify_1.default.sanitize(this.textContent);
20
- this.textContent = null; // Clear the textContent to avoid duplication
21
24
  }
25
+ else {
26
+ wrapper.innerHTML = dompurify_1.default.sanitize(html);
27
+ }
28
+ this.textContent = null; // Clear the textContent to avoid duplication
22
29
  shadow.appendChild(wrapper);
23
30
  }
24
31
  }
@@ -20,11 +20,7 @@ export interface TabBoxPanel extends Omit<TabProps, "value" | "children"> {
20
20
  /**
21
21
  * Tabs with box props
22
22
  */
23
- export interface TabBoxPros extends BoxProps {
24
- /**
25
- * Container props
26
- */
27
- container?: Omit<TabsProps, "value">;
23
+ export interface TabBoxPros extends Omit<TabsProps, "value"> {
28
24
  /**
29
25
  * Default selected index
30
26
  */
package/lib/mjs/TabBox.js CHANGED
@@ -14,8 +14,7 @@ function isActionTab(children) {
14
14
  */
15
15
  export function TabBox(props) {
16
16
  // Destruct
17
- const { index, inputName, root, container = {}, defaultIndex = 0, tabProps, tabs } = props;
18
- const { onChange, ...rest } = container;
17
+ const { index, inputName, root, defaultIndex = 0, onChange, tabProps, tabs, ...rest } = props;
19
18
  // State
20
19
  const [value, setValue] = React.useState(defaultIndex);
21
20
  React.useEffect(() => {
@@ -1,4 +1,5 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Utils } from "@etsoo/shared";
2
3
  import DOMPurify from "dompurify";
3
4
  class HtmlDivElement extends HTMLElement {
4
5
  constructor() {
@@ -9,10 +10,16 @@ class HtmlDivElement extends HTMLElement {
9
10
  const shadow = this.attachShadow({ mode: "open" });
10
11
  // Create a wrapper element to hold the sanitized HTML content
11
12
  const wrapper = document.createElement("div");
12
- if (this.textContent) {
13
+ const html = this.innerHTML;
14
+ if (Utils.hasHtmlEntity(html) &&
15
+ !Utils.hasHtmlTag(html) &&
16
+ this.textContent) {
13
17
  wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
14
- this.textContent = null; // Clear the textContent to avoid duplication
15
18
  }
19
+ else {
20
+ wrapper.innerHTML = DOMPurify.sanitize(html);
21
+ }
22
+ this.textContent = null; // Clear the textContent to avoid duplication
16
23
  shadow.appendChild(wrapper);
17
24
  }
18
25
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/materialui",
3
- "version": "1.5.24",
3
+ "version": "1.5.26",
4
4
  "description": "TypeScript Material-UI Implementation",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -43,7 +43,7 @@
43
43
  "@etsoo/appscript": "^1.6.22",
44
44
  "@etsoo/notificationbase": "^1.1.60",
45
45
  "@etsoo/react": "^1.8.38",
46
- "@etsoo/shared": "^1.2.66",
46
+ "@etsoo/shared": "^1.2.68",
47
47
  "@mui/icons-material": "^7.0.2",
48
48
  "@mui/material": "^7.0.2",
49
49
  "@mui/x-data-grid": "^7.28.3",
@@ -82,7 +82,7 @@
82
82
  "@types/react-input-mask": "^3.0.6",
83
83
  "@types/react-window": "^1.8.8",
84
84
  "@vitejs/plugin-react": "^4.3.4",
85
- "jsdom": "^26.0.0",
85
+ "jsdom": "^26.1.0",
86
86
  "typescript": "^5.8.3",
87
87
  "vitest": "^3.1.1"
88
88
  }
package/src/TabBox.tsx CHANGED
@@ -35,12 +35,7 @@ export interface TabBoxPanel extends Omit<TabProps, "value" | "children"> {
35
35
  /**
36
36
  * Tabs with box props
37
37
  */
38
- export interface TabBoxPros extends BoxProps {
39
- /**
40
- * Container props
41
- */
42
- container?: Omit<TabsProps, "value">;
43
-
38
+ export interface TabBoxPros extends Omit<TabsProps, "value"> {
44
39
  /**
45
40
  * Default selected index
46
41
  */
@@ -83,12 +78,12 @@ export function TabBox(props: TabBoxPros) {
83
78
  index,
84
79
  inputName,
85
80
  root,
86
- container = {},
87
81
  defaultIndex = 0,
82
+ onChange,
88
83
  tabProps,
89
- tabs
84
+ tabs,
85
+ ...rest
90
86
  } = props;
91
- const { onChange, ...rest } = container;
92
87
 
93
88
  // State
94
89
  const [value, setValue] = React.useState(defaultIndex);
@@ -1,3 +1,4 @@
1
+ import { Utils } from "@etsoo/shared";
1
2
  import DOMPurify from "dompurify";
2
3
  import { HTMLAttributes } from "react";
3
4
 
@@ -12,11 +13,19 @@ class HtmlDivElement extends HTMLElement {
12
13
 
13
14
  // Create a wrapper element to hold the sanitized HTML content
14
15
  const wrapper = document.createElement("div");
15
- if (this.textContent) {
16
+ const html = this.innerHTML;
17
+ if (
18
+ Utils.hasHtmlEntity(html) &&
19
+ !Utils.hasHtmlTag(html) &&
20
+ this.textContent
21
+ ) {
16
22
  wrapper.innerHTML = DOMPurify.sanitize(this.textContent);
17
- this.textContent = null; // Clear the textContent to avoid duplication
23
+ } else {
24
+ wrapper.innerHTML = DOMPurify.sanitize(html);
18
25
  }
19
26
 
27
+ this.textContent = null; // Clear the textContent to avoid duplication
28
+
20
29
  shadow.appendChild(wrapper);
21
30
  }
22
31
  }