@symbo.ls/icon 2.11.447 → 2.11.451
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/index.js +18 -15
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
import { isString, replaceLiteralsWithObjectFields } from '@domql/utils'
|
|
3
|
+
import { isString, exec, replaceLiteralsWithObjectFields } from '@domql/utils'
|
|
4
4
|
|
|
5
|
-
const getIconName = (
|
|
6
|
-
|
|
5
|
+
const getIconName = (el, s) => {
|
|
6
|
+
const { key, props, deps } = el
|
|
7
|
+
let iconName = exec(props.name || props.icon || key, el)
|
|
7
8
|
|
|
8
9
|
if (isString(iconName) && iconName.includes('{{')) {
|
|
9
|
-
iconName = deps.replaceLiteralsWithObjectFields(iconName,
|
|
10
|
+
iconName = deps.replaceLiteralsWithObjectFields(iconName, s)
|
|
10
11
|
}
|
|
11
12
|
|
|
12
13
|
return deps.isString(iconName) ? iconName : key
|
|
@@ -15,11 +16,12 @@ const getIconName = ({ key, props, context, deps, state }) => {
|
|
|
15
16
|
export const Icon = {
|
|
16
17
|
extend: 'Svg',
|
|
17
18
|
deps: { isString, replaceLiteralsWithObjectFields },
|
|
18
|
-
props: (
|
|
19
|
+
props: (el, s) => {
|
|
20
|
+
const { props, parent, context, deps, state } = el
|
|
19
21
|
const { ICONS, SEMANTIC_ICONS, useIconSprite, verbose } = context && context.designSystem
|
|
20
22
|
const { toCamelCase } = context && context.utils
|
|
21
23
|
|
|
22
|
-
let iconName = getIconName(
|
|
24
|
+
let iconName = getIconName(el, s)
|
|
23
25
|
const camelCase = toCamelCase(iconName)
|
|
24
26
|
const isArray = camelCase.split(/([a-z])([A-Z])/g)
|
|
25
27
|
|
|
@@ -49,17 +51,19 @@ export const Icon = {
|
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
let activeIconName
|
|
52
|
-
if (props.
|
|
53
|
-
activeIconName = props['.
|
|
54
|
+
if (props.isActive) {
|
|
55
|
+
activeIconName = props['.isActive'].name || props['.isActive'].icon
|
|
54
56
|
}
|
|
55
57
|
if (
|
|
56
58
|
parent &&
|
|
57
59
|
parent.props &&
|
|
58
|
-
parent.props.
|
|
59
|
-
parent.props['.
|
|
60
|
-
parent.props['.
|
|
60
|
+
parent.props.isActive &&
|
|
61
|
+
parent.props['.isActive'] &&
|
|
62
|
+
parent.props['.isActive'].icon
|
|
61
63
|
) {
|
|
62
|
-
activeIconName =
|
|
64
|
+
activeIconName = exec(
|
|
65
|
+
parent.props['.isActive'].icon.name || parent.props['.isActive'].icon.icon || parent.props['.isActive'].icon
|
|
66
|
+
, el)
|
|
63
67
|
}
|
|
64
68
|
|
|
65
69
|
if (isString(activeIconName) && activeIconName.includes('{{')) {
|
|
@@ -99,10 +103,9 @@ export const IconText = {
|
|
|
99
103
|
},
|
|
100
104
|
|
|
101
105
|
Icon: {
|
|
102
|
-
props: ({ parent
|
|
106
|
+
props: ({ parent }) => ({ icon: parent.props.icon }),
|
|
103
107
|
if: ({ parent, props }) => {
|
|
104
|
-
|
|
105
|
-
return doesExist
|
|
108
|
+
return parent.props.icon || parent.props.Icon || props.name || props.icon || props.sfSymbols || parent.props.sfSymbols
|
|
106
109
|
}
|
|
107
110
|
},
|
|
108
111
|
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/icon",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.451",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
|
-
"gitHead": "
|
|
6
|
+
"gitHead": "f3a8fdc4c82ba34580bd324cd1c922f2041506e3",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@symbo.ls/atoms": "^2.11.
|
|
8
|
+
"@symbo.ls/atoms": "^2.11.450",
|
|
9
9
|
"@symbo.ls/utils": "^2.11.446"
|
|
10
10
|
},
|
|
11
11
|
"source": "src/index.js"
|