@versini/ui-icon-renderer 0.0.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/LICENSE +21 -0
- package/README.md +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +36 -0
- package/package.json +45 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Arno Versini
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# @versini/ui-icon-renderer
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
const IconRenderer = ({ icon, ...rest })=>{
|
|
9
|
+
const [IconComponent, setIconComponent] = useState(null);
|
|
10
|
+
useEffect(()=>{
|
|
11
|
+
setIconComponent(null);
|
|
12
|
+
/* v8 ignore start -- dynamic template-literal imports are not instrumented by V8 */ (async ()=>{
|
|
13
|
+
try {
|
|
14
|
+
const mod = await import(`./data/icon-${icon}.js`);
|
|
15
|
+
if (mod && mod.default) {
|
|
16
|
+
setIconComponent(()=>mod.default);
|
|
17
|
+
}
|
|
18
|
+
} catch {
|
|
19
|
+
// Icon not found
|
|
20
|
+
}
|
|
21
|
+
})();
|
|
22
|
+
/* v8 ignore stop */ }, [
|
|
23
|
+
icon
|
|
24
|
+
]);
|
|
25
|
+
if (!IconComponent) {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return /*#__PURE__*/ jsx(IconComponent, {
|
|
29
|
+
"data-slot": "icon",
|
|
30
|
+
...rest
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/* v8 ignore next 1 */
|
|
35
|
+
|
|
36
|
+
export { IconRenderer };
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@versini/ui-icon-renderer",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Arno Versini",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/aversini/ui-icons",
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git@github.com:aversini/ui-icons.git"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"main": "dist/index.js",
|
|
16
|
+
"types": "dist/index.d.ts",
|
|
17
|
+
"files": [
|
|
18
|
+
"dist"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build:check": "tsc",
|
|
22
|
+
"build:js": "rslib build",
|
|
23
|
+
"build:types": "echo 'Types now built with rslib'",
|
|
24
|
+
"build": "npm-run-all --serial clean build:list build:check build:js",
|
|
25
|
+
"build:list": "node scripts/generate-icon-data.js",
|
|
26
|
+
"clean": "rimraf dist tmp",
|
|
27
|
+
"dev:js": "rslib build --watch",
|
|
28
|
+
"dev:types": "echo 'Types now watched with rslib'",
|
|
29
|
+
"dev": "rslib build --watch",
|
|
30
|
+
"lint": "biome lint src",
|
|
31
|
+
"prettier": "biome check --write --no-errors-on-unmatched",
|
|
32
|
+
"start": "static-server dist --port 5173",
|
|
33
|
+
"test:coverage:ui": "vitest --coverage --ui",
|
|
34
|
+
"test:coverage": "vitest run --coverage",
|
|
35
|
+
"test:watch": "vitest",
|
|
36
|
+
"test": "vitest run"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@versini/ui-icons": "4.22.0"
|
|
40
|
+
},
|
|
41
|
+
"sideEffects": [
|
|
42
|
+
"**/*.css"
|
|
43
|
+
],
|
|
44
|
+
"gitHead": "91c40956f579f1a34088d979157da1f7d286dc9a"
|
|
45
|
+
}
|