@app-studio/web 0.3.54 → 0.3.56

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.
@@ -7,8 +7,33 @@ export declare const usePasswordState: (props: PasswordProps) => {
7
7
  setIsFocused: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
8
  isHovered: boolean;
9
9
  setIsHovered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
10
- setValue: import("react").Dispatch<any>;
11
- value: any;
10
+ setValue: import("react").Dispatch<import("react").SetStateAction<string>>;
11
+ value: string;
12
+ name?: string | undefined;
13
+ isDisabled?: boolean | undefined;
14
+ visibleIcon?: import("react").ReactNode;
15
+ hiddenIcon?: import("react").ReactNode;
16
+ id?: string | undefined;
17
+ error?: any;
18
+ helperText?: string | undefined;
19
+ label?: string | undefined;
20
+ colorScheme?: string | undefined;
21
+ leftChild?: import("react").ReactNode;
22
+ rightChild?: import("react").ReactNode;
23
+ placeholder?: string | undefined;
24
+ isReadOnly?: boolean | undefined;
25
+ isClearable?: boolean | undefined;
26
+ isAutoFocus?: boolean | undefined;
27
+ onChange?: ((value: any) => void) | undefined;
28
+ onChangeText?: ((value: string) => void) | undefined;
29
+ onBlur?: ((value: any) => void) | undefined;
30
+ onClick?: (() => void) | undefined;
31
+ onFocus?: (() => void) | undefined;
32
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | undefined;
33
+ shadow?: import("app-studio").Shadow | import("../../../../utils/elevation").Elevation | import("react").CSSProperties | undefined;
34
+ shape?: "default" | "sharp" | "rounded" | "pillShaped" | undefined;
35
+ styles?: import("../../TextField/TextField/TextField.type").TextFieldStyles | undefined;
36
+ variant?: "default" | "outline" | "none" | undefined;
12
37
  isVisible: boolean;
13
38
  setIsVisible: import("react").Dispatch<import("react").SetStateAction<boolean>>;
14
39
  };
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { TextAreaProps } from './TextArea.props';
3
- export declare const useTextAreaState: ({ label, placeholder, defaultValue, }: TextAreaProps) => {
3
+ export declare const useTextAreaState: ({ label, placeholder, value: defaultValue, }: TextAreaProps) => {
4
4
  hint: string | undefined;
5
5
  setHint: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
6
6
  isHovered: boolean;
7
7
  setIsHovered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
- value: string;
9
- setValue: import("react").Dispatch<import("react").SetStateAction<string>>;
8
+ value: string | number;
9
+ setValue: import("react").Dispatch<import("react").SetStateAction<string | number>>;
10
10
  isFocused: boolean;
11
11
  setIsFocused: import("react").Dispatch<import("react").SetStateAction<boolean>>;
12
12
  };
@@ -1,12 +1,12 @@
1
1
  /// <reference types="react" />
2
2
  import { TextFieldProps } from './TextField.props';
3
- export declare const useTextFieldState: ({ label, placeholder, defaultValue }: TextFieldProps) => {
3
+ export declare const useTextFieldState: ({ label, placeholder, }: TextFieldProps) => {
4
4
  hint: string | undefined;
5
5
  setHint: import("react").Dispatch<import("react").SetStateAction<string | undefined>>;
6
6
  isFocused: boolean;
7
7
  setIsFocused: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
8
  isHovered: boolean;
9
9
  setIsHovered: import("react").Dispatch<import("react").SetStateAction<boolean>>;
10
- setValue: import("react").Dispatch<any>;
11
- value: any;
10
+ setValue: import("react").Dispatch<import("react").SetStateAction<string>>;
11
+ value: string;
12
12
  };
@@ -3349,8 +3349,7 @@ var DatePicker = DatePickerComponent;
3349
3349
 
3350
3350
  var useTextFieldState = function useTextFieldState(_ref) {
3351
3351
  var label = _ref.label,
3352
- placeholder = _ref.placeholder,
3353
- defaultValue = _ref.defaultValue;
3352
+ placeholder = _ref.placeholder;
3354
3353
  var _useState = React.useState(label != null ? label : placeholder),
3355
3354
  hint = _useState[0],
3356
3355
  setHint = _useState[1];
@@ -3360,7 +3359,7 @@ var useTextFieldState = function useTextFieldState(_ref) {
3360
3359
  var _useState3 = React.useState(false),
3361
3360
  isHovered = _useState3[0],
3362
3361
  setIsHovered = _useState3[1];
3363
- var _useState4 = React.useState(defaultValue || ''),
3362
+ var _useState4 = React.useState(''),
3364
3363
  value = _useState4[0],
3365
3364
  setValue = _useState4[1];
3366
3365
  React.useMemo(function () {
@@ -3386,10 +3385,10 @@ var usePasswordState = function usePasswordState(props) {
3386
3385
  return _extends({
3387
3386
  isVisible: isVisible,
3388
3387
  setIsVisible: setIsVisible
3389
- }, textFieldStates);
3388
+ }, props, textFieldStates);
3390
3389
  };
3391
3390
 
3392
- var _excluded$p = ["id", "name", "label", "hint", "value", "onChange", "leftChild", "rightChild", "helperText", "placeholder", "type", "onChangeText", "shadow", "styles", "size", "shape", "variant", "colorScheme", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isClearable", "isAutoFocus", "setHint", "setIsFocused", "setIsHovered", "setValue", "onClick", "onFocus", "onBlur"];
3391
+ var _excluded$p = ["id", "name", "label", "hint", "value", "onChange", "leftChild", "rightChild", "helperText", "placeholder", "onChangeText", "shadow", "styles", "size", "shape", "variant", "colorScheme", "error", "isFocused", "isHovered", "isDisabled", "isReadOnly", "isClearable", "isAutoFocus", "setHint", "setIsFocused", "setIsHovered", "setValue", "onClick", "onFocus", "onBlur"];
3393
3392
  var TextFieldInput = function TextFieldInput(props) {
3394
3393
  return React__default.createElement(appStudio.Input, Object.assign({
3395
3394
  type: "text"
@@ -3478,7 +3477,7 @@ var TextFieldView = function TextFieldView(_ref) {
3478
3477
  return setIsHovered(!isHovered);
3479
3478
  };
3480
3479
  var handleBlur = function handleBlur(event) {
3481
- onBlur(event);
3480
+ if (onBlur) onBlur(event);
3482
3481
  setIsFocused(false);
3483
3482
  };
3484
3483
  var handleChange = function handleChange(event) {
@@ -3503,12 +3502,8 @@ var TextFieldView = function TextFieldView(_ref) {
3503
3502
  name: name
3504
3503
  }
3505
3504
  });
3506
- onChange({
3507
- target: {
3508
- name: name,
3509
- value: ''
3510
- }
3511
- });
3505
+ if (onChangeText) onChangeText('');
3506
+ if (onChange) onChange('');
3512
3507
  }
3513
3508
  //for ios and android
3514
3509
  if (typeof document === 'undefined' && onChangeText) onChangeText('');
@@ -3542,7 +3537,6 @@ var TextFieldView = function TextFieldView(_ref) {
3542
3537
  }, styles), label), React__default.createElement(TextFieldInput, Object.assign({
3543
3538
  id: id,
3544
3539
  name: name,
3545
- value: value,
3546
3540
  readOnly: isReadOnly,
3547
3541
  disabled: isDisabled,
3548
3542
  autoFocus: isAutoFocus,
@@ -3551,9 +3545,8 @@ var TextFieldView = function TextFieldView(_ref) {
3551
3545
  onBlur: handleBlur,
3552
3546
  autoComplete: "off"
3553
3547
  }, fieldStyles, props, {
3554
- onChange: handleChange
3555
- }, onChange && {
3556
- onChange: handleChange
3548
+ onChange: handleChange,
3549
+ value: value
3557
3550
  }))), (rightChild || isClearable && value) && React__default.createElement(FieldIcons, null, rightChild && React__default.createElement(React__default.Fragment, null, rightChild), isClearable && value && !isReadOnly && !isDisabled && React__default.createElement(CloseSvg, {
3558
3551
  size: appStudio.Typography.fontSizes[size],
3559
3552
  color: IconColor,
@@ -3576,8 +3569,8 @@ var PasswordComponent = function PasswordComponent(_ref) {
3576
3569
  var _usePasswordState = usePasswordState(props),
3577
3570
  isVisible = _usePasswordState.isVisible,
3578
3571
  setIsVisible = _usePasswordState.setIsVisible,
3579
- passwordState = _objectWithoutPropertiesLoose(_usePasswordState, _excluded2$1);
3580
- return React__default.createElement(TextFieldView, Object.assign({}, props, passwordState, {
3572
+ passwordProps = _objectWithoutPropertiesLoose(_usePasswordState, _excluded2$1);
3573
+ return React__default.createElement(TextFieldView, Object.assign({}, passwordProps, {
3581
3574
  type: isVisible ? 'text' : 'password',
3582
3575
  isClearable: false,
3583
3576
  rightChild: React__default.createElement(appStudio.View, {
@@ -4210,7 +4203,7 @@ var Switch = SwitchComponent;
4210
4203
  var useTextAreaState = function useTextAreaState(_ref) {
4211
4204
  var label = _ref.label,
4212
4205
  placeholder = _ref.placeholder,
4213
- defaultValue = _ref.defaultValue;
4206
+ defaultValue = _ref.value;
4214
4207
  var _useState = React.useState(label != null ? label : placeholder),
4215
4208
  hint = _useState[0],
4216
4209
  setHint = _useState[1];
@@ -4238,7 +4231,7 @@ var useTextAreaState = function useTextAreaState(_ref) {
4238
4231
  };
4239
4232
  };
4240
4233
 
4241
- var _excluded$t = ["id", "name", "hint", "error", "value", "label", "shadow", "helperText", "placeholder", "defaultValue", "size", "shape", "variant", "colorScheme", "isHovered", "isFocused", "isEditable", "isReadOnly", "isDisabled", "isAutoFocus", "isMultiline", "maxRows", "maxCols", "onBlur", "onChange", "onFocus", "onChangeText", "setHint", "setValue", "setIsFocused", "setIsHovered", "styles"];
4234
+ var _excluded$t = ["id", "name", "hint", "error", "value", "label", "shadow", "helperText", "placeholder", "size", "shape", "variant", "colorScheme", "isHovered", "isFocused", "isEditable", "isReadOnly", "isDisabled", "isAutoFocus", "isMultiline", "maxRows", "maxCols", "onBlur", "onChange", "onFocus", "onChangeText", "setHint", "setValue", "setIsFocused", "setIsHovered", "styles"];
4242
4235
  var TextAreaView = function TextAreaView(_ref) {
4243
4236
  var id = _ref.id,
4244
4237
  name = _ref.name,