@sydsoft/base 1.11.0 → 1.12.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/esm/icon/index.d.ts +8 -8
- package/dist/esm/icon/index.js +4 -19
- package/package.json +1 -1
package/dist/esm/icon/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { iconMap
|
|
2
|
+
import { iconMap } from "./icons";
|
|
3
3
|
export declare const iconList: ("search" | "close" | "edit" | "keyboard_arrow_up" | "keyboard_arrow_down")[];
|
|
4
|
-
export type IconName = keyof typeof
|
|
4
|
+
export type IconName = keyof typeof iconMap;
|
|
5
5
|
interface BaseProps {
|
|
6
6
|
color?: string;
|
|
7
7
|
fontSize?: number | string;
|
|
@@ -10,17 +10,17 @@ interface BaseProps {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
12
|
interface NameIconProps extends BaseProps {
|
|
13
|
-
name: IconName
|
|
13
|
+
name: IconName;
|
|
14
14
|
customIcon?: never;
|
|
15
15
|
}
|
|
16
|
+
export type CustomIcon = {
|
|
17
|
+
viewBox: string;
|
|
18
|
+
content: string;
|
|
19
|
+
};
|
|
16
20
|
interface CustomIconProps extends BaseProps {
|
|
17
|
-
customIcon:
|
|
18
|
-
viewBox: string;
|
|
19
|
-
content: string;
|
|
20
|
-
};
|
|
21
|
+
customIcon: CustomIcon;
|
|
21
22
|
name?: never;
|
|
22
23
|
}
|
|
23
24
|
export type Props = NameIconProps | CustomIconProps;
|
|
24
|
-
export declare const iconMap: any;
|
|
25
25
|
export declare const Icon: React.FC<Props>;
|
|
26
26
|
export {};
|
package/dist/esm/icon/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { iconMap
|
|
4
|
-
export var iconList = Object.keys(
|
|
3
|
+
import { iconMap } from "./icons";
|
|
4
|
+
export var iconList = Object.keys(iconMap);
|
|
5
5
|
var defaultIconStyle = {
|
|
6
6
|
userSelect: "none",
|
|
7
7
|
width: "1em",
|
|
@@ -10,26 +10,11 @@ var defaultIconStyle = {
|
|
|
10
10
|
verticalAlign: "middle",
|
|
11
11
|
flexShrink: 0
|
|
12
12
|
};
|
|
13
|
-
var customIcons = {};
|
|
14
|
-
// Sadece server-side’da root klasörden oku
|
|
15
|
-
if (typeof window === "undefined") {
|
|
16
|
-
try {
|
|
17
|
-
var fs = require("fs");
|
|
18
|
-
var path = require("path");
|
|
19
|
-
var filePath = path.join(process.cwd(), "customIcons.json");
|
|
20
|
-
if (fs.existsSync(filePath)) {
|
|
21
|
-
customIcons = JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
catch (_a) {
|
|
25
|
-
customIcons = {};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
export var iconMap = __assign(__assign({}, defaultIcons), customIcons);
|
|
29
13
|
export var Icon = function (_a) {
|
|
30
14
|
var name = _a.name, customIcon = _a.customIcon, fontSize = _a.fontSize, color = _a.color, className = _a.className, style = _a.style, other = __rest(_a, ["name", "customIcon", "fontSize", "color", "className", "style"]);
|
|
31
15
|
var iconComponent = name ? iconMap[name] : customIcon;
|
|
32
|
-
if (!iconComponent)
|
|
16
|
+
if (!iconComponent) {
|
|
33
17
|
return _jsx("span", { children: "\u26A0\uFE0F" });
|
|
18
|
+
}
|
|
34
19
|
return (_jsx("span", __assign({ className: className, style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || "1.5rem", color: color || "inherit" }) }, other, { children: _jsx("svg", { viewBox: iconComponent.viewBox, fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { dangerouslySetInnerHTML: { __html: iconComponent.content } }) }) })));
|
|
35
20
|
};
|