@app-studio/web 0.3.35 → 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.
@@ -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
  };
@@ -9,7 +9,6 @@ var React__default = _interopDefault(React);
9
9
  var appStudio = require('app-studio');
10
10
  var reactRouterDom = require('react-router-dom');
11
11
  var format = _interopDefault(require('date-fns/format'));
12
- require('formik');
13
12
  var zustand = require('zustand');
14
13
 
15
14
  var useButtonState = function useButtonState() {
@@ -3136,15 +3135,253 @@ var DatePickerComponent = function DatePickerComponent(props) {
3136
3135
  */
3137
3136
  var DatePicker = DatePickerComponent;
3138
3137
 
3139
- var usePasswordState = function usePasswordState() {
3138
+ var useTextFieldState = function useTextFieldState(_ref) {
3139
+ var label = _ref.label,
3140
+ placeholder = _ref.placeholder,
3141
+ value = _ref.value;
3142
+ var _useState = React.useState(label != null ? label : placeholder),
3143
+ hint = _useState[0],
3144
+ setHint = _useState[1];
3145
+ var _useState2 = React.useState(false),
3146
+ isFocused = _useState2[0],
3147
+ setIsFocused = _useState2[1];
3148
+ var _useState3 = React.useState(false),
3149
+ isHovered = _useState3[0],
3150
+ setIsHovered = _useState3[1];
3151
+ var _useState4 = React.useState(value || ''),
3152
+ inputValue = _useState4[0],
3153
+ setInputValue = _useState4[1];
3154
+ return {
3155
+ hint: hint,
3156
+ setHint: setHint,
3157
+ isFocused: isFocused,
3158
+ setIsFocused: setIsFocused,
3159
+ isHovered: isHovered,
3160
+ setIsHovered: setIsHovered,
3161
+ inputValue: inputValue,
3162
+ setInputValue: setInputValue
3163
+ };
3164
+ };
3165
+
3166
+ var usePasswordState = function usePasswordState(props) {
3167
+ var textFieldStates = useTextFieldState(props);
3140
3168
  var _useState = React.useState(false),
3141
3169
  isVisible = _useState[0],
3142
3170
  setIsVisible = _useState[1];
3143
- return {
3171
+ return _extends({
3144
3172
  isVisible: isVisible,
3145
3173
  setIsVisible: setIsVisible
3174
+ }, textFieldStates);
3175
+ };
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"];
3178
+ var TextFieldInput = function TextFieldInput(props) {
3179
+ return React__default.createElement(appStudio.Input, Object.assign({
3180
+ type: "text"
3181
+ }, props));
3182
+ };
3183
+ var TextFieldView = function TextFieldView(_ref) {
3184
+ var id = _ref.id,
3185
+ name = _ref.name,
3186
+ label = _ref.label,
3187
+ hint = _ref.hint,
3188
+ inputValue = _ref.inputValue,
3189
+ onChange = _ref.onChange,
3190
+ leftChild = _ref.leftChild,
3191
+ rightChild = _ref.rightChild,
3192
+ helperText = _ref.helperText,
3193
+ placeholder = _ref.placeholder,
3194
+ onChangeText = _ref.onChangeText,
3195
+ _ref$shadow = _ref.shadow,
3196
+ shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
3197
+ _ref$styles = _ref.styles,
3198
+ styles = _ref$styles === void 0 ? {
3199
+ box: {},
3200
+ field: {},
3201
+ label: {},
3202
+ helperText: {},
3203
+ text: {}
3204
+ } : _ref$styles,
3205
+ _ref$size = _ref.size,
3206
+ size = _ref$size === void 0 ? 'md' : _ref$size,
3207
+ _ref$shape = _ref.shape,
3208
+ shape = _ref$shape === void 0 ? 'default' : _ref$shape,
3209
+ _ref$variant = _ref.variant,
3210
+ variant = _ref$variant === void 0 ? 'default' : _ref$variant,
3211
+ _ref$colorScheme = _ref.colorScheme,
3212
+ colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
3213
+ _ref$error = _ref.error,
3214
+ error = _ref$error === void 0 ? false : _ref$error,
3215
+ _ref$isFocused = _ref.isFocused,
3216
+ isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
3217
+ _ref$isHovered = _ref.isHovered,
3218
+ isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
3219
+ _ref$isDisabled = _ref.isDisabled,
3220
+ isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
3221
+ _ref$isReadOnly = _ref.isReadOnly,
3222
+ isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
3223
+ _ref$isClearable = _ref.isClearable,
3224
+ isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
3225
+ _ref$isAutoFocus = _ref.isAutoFocus,
3226
+ isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
3227
+ _ref$setHint = _ref.setHint,
3228
+ setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
3229
+ _ref$setIsFocused = _ref.setIsFocused,
3230
+ setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
3231
+ _ref$setIsHovered = _ref.setIsHovered,
3232
+ setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
3233
+ _ref$setInputValue = _ref.setInputValue,
3234
+ setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
3235
+ onFocus = _ref.onFocus,
3236
+ _ref$onBlur = _ref.onBlur,
3237
+ onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
3238
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
3239
+ var _useTheme = appStudio.useTheme(),
3240
+ getColor = _useTheme.getColor;
3241
+ var IconColor = getColor('color.blueGray.700');
3242
+ var isWithLabel = !!(isFocused && label);
3243
+ React.useMemo(function () {
3244
+ setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
3245
+ }, [inputValue, isFocused, label, placeholder]);
3246
+ var fieldStyles = _extends({
3247
+ margin: 0,
3248
+ paddingVertical: 8,
3249
+ padddingHorizontal: 0,
3250
+ width: '100%',
3251
+ heigth: '100%',
3252
+ border: 'none',
3253
+ on: {
3254
+ focus: {
3255
+ outline: 'none'
3256
+ }
3257
+ },
3258
+ fontSize: appStudio.Typography.fontSizes[size],
3259
+ lineHeight: appStudio.Typography.fontSizes[size],
3260
+ backgroundColor: 'transparent',
3261
+ color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
3262
+ cursor: isDisabled ? 'not-allowed' : 'auto'
3263
+ }, styles['field']);
3264
+ var handleFocus = function handleFocus() {
3265
+ setIsFocused(true);
3266
+ if (onFocus) onFocus();
3146
3267
  };
3268
+ var handleHover = function handleHover() {
3269
+ return setIsHovered(!isHovered);
3270
+ };
3271
+ var handleBlur = function handleBlur(event) {
3272
+ onBlur(event);
3273
+ setIsFocused(false);
3274
+ };
3275
+ var handleChange = function handleChange(event) {
3276
+ if (typeof event === 'string') {
3277
+ //for ios and android
3278
+ setInputValue(event);
3279
+ if (onChangeText) onChangeText(event);
3280
+ } else {
3281
+ //Web
3282
+ setInputValue(event.target.value);
3283
+ if (onChange) onChange(event);
3284
+ }
3285
+ };
3286
+ var handleClear = function handleClear() {
3287
+ setInputValue('');
3288
+ //Web
3289
+ if (onChange) {
3290
+ onBlur({
3291
+ target: {
3292
+ name: name
3293
+ }
3294
+ });
3295
+ onChange({
3296
+ target: {
3297
+ name: name,
3298
+ value: ''
3299
+ }
3300
+ });
3301
+ }
3302
+ //for ios and android
3303
+ if (typeof document === 'undefined' && onChangeText) onChangeText('');
3304
+ };
3305
+ return React__default.createElement(FieldContainer, {
3306
+ helperText: helperText,
3307
+ error: error,
3308
+ styles: styles
3309
+ }, React__default.createElement(FieldContent, {
3310
+ label: label,
3311
+ size: size,
3312
+ error: error,
3313
+ shape: shape,
3314
+ styles: styles,
3315
+ shadow: shadow,
3316
+ variant: variant,
3317
+ value: inputValue,
3318
+ color: colorScheme,
3319
+ isHovered: isHovered,
3320
+ isDisabled: isDisabled,
3321
+ isReadOnly: isReadOnly,
3322
+ isFocused: isFocused,
3323
+ isWithLabel: isWithLabel,
3324
+ colorScheme: colorScheme,
3325
+ onMouseEnter: handleHover,
3326
+ onMouseLeave: handleHover
3327
+ }, leftChild, React__default.createElement(FieldWrapper, null, isWithLabel && React__default.createElement(FieldLabel, Object.assign({
3328
+ htmlFor: id,
3329
+ color: colorScheme,
3330
+ error: error
3331
+ }, styles), label), React__default.createElement(TextFieldInput, Object.assign({
3332
+ id: id,
3333
+ name: name,
3334
+ value: inputValue,
3335
+ readOnly: isReadOnly,
3336
+ disabled: isDisabled,
3337
+ autoFocus: isAutoFocus,
3338
+ placeholder: hint,
3339
+ onFocus: handleFocus,
3340
+ onBlur: handleBlur,
3341
+ autoComplete: "off"
3342
+ }, fieldStyles, props, {
3343
+ onChange: handleChange
3344
+ }, onChangeText && {
3345
+ onChangeText: handleChange
3346
+ }))), (rightChild || isClearable && inputValue) && React__default.createElement(FieldIcons, null, rightChild && React__default.createElement(React__default.Fragment, null, rightChild), isClearable && inputValue && !isReadOnly && !isDisabled && React__default.createElement(CloseSvg, {
3347
+ size: appStudio.Typography.fontSizes[size],
3348
+ color: IconColor,
3349
+ onClick: handleClear
3350
+ }))));
3351
+ };
3352
+
3353
+ var _excluded$p = ["visibleIcon", "hiddenIcon"],
3354
+ _excluded2 = ["isVisible", "setIsVisible"];
3355
+ var PasswordComponent = function PasswordComponent(_ref) {
3356
+ var _ref$visibleIcon = _ref.visibleIcon,
3357
+ visibleIcon = _ref$visibleIcon === void 0 ? React__default.createElement(OpenEyeSvg, {
3358
+ size: 14
3359
+ }) : _ref$visibleIcon,
3360
+ _ref$hiddenIcon = _ref.hiddenIcon,
3361
+ hiddenIcon = _ref$hiddenIcon === void 0 ? React__default.createElement(CloseEyeSvg, {
3362
+ size: 14
3363
+ }) : _ref$hiddenIcon,
3364
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
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, {
3373
+ onClick: function onClick() {
3374
+ if (!props.isDisabled) {
3375
+ setIsVisible(!isVisible);
3376
+ }
3377
+ }
3378
+ }, isVisible ? visibleIcon : hiddenIcon)
3379
+ }, passwordState, props));
3147
3380
  };
3381
+ /**
3382
+ * To allow users to securely enter sensitive information
3383
+ */
3384
+ var Password = PasswordComponent;
3148
3385
 
3149
3386
  var useSelectState = function useSelectState(_ref) {
3150
3387
  var placeholder = _ref.placeholder,
@@ -3192,8 +3429,8 @@ var IconSizes$4 = {
3192
3429
  xl: 16
3193
3430
  };
3194
3431
 
3195
- var _excluded$o = ["isHovered", "setIsHovered", "option", "size", "callback"],
3196
- _excluded2 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
3432
+ var _excluded$q = ["isHovered", "setIsHovered", "option", "size", "callback"],
3433
+ _excluded2$1 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
3197
3434
  _excluded3 = ["option", "size", "removeOption"],
3198
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"];
3199
3436
  var Item = function Item(_ref) {
@@ -3204,7 +3441,7 @@ var Item = function Item(_ref) {
3204
3441
  size = _ref$size === void 0 ? 'md' : _ref$size,
3205
3442
  _ref$callback = _ref.callback,
3206
3443
  callback = _ref$callback === void 0 ? function () {} : _ref$callback,
3207
- props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
3444
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
3208
3445
  var handleOptionClick = function handleOptionClick(option) {
3209
3446
  return callback(option);
3210
3447
  };
@@ -3274,7 +3511,7 @@ var HiddenSelect = function HiddenSelect(_ref3) {
3274
3511
  isReadOnly = _ref3$isReadOnly === void 0 ? false : _ref3$isReadOnly,
3275
3512
  _ref3$options = _ref3.options,
3276
3513
  options = _ref3$options === void 0 ? [] : _ref3$options,
3277
- props = _objectWithoutPropertiesLoose(_ref3, _excluded2);
3514
+ props = _objectWithoutPropertiesLoose(_ref3, _excluded2$1);
3278
3515
  var handleChange = function handleChange(event) {
3279
3516
  if (onChange) onChange(event);
3280
3517
  };
@@ -3674,7 +3911,7 @@ var SliderPadding = {
3674
3911
  }
3675
3912
  };
3676
3913
 
3677
- var _excluded$p = ["id", "name", "inActiveChild", "activeChild", "shadow", "size", "colorScheme", "on", "isHovered", "isChecked", "isDisabled", "isReadOnly", "onChange", "onValueChange", "setOn", "setIsHovered", "styles"];
3914
+ var _excluded$r = ["id", "name", "inActiveChild", "activeChild", "shadow", "size", "colorScheme", "on", "isHovered", "isChecked", "isDisabled", "isReadOnly", "onChange", "onValueChange", "setOn", "setIsHovered", "styles"];
3678
3915
  var SwitchContent = function SwitchContent(props) {
3679
3916
  return React__default.createElement(appStudio.Input, Object.assign({
3680
3917
  type: "checkbox"
@@ -3710,7 +3947,7 @@ var SwitchView = function SwitchView(_ref) {
3710
3947
  slider: {},
3711
3948
  circle: {}
3712
3949
  } : _ref$styles,
3713
- props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
3950
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
3714
3951
  var handleToggle = function handleToggle(event) {
3715
3952
  if (!isReadOnly) {
3716
3953
  setOn(!on);
@@ -3786,7 +4023,7 @@ var useTextAreaState = function useTextAreaState(_ref) {
3786
4023
  };
3787
4024
  };
3788
4025
 
3789
- var _excluded$q = ["id", "name", "hint", "error", "value", "label", "shadow", "inputValue", "helperText", "placeholder", "defaultValue", "size", "shape", "variant", "colorScheme", "isHovered", "isFocused", "isEditable", "isReadOnly", "isDisabled", "isAutoFocus", "isMultiline", "maxRows", "maxCols", "onBlur", "onChange", "onFocus", "onChangeText", "setHint", "setInputValue", "setIsFocused", "setIsHovered", "styles"];
4026
+ var _excluded$s = ["id", "name", "hint", "error", "value", "label", "shadow", "inputValue", "helperText", "placeholder", "defaultValue", "size", "shape", "variant", "colorScheme", "isHovered", "isFocused", "isEditable", "isReadOnly", "isDisabled", "isAutoFocus", "isMultiline", "maxRows", "maxCols", "onBlur", "onChange", "onFocus", "onChangeText", "setHint", "setInputValue", "setIsFocused", "setIsHovered", "styles"];
3790
4027
  var TextAreaView = function TextAreaView(_ref) {
3791
4028
  var id = _ref.id,
3792
4029
  name = _ref.name,
@@ -3844,7 +4081,7 @@ var TextAreaView = function TextAreaView(_ref) {
3844
4081
  helperText: {},
3845
4082
  field: {}
3846
4083
  } : _ref$styles,
3847
- props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
4084
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
3848
4085
  var isWithLabel = !!(isFocused && label);
3849
4086
  React.useMemo(function () {
3850
4087
  setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
@@ -3943,210 +4180,6 @@ var TextAreaComponent = function TextAreaComponent(props) {
3943
4180
  */
3944
4181
  var TextArea = TextAreaComponent;
3945
4182
 
3946
- var useTextFieldState = function useTextFieldState(_ref) {
3947
- var label = _ref.label,
3948
- placeholder = _ref.placeholder,
3949
- value = _ref.value;
3950
- var _useState = React.useState(label != null ? label : placeholder),
3951
- hint = _useState[0],
3952
- setHint = _useState[1];
3953
- var _useState2 = React.useState(false),
3954
- isFocused = _useState2[0],
3955
- setIsFocused = _useState2[1];
3956
- var _useState3 = React.useState(false),
3957
- isHovered = _useState3[0],
3958
- setIsHovered = _useState3[1];
3959
- var _useState4 = React.useState(value || ''),
3960
- inputValue = _useState4[0],
3961
- setInputValue = _useState4[1];
3962
- return {
3963
- hint: hint,
3964
- setHint: setHint,
3965
- isFocused: isFocused,
3966
- setIsFocused: setIsFocused,
3967
- isHovered: isHovered,
3968
- setIsHovered: setIsHovered,
3969
- inputValue: inputValue,
3970
- setInputValue: setInputValue
3971
- };
3972
- };
3973
-
3974
- var _excluded$r = ["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"];
3975
- var TextFieldInput = function TextFieldInput(props) {
3976
- return React__default.createElement(appStudio.Input, Object.assign({
3977
- type: "text"
3978
- }, props));
3979
- };
3980
- var TextFieldView = function TextFieldView(_ref) {
3981
- var id = _ref.id,
3982
- name = _ref.name,
3983
- label = _ref.label,
3984
- hint = _ref.hint,
3985
- inputValue = _ref.inputValue,
3986
- onChange = _ref.onChange,
3987
- leftChild = _ref.leftChild,
3988
- rightChild = _ref.rightChild,
3989
- helperText = _ref.helperText,
3990
- placeholder = _ref.placeholder,
3991
- onChangeText = _ref.onChangeText,
3992
- _ref$shadow = _ref.shadow,
3993
- shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
3994
- _ref$styles = _ref.styles,
3995
- styles = _ref$styles === void 0 ? {
3996
- box: {},
3997
- field: {},
3998
- label: {},
3999
- helperText: {},
4000
- text: {}
4001
- } : _ref$styles,
4002
- _ref$size = _ref.size,
4003
- size = _ref$size === void 0 ? 'md' : _ref$size,
4004
- _ref$shape = _ref.shape,
4005
- shape = _ref$shape === void 0 ? 'default' : _ref$shape,
4006
- _ref$variant = _ref.variant,
4007
- variant = _ref$variant === void 0 ? 'default' : _ref$variant,
4008
- _ref$colorScheme = _ref.colorScheme,
4009
- colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
4010
- _ref$error = _ref.error,
4011
- error = _ref$error === void 0 ? false : _ref$error,
4012
- _ref$isFocused = _ref.isFocused,
4013
- isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
4014
- _ref$isHovered = _ref.isHovered,
4015
- isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
4016
- _ref$isDisabled = _ref.isDisabled,
4017
- isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
4018
- _ref$isReadOnly = _ref.isReadOnly,
4019
- isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
4020
- _ref$isClearable = _ref.isClearable,
4021
- isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
4022
- _ref$isAutoFocus = _ref.isAutoFocus,
4023
- isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
4024
- _ref$setHint = _ref.setHint,
4025
- setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
4026
- _ref$setIsFocused = _ref.setIsFocused,
4027
- setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
4028
- _ref$setIsHovered = _ref.setIsHovered,
4029
- setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
4030
- _ref$setInputValue = _ref.setInputValue,
4031
- setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
4032
- onFocus = _ref.onFocus,
4033
- _ref$onBlur = _ref.onBlur,
4034
- onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
4035
- props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
4036
- var _useTheme = appStudio.useTheme(),
4037
- getColor = _useTheme.getColor;
4038
- var IconColor = getColor('color.blueGray.700');
4039
- var isWithLabel = !!(isFocused && label);
4040
- React.useMemo(function () {
4041
- setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
4042
- }, [inputValue, isFocused, label, placeholder]);
4043
- var fieldStyles = _extends({
4044
- margin: 0,
4045
- paddingVertical: 8,
4046
- padddingHorizontal: 0,
4047
- width: '100%',
4048
- heigth: '100%',
4049
- border: 'none',
4050
- on: {
4051
- focus: {
4052
- outline: 'none'
4053
- }
4054
- },
4055
- fontSize: appStudio.Typography.fontSizes[size],
4056
- lineHeight: appStudio.Typography.fontSizes[size],
4057
- backgroundColor: 'transparent',
4058
- color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
4059
- cursor: isDisabled ? 'not-allowed' : 'auto'
4060
- }, styles['field']);
4061
- var handleFocus = function handleFocus() {
4062
- setIsFocused(true);
4063
- if (onFocus) onFocus();
4064
- };
4065
- var handleHover = function handleHover() {
4066
- return setIsHovered(!isHovered);
4067
- };
4068
- var handleBlur = function handleBlur(event) {
4069
- onBlur(event);
4070
- setIsFocused(false);
4071
- };
4072
- var handleChange = function handleChange(event) {
4073
- if (typeof event === 'string') {
4074
- //for ios and android
4075
- setInputValue(event);
4076
- if (onChangeText) onChangeText(event);
4077
- } else {
4078
- //Web
4079
- setInputValue(event.target.value);
4080
- if (onChange) onChange(event);
4081
- }
4082
- };
4083
- var handleClear = function handleClear() {
4084
- setInputValue('');
4085
- //Web
4086
- if (onChange) {
4087
- onBlur({
4088
- target: {
4089
- name: name
4090
- }
4091
- });
4092
- onChange({
4093
- target: {
4094
- name: name,
4095
- value: ''
4096
- }
4097
- });
4098
- }
4099
- //for ios and android
4100
- if (typeof document === 'undefined' && onChangeText) onChangeText('');
4101
- };
4102
- return React__default.createElement(FieldContainer, {
4103
- helperText: helperText,
4104
- error: error,
4105
- styles: styles
4106
- }, React__default.createElement(FieldContent, {
4107
- label: label,
4108
- size: size,
4109
- error: error,
4110
- shape: shape,
4111
- styles: styles,
4112
- shadow: shadow,
4113
- variant: variant,
4114
- value: inputValue,
4115
- color: colorScheme,
4116
- isHovered: isHovered,
4117
- isDisabled: isDisabled,
4118
- isReadOnly: isReadOnly,
4119
- isFocused: isFocused,
4120
- isWithLabel: isWithLabel,
4121
- colorScheme: colorScheme,
4122
- onMouseEnter: handleHover,
4123
- onMouseLeave: handleHover
4124
- }, leftChild, React__default.createElement(FieldWrapper, null, isWithLabel && React__default.createElement(FieldLabel, Object.assign({
4125
- htmlFor: id,
4126
- color: colorScheme,
4127
- error: error
4128
- }, styles), label), React__default.createElement(TextFieldInput, Object.assign({
4129
- id: id,
4130
- name: name,
4131
- value: inputValue,
4132
- readOnly: isReadOnly,
4133
- disabled: isDisabled,
4134
- autoFocus: isAutoFocus,
4135
- placeholder: hint,
4136
- onFocus: handleFocus,
4137
- onBlur: handleBlur,
4138
- autoComplete: "off"
4139
- }, fieldStyles, props, {
4140
- onChange: handleChange
4141
- }, onChangeText && {
4142
- onChangeText: handleChange
4143
- }))), (rightChild || isClearable && inputValue) && React__default.createElement(FieldIcons, null, rightChild && React__default.createElement(React__default.Fragment, null, rightChild), isClearable && inputValue && !isReadOnly && !isDisabled && React__default.createElement(CloseSvg, {
4144
- size: appStudio.Typography.fontSizes[size],
4145
- color: IconColor,
4146
- onClick: handleClear
4147
- }))));
4148
- };
4149
-
4150
4183
  var TextFieldComponent = function TextFieldComponent(props) {
4151
4184
  var textFieldStates = useTextFieldState(props);
4152
4185
  return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
@@ -4156,31 +4189,6 @@ var TextFieldComponent = function TextFieldComponent(props) {
4156
4189
  */
4157
4190
  var TextField = TextFieldComponent;
4158
4191
 
4159
- var PasswordComponent = function PasswordComponent(props) {
4160
- var passwordState = usePasswordState();
4161
- return React__default.createElement(TextField, Object.assign({
4162
- type: passwordState.isVisible ? 'text' : 'password',
4163
- isClearable: false,
4164
- visibleIcon: React__default.createElement(OpenEyeSvg, {
4165
- size: 14
4166
- }),
4167
- hiddenIcon: React__default.createElement(CloseEyeSvg, {
4168
- size: 14
4169
- }),
4170
- rightChild: React__default.createElement(appStudio.View, {
4171
- onClick: function onClick() {
4172
- if (!props.isDisabled) {
4173
- passwordState.setIsVisible(!props.isVisible);
4174
- }
4175
- }
4176
- }, passwordState.isVisible ? props.visibleIcon : props.hiddenIcon)
4177
- }, props));
4178
- };
4179
- /**
4180
- * To allow users to securely enter sensitive information
4181
- */
4182
- var Password = PasswordComponent;
4183
-
4184
4192
  var DefaultSizes = {
4185
4193
  xs: 14,
4186
4194
  sm: 18,
@@ -4199,8 +4207,8 @@ var DefaultSpeeds = {
4199
4207
  slow: 300
4200
4208
  };
4201
4209
 
4202
- var _excluded$s = ["size", "speed", "color"],
4203
- _excluded2$1 = ["size", "speed", "color"],
4210
+ var _excluded$t = ["size", "speed", "color"],
4211
+ _excluded2$2 = ["size", "speed", "color"],
4204
4212
  _excluded3$1 = ["size", "speed", "color"],
4205
4213
  _excluded4$1 = ["size", "children", "textColor", "loaderColor", "type", "speed", "textPosition"];
4206
4214
  var DefaultSpinner = function DefaultSpinner(_ref) {
@@ -4210,7 +4218,7 @@ var DefaultSpinner = function DefaultSpinner(_ref) {
4210
4218
  speed = _ref$speed === void 0 ? 'normal' : _ref$speed,
4211
4219
  _ref$color = _ref.color,
4212
4220
  color = _ref$color === void 0 ? 'theme.loading' : _ref$color,
4213
- props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
4221
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
4214
4222
  var theme = appStudio.useTheme();
4215
4223
  var colorStyle = theme.getColor(color);
4216
4224
  var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
@@ -4260,7 +4268,7 @@ var Dotted = function Dotted(_ref2) {
4260
4268
  speed = _ref2$speed === void 0 ? 'normal' : _ref2$speed,
4261
4269
  _ref2$color = _ref2.color,
4262
4270
  color = _ref2$color === void 0 ? 'theme.loading' : _ref2$color,
4263
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$1);
4271
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
4264
4272
  var theme = appStudio.useTheme();
4265
4273
  var colorStyle = theme.getColor(color);
4266
4274
  var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
@@ -4460,8 +4468,8 @@ var HeaderIconSizes = {
4460
4468
  xl: 28
4461
4469
  };
4462
4470
 
4463
- var _excluded$t = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
4464
- _excluded2$2 = ["children", "shadow", "isFullScreen", "shape"],
4471
+ var _excluded$u = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
4472
+ _excluded2$3 = ["children", "shadow", "isFullScreen", "shape"],
4465
4473
  _excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
4466
4474
  _excluded4$2 = ["children"],
4467
4475
  _excluded5 = ["children"];
@@ -4476,7 +4484,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
4476
4484
  onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
4477
4485
  _ref$position = _ref.position,
4478
4486
  position = _ref$position === void 0 ? 'center' : _ref$position,
4479
- props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
4487
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
4480
4488
  var handleClick = function handleClick() {
4481
4489
  if (!isClosePrevented) onClose();
4482
4490
  };
@@ -4510,7 +4518,7 @@ var ModalContainer = function ModalContainer(_ref2) {
4510
4518
  isFullScreen = _ref2$isFullScreen === void 0 ? false : _ref2$isFullScreen,
4511
4519
  _ref2$shape = _ref2.shape,
4512
4520
  shape = _ref2$shape === void 0 ? 'rounded' : _ref2$shape,
4513
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$2);
4521
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);
4514
4522
  var defaultShadow = typeof document !== undefined ? {
4515
4523
  boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.3)'
4516
4524
  } : {
@@ -4633,12 +4641,12 @@ Modal.Body = ModalBody;
4633
4641
  Modal.Footer = ModalFooter;
4634
4642
  Modal.Layout = ModalLayout;
4635
4643
 
4636
- var _excluded$u = ["src", "color"],
4637
- _excluded2$3 = ["path"];
4644
+ var _excluded$v = ["src", "color"],
4645
+ _excluded2$4 = ["path"];
4638
4646
  var FileSVG = function FileSVG(_ref) {
4639
4647
  var src = _ref.src,
4640
4648
  color = _ref.color,
4641
- props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
4649
+ props = _objectWithoutPropertiesLoose(_ref, _excluded$v);
4642
4650
  var _useTheme = appStudio.useTheme(),
4643
4651
  getColor = _useTheme.getColor;
4644
4652
  var Colorprops = color ? {
@@ -4653,7 +4661,7 @@ var FileSVG = function FileSVG(_ref) {
4653
4661
  };
4654
4662
  var FileImage = function FileImage(_ref2) {
4655
4663
  var path = _ref2.path,
4656
- props = _objectWithoutPropertiesLoose(_ref2, _excluded2$3);
4664
+ props = _objectWithoutPropertiesLoose(_ref2, _excluded2$4);
4657
4665
  return React__default.createElement(appStudio.Image, Object.assign({
4658
4666
  src: path
4659
4667
  }, props));