@sydsoft/base 1.7.0 → 1.8.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.
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { iconMap } from "./icons";
|
|
3
|
+
export declare const iconList: ("search" | "close" | "edit" | "keyboard_arrow_up" | "keyboard_arrow_down")[];
|
|
4
|
+
export type IconName = keyof typeof iconMap;
|
|
5
|
+
interface BaseProps {
|
|
6
|
+
color?: string;
|
|
7
|
+
fontSize?: number | string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
className?: string;
|
|
10
|
+
[key: string]: any;
|
|
11
|
+
}
|
|
12
|
+
interface NameIconProps extends BaseProps {
|
|
13
|
+
name: IconName;
|
|
14
|
+
customIcon?: never;
|
|
15
|
+
}
|
|
16
|
+
interface CustomIconProps extends BaseProps {
|
|
17
|
+
customIcon: {
|
|
18
|
+
viewBox: string;
|
|
19
|
+
content: string;
|
|
20
|
+
};
|
|
21
|
+
name?: never;
|
|
22
|
+
}
|
|
23
|
+
export type Props = NameIconProps | CustomIconProps;
|
|
24
|
+
export declare const Icon: React.FC<Props>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { __assign, __rest } from "tslib";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { iconMap } from "./icons";
|
|
4
|
+
export var iconList = Object.keys(iconMap);
|
|
5
|
+
// https://fonts.google.com/icons adresinden ikonu seçtikten sonra kopyalayalıp alıyoruz. Icon adı da en atta hangisiyse onu ekleyelim, isimler karışmasın
|
|
6
|
+
var defaultIconStyle = {
|
|
7
|
+
userSelect: "none",
|
|
8
|
+
width: "1em",
|
|
9
|
+
height: "1em",
|
|
10
|
+
display: "inline-block",
|
|
11
|
+
verticalAlign: "middle",
|
|
12
|
+
flexShrink: 0,
|
|
13
|
+
};
|
|
14
|
+
export var Icon = function (_a) {
|
|
15
|
+
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"]);
|
|
16
|
+
var iconComponent = name ? iconMap[name] : customIcon;
|
|
17
|
+
return (_jsx("span", __assign({ className: className, style: __assign(__assign(__assign({}, defaultIconStyle), style), { fontSize: fontSize || "1.5rem", color: color || "inherit" }) }, other, { children: (iconComponent && (_jsx("svg", { viewBox: iconComponent.viewBox, fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { dangerouslySetInnerHTML: { __html: iconComponent.content } }) }))) || _jsx("span", { children: "\u26A0\uFE0F" }) })));
|
|
18
|
+
};
|
package/dist/esm/icon/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { iconMap } from "./icons";
|
|
2
|
+
import { iconMap as defaultIcons } 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 defaultIcons;
|
|
5
5
|
interface BaseProps {
|
|
6
6
|
color?: string;
|
|
7
7
|
fontSize?: number | string;
|
|
@@ -10,7 +10,7 @@ interface BaseProps {
|
|
|
10
10
|
[key: string]: any;
|
|
11
11
|
}
|
|
12
12
|
interface NameIconProps extends BaseProps {
|
|
13
|
-
name: IconName;
|
|
13
|
+
name: IconName | string;
|
|
14
14
|
customIcon?: never;
|
|
15
15
|
}
|
|
16
16
|
interface CustomIconProps extends BaseProps {
|
|
@@ -21,5 +21,6 @@ interface CustomIconProps extends BaseProps {
|
|
|
21
21
|
name?: never;
|
|
22
22
|
}
|
|
23
23
|
export type Props = NameIconProps | CustomIconProps;
|
|
24
|
+
export declare const iconMap: any;
|
|
24
25
|
export declare const Icon: React.FC<Props>;
|
|
25
26
|
export {};
|
package/dist/esm/icon/index.js
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
import { __assign, __rest } from "tslib";
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { iconMap } from "./icons";
|
|
4
|
-
export var iconList = Object.keys(
|
|
5
|
-
// https://fonts.google.com/icons adresinden ikonu seçtikten sonra kopyalayalıp alıyoruz. Icon adı da en atta hangisiyse onu ekleyelim, isimler karışmasın
|
|
3
|
+
import { iconMap as defaultIcons } from "./icons";
|
|
4
|
+
export var iconList = Object.keys(defaultIcons);
|
|
6
5
|
var defaultIconStyle = {
|
|
7
6
|
userSelect: "none",
|
|
8
7
|
width: "1em",
|
|
9
8
|
height: "1em",
|
|
10
9
|
display: "inline-block",
|
|
11
10
|
verticalAlign: "middle",
|
|
12
|
-
flexShrink: 0
|
|
11
|
+
flexShrink: 0
|
|
13
12
|
};
|
|
13
|
+
var customIcons = {};
|
|
14
|
+
if (typeof window === "undefined") {
|
|
15
|
+
try {
|
|
16
|
+
customIcons = require("../../../../../../customIcons.json");
|
|
17
|
+
}
|
|
18
|
+
catch (err) {
|
|
19
|
+
customIcons = {};
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
export var iconMap = __assign(__assign({}, defaultIcons), customIcons);
|
|
14
23
|
export var Icon = function (_a) {
|
|
15
24
|
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"]);
|
|
16
25
|
var iconComponent = name ? iconMap[name] : customIcon;
|