@aristobyte-ui/button 2.11.2 → 2.13.0

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.
@@ -21,7 +21,7 @@ export interface IButton {
21
21
  align?: 'left' | 'right';
22
22
  };
23
23
  isLoading?: boolean;
24
- spinnerType?: 'default' | 'duo' | 'gradient' | 'pulse' | 'pulse-duo';
24
+ spinnerAppearance?: 'default' | 'duo' | 'gradient' | 'pulse' | 'pulse-duo';
25
25
  className?: string;
26
26
  style?: React.CSSProperties;
27
27
  }
@@ -51,7 +51,7 @@ var spinner_1 = require("@aristobyte-ui/spinner");
51
51
  var utils_1 = require("@aristobyte-ui/utils");
52
52
  require("./Button.scss");
53
53
  var Button = function (_a) {
54
- var onClick = _a.onClick, _b = _a.text, text = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.target, target = _d === void 0 ? '_self' : _d, _e = _a.children, children = _e === void 0 ? '' : _e, _f = _a.type, type = _f === void 0 ? 'button' : _f, _g = _a.variant, variant = _g === void 0 ? 'default' : _g, _h = _a.appearance, appearance = _h === void 0 ? 'solid' : _h, _j = _a.size, size = _j === void 0 ? 'md' : _j, _k = _a.radius, radius = _k === void 0 ? 'md' : _k, icon = _a.icon, _l = _a.spinnerType, spinnerType = _l === void 0 ? 'default' : _l, _m = _a.transparent, transparent = _m === void 0 ? false : _m, _o = _a.isLoading, isLoading = _o === void 0 ? false : _o, _p = _a.disabled, disabled = _p === void 0 ? false : _p, _q = _a.className, className = _q === void 0 ? '' : _q, _r = _a.style, style = _r === void 0 ? {} : _r;
54
+ var onClick = _a.onClick, _b = _a.text, text = _b === void 0 ? '' : _b, _c = _a.href, href = _c === void 0 ? '' : _c, _d = _a.target, target = _d === void 0 ? '_self' : _d, _e = _a.children, children = _e === void 0 ? '' : _e, _f = _a.type, type = _f === void 0 ? 'button' : _f, _g = _a.variant, variant = _g === void 0 ? 'default' : _g, _h = _a.appearance, appearance = _h === void 0 ? 'solid' : _h, _j = _a.size, size = _j === void 0 ? 'md' : _j, _k = _a.radius, radius = _k === void 0 ? 'md' : _k, icon = _a.icon, _l = _a.spinnerAppearance, spinnerAppearance = _l === void 0 ? 'default' : _l, _m = _a.transparent, transparent = _m === void 0 ? false : _m, _o = _a.isLoading, isLoading = _o === void 0 ? false : _o, _p = _a.disabled, disabled = _p === void 0 ? false : _p, _q = _a.className, className = _q === void 0 ? '' : _q, _r = _a.style, style = _r === void 0 ? {} : _r;
55
55
  var uniqueId = React.useId();
56
56
  var ref = React.useRef(null);
57
57
  var handleClick = function (e) {
@@ -69,12 +69,23 @@ var Button = function (_a) {
69
69
  onClick: handleClick,
70
70
  disabled: disabled || isLoading,
71
71
  style: style,
72
- className: "button ".concat(transparent ? 'button--transparent' : '', " ").concat("button-variant--".concat(variant), " ").concat("button-appearance--".concat(appearance), " ").concat("button-size--".concat(size), " ").concat("button-radius--".concat(radius), " ").concat(isLoading ? 'button--loading' : '', " ").concat(className),
72
+ className: [
73
+ 'button',
74
+ transparent && 'button--transparent',
75
+ "button-variant--".concat(variant),
76
+ "button-appearance--".concat(appearance),
77
+ "button-size--".concat(size),
78
+ "button-radius--".concat(radius),
79
+ isLoading && 'button--loading',
80
+ className,
81
+ ]
82
+ .filter(Boolean)
83
+ .join(' '),
73
84
  }); };
74
85
  var renderChildren = function () {
75
86
  var _a;
76
87
  return (React.createElement(React.Fragment, null,
77
- isLoading && React.createElement(spinner_1.Spinner, { size: size, variant: variant, type: spinnerType, className: "spinner" }),
88
+ isLoading && React.createElement(spinner_1.Spinner, { size: size, variant: variant, appearance: spinnerAppearance, className: "spinner" }),
78
89
  icon && (React.createElement("span", { className: "icon ".concat("icon--".concat((_a = icon.align) !== null && _a !== void 0 ? _a : 'left')) }, icon.component({ color: icon.color, size: icon.size }))),
79
90
  text || children));
80
91
  };
@@ -16,18 +16,31 @@
16
16
  }
17
17
  }
18
18
 
19
- @mixin button-group-variant($name, $color) {
20
- &-variant--#{$name} {
21
- background-color: $color;
19
+ &-variant {
20
+ &--default {
21
+ background-color: $color-default;
22
+ }
23
+
24
+ &--primary {
25
+ background-color: $color-primary;
22
26
  }
23
- }
24
27
 
25
- @include button-group-variant('default', $color-default);
26
- @include button-group-variant('primary', $color-primary);
27
- @include button-group-variant('secondary', $color-secondary);
28
- @include button-group-variant('success', $color-success);
29
- @include button-group-variant('error', $color-error);
30
- @include button-group-variant('warning', $color-warning);
28
+ &--secondary {
29
+ background-color: $color-secondary;
30
+ }
31
+
32
+ &--success {
33
+ background-color: $color-success;
34
+ }
35
+
36
+ &--error {
37
+ background-color: $color-error;
38
+ }
39
+
40
+ &--warning {
41
+ background-color: $color-warning;
42
+ }
43
+ }
31
44
 
32
45
  &-radius {
33
46
  &--none {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aristobyte-ui/button",
3
- "version": "2.11.2",
3
+ "version": "2.13.0",
4
4
  "description": "react button and buttongroup components with multiple variants, appearances, sizes, radius options, icons, ripple feedback, and fully typed typescript support",
5
5
  "license": "MIT",
6
6
  "private": false,
@@ -54,8 +54,8 @@
54
54
  "sass": "^1.97.3"
55
55
  },
56
56
  "dependencies": {
57
- "@aristobyte-ui/spinner": "^2.11.2",
58
- "@aristobyte-ui/utils": "^2.11.2"
57
+ "@aristobyte-ui/spinner": "^2.13.0",
58
+ "@aristobyte-ui/utils": "^2.13.0"
59
59
  },
60
60
  "exports": {
61
61
  ".": {