@sb1/ffe-icons-react 8.0.0 → 9.0.1
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/README.md +21 -3
- package/es/Icon.js +5 -5
- package/lib/Icon.js +5 -5
- package/package.json +4 -3
- package/src/Icon.js +4 -4
- package/src/Icon.spec.js +2 -2
- package/src/index.d.ts +1 -1
- package/types/index.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
# @sb1/ffe-icons-react
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Install
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
```
|
|
6
|
+
npm install --save @sb1/ffe-icons-react
|
|
7
|
+
```
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Full documentation on icon usage is available at https://design.sparebank1.no/komponenter/ikoner/.
|
|
12
|
+
|
|
13
|
+
## Development
|
|
14
|
+
|
|
15
|
+
To start a local development server, run the following from the designsystem root folder:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install
|
|
19
|
+
npm run build
|
|
20
|
+
npm start
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
A local instance of `component-overview` with live reloading will run at http://localhost:1234/.
|
|
24
|
+
|
|
25
|
+
Example implementations using the latest versions of all components are also available at https://sparebank1.github.io/designsystem.
|
package/es/Icon.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded = ["
|
|
1
|
+
var _excluded = ["fileUrl", "className", "ariaLabel", "size"];
|
|
2
2
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
3
3
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
4
4
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
@@ -6,7 +6,7 @@ import React from 'react';
|
|
|
6
6
|
import classNames from 'classnames';
|
|
7
7
|
import { string, oneOf } from 'prop-types';
|
|
8
8
|
var Icon = function Icon(props) {
|
|
9
|
-
var
|
|
9
|
+
var fileUrl = props.fileUrl,
|
|
10
10
|
className = props.className,
|
|
11
11
|
ariaLabel = props.ariaLabel,
|
|
12
12
|
size = props.size,
|
|
@@ -17,7 +17,7 @@ var Icon = function Icon(props) {
|
|
|
17
17
|
"aria-hidden": !ariaLabel,
|
|
18
18
|
className: classNames('ffe-icons', "ffe-icons--".concat(size), className),
|
|
19
19
|
style: {
|
|
20
|
-
maskImage: "url(".concat(
|
|
20
|
+
maskImage: "url(".concat(fileUrl, ")")
|
|
21
21
|
}
|
|
22
22
|
}, rest));
|
|
23
23
|
};
|
|
@@ -25,8 +25,8 @@ Icon.defaultProps = {
|
|
|
25
25
|
size: 'md'
|
|
26
26
|
};
|
|
27
27
|
Icon.propTypes = {
|
|
28
|
-
/** The path to the svg-file */
|
|
29
|
-
|
|
28
|
+
/** The path to the svg-file og base64 string */
|
|
29
|
+
fileUrl: string.isRequired,
|
|
30
30
|
/** Additional classnames */
|
|
31
31
|
className: string,
|
|
32
32
|
/** Aria label, if ariaLabel is hull it'll sett aria-hidden to true */
|
package/lib/Icon.js
CHANGED
|
@@ -7,13 +7,13 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = _interopRequireDefault(require("react"));
|
|
8
8
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
9
9
|
var _propTypes = require("prop-types");
|
|
10
|
-
var _excluded = ["
|
|
10
|
+
var _excluded = ["fileUrl", "className", "ariaLabel", "size"];
|
|
11
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
12
12
|
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
13
13
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
14
14
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
15
15
|
var Icon = function Icon(props) {
|
|
16
|
-
var
|
|
16
|
+
var fileUrl = props.fileUrl,
|
|
17
17
|
className = props.className,
|
|
18
18
|
ariaLabel = props.ariaLabel,
|
|
19
19
|
size = props.size,
|
|
@@ -24,7 +24,7 @@ var Icon = function Icon(props) {
|
|
|
24
24
|
"aria-hidden": !ariaLabel,
|
|
25
25
|
className: (0, _classnames.default)('ffe-icons', "ffe-icons--".concat(size), className),
|
|
26
26
|
style: {
|
|
27
|
-
maskImage: "url(".concat(
|
|
27
|
+
maskImage: "url(".concat(fileUrl, ")")
|
|
28
28
|
}
|
|
29
29
|
}, rest));
|
|
30
30
|
};
|
|
@@ -32,8 +32,8 @@ Icon.defaultProps = {
|
|
|
32
32
|
size: 'md'
|
|
33
33
|
};
|
|
34
34
|
Icon.propTypes = {
|
|
35
|
-
/** The path to the svg-file */
|
|
36
|
-
|
|
35
|
+
/** The path to the svg-file og base64 string */
|
|
36
|
+
fileUrl: _propTypes.string.isRequired,
|
|
37
37
|
/** Additional classnames */
|
|
38
38
|
className: _propTypes.string,
|
|
39
39
|
/** Aria label, if ariaLabel is hull it'll sett aria-hidden to true */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sb1/ffe-icons-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.1",
|
|
4
4
|
"description": "React-komponenter for ffe-icons",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "SpareBank 1",
|
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
"test": "ffe-buildtool jest"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
+
"@sb1/ffe-icons": "^13.0.4",
|
|
28
29
|
"prop-types": "^15.7.2"
|
|
29
30
|
},
|
|
30
31
|
"devDependencies": {
|
|
31
|
-
"@sb1/ffe-buildtool": "^0.5.
|
|
32
|
+
"@sb1/ffe-buildtool": "^0.5.1",
|
|
32
33
|
"eslint": "^5.9.0",
|
|
33
34
|
"eslint-loader": "^2.1.0",
|
|
34
35
|
"react": "^16.9.0",
|
|
@@ -41,5 +42,5 @@
|
|
|
41
42
|
"publishConfig": {
|
|
42
43
|
"access": "public"
|
|
43
44
|
},
|
|
44
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "e9f8ba0eb329a7b2fc1aa21512c67ad440b74bb0"
|
|
45
46
|
}
|
package/src/Icon.js
CHANGED
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { string, oneOf } from 'prop-types';
|
|
4
4
|
|
|
5
5
|
const Icon = props => {
|
|
6
|
-
const {
|
|
6
|
+
const { fileUrl, className, ariaLabel, size, ...rest } = props;
|
|
7
7
|
|
|
8
8
|
return (
|
|
9
9
|
<span
|
|
@@ -11,7 +11,7 @@ const Icon = props => {
|
|
|
11
11
|
aria-label={ariaLabel}
|
|
12
12
|
aria-hidden={!ariaLabel}
|
|
13
13
|
className={classNames('ffe-icons', `ffe-icons--${size}`, className)}
|
|
14
|
-
style={{ maskImage: `url(${
|
|
14
|
+
style={{ maskImage: `url(${fileUrl})` }}
|
|
15
15
|
{...rest}
|
|
16
16
|
/>
|
|
17
17
|
);
|
|
@@ -22,8 +22,8 @@ Icon.defaultProps = {
|
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
Icon.propTypes = {
|
|
25
|
-
/** The path to the svg-file */
|
|
26
|
-
|
|
25
|
+
/** The path to the svg-file og base64 string */
|
|
26
|
+
fileUrl: string.isRequired,
|
|
27
27
|
/** Additional classnames */
|
|
28
28
|
className: string,
|
|
29
29
|
/** Aria label, if ariaLabel is hull it'll sett aria-hidden to true */
|
package/src/Icon.spec.js
CHANGED
|
@@ -5,7 +5,7 @@ const getWrapper = props => shallow(<Icon {...props} />);
|
|
|
5
5
|
|
|
6
6
|
describe('Icon', () => {
|
|
7
7
|
it('renders without crashing and with right class', () => {
|
|
8
|
-
const wrapper = getWrapper({
|
|
8
|
+
const wrapper = getWrapper({ fileUrl: '<svg></svg>' });
|
|
9
9
|
expect(wrapper.exists()).toBe(true);
|
|
10
10
|
expect(wrapper.hasClass('ffe-icons')).toBe(true);
|
|
11
11
|
});
|
|
@@ -19,7 +19,7 @@ describe('Icon', () => {
|
|
|
19
19
|
});
|
|
20
20
|
it('applies additional CSS classes when provided', () => {
|
|
21
21
|
const wrapper = getWrapper({
|
|
22
|
-
|
|
22
|
+
fileUrl: '<svg></svg>',
|
|
23
23
|
size: 'md',
|
|
24
24
|
className: 'my-class',
|
|
25
25
|
});
|
package/src/index.d.ts
CHANGED