@app-studio/web 0.3.34 → 0.3.36

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.
@@ -22,3 +22,13 @@ export interface PasswordProps extends TextFieldProps {
22
22
  */
23
23
  [x: string]: any;
24
24
  }
25
+ export interface PasswordViewProps extends PasswordProps {
26
+ /**
27
+ * Optional prop to determine if the password is visible
28
+ */
29
+ isVisible?: boolean;
30
+ /**
31
+ * Optional callback prop to update the visibility state
32
+ */
33
+ setIsVisible?: Function;
34
+ }
@@ -1,5 +1,14 @@
1
1
  /// <reference types="react" />
2
- export declare const usePasswordState: () => {
2
+ import { PasswordProps } from './Password.props';
3
+ export declare const usePasswordState: (props: PasswordProps) => {
4
+ hint: string | undefined;
5
+ setHint: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
6
+ isFocused: boolean;
7
+ setIsFocused: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
+ isHovered: boolean;
9
+ setIsHovered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
10
+ inputValue: string;
11
+ setInputValue: import("react").Dispatch<import("react").SetStateAction<string>>;
3
12
  isVisible: boolean;
4
13
  setIsVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
5
14
  };
@@ -3135,16 +3135,6 @@ var DatePickerComponent = function DatePickerComponent(props) {
3135
3135
  */
3136
3136
  var DatePicker = DatePickerComponent;
3137
3137
 
3138
- var usePasswordState = function usePasswordState() {
3139
- var _useState = React.useState(false),
3140
- isVisible = _useState[0],
3141
- setIsVisible = _useState[1];
3142
- return {
3143
- isVisible: isVisible,
3144
- setIsVisible: setIsVisible
3145
- };
3146
- };
3147
-
3148
3138
  var useTextFieldState = function useTextFieldState(_ref) {
3149
3139
  var label = _ref.label,
3150
3140
  placeholder = _ref.placeholder,
@@ -3173,6 +3163,17 @@ var useTextFieldState = function useTextFieldState(_ref) {
3173
3163
  };
3174
3164
  };
3175
3165
 
3166
+ var usePasswordState = function usePasswordState(props) {
3167
+ var textFieldStates = useTextFieldState(props);
3168
+ var _useState = React.useState(false),
3169
+ isVisible = _useState[0],
3170
+ setIsVisible = _useState[1];
3171
+ return _extends({
3172
+ isVisible: isVisible,
3173
+ setIsVisible: setIsVisible
3174
+ }, textFieldStates);
3175
+ };
3176
+
3176
3177
  var _excluded$o = ["id", "name", "label", "value", "hint", "inputValue", "onChange", "leftChild", "rightChild", "helperText", "placeholder", "onChangeText", "shadow", "styles", "size", "shape", "variant", "colorScheme", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isClearable", "isAutoFocus", "setHint", "setIsFocused", "setIsHovered", "setInputValue", "onClick", "onFocus", "onBlur"];
3177
3178
  var TextFieldInput = function TextFieldInput(props) {
3178
3179
  return React__default.createElement(appStudio.Input, Object.assign({
@@ -3349,19 +3350,10 @@ var TextFieldView = function TextFieldView(_ref) {
3349
3350
  }))));
3350
3351
  };
3351
3352
 
3352
- var TextFieldComponent = function TextFieldComponent(props) {
3353
- var textFieldStates = useTextFieldState(props);
3354
- return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
3355
- };
3356
- /**
3357
- * TextField is used to capture text data from users.
3358
- */
3359
- var TextField = TextFieldComponent;
3360
-
3361
- var _excluded$p = ["name", "visibleIcon", "hiddenIcon", "isDisabled"];
3362
- var PasswordView = function PasswordView(_ref) {
3363
- var name = _ref.name,
3364
- _ref$visibleIcon = _ref.visibleIcon,
3353
+ var _excluded$p = ["visibleIcon", "hiddenIcon"],
3354
+ _excluded2 = ["isVisible", "setIsVisible"];
3355
+ var PasswordComponent = function PasswordComponent(_ref) {
3356
+ var _ref$visibleIcon = _ref.visibleIcon,
3365
3357
  visibleIcon = _ref$visibleIcon === void 0 ? React__default.createElement(OpenEyeSvg, {
3366
3358
  size: 14
3367
3359
  }) : _ref$visibleIcon,
@@ -3369,29 +3361,22 @@ var PasswordView = function PasswordView(_ref) {
3369
3361
  hiddenIcon = _ref$hiddenIcon === void 0 ? React__default.createElement(CloseEyeSvg, {
3370
3362
  size: 14
3371
3363
  }) : _ref$hiddenIcon,
3372
- _ref$isDisabled = _ref.isDisabled,
3373
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
3374
3364
  props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
3375
- var _useState = React.useState(false),
3376
- visible = _useState[0],
3377
- setVisible = _useState[1];
3378
- return React__default.createElement(TextField, Object.assign({
3379
- name: name,
3380
- type: visible ? 'text' : 'password',
3381
- rightChild: React__default.createElement(View, {
3365
+ var _usePasswordState = usePasswordState(props),
3366
+ isVisible = _usePasswordState.isVisible,
3367
+ setIsVisible = _usePasswordState.setIsVisible,
3368
+ passwordState = _objectWithoutPropertiesLoose(_usePasswordState, _excluded2);
3369
+ return React__default.createElement(TextFieldView, Object.assign({
3370
+ type: isVisible ? 'text' : 'password',
3371
+ isClearable: false,
3372
+ rightChild: React__default.createElement(appStudio.View, {
3382
3373
  onClick: function onClick() {
3383
- if (!isDisabled) {
3384
- setVisible(!visible);
3374
+ if (!props.isDisabled) {
3375
+ setIsVisible(!isVisible);
3385
3376
  }
3386
3377
  }
3387
- }, visible ? visibleIcon : hiddenIcon),
3388
- isClearable: false
3389
- }, props));
3390
- };
3391
-
3392
- var PasswordComponent = function PasswordComponent(props) {
3393
- var passwordState = usePasswordState();
3394
- return React__default.createElement(PasswordView, Object.assign({}, passwordState, props));
3378
+ }, isVisible ? visibleIcon : hiddenIcon)
3379
+ }, passwordState, props));
3395
3380
  };
3396
3381
  /**
3397
3382
  * To allow users to securely enter sensitive information
@@ -3445,7 +3430,7 @@ var IconSizes$4 = {
3445
3430
  };
3446
3431
 
3447
3432
  var _excluded$q = ["isHovered", "setIsHovered", "option", "size", "callback"],
3448
- _excluded2 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
3433
+ _excluded2$1 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
3449
3434
  _excluded3 = ["option", "size", "removeOption"],
3450
3435
  _excluded4 = ["id", "name", "label", "selected", "placeholder", "helperText", "hide", "error", "isMulti", "isFocused", "isHovered", "isDisabled", "isReadOnly", "options", "shadow", "size", "colorScheme", "shape", "variant", "styles", "onChange", "setHide", "setSelected", "setIsHovered", "setIsFocused"];
3451
3436
  var Item = function Item(_ref) {
@@ -3526,7 +3511,7 @@ var HiddenSelect = function HiddenSelect(_ref3) {
3526
3511
  isReadOnly = _ref3$isReadOnly === void 0 ? false : _ref3$isReadOnly,
3527
3512
  _ref3$options = _ref3.options,
3528
3513
  options = _ref3$options === void 0 ? [] : _ref3$options,
3529
- props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
3514
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
3530
3515
  var handleChange = function handleChange(event) {
3531
3516
  if (onChange) onChange(event);
3532
3517
  };
@@ -4195,6 +4180,15 @@ var TextAreaComponent = function TextAreaComponent(props) {
4195
4180
  */
4196
4181
  var TextArea = TextAreaComponent;
4197
4182
 
4183
+ var TextFieldComponent = function TextFieldComponent(props) {
4184
+ var textFieldStates = useTextFieldState(props);
4185
+ return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
4186
+ };
4187
+ /**
4188
+ * TextField is used to capture text data from users.
4189
+ */
4190
+ var TextField = TextFieldComponent;
4191
+
4198
4192
  var DefaultSizes = {
4199
4193
  xs: 14,
4200
4194
  sm: 18,
@@ -4214,7 +4208,7 @@ var DefaultSpeeds = {
4214
4208
  };
4215
4209
 
4216
4210
  var _excluded$t = ["size", "speed", "color"],
4217
- _excluded2$1 = ["size", "speed", "color"],
4211
+ _excluded2$2 = ["size", "speed", "color"],
4218
4212
  _excluded3$1 = ["size", "speed", "color"],
4219
4213
  _excluded4$1 = ["size", "children", "textColor", "loaderColor", "type", "speed", "textPosition"];
4220
4214
  var DefaultSpinner = function DefaultSpinner(_ref) {
@@ -4274,7 +4268,7 @@ var Dotted = function Dotted(_ref2) {
4274
4268
  speed = _ref2$speed === void 0 ? 'normal' : _ref2$speed,
4275
4269
  _ref2$color = _ref2.color,
4276
4270
  color = _ref2$color === void 0 ? 'theme.loading' : _ref2$color,
4277
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
4271
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
4278
4272
  var theme = appStudio.useTheme();
4279
4273
  var colorStyle = theme.getColor(color);
4280
4274
  var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
@@ -4475,7 +4469,7 @@ var HeaderIconSizes = {
4475
4469
  };
4476
4470
 
4477
4471
  var _excluded$u = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
4478
- _excluded2$2 = ["children", "shadow", "isFullScreen", "shape"],
4472
+ _excluded2$3 = ["children", "shadow", "isFullScreen", "shape"],
4479
4473
  _excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
4480
4474
  _excluded4$2 = ["children"],
4481
4475
  _excluded5 = ["children"];
@@ -4524,7 +4518,7 @@ var ModalContainer = function ModalContainer(_ref2) {
4524
4518
  isFullScreen = _ref2$isFullScreen === void 0 ? false : _ref2$isFullScreen,
4525
4519
  _ref2$shape = _ref2.shape,
4526
4520
  shape = _ref2$shape === void 0 ? 'rounded' : _ref2$shape,
4527
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
4521
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);
4528
4522
  var defaultShadow = typeof document !== undefined ? {
4529
4523
  boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.3)'
4530
4524
  } : {
@@ -4648,7 +4642,7 @@ Modal.Footer = ModalFooter;
4648
4642
  Modal.Layout = ModalLayout;
4649
4643
 
4650
4644
  var _excluded$v = ["src", "color"],
4651
- _excluded2$3 = ["path"];
4645
+ _excluded2$4 = ["path"];
4652
4646
  var FileSVG = function FileSVG(_ref) {
4653
4647
  var src = _ref.src,
4654
4648
  color = _ref.color,
@@ -4667,7 +4661,7 @@ var FileSVG = function FileSVG(_ref) {
4667
4661
  };
4668
4662
  var FileImage = function FileImage(_ref2) {
4669
4663
  var path = _ref2.path,
4670
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);
4664
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$4);
4671
4665
  return React__default.createElement(appStudio.Image, Object.assign({
4672
4666
  src: path
4673
4667
  }, props));