@snack-uikit/icons 0.26.4 → 0.26.5-preview-76bcef09.0
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.
- package/dist/cjs/Sprite.d.ts +4 -3
- package/dist/cjs/Sprite.js +13 -27
- package/dist/esm/Sprite.d.ts +4 -3
- package/dist/esm/Sprite.js +8 -27
- package/package.json +2 -2
- package/src/Sprite.tsx +17 -31
package/dist/cjs/Sprite.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type SpriteProps = {
|
|
2
2
|
content: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
'data-test-id'?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const Sprite: import("react").NamedExoticComponent<SpriteProps>;
|
|
5
6
|
export {};
|
package/dist/cjs/Sprite.js
CHANGED
|
@@ -4,34 +4,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.Sprite = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
7
8
|
const react_1 = require("react");
|
|
8
9
|
const utils_1 = require("@snack-uikit/utils");
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
13
|
-
const [div] = (0, react_1.useState)((0, utils_1.isBrowser)() ? document.createElement('div') : undefined);
|
|
14
|
-
if ((0, utils_1.isBrowser)() && div && div.parentNode !== document.body) {
|
|
15
|
-
div.style.display = 'none';
|
|
16
|
-
div.innerHTML = content;
|
|
17
|
-
document.body.prepend(div);
|
|
10
|
+
exports.Sprite = (0, react_1.memo)(function Sprite(props) {
|
|
11
|
+
if (!(0, utils_1.isBrowser)()) {
|
|
12
|
+
return null;
|
|
18
13
|
}
|
|
19
|
-
(0,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
14
|
+
return (0, jsx_runtime_1.jsx)("div", {
|
|
15
|
+
"data-test-id": props['data-test-id'],
|
|
16
|
+
style: {
|
|
17
|
+
display: 'none'
|
|
18
|
+
},
|
|
19
|
+
dangerouslySetInnerHTML: {
|
|
20
|
+
__html: props.content
|
|
24
21
|
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (div) {
|
|
28
|
-
if (div.parentNode !== document.body) {
|
|
29
|
-
div.style.display = 'none';
|
|
30
|
-
document.body.prepend(div);
|
|
31
|
-
}
|
|
32
|
-
div.innerHTML = content;
|
|
33
|
-
}
|
|
34
|
-
}, [content, div]);
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
exports.Sprite = (0, react_1.memo)(SpriteInner);
|
|
22
|
+
});
|
|
23
|
+
});
|
package/dist/esm/Sprite.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
type SpriteProps = {
|
|
2
2
|
content: string;
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
'data-test-id'?: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const Sprite: import("react").NamedExoticComponent<SpriteProps>;
|
|
5
6
|
export {};
|
package/dist/esm/Sprite.js
CHANGED
|
@@ -1,28 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
if (isBrowser()
|
|
6
|
-
|
|
7
|
-
div.innerHTML = content;
|
|
8
|
-
document.body.prepend(div);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
4
|
+
export const Sprite = memo(function Sprite(props) {
|
|
5
|
+
if (!isBrowser()) {
|
|
6
|
+
return null;
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return () => {
|
|
13
|
-
document.body.removeChild(div);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
}, [div]);
|
|
17
|
-
useLayoutEffect(() => {
|
|
18
|
-
if (div) {
|
|
19
|
-
if (div.parentNode !== document.body) {
|
|
20
|
-
div.style.display = 'none';
|
|
21
|
-
document.body.prepend(div);
|
|
22
|
-
}
|
|
23
|
-
div.innerHTML = content;
|
|
24
|
-
}
|
|
25
|
-
}, [content, div]);
|
|
26
|
-
return null;
|
|
27
|
-
}
|
|
28
|
-
export const Sprite = memo(SpriteInner);
|
|
8
|
+
return (_jsx("div", { "data-test-id": props['data-test-id'], style: { display: 'none' }, dangerouslySetInnerHTML: { __html: props.content } }));
|
|
9
|
+
});
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
6
|
"title": "Icons",
|
|
7
|
-
"version": "0.26.
|
|
7
|
+
"version": "0.26.5-preview-76bcef09.0",
|
|
8
8
|
"sideEffects": [
|
|
9
9
|
"*.svg",
|
|
10
10
|
"*.css",
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"svg-sprite": "2.0.2",
|
|
57
57
|
"svgo": "3.1.0"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "f319535e21d641f07f7f7f20ae249d94b7586544"
|
|
60
60
|
}
|
package/src/Sprite.tsx
CHANGED
|
@@ -1,36 +1,22 @@
|
|
|
1
|
-
import { memo
|
|
1
|
+
import { memo } from 'react';
|
|
2
2
|
|
|
3
|
-
import { isBrowser
|
|
3
|
+
import { isBrowser } from '@snack-uikit/utils';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
type SpriteProps = {
|
|
6
|
+
content: string;
|
|
7
|
+
'data-test-id'?: string;
|
|
8
|
+
};
|
|
7
9
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
document.body.prepend(div);
|
|
10
|
+
export const Sprite = memo(function Sprite(props: SpriteProps) {
|
|
11
|
+
if (!isBrowser()) {
|
|
12
|
+
return null;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
useLayoutEffect(() => {
|
|
23
|
-
if (div) {
|
|
24
|
-
if (div.parentNode !== document.body) {
|
|
25
|
-
div.style.display = 'none';
|
|
26
|
-
document.body.prepend(div);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
div.innerHTML = content;
|
|
30
|
-
}
|
|
31
|
-
}, [content, div]);
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
export const Sprite = memo(SpriteInner);
|
|
15
|
+
return (
|
|
16
|
+
<div
|
|
17
|
+
data-test-id={props['data-test-id']}
|
|
18
|
+
style={{ display: 'none' }}
|
|
19
|
+
dangerouslySetInnerHTML={{ __html: props.content }}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
});
|