@geneui/components
Version:
The Gene UI components library designed for BI tools
63 lines (59 loc) • 3.25 kB
JavaScript
import { _ as _extends } from '../_rollupPluginBabelHelpers-e8fb2e5c.js';
import React__default from 'react';
import { c as classnames } from '../index-031ff73c.js';
import PropTypes from 'prop-types';
import { s as styleInject } from '../style-inject.es-746bb8ed.js';
var css_248z = "[data-gene-ui-version=\"2.16.5\"] .icon{display:block;font-size:2.4rem}[data-gene-ui-version=\"2.16.5\"] .icon.disabled{opacity:.5;pointer-events:none}[data-gene-ui-version=\"2.16.5\"] .icon.bc-icon-loader{overflow:hidden}[data-gene-ui-version=\"2.16.5\"] .icon.bc-icon-loader:before{animation:loader-icon .3s linear infinite;display:block}@keyframes loader-icon{to{transform:rotate(1turn)}}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-arrow-right-nav:before{content:\"\\e906\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-arrow-left-nav:before{content:\"\\e90a\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-arrow-right:before{content:\"\\e907\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-arrow-left:before{content:\"\\e90b\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-arrow-forward:before{content:\"\\e901\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-left-outline:before{content:\"\\e959\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-right-outline:before{content:\"\\e955\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-forwards:before{content:\"\\e95b\"}[data-gene-ui-version=\"2.16.5\"] [dir=rtl] .bc-icon-backwards:before{content:\"\\e95a\"}";
styleInject(css_248z);
// This this because in production we need to replace 'nonames.com' with host
// but in development mode we need to put 'nonames.com'
function getMainHost() {
const parts = window.location.host.split('.');
if (parts.length < 2) return 'nonamens.com';
return "".concat(parts[parts.length - 2], ".").concat(parts[parts.length - 1]);
}
const host = process.env.REACT_APP_ICON_URL || process.env.REACT_APP_NODE === 'production' ? getMainHost() : 'nonamens.com';
if (process.env.REACT_APP_CUSTOM_ICON_URL) {
document.head.appendChild(document.createElement('style')).textContent = "@import url('".concat(window.location.protocol, "//").concat(window.location.host, "/core-icons/import.css?v=").concat(Math.floor(Math.random() * 666) + 1);
} else {
document.head.appendChild(document.createElement('style')).textContent = "@import url('https://sharedassets.".concat(host, "/core-icons/import.css?v=").concat(Math.floor(Math.random() * 666) + 1);
}
function Icon(_ref) {
let {
type,
disabled,
className,
isFilled,
...restProps
} = _ref;
return /*#__PURE__*/React__default.createElement("i", _extends({}, restProps, {
className: classnames('icon', className, {
[type]: !!type,
disabled
})
}));
}
Icon.propTypes = {
/**
* Type is the exact icon. You can find valid "type" values in the documentation example
*/
type: PropTypes.string,
/**
* Additional className
*/
className: PropTypes.string,
/**
* Icon disabled state
*/
disabled: PropTypes.bool,
/**
* Will fill the icon when set to "true"
*/
isFilled: PropTypes.bool
};
Icon.defaultProps = {
disabled: false,
isFilled: false,
type: ''
};
export { Icon as default };