schema-components 1.9.0 → 1.9.1

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.
@@ -6,11 +6,11 @@ import { b as ComponentResolver } from "../types-BJzEgJdX.mjs";
6
6
  * Call once at app startup before rendering.
7
7
  */
8
8
  declare function registerMantineComponents(components: {
9
- TextInput: unknown;
10
- NumberInput: unknown;
11
- Switch: unknown;
12
- Select: unknown;
13
- Fieldset: unknown;
9
+ TextInput: React.ElementType;
10
+ NumberInput: React.ElementType;
11
+ Switch: React.ElementType;
12
+ Select: React.ElementType;
13
+ Fieldset: React.ElementType;
14
14
  }): void;
15
15
  declare const mantineResolver: ComponentResolver;
16
16
  //#endregion
@@ -16,21 +16,16 @@ let MantineSwitch = (props) => /* @__PURE__ */ jsx("input", {
16
16
  });
17
17
  let MantineSelect = (props) => /* @__PURE__ */ jsx("select", { ...props });
18
18
  let MantineFieldset = (props) => /* @__PURE__ */ jsx("fieldset", { ...props });
19
- function toComponent(value) {
20
- if (typeof value === "function") return value;
21
- if (typeof value === "object" && value !== null && "render" in value) return value;
22
- throw new Error(`Expected a React component, got ${typeof value}`);
23
- }
24
19
  /**
25
20
  * Register real Mantine components for the resolver to use.
26
21
  * Call once at app startup before rendering.
27
22
  */
28
23
  function registerMantineComponents(components) {
29
- MantineTextInput = toComponent(components.TextInput);
30
- MantineNumberInput = toComponent(components.NumberInput);
31
- MantineSwitch = toComponent(components.Switch);
32
- MantineSelect = toComponent(components.Select);
33
- MantineFieldset = toComponent(components.Fieldset);
24
+ MantineTextInput = components.TextInput;
25
+ MantineNumberInput = components.NumberInput;
26
+ MantineSwitch = components.Switch;
27
+ MantineSelect = components.Select;
28
+ MantineFieldset = components.Fieldset;
34
29
  }
35
30
  function renderStringInput(props) {
36
31
  const strValue = typeof props.value === "string" ? props.value : "";
@@ -1,13 +1,16 @@
1
1
  import { b as ComponentResolver } from "../types-BJzEgJdX.mjs";
2
2
 
3
3
  //#region src/themes/mui.d.ts
4
+ /**
5
+ * Register real MUI components. Call once at app startup.
6
+ */
4
7
  declare function registerMuiComponents(components: {
5
- TextField: unknown;
6
- Checkbox: unknown;
7
- Typography: unknown;
8
- Box: unknown;
9
- MenuItem: unknown;
10
- FormControlLabel: unknown;
8
+ TextField: React.ElementType;
9
+ Checkbox: React.ElementType;
10
+ Typography: React.ElementType;
11
+ Box: React.ElementType;
12
+ MenuItem: React.ElementType;
13
+ FormControlLabel: React.ElementType;
11
14
  }): void;
12
15
  declare const muiResolver: ComponentResolver;
13
16
  //#endregion
@@ -197,18 +197,13 @@ let MuiFormControlLabel = (props) => {
197
197
  /**
198
198
  * Register real MUI components. Call once at app startup.
199
199
  */
200
- function toComponent(value) {
201
- if (typeof value === "function") return value;
202
- if (typeof value === "object" && value !== null && "render" in value) return value;
203
- throw new Error(`Expected a React component, got ${typeof value}`);
204
- }
205
200
  function registerMuiComponents(components) {
206
- MuiTextField = toComponent(components.TextField);
207
- MuiCheckbox = toComponent(components.Checkbox);
208
- MuiTypography = toComponent(components.Typography);
209
- MuiBox = toComponent(components.Box);
210
- MuiMenuItem = toComponent(components.MenuItem);
211
- MuiFormControlLabel = toComponent(components.FormControlLabel);
201
+ MuiTextField = components.TextField;
202
+ MuiCheckbox = components.Checkbox;
203
+ MuiTypography = components.Typography;
204
+ MuiBox = components.Box;
205
+ MuiMenuItem = components.MenuItem;
206
+ MuiFormControlLabel = components.FormControlLabel;
212
207
  }
213
208
  function buildResolver() {
214
209
  const resolver = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "schema-components",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
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",