@app-garage/button
Advanced tools
Comparing version 1.8.0 to 1.9.0
# Change Log | ||
## 1.9.0 | ||
### Minor Changes | ||
- [`99d3043`](https://github.com/electronic33/ag-ui-react/commit/99d30433ab12b312441848fd3bff1aaac1d466a9) - added preset | ||
### Patch Changes | ||
- Updated dependencies [[`99d3043`](https://github.com/electronic33/ag-ui-react/commit/99d30433ab12b312441848fd3bff1aaac1d466a9)]: | ||
- @app-garage/spinner@1.3.0 | ||
## 1.8.0 | ||
@@ -4,0 +15,0 @@ |
@@ -32,6 +32,4 @@ import React from 'react'; | ||
var Button = React.forwardRef(function (_a, ref) { | ||
var className = _a.className, children = _a.children, isDisabled = _a.isDisabled, isLoading = _a.isLoading, Icon = _a.Icon, _b = _a.iconPosition, iconPosition = _b === void 0 ? 'left' : _b, _c = _a.type, type = _c === void 0 ? 'button' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onFocus = _a.onFocus, onBlur = _a.onBlur, _e = _a.ariaProps, ariaProps = _e === void 0 ? {} : _e, testId = _a.testId; | ||
return (React.createElement("button", __assign({ "data-test-id": testId, ref: ref, | ||
// eslint-disable-next-line react/button-has-type | ||
type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur, onClick: onClick, className: classNames('keyboard-only-focus', { | ||
var className = _a.className, children = _a.children, isDisabled = _a.isDisabled, isLoading = _a.isLoading, Icon = _a.Icon, _b = _a.iconPosition, iconPosition = _b === void 0 ? 'left' : _b, _c = _a.type, type = _c === void 0 ? 'button' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.color, color = _e === void 0 ? 'primary' : _e, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onFocus = _a.onFocus, onBlur = _a.onBlur, _g = _a.ariaProps, ariaProps = _g === void 0 ? {} : _g, testId = _a.testId; | ||
return (React.createElement("button", __assign({ "data-test-id": testId, ref: ref, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur, onClick: onClick, className: classNames('keyboard-only-focus', { | ||
'btn-sm': size === 'sm', | ||
@@ -44,10 +42,10 @@ }, { | ||
'btn-xl': size === 'xl', | ||
}, { | ||
}, { 'btn-primary-filled': color === 'primary' && variant === 'filled' }, { 'btn-neutral-filled': color === 'neutral' && variant === 'filled' }, { 'btn-warning-filled': color === 'warning' && variant === 'filled' }, { 'btn-danger-filled': color === 'danger' && variant === 'filled' }, { 'btn-success-filled': color === 'success' && variant === 'filled' }, { 'btn-primary-outline': color === 'primary' && variant === 'outline' }, { 'btn-neutral-outline': color === 'neutral' && variant === 'outline' }, { 'btn-warning-outline': color === 'warning' && variant === 'outline' }, { 'btn-danger-outline': color === 'danger' && variant === 'outline' }, { 'btn-success-outline': color === 'success' && variant === 'outline' }, { 'btn-primary-ghost': color === 'primary' && variant === 'ghost' }, { 'btn-neutral-ghost': color === 'neutral' && variant === 'ghost' }, { 'btn-warning-ghost': color === 'warning' && variant === 'ghost' }, { 'btn-danger-ghost': color === 'danger' && variant === 'ghost' }, { 'btn-success-ghost': color === 'success' && variant === 'ghost' }, { | ||
'btn-disabled': isDisabled || isLoading, | ||
}, className) }, ariaProps), | ||
isLoading && iconPosition === 'left' && (React.createElement(Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames('btn-icon-spinner-left', { | ||
'btn-spinner-left-sm': size === 'sm', | ||
'btn-spinner-left-md': size === 'md', | ||
'btn-spinner-left-lg': size === 'lg', | ||
'btn-spinner-left-xl': size === 'xl', | ||
'btn-spinner-sm': size === 'sm', | ||
'btn-spinner-md': size === 'md', | ||
'btn-spinner-lg': size === 'lg', | ||
'btn-spinner-xl': size === 'xl', | ||
}) })), | ||
@@ -58,6 +56,6 @@ !isLoading && Icon && iconPosition === 'left' && (React.createElement(Icon, { className: classNames('btn-icon-spinner-left') })), | ||
isLoading && iconPosition === 'right' && (React.createElement(Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames('btn-icon-spinner-right', { | ||
'btn-spinner-right-sm': size === 'sm', | ||
'btn-spinner-right-md': size === 'md', | ||
'btn-spinner-right-lg': size === 'lg', | ||
'btn-spinner-right-xl': size === 'xl', | ||
'btn-spinner-sm': size === 'sm', | ||
'btn-spinner-md': size === 'md', | ||
'btn-spinner-lg': size === 'lg', | ||
'btn-spinner-xl': size === 'xl', | ||
}) })))); | ||
@@ -64,0 +62,0 @@ }); |
@@ -40,7 +40,5 @@ 'use strict'; | ||
var Button = React__default['default'].forwardRef(function (_a, ref) { | ||
var className = _a.className, children = _a.children, isDisabled = _a.isDisabled, isLoading = _a.isLoading, Icon = _a.Icon, _b = _a.iconPosition, iconPosition = _b === void 0 ? 'left' : _b, _c = _a.type, type = _c === void 0 ? 'button' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onFocus = _a.onFocus, onBlur = _a.onBlur, _e = _a.ariaProps, ariaProps = _e === void 0 ? {} : _e, testId = _a.testId; | ||
return (React__default['default'].createElement("button", __assign({ "data-test-id": testId, ref: ref, | ||
// eslint-disable-next-line react/button-has-type | ||
type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur, onClick: onClick, className: classNames__default['default']('keyboard-only-focus', { | ||
var Button = React__default["default"].forwardRef(function (_a, ref) { | ||
var className = _a.className, children = _a.children, isDisabled = _a.isDisabled, isLoading = _a.isLoading, Icon = _a.Icon, _b = _a.iconPosition, iconPosition = _b === void 0 ? 'left' : _b, _c = _a.type, type = _c === void 0 ? 'button' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.color, color = _e === void 0 ? 'primary' : _e, _f = _a.variant, variant = _f === void 0 ? 'filled' : _f, onClick = _a.onClick, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, onFocus = _a.onFocus, onBlur = _a.onBlur, _g = _a.ariaProps, ariaProps = _g === void 0 ? {} : _g, testId = _a.testId; | ||
return (React__default["default"].createElement("button", __assign({ "data-test-id": testId, ref: ref, type: type, onMouseEnter: onMouseEnter, onMouseLeave: onMouseLeave, onFocus: onFocus, onBlur: onBlur, onClick: onClick, className: classNames__default["default"]('keyboard-only-focus', { | ||
'btn-sm': size === 'sm', | ||
@@ -53,19 +51,19 @@ }, { | ||
'btn-xl': size === 'xl', | ||
}, { | ||
}, { 'btn-primary-filled': color === 'primary' && variant === 'filled' }, { 'btn-neutral-filled': color === 'neutral' && variant === 'filled' }, { 'btn-warning-filled': color === 'warning' && variant === 'filled' }, { 'btn-danger-filled': color === 'danger' && variant === 'filled' }, { 'btn-success-filled': color === 'success' && variant === 'filled' }, { 'btn-primary-outline': color === 'primary' && variant === 'outline' }, { 'btn-neutral-outline': color === 'neutral' && variant === 'outline' }, { 'btn-warning-outline': color === 'warning' && variant === 'outline' }, { 'btn-danger-outline': color === 'danger' && variant === 'outline' }, { 'btn-success-outline': color === 'success' && variant === 'outline' }, { 'btn-primary-ghost': color === 'primary' && variant === 'ghost' }, { 'btn-neutral-ghost': color === 'neutral' && variant === 'ghost' }, { 'btn-warning-ghost': color === 'warning' && variant === 'ghost' }, { 'btn-danger-ghost': color === 'danger' && variant === 'ghost' }, { 'btn-success-ghost': color === 'success' && variant === 'ghost' }, { | ||
'btn-disabled': isDisabled || isLoading, | ||
}, className) }, ariaProps), | ||
isLoading && iconPosition === 'left' && (React__default['default'].createElement(spinner.Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames__default['default']('btn-icon-spinner-left', { | ||
'btn-spinner-left-sm': size === 'sm', | ||
'btn-spinner-left-md': size === 'md', | ||
'btn-spinner-left-lg': size === 'lg', | ||
'btn-spinner-left-xl': size === 'xl', | ||
isLoading && iconPosition === 'left' && (React__default["default"].createElement(spinner.Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames__default["default"]('btn-icon-spinner-left', { | ||
'btn-spinner-sm': size === 'sm', | ||
'btn-spinner-md': size === 'md', | ||
'btn-spinner-lg': size === 'lg', | ||
'btn-spinner-xl': size === 'xl', | ||
}) })), | ||
!isLoading && Icon && iconPosition === 'left' && (React__default['default'].createElement(Icon, { className: classNames__default['default']('btn-icon-spinner-left') })), | ||
!isLoading && Icon && iconPosition === 'left' && (React__default["default"].createElement(Icon, { className: classNames__default["default"]('btn-icon-spinner-left') })), | ||
children, | ||
!isLoading && Icon && iconPosition === 'right' && (React__default['default'].createElement(Icon, { className: classNames__default['default']('btn-icon-spinner-right') })), | ||
isLoading && iconPosition === 'right' && (React__default['default'].createElement(spinner.Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames__default['default']('btn-icon-spinner-right', { | ||
'btn-spinner-right-sm': size === 'sm', | ||
'btn-spinner-right-md': size === 'md', | ||
'btn-spinner-right-lg': size === 'lg', | ||
'btn-spinner-right-xl': size === 'xl', | ||
!isLoading && Icon && iconPosition === 'right' && (React__default["default"].createElement(Icon, { className: classNames__default["default"]('btn-icon-spinner-right') })), | ||
isLoading && iconPosition === 'right' && (React__default["default"].createElement(spinner.Spinner, { fill: "rgba(255, 255, 255, 1)", stroke: "rgba(255, 255, 255, 1)", className: classNames__default["default"]('btn-icon-spinner-right', { | ||
'btn-spinner-sm': size === 'sm', | ||
'btn-spinner-md': size === 'md', | ||
'btn-spinner-lg': size === 'lg', | ||
'btn-spinner-xl': size === 'xl', | ||
}) })))); | ||
@@ -72,0 +70,0 @@ }); |
import React, { ReactNode } from 'react'; | ||
export interface ButtonProps { | ||
export declare type ButtonProps = { | ||
className?: string; | ||
@@ -12,2 +12,4 @@ isDisabled?: boolean; | ||
size?: 'sm' | 'md' | 'lg' | 'xl'; | ||
color?: 'primary' | 'neutral' | 'warning' | 'danger' | 'success'; | ||
variant?: 'filled' | 'outline' | 'ghost'; | ||
onClick?: (event?: React.MouseEvent<HTMLButtonElement>) => void; | ||
@@ -23,4 +25,4 @@ onMouseEnter?: (event?: React.MouseEvent<HTMLButtonElement>) => void; | ||
}; | ||
} | ||
}; | ||
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<HTMLButtonElement | null>>; | ||
//# sourceMappingURL=button.d.ts.map |
@@ -13,3 +13,3 @@ { | ||
}, | ||
"version": "1.8.0", | ||
"version": "1.9.0", | ||
"main": "dist/index.js", | ||
@@ -33,8 +33,8 @@ "module": "dist/index.es.js", | ||
"dependencies": { | ||
"@app-garage/spinner": "^1.2.0", | ||
"classnames": "^2.3.1" | ||
"@app-garage/spinner": "~1.3.0", | ||
"classnames": "~2.3.1" | ||
}, | ||
"devDependencies": { | ||
"react": "^17.0.2", | ||
"react-icons": "^4.2.0" | ||
"react": "~17.0.2", | ||
"react-icons": "~4.3.1" | ||
}, | ||
@@ -41,0 +41,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
16504
151
+ Added@app-garage/label@1.4.0(transitive)
+ Added@app-garage/spinner@1.3.0(transitive)
- Removed@app-garage/label@1.5.0(transitive)
- Removed@app-garage/spinner@1.5.0(transitive)
- Removedclassnames@2.5.1(transitive)
Updated@app-garage/spinner@~1.3.0
Updatedclassnames@~2.3.1