wini-web-components 1.7.7 → 1.7.8

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.
@@ -50,7 +50,7 @@ var Checkbox = /** @class */ (function (_super) {
50
50
  };
51
51
  Checkbox.prototype.render = function () {
52
52
  var _this = this;
53
- var _a, _b, _c, _d, _e;
53
+ var _a, _b, _c;
54
54
  var convertStyle = {
55
55
  width: (_a = this.props.size) !== null && _a !== void 0 ? _a : '2.4rem',
56
56
  height: (_b = this.props.size) !== null && _b !== void 0 ? _b : '2.4rem',
@@ -72,9 +72,9 @@ var Checkbox = /** @class */ (function (_super) {
72
72
  if (_this.props.onChange)
73
73
  _this.props.onChange(newValue);
74
74
  } }),
75
- react_1.default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, this.state.value == undefined ?
76
- react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.79199 9.95298C4.79199 9.69148 5.00398 9.47949 5.26548 9.47949H14.7352C14.9967 9.47949 15.2087 9.69148 15.2087 9.95298C15.2087 10.2145 14.9967 10.4265 14.7352 10.4265H5.26548C5.00398 10.4265 4.79199 10.2145 4.79199 9.95298Z", fill: (_d = this.props.checkColor) !== null && _d !== void 0 ? _d : '#ffffff' }) :
77
- react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.07 6.49317C15.2549 6.67808 15.2549 6.97787 15.07 7.16278L8.91467 13.3181C8.72977 13.503 8.42997 13.503 8.24507 13.3181L4.93067 10.0037C4.74577 9.81878 4.74577 9.51899 4.93067 9.33408C5.11558 9.14917 5.41537 9.14917 5.60028 9.33408L8.57987 12.3137L14.4004 6.49317C14.5853 6.30827 14.8851 6.30827 15.07 6.49317Z", fill: (_e = this.props.checkColor) !== null && _e !== void 0 ? _e : '#ffffff' })));
75
+ react_1.default.createElement("svg", { width: "100%", height: "100%", viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", style: { '--check-color': this.props.checkColor } }, this.state.value == undefined ?
76
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M4.79199 9.95298C4.79199 9.69148 5.00398 9.47949 5.26548 9.47949H14.7352C14.9967 9.47949 15.2087 9.69148 15.2087 9.95298C15.2087 10.2145 14.9967 10.4265 14.7352 10.4265H5.26548C5.00398 10.4265 4.79199 10.2145 4.79199 9.95298Z" }) :
77
+ react_1.default.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M15.07 6.49317C15.2549 6.67808 15.2549 6.97787 15.07 7.16278L8.91467 13.3181C8.72977 13.503 8.42997 13.503 8.24507 13.3181L4.93067 10.0037C4.74577 9.81878 4.74577 9.51899 4.93067 9.33408C5.11558 9.14917 5.41537 9.14917 5.60028 9.33408L8.57987 12.3137L14.4004 6.49317C14.5853 6.30827 14.8851 6.30827 15.07 6.49317Z" })));
78
78
  };
79
79
  return Checkbox;
80
80
  }(react_1.default.Component));
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { CSSProperties, ReactNode } from "react";
2
+ import { CSSProperties } from "react";
3
3
  interface WiniconProps {
4
- svg: ReactNode;
4
+ src?: string;
5
+ link?: string;
5
6
  className?: string;
6
7
  style?: CSSProperties;
7
8
  size?: number | string;
8
9
  color?: string;
9
10
  }
10
- export default function Winicon({ svg, className, style, size, color }: WiniconProps): React.JSX.Element;
11
+ export declare function Winicon({ src, link, className, style, size, color }: WiniconProps): React.JSX.Element;
11
12
  export {};
@@ -1,15 +1,112 @@
1
1
  "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ var __generator = (this && this.__generator) || function (thisArg, body) {
46
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
47
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
48
+ function verb(n) { return function (v) { return step([n, v]); }; }
49
+ function step(op) {
50
+ if (f) throw new TypeError("Generator is already executing.");
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
52
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
53
+ if (y = 0, t) op = [op[0] & 2, t.value];
54
+ switch (op[0]) {
55
+ case 0: case 1: t = op; break;
56
+ case 4: _.label++; return { value: op[1], done: false };
57
+ case 5: _.label++; y = op[1]; op = [0]; continue;
58
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
59
+ default:
60
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
61
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
62
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
63
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
64
+ if (t[2]) _.ops.pop();
65
+ _.trys.pop(); continue;
66
+ }
67
+ op = body.call(thisArg, _);
68
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
69
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
70
+ }
71
+ };
2
72
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
74
  };
5
75
  Object.defineProperty(exports, "__esModule", { value: true });
6
- var react_1 = __importDefault(require("react"));
76
+ exports.Winicon = void 0;
77
+ var react_1 = __importStar(require("react"));
78
+ var winicon_module_css_1 = __importDefault(require("./winicon.module.css"));
7
79
  function Winicon(_a) {
8
- var svg = _a.svg, className = _a.className, style = _a.style, size = _a.size, color = _a.color;
9
- var modifiedSvg = react_1.default.cloneElement(svg, {
10
- size: size,
11
- fill: color, // Apply color to the fill attribute of the SVG
12
- });
13
- return react_1.default.createElement("div", { className: "wini-icon ".concat(className !== null && className !== void 0 ? className : ''), style: style }, modifiedSvg);
80
+ var _this = this;
81
+ var src = _a.src, link = _a.link, className = _a.className, style = _a.style, size = _a.size, color = _a.color;
82
+ var _b = (0, react_1.useState)(), svgData = _b[0], setSvgData = _b[1];
83
+ var cdnSrc = "https://cdn.jsdelivr.net/gh/WiniGit/wini-icons@latest/icons/";
84
+ (0, react_1.useEffect)(function () {
85
+ if (src) {
86
+ fetch(cdnSrc + src + ".svg").then(function (res) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
87
+ switch (_b.label) {
88
+ case 0:
89
+ _a = setSvgData;
90
+ return [4 /*yield*/, res.text()];
91
+ case 1:
92
+ _a.apply(void 0, [_b.sent()]);
93
+ return [2 /*return*/];
94
+ }
95
+ }); }); });
96
+ }
97
+ else if (link) {
98
+ fetch(link).then(function (res) { return __awaiter(_this, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
99
+ switch (_b.label) {
100
+ case 0:
101
+ _a = setSvgData;
102
+ return [4 /*yield*/, res.text()];
103
+ case 1:
104
+ _a.apply(void 0, [_b.sent()]);
105
+ return [2 /*return*/];
106
+ }
107
+ }); }); });
108
+ }
109
+ }, [src, link]);
110
+ return react_1.default.createElement("div", { className: "".concat(winicon_module_css_1.default['wini-icon'], " ").concat(className !== null && className !== void 0 ? className : ''), style: (style ? __assign(__assign({}, style), { '--size': size, '--color': color }) : { '--size': size, '--color': color }), dangerouslySetInnerHTML: { __html: svgData !== null && svgData !== void 0 ? svgData : '' } });
14
111
  }
15
- exports.default = Winicon;
112
+ exports.Winicon = Winicon;
package/dist/index.d.ts CHANGED
@@ -26,5 +26,6 @@ import { CustomSlider } from './component/slider/slider';
26
26
  import { ToastContainer } from 'react-toastify';
27
27
  import { Button } from './component/button/button';
28
28
  import { Tag } from './component/tag/tag';
29
- export { Calendar, CalendarType, ComponentStatus, getStatusIcon, Checkbox, Select1, Switch, Popup, showPopup, closePopup, Dialog, showDialog, DialogAlignment, DatePicker, SelectMultiple, ProgressBar, Text, Pagination, Table, TbCell, TbHeader, TbBody, TbRow, CellAlignItems, TextField, RadioButton, TextArea, ImportFile, ToastMessage, InfiniteScroll, Rating, ProgressCircle, CustomSlider, ToastContainer, Button, Tag };
29
+ import { Winicon } from './component/wini-icon/winicon';
30
+ export { Calendar, CalendarType, ComponentStatus, getStatusIcon, Checkbox, Select1, Switch, Popup, showPopup, closePopup, Dialog, showDialog, DialogAlignment, DatePicker, SelectMultiple, ProgressBar, Text, Pagination, Table, TbCell, TbHeader, TbBody, TbRow, CellAlignItems, TextField, RadioButton, TextArea, ImportFile, ToastMessage, InfiniteScroll, Rating, ProgressCircle, CustomSlider, ToastContainer, Button, Tag, Winicon };
30
31
  export type { OptionsItem };