@eubank/kit-button
Advanced tools
Comparing version 0.0.13 to 0.0.14
@@ -11,4 +11,4 @@ import { HTMLProps, ReactNode } from 'react'; | ||
htmlType?: 'button' | 'submit' | 'reset' | undefined; | ||
children?: ReactNode; | ||
loaderSize?: number; | ||
children?: ReactNode | string; | ||
loaderSize?: 's' | 'm' | 'l'; | ||
leftIcon?: ReactNode; | ||
@@ -15,0 +15,0 @@ rightIcon?: ReactNode; |
'use strict'; | ||
//# sourceMappingURL=button.types.js.map |
@@ -9,3 +9,2 @@ 'use strict'; | ||
var kitLoader = require('@eubank/kit-loader'); | ||
var index_module = require('./index.module.scss.js'); | ||
@@ -32,9 +31,6 @@ require('./styles.css'); | ||
const loaderSizeConfig = { | ||
s: 15, | ||
m: 17, | ||
l: 19 | ||
}; | ||
var cls = {"root":"eub-button_root__8kw4","primary":"eub-button_primary__MdPD","focus":"eub-button_focus__9JcN","loading":"eub-button_loading__KqU7","outline":"eub-button_outline__xJzt","ghost":"eub-button_ghost__D8J6","link":"eub-button_link__o-v2","s":"eub-button_s__Rg-m","onlyIcon":"eub-button_onlyIcon__P1GG","m":"eub-button_m__n6cI","l":"eub-button_l__e56g","roundness-s":"eub-button_roundness-s__TZ5R","roundness-m":"eub-button_roundness-m__Spzp","roundness-l":"eub-button_roundness-l__Q-h1","block":"eub-button_block__utN8","noPadding":"eub-button_noPadding__qgFO"}; | ||
const Button = React__namespace.forwardRef((props, ref) => { | ||
const { loading, children, size = 'm', roundness = 's', type = 'primary', htmlType = 'button', block = false, noPadding = false, loaderSize, leftIcon, rightIcon, className, href, onClick, disabled, classes = {} } = props, rest = tslib.__rest(props, ["loading", "children", "size", "roundness", "type", "htmlType", "block", "noPadding", "loaderSize", "leftIcon", "rightIcon", "className", "href", "onClick", "disabled", "classes"]); | ||
const { loading, children, size = 'm', roundness = 's', type = 'primary', htmlType = 'button', block = false, noPadding = false, loaderSize = 'm', leftIcon, rightIcon, className, href, onClick, disabled, classes = {} } = props, rest = tslib.__rest(props, ["loading", "children", "size", "roundness", "type", "htmlType", "block", "noPadding", "loaderSize", "leftIcon", "rightIcon", "className", "href", "onClick", "disabled", "classes"]); | ||
const buttonRef = React.useRef(null); | ||
@@ -51,12 +47,13 @@ const [focus] = kitHooks.useFocus(buttonRef, 'keyboard'); | ||
}; | ||
return (React__namespace.createElement("button", Object.assign({ ref: kitUtils.mergeRefs([ref, buttonRef]), type: htmlType, className: clsx(index_module.default.root, index_module.default[type], index_module.default[size], index_module.default[`roundness-${roundness}`], { | ||
[index_module.default.focus]: focus, | ||
[index_module.default.block]: block, | ||
[index_module.default.noPadding]: noPadding, | ||
[index_module.default.loading]: loading, | ||
[index_module.default.onlyIcon]: isOnlyIcon | ||
return (React__namespace.createElement("button", Object.assign({ ref: kitUtils.mergeRefs([ref, buttonRef]), type: htmlType, className: clsx(cls.root, cls[type], cls[size], cls[`roundness-${roundness}`], { | ||
[cls.focus]: focus, | ||
[cls.block]: block, | ||
[cls.noPadding]: noPadding, | ||
[cls.loading]: loading, | ||
[cls.onlyIcon]: isOnlyIcon | ||
}, className, classes === null || classes === void 0 ? void 0 : classes.root), onClick: loading || disabled ? undefined : handleClick, disabled: disabled, tabIndex: disabled || loading ? -1 : undefined }, rest), | ||
loading && React__namespace.createElement(kitLoader.Loader, { fill: false, size: loaderSize !== null && loaderSize !== void 0 ? loaderSize : loaderSizeConfig[size], className: classes === null || classes === void 0 ? void 0 : classes.loader }), | ||
loading && (React__namespace.createElement("span", { className: clsx(cls.loader) }, | ||
React__namespace.createElement(kitLoader.Loader, { size: loaderSize, variant: type === 'primary' ? 'secondary' : 'primary' }))), | ||
(!loading && leftIcon) || null, | ||
children, | ||
typeof children === 'string' && children.length >= 32 ? children.substring(0, 29) + '...' : children, | ||
rightIcon)); | ||
@@ -66,2 +63,1 @@ }); | ||
exports.Button = Button; | ||
//# sourceMappingURL=Component.js.map |
'use strict'; | ||
var Component = require('./Component.js'); | ||
require('tslib'); | ||
require('react'); | ||
require('clsx'); | ||
require('@eubank/kit-hooks'); | ||
require('@eubank/kit-utils'); | ||
require('@eubank/kit-loader'); | ||
@@ -8,2 +14,1 @@ | ||
exports.Button = Component.Button; | ||
//# sourceMappingURL=index.js.map |
@@ -11,4 +11,4 @@ import { HTMLProps, ReactNode } from 'react'; | ||
htmlType?: 'button' | 'submit' | 'reset' | undefined; | ||
children?: ReactNode; | ||
loaderSize?: number; | ||
children?: ReactNode | string; | ||
loaderSize?: 's' | 'm' | 'l'; | ||
leftIcon?: ReactNode; | ||
@@ -15,0 +15,0 @@ rightIcon?: ReactNode; |
//# sourceMappingURL=button.types.js.map |
@@ -8,12 +8,8 @@ import { __rest } from 'tslib'; | ||
import { Loader } from '@eubank/kit-loader'; | ||
import cls from './index.module.scss.js'; | ||
import './styles.css'; | ||
const loaderSizeConfig = { | ||
s: 15, | ||
m: 17, | ||
l: 19 | ||
}; | ||
const cls = {"root":"eub-button_root__8kw4","primary":"eub-button_primary__MdPD","focus":"eub-button_focus__9JcN","loading":"eub-button_loading__KqU7","outline":"eub-button_outline__xJzt","ghost":"eub-button_ghost__D8J6","link":"eub-button_link__o-v2","s":"eub-button_s__Rg-m","onlyIcon":"eub-button_onlyIcon__P1GG","m":"eub-button_m__n6cI","l":"eub-button_l__e56g","roundness-s":"eub-button_roundness-s__TZ5R","roundness-m":"eub-button_roundness-m__Spzp","roundness-l":"eub-button_roundness-l__Q-h1","block":"eub-button_block__utN8","noPadding":"eub-button_noPadding__qgFO"}; | ||
const Button = React.forwardRef((props, ref) => { | ||
const { loading, children, size = 'm', roundness = 's', type = 'primary', htmlType = 'button', block = false, noPadding = false, loaderSize, leftIcon, rightIcon, className, href, onClick, disabled, classes = {} } = props, rest = __rest(props, ["loading", "children", "size", "roundness", "type", "htmlType", "block", "noPadding", "loaderSize", "leftIcon", "rightIcon", "className", "href", "onClick", "disabled", "classes"]); | ||
const { loading, children, size = 'm', roundness = 's', type = 'primary', htmlType = 'button', block = false, noPadding = false, loaderSize = 'm', leftIcon, rightIcon, className, href, onClick, disabled, classes = {} } = props, rest = __rest(props, ["loading", "children", "size", "roundness", "type", "htmlType", "block", "noPadding", "loaderSize", "leftIcon", "rightIcon", "className", "href", "onClick", "disabled", "classes"]); | ||
const buttonRef = useRef(null); | ||
@@ -37,5 +33,6 @@ const [focus] = useFocus(buttonRef, 'keyboard'); | ||
}, className, classes === null || classes === void 0 ? void 0 : classes.root), onClick: loading || disabled ? undefined : handleClick, disabled: disabled, tabIndex: disabled || loading ? -1 : undefined }, rest), | ||
loading && React.createElement(Loader, { fill: false, size: loaderSize !== null && loaderSize !== void 0 ? loaderSize : loaderSizeConfig[size], className: classes === null || classes === void 0 ? void 0 : classes.loader }), | ||
loading && (React.createElement("span", { className: clsx(cls.loader) }, | ||
React.createElement(Loader, { size: loaderSize, variant: type === 'primary' ? 'secondary' : 'primary' }))), | ||
(!loading && leftIcon) || null, | ||
children, | ||
typeof children === 'string' && children.length >= 32 ? children.substring(0, 29) + '...' : children, | ||
rightIcon)); | ||
@@ -45,2 +42,1 @@ }); | ||
export { Button }; | ||
//# sourceMappingURL=Component.js.map |
export { Button } from './Component.js'; | ||
//# sourceMappingURL=index.js.map | ||
import 'tslib'; | ||
import 'react'; | ||
import 'clsx'; | ||
import '@eubank/kit-hooks'; | ||
import '@eubank/kit-utils'; | ||
import '@eubank/kit-loader'; |
{ | ||
"name": "@eubank/kit-button", | ||
"version": "0.0.13", | ||
"version": "0.0.14", | ||
"description": "Button", | ||
@@ -14,3 +14,3 @@ "license": "ISC", | ||
"@eubank/kit-hooks": "^0.0.10", | ||
"@eubank/kit-loader": "^0.0.7", | ||
"@eubank/kit-loader": "^0.0.8", | ||
"@eubank/kit-utils": "^0.0.6", | ||
@@ -17,0 +17,0 @@ "@eubank/kit-variables": "^0.0.15", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
624
40416
18
+ Added@eubank/kit-loader@0.0.8(transitive)
- Removed@eubank/kit-loader@0.0.7(transitive)
Updated@eubank/kit-loader@^0.0.8