@app-studio/web 0.8.24 → 0.8.25
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/web.cjs.development.js +24 -18
- 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 +24 -18
- package/dist/web.esm.js.map +1 -1
- package/dist/web.umd.development.js +24 -18
- package/dist/web.umd.development.js.map +1 -1
- package/dist/web.umd.production.min.js +1 -1
- package/dist/web.umd.production.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -2507,7 +2507,8 @@ var useSelectState = _ref => {
|
|
|
2507
2507
|
options
|
|
2508
2508
|
} = _ref;
|
|
2509
2509
|
// Determines the default value based on the 'placeholder' and 'isMulti' props, setting to an empty array for multi-select or an empty string/single default option
|
|
2510
|
-
var defaultValue = placeholder ? isMulti ? [] : ''
|
|
2510
|
+
var defaultValue = placeholder ? isMulti ? [] : '' // If there's a placeholder, set default to empty array for multi-select or empty string for single select
|
|
2511
|
+
: Array.isArray(options) && options.length > 0 ? options[0].value : ''; // If no placeholder, use the first option value if available, otherwise undefined
|
|
2511
2512
|
// State hook for managing visibility of the Select dropdown, initially set to hidden
|
|
2512
2513
|
var [hide, setHide] = React__default.useState(true);
|
|
2513
2514
|
// State hook for tracking mouse hover status over the Select component
|
|
@@ -2851,7 +2852,7 @@ var Item = _ref => {
|
|
|
2851
2852
|
}, style), option.label));
|
|
2852
2853
|
};
|
|
2853
2854
|
var SelectBox = _ref2 => {
|
|
2854
|
-
var
|
|
2855
|
+
var _ref3;
|
|
2855
2856
|
var {
|
|
2856
2857
|
size = 'md',
|
|
2857
2858
|
styles = {
|
|
@@ -2876,16 +2877,21 @@ var SelectBox = _ref2 => {
|
|
|
2876
2877
|
color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
|
|
2877
2878
|
cursor: isDisabled ? 'not-allowed' : 'auto'
|
|
2878
2879
|
}, styles['field'], styles['text']);
|
|
2879
|
-
var option = options.find(option => option.value === value);
|
|
2880
|
-
return /*#__PURE__*/React__default.createElement(Text, Object.assign({}, fieldStyles), (value === '' || value && value.length === 0) && !!placeholder ? placeholder : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, typeof value === 'string' ? (
|
|
2880
|
+
var option = options.length > 0 && options.find(option => option.value === value);
|
|
2881
|
+
return /*#__PURE__*/React__default.createElement(Text, Object.assign({}, fieldStyles), (value === '' || Array.isArray(value) && value.length === 0) && !!placeholder ? placeholder : (/*#__PURE__*/React__default.createElement(React__default.Fragment, null, typeof value === 'string' ? (_ref3 = option && option.label) != null ? _ref3 : value :
|
|
2882
|
+
// If value is an array and not empty, render MultiSelect options
|
|
2883
|
+
Array.isArray(value) && value.length > 0 ? (/*#__PURE__*/React__default.createElement(Horizontal, {
|
|
2881
2884
|
gap: 6
|
|
2882
2885
|
}, value.map(option => (/*#__PURE__*/React__default.createElement(MultiSelect, {
|
|
2883
2886
|
key: option,
|
|
2884
2887
|
option: option,
|
|
2885
2888
|
removeOption: removeOption
|
|
2886
|
-
})))))
|
|
2889
|
+
}))))) : (
|
|
2890
|
+
/*#__PURE__*/
|
|
2891
|
+
// Handle any other types of value (including objects or unexpected values)
|
|
2892
|
+
React__default.createElement("span", null, value)))));
|
|
2887
2893
|
};
|
|
2888
|
-
var HiddenSelect =
|
|
2894
|
+
var HiddenSelect = _ref4 => {
|
|
2889
2895
|
var {
|
|
2890
2896
|
id,
|
|
2891
2897
|
name,
|
|
@@ -2895,8 +2901,8 @@ var HiddenSelect = _ref3 => {
|
|
|
2895
2901
|
isDisabled = false,
|
|
2896
2902
|
isReadOnly = false,
|
|
2897
2903
|
options = []
|
|
2898
|
-
} =
|
|
2899
|
-
props = _objectWithoutPropertiesLoose(
|
|
2904
|
+
} = _ref4,
|
|
2905
|
+
props = _objectWithoutPropertiesLoose(_ref4, _excluded2$3);
|
|
2900
2906
|
var handleChange = event => {
|
|
2901
2907
|
if (onChange) onChange(event);
|
|
2902
2908
|
};
|
|
@@ -2913,14 +2919,14 @@ var HiddenSelect = _ref3 => {
|
|
|
2913
2919
|
readOnly: isReadOnly,
|
|
2914
2920
|
onChange: handleChange,
|
|
2915
2921
|
multiple: isMulti
|
|
2916
|
-
}, props), options.map(option => {
|
|
2922
|
+
}, props), options.length > 0 && options.map(option => {
|
|
2917
2923
|
return /*#__PURE__*/React__default.createElement("option", {
|
|
2918
2924
|
key: option.value,
|
|
2919
2925
|
value: option.value
|
|
2920
2926
|
}, option.label);
|
|
2921
2927
|
}));
|
|
2922
2928
|
};
|
|
2923
|
-
var DropDown =
|
|
2929
|
+
var DropDown = _ref5 => {
|
|
2924
2930
|
var {
|
|
2925
2931
|
size,
|
|
2926
2932
|
styles = {
|
|
@@ -2930,7 +2936,7 @@ var DropDown = _ref4 => {
|
|
|
2930
2936
|
callback = () => {},
|
|
2931
2937
|
highlightedIndex,
|
|
2932
2938
|
setHighlightedIndex
|
|
2933
|
-
} =
|
|
2939
|
+
} = _ref5;
|
|
2934
2940
|
var itemStates = useItemState();
|
|
2935
2941
|
var handleCallback = option => callback(option);
|
|
2936
2942
|
var shadow = typeof document !== undefined ? {
|
|
@@ -2970,7 +2976,7 @@ var DropDown = _ref4 => {
|
|
|
2970
2976
|
display: 'none'
|
|
2971
2977
|
}
|
|
2972
2978
|
}
|
|
2973
|
-
}, shadow, styles['dropDown']), options.map((option, index) => (/*#__PURE__*/React__default.createElement(Item, Object.assign({
|
|
2979
|
+
}, shadow, styles['dropDown']), options.length > 0 && options.map((option, index) => (/*#__PURE__*/React__default.createElement(Item, Object.assign({
|
|
2974
2980
|
key: option.value,
|
|
2975
2981
|
size: size,
|
|
2976
2982
|
style: styles['text'],
|
|
@@ -2980,13 +2986,13 @@ var DropDown = _ref4 => {
|
|
|
2980
2986
|
onMouseEnter: () => setHighlightedIndex(index)
|
|
2981
2987
|
}, itemStates)))));
|
|
2982
2988
|
};
|
|
2983
|
-
var MultiSelect =
|
|
2989
|
+
var MultiSelect = _ref6 => {
|
|
2984
2990
|
var {
|
|
2985
2991
|
option,
|
|
2986
2992
|
size = 'md',
|
|
2987
2993
|
removeOption = () => {}
|
|
2988
|
-
} =
|
|
2989
|
-
props = _objectWithoutPropertiesLoose(
|
|
2994
|
+
} = _ref6,
|
|
2995
|
+
props = _objectWithoutPropertiesLoose(_ref6, _excluded3$2);
|
|
2990
2996
|
var handleClick = () => removeOption(option);
|
|
2991
2997
|
return /*#__PURE__*/React__default.createElement(Horizontal, Object.assign({
|
|
2992
2998
|
gap: 10,
|
|
@@ -3005,7 +3011,7 @@ var MultiSelect = _ref5 => {
|
|
|
3005
3011
|
onClick: handleClick
|
|
3006
3012
|
}));
|
|
3007
3013
|
};
|
|
3008
|
-
var SelectView =
|
|
3014
|
+
var SelectView = _ref7 => {
|
|
3009
3015
|
var {
|
|
3010
3016
|
id,
|
|
3011
3017
|
name,
|
|
@@ -3041,8 +3047,8 @@ var SelectView = _ref6 => {
|
|
|
3041
3047
|
setIsFocused = () => {},
|
|
3042
3048
|
setHighlightedIndex,
|
|
3043
3049
|
highlightedIndex
|
|
3044
|
-
} =
|
|
3045
|
-
props = _objectWithoutPropertiesLoose(
|
|
3050
|
+
} = _ref7,
|
|
3051
|
+
props = _objectWithoutPropertiesLoose(_ref7, _excluded4$2);
|
|
3046
3052
|
var isWithLabel = !!(isFocused && label);
|
|
3047
3053
|
var handleHover = () => setIsHovered(!isHovered);
|
|
3048
3054
|
var handleFocus = () => setIsFocused(true);
|