@app-studio/web 0.3.52 → 0.3.54
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/File/File.d.ts +1 -3
- package/dist/components/Form/CountryPicker/CountryPicker/CountryPicker.state.d.ts +2 -2
- package/dist/components/Form/DatePicker/examples/index.d.ts +0 -1
- package/dist/components/Form/Form.d.ts +0 -8
- package/dist/components/Form/Password/Password/Password.state.d.ts +2 -2
- package/dist/components/Form/Select/Select/Select.props.d.ts +5 -5
- package/dist/components/Form/Select/Select/Select.state.d.ts +2 -2
- package/dist/components/Form/TextArea/TextArea/TextArea.props.d.ts +2 -2
- package/dist/components/Form/TextArea/TextArea/TextArea.state.d.ts +3 -3
- package/dist/components/Form/TextArea/examples/index.d.ts +0 -2
- package/dist/components/Form/TextField/TextField/TextField.props.d.ts +2 -2
- package/dist/components/Form/TextField/TextField/TextField.state.d.ts +3 -3
- package/dist/components/Form/TextField/examples/index.d.ts +0 -2
- package/dist/components/Formik/Formik.Checkbox.d.ts +6 -0
- package/dist/components/Formik/Formik.CountryPicker.d.ts +6 -0
- package/dist/components/Formik/Formik.DatePicker.d.ts +6 -0
- package/dist/components/Formik/Formik.Form.d.ts +25 -0
- package/dist/components/Formik/Formik.Hook.d.ts +1 -0
- package/dist/components/Formik/Formik.Password.d.ts +6 -0
- package/dist/components/Formik/Formik.Select.d.ts +6 -0
- package/dist/components/Formik/Formik.Switch.d.ts +3 -0
- package/dist/components/Formik/Formik.TextArea.d.ts +6 -0
- package/dist/components/Formik/Formik.TextField.d.ts +6 -0
- package/dist/components/Formik/examples/FormikCheckbox.d.ts +2 -0
- package/dist/components/Formik/examples/FormikPassword.d.ts +2 -0
- package/dist/components/Formik/examples/FormikTextArea.d.ts +2 -0
- package/dist/components/Formik/examples/FormikTextField.d.ts +2 -0
- package/dist/components/Formik/examples/index.d.ts +9 -0
- package/dist/components/Formik/index.d.ts +9 -0
- package/dist/components/Layout/View/View.d.ts +1 -1
- package/dist/pages/formik.page.d.ts +3 -0
- package/dist/web.cjs.development.js +95 -100
- 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 +95 -100
- package/dist/web.esm.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/Form/FormField.d.ts +0 -10
- package/dist/components/Form/Password/example/FormikErrorInput.d.ts +0 -2
- package/dist/components/Form/Password/example/FormikHelperText.d.ts +0 -2
- package/dist/components/Form/TextArea/examples/FormikErrorInput.d.ts +0 -2
- package/dist/components/Form/TextArea/examples/FormikHelperText.d.ts +0 -2
- package/dist/components/Form/TextField/examples/FormikErrorInput.d.ts +0 -2
- package/dist/components/Form/TextField/examples/FormikHelperText.d.ts +0 -2
- package/dist/utils/form.d.ts +0 -10
- /package/dist/components/{Form/CountryPicker/examples/Formik.d.ts → Formik/examples/FormikCountryPicker.d.ts} +0 -0
- /package/dist/components/{Form/DatePicker/examples/Formik.d.ts → Formik/examples/FormikDatePicker.d.ts} +0 -0
- /package/dist/components/{Form/Select/examples/Formik.d.ts → Formik/examples/FormikSelect.d.ts} +0 -0
- /package/dist/components/{Form/Switch/examples/Formik.d.ts → Formik/examples/FormikSwitch.d.ts} +0 -0
package/dist/web.esm.js
CHANGED
|
@@ -1056,12 +1056,9 @@ var CheckboxView = function CheckboxView(_ref) {
|
|
|
1056
1056
|
};
|
|
1057
1057
|
var handleChange = function handleChange() {
|
|
1058
1058
|
if (!isReadOnly && !isDisabled) {
|
|
1059
|
-
if (
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
if (onChange) onChange(!isChecked);
|
|
1063
|
-
if (onValueChange) onValueChange(!isChecked);
|
|
1064
|
-
}
|
|
1059
|
+
if (setIsSelected) setIsSelected(!isSelected);
|
|
1060
|
+
if (onChange) onChange(!isChecked);
|
|
1061
|
+
if (onValueChange) onValueChange(!isChecked);
|
|
1065
1062
|
}
|
|
1066
1063
|
};
|
|
1067
1064
|
var checkboxStyle = {
|
|
@@ -2569,8 +2566,8 @@ var useCountryPickerState = function useCountryPickerState(_ref) {
|
|
|
2569
2566
|
newOptions = _React$useState[0],
|
|
2570
2567
|
setNewOptions = _React$useState[1];
|
|
2571
2568
|
var _React$useState2 = React.useState(placeholder != null ? placeholder : countryList[0].name),
|
|
2572
|
-
|
|
2573
|
-
|
|
2569
|
+
value = _React$useState2[0],
|
|
2570
|
+
setValue = _React$useState2[1];
|
|
2574
2571
|
var _React$useState3 = React.useState(true),
|
|
2575
2572
|
hide = _React$useState3[0],
|
|
2576
2573
|
setHide = _React$useState3[1];
|
|
@@ -2589,8 +2586,8 @@ var useCountryPickerState = function useCountryPickerState(_ref) {
|
|
|
2589
2586
|
setIsHovered: setIsHovered,
|
|
2590
2587
|
isFocused: isFocused,
|
|
2591
2588
|
setIsFocused: setIsFocused,
|
|
2592
|
-
|
|
2593
|
-
|
|
2589
|
+
value: value,
|
|
2590
|
+
setValue: setValue
|
|
2594
2591
|
};
|
|
2595
2592
|
};
|
|
2596
2593
|
|
|
@@ -2871,6 +2868,7 @@ var FieldContent = function FieldContent(_ref) {
|
|
|
2871
2868
|
backgroundColor: "color.white",
|
|
2872
2869
|
transition: "padding 0.2s ease",
|
|
2873
2870
|
justifyContent: "space-between",
|
|
2871
|
+
marginBottom: 5,
|
|
2874
2872
|
fontSize: Typography.fontSizes[size],
|
|
2875
2873
|
// filter={isHovered ? 'brightness(1)':'brightness(0.97)'}
|
|
2876
2874
|
cursor: isDisabled ? 'not-allowed' : isReadOnly ? 'auto' : 'pointer'
|
|
@@ -2933,7 +2931,7 @@ var IconSizes$3 = {
|
|
|
2933
2931
|
xl: 16
|
|
2934
2932
|
};
|
|
2935
2933
|
|
|
2936
|
-
var _excluded$n = ["id", "name", "label", "
|
|
2934
|
+
var _excluded$n = ["id", "name", "label", "value", "placeholder", "helperText", "hide", "error", "isHovered", "isFocused", "isAutoFocus", "isDisabled", "isReadOnly", "shadow", "newOptions", "size", "variant", "shape", "colorScheme", "onChange", "onBlur", "setHide", "setNewOptions", "setIsHovered", "setIsFocused", "setValue", "styles"];
|
|
2937
2935
|
var CountryList = function CountryList(props) {
|
|
2938
2936
|
return React.createElement(Element, Object.assign({
|
|
2939
2937
|
as: "ul"
|
|
@@ -3022,7 +3020,7 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3022
3020
|
var id = _ref3.id,
|
|
3023
3021
|
name = _ref3.name,
|
|
3024
3022
|
label = _ref3.label,
|
|
3025
|
-
|
|
3023
|
+
value = _ref3.value,
|
|
3026
3024
|
placeholder = _ref3.placeholder,
|
|
3027
3025
|
helperText = _ref3.helperText,
|
|
3028
3026
|
_ref3$hide = _ref3.hide,
|
|
@@ -3062,8 +3060,8 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3062
3060
|
setIsHovered = _ref3$setIsHovered === void 0 ? function () {} : _ref3$setIsHovered,
|
|
3063
3061
|
_ref3$setIsFocused = _ref3.setIsFocused,
|
|
3064
3062
|
setIsFocused = _ref3$setIsFocused === void 0 ? function () {} : _ref3$setIsFocused,
|
|
3065
|
-
_ref3$
|
|
3066
|
-
|
|
3063
|
+
_ref3$setValue = _ref3.setValue,
|
|
3064
|
+
setValue = _ref3$setValue === void 0 ? function () {} : _ref3$setValue,
|
|
3067
3065
|
_ref3$styles = _ref3.styles,
|
|
3068
3066
|
styles = _ref3$styles === void 0 ? {
|
|
3069
3067
|
text: {},
|
|
@@ -3085,7 +3083,8 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3085
3083
|
};
|
|
3086
3084
|
var handleCallback = function handleCallback(option) {
|
|
3087
3085
|
setHide(!hide);
|
|
3088
|
-
|
|
3086
|
+
setValue(option);
|
|
3087
|
+
if (onChange) onChange(option);
|
|
3089
3088
|
};
|
|
3090
3089
|
var handleClick = function handleClick() {
|
|
3091
3090
|
if (!isDisabled && !isReadOnly) {
|
|
@@ -3093,22 +3092,21 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3093
3092
|
}
|
|
3094
3093
|
};
|
|
3095
3094
|
var handleChange = function handleChange(event) {
|
|
3096
|
-
var
|
|
3095
|
+
var valueCountry = event.target.value;
|
|
3097
3096
|
var filteredCountries = countryList.filter(function (country) {
|
|
3098
|
-
return country.name.toLowerCase().startsWith(
|
|
3097
|
+
return country.name.toLowerCase().startsWith(valueCountry.toLowerCase());
|
|
3099
3098
|
});
|
|
3100
3099
|
if (hide) setHide(false);
|
|
3101
|
-
setSelected(event.target.value);
|
|
3102
3100
|
setNewOptions(filteredCountries);
|
|
3103
|
-
if (onChange) onChange(
|
|
3101
|
+
if (onChange) onChange(valueCountry);
|
|
3104
3102
|
};
|
|
3105
3103
|
var handleBlur = function handleBlur(event) {
|
|
3106
3104
|
onBlur(event);
|
|
3107
3105
|
setIsFocused(false);
|
|
3108
3106
|
};
|
|
3109
|
-
useEffect(
|
|
3110
|
-
|
|
3111
|
-
}, [onChange,
|
|
3107
|
+
// useEffect(() => {
|
|
3108
|
+
// if (onChange) onChange(value); // Call onChange when valueCountry changes
|
|
3109
|
+
// }, [onChange, value]);
|
|
3112
3110
|
var isWithLabel = !!(isFocused && label);
|
|
3113
3111
|
var fieldStyles = _extends({
|
|
3114
3112
|
margin: 0,
|
|
@@ -3140,7 +3138,7 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3140
3138
|
styles: styles,
|
|
3141
3139
|
shadow: shadow,
|
|
3142
3140
|
variant: variant,
|
|
3143
|
-
value:
|
|
3141
|
+
value: value,
|
|
3144
3142
|
color: colorScheme,
|
|
3145
3143
|
isHovered: isHovered,
|
|
3146
3144
|
isDisabled: isDisabled,
|
|
@@ -3164,7 +3162,7 @@ var CountryPickerView = function CountryPickerView(_ref3) {
|
|
|
3164
3162
|
onBlur: handleBlur,
|
|
3165
3163
|
onFocus: handleFocus
|
|
3166
3164
|
}, fieldStyles, props, {
|
|
3167
|
-
value:
|
|
3165
|
+
value: value,
|
|
3168
3166
|
onChange: handleChange
|
|
3169
3167
|
}))), React.createElement(FieldIcons, null, hide ? React.createElement(ArrowDownSvg, {
|
|
3170
3168
|
size: IconSizes$3[size],
|
|
@@ -3345,7 +3343,7 @@ var DatePicker = DatePickerComponent;
|
|
|
3345
3343
|
var useTextFieldState = function useTextFieldState(_ref) {
|
|
3346
3344
|
var label = _ref.label,
|
|
3347
3345
|
placeholder = _ref.placeholder,
|
|
3348
|
-
|
|
3346
|
+
defaultValue = _ref.defaultValue;
|
|
3349
3347
|
var _useState = useState(label != null ? label : placeholder),
|
|
3350
3348
|
hint = _useState[0],
|
|
3351
3349
|
setHint = _useState[1];
|
|
@@ -3355,9 +3353,12 @@ var useTextFieldState = function useTextFieldState(_ref) {
|
|
|
3355
3353
|
var _useState3 = useState(false),
|
|
3356
3354
|
isHovered = _useState3[0],
|
|
3357
3355
|
setIsHovered = _useState3[1];
|
|
3358
|
-
var _useState4 = useState(
|
|
3359
|
-
|
|
3360
|
-
|
|
3356
|
+
var _useState4 = useState(defaultValue || ''),
|
|
3357
|
+
value = _useState4[0],
|
|
3358
|
+
setValue = _useState4[1];
|
|
3359
|
+
useMemo(function () {
|
|
3360
|
+
setHint(isFocused && !value ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
3361
|
+
}, [value, isFocused, label, placeholder]);
|
|
3361
3362
|
return {
|
|
3362
3363
|
hint: hint,
|
|
3363
3364
|
setHint: setHint,
|
|
@@ -3365,8 +3366,8 @@ var useTextFieldState = function useTextFieldState(_ref) {
|
|
|
3365
3366
|
setIsFocused: setIsFocused,
|
|
3366
3367
|
isHovered: isHovered,
|
|
3367
3368
|
setIsHovered: setIsHovered,
|
|
3368
|
-
|
|
3369
|
-
|
|
3369
|
+
setValue: setValue,
|
|
3370
|
+
value: value
|
|
3370
3371
|
};
|
|
3371
3372
|
};
|
|
3372
3373
|
|
|
@@ -3381,7 +3382,7 @@ var usePasswordState = function usePasswordState(props) {
|
|
|
3381
3382
|
}, textFieldStates);
|
|
3382
3383
|
};
|
|
3383
3384
|
|
|
3384
|
-
var _excluded$p = ["id", "name", "label", "
|
|
3385
|
+
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"];
|
|
3385
3386
|
var TextFieldInput = function TextFieldInput(props) {
|
|
3386
3387
|
return React.createElement(Input, Object.assign({
|
|
3387
3388
|
type: "text"
|
|
@@ -3392,12 +3393,11 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3392
3393
|
name = _ref.name,
|
|
3393
3394
|
label = _ref.label,
|
|
3394
3395
|
hint = _ref.hint,
|
|
3395
|
-
|
|
3396
|
+
value = _ref.value,
|
|
3396
3397
|
onChange = _ref.onChange,
|
|
3397
3398
|
leftChild = _ref.leftChild,
|
|
3398
3399
|
rightChild = _ref.rightChild,
|
|
3399
3400
|
helperText = _ref.helperText,
|
|
3400
|
-
placeholder = _ref.placeholder,
|
|
3401
3401
|
onChangeText = _ref.onChangeText,
|
|
3402
3402
|
_ref$shadow = _ref.shadow,
|
|
3403
3403
|
shadow = _ref$shadow === void 0 ? {} : _ref$shadow,
|
|
@@ -3431,14 +3431,12 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3431
3431
|
isClearable = _ref$isClearable === void 0 ? true : _ref$isClearable,
|
|
3432
3432
|
_ref$isAutoFocus = _ref.isAutoFocus,
|
|
3433
3433
|
isAutoFocus = _ref$isAutoFocus === void 0 ? false : _ref$isAutoFocus,
|
|
3434
|
-
_ref$setHint = _ref.setHint,
|
|
3435
|
-
setHint = _ref$setHint === void 0 ? function () {} : _ref$setHint,
|
|
3436
3434
|
_ref$setIsFocused = _ref.setIsFocused,
|
|
3437
3435
|
setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
|
|
3438
3436
|
_ref$setIsHovered = _ref.setIsHovered,
|
|
3439
3437
|
setIsHovered = _ref$setIsHovered === void 0 ? function () {} : _ref$setIsHovered,
|
|
3440
|
-
_ref$
|
|
3441
|
-
|
|
3438
|
+
_ref$setValue = _ref.setValue,
|
|
3439
|
+
setValue = _ref$setValue === void 0 ? function () {} : _ref$setValue,
|
|
3442
3440
|
onFocus = _ref.onFocus,
|
|
3443
3441
|
_ref$onBlur = _ref.onBlur,
|
|
3444
3442
|
onBlur = _ref$onBlur === void 0 ? function () {} : _ref$onBlur,
|
|
@@ -3447,9 +3445,6 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3447
3445
|
getColor = _useTheme.getColor;
|
|
3448
3446
|
var IconColor = getColor('color.blueGray.700');
|
|
3449
3447
|
var isWithLabel = !!(isFocused && label);
|
|
3450
|
-
useMemo(function () {
|
|
3451
|
-
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
3452
|
-
}, [inputValue, isFocused, label, placeholder]);
|
|
3453
3448
|
var fieldStyles = _extends({
|
|
3454
3449
|
margin: 0,
|
|
3455
3450
|
paddingVertical: 8,
|
|
@@ -3482,16 +3477,18 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3482
3477
|
var handleChange = function handleChange(event) {
|
|
3483
3478
|
if (typeof event === 'string') {
|
|
3484
3479
|
//for ios and android
|
|
3485
|
-
|
|
3480
|
+
setValue(event);
|
|
3486
3481
|
if (onChangeText) onChangeText(event);
|
|
3482
|
+
if (onChange) onChange(event);
|
|
3487
3483
|
} else {
|
|
3488
3484
|
//Web
|
|
3489
|
-
|
|
3490
|
-
if (
|
|
3485
|
+
setValue(event.target.value);
|
|
3486
|
+
if (onChangeText) onChangeText(event.target.value);
|
|
3487
|
+
if (onChange) onChange(event.target.value);
|
|
3491
3488
|
}
|
|
3492
3489
|
};
|
|
3493
3490
|
var handleClear = function handleClear() {
|
|
3494
|
-
|
|
3491
|
+
setValue('');
|
|
3495
3492
|
//Web
|
|
3496
3493
|
if (onChange) {
|
|
3497
3494
|
onBlur({
|
|
@@ -3521,7 +3518,7 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3521
3518
|
styles: styles,
|
|
3522
3519
|
shadow: shadow,
|
|
3523
3520
|
variant: variant,
|
|
3524
|
-
value:
|
|
3521
|
+
value: value,
|
|
3525
3522
|
color: colorScheme,
|
|
3526
3523
|
isHovered: isHovered,
|
|
3527
3524
|
isDisabled: isDisabled,
|
|
@@ -3538,7 +3535,7 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3538
3535
|
}, styles), label), React.createElement(TextFieldInput, Object.assign({
|
|
3539
3536
|
id: id,
|
|
3540
3537
|
name: name,
|
|
3541
|
-
value:
|
|
3538
|
+
value: value,
|
|
3542
3539
|
readOnly: isReadOnly,
|
|
3543
3540
|
disabled: isDisabled,
|
|
3544
3541
|
autoFocus: isAutoFocus,
|
|
@@ -3548,9 +3545,9 @@ var TextFieldView = function TextFieldView(_ref) {
|
|
|
3548
3545
|
autoComplete: "off"
|
|
3549
3546
|
}, fieldStyles, props, {
|
|
3550
3547
|
onChange: handleChange
|
|
3551
|
-
},
|
|
3552
|
-
|
|
3553
|
-
}))), (rightChild || isClearable &&
|
|
3548
|
+
}, onChange && {
|
|
3549
|
+
onChange: handleChange
|
|
3550
|
+
}))), (rightChild || isClearable && value) && React.createElement(FieldIcons, null, rightChild && React.createElement(React.Fragment, null, rightChild), isClearable && value && !isReadOnly && !isDisabled && React.createElement(CloseSvg, {
|
|
3554
3551
|
size: Typography.fontSizes[size],
|
|
3555
3552
|
color: IconColor,
|
|
3556
3553
|
onClick: handleClear
|
|
@@ -3594,7 +3591,7 @@ var useSelectState = function useSelectState(_ref) {
|
|
|
3594
3591
|
var placeholder = _ref.placeholder,
|
|
3595
3592
|
isMulti = _ref.isMulti,
|
|
3596
3593
|
options = _ref.options;
|
|
3597
|
-
var
|
|
3594
|
+
var defaultValue = placeholder ? isMulti ? [] : '' : options[0];
|
|
3598
3595
|
var _React$useState = React.useState(true),
|
|
3599
3596
|
hide = _React$useState[0],
|
|
3600
3597
|
setHide = _React$useState[1];
|
|
@@ -3604,12 +3601,12 @@ var useSelectState = function useSelectState(_ref) {
|
|
|
3604
3601
|
var _React$useState3 = React.useState(false),
|
|
3605
3602
|
isFocused = _React$useState3[0],
|
|
3606
3603
|
setIsFocused = _React$useState3[1];
|
|
3607
|
-
var _React$useState4 = React.useState(
|
|
3608
|
-
|
|
3609
|
-
|
|
3604
|
+
var _React$useState4 = React.useState(defaultValue),
|
|
3605
|
+
value = _React$useState4[0],
|
|
3606
|
+
setValue = _React$useState4[1];
|
|
3610
3607
|
return {
|
|
3611
|
-
|
|
3612
|
-
|
|
3608
|
+
value: value,
|
|
3609
|
+
setValue: setValue,
|
|
3613
3610
|
hide: hide,
|
|
3614
3611
|
setHide: setHide,
|
|
3615
3612
|
isHovered: isHovered,
|
|
@@ -3637,9 +3634,9 @@ var IconSizes$4 = {
|
|
|
3637
3634
|
};
|
|
3638
3635
|
|
|
3639
3636
|
var _excluded$r = ["isHovered", "setIsHovered", "option", "size", "callback"],
|
|
3640
|
-
_excluded2$2 = ["id", "name", "
|
|
3637
|
+
_excluded2$2 = ["id", "name", "value", "onChange", "isMulti", "isDisabled", "isReadOnly", "options"],
|
|
3641
3638
|
_excluded3$1 = ["option", "size", "removeOption"],
|
|
3642
|
-
_excluded4$1 = ["id", "name", "label", "
|
|
3639
|
+
_excluded4$1 = ["id", "name", "label", "value", "placeholder", "helperText", "hide", "error", "isMulti", "isFocused", "isHovered", "isDisabled", "isReadOnly", "options", "shadow", "size", "colorScheme", "shape", "variant", "styles", "onChange", "setHide", "setValue", "setIsHovered", "setIsFocused"];
|
|
3643
3640
|
var Item = function Item(_ref) {
|
|
3644
3641
|
var isHovered = _ref.isHovered,
|
|
3645
3642
|
setIsHovered = _ref.setIsHovered,
|
|
@@ -3678,7 +3675,7 @@ var SelectBox = function SelectBox(_ref2) {
|
|
|
3678
3675
|
field: {},
|
|
3679
3676
|
text: {}
|
|
3680
3677
|
} : _ref2$styles,
|
|
3681
|
-
|
|
3678
|
+
value = _ref2.value,
|
|
3682
3679
|
isDisabled = _ref2.isDisabled,
|
|
3683
3680
|
placeholder = _ref2.placeholder,
|
|
3684
3681
|
_ref2$removeOption = _ref2.removeOption,
|
|
@@ -3695,9 +3692,9 @@ var SelectBox = function SelectBox(_ref2) {
|
|
|
3695
3692
|
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
3696
3693
|
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
3697
3694
|
}, styles['field'], styles['text']);
|
|
3698
|
-
return React.createElement(Text, Object.assign({}, fieldStyles), (
|
|
3695
|
+
return React.createElement(Text, Object.assign({}, fieldStyles), (value === '' || value && value.length === 0) && !!placeholder ? placeholder : React.createElement(React.Fragment, null, typeof value === 'string' ? value : value && value.length > 0 && React.createElement(Horizontal, {
|
|
3699
3696
|
gap: 6
|
|
3700
|
-
},
|
|
3697
|
+
}, value.map(function (option) {
|
|
3701
3698
|
return React.createElement(MultiSelect, {
|
|
3702
3699
|
key: option,
|
|
3703
3700
|
option: option,
|
|
@@ -3708,7 +3705,7 @@ var SelectBox = function SelectBox(_ref2) {
|
|
|
3708
3705
|
var HiddenSelect = function HiddenSelect(_ref3) {
|
|
3709
3706
|
var id = _ref3.id,
|
|
3710
3707
|
name = _ref3.name,
|
|
3711
|
-
|
|
3708
|
+
value = _ref3.value,
|
|
3712
3709
|
onChange = _ref3.onChange,
|
|
3713
3710
|
_ref3$isMulti = _ref3.isMulti,
|
|
3714
3711
|
isMulti = _ref3$isMulti === void 0 ? false : _ref3$isMulti,
|
|
@@ -3730,7 +3727,7 @@ var HiddenSelect = function HiddenSelect(_ref3) {
|
|
|
3730
3727
|
width: 0,
|
|
3731
3728
|
height: 0,
|
|
3732
3729
|
position: "absolute",
|
|
3733
|
-
value:
|
|
3730
|
+
value: value,
|
|
3734
3731
|
disabled: isDisabled,
|
|
3735
3732
|
readOnly: isReadOnly,
|
|
3736
3733
|
onChange: handleChange,
|
|
@@ -3827,7 +3824,7 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3827
3824
|
var id = _ref6.id,
|
|
3828
3825
|
name = _ref6.name,
|
|
3829
3826
|
label = _ref6.label,
|
|
3830
|
-
|
|
3827
|
+
value = _ref6.value,
|
|
3831
3828
|
placeholder = _ref6.placeholder,
|
|
3832
3829
|
helperText = _ref6.helperText,
|
|
3833
3830
|
_ref6$hide = _ref6.hide,
|
|
@@ -3869,8 +3866,8 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3869
3866
|
onChange = _ref6$onChange === void 0 ? function () {} : _ref6$onChange,
|
|
3870
3867
|
_ref6$setHide = _ref6.setHide,
|
|
3871
3868
|
setHide = _ref6$setHide === void 0 ? function () {} : _ref6$setHide,
|
|
3872
|
-
_ref6$
|
|
3873
|
-
|
|
3869
|
+
_ref6$setValue = _ref6.setValue,
|
|
3870
|
+
setValue = _ref6$setValue === void 0 ? function () {} : _ref6$setValue,
|
|
3874
3871
|
_ref6$setIsHovered = _ref6.setIsHovered,
|
|
3875
3872
|
setIsHovered = _ref6$setIsHovered === void 0 ? function () {} : _ref6$setIsHovered,
|
|
3876
3873
|
_ref6$setIsFocused = _ref6.setIsFocused,
|
|
@@ -3890,18 +3887,19 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3890
3887
|
};
|
|
3891
3888
|
var handleCallback = useCallback(function (option) {
|
|
3892
3889
|
setHide(!hide);
|
|
3893
|
-
if (isMulti && Array.isArray(
|
|
3894
|
-
!
|
|
3890
|
+
if (isMulti && Array.isArray(value)) {
|
|
3891
|
+
!value.includes(option) && setValue([].concat(value, [option]));
|
|
3895
3892
|
} else {
|
|
3896
|
-
|
|
3893
|
+
setValue(option);
|
|
3897
3894
|
}
|
|
3898
|
-
|
|
3899
|
-
|
|
3900
|
-
|
|
3901
|
-
|
|
3902
|
-
|
|
3895
|
+
if (onChange) onChange(option);
|
|
3896
|
+
}, [hide, isMulti, value]);
|
|
3897
|
+
var handleRemoveOption = function handleRemoveOption(valueOption) {
|
|
3898
|
+
if (Array.isArray(value) && value.includes(valueOption)) {
|
|
3899
|
+
var newValue = value.filter(function (option) {
|
|
3900
|
+
return option !== valueOption;
|
|
3903
3901
|
});
|
|
3904
|
-
|
|
3902
|
+
setValue(newValue.length === 0 ? [] : newValue);
|
|
3905
3903
|
}
|
|
3906
3904
|
};
|
|
3907
3905
|
return React.createElement(FieldContainer, {
|
|
@@ -3918,7 +3916,7 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3918
3916
|
styles: styles,
|
|
3919
3917
|
shadow: shadow,
|
|
3920
3918
|
variant: variant,
|
|
3921
|
-
value:
|
|
3919
|
+
value: value,
|
|
3922
3920
|
color: colorScheme,
|
|
3923
3921
|
isHovered: isHovered,
|
|
3924
3922
|
isDisabled: isDisabled,
|
|
@@ -3937,7 +3935,7 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3937
3935
|
name: name,
|
|
3938
3936
|
options: options,
|
|
3939
3937
|
onChange: onChange,
|
|
3940
|
-
|
|
3938
|
+
value: value,
|
|
3941
3939
|
isDisabled: isDisabled,
|
|
3942
3940
|
isReadOnly: isReadOnly,
|
|
3943
3941
|
isMulti: isMulti,
|
|
@@ -3945,7 +3943,7 @@ var SelectView = function SelectView(_ref6) {
|
|
|
3945
3943
|
}, props)), React.createElement(SelectBox, {
|
|
3946
3944
|
size: size,
|
|
3947
3945
|
styles: styles,
|
|
3948
|
-
|
|
3946
|
+
value: value,
|
|
3949
3947
|
isDisabled: isDisabled,
|
|
3950
3948
|
placeholder: placeholder,
|
|
3951
3949
|
removeOption: handleRemoveOption
|
|
@@ -4158,7 +4156,7 @@ var SwitchView = function SwitchView(_ref) {
|
|
|
4158
4156
|
var handleToggle = function handleToggle(event) {
|
|
4159
4157
|
if (!isReadOnly) {
|
|
4160
4158
|
setOn(!on);
|
|
4161
|
-
if (onChange) onChange(event);
|
|
4159
|
+
if (onChange) onChange(event.target.checked);
|
|
4162
4160
|
}
|
|
4163
4161
|
};
|
|
4164
4162
|
var handleHover = function handleHover() {
|
|
@@ -4185,6 +4183,7 @@ var SwitchView = function SwitchView(_ref) {
|
|
|
4185
4183
|
cursor: "pointer",
|
|
4186
4184
|
alignItems: "center",
|
|
4187
4185
|
borderRadius: 24,
|
|
4186
|
+
marginBottom: 5,
|
|
4188
4187
|
filter: isHovered && on ? 'brightness(0.9)' : 'brightness(1)',
|
|
4189
4188
|
transition: "justify-content 0.3s cubic-bezier(0.4, 0, 0.2, 1)",
|
|
4190
4189
|
backgroundColor: isDisabled ? 'disabled' : on ? colorScheme : 'lightgray',
|
|
@@ -4204,43 +4203,44 @@ var Switch = SwitchComponent;
|
|
|
4204
4203
|
var useTextAreaState = function useTextAreaState(_ref) {
|
|
4205
4204
|
var label = _ref.label,
|
|
4206
4205
|
placeholder = _ref.placeholder,
|
|
4207
|
-
defaultValue = _ref.defaultValue
|
|
4208
|
-
value = _ref.value;
|
|
4206
|
+
defaultValue = _ref.defaultValue;
|
|
4209
4207
|
var _useState = useState(label != null ? label : placeholder),
|
|
4210
4208
|
hint = _useState[0],
|
|
4211
4209
|
setHint = _useState[1];
|
|
4212
4210
|
var _useState2 = useState(false),
|
|
4213
4211
|
isHovered = _useState2[0],
|
|
4214
4212
|
setIsHovered = _useState2[1];
|
|
4215
|
-
var _useState3 = useState(
|
|
4216
|
-
|
|
4217
|
-
|
|
4213
|
+
var _useState3 = useState(defaultValue || ''),
|
|
4214
|
+
value = _useState3[0],
|
|
4215
|
+
setValue = _useState3[1];
|
|
4218
4216
|
var _useState4 = useState(false),
|
|
4219
4217
|
isFocused = _useState4[0],
|
|
4220
4218
|
setIsFocused = _useState4[1];
|
|
4219
|
+
useMemo(function () {
|
|
4220
|
+
setHint(isFocused && !value ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
4221
|
+
}, [value, isFocused, label, placeholder]);
|
|
4221
4222
|
return {
|
|
4222
4223
|
hint: hint,
|
|
4223
4224
|
setHint: setHint,
|
|
4224
4225
|
isHovered: isHovered,
|
|
4225
4226
|
setIsHovered: setIsHovered,
|
|
4226
|
-
|
|
4227
|
-
|
|
4227
|
+
value: value,
|
|
4228
|
+
setValue: setValue,
|
|
4228
4229
|
isFocused: isFocused,
|
|
4229
4230
|
setIsFocused: setIsFocused
|
|
4230
4231
|
};
|
|
4231
4232
|
};
|
|
4232
4233
|
|
|
4233
|
-
var _excluded$t = ["id", "name", "hint", "error", "value", "label", "shadow", "
|
|
4234
|
+
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
4235
|
var TextAreaView = function TextAreaView(_ref) {
|
|
4235
4236
|
var id = _ref.id,
|
|
4236
4237
|
name = _ref.name,
|
|
4237
4238
|
hint = _ref.hint,
|
|
4238
4239
|
error = _ref.error,
|
|
4240
|
+
value = _ref.value,
|
|
4239
4241
|
label = _ref.label,
|
|
4240
4242
|
shadow = _ref.shadow,
|
|
4241
|
-
inputValue = _ref.inputValue,
|
|
4242
4243
|
helperText = _ref.helperText,
|
|
4243
|
-
placeholder = _ref.placeholder,
|
|
4244
4244
|
_ref$size = _ref.size,
|
|
4245
4245
|
size = _ref$size === void 0 ? 'sm' : _ref$size,
|
|
4246
4246
|
_ref$shape = _ref.shape,
|
|
@@ -4272,10 +4272,8 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4272
4272
|
onChange = _ref.onChange,
|
|
4273
4273
|
onFocus = _ref.onFocus,
|
|
4274
4274
|
onChangeText = _ref.onChangeText,
|
|
4275
|
-
_ref$
|
|
4276
|
-
|
|
4277
|
-
_ref$setInputValue = _ref.setInputValue,
|
|
4278
|
-
setInputValue = _ref$setInputValue === void 0 ? function () {} : _ref$setInputValue,
|
|
4275
|
+
_ref$setValue = _ref.setValue,
|
|
4276
|
+
setValue = _ref$setValue === void 0 ? function () {} : _ref$setValue,
|
|
4279
4277
|
_ref$setIsFocused = _ref.setIsFocused,
|
|
4280
4278
|
setIsFocused = _ref$setIsFocused === void 0 ? function () {} : _ref$setIsFocused,
|
|
4281
4279
|
_ref$setIsHovered = _ref.setIsHovered,
|
|
@@ -4290,9 +4288,6 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4290
4288
|
} : _ref$styles,
|
|
4291
4289
|
props = _objectWithoutPropertiesLoose(_ref, _excluded$t);
|
|
4292
4290
|
var isWithLabel = !!(isFocused && label);
|
|
4293
|
-
useMemo(function () {
|
|
4294
|
-
setHint(isFocused && !inputValue ? placeholder != null ? placeholder : '' : label != null ? label : placeholder);
|
|
4295
|
-
}, [inputValue, isFocused, label, placeholder]);
|
|
4296
4291
|
var fieldStyles = _extends({
|
|
4297
4292
|
margin: 0,
|
|
4298
4293
|
paddingVertical: 8,
|
|
@@ -4324,11 +4319,11 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4324
4319
|
var handleChange = function handleChange(event) {
|
|
4325
4320
|
if (typeof event === 'string') {
|
|
4326
4321
|
//for ios and android
|
|
4327
|
-
|
|
4322
|
+
setValue(event);
|
|
4328
4323
|
if (onChangeText) onChangeText(event);
|
|
4329
4324
|
} else {
|
|
4330
|
-
|
|
4331
|
-
if (onChange) onChange(event);
|
|
4325
|
+
setValue(event.target.value);
|
|
4326
|
+
if (onChange) onChange(event.target.value);
|
|
4332
4327
|
}
|
|
4333
4328
|
};
|
|
4334
4329
|
return React.createElement(FieldContainer, {
|
|
@@ -4343,7 +4338,7 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4343
4338
|
styles: styles,
|
|
4344
4339
|
shadow: shadow,
|
|
4345
4340
|
variant: variant,
|
|
4346
|
-
value:
|
|
4341
|
+
value: value,
|
|
4347
4342
|
color: colorScheme,
|
|
4348
4343
|
isHovered: isHovered,
|
|
4349
4344
|
isDisabled: isDisabled,
|
|
@@ -4363,7 +4358,7 @@ var TextAreaView = function TextAreaView(_ref) {
|
|
|
4363
4358
|
name: name,
|
|
4364
4359
|
rows: maxRows,
|
|
4365
4360
|
cols: maxCols,
|
|
4366
|
-
value:
|
|
4361
|
+
value: value,
|
|
4367
4362
|
readOnly: isReadOnly,
|
|
4368
4363
|
disabled: isDisabled,
|
|
4369
4364
|
autoFocus: isAutoFocus,
|