@app-studio/web 0.8.24 → 0.8.26

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.esm.js CHANGED
@@ -166,16 +166,16 @@ var Text = TextComponent;
166
166
  var _excluded$1 = ["justifyContent", "isReversed"];
167
167
  var Vertical = /*#__PURE__*/React.forwardRef((_ref, ref) => {
168
168
  var {
169
- // Sets a default alignment for content within the Vertical container to 'flex-start'
170
169
  justifyContent = 'flex-start',
171
- // Determines the direction in which the Vertical elements are stacked, default not reversed
172
170
  isReversed = false
173
171
  } = _ref,
174
172
  props = _objectWithoutPropertiesLoose(_ref, _excluded$1);
175
- return /*#__PURE__*/React.createElement(View$1, Object.assign({
176
- display: "flex",
177
- justifyContent: justifyContent,
178
- flexDirection: isReversed ? 'column-reverse' : 'column'
173
+ return /*#__PURE__*/React.createElement("div", Object.assign({
174
+ style: {
175
+ display: 'flex',
176
+ justifyContent: justifyContent,
177
+ flexDirection: isReversed ? 'column-reverse' : 'column'
178
+ }
179
179
  }, props, {
180
180
  ref: ref
181
181
  }));
@@ -2500,7 +2500,8 @@ var useSelectState = _ref => {
2500
2500
  options
2501
2501
  } = _ref;
2502
2502
  // 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
2503
- var defaultValue = placeholder ? isMulti ? [] : '' : options[0].value;
2503
+ var defaultValue = placeholder ? isMulti ? [] : '' // If there's a placeholder, set default to empty array for multi-select or empty string for single select
2504
+ : Array.isArray(options) && options.length > 0 ? options[0].value : ''; // If no placeholder, use the first option value if available, otherwise undefined
2504
2505
  // State hook for managing visibility of the Select dropdown, initially set to hidden
2505
2506
  var [hide, setHide] = React.useState(true);
2506
2507
  // State hook for tracking mouse hover status over the Select component
@@ -2844,7 +2845,7 @@ var Item = _ref => {
2844
2845
  }, style), option.label));
2845
2846
  };
2846
2847
  var SelectBox = _ref2 => {
2847
- var _option$label;
2848
+ var _ref3;
2848
2849
  var {
2849
2850
  size = 'md',
2850
2851
  styles = {
@@ -2869,16 +2870,21 @@ var SelectBox = _ref2 => {
2869
2870
  color: isDisabled ? 'color.trueGray.600' : 'color.blueGray.700',
2870
2871
  cursor: isDisabled ? 'not-allowed' : 'auto'
2871
2872
  }, styles['field'], styles['text']);
2872
- var option = options.find(option => option.value === value);
2873
- return /*#__PURE__*/React.createElement(Text, Object.assign({}, fieldStyles), (value === '' || value && value.length === 0) && !!placeholder ? placeholder : (/*#__PURE__*/React.createElement(React.Fragment, null, typeof value === 'string' ? (_option$label = option == null ? void 0 : option.label) != null ? _option$label : value : value && value.length > 0 && (/*#__PURE__*/React.createElement(Horizontal, {
2873
+ var option = options.length > 0 && options.find(option => option.value === value);
2874
+ return /*#__PURE__*/React.createElement(Text, Object.assign({}, fieldStyles), (value === '' || Array.isArray(value) && value.length === 0) && !!placeholder ? placeholder : (/*#__PURE__*/React.createElement(React.Fragment, null, typeof value === 'string' ? (_ref3 = option && option.label) != null ? _ref3 : value :
2875
+ // If value is an array and not empty, render MultiSelect options
2876
+ Array.isArray(value) && value.length > 0 ? (/*#__PURE__*/React.createElement(Horizontal, {
2874
2877
  gap: 6
2875
2878
  }, value.map(option => (/*#__PURE__*/React.createElement(MultiSelect, {
2876
2879
  key: option,
2877
2880
  option: option,
2878
2881
  removeOption: removeOption
2879
- }))))))));
2882
+ }))))) : (
2883
+ /*#__PURE__*/
2884
+ // Handle any other types of value (including objects or unexpected values)
2885
+ React.createElement("span", null, value)))));
2880
2886
  };
2881
- var HiddenSelect = _ref3 => {
2887
+ var HiddenSelect = _ref4 => {
2882
2888
  var {
2883
2889
  id,
2884
2890
  name,
@@ -2888,8 +2894,8 @@ var HiddenSelect = _ref3 => {
2888
2894
  isDisabled = false,
2889
2895
  isReadOnly = false,
2890
2896
  options = []
2891
- } = _ref3,
2892
- props = _objectWithoutPropertiesLoose(_ref3, _excluded2$3);
2897
+ } = _ref4,
2898
+ props = _objectWithoutPropertiesLoose(_ref4, _excluded2$3);
2893
2899
  var handleChange = event => {
2894
2900
  if (onChange) onChange(event);
2895
2901
  };
@@ -2906,14 +2912,14 @@ var HiddenSelect = _ref3 => {
2906
2912
  readOnly: isReadOnly,
2907
2913
  onChange: handleChange,
2908
2914
  multiple: isMulti
2909
- }, props), options.map(option => {
2915
+ }, props), options.length > 0 && options.map(option => {
2910
2916
  return /*#__PURE__*/React.createElement("option", {
2911
2917
  key: option.value,
2912
2918
  value: option.value
2913
2919
  }, option.label);
2914
2920
  }));
2915
2921
  };
2916
- var DropDown = _ref4 => {
2922
+ var DropDown = _ref5 => {
2917
2923
  var {
2918
2924
  size,
2919
2925
  styles = {
@@ -2923,7 +2929,7 @@ var DropDown = _ref4 => {
2923
2929
  callback = () => {},
2924
2930
  highlightedIndex,
2925
2931
  setHighlightedIndex
2926
- } = _ref4;
2932
+ } = _ref5;
2927
2933
  var itemStates = useItemState();
2928
2934
  var handleCallback = option => callback(option);
2929
2935
  var shadow = typeof document !== undefined ? {
@@ -2963,7 +2969,7 @@ var DropDown = _ref4 => {
2963
2969
  display: 'none'
2964
2970
  }
2965
2971
  }
2966
- }, shadow, styles['dropDown']), options.map((option, index) => (/*#__PURE__*/React.createElement(Item, Object.assign({
2972
+ }, shadow, styles['dropDown']), options.length > 0 && options.map((option, index) => (/*#__PURE__*/React.createElement(Item, Object.assign({
2967
2973
  key: option.value,
2968
2974
  size: size,
2969
2975
  style: styles['text'],
@@ -2973,13 +2979,13 @@ var DropDown = _ref4 => {
2973
2979
  onMouseEnter: () => setHighlightedIndex(index)
2974
2980
  }, itemStates)))));
2975
2981
  };
2976
- var MultiSelect = _ref5 => {
2982
+ var MultiSelect = _ref6 => {
2977
2983
  var {
2978
2984
  option,
2979
2985
  size = 'md',
2980
2986
  removeOption = () => {}
2981
- } = _ref5,
2982
- props = _objectWithoutPropertiesLoose(_ref5, _excluded3$2);
2987
+ } = _ref6,
2988
+ props = _objectWithoutPropertiesLoose(_ref6, _excluded3$2);
2983
2989
  var handleClick = () => removeOption(option);
2984
2990
  return /*#__PURE__*/React.createElement(Horizontal, Object.assign({
2985
2991
  gap: 10,
@@ -2998,7 +3004,7 @@ var MultiSelect = _ref5 => {
2998
3004
  onClick: handleClick
2999
3005
  }));
3000
3006
  };
3001
- var SelectView = _ref6 => {
3007
+ var SelectView = _ref7 => {
3002
3008
  var {
3003
3009
  id,
3004
3010
  name,
@@ -3034,8 +3040,8 @@ var SelectView = _ref6 => {
3034
3040
  setIsFocused = () => {},
3035
3041
  setHighlightedIndex,
3036
3042
  highlightedIndex
3037
- } = _ref6,
3038
- props = _objectWithoutPropertiesLoose(_ref6, _excluded4$2);
3043
+ } = _ref7,
3044
+ props = _objectWithoutPropertiesLoose(_ref7, _excluded4$2);
3039
3045
  var isWithLabel = !!(isFocused && label);
3040
3046
  var handleHover = () => setIsHovered(!isHovered);
3041
3047
  var handleFocus = () => setIsFocused(true);