@rjsf/chakra-ui 6.2.5 → 6.3.0

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.
@@ -128,6 +128,7 @@ import {
128
128
  labelValue,
129
129
  getInputProps
130
130
  } from "@rjsf/utils";
131
+ import { SchemaExamples } from "@rjsf/core";
131
132
 
132
133
  // src/components/ui/field.tsx
133
134
  import { forwardRef } from "react";
@@ -227,9 +228,7 @@ function BaseInputTemplate(props) {
227
228
  }
228
229
  ),
229
230
  options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsx5(ClearButton2, { registry, onClick: onClear }),
230
- Array.isArray(schema.examples) ? /* @__PURE__ */ jsx5("datalist", { id: examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
231
- return /* @__PURE__ */ jsx5("option", { value: example }, example);
232
- }) }) : null
231
+ /* @__PURE__ */ jsx5(SchemaExamples, { id, schema })
233
232
  ]
234
233
  }
235
234
  );
@@ -1304,7 +1303,7 @@ function SelectWidget(props) {
1304
1303
  );
1305
1304
  }
1306
1305
 
1307
- // src/SelectNativeWidget/NativeSelectWidget.tsx
1306
+ // src/NativeSelectWidget/NativeSelectWidget.tsx
1308
1307
  import { useMemo as useMemo2 } from "react";
1309
1308
  import {
1310
1309
  ariaDescribedByIds as ariaDescribedByIds7,
@@ -1312,7 +1311,7 @@ import {
1312
1311
  enumOptionsValueForIndex as enumOptionsValueForIndex4,
1313
1312
  labelValue as labelValue7
1314
1313
  } from "@rjsf/utils";
1315
- import { createListCollection as createListCollection2, NativeSelect as ChakraSelect3 } from "@chakra-ui/react";
1314
+ import { createListCollection as createListCollection2, NativeSelect } from "@chakra-ui/react";
1316
1315
  import { jsx as jsx33, jsxs as jsxs20 } from "react/jsx-runtime";
1317
1316
  function NativeSelectWidget(props) {
1318
1317
  const {
@@ -1354,12 +1353,9 @@ function NativeSelectWidget(props) {
1354
1353
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
1355
1354
  };
1356
1355
  });
1357
- if (showPlaceholderOption) {
1358
- displayEnumOptions2.unshift({ value: "", label: placeholder || "" });
1359
- }
1360
1356
  }
1361
1357
  return { valueLabelMap: valueLabelMap2, displayEnumOptions: displayEnumOptions2 };
1362
- }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
1358
+ }, [enumDisabled, enumOptions]);
1363
1359
  const selectedIndex = enumOptionsIndexForValue4(value, enumOptions, false);
1364
1360
  const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
1365
1361
  {
@@ -1382,9 +1378,9 @@ function NativeSelectWidget(props) {
1382
1378
  invalid: rawErrors && rawErrors.length > 0,
1383
1379
  label: labelValue7(label, hideLabel || !label),
1384
1380
  ...chakraProps,
1385
- children: /* @__PURE__ */ jsxs20(ChakraSelect3.Root, { children: [
1386
- /* @__PURE__ */ jsx33(
1387
- ChakraSelect3.Field,
1381
+ children: /* @__PURE__ */ jsxs20(NativeSelect.Root, { children: [
1382
+ /* @__PURE__ */ jsxs20(
1383
+ NativeSelect.Field,
1388
1384
  {
1389
1385
  id,
1390
1386
  onBlur: _onBlur,
@@ -1393,10 +1389,13 @@ function NativeSelectWidget(props) {
1393
1389
  autoFocus: autofocus,
1394
1390
  value: formValue,
1395
1391
  "aria-describedby": ariaDescribedByIds7(id),
1396
- children: selectOptions.items.map((item) => /* @__PURE__ */ jsx33("option", { value: item.value, children: item.label }, item.value))
1392
+ children: [
1393
+ showPlaceholderOption ? /* @__PURE__ */ jsx33("option", { value: "", disabled: true, hidden: true, children: placeholder || "" }) : void 0,
1394
+ selectOptions.items.map((item) => /* @__PURE__ */ jsx33("option", { value: item.value, children: item.label }, item.value))
1395
+ ]
1397
1396
  }
1398
1397
  ),
1399
- /* @__PURE__ */ jsx33(ChakraSelect3.Indicator, {})
1398
+ /* @__PURE__ */ jsx33(NativeSelect.Indicator, {})
1400
1399
  ] })
1401
1400
  }
1402
1401
  );