@semcore/icon 3.1.0 → 3.1.2
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/CHANGELOG.md +12 -0
- package/Text/l/index.js +1 -1
- package/Text/l/index.mjs +1 -1
- package/Text/m/index.js +1 -1
- package/Text/m/index.mjs +1 -1
- package/lib/cjs/Icon.js +24 -12
- package/lib/cjs/Icon.js.map +1 -1
- package/lib/es6/Icon.js +21 -12
- package/lib/es6/Icon.js.map +1 -1
- package/package.json +2 -2
- package/svg-new/icon/Text/l.svg +1 -1
- package/svg-new/icon/Text/m.svg +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
CHANGELOG.md standards are inspired by [keepachangelog.com](https://keepachangelog.com/en/1.0.0/).
|
|
4
4
|
|
|
5
|
+
## [3.1.2] - 2022-10-26
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- Lazy checks for necessity of `aria-label` in non production environment.
|
|
10
|
+
|
|
11
|
+
## [3.1.1] - 2022-10-24
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
|
|
15
|
+
- Updated `Text` icon.
|
|
16
|
+
|
|
5
17
|
## [3.1.0] - 2022-10-20
|
|
6
18
|
|
|
7
19
|
### Added
|
package/Text/l/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function Text(_ref, ref) {
|
|
|
35
35
|
height: height,
|
|
36
36
|
viewBox: viewBox
|
|
37
37
|
}, props), /*#__PURE__*/_react["default"].createElement("path", {
|
|
38
|
-
d: "M4
|
|
38
|
+
d: "M4 5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V6h-5v12h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2V6H6v1a1 1 0 0 1-2 0V5Z",
|
|
39
39
|
shapeRendering: "geometricPrecision"
|
|
40
40
|
}));
|
|
41
41
|
}
|
package/Text/l/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function Text({
|
|
|
18
18
|
height: height,
|
|
19
19
|
viewBox: viewBox
|
|
20
20
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
21
|
-
d: "M4
|
|
21
|
+
d: "M4 5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V6h-5v12h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2V6H6v1a1 1 0 0 1-2 0V5Z",
|
|
22
22
|
shapeRendering: "geometricPrecision"
|
|
23
23
|
}));
|
|
24
24
|
}
|
package/Text/m/index.js
CHANGED
|
@@ -35,7 +35,7 @@ function Text(_ref, ref) {
|
|
|
35
35
|
height: height,
|
|
36
36
|
viewBox: viewBox
|
|
37
37
|
}, props), /*#__PURE__*/_react["default"].createElement("path", {
|
|
38
|
-
d: "
|
|
38
|
+
d: "M3 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0H9v6h1a1 1 0 1 1 0 2H6a1 1 0 1 1 0-2h1V5H5a1 1 0 0 1-2 0V4Z",
|
|
39
39
|
shapeRendering: "geometricPrecision"
|
|
40
40
|
}));
|
|
41
41
|
}
|
package/Text/m/index.mjs
CHANGED
|
@@ -18,7 +18,7 @@ function Text({
|
|
|
18
18
|
height: height,
|
|
19
19
|
viewBox: viewBox
|
|
20
20
|
}, props), /*#__PURE__*/React.createElement("path", {
|
|
21
|
-
d: "
|
|
21
|
+
d: "M3 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0H9v6h1a1 1 0 1 1 0 2H6a1 1 0 1 1 0-2h1V5H5a1 1 0 0 1-2 0V4Z",
|
|
22
22
|
shapeRendering: "geometricPrecision"
|
|
23
23
|
}));
|
|
24
24
|
}
|
package/lib/cjs/Icon.js
CHANGED
|
@@ -33,6 +33,10 @@ var _propsForElement = _interopRequireDefault(require("@semcore/utils/lib/propsF
|
|
|
33
33
|
|
|
34
34
|
var _logger = _interopRequireDefault(require("@semcore/utils/lib/logger"));
|
|
35
35
|
|
|
36
|
+
var _ref = require("@semcore/utils/lib/ref");
|
|
37
|
+
|
|
38
|
+
var _hasLabels = _interopRequireDefault(require("@semcore/utils/lib/hasLabels"));
|
|
39
|
+
|
|
36
40
|
var _excluded = ["keyboardFocused"];
|
|
37
41
|
|
|
38
42
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -48,16 +52,16 @@ var styles = (
|
|
|
48
52
|
/*__reshadow_css_start__*/
|
|
49
53
|
_core.sstyled.insert(
|
|
50
54
|
/*__inner_css_start__*/
|
|
51
|
-
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.
|
|
55
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SIcon_xbeyq_gg_ {\n display: inline-block;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n shape-rendering: geometricPrecision;\n box-sizing: content-box;\n fill: currentColor;\n flex-shrink: 0;\n outline: none;\n color: var(--color_xbeyq);\n}\n\n.___SIcon_xbeyq_gg_.__keyboardFocused_xbeyq_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___SIcon_xbeyq_gg_.__interactive_xbeyq_gg_ {\n cursor: pointer\n}\n\n.___SIcon_xbeyq_gg_.__interactive_xbeyq_gg_:hover {\n color: var(--color-interactive_xbeyq);\n }\n"
|
|
52
56
|
/*__inner_css_end__*/
|
|
53
|
-
, "
|
|
57
|
+
, "xbeyq_gg_")
|
|
54
58
|
/*__reshadow_css_end__*/
|
|
55
59
|
, {
|
|
56
|
-
"__SIcon": "
|
|
57
|
-
"--color": "--
|
|
58
|
-
"_keyboardFocused": "
|
|
59
|
-
"_interactive": "
|
|
60
|
-
"--color-interactive": "--color-
|
|
60
|
+
"__SIcon": "___SIcon_xbeyq_gg_",
|
|
61
|
+
"--color": "--color_xbeyq",
|
|
62
|
+
"_keyboardFocused": "__keyboardFocused_xbeyq_gg_",
|
|
63
|
+
"_interactive": "__interactive_xbeyq_gg_",
|
|
64
|
+
"--color-interactive": "--color-interactive_xbeyq"
|
|
61
65
|
});
|
|
62
66
|
|
|
63
67
|
function Icon(props, ref) {
|
|
@@ -75,9 +79,7 @@ function Icon(props, ref) {
|
|
|
75
79
|
other = _useBox2[1];
|
|
76
80
|
|
|
77
81
|
var interactive = props.interactive,
|
|
78
|
-
colorProps = props.color
|
|
79
|
-
ariaLabel = props['aria-label'],
|
|
80
|
-
ariaLabelledby = props['aria-labelledby'];
|
|
82
|
+
colorProps = props.color;
|
|
81
83
|
var color = (0, _color["default"])(colorProps);
|
|
82
84
|
|
|
83
85
|
var _keyboardFocusEnhance = (0, _keyboardFocusEnhance2["default"])()(_objectSpread({
|
|
@@ -107,14 +109,24 @@ function Icon(props, ref) {
|
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
|
|
110
|
-
|
|
112
|
+
var labelCheckRef = _react["default"].useRef();
|
|
113
|
+
|
|
114
|
+
_react["default"].useEffect(function () {
|
|
115
|
+
if (!interactive) return;
|
|
116
|
+
|
|
117
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
118
|
+
_logger["default"].warn(!(0, _hasLabels["default"])(labelCheckRef.current), "'aria-label' or 'aria-labelledby' are required props for interactive icons", props['data-ui-name'] || Icon.displayName);
|
|
119
|
+
}
|
|
120
|
+
}, [interactive]);
|
|
111
121
|
|
|
122
|
+
var forkedRef = (0, _ref.useForkRef)(ref, labelCheckRef);
|
|
112
123
|
return /*#__PURE__*/_react["default"].createElement(SIcon, (0, _extends2["default"])({}, (0, _propsForElement["default"])(propsWithKeyboardEnhance), {
|
|
113
124
|
style: Object.assign({}, style, propsWithKeyboardEnhance.style, props.style),
|
|
114
125
|
className: (0, _classnames["default"])(className, propsWithKeyboardEnhance.className, props.className) || undefined,
|
|
115
126
|
onKeyDown: onKeyDown,
|
|
116
127
|
role: interactive ? 'button' : undefined,
|
|
117
|
-
"aria-hidden": interactive ? undefined : 'true'
|
|
128
|
+
"aria-hidden": interactive ? undefined : 'true',
|
|
129
|
+
ref: forkedRef
|
|
118
130
|
}));
|
|
119
131
|
}
|
|
120
132
|
|
package/lib/cjs/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","names":["Icon","props","ref","useBox","tag","width","height","viewBox","focusable","interactive","SIcon","other","colorProps","color","
|
|
1
|
+
{"version":3,"file":"Icon.js","names":["Icon","props","ref","useBox","tag","width","height","viewBox","focusable","interactive","SIcon","other","colorProps","color","resolveColor","keyboardFocusEnhance","disabled","keyboardFocused","propsWithKeyboardEnhance","sstyles","sstyled","styles","cn","shade","className","style","onKeyDown","event","code","onClick","labelCheckRef","React","useRef","useEffect","process","env","NODE_ENV","logger","warn","hasLabels","current","displayName","forkedRef","useForkRef","propsForElement","Object","assign","undefined","createBaseComponent"],"sources":["../../src/Icon.jsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { createBaseComponent, sstyled } from '@semcore/core';\nimport { useBox } from '@semcore/flex-box';\nimport resolveColor, { shade } from '@semcore/utils/lib/color';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport propsForElement from '@semcore/utils/lib/propsForElement';\nimport logger from '@semcore/utils/lib/logger';\nimport { useForkRef } from '@semcore/utils/lib/ref';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\n\nimport styles from './style/icon.shadow.css';\n\nfunction Icon(props, ref) {\n const [SIcon, other] = useBox(\n {\n tag: 'svg',\n 'data-ui-name': 'Icon',\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n 'aria-hidden': true,\n focusable: props.interactive,\n ...props,\n },\n ref,\n );\n\n const { interactive, color: colorProps } = props;\n const color = resolveColor(colorProps);\n const { keyboardFocused, ...propsWithKeyboardEnhance } = keyboardFocusEnhance()({\n disabled: !interactive,\n ...other,\n });\n const sstyles = sstyled(styles);\n const { className, style } = sstyles.cn('SIcon', {\n 'color-interactive': shade(color, -0.12),\n 'use:color': color,\n interactive: interactive,\n keyboardFocused: keyboardFocused,\n });\n\n function onKeyDown(event) {\n if (props.onKeyDown) {\n return props.onKeyDown(event);\n }\n\n if (interactive && event.code === 'Enter') {\n props.onClick && props.onClick(event);\n }\n }\n\n const labelCheckRef = React.useRef();\n React.useEffect(() => {\n if (!interactive) return;\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n !hasLabels(labelCheckRef.current),\n `'aria-label' or 'aria-labelledby' are required props for interactive icons`,\n props['data-ui-name'] || Icon.displayName,\n );\n }\n }, [interactive]);\n const forkedRef = useForkRef(ref, labelCheckRef);\n\n return (\n <SIcon\n {...propsForElement(propsWithKeyboardEnhance)}\n style={Object.assign({}, style, propsWithKeyboardEnhance.style, props.style)}\n className={cn(className, propsWithKeyboardEnhance.className, props.className) || undefined}\n onKeyDown={onKeyDown}\n role={interactive ? 'button' : undefined}\n aria-hidden={interactive ? undefined : 'true'}\n ref={forkedRef}\n />\n );\n}\n\nIcon.displayName = 'Icon';\n\nexport default createBaseComponent(Icon);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAEA;;AAFA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,SAASA,IAAT,CAAcC,KAAd,EAAqBC,GAArB,EAA0B;EACxB,cAAuB,IAAAC,eAAA;IAEnBC,GAAG,EAAE,KAFc;IAGnB,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;;EACAD,iBAAA,CAAME,SAAN,CAAgB,YAAM;IACpB,IAAI,CAACxB,WAAL,EAAkB;;IAClB,IAAIyB,OAAO,CAACC,GAAR,CAAYC,QAAZ,KAAyB,YAA7B,EAA2C;MACzCC,kBAAA,CAAOC,IAAP,CACE,CAAC,IAAAC,qBAAA,EAAUT,aAAa,CAACU,OAAxB,CADH,gFAGEvC,KAAK,CAAC,cAAD,CAAL,IAAyBD,IAAI,CAACyC,WAHhC;IAKD;EACF,CATD,EASG,CAAChC,WAAD,CATH;;EAUA,IAAMiC,SAAS,GAAG,IAAAC,eAAA,EAAWzC,GAAX,EAAgB4B,aAAhB,CAAlB;EAEA,oBACE,gCAAC,KAAD,gCACM,IAAAc,2BAAA,EAAgB1B,wBAAhB,CADN;IAEE,KAAK,EAAE2B,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBrB,KAAlB,EAAyBP,wBAAwB,CAACO,KAAlD,EAAyDxB,KAAK,CAACwB,KAA/D,CAFT;IAGE,SAAS,EAAE,IAAAH,sBAAA,EAAGE,SAAH,EAAcN,wBAAwB,CAACM,SAAvC,EAAkDvB,KAAK,CAACuB,SAAxD,KAAsEuB,SAHnF;IAIE,SAAS,EAAErB,SAJb;IAKE,IAAI,EAAEjB,WAAW,GAAG,QAAH,GAAcsC,SALjC;IAME,eAAatC,WAAW,GAAGsC,SAAH,GAAe,MANzC;IAOE,GAAG,EAAEL;EAPP,GADF;AAWD;;AAED1C,IAAI,CAACyC,WAAL,GAAmB,MAAnB;;eAEe,IAAAO,yBAAA,EAAoBhD,IAApB,C"}
|
package/lib/es6/Icon.js
CHANGED
|
@@ -17,22 +17,24 @@ import resolveColor, { shade } from '@semcore/utils/lib/color';
|
|
|
17
17
|
import keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';
|
|
18
18
|
import propsForElement from '@semcore/utils/lib/propsForElement';
|
|
19
19
|
import logger from '@semcore/utils/lib/logger';
|
|
20
|
+
import { useForkRef } from '@semcore/utils/lib/ref';
|
|
21
|
+
import hasLabels from '@semcore/utils/lib/hasLabels';
|
|
20
22
|
|
|
21
23
|
/*__reshadow-styles__:"./style/icon.shadow.css"*/
|
|
22
24
|
var styles = (
|
|
23
25
|
/*__reshadow_css_start__*/
|
|
24
26
|
_sstyled.insert(
|
|
25
27
|
/*__inner_css_start__*/
|
|
26
|
-
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.
|
|
28
|
+
":root {\n\n /* DEPRECATED START\n Deprecated variables should never be used in\n components styles but preserved for backward\n compatibility if they used in projects\n like `<Badge bg=\"red\">alpha</Badge>`\n */\n /* DEPRECATED END */\n}\n\n.___SIcon_xbeyq_gg_ {\n display: inline-block;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n shape-rendering: geometricPrecision;\n box-sizing: content-box;\n fill: currentColor;\n flex-shrink: 0;\n outline: none;\n color: var(--color_xbeyq);\n}\n\n.___SIcon_xbeyq_gg_.__keyboardFocused_xbeyq_gg_ {\n box-shadow: 0 0 0 3px rgba(0, 143, 248, 0.2);\n}\n\n.___SIcon_xbeyq_gg_.__interactive_xbeyq_gg_ {\n cursor: pointer\n}\n\n.___SIcon_xbeyq_gg_.__interactive_xbeyq_gg_:hover {\n color: var(--color-interactive_xbeyq);\n }\n"
|
|
27
29
|
/*__inner_css_end__*/
|
|
28
|
-
, "
|
|
30
|
+
, "xbeyq_gg_")
|
|
29
31
|
/*__reshadow_css_end__*/
|
|
30
32
|
, {
|
|
31
|
-
"__SIcon": "
|
|
32
|
-
"--color": "--
|
|
33
|
-
"_keyboardFocused": "
|
|
34
|
-
"_interactive": "
|
|
35
|
-
"--color-interactive": "--color-
|
|
33
|
+
"__SIcon": "___SIcon_xbeyq_gg_",
|
|
34
|
+
"--color": "--color_xbeyq",
|
|
35
|
+
"_keyboardFocused": "__keyboardFocused_xbeyq_gg_",
|
|
36
|
+
"_interactive": "__interactive_xbeyq_gg_",
|
|
37
|
+
"--color-interactive": "--color-interactive_xbeyq"
|
|
36
38
|
});
|
|
37
39
|
|
|
38
40
|
function Icon(props, ref) {
|
|
@@ -50,9 +52,7 @@ function Icon(props, ref) {
|
|
|
50
52
|
other = _useBox2[1];
|
|
51
53
|
|
|
52
54
|
var interactive = props.interactive,
|
|
53
|
-
colorProps = props.color
|
|
54
|
-
ariaLabel = props['aria-label'],
|
|
55
|
-
ariaLabelledby = props['aria-labelledby'];
|
|
55
|
+
colorProps = props.color;
|
|
56
56
|
var color = resolveColor(colorProps);
|
|
57
57
|
|
|
58
58
|
var _keyboardFocusEnhance = keyboardFocusEnhance()(_objectSpread({
|
|
@@ -82,13 +82,22 @@ function Icon(props, ref) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
var labelCheckRef = React.useRef();
|
|
86
|
+
React.useEffect(function () {
|
|
87
|
+
if (!interactive) return;
|
|
88
|
+
|
|
89
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
90
|
+
logger.warn(!hasLabels(labelCheckRef.current), "'aria-label' or 'aria-labelledby' are required props for interactive icons", props['data-ui-name'] || Icon.displayName);
|
|
91
|
+
}
|
|
92
|
+
}, [interactive]);
|
|
93
|
+
var forkedRef = useForkRef(ref, labelCheckRef);
|
|
86
94
|
return /*#__PURE__*/React.createElement(SIcon, _extends({}, propsForElement(propsWithKeyboardEnhance), {
|
|
87
95
|
style: Object.assign({}, style, propsWithKeyboardEnhance.style, props.style),
|
|
88
96
|
className: cn(className, propsWithKeyboardEnhance.className, props.className) || undefined,
|
|
89
97
|
onKeyDown: onKeyDown,
|
|
90
98
|
role: interactive ? 'button' : undefined,
|
|
91
|
-
"aria-hidden": interactive ? undefined : 'true'
|
|
99
|
+
"aria-hidden": interactive ? undefined : 'true',
|
|
100
|
+
ref: forkedRef
|
|
92
101
|
}));
|
|
93
102
|
}
|
|
94
103
|
|
package/lib/es6/Icon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","names":["React","cn","createBaseComponent","sstyled","useBox","resolveColor","shade","keyboardFocusEnhance","propsForElement","logger","Icon","props","ref","tag","width","height","viewBox","focusable","interactive","SIcon","other","colorProps","color","
|
|
1
|
+
{"version":3,"file":"Icon.js","names":["React","cn","createBaseComponent","sstyled","useBox","resolveColor","shade","keyboardFocusEnhance","propsForElement","logger","useForkRef","hasLabels","Icon","props","ref","tag","width","height","viewBox","focusable","interactive","SIcon","other","colorProps","color","disabled","keyboardFocused","propsWithKeyboardEnhance","sstyles","styles","className","style","onKeyDown","event","code","onClick","labelCheckRef","useRef","useEffect","process","env","NODE_ENV","warn","current","displayName","forkedRef","Object","assign","undefined"],"sources":["../../src/Icon.jsx"],"sourcesContent":["import React from 'react';\nimport cn from 'classnames';\nimport { createBaseComponent, sstyled } from '@semcore/core';\nimport { useBox } from '@semcore/flex-box';\nimport resolveColor, { shade } from '@semcore/utils/lib/color';\nimport keyboardFocusEnhance from '@semcore/utils/lib/enhances/keyboardFocusEnhance';\nimport propsForElement from '@semcore/utils/lib/propsForElement';\nimport logger from '@semcore/utils/lib/logger';\nimport { useForkRef } from '@semcore/utils/lib/ref';\nimport hasLabels from '@semcore/utils/lib/hasLabels';\n\nimport styles from './style/icon.shadow.css';\n\nfunction Icon(props, ref) {\n const [SIcon, other] = useBox(\n {\n tag: 'svg',\n 'data-ui-name': 'Icon',\n width: 16,\n height: 16,\n viewBox: '0 0 16 16',\n 'aria-hidden': true,\n focusable: props.interactive,\n ...props,\n },\n ref,\n );\n\n const { interactive, color: colorProps } = props;\n const color = resolveColor(colorProps);\n const { keyboardFocused, ...propsWithKeyboardEnhance } = keyboardFocusEnhance()({\n disabled: !interactive,\n ...other,\n });\n const sstyles = sstyled(styles);\n const { className, style } = sstyles.cn('SIcon', {\n 'color-interactive': shade(color, -0.12),\n 'use:color': color,\n interactive: interactive,\n keyboardFocused: keyboardFocused,\n });\n\n function onKeyDown(event) {\n if (props.onKeyDown) {\n return props.onKeyDown(event);\n }\n\n if (interactive && event.code === 'Enter') {\n props.onClick && props.onClick(event);\n }\n }\n\n const labelCheckRef = React.useRef();\n React.useEffect(() => {\n if (!interactive) return;\n if (process.env.NODE_ENV !== 'production') {\n logger.warn(\n !hasLabels(labelCheckRef.current),\n `'aria-label' or 'aria-labelledby' are required props for interactive icons`,\n props['data-ui-name'] || Icon.displayName,\n );\n }\n }, [interactive]);\n const forkedRef = useForkRef(ref, labelCheckRef);\n\n return (\n <SIcon\n {...propsForElement(propsWithKeyboardEnhance)}\n style={Object.assign({}, style, propsWithKeyboardEnhance.style, props.style)}\n className={cn(className, propsWithKeyboardEnhance.className, props.className) || undefined}\n onKeyDown={onKeyDown}\n role={interactive ? 'button' : undefined}\n aria-hidden={interactive ? undefined : 'true'}\n ref={forkedRef}\n />\n );\n}\n\nIcon.displayName = 'Icon';\n\nexport default createBaseComponent(Icon);\n"],"mappings":";;;;;;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,EAAP,MAAe,YAAf;AACA,SAASC,mBAAT,EAA8BC,OAA9B,QAA6C,eAA7C;AACA,SAASC,MAAT,QAAuB,mBAAvB;AACA,OAAOC,YAAP,IAAuBC,KAAvB,QAAoC,0BAApC;AACA,OAAOC,oBAAP,MAAiC,kDAAjC;AACA,OAAOC,eAAP,MAA4B,oCAA5B;AACA,OAAOC,MAAP,MAAmB,2BAAnB;AACA,SAASC,UAAT,QAA2B,wBAA3B;AACA,OAAOC,SAAP,MAAsB,8BAAtB;;;;;;;;;;;;;;;;;;;AAIA,SAASC,IAAT,CAAcC,KAAd,EAAqBC,GAArB,EAA0B;EACxB,cAAuBV,MAAM;IAEzBW,GAAG,EAAE,KAFoB;IAGzB,gBAAgB,MAHS;IAIzBC,KAAK,EAAE,EAJkB;IAKzBC,MAAM,EAAE,EALiB;IAMzBC,OAAO,EAAE,WANgB;IAOzB,e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yB,YAA7B,EAA2C;MACzChC,MAAM,CAACiC,IAAP,CACE,CAAC/B,SAAS,CAACyB,aAAa,CAACO,OAAf,CADZ,gFAGE9B,KAAK,CAAC,cAAD,CAAL,IAAyBD,IAAI,CAACgC,WAHhC;IAKD;EACF,CATD,EASG,CAACxB,WAAD,CATH;EAUA,IAAMyB,SAAS,GAAGnC,UAAU,CAACI,GAAD,EAAMsB,aAAN,CAA5B;EAEA,oBACE,oBAAC,KAAD,eACM5B,eAAe,CAACmB,wBAAD,CADrB;IAEE,KAAK,EAAEmB,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkBhB,KAAlB,EAAyBJ,wBAAwB,CAACI,KAAlD,EAAyDlB,KAAK,CAACkB,KAA/D,CAFT;IAGE,SAAS,EAAE9B,EAAE,CAAC6B,SAAD,EAAYH,wBAAwB,CAACG,SAArC,EAAgDjB,KAAK,CAACiB,SAAtD,CAAF,IAAsEkB,SAHnF;IAIE,SAAS,EAAEhB,SAJb;IAKE,IAAI,EAAEZ,WAAW,GAAG,QAAH,GAAc4B,SALjC;IAME,eAAa5B,WAAW,GAAG4B,SAAH,GAAe,MANzC;IAOE,GAAG,EAAEH;EAPP,GADF;AAWD;;AAEDjC,IAAI,CAACgC,WAAL,GAAmB,MAAnB;AAEA,eAAe1C,mBAAmB,CAACU,IAAD,CAAlC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semcore/icon",
|
|
3
3
|
"description": "Semrush Icon Component",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.2",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/es6/index.js",
|
|
7
7
|
"typings": "lib/types/index.d.ts",
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"author": "UI-kit team <ui-kit-team@semrush.com>",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@semcore/utils": "^3.
|
|
12
|
+
"@semcore/utils": "^3.40.0",
|
|
13
13
|
"@semcore/flex-box": "^4",
|
|
14
14
|
"classnames": "2.2.6"
|
|
15
15
|
},
|
package/svg-new/icon/Text/l.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4 5a1 1 0 0 1 1-1h14a1 1 0 0 1 1 1v2a1 1 0 1 1-2 0V6h-5v12h2a1 1 0 1 1 0 2H9a1 1 0 1 1 0-2h2V6H6v1a1 1 0 0 1-2 0V5Z"/></svg>
|
package/svg-new/icon/Text/m.svg
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M3 4a1 1 0 0 1 1-1h8a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0H9v6h1a1 1 0 1 1 0 2H6a1 1 0 1 1 0-2h1V5H5a1 1 0 0 1-2 0V4Z"/></svg>
|