@aristobyte-ui/button 2.1.8 → 2.2.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.
@@ -1,86 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __assign = (this && this.__assign) || function () {
4
- __assign = Object.assign || function(t) {
5
- for (var s, i = 1, n = arguments.length; i < n; i++) {
6
- s = arguments[i];
7
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
8
- t[p] = s[p];
9
- }
10
- return t;
11
- };
12
- return __assign.apply(this, arguments);
13
- };
14
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
- if (k2 === undefined) k2 = k;
16
- var desc = Object.getOwnPropertyDescriptor(m, k);
17
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
- desc = { enumerable: true, get: function() { return m[k]; } };
19
- }
20
- Object.defineProperty(o, k2, desc);
21
- }) : (function(o, m, k, k2) {
22
- if (k2 === undefined) k2 = k;
23
- o[k2] = m[k];
24
- }));
25
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
- Object.defineProperty(o, "default", { enumerable: true, value: v });
27
- }) : function(o, v) {
28
- o["default"] = v;
29
- });
30
- var __importStar = (this && this.__importStar) || (function () {
31
- var ownKeys = function(o) {
32
- ownKeys = Object.getOwnPropertyNames || function (o) {
33
- var ar = [];
34
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
- return ar;
36
- };
37
- return ownKeys(o);
38
- };
39
- return function (mod) {
40
- if (mod && mod.__esModule) return mod;
41
- var result = {};
42
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
- __setModuleDefault(result, mod);
44
- return result;
45
- };
46
- })();
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.Button = void 0;
49
- var React = __importStar(require("react"));
50
- var spinner_1 = require("@aristobyte-ui/spinner");
51
- var utils_1 = require("@aristobyte-ui/utils");
52
- require("./Button.scss");
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;
55
- var uniqueId = React.useId();
56
- var ref = React.useRef(null);
57
- var handleClick = function (e) {
58
- var clientX = e.clientX, clientY = e.clientY;
59
- (0, utils_1.renderRipple)({
60
- ref: ref,
61
- clientX: clientX,
62
- clientY: clientY,
63
- });
64
- if (onClick) {
65
- onClick(e);
66
- }
67
- };
68
- var getCommonProps = function () { return ({
69
- onClick: handleClick,
70
- disabled: disabled || isLoading,
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),
73
- }); };
74
- var renderChildren = function () {
75
- var _a;
76
- return (React.createElement(React.Fragment, null,
77
- isLoading && React.createElement(spinner_1.Spinner, { size: size, variant: variant, type: spinnerType, className: "spinner" }),
78
- 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
- text || children));
80
- };
81
- if (type === 'link') {
82
- return (React.createElement("a", __assign({ key: uniqueId, ref: ref, target: target, href: href }, getCommonProps()), renderChildren()));
83
- }
84
- return (React.createElement("button", __assign({ key: uniqueId, ref: ref }, getCommonProps()), renderChildren()));
85
- };
86
- exports.Button = Button;
@@ -1,66 +0,0 @@
1
- @use '@aristobyte-ui/utils/aristobyte-ui.settings' as *;
2
-
3
- .button-group {
4
- align-items: center;
5
- display: flex;
6
- overflow: hidden;
7
- max-width: max-content;
8
-
9
- &-align {
10
- &--horizontal {
11
- flex-direction: row;
12
- }
13
-
14
- &--vertical {
15
- flex-direction: column;
16
- }
17
- }
18
-
19
- &-variant {
20
- &--default {
21
- background-color: $color-default;
22
- }
23
-
24
- &--primary {
25
- background-color: $color-primary;
26
- }
27
-
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
- }
44
-
45
- &-radius {
46
- &--none {
47
- border-radius: 0rem; // 0px
48
- }
49
-
50
- &--sm {
51
- border-radius: 0.125rem; // 2px
52
- }
53
-
54
- &--md {
55
- border-radius: 0.375rem; // 6px
56
- }
57
-
58
- &--lg {
59
- border-radius: 0.5rem; // 8px
60
- }
61
-
62
- &--full {
63
- border-radius: 1.5rem; // 24px
64
- }
65
- }
66
- }
@@ -1,57 +0,0 @@
1
- "use strict";
2
- 'use client';
3
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
- if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
10
- }) : (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- o[k2] = m[k];
13
- }));
14
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
- Object.defineProperty(o, "default", { enumerable: true, value: v });
16
- }) : function(o, v) {
17
- o["default"] = v;
18
- });
19
- var __importStar = (this && this.__importStar) || (function () {
20
- var ownKeys = function(o) {
21
- ownKeys = Object.getOwnPropertyNames || function (o) {
22
- var ar = [];
23
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
- return ar;
25
- };
26
- return ownKeys(o);
27
- };
28
- return function (mod) {
29
- if (mod && mod.__esModule) return mod;
30
- var result = {};
31
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
- __setModuleDefault(result, mod);
33
- return result;
34
- };
35
- })();
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- exports.ButtonGroup = void 0;
38
- var React = __importStar(require("react"));
39
- var Button_1 = require("../Button");
40
- require("./ButtonGroup.scss");
41
- var ButtonGroup = function (_a) {
42
- var children = _a.children, _b = _a.align, align = _b === void 0 ? 'horizontal' : _b, _c = _a.variant, variant = _c === void 0 ? 'default' : _c, _d = _a.size, size = _d === void 0 ? 'md' : _d, _e = _a.radius, radius = _e === void 0 ? 'md' : _e, disabled = _a.disabled, _f = _a.className, className = _f === void 0 ? '' : _f, _g = _a.style, style = _g === void 0 ? {} : _g;
43
- return (React.createElement("div", { className: "button-group ".concat("button-group-variant--".concat(variant), " ").concat("button-group-size--".concat(size), " ").concat("button-group-radius--".concat(radius), " ").concat("button-group-align--".concat(align), " ").concat(className), style: style }, React.Children.toArray(children)
44
- .filter(function (child) {
45
- return React.isValidElement(child) && child.type === Button_1.Button;
46
- })
47
- .map(function (child, index) {
48
- return React.cloneElement(child, {
49
- key: index || child.key,
50
- size: size || child.props.size,
51
- disabled: disabled || child.props.disabled,
52
- variant: variant || child.props.variant,
53
- radius: 'none',
54
- });
55
- })));
56
- };
57
- exports.ButtonGroup = ButtonGroup;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./Button"), exports);
18
- __exportStar(require("./ButtonGroup"), exports);
@@ -1,17 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./components"), exports);