@app-studio/web 0.3.34 → 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
|
@@ -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
|
+
}
|
|
@@ -9,6 +9,7 @@ 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');
|
|
12
13
|
var zustand = require('zustand');
|
|
13
14
|
|
|
14
15
|
var useButtonState = function useButtonState() {
|
|
@@ -3145,259 +3146,6 @@ var usePasswordState = function usePasswordState() {
|
|
|
3145
3146
|
};
|
|
3146
3147
|
};
|
|
3147
3148
|
|
|
3148
|
-
var useTextFieldState = function useTextFieldState(_ref) {
|
|
3149
|
-
var label = _ref.label,
|
|
3150
|
-
placeholder = _ref.placeholder,
|
|
3151
|
-
value = _ref.value;
|
|
3152
|
-
var _useState = React.useState(label != null ? label : placeholder),
|
|
3153
|
-
hint = _useState[0],
|
|
3154
|
-
setHint = _useState[1];
|
|
3155
|
-
var _useState2 = React.useState(false),
|
|
3156
|
-
isFocused = _useState2[0],
|
|
3157
|
-
setIsFocused = _useState2[1];
|
|
3158
|
-
var _useState3 = React.useState(false),
|
|
3159
|
-
isHovered = _useState3[0],
|
|
3160
|
-
setIsHovered = _useState3[1];
|
|
3161
|
-
var _useState4 = React.useState(value || ''),
|
|
3162
|
-
inputValue = _useState4[0],
|
|
3163
|
-
setInputValue = _useState4[1];
|
|
3164
|
-
return {
|
|
3165
|
-
hint: hint,
|
|
3166
|
-
setHint: setHint,
|
|
3167
|
-
isFocused: isFocused,
|
|
3168
|
-
setIsFocused: setIsFocused,
|
|
3169
|
-
isHovered: isHovered,
|
|
3170
|
-
setIsHovered: setIsHovered,
|
|
3171
|
-
inputValue: inputValue,
|
|
3172
|
-
setInputValue: setInputValue
|
|
3173
|
-
};
|
|
3174
|
-
};
|
|
3175
|
-
|
|
3176
|
-
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
|
-
var TextFieldInput = function TextFieldInput(props) {
|
|
3178
|
-
return React__default.createElement(appStudio.Input, Object.assign({
|
|
3179
|
-
type: "text"
|
|
3180
|
-
}, props));
|
|
3181
|
-
};
|
|
3182
|
-
var TextFieldView = function TextFieldView(_ref) {
|
|
3183
|
-
var id = _ref.id,
|
|
3184
|
-
name = _ref.name,
|
|
3185
|
-
label = _ref.label,
|
|
3186
|
-
hint = _ref.hint,
|
|
3187
|
-
inputValue = _ref.inputValue,
|
|
3188
|
-
onChange = _ref.onChange,
|
|
3189
|
-
leftChild = _ref.leftChild,
|
|
3190
|
-
rightChild = _ref.rightChild,
|
|
3191
|
-
helperText = _ref.helperText,
|
|
3192
|
-
placeholder = _ref.placeholder,
|
|
3193
|
-
onChangeText = _ref.onChangeText,
|
|
3194
|
-
_ref$shadow = _ref.shadow,
|
|
3195
|
-
shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
|
|
3196
|
-
_ref$styles = _ref.styles,
|
|
3197
|
-
styles = _ref$styles === void 0 ? {
|
|
3198
|
-
box: {},
|
|
3199
|
-
field: {},
|
|
3200
|
-
label: {},
|
|
3201
|
-
helperText: {},
|
|
3202
|
-
text: {}
|
|
3203
|
-
} : _ref$styles,
|
|
3204
|
-
_ref$size = _ref.size,
|
|
3205
|
-
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3206
|
-
_ref$shape = _ref.shape,
|
|
3207
|
-
shape = _ref$shape === void 0 ? 'default' : _ref$shape,
|
|
3208
|
-
_ref$variant = _ref.variant,
|
|
3209
|
-
variant = _ref$variant === void 0 ? 'default' : _ref$variant,
|
|
3210
|
-
_ref$colorScheme = _ref.colorScheme,
|
|
3211
|
-
colorScheme = _ref$colorScheme === void 0 ? 'theme.primary' : _ref$colorScheme,
|
|
3212
|
-
_ref$error = _ref.error,
|
|
3213
|
-
error = _ref$error === void 0 ? false : _ref$error,
|
|
3214
|
-
_ref$isFocused = _ref.isFocused,
|
|
3215
|
-
isFocused = _ref$isFocused === void 0 ? false : _ref$isFocused,
|
|
3216
|
-
_ref$isHovered = _ref.isHovered,
|
|
3217
|
-
isHovered = _ref$isHovered === void 0 ? false : _ref$isHovered,
|
|
3218
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3219
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3220
|
-
_ref$isReadOnly = _ref.isReadOnly,
|
|
3221
|
-
isReadOnly = _ref$isReadOnly === void 0 ? false : _ref$isReadOnly,
|
|
3222
|
-
_ref$isClearable = _ref.isClearable,
|
|
3223
|
-
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
|
3224
|
-
_ref$isAutoFocus = _ref.isAutoFocus,
|
|
3225
|
-
isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
|
|
3226
|
-
_ref$setHint = _ref.setHint,
|
|
3227
|
-
setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
|
|
3228
|
-
_ref$setIsFocused = _ref.setIsFocused,
|
|
3229
|
-
setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
|
|
3230
|
-
_ref$setIsHovered = _ref.setIsHovered,
|
|
3231
|
-
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
3232
|
-
_ref$setInputValue = _ref.setInputValue,
|
|
3233
|
-
setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
|
|
3234
|
-
onFocus = _ref.onFocus,
|
|
3235
|
-
_ref$onBlur = _ref.onBlur,
|
|
3236
|
-
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
3237
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
3238
|
-
var _useTheme = appStudio.useTheme(),
|
|
3239
|
-
getColor = _useTheme.getColor;
|
|
3240
|
-
var IconColor = getColor('color.blueGray.700');
|
|
3241
|
-
var isWithLabel = !!(isFocused && label);
|
|
3242
|
-
React.useMemo(function () {
|
|
3243
|
-
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
3244
|
-
}, [inputValue, isFocused, label, placeholder]);
|
|
3245
|
-
var fieldStyles = _extends({
|
|
3246
|
-
margin: 0,
|
|
3247
|
-
paddingVertical: 8,
|
|
3248
|
-
padddingHorizontal: 0,
|
|
3249
|
-
width: '100%',
|
|
3250
|
-
heigth: '100%',
|
|
3251
|
-
border: 'none',
|
|
3252
|
-
on: {
|
|
3253
|
-
focus: {
|
|
3254
|
-
outline: 'none'
|
|
3255
|
-
}
|
|
3256
|
-
},
|
|
3257
|
-
fontSize: appStudio.Typography.fontSizes[size],
|
|
3258
|
-
lineHeight: appStudio.Typography.fontSizes[size],
|
|
3259
|
-
backgroundColor: 'transparent',
|
|
3260
|
-
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
3261
|
-
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
3262
|
-
}, styles['field']);
|
|
3263
|
-
var handleFocus = function handleFocus() {
|
|
3264
|
-
setIsFocused(true);
|
|
3265
|
-
if (onFocus) onFocus();
|
|
3266
|
-
};
|
|
3267
|
-
var handleHover = function handleHover() {
|
|
3268
|
-
return setIsHovered(!isHovered);
|
|
3269
|
-
};
|
|
3270
|
-
var handleBlur = function handleBlur(event) {
|
|
3271
|
-
onBlur(event);
|
|
3272
|
-
setIsFocused(false);
|
|
3273
|
-
};
|
|
3274
|
-
var handleChange = function handleChange(event) {
|
|
3275
|
-
if (typeof event === 'string') {
|
|
3276
|
-
//for ios and android
|
|
3277
|
-
setInputValue(event);
|
|
3278
|
-
if (onChangeText) onChangeText(event);
|
|
3279
|
-
} else {
|
|
3280
|
-
//Web
|
|
3281
|
-
setInputValue(event.target.value);
|
|
3282
|
-
if (onChange) onChange(event);
|
|
3283
|
-
}
|
|
3284
|
-
};
|
|
3285
|
-
var handleClear = function handleClear() {
|
|
3286
|
-
setInputValue('');
|
|
3287
|
-
//Web
|
|
3288
|
-
if (onChange) {
|
|
3289
|
-
onBlur({
|
|
3290
|
-
target: {
|
|
3291
|
-
name: name
|
|
3292
|
-
}
|
|
3293
|
-
});
|
|
3294
|
-
onChange({
|
|
3295
|
-
target: {
|
|
3296
|
-
name: name,
|
|
3297
|
-
value: ''
|
|
3298
|
-
}
|
|
3299
|
-
});
|
|
3300
|
-
}
|
|
3301
|
-
//for ios and android
|
|
3302
|
-
if (typeof document === 'undefined' && onChangeText) onChangeText('');
|
|
3303
|
-
};
|
|
3304
|
-
return React__default.createElement(FieldContainer, {
|
|
3305
|
-
helperText: helperText,
|
|
3306
|
-
error: error,
|
|
3307
|
-
styles: styles
|
|
3308
|
-
}, React__default.createElement(FieldContent, {
|
|
3309
|
-
label: label,
|
|
3310
|
-
size: size,
|
|
3311
|
-
error: error,
|
|
3312
|
-
shape: shape,
|
|
3313
|
-
styles: styles,
|
|
3314
|
-
shadow: shadow,
|
|
3315
|
-
variant: variant,
|
|
3316
|
-
value: inputValue,
|
|
3317
|
-
color: colorScheme,
|
|
3318
|
-
isHovered: isHovered,
|
|
3319
|
-
isDisabled: isDisabled,
|
|
3320
|
-
isReadOnly: isReadOnly,
|
|
3321
|
-
isFocused: isFocused,
|
|
3322
|
-
isWithLabel: isWithLabel,
|
|
3323
|
-
colorScheme: colorScheme,
|
|
3324
|
-
onMouseEnter: handleHover,
|
|
3325
|
-
onMouseLeave: handleHover
|
|
3326
|
-
}, leftChild, React__default.createElement(FieldWrapper, null, isWithLabel && React__default.createElement(FieldLabel, Object.assign({
|
|
3327
|
-
htmlFor: id,
|
|
3328
|
-
color: colorScheme,
|
|
3329
|
-
error: error
|
|
3330
|
-
}, styles), label), React__default.createElement(TextFieldInput, Object.assign({
|
|
3331
|
-
id: id,
|
|
3332
|
-
name: name,
|
|
3333
|
-
value: inputValue,
|
|
3334
|
-
readOnly: isReadOnly,
|
|
3335
|
-
disabled: isDisabled,
|
|
3336
|
-
autoFocus: isAutoFocus,
|
|
3337
|
-
placeholder: hint,
|
|
3338
|
-
onFocus: handleFocus,
|
|
3339
|
-
onBlur: handleBlur,
|
|
3340
|
-
autoComplete: "off"
|
|
3341
|
-
}, fieldStyles, props, {
|
|
3342
|
-
onChange: handleChange
|
|
3343
|
-
}, onChangeText && {
|
|
3344
|
-
onChangeText: handleChange
|
|
3345
|
-
}))), (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, {
|
|
3346
|
-
size: appStudio.Typography.fontSizes[size],
|
|
3347
|
-
color: IconColor,
|
|
3348
|
-
onClick: handleClear
|
|
3349
|
-
}))));
|
|
3350
|
-
};
|
|
3351
|
-
|
|
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,
|
|
3365
|
-
visibleIcon = _ref$visibleIcon === void 0 ? React__default.createElement(OpenEyeSvg, {
|
|
3366
|
-
size: 14
|
|
3367
|
-
}) : _ref$visibleIcon,
|
|
3368
|
-
_ref$hiddenIcon = _ref.hiddenIcon,
|
|
3369
|
-
hiddenIcon = _ref$hiddenIcon === void 0 ? React__default.createElement(CloseEyeSvg, {
|
|
3370
|
-
size: 14
|
|
3371
|
-
}) : _ref$hiddenIcon,
|
|
3372
|
-
_ref$isDisabled = _ref.isDisabled,
|
|
3373
|
-
isDisabled = _ref$isDisabled === void 0 ? false : _ref$isDisabled,
|
|
3374
|
-
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, {
|
|
3382
|
-
onClick: function onClick() {
|
|
3383
|
-
if (!isDisabled) {
|
|
3384
|
-
setVisible(!visible);
|
|
3385
|
-
}
|
|
3386
|
-
}
|
|
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));
|
|
3395
|
-
};
|
|
3396
|
-
/**
|
|
3397
|
-
* To allow users to securely enter sensitive information
|
|
3398
|
-
*/
|
|
3399
|
-
var Password = PasswordComponent;
|
|
3400
|
-
|
|
3401
3149
|
var useSelectState = function useSelectState(_ref) {
|
|
3402
3150
|
var placeholder = _ref.placeholder,
|
|
3403
3151
|
isMulti = _ref.isMulti,
|
|
@@ -3444,7 +3192,7 @@ var IconSizes$4 = {
|
|
|
3444
3192
|
xl: 16
|
|
3445
3193
|
};
|
|
3446
3194
|
|
|
3447
|
-
var _excluded$
|
|
3195
|
+
var _excluded$o = ["isHovered", "setIsHovered", "option", "size", "callback"],
|
|
3448
3196
|
_excluded2 = ["id", "name", "selected", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
|
|
3449
3197
|
_excluded3 = ["option", "size", "removeOption"],
|
|
3450
3198
|
_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"];
|
|
@@ -3456,7 +3204,7 @@ var Item = function Item(_ref) {
|
|
|
3456
3204
|
size = _ref$size === void 0 ? 'md' : _ref$size,
|
|
3457
3205
|
_ref$callback = _ref.callback,
|
|
3458
3206
|
callback = _ref$callback === void 0 ? function () {} : _ref$callback,
|
|
3459
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3207
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
3460
3208
|
var handleOptionClick = function handleOptionClick(option) {
|
|
3461
3209
|
return callback(option);
|
|
3462
3210
|
};
|
|
@@ -3926,7 +3674,7 @@ var SliderPadding = {
|
|
|
3926
3674
|
}
|
|
3927
3675
|
};
|
|
3928
3676
|
|
|
3929
|
-
var _excluded$
|
|
3677
|
+
var _excluded$p = ["id", "name", "inActiveChild", "activeChild", "shadow", "size", "colorScheme", "on", "isHovered", "isChecked", "isDisabled", "isReadOnly", "onChange", "onValueChange", "setOn", "setIsHovered", "styles"];
|
|
3930
3678
|
var SwitchContent = function SwitchContent(props) {
|
|
3931
3679
|
return React__default.createElement(appStudio.Input, Object.assign({
|
|
3932
3680
|
type: "checkbox"
|
|
@@ -3962,7 +3710,7 @@ var SwitchView = function SwitchView(_ref) {
|
|
|
3962
3710
|
slider: {},
|
|
3963
3711
|
circle: {}
|
|
3964
3712
|
} : _ref$styles,
|
|
3965
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3713
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$p);
|
|
3966
3714
|
var handleToggle = function handleToggle(event) {
|
|
3967
3715
|
if (!isReadOnly) {
|
|
3968
3716
|
setOn(!on);
|
|
@@ -4038,7 +3786,7 @@ var useTextAreaState = function useTextAreaState(_ref) {
|
|
|
4038
3786
|
};
|
|
4039
3787
|
};
|
|
4040
3788
|
|
|
4041
|
-
var _excluded$
|
|
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"];
|
|
4042
3790
|
var TextAreaView = function TextAreaView(_ref) {
|
|
4043
3791
|
var id = _ref.id,
|
|
4044
3792
|
name = _ref.name,
|
|
@@ -4096,7 +3844,7 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4096
3844
|
helperText: {},
|
|
4097
3845
|
field: {}
|
|
4098
3846
|
} : _ref$styles,
|
|
4099
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
3847
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$q);
|
|
4100
3848
|
var isWithLabel = !!(isFocused && label);
|
|
4101
3849
|
React.useMemo(function () {
|
|
4102
3850
|
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
@@ -4195,6 +3943,244 @@ var TextAreaComponent = function TextAreaComponent(props) {
|
|
|
4195
3943
|
*/
|
|
4196
3944
|
var TextArea = TextAreaComponent;
|
|
4197
3945
|
|
|
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
|
+
var TextFieldComponent = function TextFieldComponent(props) {
|
|
4151
|
+
var textFieldStates = useTextFieldState(props);
|
|
4152
|
+
return React__default.createElement(TextFieldView, Object.assign({}, textFieldStates, props));
|
|
4153
|
+
};
|
|
4154
|
+
/**
|
|
4155
|
+
* TextField is used to capture text data from users.
|
|
4156
|
+
*/
|
|
4157
|
+
var TextField = TextFieldComponent;
|
|
4158
|
+
|
|
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
|
+
|
|
4198
4184
|
var DefaultSizes = {
|
|
4199
4185
|
xs: 14,
|
|
4200
4186
|
sm: 18,
|
|
@@ -4213,7 +4199,7 @@ var DefaultSpeeds = {
|
|
|
4213
4199
|
slow: 300
|
|
4214
4200
|
};
|
|
4215
4201
|
|
|
4216
|
-
var _excluded$
|
|
4202
|
+
var _excluded$s = ["size", "speed", "color"],
|
|
4217
4203
|
_excluded2$1 = ["size", "speed", "color"],
|
|
4218
4204
|
_excluded3$1 = ["size", "speed", "color"],
|
|
4219
4205
|
_excluded4$1 = ["size", "children", "textColor", "loaderColor", "type", "speed", "textPosition"];
|
|
@@ -4224,7 +4210,7 @@ var DefaultSpinner = function DefaultSpinner(_ref) {
|
|
|
4224
4210
|
speed = _ref$speed === void 0 ? 'normal' : _ref$speed,
|
|
4225
4211
|
_ref$color = _ref.color,
|
|
4226
4212
|
color = _ref$color === void 0 ? 'theme.loading' : _ref$color,
|
|
4227
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4213
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$s);
|
|
4228
4214
|
var theme = appStudio.useTheme();
|
|
4229
4215
|
var colorStyle = theme.getColor(color);
|
|
4230
4216
|
var sizeStyle = typeof size === 'number' ? size : DefaultSizes[size];
|
|
@@ -4474,7 +4460,7 @@ var HeaderIconSizes = {
|
|
|
4474
4460
|
xl: 28
|
|
4475
4461
|
};
|
|
4476
4462
|
|
|
4477
|
-
var _excluded$
|
|
4463
|
+
var _excluded$t = ["children", "blur", "isOpen", "isClosePrevented", "onClose", "position"],
|
|
4478
4464
|
_excluded2$2 = ["children", "shadow", "isFullScreen", "shape"],
|
|
4479
4465
|
_excluded3$2 = ["children", "buttonColor", "iconSize", "buttonPosition"],
|
|
4480
4466
|
_excluded4$2 = ["children"],
|
|
@@ -4490,7 +4476,7 @@ var ModalOverlay = function ModalOverlay(_ref) {
|
|
|
4490
4476
|
onClose = _ref$onClose === void 0 ? function () {} : _ref$onClose,
|
|
4491
4477
|
_ref$position = _ref.position,
|
|
4492
4478
|
position = _ref$position === void 0 ? 'center' : _ref$position,
|
|
4493
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4479
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
4494
4480
|
var handleClick = function handleClick() {
|
|
4495
4481
|
if (!isClosePrevented) onClose();
|
|
4496
4482
|
};
|
|
@@ -4647,12 +4633,12 @@ Modal.Body = ModalBody;
|
|
|
4647
4633
|
Modal.Footer = ModalFooter;
|
|
4648
4634
|
Modal.Layout = ModalLayout;
|
|
4649
4635
|
|
|
4650
|
-
var _excluded$
|
|
4636
|
+
var _excluded$u = ["src", "color"],
|
|
4651
4637
|
_excluded2$3 = ["path"];
|
|
4652
4638
|
var FileSVG = function FileSVG(_ref) {
|
|
4653
4639
|
var src = _ref.src,
|
|
4654
4640
|
color = _ref.color,
|
|
4655
|
-
props = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
4641
|
+
props = _objectWithoutPropertiesLoose(_ref, _excluded$u);
|
|
4656
4642
|
var _useTheme = appStudio.useTheme(),
|
|
4657
4643
|
getColor = _useTheme.getColor;
|
|
4658
4644
|
var Colorprops = color ? {
|