@sydsoft/base 1.6.0 → 1.7.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,22 @@
1
+ export declare const iconMap: {
2
+ close: {
3
+ viewBox: string;
4
+ content: string;
5
+ };
6
+ search: {
7
+ viewBox: string;
8
+ content: string;
9
+ };
10
+ edit: {
11
+ content: string;
12
+ viewBox: string;
13
+ };
14
+ keyboard_arrow_up: {
15
+ content: string;
16
+ viewBox: string;
17
+ };
18
+ keyboard_arrow_down: {
19
+ content: string;
20
+ viewBox: string;
21
+ };
22
+ };
@@ -0,0 +1,22 @@
1
+ export var iconMap = {
2
+ close: {
3
+ viewBox: "0 -960 960 960",
4
+ content: '<path d="m336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z"/>'
5
+ },
6
+ search: {
7
+ viewBox: "0 0 24 24",
8
+ content: '<path d="M0 0h24v24H0V0z" fill="none"/><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"/>'
9
+ },
10
+ edit: {
11
+ content: '<path d="M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z" />',
12
+ viewBox: "0 -960 960 960"
13
+ },
14
+ keyboard_arrow_up: {
15
+ content: '<path d="M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z"/>',
16
+ viewBox: "0 -960 960 960"
17
+ },
18
+ keyboard_arrow_down: {
19
+ content: '<path d="M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z"/>',
20
+ viewBox: "0 -960 960 960"
21
+ }
22
+ };
@@ -1,34 +1,25 @@
1
1
  import React from "react";
2
- export declare const iconMap: {
3
- close: {
4
- viewBox: string;
5
- content: string;
6
- };
7
- search: {
8
- viewBox: string;
9
- content: string;
10
- };
11
- edit: {
12
- content: string;
13
- viewBox: string;
14
- };
15
- keyboard_arrow_up: {
16
- content: string;
17
- viewBox: string;
18
- };
19
- keyboard_arrow_down: {
20
- content: string;
21
- viewBox: string;
22
- };
23
- };
2
+ import { iconMap } from "./icons";
3
+ export declare const iconList: ("search" | "close" | "edit" | "keyboard_arrow_up" | "keyboard_arrow_down")[];
24
4
  export type IconName = keyof typeof iconMap;
25
- interface Props {
26
- name: IconName;
5
+ interface BaseProps {
27
6
  color?: string;
28
7
  fontSize?: number | string;
29
8
  style?: React.CSSProperties;
30
9
  className?: string;
31
10
  [key: string]: any;
32
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;
33
24
  export declare const Icon: React.FC<Props>;
34
25
  export {};
@@ -1,22 +1,18 @@
1
1
  import { __assign, __rest } from "tslib";
2
2
  import { jsx as _jsx } from "react/jsx-runtime";
3
- import icons from "./icons.json";
4
- import { isDev } from "../_lib/baseFunctions";
5
- var customIcons = {};
6
- // Root klasörde customIcons.json varsa yükle
7
- try {
8
- customIcons = require(process.cwd() + "/customIcons.json");
9
- isDev && console.log("customIcons.json yüklendi:", Object.keys(customIcons));
10
- }
11
- catch (err) {
12
- isDev && console.log("customIcons.json bulunamadı, sadece default ikonlar kullanılacak.");
13
- }
14
- // Default ikonlar + custom ikonlar
15
- export var iconMap = __assign(__assign({}, icons), customIcons);
3
+ import { iconMap } from "./icons";
4
+ export var iconList = Object.keys(iconMap);
16
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
+ };
17
14
  export var Icon = function (_a) {
18
- var name = _a.name, fontSize = _a.fontSize, color = _a.color, className = _a.className, style = _a.style, other = __rest(_a, ["name", "fontSize", "color", "className", "style"]);
19
- var defaultStyle = __assign({ userSelect: "none", width: "1em", height: "1em", display: "inline-block", verticalAlign: "middle", fontSize: fontSize || "1.5rem", color: color || "inherit", flexShrink: 0 }, style);
20
- var svgString = iconMap[name];
21
- return (_jsx("span", __assign({ className: className, style: __assign(__assign({}, defaultStyle), style) }, other, { children: (svgString && (_jsx("svg", { viewBox: svgString.viewBox, fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", children: _jsx("g", { dangerouslySetInnerHTML: { __html: svgString.content } }) }))) || _jsx("span", { children: "\u26A0\uFE0F" }) })));
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" }) })));
22
18
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sydsoft/base",
3
3
  "private": false,
4
- "version": "1.6.0",
4
+ "version": "1.7.0",
5
5
  "description": "",
6
6
  "main": "./dist/cjs/index.js",
7
7
  "module": "./dist/esm/index.js",
@@ -11,7 +11,8 @@
11
11
  "README.md"
12
12
  ],
13
13
  "scripts": {
14
- "test": "npm run build && npm pack",
14
+ "test": "rm -rf ../*.tgz && rm -rf ../.next && npm run build && npm pack --pack-destination ../ && cd ../ && npm uninstall @sydsoft/base && npm install *.tgz && npm run dev",
15
+ "buildCommonJS": "rm -rf ./dist && tsc && tsc --module commonjs --outDir ./dist/csj",
15
16
  "copyFiles": "copyfiles -u 2 \"../@base/**/*.css\" dist/esm",
16
17
  "build": "rm -rf ./dist && tsc && npm run copyFiles",
17
18
  "publishNPM": "npm run build && npm version patch && npm version minor && npm publish --dry-run && npm publish --access public"
@@ -1,22 +0,0 @@
1
- {
2
- "close": {
3
- "viewBox": "0 -960 960 960",
4
- "content": "<path d=\"m336-280-56-56 144-144-144-143 56-56 144 144 143-144 56 56-144 143 144 144-56 56-143-144-144 144Z\"/>"
5
- },
6
- "search": {
7
- "viewBox": "0 0 24 24",
8
- "content": "<path d=\"M0 0h24v24H0V0z\" fill=\"none\"/><path d=\"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z\"/>"
9
- },
10
- "edit": {
11
- "content": "<path d=\"M200-200h57l391-391-57-57-391 391v57Zm-80 80v-170l528-527q12-11 26.5-17t30.5-6q16 0 31 6t26 18l55 56q12 11 17.5 26t5.5 30q0 16-5.5 30.5T817-647L290-120H120Zm640-584-56-56 56 56Zm-141 85-28-29 57 57-29-28Z\" />",
12
- "viewBox": "0 -960 960 960"
13
- },
14
- "keyboard_arrow_up": {
15
- "content": "<path d=\"M480-528 296-344l-56-56 240-240 240 240-56 56-184-184Z\"/>",
16
- "viewBox": "0 -960 960 960"
17
- },
18
- "keyboard_arrow_down": {
19
- "content": "<path d=\"M480-344 240-584l56-56 184 184 184-184 56 56-240 240Z\"/>",
20
- "viewBox": "0 -960 960 960"
21
- }
22
- }