@ncds/ui-admin-icon 0.0.11 → 0.0.13
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/index.js +15 -16
- package/dist/cjs/map.js +1533 -0
- package/dist/cjs/utils.js +7 -0
- package/dist/esm/index.js +16 -14
- package/dist/esm/map.js +1496 -0
- package/dist/esm/utils.js +3 -0
- package/dist/types/index.d.ts +0 -1
- package/dist/types/map.d.ts +2 -0
- package/dist/types/utils.d.ts +1 -0
- package/package.json +3 -2
package/dist/cjs/index.js
CHANGED
|
@@ -32,30 +32,29 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
36
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
|
-
};
|
|
38
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
36
|
const react_1 = __importStar(require("react"));
|
|
40
|
-
const
|
|
41
|
-
return str.replace(/-([a-z0-9])/g, (_, char) => char.toUpperCase()).replace(/^[a-z]/, (char) => char.toUpperCase());
|
|
42
|
-
};
|
|
37
|
+
const map_1 = require("./map");
|
|
43
38
|
const Icon = ({ name, ...props }) => {
|
|
44
39
|
const iconRef = (0, react_1.useRef)(null);
|
|
45
|
-
const [
|
|
40
|
+
const [isLoading, setIsLoading] = (0, react_1.useState)(true);
|
|
46
41
|
(0, react_1.useEffect)(() => {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
iconRef.current =
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
42
|
+
setIsLoading(true);
|
|
43
|
+
(0, map_1.getIcon)(name)
|
|
44
|
+
?.then((module) => {
|
|
45
|
+
iconRef.current = module.default;
|
|
46
|
+
setIsLoading(false);
|
|
47
|
+
})
|
|
48
|
+
.catch((error) => {
|
|
49
|
+
console.error(error);
|
|
50
|
+
setIsLoading(false);
|
|
51
|
+
});
|
|
54
52
|
}, [name]);
|
|
55
53
|
const IconComponent = iconRef.current;
|
|
56
|
-
if (
|
|
54
|
+
if (isLoading || !IconComponent)
|
|
57
55
|
return null;
|
|
58
56
|
return react_1.default.createElement(IconComponent, { ...props });
|
|
59
57
|
};
|
|
60
58
|
exports.default = Icon;
|
|
61
|
-
|
|
59
|
+
// 모든 컴포넌트를 정적으로 내보내지 않음
|
|
60
|
+
// export * from './components';
|