pxengine 0.1.7 → 0.1.9

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/index.cjs CHANGED
@@ -8384,16 +8384,17 @@ var FormInputAtom = ({
8384
8384
  className,
8385
8385
  id
8386
8386
  }) => {
8387
+ const fieldName = name || id || `input-${Math.random().toString(36).substring(2, 9)}`;
8387
8388
  const form = (0, import_react_hook_form2.useForm)({
8388
8389
  defaultValues: {
8389
- [name]: defaultValue
8390
+ [fieldName]: defaultValue
8390
8391
  }
8391
8392
  });
8392
8393
  return /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(Form, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime69.jsx)(
8393
8394
  FormField,
8394
8395
  {
8395
8396
  control: form.control,
8396
- name,
8397
+ name: fieldName,
8397
8398
  rules: {
8398
8399
  required: required ? `${label || name} is required` : void 0
8399
8400
  },
@@ -8429,23 +8430,24 @@ var FormSelectAtom = ({
8429
8430
  className,
8430
8431
  id
8431
8432
  }) => {
8433
+ const fieldName = name || id || `select-${Math.random().toString(36).substring(2, 9)}`;
8432
8434
  const form = (0, import_react_hook_form3.useForm)({
8433
8435
  defaultValues: {
8434
- [name]: defaultValue
8436
+ [fieldName]: defaultValue
8435
8437
  }
8436
8438
  });
8437
8439
  return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(Form, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
8438
8440
  FormField,
8439
8441
  {
8440
8442
  control: form.control,
8441
- name,
8443
+ name: fieldName,
8442
8444
  rules: {
8443
8445
  required: required ? `${label || name} is required` : void 0
8444
8446
  },
8445
8447
  render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(FormItem, { className: cn("w-full", className), children: [
8446
8448
  label && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FormLabel, { children: label }),
8447
8449
  /* @__PURE__ */ (0, import_jsx_runtime70.jsxs)(Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
8448
- /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectTrigger, { id: id || `form-select-${name}`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectValue, { placeholder }) }) }),
8450
+ /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectTrigger, { id: id || `form-select-${fieldName}`, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectValue, { placeholder }) }) }),
8449
8451
  /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectContent, { children: options.map((option) => /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(SelectItem, { value: option.value, children: option.label }, option.value)) })
8450
8452
  ] }),
8451
8453
  description && /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FormDescription, { children: description }),
@@ -8469,16 +8471,17 @@ var FormTextareaAtom = ({
8469
8471
  className,
8470
8472
  id
8471
8473
  }) => {
8474
+ const fieldName = name || id || `textarea-${Math.random().toString(36).substring(2, 9)}`;
8472
8475
  const form = (0, import_react_hook_form4.useForm)({
8473
8476
  defaultValues: {
8474
- [name]: defaultValue
8477
+ [fieldName]: defaultValue
8475
8478
  }
8476
8479
  });
8477
8480
  return /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(Form, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
8478
8481
  FormField,
8479
8482
  {
8480
8483
  control: form.control,
8481
- name,
8484
+ name: fieldName,
8482
8485
  rules: {
8483
8486
  required: required ? `${label || name} is required` : void 0
8484
8487
  },
@@ -8489,7 +8492,7 @@ var FormTextareaAtom = ({
8489
8492
  {
8490
8493
  placeholder,
8491
8494
  rows,
8492
- id: id || `form-textarea-${name}`,
8495
+ id: id || `form-textarea-${fieldName}`,
8493
8496
  ...field
8494
8497
  }
8495
8498
  ) }),
@@ -11745,9 +11748,21 @@ var PXEngineRenderer = ({
11745
11748
  return component;
11746
11749
  }
11747
11750
  if (!component || typeof component !== "object") return null;
11748
- const { type, name, props = {}, children = [], id } = component;
11749
- const componentName = name || type;
11751
+ const {
11752
+ type,
11753
+ name,
11754
+ component: componentType,
11755
+ props = {},
11756
+ children = [],
11757
+ id,
11758
+ ...remainingProps
11759
+ } = component;
11760
+ const componentName = name || type || componentType;
11750
11761
  if (!componentName || typeof componentName !== "string") return null;
11762
+ const finalProps = { ...remainingProps, ...props };
11763
+ if (id && !finalProps.id) {
11764
+ finalProps.id = id;
11765
+ }
11751
11766
  const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
11752
11767
  const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
11753
11768
  const resolveComponent = (identifier) => {
@@ -11796,7 +11811,7 @@ var PXEngineRenderer = ({
11796
11811
  return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
11797
11812
  TargetComponent,
11798
11813
  {
11799
- ...props,
11814
+ ...finalProps,
11800
11815
  onAction,
11801
11816
  renderComponent: renderRecursive,
11802
11817
  children
@@ -11804,10 +11819,10 @@ var PXEngineRenderer = ({
11804
11819
  uniqueKey
11805
11820
  );
11806
11821
  } else {
11807
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TargetComponent, { ...props, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
11822
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(TargetComponent, { ...finalProps, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
11808
11823
  }
11809
11824
  };
11810
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "px-engine-root", children: renderRecursive(root) });
11825
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("div", { className: "px-engine-root relative w-full h-full min-h-[300px]", children: renderRecursive(root) });
11811
11826
  };
11812
11827
  // Annotate the CommonJS export names for ESM import in node:
11813
11828
  0 && (module.exports = {
package/dist/index.js CHANGED
@@ -8138,16 +8138,17 @@ var FormInputAtom = ({
8138
8138
  className,
8139
8139
  id
8140
8140
  }) => {
8141
+ const fieldName = name || id || `input-${Math.random().toString(36).substring(2, 9)}`;
8141
8142
  const form = useForm({
8142
8143
  defaultValues: {
8143
- [name]: defaultValue
8144
+ [fieldName]: defaultValue
8144
8145
  }
8145
8146
  });
8146
8147
  return /* @__PURE__ */ jsx69(Form, { ...form, children: /* @__PURE__ */ jsx69(
8147
8148
  FormField,
8148
8149
  {
8149
8150
  control: form.control,
8150
- name,
8151
+ name: fieldName,
8151
8152
  rules: {
8152
8153
  required: required ? `${label || name} is required` : void 0
8153
8154
  },
@@ -8183,23 +8184,24 @@ var FormSelectAtom = ({
8183
8184
  className,
8184
8185
  id
8185
8186
  }) => {
8187
+ const fieldName = name || id || `select-${Math.random().toString(36).substring(2, 9)}`;
8186
8188
  const form = useForm2({
8187
8189
  defaultValues: {
8188
- [name]: defaultValue
8190
+ [fieldName]: defaultValue
8189
8191
  }
8190
8192
  });
8191
8193
  return /* @__PURE__ */ jsx70(Form, { ...form, children: /* @__PURE__ */ jsx70(
8192
8194
  FormField,
8193
8195
  {
8194
8196
  control: form.control,
8195
- name,
8197
+ name: fieldName,
8196
8198
  rules: {
8197
8199
  required: required ? `${label || name} is required` : void 0
8198
8200
  },
8199
8201
  render: ({ field }) => /* @__PURE__ */ jsxs38(FormItem, { className: cn("w-full", className), children: [
8200
8202
  label && /* @__PURE__ */ jsx70(FormLabel, { children: label }),
8201
8203
  /* @__PURE__ */ jsxs38(Select, { onValueChange: field.onChange, defaultValue: field.value, children: [
8202
- /* @__PURE__ */ jsx70(FormControl, { children: /* @__PURE__ */ jsx70(SelectTrigger, { id: id || `form-select-${name}`, children: /* @__PURE__ */ jsx70(SelectValue, { placeholder }) }) }),
8204
+ /* @__PURE__ */ jsx70(FormControl, { children: /* @__PURE__ */ jsx70(SelectTrigger, { id: id || `form-select-${fieldName}`, children: /* @__PURE__ */ jsx70(SelectValue, { placeholder }) }) }),
8203
8205
  /* @__PURE__ */ jsx70(SelectContent, { children: options.map((option) => /* @__PURE__ */ jsx70(SelectItem, { value: option.value, children: option.label }, option.value)) })
8204
8206
  ] }),
8205
8207
  description && /* @__PURE__ */ jsx70(FormDescription, { children: description }),
@@ -8223,16 +8225,17 @@ var FormTextareaAtom = ({
8223
8225
  className,
8224
8226
  id
8225
8227
  }) => {
8228
+ const fieldName = name || id || `textarea-${Math.random().toString(36).substring(2, 9)}`;
8226
8229
  const form = useForm3({
8227
8230
  defaultValues: {
8228
- [name]: defaultValue
8231
+ [fieldName]: defaultValue
8229
8232
  }
8230
8233
  });
8231
8234
  return /* @__PURE__ */ jsx71(Form, { ...form, children: /* @__PURE__ */ jsx71(
8232
8235
  FormField,
8233
8236
  {
8234
8237
  control: form.control,
8235
- name,
8238
+ name: fieldName,
8236
8239
  rules: {
8237
8240
  required: required ? `${label || name} is required` : void 0
8238
8241
  },
@@ -8243,7 +8246,7 @@ var FormTextareaAtom = ({
8243
8246
  {
8244
8247
  placeholder,
8245
8248
  rows,
8246
- id: id || `form-textarea-${name}`,
8249
+ id: id || `form-textarea-${fieldName}`,
8247
8250
  ...field
8248
8251
  }
8249
8252
  ) }),
@@ -11499,9 +11502,21 @@ var PXEngineRenderer = ({
11499
11502
  return component;
11500
11503
  }
11501
11504
  if (!component || typeof component !== "object") return null;
11502
- const { type, name, props = {}, children = [], id } = component;
11503
- const componentName = name || type;
11505
+ const {
11506
+ type,
11507
+ name,
11508
+ component: componentType,
11509
+ props = {},
11510
+ children = [],
11511
+ id,
11512
+ ...remainingProps
11513
+ } = component;
11514
+ const componentName = name || type || componentType;
11504
11515
  if (!componentName || typeof componentName !== "string") return null;
11516
+ const finalProps = { ...remainingProps, ...props };
11517
+ if (id && !finalProps.id) {
11518
+ finalProps.id = id;
11519
+ }
11505
11520
  const uniqueKey = id || `${componentName}-${index || Math.random().toString(36).substr(2, 9)}`;
11506
11521
  const normalizedName = componentName.charAt(0).toUpperCase() + componentName.slice(1);
11507
11522
  const resolveComponent = (identifier) => {
@@ -11550,7 +11565,7 @@ var PXEngineRenderer = ({
11550
11565
  return /* @__PURE__ */ jsx90(
11551
11566
  TargetComponent,
11552
11567
  {
11553
- ...props,
11568
+ ...finalProps,
11554
11569
  onAction,
11555
11570
  renderComponent: renderRecursive,
11556
11571
  children
@@ -11558,10 +11573,10 @@ var PXEngineRenderer = ({
11558
11573
  uniqueKey
11559
11574
  );
11560
11575
  } else {
11561
- return /* @__PURE__ */ jsx90(TargetComponent, { ...props, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
11576
+ return /* @__PURE__ */ jsx90(TargetComponent, { ...finalProps, children: Array.isArray(children) ? children.map((child, idx) => renderRecursive(child, idx)) : children }, uniqueKey);
11562
11577
  }
11563
11578
  };
11564
- return /* @__PURE__ */ jsx90("div", { className: "px-engine-root", children: renderRecursive(root) });
11579
+ return /* @__PURE__ */ jsx90("div", { className: "px-engine-root relative w-full h-full min-h-[300px]", children: renderRecursive(root) });
11565
11580
  };
11566
11581
  export {
11567
11582
  Accordion,
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pxengine/ui",
3
3
  "version": "1.0.0",
4
- "lastUpdated": "2026-01-30T05:20:50.325Z",
4
+ "lastUpdated": "2026-01-30T13:41:14.195Z",
5
5
  "components": {
6
6
  "AccordionAtom": {
7
7
  "name": "AccordionAtom",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pxengine",
3
- "version": "0.1.7",
3
+ "version": "0.1.9",
4
4
  "type": "module",
5
5
  "description": "Shadcn-based UI component library for agent-driven interfaces",
6
6
  "main": "./dist/index.cjs",
@@ -61,10 +61,14 @@ export const FormInputAtom: React.FC<FormInputAtomProps> = ({
61
61
  className,
62
62
  id,
63
63
  }) => {
64
+ // Safe fallback for name to prevent RHF crash
65
+ const fieldName =
66
+ name || id || `input-${Math.random().toString(36).substring(2, 9)}`;
67
+
64
68
  // Create a local form context for this field
65
69
  const form = useForm({
66
70
  defaultValues: {
67
- [name]: defaultValue,
71
+ [fieldName]: defaultValue,
68
72
  },
69
73
  });
70
74
 
@@ -72,7 +76,7 @@ export const FormInputAtom: React.FC<FormInputAtomProps> = ({
72
76
  <Form {...form}>
73
77
  <FormField
74
78
  control={form.control}
75
- name={name}
79
+ name={fieldName}
76
80
  rules={{
77
81
  required: required ? `${label || name} is required` : undefined,
78
82
  }}
@@ -64,10 +64,14 @@ export const FormSelectAtom: React.FC<FormSelectAtomProps> = ({
64
64
  className,
65
65
  id,
66
66
  }) => {
67
+ // Safe fallback for name to prevent RHF crash
68
+ const fieldName =
69
+ name || id || `select-${Math.random().toString(36).substring(2, 9)}`;
70
+
67
71
  // Create a local form context for this field
68
72
  const form = useForm({
69
73
  defaultValues: {
70
- [name]: defaultValue,
74
+ [fieldName]: defaultValue,
71
75
  },
72
76
  });
73
77
 
@@ -75,7 +79,7 @@ export const FormSelectAtom: React.FC<FormSelectAtomProps> = ({
75
79
  <Form {...form}>
76
80
  <FormField
77
81
  control={form.control}
78
- name={name}
82
+ name={fieldName}
79
83
  rules={{
80
84
  required: required ? `${label || name} is required` : undefined,
81
85
  }}
@@ -84,7 +88,7 @@ export const FormSelectAtom: React.FC<FormSelectAtomProps> = ({
84
88
  {label && <FormLabel>{label}</FormLabel>}
85
89
  <Select onValueChange={field.onChange} defaultValue={field.value}>
86
90
  <FormControl>
87
- <SelectTrigger id={id || `form-select-${name}`}>
91
+ <SelectTrigger id={id || `form-select-${fieldName}`}>
88
92
  <SelectValue placeholder={placeholder} />
89
93
  </SelectTrigger>
90
94
  </FormControl>
@@ -53,10 +53,14 @@ export const FormTextareaAtom: React.FC<FormTextareaAtomProps> = ({
53
53
  className,
54
54
  id,
55
55
  }) => {
56
+ // Safe fallback for name to prevent RHF crash
57
+ const fieldName =
58
+ name || id || `textarea-${Math.random().toString(36).substring(2, 9)}`;
59
+
56
60
  // Create a local form context for this field
57
61
  const form = useForm({
58
62
  defaultValues: {
59
- [name]: defaultValue,
63
+ [fieldName]: defaultValue,
60
64
  },
61
65
  });
62
66
 
@@ -64,7 +68,7 @@ export const FormTextareaAtom: React.FC<FormTextareaAtomProps> = ({
64
68
  <Form {...form}>
65
69
  <FormField
66
70
  control={form.control}
67
- name={name}
71
+ name={fieldName}
68
72
  rules={{
69
73
  required: required ? `${label || name} is required` : undefined,
70
74
  }}
@@ -75,7 +79,7 @@ export const FormTextareaAtom: React.FC<FormTextareaAtomProps> = ({
75
79
  <Textarea
76
80
  placeholder={placeholder}
77
81
  rows={rows}
78
- id={id || `form-textarea-${name}`}
82
+ id={id || `form-textarea-${fieldName}`}
79
83
  {...field}
80
84
  />
81
85
  </FormControl>
@@ -201,12 +201,30 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
201
201
 
202
202
  if (!component || typeof component !== "object") return null;
203
203
 
204
- const { type, name, props = {}, children = [], id } = component;
204
+ // Support 'component' alias for name/type
205
+ const {
206
+ type,
207
+ name,
208
+ component: componentType,
209
+ props = {},
210
+ children = [],
211
+ id,
212
+ ...remainingProps
213
+ } = component;
205
214
 
206
215
  // Determine the component logic name to search for
207
- const componentName = name || type;
216
+ const componentName = name || type || componentType;
208
217
  if (!componentName || typeof componentName !== "string") return null;
209
218
 
219
+ // Merge explicit props with flattened props (remainingProps)
220
+ // Priority: explicit props > flattened props
221
+ const finalProps = { ...remainingProps, ...props };
222
+
223
+ // Also pass ID if not already in props
224
+ if (id && !finalProps.id) {
225
+ finalProps.id = id;
226
+ }
227
+
210
228
  // Generate a unique key from id, index, or random
211
229
  const uniqueKey =
212
230
  id ||
@@ -300,7 +318,7 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
300
318
  return (
301
319
  <TargetComponent
302
320
  key={uniqueKey}
303
- {...props}
321
+ {...finalProps}
304
322
  onAction={onAction}
305
323
  renderComponent={renderRecursive}
306
324
  children={children}
@@ -309,7 +327,7 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
309
327
  } else {
310
328
  // Standard shadcn components - pass children as React children
311
329
  return (
312
- <TargetComponent key={uniqueKey} {...props}>
330
+ <TargetComponent key={uniqueKey} {...finalProps}>
313
331
  {Array.isArray(children)
314
332
  ? children.map((child, idx) => renderRecursive(child, idx))
315
333
  : children}
@@ -318,5 +336,9 @@ export const PXEngineRenderer: React.FC<PXEngineRendererProps> = ({
318
336
  }
319
337
  };
320
338
 
321
- return <div className="px-engine-root">{renderRecursive(root)}</div>;
339
+ return (
340
+ <div className="px-engine-root relative w-full h-full min-h-[300px]">
341
+ {renderRecursive(root)}
342
+ </div>
343
+ );
322
344
  };