@rjsf/chakra-ui 6.2.4 → 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.
@@ -187,9 +187,7 @@
187
187
  }
188
188
  ),
189
189
  options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ jsxRuntime.jsx(ClearButton2, { registry, onClick: onClear }),
190
- Array.isArray(schema.examples) ? /* @__PURE__ */ jsxRuntime.jsx("datalist", { id: utils.examplesId(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
191
- return /* @__PURE__ */ jsxRuntime.jsx("option", { value: example }, example);
192
- }) }) : null
190
+ /* @__PURE__ */ jsxRuntime.jsx(core.SchemaExamples, { id, schema })
193
191
  ]
194
192
  }
195
193
  );
@@ -1114,12 +1112,9 @@
1114
1112
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
1115
1113
  };
1116
1114
  });
1117
- if (showPlaceholderOption) {
1118
- displayEnumOptions2.unshift({ value: "", label: placeholder || "" });
1119
- }
1120
1115
  }
1121
1116
  return { valueLabelMap: valueLabelMap2, displayEnumOptions: displayEnumOptions2 };
1122
- }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
1117
+ }, [enumDisabled, enumOptions]);
1123
1118
  const selectedIndex = utils.enumOptionsIndexForValue(value, enumOptions, false);
1124
1119
  const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
1125
1120
  {
@@ -1143,7 +1138,7 @@
1143
1138
  label: utils.labelValue(label, hideLabel || !label),
1144
1139
  ...chakraProps,
1145
1140
  children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.NativeSelect.Root, { children: [
1146
- /* @__PURE__ */ jsxRuntime.jsx(
1141
+ /* @__PURE__ */ jsxRuntime.jsxs(
1147
1142
  react$1.NativeSelect.Field,
1148
1143
  {
1149
1144
  id,
@@ -1153,7 +1148,10 @@
1153
1148
  autoFocus: autofocus,
1154
1149
  value: formValue,
1155
1150
  "aria-describedby": utils.ariaDescribedByIds(id),
1156
- children: selectOptions.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.value, children: item.label }, item.value))
1151
+ children: [
1152
+ showPlaceholderOption ? /* @__PURE__ */ jsxRuntime.jsx("option", { value: "", disabled: true, hidden: true, children: placeholder || "" }) : void 0,
1153
+ selectOptions.items.map((item) => /* @__PURE__ */ jsxRuntime.jsx("option", { value: item.value, children: item.label }, item.value))
1154
+ ]
1157
1155
  }
1158
1156
  ),
1159
1157
  /* @__PURE__ */ jsxRuntime.jsx(react$1.NativeSelect.Indicator, {})
package/dist/index.cjs CHANGED
@@ -45,7 +45,7 @@ __export(index_exports, {
45
45
  module.exports = __toCommonJS(index_exports);
46
46
 
47
47
  // src/Form/Form.tsx
48
- var import_core3 = require("@rjsf/core");
48
+ var import_core4 = require("@rjsf/core");
49
49
 
50
50
  // src/AddButton/AddButton.tsx
51
51
  var import_utils = require("@rjsf/utils");
@@ -162,6 +162,7 @@ function ArrayFieldTemplate(props) {
162
162
  var import_react7 = require("react");
163
163
  var import_react8 = require("@chakra-ui/react");
164
164
  var import_utils4 = require("@rjsf/utils");
165
+ var import_core = require("@rjsf/core");
165
166
 
166
167
  // src/components/ui/field.tsx
167
168
  var import_react4 = require("react");
@@ -261,23 +262,21 @@ function BaseInputTemplate(props) {
261
262
  }
262
263
  ),
263
264
  options.allowClearTextInputs && !readonly && !disabled && value && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ClearButton2, { registry, onClick: onClear }),
264
- Array.isArray(schema.examples) ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("datalist", { id: (0, import_utils4.examplesId)(id), children: schema.examples.concat(schema.default && !schema.examples.includes(schema.default) ? [schema.default] : []).map((example) => {
265
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("option", { value: example }, example);
266
- }) }) : null
265
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core.SchemaExamples, { id, schema })
267
266
  ]
268
267
  }
269
268
  );
270
269
  }
271
270
 
272
271
  // src/DescriptionField/DescriptionField.tsx
273
- var import_core = require("@rjsf/core");
272
+ var import_core2 = require("@rjsf/core");
274
273
  var import_react9 = require("@chakra-ui/react");
275
274
  var import_jsx_runtime6 = require("react/jsx-runtime");
276
275
  function DescriptionField({ description, id, registry, uiSchema }) {
277
276
  if (!description) {
278
277
  return null;
279
278
  }
280
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Text, { as: "sup", fontSize: "md", id, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core.RichDescription, { description, registry, uiSchema }) });
279
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_react9.Text, { as: "sup", fontSize: "md", id, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core2.RichDescription, { description, registry, uiSchema }) });
281
280
  }
282
281
 
283
282
  // src/ErrorList/ErrorList.tsx
@@ -407,14 +406,14 @@ function FieldErrorTemplate(props) {
407
406
  // src/FieldHelpTemplate/FieldHelpTemplate.tsx
408
407
  var import_react18 = require("@chakra-ui/react");
409
408
  var import_utils9 = require("@rjsf/utils");
410
- var import_core2 = require("@rjsf/core");
409
+ var import_core3 = require("@rjsf/core");
411
410
  var import_jsx_runtime13 = require("react/jsx-runtime");
412
411
  function FieldHelpTemplate(props) {
413
412
  const { fieldPathId, help, uiSchema, registry } = props;
414
413
  if (!help) {
415
414
  return null;
416
415
  }
417
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react18.Text, { as: "sup", fontSize: "md", id: (0, import_utils9.helpId)(fieldPathId), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core2.RichHelp, { help, registry, uiSchema }) });
416
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_react18.Text, { as: "sup", fontSize: "md", id: (0, import_utils9.helpId)(fieldPathId), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_core3.RichHelp, { help, registry, uiSchema }) });
418
417
  }
419
418
 
420
419
  // src/FieldTemplate/FieldTemplate.tsx
@@ -1292,7 +1291,7 @@ function SelectWidget(props) {
1292
1291
  );
1293
1292
  }
1294
1293
 
1295
- // src/SelectNativeWidget/NativeSelectWidget.tsx
1294
+ // src/NativeSelectWidget/NativeSelectWidget.tsx
1296
1295
  var import_react40 = require("react");
1297
1296
  var import_utils26 = require("@rjsf/utils");
1298
1297
  var import_react41 = require("@chakra-ui/react");
@@ -1337,12 +1336,9 @@ function NativeSelectWidget(props) {
1337
1336
  disabled: Array.isArray(enumDisabled) && enumDisabled.indexOf(value2) !== -1
1338
1337
  };
1339
1338
  });
1340
- if (showPlaceholderOption) {
1341
- displayEnumOptions2.unshift({ value: "", label: placeholder || "" });
1342
- }
1343
1339
  }
1344
1340
  return { valueLabelMap: valueLabelMap2, displayEnumOptions: displayEnumOptions2 };
1345
- }, [enumDisabled, enumOptions, placeholder, showPlaceholderOption]);
1341
+ }, [enumDisabled, enumOptions]);
1346
1342
  const selectedIndex = (0, import_utils26.enumOptionsIndexForValue)(value, enumOptions, false);
1347
1343
  const getSingleValue = () => typeof selectedIndex !== "undefined" ? [
1348
1344
  {
@@ -1366,7 +1362,7 @@ function NativeSelectWidget(props) {
1366
1362
  label: (0, import_utils26.labelValue)(label, hideLabel || !label),
1367
1363
  ...chakraProps,
1368
1364
  children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_react41.NativeSelect.Root, { children: [
1369
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
1365
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
1370
1366
  import_react41.NativeSelect.Field,
1371
1367
  {
1372
1368
  id,
@@ -1376,7 +1372,10 @@ function NativeSelectWidget(props) {
1376
1372
  autoFocus: autofocus,
1377
1373
  value: formValue,
1378
1374
  "aria-describedby": (0, import_utils26.ariaDescribedByIds)(id),
1379
- children: selectOptions.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: item.value, children: item.label }, item.value))
1375
+ children: [
1376
+ showPlaceholderOption ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: "", disabled: true, hidden: true, children: placeholder || "" }) : void 0,
1377
+ selectOptions.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("option", { value: item.value, children: item.label }, item.value))
1378
+ ]
1380
1379
  }
1381
1380
  ),
1382
1381
  /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_react41.NativeSelect.Indicator, {})
@@ -1525,7 +1524,7 @@ var Theme_default = generateTheme();
1525
1524
 
1526
1525
  // src/Form/Form.tsx
1527
1526
  function generateForm() {
1528
- return (0, import_core3.withTheme)(generateTheme());
1527
+ return (0, import_core4.withTheme)(generateTheme());
1529
1528
  }
1530
1529
  var Form_default = generateForm();
1531
1530