@app-studio/web 0.7.7 → 0.7.9
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/Select/Select/Select.props.d.ts +6 -5
- package/dist/web.cjs.development.js +19 -9
- 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 +19 -9
- package/dist/web.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
2
|
import { Elevation } from 'src/utils/elevation';
|
|
3
3
|
import { Shadow } from 'app-studio';
|
|
4
|
-
import { SelectStyles, Shape, Size, Variant } from './Select.type';
|
|
4
|
+
import { SelectStyles, Shape, Size, Variant, Option } from './Select.type';
|
|
5
5
|
export interface SelectProps {
|
|
6
6
|
/**
|
|
7
7
|
* The identifier of the select field.
|
|
@@ -34,7 +34,7 @@ export interface SelectProps {
|
|
|
34
34
|
/**
|
|
35
35
|
* An array of options for the select field.
|
|
36
36
|
*/
|
|
37
|
-
options:
|
|
37
|
+
options: Option[];
|
|
38
38
|
/**
|
|
39
39
|
* If true, allows multiple options to be selected.
|
|
40
40
|
*/
|
|
@@ -112,6 +112,7 @@ export interface SelectViewProps extends SelectProps {
|
|
|
112
112
|
setIsFocused: Function;
|
|
113
113
|
}
|
|
114
114
|
export interface SelectBoxProps {
|
|
115
|
+
options: Option[];
|
|
115
116
|
/**
|
|
116
117
|
* The option that will be selected value
|
|
117
118
|
*/
|
|
@@ -163,7 +164,7 @@ export interface ItemProps {
|
|
|
163
164
|
/**
|
|
164
165
|
* Option to be displayed
|
|
165
166
|
*/
|
|
166
|
-
option:
|
|
167
|
+
option: Option;
|
|
167
168
|
/**
|
|
168
169
|
* To set the item's fontSize
|
|
169
170
|
*/
|
|
@@ -209,7 +210,7 @@ export interface HiddenSelectProps {
|
|
|
209
210
|
/**
|
|
210
211
|
* List of options
|
|
211
212
|
*/
|
|
212
|
-
options:
|
|
213
|
+
options: Option[];
|
|
213
214
|
/**
|
|
214
215
|
* other properties
|
|
215
216
|
*/
|
|
@@ -227,7 +228,7 @@ export interface DropDownProps {
|
|
|
227
228
|
/**
|
|
228
229
|
* List of options
|
|
229
230
|
*/
|
|
230
|
-
options:
|
|
231
|
+
options: Option[];
|
|
231
232
|
/**
|
|
232
233
|
* Css styles for the select container and label
|
|
233
234
|
*/
|
|
@@ -3809,7 +3809,7 @@ var useSelectState = function useSelectState(_ref) {
|
|
|
3809
3809
|
var placeholder = _ref.placeholder,
|
|
3810
3810
|
isMulti = _ref.isMulti,
|
|
3811
3811
|
options = _ref.options;
|
|
3812
|
-
var defaultValue = placeholder ? isMulti ? [] : '' : options[0];
|
|
3812
|
+
var defaultValue = placeholder ? isMulti ? [] : '' : options[0].value;
|
|
3813
3813
|
var _React$useState = React__default.useState(true),
|
|
3814
3814
|
hide = _React$useState[0],
|
|
3815
3815
|
setHide = _React$useState[1];
|
|
@@ -3885,14 +3885,15 @@ var Item = function Item(_ref) {
|
|
|
3885
3885
|
onMouseEnter: handleHover,
|
|
3886
3886
|
onMouseLeave: handleHover,
|
|
3887
3887
|
onClick: function onClick() {
|
|
3888
|
-
return handleOptionClick(option);
|
|
3888
|
+
return handleOptionClick(option.value);
|
|
3889
3889
|
},
|
|
3890
3890
|
backgroundColor: isHovered ? 'trueGray.100' : 'transparent'
|
|
3891
3891
|
}, props), React__default.createElement(Text, Object.assign({
|
|
3892
3892
|
fontSize: appStudio.Typography.fontSizes[size]
|
|
3893
|
-
}, style), option));
|
|
3893
|
+
}, style), option.label));
|
|
3894
3894
|
};
|
|
3895
3895
|
var SelectBox = function SelectBox(_ref2) {
|
|
3896
|
+
var _option$label;
|
|
3896
3897
|
var _ref2$size = _ref2.size,
|
|
3897
3898
|
size = _ref2$size === void 0 ? 'md' : _ref2$size,
|
|
3898
3899
|
_ref2$styles = _ref2.styles,
|
|
@@ -3904,7 +3905,8 @@ var SelectBox = function SelectBox(_ref2) {
|
|
|
3904
3905
|
isDisabled = _ref2.isDisabled,
|
|
3905
3906
|
placeholder = _ref2.placeholder,
|
|
3906
3907
|
_ref2$removeOption = _ref2.removeOption,
|
|
3907
|
-
removeOption = _ref2$removeOption === void 0 ? function () {} : _ref2$removeOption
|
|
3908
|
+
removeOption = _ref2$removeOption === void 0 ? function () {} : _ref2$removeOption,
|
|
3909
|
+
options = _ref2.options;
|
|
3908
3910
|
var fieldStyles = _extends({
|
|
3909
3911
|
margin: 0,
|
|
3910
3912
|
width: '95%',
|
|
@@ -3917,7 +3919,10 @@ var SelectBox = function SelectBox(_ref2) {
|
|
|
3917
3919
|
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
3918
3920
|
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
3919
3921
|
}, styles['field'], styles['text']);
|
|
3920
|
-
|
|
3922
|
+
var option = options.find(function (option) {
|
|
3923
|
+
return option.value === value;
|
|
3924
|
+
});
|
|
3925
|
+
return React__default.createElement(Text, Object.assign({}, fieldStyles), (value === '' || value && value.length === 0) && !!placeholder ? placeholder : React__default.createElement(React__default.Fragment, null, typeof value === 'string' ? (_option$label = option == null ? void 0 : option.label) != null ? _option$label : value : value && value.length > 0 && React__default.createElement(Horizontal, {
|
|
3921
3926
|
gap: 6
|
|
3922
3927
|
}, value.map(function (option) {
|
|
3923
3928
|
return React__default.createElement(MultiSelect, {
|
|
@@ -3959,9 +3964,9 @@ var HiddenSelect = function HiddenSelect(_ref3) {
|
|
|
3959
3964
|
multiple: isMulti
|
|
3960
3965
|
}, props), options.map(function (option) {
|
|
3961
3966
|
return React__default.createElement("option", {
|
|
3962
|
-
key: option,
|
|
3963
|
-
value: option
|
|
3964
|
-
}, option);
|
|
3967
|
+
key: option.value,
|
|
3968
|
+
value: option.value
|
|
3969
|
+
}, option.label);
|
|
3965
3970
|
}));
|
|
3966
3971
|
};
|
|
3967
3972
|
var DropDown$1 = function DropDown(_ref4) {
|
|
@@ -4018,7 +4023,7 @@ var DropDown$1 = function DropDown(_ref4) {
|
|
|
4018
4023
|
}
|
|
4019
4024
|
}, shadow, styles['dropDown']), options.map(function (option, index) {
|
|
4020
4025
|
return React__default.createElement(Item, Object.assign({
|
|
4021
|
-
key: option,
|
|
4026
|
+
key: option.value,
|
|
4022
4027
|
size: size,
|
|
4023
4028
|
style: styles['text'],
|
|
4024
4029
|
option: option,
|
|
@@ -4182,6 +4187,7 @@ var SelectView = function SelectView(_ref6) {
|
|
|
4182
4187
|
isMulti: isMulti,
|
|
4183
4188
|
onFocus: handleFocus
|
|
4184
4189
|
}, props)), React__default.createElement(SelectBox, {
|
|
4190
|
+
options: options,
|
|
4185
4191
|
size: size,
|
|
4186
4192
|
styles: styles,
|
|
4187
4193
|
value: value,
|
|
@@ -4821,6 +4827,10 @@ var FormikCountryPicker = CountryPickerComponent$1;
|
|
|
4821
4827
|
var SelectComponent$1 = function SelectComponent(props) {
|
|
4822
4828
|
var formProps = useFormikInput(props);
|
|
4823
4829
|
formProps.selected = formProps.value;
|
|
4830
|
+
console.log({
|
|
4831
|
+
formProps: formProps,
|
|
4832
|
+
test: formProps.value
|
|
4833
|
+
});
|
|
4824
4834
|
var selectStates = useSelectState(props);
|
|
4825
4835
|
return React__default.createElement(SelectView, Object.assign({}, selectStates, formProps));
|
|
4826
4836
|
};
|