@app-studio/web 0.3.37 → 0.3.39
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.
- package/dist/components/Button/Button/Button.props.d.ts +11 -2
- package/dist/web.cjs.development.js +15 -7
- package/dist/web.cjs.development.js.map +1 -1
- package/dist/web.cjs.production.min.js +1 -1
- package/dist/web.cjs.production.min.js.map +1 -1
- package/dist/web.esm.js +15 -7
- package/dist/web.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React, { CSSProperties } from 'react';
|
|
2
2
|
import { Shadow } from 'app-studio';
|
|
3
3
|
import { Elevation } from '../../../utils/elevation';
|
|
4
|
-
import { IconPosition, Shape, Size, Variant } from './Button.type';
|
|
4
|
+
import { IconPosition, Shape, Size, Variant, LoaderPosition } from './Button.type';
|
|
5
|
+
import { LoaderProps } from 'src/components/Loader/Loader/Loader.props';
|
|
5
6
|
/**
|
|
6
7
|
* Represents the properties for the Button component.
|
|
7
8
|
*/
|
|
@@ -21,7 +22,15 @@ export interface ButtonProps {
|
|
|
21
22
|
/**
|
|
22
23
|
* Indicates whether the button is in a loading state.
|
|
23
24
|
*/
|
|
24
|
-
|
|
25
|
+
isLoading?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Indicates whether the button is in a loading state.
|
|
28
|
+
*/
|
|
29
|
+
loaderProps?: LoaderProps;
|
|
30
|
+
/**
|
|
31
|
+
* Specifies the position of the icon within the button.
|
|
32
|
+
*/
|
|
33
|
+
loaderPosition?: LoaderPosition;
|
|
25
34
|
/**
|
|
26
35
|
* The icon component rendered within the button.
|
|
27
36
|
*/
|
|
@@ -8,6 +8,8 @@ var React = require('react');
|
|
|
8
8
|
var React__default = _interopDefault(React);
|
|
9
9
|
var appStudio = require('app-studio');
|
|
10
10
|
var reactRouterDom = require('react-router-dom');
|
|
11
|
+
var Loader$1 = require('src/components/Loader/Loader');
|
|
12
|
+
var Horizontal$1 = require('src/components/Layout/Horizontal/Horizontal');
|
|
11
13
|
var format = _interopDefault(require('date-fns/format'));
|
|
12
14
|
var zustand = require('zustand');
|
|
13
15
|
|
|
@@ -568,7 +570,7 @@ var IconSizes$1 = {
|
|
|
568
570
|
}
|
|
569
571
|
};
|
|
570
572
|
|
|
571
|
-
var _excluded$b = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "
|
|
573
|
+
var _excluded$b = ["icon", "shadow", "children", "ariaLabel", "externalHref", "isAuto", "isFilled", "isIconRounded", "isLoading", "isDisabled", "size", "variant", "iconPosition", "colorScheme", "shape", "onClick", "loaderProps", "loaderPosition"];
|
|
572
574
|
var ButtonView = function ButtonView(_ref) {
|
|
573
575
|
var _props$onClick;
|
|
574
576
|
var icon = _ref.icon,
|
|
@@ -582,8 +584,8 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
582
584
|
isFilled = _ref$isFilled === void 0 ? false : _ref$isFilled,
|
|
583
585
|
_ref$isIconRounded = _ref.isIconRounded,
|
|
584
586
|
isIconRounded = _ref$isIconRounded === void 0 ? false : _ref$isIconRounded,
|
|
585
|
-
_ref$
|
|
586
|
-
|
|
587
|
+
_ref$isLoading = _ref.isLoading,
|
|
588
|
+
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
587
589
|
_ref$isDisabled = _ref.isDisabled,
|
|
588
590
|
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
589
591
|
_ref$size = _ref.size,
|
|
@@ -598,8 +600,12 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
598
600
|
shape = _ref$shape === void 0 ? 'rounded' : _ref$shape,
|
|
599
601
|
_ref$onClick = _ref.onClick,
|
|
600
602
|
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
603
|
+
_ref$loaderProps = _ref.loaderProps,
|
|
604
|
+
loaderProps = _ref$loaderProps === void 0 ? {} : _ref$loaderProps,
|
|
605
|
+
_ref$loaderPosition = _ref.loaderPosition,
|
|
606
|
+
loaderPosition = _ref$loaderPosition === void 0 ? 'left' : _ref$loaderPosition,
|
|
601
607
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$b);
|
|
602
|
-
var isActive = !(isDisabled ||
|
|
608
|
+
var isActive = !(isDisabled || isLoading);
|
|
603
609
|
var defaultNativeProps = {
|
|
604
610
|
disabled: !isActive
|
|
605
611
|
};
|
|
@@ -636,7 +642,9 @@ var ButtonView = function ButtonView(_ref) {
|
|
|
636
642
|
var changePadding = {
|
|
637
643
|
padding: isIconRounded ? IconSizes$1[size].padding : ButtonSizes[size].padding
|
|
638
644
|
};
|
|
639
|
-
var content = React__default.createElement(
|
|
645
|
+
var content = React__default.createElement(Horizontal$1.Horizontal, {
|
|
646
|
+
gap: 4
|
|
647
|
+
}, isLoading && loaderPosition === 'left' && React__default.createElement(Loader$1.Loader, Object.assign({}, loaderProps)), icon && iconPosition === 'left' && !isLoading && icon, children, icon && iconPosition === 'right' && !isLoading && icon, isLoading && loaderPosition === 'right' && React__default.createElement(Loader$1.Loader, Object.assign({}, loaderProps)));
|
|
640
648
|
return React__default.createElement(appStudio.Element, Object.assign({
|
|
641
649
|
gap: 8,
|
|
642
650
|
as: "button",
|
|
@@ -3366,7 +3374,7 @@ var PasswordComponent = function PasswordComponent(_ref) {
|
|
|
3366
3374
|
isVisible = _usePasswordState.isVisible,
|
|
3367
3375
|
setIsVisible = _usePasswordState.setIsVisible,
|
|
3368
3376
|
passwordState = _objectWithoutPropertiesLoose(_usePasswordState, _excluded2);
|
|
3369
|
-
return React__default.createElement(TextFieldView, Object.assign({
|
|
3377
|
+
return React__default.createElement(TextFieldView, Object.assign({}, props, passwordState, {
|
|
3370
3378
|
type: isVisible ? 'text' : 'password',
|
|
3371
3379
|
isClearable: false,
|
|
3372
3380
|
rightChild: React__default.createElement(appStudio.View, {
|
|
@@ -3376,7 +3384,7 @@ var PasswordComponent = function PasswordComponent(_ref) {
|
|
|
3376
3384
|
}
|
|
3377
3385
|
}
|
|
3378
3386
|
}, isVisible ? visibleIcon : hiddenIcon)
|
|
3379
|
-
}
|
|
3387
|
+
}));
|
|
3380
3388
|
};
|
|
3381
3389
|
/**
|
|
3382
3390
|
* To allow users to securely enter sensitive information
|