@uiw/react-icon
Advanced tools
Comparing version 4.21.28 to 4.22.0
import React from 'react'; | ||
import svgPaths from '@uiw/icons/fonts/w-icon.json'; | ||
import './style/index.less'; | ||
export declare type IconsName = keyof typeof svgPaths; | ||
declare type TagType = React.ComponentType | keyof JSX.IntrinsicElements; | ||
export interface IconProps<Tag extends TagType = 'span', E = React.ReactElement> extends React.HTMLAttributes<Tag> { | ||
export type IconsName = keyof typeof svgPaths; | ||
export type IconTagType = React.ElementType | keyof JSX.IntrinsicElements; | ||
type ElementProps<T extends IconTagType, E = React.ReactElement> = { | ||
fill?: string; | ||
style?: React.CSSProperties; | ||
@@ -14,3 +15,3 @@ className?: string; | ||
*/ | ||
tagName?: Tag; | ||
tagName?: T; | ||
type?: IconsName | null | E; | ||
@@ -20,4 +21,5 @@ spin?: boolean; | ||
verticalAlign?: 'middle' | 'baseline'; | ||
} | ||
export default function Icon<Tag extends TagType = 'span'>(props: IconProps<Tag>): React.ReactElement<{}, string | React.JSXElementConstructor<any>> | null; | ||
export {}; | ||
}; | ||
export type IconProps<T extends IconTagType> = ElementProps<T> & React.ComponentPropsWithoutRef<T>; | ||
declare const Icon: <T extends IconTagType = "span">(props: IconProps<T>) => React.JSX.Element; | ||
export default Icon; |
@@ -7,3 +7,3 @@ "use strict"; | ||
}); | ||
exports["default"] = Icon; | ||
exports["default"] = void 0; | ||
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2")); | ||
@@ -14,4 +14,4 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties")); | ||
var _jsxRuntime = require("react/jsx-runtime"); | ||
var _excluded = ["className", "prefixCls", "verticalAlign", "tagName", "color", "type", "spin"]; | ||
function Icon(props) { | ||
var _excluded = ["className", "prefixCls", "verticalAlign", "tagName", "color", "type", "spin", "style"]; | ||
var Icon = function Icon(props) { | ||
var className = props.className, | ||
@@ -23,3 +23,3 @@ _props$prefixCls = props.prefixCls, | ||
_props$tagName = props.tagName, | ||
TagName = _props$tagName === void 0 ? 'span' : _props$tagName, | ||
Element = _props$tagName === void 0 ? 'span' : _props$tagName, | ||
color = props.color, | ||
@@ -29,7 +29,8 @@ type = props.type, | ||
spin = _props$spin === void 0 ? false : _props$spin, | ||
others = (0, _objectWithoutProperties2["default"])(props, _excluded); | ||
style = props.style, | ||
reset = (0, _objectWithoutProperties2["default"])(props, _excluded); | ||
var svg = null; | ||
if (typeof type === 'string') { | ||
svg = /*#__PURE__*/(0, _jsxRuntime.jsx)("svg", { | ||
fill: color, | ||
fill: color || props.fill, | ||
viewBox: "0 0 20 20", | ||
@@ -43,18 +44,16 @@ children: (_wIcon["default"][type] || []).map(function (d, i) { | ||
}); | ||
} else if ( /*#__PURE__*/_react["default"].isValidElement(type)) { | ||
svg = /*#__PURE__*/_react["default"].cloneElement(type, { | ||
fill: color | ||
}); | ||
} else { | ||
return null; | ||
} | ||
others.style = (0, _objectSpread2["default"])({ | ||
var initStyle = (0, _objectSpread2["default"])({ | ||
fill: 'currentColor' | ||
}, others.style); | ||
var propps = (0, _objectSpread2["default"])((0, _objectSpread2["default"])({}, others), {}, { | ||
className: [prefixCls, className, prefixCls && verticalAlign ? "".concat(prefixCls, "-").concat(verticalAlign) : null, spin && prefixCls ? "".concat(prefixCls, "-spin") : null].filter(Boolean).join(' ').trim() | ||
}); | ||
return /*#__PURE__*/_react["default"].createElement(TagName, (0, _objectSpread2["default"])({}, propps), svg); | ||
} | ||
module.exports = exports.default; | ||
//# sourceMappingURL=index.js.map | ||
}, style); | ||
var cls = [prefixCls, className, prefixCls && verticalAlign ? "".concat(prefixCls, "-").concat(verticalAlign) : null, spin && prefixCls ? "".concat(prefixCls, "-spin") : null].filter(Boolean).join(' ').trim(); | ||
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Element, (0, _objectSpread2["default"])((0, _objectSpread2["default"])({ | ||
className: cls | ||
}, reset), {}, { | ||
style: initStyle, | ||
children: svg | ||
})); | ||
}; | ||
var _default = Icon; | ||
exports["default"] = _default; | ||
module.exports = exports.default; |
import React from 'react'; | ||
import svgPaths from '@uiw/icons/fonts/w-icon.json'; | ||
import './style/index.less'; | ||
export declare type IconsName = keyof typeof svgPaths; | ||
declare type TagType = React.ComponentType | keyof JSX.IntrinsicElements; | ||
export interface IconProps<Tag extends TagType = 'span', E = React.ReactElement> extends React.HTMLAttributes<Tag> { | ||
export type IconsName = keyof typeof svgPaths; | ||
export type IconTagType = React.ElementType | keyof JSX.IntrinsicElements; | ||
type ElementProps<T extends IconTagType, E = React.ReactElement> = { | ||
fill?: string; | ||
style?: React.CSSProperties; | ||
@@ -14,3 +15,3 @@ className?: string; | ||
*/ | ||
tagName?: Tag; | ||
tagName?: T; | ||
type?: IconsName | null | E; | ||
@@ -20,4 +21,5 @@ spin?: boolean; | ||
verticalAlign?: 'middle' | 'baseline'; | ||
} | ||
export default function Icon<Tag extends TagType = 'span'>(props: IconProps<Tag>): React.ReactElement<{}, string | React.JSXElementConstructor<any>> | null; | ||
export {}; | ||
}; | ||
export type IconProps<T extends IconTagType> = ElementProps<T> & React.ComponentPropsWithoutRef<T>; | ||
declare const Icon: <T extends IconTagType = "span">(props: IconProps<T>) => React.JSX.Element; | ||
export default Icon; |
import _extends from "@babel/runtime/helpers/extends"; | ||
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose"; | ||
var _excluded = ["className", "prefixCls", "verticalAlign", "tagName", "color", "type", "spin"]; | ||
var _excluded = ["className", "prefixCls", "verticalAlign", "tagName", "color", "type", "spin", "style"]; | ||
import React from 'react'; | ||
@@ -8,3 +8,3 @@ import svgPaths from '@uiw/icons/fonts/w-icon.json'; | ||
import { jsx as _jsx } from "react/jsx-runtime"; | ||
export default function Icon(props) { | ||
var Icon = props => { | ||
var { | ||
@@ -14,12 +14,13 @@ className, | ||
verticalAlign = 'middle', | ||
tagName: TagName = 'span', | ||
tagName: Element = 'span', | ||
color, | ||
type, | ||
spin = false | ||
spin = false, | ||
style | ||
} = props, | ||
others = _objectWithoutPropertiesLoose(props, _excluded); | ||
reset = _objectWithoutPropertiesLoose(props, _excluded); | ||
var svg = null; | ||
if (typeof type === 'string') { | ||
svg = /*#__PURE__*/_jsx("svg", { | ||
fill: color, | ||
fill: color || props.fill, | ||
viewBox: "0 0 20 20", | ||
@@ -31,17 +32,14 @@ children: (svgPaths[type] || []).map((d, i) => /*#__PURE__*/_jsx("path", { | ||
}); | ||
} else if ( /*#__PURE__*/React.isValidElement(type)) { | ||
svg = /*#__PURE__*/React.cloneElement(type, { | ||
fill: color | ||
}); | ||
} else { | ||
return null; | ||
} | ||
others.style = _extends({ | ||
var initStyle = _extends({ | ||
fill: 'currentColor' | ||
}, others.style); | ||
var propps = _extends({}, others, { | ||
className: [prefixCls, className, prefixCls && verticalAlign ? prefixCls + "-" + verticalAlign : null, spin && prefixCls ? prefixCls + "-spin" : null].filter(Boolean).join(' ').trim() | ||
}); | ||
return /*#__PURE__*/React.createElement(TagName, _extends({}, propps), svg); | ||
} | ||
//# sourceMappingURL=index.js.map | ||
}, style); | ||
var cls = [prefixCls, className, prefixCls && verticalAlign ? prefixCls + "-" + verticalAlign : null, spin && prefixCls ? prefixCls + "-spin" : null].filter(Boolean).join(' ').trim(); | ||
return /*#__PURE__*/_jsx(Element, _extends({ | ||
className: cls | ||
}, reset, { | ||
style: initStyle, | ||
children: svg | ||
})); | ||
}; | ||
export default Icon; |
{ | ||
"name": "@uiw/react-icon", | ||
"version": "4.21.28", | ||
"version": "4.22.0", | ||
"description": "Icon component", | ||
@@ -5,0 +5,0 @@ "author": "Kenny Wong <wowohoo@qq.com>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33016
12