@hyvor/design 1.1.1 → 1.1.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.
@@ -46,7 +46,7 @@
46
46
  <style>
47
47
  .wrap,
48
48
  .wrap :global(.dropdown),
49
- :global(.dropdown > .trigger) {
49
+ .wrap :global(.dropdown > .trigger) {
50
50
  display: inline-flex;
51
51
  align-items: center;
52
52
  }
@@ -26,10 +26,18 @@
26
26
 
27
27
  let hasComponentParams = false;
28
28
 
29
- function getElementFunc(el: string) {
29
+ function getElementFunc(el: string, props: Record<string, any> = {}) {
30
30
  return (chunks: string | string[]) => {
31
31
  const children = typeof chunks === 'string' ? chunks : chunks.join('');
32
- return `<${el}>${children}</${el}>`;
32
+ let propsStr = '';
33
+ for (let [propKey, propValue] of Object.entries(props)) {
34
+ if (typeof propValue === 'string' || typeof propValue === 'number') {
35
+ propsStr += ` ${propKey}="${propValue}"`;
36
+ } else if (typeof propValue === 'boolean' && propValue) {
37
+ propsStr += ` ${propKey}`;
38
+ }
39
+ }
40
+ return `<${el}${propsStr}>${children}</${el}>`;
33
41
  };
34
42
  }
35
43
 
@@ -52,7 +60,10 @@
52
60
  };
53
61
  hasComponentParams = true;
54
62
  } else if (value.hasOwnProperty('element')) {
55
- newValue = getElementFunc((value as any).element as string);
63
+ newValue = getElementFunc(
64
+ (value as any).element as string,
65
+ (value as any).props || {}
66
+ );
56
67
  }
57
68
  } else {
58
69
  newValue = value as PrimitiveType;
@@ -98,7 +109,7 @@
98
109
  return '<span id="' + id + '">' + children + '</span>';
99
110
  };
100
111
  } else if (value.hasOwnProperty('element')) {
101
- newValue = getElementFunc((value as any).element as string);
112
+ newValue = getElementFunc((value as any).element as string, (value as any).props || {});
102
113
  }
103
114
  } else {
104
115
  newValue = value as PrimitiveType;
package/dist/index.css CHANGED
@@ -49,3 +49,8 @@ a {
49
49
  padding: 0 15px;
50
50
  margin: auto;
51
51
  }
52
+
53
+ .hds-link {
54
+ color: var(--link);
55
+ text-decoration: underline;
56
+ }
package/package.json CHANGED
@@ -59,5 +59,5 @@
59
59
  "publishConfig": {
60
60
  "access": "public"
61
61
  },
62
- "version": "1.1.1"
62
+ "version": "1.1.3"
63
63
  }