@symbo.ls/icon 2.11.360 → 2.11.371

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.
Files changed (2) hide show
  1. package/index.js +13 -4
  2. package/package.json +2 -2
package/index.js CHANGED
@@ -1,14 +1,19 @@
1
1
  'use strict'
2
2
 
3
- import { isString } from '@domql/utils'
3
+ import { isString, replaceLiteralsWithObjectFields } from '@domql/utils'
4
4
 
5
5
  export const Icon = {
6
6
  extend: 'Svg',
7
- deps: { isString },
8
- props: ({ key, props, parent, context, deps }) => {
7
+ deps: { isString, replaceLiteralsWithObjectFields },
8
+ props: ({ key, props, parent, context, deps, state }) => {
9
9
  const { ICONS, useIconSprite, verbose } = context && context.designSystem
10
10
  const { toCamelCase } = context && context.utils
11
- const iconName = props.name || props.icon || key
11
+ let iconName = props.name || props.icon || key
12
+
13
+ if (isString(iconName) && iconName.includes('{{')) {
14
+ iconName = deps.replaceLiteralsWithObjectFields(iconName, state)
15
+ }
16
+
12
17
  const camelCase = toCamelCase(deps.isString(iconName) ? iconName : key)
13
18
 
14
19
  const isArray = camelCase.split(/([a-z])([A-Z])/g)
@@ -27,6 +32,10 @@ export const Icon = {
27
32
  activeIconName = parent.props['.active'].icon.name || parent.props['.active'].icon.icon || parent.props['.active'].icon
28
33
  }
29
34
 
35
+ if (isString(activeIconName) && activeIconName.includes('{{')) {
36
+ activeIconName = deps.replaceLiteralsWithObjectFields(activeIconName, state)
37
+ }
38
+
30
39
  let validIconName
31
40
  if (ICONS[activeIconName]) validIconName = activeIconName
32
41
  if (ICONS[camelCase]) validIconName = camelCase
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@symbo.ls/icon",
3
- "version": "2.11.360",
3
+ "version": "2.11.371",
4
4
  "main": "index.js",
5
5
  "license": "MIT",
6
- "gitHead": "87c62e587157ba9c3ef135e31dbc79f165cdaa38",
6
+ "gitHead": "83f0e49f68c093250229b71bed49e626c6008355",
7
7
  "dependencies": {
8
8
  "@symbo.ls/atoms": "latest"
9
9
  },