@app-studio/web 0.3.33 → 0.3.35
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/Form/Password/Password/Password.props.d.ts +10 -0
- package/dist/web.cjs.development.js +251 -265
- 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 +252 -266
- package/dist/web.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/Form/Password/Password/Password.view.d.ts +0 -4
package/dist/web.esm.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { useState, useRef, useEffect,
|
|
1
|
+
import React, { useState, useRef, useEffect, useCallback, useMemo, Fragment } from 'react';
|
|
2
2
|
import { View as View$1, Element, Typography, useTheme, Input, Image } from 'app-studio';
|
|
3
3
|
import { Link as Link$1 } from 'react-router-dom';
|
|
4
4
|
import format from 'date-fns/format';
|
|
5
|
+
import 'formik';
|
|
5
6
|
import { create } from 'zustand';
|
|
6
7
|
|
|
7
8
|
var useButtonState = function useButtonState() {
|
|
@@ -3138,259 +3139,6 @@ var usePasswordState = function usePasswordState() {
|
|
|
3138
3139
|
};
|
|
3139
3140
|
};
|
|
3140
3141
|
|
|
3141
|
-
var useTextFieldState = function useTextFieldState(_ref) {
|
|
3142
|
-
var label = _ref.label,
|
|
3143
|
-
placeholder = _ref.placeholder,
|
|
3144
|
-
value = _ref.value;
|
|
3145
|
-
var _useState = useState(label != null ? label : placeholder),
|
|
3146
|
-
hint = _useState[0],
|
|
3147
|
-
setHint = _useState[1];
|
|
3148
|
-
var _useState2 = useState(false),
|
|
3149
|
-
isFocused = _useState2[0],
|
|
3150
|
-
setIsFocused = _useState2[1];
|
|
3151
|
-
var _useState3 = useState(false),
|
|
3152
|
-
isHovered = _useState3[0],
|
|
3153
|
-
setIsHovered = _useState3[1];
|
|
3154
|
-
var _useState4 = useState(value || ''),
|
|
3155
|
-
inputValue = _useState4[0],
|
|
3156
|
-
setInputValue = _useState4[1];
|
|
3157
|
-
return {
|
|
3158
|
-
hint: hint,
|
|
3159
|
-
setHint: setHint,
|
|
3160
|
-
isFocused: isFocused,
|
|
3161
|
-
setIsFocused: setIsFocused,
|
|
3162
|
-
isHovered: isHovered,
|
|
3163
|
-
setIsHovered: setIsHovered,
|
|
3164
|
-
inputValue: inputValue,
|
|
3165
|
-
setInputValue: setInputValue
|
|
3166
|
-
};
|
|
3167
|
-
};
|
|
3168
|
-
|
|
3169
|
-
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"];
|
|
3170
|
-
var TextFieldInput = function TextFieldInput(props) {
|
|
3171
|
-
return React.createElement(Input, Object.assign({
|
|
3172
|
-
type: "text"
|
|
3173
|
-
}, props));
|
|
3174
|
-
};
|
|
3175
|
-
var TextFieldView = function TextFieldView(_ref) {
|
|
3176
|
-
var id = _ref.id,
|
|
3177
|
-
name = _ref.name,
|
|
3178
|
-
label = _ref.label,
|
|
3179
|
-
hint = _ref.hint,
|
|
3180
|
-
inputValue = _ref.inputValue,
|
|
3181
|
-
onChange = _ref.onChange,
|
|
3182
|
-
leftChild = _ref.leftChild,
|
|
3183
|
-
rightChild = _ref.rightChild,
|
|
3184
|
-
helperText = _ref.helperText,
|
|
3185
|
-
placeholder = _ref.placeholder,
|
|
3186
|
-
onChangeText = _ref.onChangeText,
|
|
3187
|
-
_ref$shadow = _ref.shadow,
|
|
3188
|
-
shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
|
|
3189
|
-
_ref$styles = _ref.styles,
|
|
3190
|
-
styles = _ref$styles === void 0 ? {
|
|
3191
|
-
box: {},
|
|
3192
|
-
field: {},
|
|
3193
|
-
label: {},
|
|
3194
|
-
helperText: {},
|
|
3195
|
-
text: {}
|
|
3196
|
-
} : _ref$styles,
|
|
3197
|
-
_ref$size = _ref.size,
|
|
3198
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3199
|
-
_ref$shape = _ref.shape,
|
|
3200
|
-
shape = _ref$shape === void 0 ? 'default' : _ref$shape,
|
|
3201
|
-
_ref$variant = _ref.variant,
|
|
3202
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
3203
|
-
_ref$colorScheme = _ref.colorScheme,
|
|
3204
|
-
colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
|
|
3205
|
-
_ref$error = _ref.error,
|
|
3206
|
-
error = _ref$error === void 0 ? false : _ref$error,
|
|
3207
|
-
_ref$isFocused = _ref.isFocused,
|
|
3208
|
-
isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
|
|
3209
|
-
_ref$isHovered = _ref.isHovered,
|
|
3210
|
-
isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
|
|
3211
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3212
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3213
|
-
_ref$isReadOnly = _ref.isReadOnly,
|
|
3214
|
-
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
3215
|
-
_ref$isClearable = _ref.isClearable,
|
|
3216
|
-
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
|
3217
|
-
_ref$isAutoFocus = _ref.isAutoFocus,
|
|
3218
|
-
isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
|
|
3219
|
-
_ref$setHint = _ref.setHint,
|
|
3220
|
-
setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
|
|
3221
|
-
_ref$setIsFocused = _ref.setIsFocused,
|
|
3222
|
-
setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
|
|
3223
|
-
_ref$setIsHovered = _ref.setIsHovered,
|
|
3224
|
-
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
3225
|
-
_ref$setInputValue = _ref.setInputValue,
|
|
3226
|
-
setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
|
|
3227
|
-
onFocus = _ref.onFocus,
|
|
3228
|
-
_ref$onBlur = _ref.onBlur,
|
|
3229
|
-
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
3230
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
3231
|
-
var _useTheme = useTheme(),
|
|
3232
|
-
getColor = _useTheme.getColor;
|
|
3233
|
-
var IconColor = getColor('color.blueGray.700');
|
|
3234
|
-
var isWithLabel = !!(isFocused && label);
|
|
3235
|
-
useMemo(function () {
|
|
3236
|
-
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
3237
|
-
}, [inputValue, isFocused, label, placeholder]);
|
|
3238
|
-
var fieldStyles = _extends({
|
|
3239
|
-
margin: 0,
|
|
3240
|
-
paddingVertical: 8,
|
|
3241
|
-
padddingHorizontal: 0,
|
|
3242
|
-
width: '100%',
|
|
3243
|
-
heigth: '100%',
|
|
3244
|
-
border: 'none',
|
|
3245
|
-
on: {
|
|
3246
|
-
focus: {
|
|
3247
|
-
outline: 'none'
|
|
3248
|
-
}
|
|
3249
|
-
},
|
|
3250
|
-
fontSize: Typography.fontSizes[size],
|
|
3251
|
-
lineHeight: Typography.fontSizes[size],
|
|
3252
|
-
backgroundColor: 'transparent',
|
|
3253
|
-
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
3254
|
-
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
3255
|
-
}, styles['field']);
|
|
3256
|
-
var handleFocus = function handleFocus() {
|
|
3257
|
-
setIsFocused(true);
|
|
3258
|
-
if (onFocus) onFocus();
|
|
3259
|
-
};
|
|
3260
|
-
var handleHover = function handleHover() {
|
|
3261
|
-
return setIsHovered(!isHovered);
|
|
3262
|
-
};
|
|
3263
|
-
var handleBlur = function handleBlur(event) {
|
|
3264
|
-
onBlur(event);
|
|
3265
|
-
setIsFocused(false);
|
|
3266
|
-
};
|
|
3267
|
-
var handleChange = function handleChange(event) {
|
|
3268
|
-
if (typeof event === 'string') {
|
|
3269
|
-
//for ios and android
|
|
3270
|
-
setInputValue(event);
|
|
3271
|
-
if (onChangeText) onChangeText(event);
|
|
3272
|
-
} else {
|
|
3273
|
-
//Web
|
|
3274
|
-
setInputValue(event.target.value);
|
|
3275
|
-
if (onChange) onChange(event);
|
|
3276
|
-
}
|
|
3277
|
-
};
|
|
3278
|
-
var handleClear = function handleClear() {
|
|
3279
|
-
setInputValue('');
|
|
3280
|
-
//Web
|
|
3281
|
-
if (onChange) {
|
|
3282
|
-
onBlur({
|
|
3283
|
-
target: {
|
|
3284
|
-
name: name
|
|
3285
|
-
}
|
|
3286
|
-
});
|
|
3287
|
-
onChange({
|
|
3288
|
-
target: {
|
|
3289
|
-
name: name,
|
|
3290
|
-
value: ''
|
|
3291
|
-
}
|
|
3292
|
-
});
|
|
3293
|
-
}
|
|
3294
|
-
//for ios and android
|
|
3295
|
-
if (typeof document === 'undefined' && onChangeText) onChangeText('');
|
|
3296
|
-
};
|
|
3297
|
-
return React.createElement(FieldContainer, {
|
|
3298
|
-
helperText: helperText,
|
|
3299
|
-
error: error,
|
|
3300
|
-
styles: styles
|
|
3301
|
-
}, React.createElement(FieldContent, {
|
|
3302
|
-
label: label,
|
|
3303
|
-
size: size,
|
|
3304
|
-
error: error,
|
|
3305
|
-
shape: shape,
|
|
3306
|
-
styles: styles,
|
|
3307
|
-
shadow: shadow,
|
|
3308
|
-
variant: variant,
|
|
3309
|
-
value: inputValue,
|
|
3310
|
-
color: colorScheme,
|
|
3311
|
-
isHovered: isHovered,
|
|
3312
|
-
isDisabled: isDisabled,
|
|
3313
|
-
isReadOnly: isReadOnly,
|
|
3314
|
-
isFocused: isFocused,
|
|
3315
|
-
isWithLabel: isWithLabel,
|
|
3316
|
-
colorScheme: colorScheme,
|
|
3317
|
-
onMouseEnter: handleHover,
|
|
3318
|
-
onMouseLeave: handleHover
|
|
3319
|
-
}, leftChild, React.createElement(FieldWrapper, null, isWithLabel && React.createElement(FieldLabel, Object.assign({
|
|
3320
|
-
htmlFor: id,
|
|
3321
|
-
color: colorScheme,
|
|
3322
|
-
error: error
|
|
3323
|
-
}, styles), label), React.createElement(TextFieldInput, Object.assign({
|
|
3324
|
-
id: id,
|
|
3325
|
-
name: name,
|
|
3326
|
-
value: inputValue,
|
|
3327
|
-
readOnly: isReadOnly,
|
|
3328
|
-
disabled: isDisabled,
|
|
3329
|
-
autoFocus: isAutoFocus,
|
|
3330
|
-
placeholder: hint,
|
|
3331
|
-
onFocus: handleFocus,
|
|
3332
|
-
onBlur: handleBlur,
|
|
3333
|
-
autoComplete: "off"
|
|
3334
|
-
}, fieldStyles, props, {
|
|
3335
|
-
onChange: handleChange
|
|
3336
|
-
}, onChangeText && {
|
|
3337
|
-
onChangeText: handleChange
|
|
3338
|
-
}))), (rightChild || isClearable && inputValue) && React.createElement(FieldIcons, null, rightChild && React.createElement(React.Fragment, null, rightChild), isClearable && inputValue && !isReadOnly && !isDisabled && React.createElement(CloseSvg, {
|
|
3339
|
-
size: Typography.fontSizes[size],
|
|
3340
|
-
color: IconColor,
|
|
3341
|
-
onClick: handleClear
|
|
3342
|
-
}))));
|
|
3343
|
-
};
|
|
3344
|
-
|
|
3345
|
-
var TextFieldComponent = function TextFieldComponent(props) {
|
|
3346
|
-
var textFieldStates = useTextFieldState(props);
|
|
3347
|
-
return React.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
|
|
3348
|
-
};
|
|
3349
|
-
/**
|
|
3350
|
-
* TextField is used to capture text data from users.
|
|
3351
|
-
*/
|
|
3352
|
-
var TextField = TextFieldComponent;
|
|
3353
|
-
|
|
3354
|
-
var _excluded$p = ["name", "visibleIcon", "hiddenIcon", "isDisabled"];
|
|
3355
|
-
var PasswordView = function PasswordView(_ref) {
|
|
3356
|
-
var name = _ref.name,
|
|
3357
|
-
_ref$visibleIcon = _ref.visibleIcon,
|
|
3358
|
-
visibleIcon = _ref$visibleIcon === void 0 ? React.createElement(OpenEyeSvg, {
|
|
3359
|
-
size: 14
|
|
3360
|
-
}) : _ref$visibleIcon,
|
|
3361
|
-
_ref$hiddenIcon = _ref.hiddenIcon,
|
|
3362
|
-
hiddenIcon = _ref$hiddenIcon === void 0 ? React.createElement(CloseEyeSvg, {
|
|
3363
|
-
size: 14
|
|
3364
|
-
}) : _ref$hiddenIcon,
|
|
3365
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3366
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3367
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
3368
|
-
var _useState = useState(false),
|
|
3369
|
-
visible = _useState[0],
|
|
3370
|
-
setVisible = _useState[1];
|
|
3371
|
-
return React.createElement(TextField, Object.assign({
|
|
3372
|
-
name: name,
|
|
3373
|
-
type: visible ? 'text' : 'password',
|
|
3374
|
-
rightChild: React.createElement(View, {
|
|
3375
|
-
onClick: function onClick() {
|
|
3376
|
-
if (!isDisabled) {
|
|
3377
|
-
setVisible(!visible);
|
|
3378
|
-
}
|
|
3379
|
-
}
|
|
3380
|
-
}, visible ? visibleIcon : hiddenIcon),
|
|
3381
|
-
isClearable: false
|
|
3382
|
-
}, props));
|
|
3383
|
-
};
|
|
3384
|
-
|
|
3385
|
-
var PasswordComponent = function PasswordComponent(props) {
|
|
3386
|
-
var passwordState = usePasswordState();
|
|
3387
|
-
return React.createElement(PasswordView, Object.assign({}, passwordState, props));
|
|
3388
|
-
};
|
|
3389
|
-
/**
|
|
3390
|
-
* To allow users to securely enter sensitive information
|
|
3391
|
-
*/
|
|
3392
|
-
var Password = PasswordComponent;
|
|
3393
|
-
|
|
3394
3142
|
var useSelectState = function useSelectState(_ref) {
|
|
3395
3143
|
var placeholder = _ref.placeholder,
|
|
3396
3144
|
isMulti = _ref.isMulti,
|
|
@@ -3437,7 +3185,7 @@ var IconSizes$4 = {
|
|
|
3437
3185
|
xl: 16
|
|
3438
3186
|
};
|
|
3439
3187
|
|
|
3440
|
-
var _excluded$
|
|
3188
|
+
var _excluded$o = ["isHovered", "setIsHovered", "option", "size", "callback"],
|
|
3441
3189
|
_excluded2 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
|
|
3442
3190
|
_excluded3 = ["option", "size", "removeOption"],
|
|
3443
3191
|
_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"];
|
|
@@ -3449,7 +3197,7 @@ var Item = function Item(_ref) {
|
|
|
3449
3197
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3450
3198
|
_ref$callback = _ref.callback,
|
|
3451
3199
|
callback = _ref$callback === void 0 ? function () {} : _ref$callback,
|
|
3452
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3200
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
3453
3201
|
var handleOptionClick = function handleOptionClick(option) {
|
|
3454
3202
|
return callback(option);
|
|
3455
3203
|
};
|
|
@@ -3919,7 +3667,7 @@ var SliderPadding = {
|
|
|
3919
3667
|
}
|
|
3920
3668
|
};
|
|
3921
3669
|
|
|
3922
|
-
var _excluded$
|
|
3670
|
+
var _excluded$p = ["id", "name", "inActiveChild", "activeChild", "shadow", "size", "colorScheme", "on", "isHovered", "isChecked", "isDisabled", "isReadOnly", "onChange", "onValueChange", "setOn", "setIsHovered", "styles"];
|
|
3923
3671
|
var SwitchContent = function SwitchContent(props) {
|
|
3924
3672
|
return React.createElement(Input, Object.assign({
|
|
3925
3673
|
type: "checkbox"
|
|
@@ -3955,7 +3703,7 @@ var SwitchView = function SwitchView(_ref) {
|
|
|
3955
3703
|
slider: {},
|
|
3956
3704
|
circle: {}
|
|
3957
3705
|
} : _ref$styles,
|
|
3958
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3706
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
3959
3707
|
var handleToggle = function handleToggle(event) {
|
|
3960
3708
|
if (!isReadOnly) {
|
|
3961
3709
|
setOn(!on);
|
|
@@ -4031,7 +3779,7 @@ var useTextAreaState = function useTextAreaState(_ref) {
|
|
|
4031
3779
|
};
|
|
4032
3780
|
};
|
|
4033
3781
|
|
|
4034
|
-
var _excluded$
|
|
3782
|
+
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"];
|
|
4035
3783
|
var TextAreaView = function TextAreaView(_ref) {
|
|
4036
3784
|
var id = _ref.id,
|
|
4037
3785
|
name = _ref.name,
|
|
@@ -4089,7 +3837,7 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4089
3837
|
helperText: {},
|
|
4090
3838
|
field: {}
|
|
4091
3839
|
} : _ref$styles,
|
|
4092
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3840
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
4093
3841
|
var isWithLabel = !!(isFocused && label);
|
|
4094
3842
|
useMemo(function () {
|
|
4095
3843
|
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
@@ -4188,6 +3936,244 @@ var TextAreaComponent = function TextAreaComponent(props) {
|
|
|
4188
3936
|
*/
|
|
4189
3937
|
var TextArea = TextAreaComponent;
|
|
4190
3938
|
|
|
3939
|
+
var useTextFieldState = function useTextFieldState(_ref) {
|
|
3940
|
+
var label = _ref.label,
|
|
3941
|
+
placeholder = _ref.placeholder,
|
|
3942
|
+
value = _ref.value;
|
|
3943
|
+
var _useState = useState(label != null ? label : placeholder),
|
|
3944
|
+
hint = _useState[0],
|
|
3945
|
+
setHint = _useState[1];
|
|
3946
|
+
var _useState2 = useState(false),
|
|
3947
|
+
isFocused = _useState2[0],
|
|
3948
|
+
setIsFocused = _useState2[1];
|
|
3949
|
+
var _useState3 = useState(false),
|
|
3950
|
+
isHovered = _useState3[0],
|
|
3951
|
+
setIsHovered = _useState3[1];
|
|
3952
|
+
var _useState4 = useState(value || ''),
|
|
3953
|
+
inputValue = _useState4[0],
|
|
3954
|
+
setInputValue = _useState4[1];
|
|
3955
|
+
return {
|
|
3956
|
+
hint: hint,
|
|
3957
|
+
setHint: setHint,
|
|
3958
|
+
isFocused: isFocused,
|
|
3959
|
+
setIsFocused: setIsFocused,
|
|
3960
|
+
isHovered: isHovered,
|
|
3961
|
+
setIsHovered: setIsHovered,
|
|
3962
|
+
inputValue: inputValue,
|
|
3963
|
+
setInputValue: setInputValue
|
|
3964
|
+
};
|
|
3965
|
+
};
|
|
3966
|
+
|
|
3967
|
+
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"];
|
|
3968
|
+
var TextFieldInput = function TextFieldInput(props) {
|
|
3969
|
+
return React.createElement(Input, Object.assign({
|
|
3970
|
+
type: "text"
|
|
3971
|
+
}, props));
|
|
3972
|
+
};
|
|
3973
|
+
var TextFieldView = function TextFieldView(_ref) {
|
|
3974
|
+
var id = _ref.id,
|
|
3975
|
+
name = _ref.name,
|
|
3976
|
+
label = _ref.label,
|
|
3977
|
+
hint = _ref.hint,
|
|
3978
|
+
inputValue = _ref.inputValue,
|
|
3979
|
+
onChange = _ref.onChange,
|
|
3980
|
+
leftChild = _ref.leftChild,
|
|
3981
|
+
rightChild = _ref.rightChild,
|
|
3982
|
+
helperText = _ref.helperText,
|
|
3983
|
+
placeholder = _ref.placeholder,
|
|
3984
|
+
onChangeText = _ref.onChangeText,
|
|
3985
|
+
_ref$shadow = _ref.shadow,
|
|
3986
|
+
shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
|
|
3987
|
+
_ref$styles = _ref.styles,
|
|
3988
|
+
styles = _ref$styles === void 0 ? {
|
|
3989
|
+
box: {},
|
|
3990
|
+
field: {},
|
|
3991
|
+
label: {},
|
|
3992
|
+
helperText: {},
|
|
3993
|
+
text: {}
|
|
3994
|
+
} : _ref$styles,
|
|
3995
|
+
_ref$size = _ref.size,
|
|
3996
|
+
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3997
|
+
_ref$shape = _ref.shape,
|
|
3998
|
+
shape = _ref$shape === void 0 ? 'default' : _ref$shape,
|
|
3999
|
+
_ref$variant = _ref.variant,
|
|
4000
|
+
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
4001
|
+
_ref$colorScheme = _ref.colorScheme,
|
|
4002
|
+
colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
|
|
4003
|
+
_ref$error = _ref.error,
|
|
4004
|
+
error = _ref$error === void 0 ? false : _ref$error,
|
|
4005
|
+
_ref$isFocused = _ref.isFocused,
|
|
4006
|
+
isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
|
|
4007
|
+
_ref$isHovered = _ref.isHovered,
|
|
4008
|
+
isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
|
|
4009
|
+
_ref$isDisabled = _ref.isDisabled,
|
|
4010
|
+
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
4011
|
+
_ref$isReadOnly = _ref.isReadOnly,
|
|
4012
|
+
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
4013
|
+
_ref$isClearable = _ref.isClearable,
|
|
4014
|
+
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
|
4015
|
+
_ref$isAutoFocus = _ref.isAutoFocus,
|
|
4016
|
+
isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
|
|
4017
|
+
_ref$setHint = _ref.setHint,
|
|
4018
|
+
setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
|
|
4019
|
+
_ref$setIsFocused = _ref.setIsFocused,
|
|
4020
|
+
setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
|
|
4021
|
+
_ref$setIsHovered = _ref.setIsHovered,
|
|
4022
|
+
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
4023
|
+
_ref$setInputValue = _ref.setInputValue,
|
|
4024
|
+
setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
|
|
4025
|
+
onFocus = _ref.onFocus,
|
|
4026
|
+
_ref$onBlur = _ref.onBlur,
|
|
4027
|
+
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
4028
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$r);
|
|
4029
|
+
var _useTheme = useTheme(),
|
|
4030
|
+
getColor = _useTheme.getColor;
|
|
4031
|
+
var IconColor = getColor('color.blueGray.700');
|
|
4032
|
+
var isWithLabel = !!(isFocused && label);
|
|
4033
|
+
useMemo(function () {
|
|
4034
|
+
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
4035
|
+
}, [inputValue, isFocused, label, placeholder]);
|
|
4036
|
+
var fieldStyles = _extends({
|
|
4037
|
+
margin: 0,
|
|
4038
|
+
paddingVertical: 8,
|
|
4039
|
+
padddingHorizontal: 0,
|
|
4040
|
+
width: '100%',
|
|
4041
|
+
heigth: '100%',
|
|
4042
|
+
border: 'none',
|
|
4043
|
+
on: {
|
|
4044
|
+
focus: {
|
|
4045
|
+
outline: 'none'
|
|
4046
|
+
}
|
|
4047
|
+
},
|
|
4048
|
+
fontSize: Typography.fontSizes[size],
|
|
4049
|
+
lineHeight: Typography.fontSizes[size],
|
|
4050
|
+
backgroundColor: 'transparent',
|
|
4051
|
+
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
4052
|
+
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
4053
|
+
}, styles['field']);
|
|
4054
|
+
var handleFocus = function handleFocus() {
|
|
4055
|
+
setIsFocused(true);
|
|
4056
|
+
if (onFocus) onFocus();
|
|
4057
|
+
};
|
|
4058
|
+
var handleHover = function handleHover() {
|
|
4059
|
+
return setIsHovered(!isHovered);
|
|
4060
|
+
};
|
|
4061
|
+
var handleBlur = function handleBlur(event) {
|
|
4062
|
+
onBlur(event);
|
|
4063
|
+
setIsFocused(false);
|
|
4064
|
+
};
|
|
4065
|
+
var handleChange = function handleChange(event) {
|
|
4066
|
+
if (typeof event === 'string') {
|
|
4067
|
+
//for ios and android
|
|
4068
|
+
setInputValue(event);
|
|
4069
|
+
if (onChangeText) onChangeText(event);
|
|
4070
|
+
} else {
|
|
4071
|
+
//Web
|
|
4072
|
+
setInputValue(event.target.value);
|
|
4073
|
+
if (onChange) onChange(event);
|
|
4074
|
+
}
|
|
4075
|
+
};
|
|
4076
|
+
var handleClear = function handleClear() {
|
|
4077
|
+
setInputValue('');
|
|
4078
|
+
//Web
|
|
4079
|
+
if (onChange) {
|
|
4080
|
+
onBlur({
|
|
4081
|
+
target: {
|
|
4082
|
+
name: name
|
|
4083
|
+
}
|
|
4084
|
+
});
|
|
4085
|
+
onChange({
|
|
4086
|
+
target: {
|
|
4087
|
+
name: name,
|
|
4088
|
+
value: ''
|
|
4089
|
+
}
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
//for ios and android
|
|
4093
|
+
if (typeof document === 'undefined' && onChangeText) onChangeText('');
|
|
4094
|
+
};
|
|
4095
|
+
return React.createElement(FieldContainer, {
|
|
4096
|
+
helperText: helperText,
|
|
4097
|
+
error: error,
|
|
4098
|
+
styles: styles
|
|
4099
|
+
}, React.createElement(FieldContent, {
|
|
4100
|
+
label: label,
|
|
4101
|
+
size: size,
|
|
4102
|
+
error: error,
|
|
4103
|
+
shape: shape,
|
|
4104
|
+
styles: styles,
|
|
4105
|
+
shadow: shadow,
|
|
4106
|
+
variant: variant,
|
|
4107
|
+
value: inputValue,
|
|
4108
|
+
color: colorScheme,
|
|
4109
|
+
isHovered: isHovered,
|
|
4110
|
+
isDisabled: isDisabled,
|
|
4111
|
+
isReadOnly: isReadOnly,
|
|
4112
|
+
isFocused: isFocused,
|
|
4113
|
+
isWithLabel: isWithLabel,
|
|
4114
|
+
colorScheme: colorScheme,
|
|
4115
|
+
onMouseEnter: handleHover,
|
|
4116
|
+
onMouseLeave: handleHover
|
|
4117
|
+
}, leftChild, React.createElement(FieldWrapper, null, isWithLabel && React.createElement(FieldLabel, Object.assign({
|
|
4118
|
+
htmlFor: id,
|
|
4119
|
+
color: colorScheme,
|
|
4120
|
+
error: error
|
|
4121
|
+
}, styles), label), React.createElement(TextFieldInput, Object.assign({
|
|
4122
|
+
id: id,
|
|
4123
|
+
name: name,
|
|
4124
|
+
value: inputValue,
|
|
4125
|
+
readOnly: isReadOnly,
|
|
4126
|
+
disabled: isDisabled,
|
|
4127
|
+
autoFocus: isAutoFocus,
|
|
4128
|
+
placeholder: hint,
|
|
4129
|
+
onFocus: handleFocus,
|
|
4130
|
+
onBlur: handleBlur,
|
|
4131
|
+
autoComplete: "off"
|
|
4132
|
+
}, fieldStyles, props, {
|
|
4133
|
+
onChange: handleChange
|
|
4134
|
+
}, onChangeText && {
|
|
4135
|
+
onChangeText: handleChange
|
|
4136
|
+
}))), (rightChild || isClearable && inputValue) && React.createElement(FieldIcons, null, rightChild && React.createElement(React.Fragment, null, rightChild), isClearable && inputValue && !isReadOnly && !isDisabled && React.createElement(CloseSvg, {
|
|
4137
|
+
size: Typography.fontSizes[size],
|
|
4138
|
+
color: IconColor,
|
|
4139
|
+
onClick: handleClear
|
|
4140
|
+
}))));
|
|
4141
|
+
};
|
|
4142
|
+
|
|
4143
|
+
var TextFieldComponent = function TextFieldComponent(props) {
|
|
4144
|
+
var textFieldStates = useTextFieldState(props);
|
|
4145
|
+
return React.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
|
|
4146
|
+
};
|
|
4147
|
+
/**
|
|
4148
|
+
* TextField is used to capture text data from users.
|
|
4149
|
+
*/
|
|
4150
|
+
var TextField = TextFieldComponent;
|
|
4151
|
+
|
|
4152
|
+
var PasswordComponent = function PasswordComponent(props) {
|
|
4153
|
+
var passwordState = usePasswordState();
|
|
4154
|
+
return React.createElement(TextField, Object.assign({
|
|
4155
|
+
type: passwordState.isVisible ? 'text' : 'password',
|
|
4156
|
+
isClearable: false,
|
|
4157
|
+
visibleIcon: React.createElement(OpenEyeSvg, {
|
|
4158
|
+
size: 14
|
|
4159
|
+
}),
|
|
4160
|
+
hiddenIcon: React.createElement(CloseEyeSvg, {
|
|
4161
|
+
size: 14
|
|
4162
|
+
}),
|
|
4163
|
+
rightChild: React.createElement(View$1, {
|
|
4164
|
+
onClick: function onClick() {
|
|
4165
|
+
if (!props.isDisabled) {
|
|
4166
|
+
passwordState.setIsVisible(!props.isVisible);
|
|
4167
|
+
}
|
|
4168
|
+
}
|
|
4169
|
+
}, passwordState.isVisible ? props.visibleIcon : props.hiddenIcon)
|
|
4170
|
+
}, props));
|
|
4171
|
+
};
|
|
4172
|
+
/**
|
|
4173
|
+
* To allow users to securely enter sensitive information
|
|
4174
|
+
*/
|
|
4175
|
+
var Password = PasswordComponent;
|
|
4176
|
+
|
|
4191
4177
|
var DefaultSizes = {
|
|
4192
4178
|
xs: 14,
|
|
4193
4179
|
sm: 18,
|
|
@@ -4206,7 +4192,7 @@ var DefaultSpeeds = {
|
|
|
4206
4192
|
slow: 300
|
|
4207
4193
|
};
|
|
4208
4194
|
|
|
4209
|
-
var _excluded$
|
|
4195
|
+
var _excluded$s = ["size", "speed", "color"],
|
|
4210
4196
|
_excluded2$1 = ["size", "speed", "color"],
|
|
4211
4197
|
_excluded3$1 = ["size", "speed", "color"],
|
|
4212
4198
|
_excluded4$1 = ["size", "children", "textColor", "loaderColor", "type", "speed", "textPosition"];
|
|
@@ -4217,7 +4203,7 @@ var DefaultSpinner = function DefaultSpinner(_ref) {
|
|
|
4217
4203
|
speed = _ref$speed === void 0 ? 'normal' : _ref$speed,
|
|
4218
4204
|
_ref$color = _ref.color,
|
|
4219
4205
|
color = _ref$color === void 0 ? 'theme.loading' : _ref$color,
|
|
4220
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4206
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
4221
4207
|
var theme = useTheme();
|
|
4222
4208
|
var colorStyle = theme.getColor(color);
|
|
4223
4209
|
var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
|
|
@@ -4467,7 +4453,7 @@ var HeaderIconSizes = {
|
|
|
4467
4453
|
xl: 28
|
|
4468
4454
|
};
|
|
4469
4455
|
|
|
4470
|
-
var _excluded$
|
|
4456
|
+
var _excluded$t = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
|
|
4471
4457
|
_excluded2$2 = ["children", "shadow", "isFullScreen", "shape"],
|
|
4472
4458
|
_excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
|
|
4473
4459
|
_excluded4$2 = ["children"],
|
|
@@ -4483,7 +4469,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
4483
4469
|
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
4484
4470
|
_ref$position = _ref.position,
|
|
4485
4471
|
position = _ref$position === void 0 ? 'center' : _ref$position,
|
|
4486
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4472
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
4487
4473
|
var handleClick = function handleClick() {
|
|
4488
4474
|
if (!isClosePrevented) onClose();
|
|
4489
4475
|
};
|
|
@@ -4640,12 +4626,12 @@ Modal.Body = ModalBody;
|
|
|
4640
4626
|
Modal.Footer = ModalFooter;
|
|
4641
4627
|
Modal.Layout = ModalLayout;
|
|
4642
4628
|
|
|
4643
|
-
var _excluded$
|
|
4629
|
+
var _excluded$u = ["src", "color"],
|
|
4644
4630
|
_excluded2$3 = ["path"];
|
|
4645
4631
|
var FileSVG = function FileSVG(_ref) {
|
|
4646
4632
|
var src = _ref.src,
|
|
4647
4633
|
color = _ref.color,
|
|
4648
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4634
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
4649
4635
|
var _useTheme = useTheme(),
|
|
4650
4636
|
getColor = _useTheme.getColor;
|
|
4651
4637
|
var Colorprops = color ? {
|