schema-components 1.10.1 → 1.10.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.
@@ -259,6 +259,33 @@ function renderObject(props) {
259
259
  }), toReactNode(props.renderChild(field, childValue, childOnChange))] }, key);
260
260
  })] });
261
261
  }
262
+ function renderRecord(props) {
263
+ const obj = isObject(props.value) ? props.value : {};
264
+ const valueType = props.valueType;
265
+ if (valueType === void 0) return null;
266
+ const entries = Object.entries(obj);
267
+ if (entries.length === 0) return /* @__PURE__ */ jsx("span", {
268
+ "aria-readonly": props.readOnly ? "true" : void 0,
269
+ children: "—"
270
+ });
271
+ return /* @__PURE__ */ jsx("div", {
272
+ role: "group",
273
+ "aria-label": props.meta.description ?? "Record",
274
+ children: entries.map(([key, value]) => {
275
+ const childId = inputId(props.path ? `${props.path}.${key}` : key);
276
+ const childOnChange = (nextValue) => {
277
+ const updated = {};
278
+ for (const [k, val] of Object.entries(obj)) updated[k] = val;
279
+ updated[key] = nextValue;
280
+ props.onChange(updated);
281
+ };
282
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
283
+ htmlFor: childId,
284
+ children: key
285
+ }), toReactNode(props.renderChild(valueType, value, childOnChange))] }, key);
286
+ })
287
+ });
288
+ }
262
289
  function renderArray(props) {
263
290
  const arr = Array.isArray(props.value) ? props.value : [];
264
291
  const element = props.element;
@@ -471,6 +498,7 @@ const headlessResolver = {
471
498
  boolean: renderBoolean,
472
499
  enum: renderEnum,
473
500
  object: renderObject,
501
+ record: renderRecord,
474
502
  array: renderArray,
475
503
  union: renderUnion,
476
504
  discriminatedUnion: renderDiscriminatedUnion,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schema-components",
3
- "version": "1.10.1",
3
+ "version": "1.10.3",
4
4
  "description": "React components that render UI from Zod schemas, JSON Schema, and OpenAPI documents",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",