albinasoft-ui-package 1.0.62 → 1.0.63

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.
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React from "react";
2
2
  declare enum TextType {
3
3
  BOLDHEAD = "boldhead",
4
4
  HEADING = "heading",
@@ -79,9 +79,7 @@ var Color;
79
79
  exports.Color = Color;
80
80
  var CustomText = function (_a) {
81
81
  var _b;
82
- var id = _a.id, value = _a.value, _c = _a.className, className = _c === void 0 ? '' : _c, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.textType, textType = _e === void 0 ? TextType.PARAGRAPH : _e, // Varsayılan olarak 'paragraph'
83
- color = _a.color, textAlign = _a.textAlign, fontSize = _a.fontSize, lineHeight = _a.lineHeight, fontWeight = _a.fontWeight, _f = _a.underline, underline = _f === void 0 ? false : _f, _g = _a.overline, overline = _g === void 0 ? false : _g, _h = _a.linethrough, linethrough = _h === void 0 ? false : _h, _j = _a.italic, italic = _j === void 0 ? false : _j, textAlignClass = _a.textAlignClass, linkText = _a.linkText;
84
- // Varsayılan stiller
82
+ var id = _a.id, value = _a.value, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.style, style = _d === void 0 ? {} : _d, _e = _a.textType, textType = _e === void 0 ? TextType.PARAGRAPH : _e, color = _a.color, textAlign = _a.textAlign, fontSize = _a.fontSize, lineHeight = _a.lineHeight, fontWeight = _a.fontWeight, _f = _a.underline, underline = _f === void 0 ? false : _f, _g = _a.overline, overline = _g === void 0 ? false : _g, _h = _a.linethrough, linethrough = _h === void 0 ? false : _h, _j = _a.italic, italic = _j === void 0 ? false : _j, textAlignClass = _a.textAlignClass, linkText = _a.linkText;
85
83
  var defaultStyles = (_b = {},
86
84
  _b[TextType.BOLDHEAD] = {
87
85
  fontSize: FontSize.XL,
@@ -104,7 +102,6 @@ var CustomText = function (_a) {
104
102
  fontWeight: FontWeight.THIN,
105
103
  },
106
104
  _b);
107
- // Dinamik sınıf ekleme
108
105
  if (textType == TextType.BOLDHEAD && !color) {
109
106
  color = Color.DARK;
110
107
  }
@@ -126,31 +123,36 @@ var CustomText = function (_a) {
126
123
  else if (textAlign == TextAlign.END) {
127
124
  textAlignClass = "text-end";
128
125
  }
129
- // Text decoration birleştirme
130
126
  var textDecoration = [
131
- underline ? 'underline' : '',
132
- overline ? 'overline' : '',
133
- linethrough ? 'line-through' : '',
127
+ underline ? "underline" : "",
128
+ overline ? "overline" : "",
129
+ linethrough ? "line-through" : "",
134
130
  ]
135
131
  .filter(Boolean)
136
- .join(' ');
137
- // Varsayılan stil ile kullanıcı stilini birleştir
138
- var combinedStyle = __assign(__assign(__assign({}, defaultStyles[textType]), { textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : defaultStyles[textType].textAlign, fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : defaultStyles[textType].fontSize, lineHeight: lineHeight !== null && lineHeight !== void 0 ? lineHeight : defaultStyles[textType].lineHeight, fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : defaultStyles[textType].fontWeight, textDecoration: textDecoration || undefined, fontStyle: italic ? 'italic' : undefined }), style);
132
+ .join(" ");
133
+ var combinedStyle = __assign(__assign(__assign({}, defaultStyles[textType]), { textAlign: textAlign !== null && textAlign !== void 0 ? textAlign : defaultStyles[textType].textAlign, fontSize: fontSize !== null && fontSize !== void 0 ? fontSize : defaultStyles[textType].fontSize, lineHeight: lineHeight !== null && lineHeight !== void 0 ? lineHeight : defaultStyles[textType].lineHeight, fontWeight: fontWeight !== null && fontWeight !== void 0 ? fontWeight : defaultStyles[textType].fontWeight, textDecoration: textDecoration || undefined, fontStyle: italic ? "italic" : undefined }), style);
139
134
  var combinedClassName = "".concat(color, " ").concat(className).trim();
140
- // URL'leri tıklanabilir hale getirme
141
- var renderWithLinks = function (text, linkText) {
142
- var urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g; // URL'leri algılayan RegEx
143
- var parts = text.split(urlRegex);
144
- return parts.map(function (part, index) {
145
- return urlRegex.test(part) ? (react_1.default.createElement("a", { key: index, href: part.startsWith('http') ? part : "https://".concat(part), target: "_blank", rel: "noopener noreferrer", style: { wordBreak: 'break-all' } },
146
- linkText || part.replace(/https?:\/\/|www\.|\/$/g, ''),
147
- " ")) : (part);
135
+ /**
136
+ * Metindeki düz linkleri `<a>` etiketi ile sarmalar ve HTML olarak render eder.
137
+ */
138
+ var processTextWithLinks = function (text, linkText) {
139
+ if (typeof text !== "string")
140
+ return text;
141
+ // URL regex
142
+ var urlRegex = /(https?:\/\/[^\s]+|www\.[^\s]+)/g;
143
+ // Önce tüm satırları parçala (HTML olarak yazıldıysa çalışsın)
144
+ return text
145
+ .split("\n")
146
+ .map(function (line, lineIndex) {
147
+ // Metin içinde link var mı kontrol et
148
+ var parts = line.split(urlRegex);
149
+ return (react_1.default.createElement("p", { key: lineIndex, style: { margin: "0" } }, parts.map(function (part, index) {
150
+ return urlRegex.test(part) ? (react_1.default.createElement("a", { key: index, href: part.startsWith("http") ? part : "https://".concat(part), target: "_blank", rel: "noopener noreferrer", style: { wordBreak: "break-word", color: "#007bff" } }, linkText || part.replace(/https?:\/\/|www\.|\/$/g, ""))) : (react_1.default.createElement("span", { dangerouslySetInnerHTML: { __html: part }, key: index }));
151
+ })));
148
152
  });
149
153
  };
150
154
  return (react_1.default.createElement("div", { className: "".concat(textAlignClass) },
151
- react_1.default.createElement("span", { id: id || "custom-text-".concat(Date.now()), className: "custom-text ".concat(combinedClassName), style: combinedStyle },
152
- renderWithLinks(value, linkText),
153
- " ")));
155
+ react_1.default.createElement("span", { id: id || "custom-text-".concat(Date.now()), className: "custom-text ".concat(combinedClassName), style: combinedStyle }, processTextWithLinks(value, linkText))));
154
156
  };
155
157
  exports.CustomText = CustomText;
156
158
  exports.default = CustomText;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "albinasoft-ui-package",
3
- "version": "1.0.62",
3
+ "version": "1.0.63",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "scripts": {