@adobe-commerce/elsie 1.5.1 → 1.6.0-alpha2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe-commerce/elsie",
3
- "version": "1.5.1",
3
+ "version": "1.6.0-alpha2",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "description": "Domain Package SDK",
6
6
  "engines": {
@@ -8,7 +8,7 @@
8
8
  *******************************************************************/
9
9
 
10
10
  import '@adobe-commerce/elsie/components/Field/Field.css';
11
- import { classes } from '@adobe-commerce/elsie/lib';
11
+ import { classes, VComponent } from '@adobe-commerce/elsie/lib';
12
12
  import { FunctionComponent, VNode } from 'preact';
13
13
  import { HTMLAttributes } from 'preact/compat';
14
14
 
@@ -36,8 +36,23 @@ export const Field: FunctionComponent<FieldProps> = ({
36
36
  }) => {
37
37
  const id =
38
38
  children?.props?.id ?? `dropin-field-${Math.random().toString(36)}`;
39
- const ChildComponent =
40
- children && typeof children.type !== 'string' ? children.type : null;
39
+
40
+ let fieldContent: VNode | string | null = null;
41
+
42
+ if (children && typeof children !== 'string') {
43
+ fieldContent = (
44
+ <VComponent
45
+ node={children}
46
+ id={id}
47
+ key={children.key}
48
+ disabled={disabled}
49
+ size={size}
50
+ error={!!error}
51
+ success={!!success && !error}
52
+ />
53
+ );
54
+ }
55
+
41
56
 
42
57
  return (
43
58
  <div {...props} className={classes(['dropin-field', className])}>
@@ -55,17 +70,7 @@ export const Field: FunctionComponent<FieldProps> = ({
55
70
  )}
56
71
 
57
72
  <div className={classes(['dropin-field__content'])}>
58
- {ChildComponent && children && (
59
- <ChildComponent
60
- {...children.props}
61
- id={id}
62
- key={children.key}
63
- disabled={disabled}
64
- size={size}
65
- error={!!error}
66
- success={!!success && !error}
67
- />
68
- )}
73
+ {fieldContent}
69
74
  </div>
70
75
 
71
76
  <div