@rjsf/core 5.19.2 → 5.19.3

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/core.umd.js CHANGED
@@ -2819,23 +2819,24 @@
2819
2819
  const newValue = getValue(event, multiple);
2820
2820
  return onFocus(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
2821
2821
  },
2822
- [onFocus, id, schema, multiple, options]
2822
+ [onFocus, id, schema, multiple, enumOptions, optEmptyVal]
2823
2823
  );
2824
2824
  const handleBlur = react.useCallback(
2825
2825
  (event) => {
2826
2826
  const newValue = getValue(event, multiple);
2827
2827
  return onBlur(id, utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
2828
2828
  },
2829
- [onBlur, id, schema, multiple, options]
2829
+ [onBlur, id, schema, multiple, enumOptions, optEmptyVal]
2830
2830
  );
2831
2831
  const handleChange = react.useCallback(
2832
2832
  (event) => {
2833
2833
  const newValue = getValue(event, multiple);
2834
2834
  return onChange(utils.enumOptionsValueForIndex(newValue, enumOptions, optEmptyVal));
2835
2835
  },
2836
- [onChange, schema, multiple, options]
2836
+ [onChange, schema, multiple, enumOptions, optEmptyVal]
2837
2837
  );
2838
2838
  const selectedIndexes = utils.enumOptionsIndexForValue(value, enumOptions, multiple);
2839
+ const showPlaceholderOption = !multiple && schema.default === void 0;
2839
2840
  return /* @__PURE__ */ jsxRuntime.jsxs(
2840
2841
  "select",
2841
2842
  {
@@ -2852,7 +2853,7 @@
2852
2853
  onChange: handleChange,
2853
2854
  "aria-describedby": utils.ariaDescribedByIds(id),
2854
2855
  children: [
2855
- !multiple && schema.default === void 0 && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
2856
+ showPlaceholderOption && /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", children: placeholder }),
2856
2857
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
2857
2858
  const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
2858
2859
  return /* @__PURE__ */ jsxRuntime.jsx("option", { value: String(i), disabled: disabled2, children: label }, i);
package/dist/index.esm.js CHANGED
@@ -3143,23 +3143,24 @@ function SelectWidget({
3143
3143
  const newValue = getValue(event, multiple);
3144
3144
  return onFocus(id, enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3145
3145
  },
3146
- [onFocus, id, schema, multiple, options]
3146
+ [onFocus, id, schema, multiple, enumOptions, optEmptyVal]
3147
3147
  );
3148
3148
  const handleBlur = useCallback10(
3149
3149
  (event) => {
3150
3150
  const newValue = getValue(event, multiple);
3151
3151
  return onBlur(id, enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3152
3152
  },
3153
- [onBlur, id, schema, multiple, options]
3153
+ [onBlur, id, schema, multiple, enumOptions, optEmptyVal]
3154
3154
  );
3155
3155
  const handleChange = useCallback10(
3156
3156
  (event) => {
3157
3157
  const newValue = getValue(event, multiple);
3158
3158
  return onChange(enumOptionsValueForIndex3(newValue, enumOptions, optEmptyVal));
3159
3159
  },
3160
- [onChange, schema, multiple, options]
3160
+ [onChange, schema, multiple, enumOptions, optEmptyVal]
3161
3161
  );
3162
3162
  const selectedIndexes = enumOptionsIndexForValue(value, enumOptions, multiple);
3163
+ const showPlaceholderOption = !multiple && schema.default === void 0;
3163
3164
  return /* @__PURE__ */ jsxs20(
3164
3165
  "select",
3165
3166
  {
@@ -3176,7 +3177,7 @@ function SelectWidget({
3176
3177
  onChange: handleChange,
3177
3178
  "aria-describedby": ariaDescribedByIds6(id),
3178
3179
  children: [
3179
- !multiple && schema.default === void 0 && /* @__PURE__ */ jsx39("option", { value: "", children: placeholder }),
3180
+ showPlaceholderOption && /* @__PURE__ */ jsx39("option", { value: "", children: placeholder }),
3180
3181
  Array.isArray(enumOptions) && enumOptions.map(({ value: value2, label }, i) => {
3181
3182
  const disabled2 = enumDisabled && enumDisabled.indexOf(value2) !== -1;
3182
3183
  return /* @__PURE__ */ jsx39("option", { value: String(i), disabled: disabled2, children: label }, i);