@sb1/ffe-symbols-react 4.0.0 → 5.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/CHANGELOG.md CHANGED
@@ -3,6 +3,25 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [5.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-symbols-react@5.0.0...@sb1/ffe-symbols-react@5.0.1) (2024-05-03)
7
+
8
+ **Note:** Version bump only for package @sb1/ffe-symbols-react
9
+
10
+ # [5.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-symbols-react@4.0.0...@sb1/ffe-symbols-react@5.0.0) (2024-04-29)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **ffe-symbols-react:** remove default props ([6f8529d](https://github.com/SpareBank1/designsystem/commit/6f8529ddeb432cda43cd08d2917dd28f2a673917))
15
+
16
+ ### Documentation
17
+
18
+ - **ffe-symbols-react:** this package has been deprecated ([970906a](https://github.com/SpareBank1/designsystem/commit/970906a22848052d9802cf9b7a5c773a001ad629))
19
+
20
+ ### BREAKING CHANGES
21
+
22
+ - **ffe-symbols-react:** This package has been deprecated.
23
+ Please use @sb1/ffe-icons and @sb1/ffe-icons-react.
24
+
6
25
  # [4.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-symbols-react@3.0.3...@sb1/ffe-symbols-react@4.0.0) (2024-02-26)
7
26
 
8
27
  ### Bug Fixes
package/README.md CHANGED
@@ -1,25 +1,7 @@
1
1
  # @sb1/ffe-symbols-react
2
2
 
3
- ## Install
3
+ ## Deprecated package
4
4
 
5
- ```
6
- npm install --save @sb1/ffe-symbols-react
7
- ```
5
+ This package is deprecated, and will be removed from the designsystem repo.
8
6
 
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.
7
+ To use the new set of icons, please refer to [ffe-icons](https://github.com/SpareBank1/designsystem/tree/develop/packages/ffe-icons) and/or [ffe-icons-react](https://github.com/SpareBank1/designsystem/tree/develop/packages/ffe-icons-react).
package/es/Symbol.js CHANGED
@@ -1,15 +1,17 @@
1
1
  var _excluded = ["className", "size", "weight", "fill", "ariaLabel", "icon"];
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
- 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; }
4
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
5
5
  import React from 'react';
6
6
  import { string, bool, oneOf } from 'prop-types';
7
7
  import classNames from 'classnames';
8
8
  var _Symbol = function _Symbol(props) {
9
9
  var className = props.className,
10
10
  size = props.size,
11
- weight = props.weight,
12
- fill = props.fill,
11
+ _props$weight = props.weight,
12
+ weight = _props$weight === void 0 ? 300 : _props$weight,
13
+ _props$fill = props.fill,
14
+ fill = _props$fill === void 0 ? false : _props$fill,
13
15
  ariaLabel = props.ariaLabel,
14
16
  icon = props.icon,
15
17
  rest = _objectWithoutProperties(props, _excluded);
@@ -21,10 +23,6 @@ var _Symbol = function _Symbol(props) {
21
23
  }, rest), icon);
22
24
  };
23
25
  export { _Symbol as Symbol };
24
- _Symbol.defaultProps = {
25
- fill: false,
26
- weight: 300
27
- };
28
26
  _Symbol.propTypes = {
29
27
  /** Fills the icon with color */
30
28
  fill: bool,
package/lib/Symbol.js CHANGED
@@ -11,12 +11,14 @@ var _excluded = ["className", "size", "weight", "fill", "ariaLabel", "icon"];
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
- 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; }
14
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
15
15
  var _Symbol = exports.Symbol = function _Symbol(props) {
16
16
  var className = props.className,
17
17
  size = props.size,
18
- weight = props.weight,
19
- fill = props.fill,
18
+ _props$weight = props.weight,
19
+ weight = _props$weight === void 0 ? 300 : _props$weight,
20
+ _props$fill = props.fill,
21
+ fill = _props$fill === void 0 ? false : _props$fill,
20
22
  ariaLabel = props.ariaLabel,
21
23
  icon = props.icon,
22
24
  rest = _objectWithoutProperties(props, _excluded);
@@ -27,10 +29,6 @@ var _Symbol = exports.Symbol = function _Symbol(props) {
27
29
  "aria-hidden": !ariaLabel
28
30
  }, rest), icon);
29
31
  };
30
- _Symbol.defaultProps = {
31
- fill: false,
32
- weight: 300
33
- };
34
32
  _Symbol.propTypes = {
35
33
  /** Fills the icon with color */
36
34
  fill: _propTypes.bool,
package/lib/index.js CHANGED
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "default", {
18
18
  });
19
19
  var _Symbol = _interopRequireWildcard(require("./Symbol"));
20
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
21
- function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-symbols-react",
3
- "version": "4.0.0",
3
+ "version": "5.0.1",
4
4
  "description": "React-komponenter for Material Symbols tilpasset Sb1 sine behov",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -9,6 +9,7 @@
9
9
  "build": "ffe-buildtool babel && cp src/symbolNames.ts types/symbolNames.ts",
10
10
  "watch": "ffe-buildtool babel-watch",
11
11
  "lint": "eslint src",
12
+ "lint:fix": "eslint src --fix",
12
13
  "test": "ffe-buildtool jest",
13
14
  "test:watch": "ffe-buildtool jest --watch"
14
15
  },
@@ -23,17 +24,17 @@
23
24
  },
24
25
  "homepage": "https://github.com/SpareBank1/designsystem#readme",
25
26
  "dependencies": {
26
- "@sb1/ffe-symbols": "^3.0.0",
27
+ "@sb1/ffe-symbols": "^4.0.0",
27
28
  "classnames": "^2.3.2",
28
29
  "prop-types": "^15.8.1",
29
30
  "react": "^18.2.0"
30
31
  },
31
32
  "devDependencies": {
32
- "@sb1/ffe-buildtool": "^0.5.1",
33
- "eslint": "^5.9.0"
33
+ "@sb1/ffe-buildtool": "^0.5.2",
34
+ "eslint": "^8.57.0"
34
35
  },
35
36
  "publishConfig": {
36
37
  "access": "public"
37
38
  },
38
- "gitHead": "d78e3fec5da8d8ce82b4e95c9f2960a3402902ef"
39
+ "gitHead": "c2e7c509b580bc205ca92d91b7e2e2c0503a0087"
39
40
  }
package/src/Symbol.js CHANGED
@@ -3,7 +3,15 @@ import { string, bool, oneOf } from 'prop-types';
3
3
  import classNames from 'classnames';
4
4
 
5
5
  export const Symbol = props => {
6
- const { className, size, weight, fill, ariaLabel, icon, ...rest } = props;
6
+ const {
7
+ className,
8
+ size,
9
+ weight = 300,
10
+ fill = false,
11
+ ariaLabel,
12
+ icon,
13
+ ...rest
14
+ } = props;
7
15
 
8
16
  return (
9
17
  <span
@@ -23,11 +31,6 @@ export const Symbol = props => {
23
31
  );
24
32
  };
25
33
 
26
- Symbol.defaultProps = {
27
- fill: false,
28
- weight: 300,
29
- };
30
-
31
34
  Symbol.propTypes = {
32
35
  /** Fills the icon with color */
33
36
  fill: bool,
@@ -1,43 +0,0 @@
1
- import React from 'react';
2
- import Symbol from '.';
3
-
4
- const getWrapper = props => shallow(<Symbol icon="home" {...props} />);
5
-
6
- describe('<Symbol />', () => {
7
- it('renders without exploding', () => {
8
- const wrapper = getWrapper();
9
- expect(wrapper.exists()).toBe(true);
10
- expect(wrapper.is('span')).toBe(true);
11
- });
12
- it('renders filled symbol correctly', () => {
13
- const wrapper = getWrapper();
14
- expect(wrapper.hasClass('ffe-symbol--300')).toBe(true);
15
- const filled = getWrapper({ fill: true });
16
- expect(filled.hasClass('ffe-symbol--filled-300')).toBe(true);
17
- });
18
- it('set correct symbol weight', () => {
19
- const wrapper = getWrapper({ weight: 500 });
20
- expect(wrapper.hasClass('ffe-symbol--500')).toBe(true);
21
- });
22
- it('renders classes correctly', () => {
23
- const wrapper = getWrapper({ className: 'test-class' });
24
- expect(wrapper.hasClass('ffe-symbol')).toBe(true);
25
- expect(wrapper.hasClass('test-class')).toBe(true);
26
- });
27
- it('renders correct sized symbol of prop', () => {
28
- const wrapper = getWrapper({ size: 'xl' });
29
- expect(wrapper.hasClass('ffe-symbol--xl')).toBe(true);
30
- });
31
- it('passes props correctly', () => {
32
- const wrapper = getWrapper({ id: 'test-id' });
33
- expect(wrapper.prop('id')).toBe('test-id');
34
- });
35
- it('set aria-hidden to true when aria-label is undefined', () => {
36
- const wrapper = getWrapper();
37
- expect(wrapper.prop('aria-hidden')).toBe(true);
38
- });
39
- it('set aria-hidden to false when aria-label is set', () => {
40
- const wrapper = getWrapper({ ariaLabel: 'hus icon' });
41
- expect(wrapper.prop('aria-hidden')).toBe(false);
42
- });
43
- });