@sb1/ffe-cards-react 11.0.3 → 12.0.0

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.
@@ -1,4 +1,4 @@
1
- var _excluded = ["className", "icon", "condensed", "greyCharcoal", "element", "children"];
1
+ var _excluded = ["className", "icon", "condensed", "element", "children"];
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; }
@@ -10,15 +10,12 @@ var IconCard = function IconCard(props) {
10
10
  var className = props.className,
11
11
  icon = props.icon,
12
12
  condensed = props.condensed,
13
- greyCharcoal = props.greyCharcoal,
14
13
  Element = props.element,
15
14
  children = props.children,
16
15
  rest = _objectWithoutProperties(props, _excluded);
17
16
  return /*#__PURE__*/React.createElement(Element, _extends({
18
17
  className: classNames('ffe-icon-card', {
19
18
  'ffe-icon-card--condensed': condensed
20
- }, {
21
- 'ffe-icon-card--grey-charcoal': greyCharcoal
22
19
  }, className)
23
20
  }, rest), /*#__PURE__*/React.cloneElement(icon, {
24
21
  className: classNames('ffe-icon-card__icon', icon.props.className),
@@ -36,8 +33,6 @@ IconCard.propTypes = {
36
33
  icon: node.isRequired,
37
34
  /** Smaller icon and less space */
38
35
  condensed: bool,
39
- /** Icon and text will all be ffe-grey-charcoal */
40
- greyCharcoal: bool,
41
36
  /** The element to render the card as */
42
37
  element: oneOfType([func, string, elementType]),
43
38
  /** Function that's passed available sub-components as arguments, or regular children */
@@ -0,0 +1,49 @@
1
+ var _excluded = ["className", "element", "children", "img", "condensed"];
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
+ 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; }
5
+ import React from 'react';
6
+ import classNames from 'classnames';
7
+ import { bool, elementType, func, node, oneOfType, string, shape, oneOf } from 'prop-types';
8
+ import { Text, Title, Subtext, CardName } from '../components';
9
+ var StippledCard = function StippledCard(_ref) {
10
+ var className = _ref.className,
11
+ Element = _ref.element,
12
+ children = _ref.children,
13
+ img = _ref.img,
14
+ condensed = _ref.condensed,
15
+ rest = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/React.createElement(Element, _extends({
17
+ className: classNames('ffe-stippled-card', {
18
+ 'ffe-stippled-card--condensed': condensed
19
+ }, className)
20
+ }, rest), /*#__PURE__*/React.createElement("div", {
21
+ className: classNames('ffe-stippled-card__img', {
22
+ 'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon'
23
+ }),
24
+ "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon'
25
+ }, img === null || img === void 0 ? void 0 : img.element), /*#__PURE__*/React.createElement("div", null, typeof children === 'function' ? children({
26
+ CardName: CardName,
27
+ Title: Title,
28
+ Text: Text,
29
+ Subtext: Subtext
30
+ }) : children));
31
+ };
32
+ StippledCard.defaultProps = {
33
+ element: 'a'
34
+ };
35
+ StippledCard.propTypes = {
36
+ className: string,
37
+ /** The element to render the card as */
38
+ element: oneOfType([func, string, elementType]),
39
+ /** Function that's passed available sub-components as arguments, or regular children */
40
+ children: oneOfType([func, node]).isRequired,
41
+ /** Image to be rendered*/
42
+ img: shape({
43
+ element: elementType.isRequired,
44
+ type: oneOf(['icon', 'custom']).isRequired
45
+ }),
46
+ /** Smaller icon and less space */
47
+ condensed: bool
48
+ };
49
+ export default StippledCard;
package/es/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export { default as CardBase } from './CardBase';
2
2
  export { default as TextCard } from './TextCard/TextCard';
3
3
  export { default as IconCard } from './IconCard/IconCard';
4
- export { default as ImageCard } from './ImageCard/ImageCard';
4
+ export { default as ImageCard } from './ImageCard/ImageCard';
5
+ export { default as StippledCard } from './StippledCard/StippledCard';
@@ -9,7 +9,7 @@ var _react = _interopRequireDefault(require("react"));
9
9
  var _classnames = _interopRequireDefault(require("classnames"));
10
10
  var _propTypes = require("prop-types");
11
11
  var components = _interopRequireWildcard(require("../components"));
12
- var _excluded = ["className", "icon", "condensed", "greyCharcoal", "element", "children"];
12
+ var _excluded = ["className", "icon", "condensed", "element", "children"];
13
13
  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); }
14
14
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -20,15 +20,12 @@ var IconCard = function IconCard(props) {
20
20
  var className = props.className,
21
21
  icon = props.icon,
22
22
  condensed = props.condensed,
23
- greyCharcoal = props.greyCharcoal,
24
23
  Element = props.element,
25
24
  children = props.children,
26
25
  rest = _objectWithoutProperties(props, _excluded);
27
26
  return /*#__PURE__*/_react.default.createElement(Element, _extends({
28
27
  className: (0, _classnames.default)('ffe-icon-card', {
29
28
  'ffe-icon-card--condensed': condensed
30
- }, {
31
- 'ffe-icon-card--grey-charcoal': greyCharcoal
32
29
  }, className)
33
30
  }, rest), /*#__PURE__*/_react.default.cloneElement(icon, {
34
31
  className: (0, _classnames.default)('ffe-icon-card__icon', icon.props.className),
@@ -46,8 +43,6 @@ IconCard.propTypes = {
46
43
  icon: _propTypes.node.isRequired,
47
44
  /** Smaller icon and less space */
48
45
  condensed: _propTypes.bool,
49
- /** Icon and text will all be ffe-grey-charcoal */
50
- greyCharcoal: _propTypes.bool,
51
46
  /** The element to render the card as */
52
47
  element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
53
48
  /** Function that's passed available sub-components as arguments, or regular children */
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _react = _interopRequireDefault(require("react"));
8
+ var _classnames = _interopRequireDefault(require("classnames"));
9
+ var _propTypes = require("prop-types");
10
+ var _components = require("../components");
11
+ var _excluded = ["className", "element", "children", "img", "condensed"];
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ 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); }
14
+ 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; }
15
+ 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; }
16
+ var StippledCard = function StippledCard(_ref) {
17
+ var className = _ref.className,
18
+ Element = _ref.element,
19
+ children = _ref.children,
20
+ img = _ref.img,
21
+ condensed = _ref.condensed,
22
+ rest = _objectWithoutProperties(_ref, _excluded);
23
+ return /*#__PURE__*/_react.default.createElement(Element, _extends({
24
+ className: (0, _classnames.default)('ffe-stippled-card', {
25
+ 'ffe-stippled-card--condensed': condensed
26
+ }, className)
27
+ }, rest), /*#__PURE__*/_react.default.createElement("div", {
28
+ className: (0, _classnames.default)('ffe-stippled-card__img', {
29
+ 'ffe-stippled-card__img--icon': (img === null || img === void 0 ? void 0 : img.type) === 'icon'
30
+ }),
31
+ "aria-hidden": (img === null || img === void 0 ? void 0 : img.type) === 'icon'
32
+ }, img === null || img === void 0 ? void 0 : img.element), /*#__PURE__*/_react.default.createElement("div", null, typeof children === 'function' ? children({
33
+ CardName: _components.CardName,
34
+ Title: _components.Title,
35
+ Text: _components.Text,
36
+ Subtext: _components.Subtext
37
+ }) : children));
38
+ };
39
+ StippledCard.defaultProps = {
40
+ element: 'a'
41
+ };
42
+ StippledCard.propTypes = {
43
+ className: _propTypes.string,
44
+ /** The element to render the card as */
45
+ element: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.string, _propTypes.elementType]),
46
+ /** Function that's passed available sub-components as arguments, or regular children */
47
+ children: (0, _propTypes.oneOfType)([_propTypes.func, _propTypes.node]).isRequired,
48
+ /** Image to be rendered*/
49
+ img: (0, _propTypes.shape)({
50
+ element: _propTypes.elementType.isRequired,
51
+ type: (0, _propTypes.oneOf)(['icon', 'custom']).isRequired
52
+ }),
53
+ /** Smaller icon and less space */
54
+ condensed: _propTypes.bool
55
+ };
56
+ var _default = StippledCard;
57
+ exports.default = _default;
package/lib/index.js CHANGED
@@ -21,6 +21,12 @@ Object.defineProperty(exports, "ImageCard", {
21
21
  return _ImageCard.default;
22
22
  }
23
23
  });
24
+ Object.defineProperty(exports, "StippledCard", {
25
+ enumerable: true,
26
+ get: function get() {
27
+ return _StippledCard.default;
28
+ }
29
+ });
24
30
  Object.defineProperty(exports, "TextCard", {
25
31
  enumerable: true,
26
32
  get: function get() {
@@ -31,4 +37,5 @@ var _CardBase = _interopRequireDefault(require("./CardBase"));
31
37
  var _TextCard = _interopRequireDefault(require("./TextCard/TextCard"));
32
38
  var _IconCard = _interopRequireDefault(require("./IconCard/IconCard"));
33
39
  var _ImageCard = _interopRequireDefault(require("./ImageCard/ImageCard"));
40
+ var _StippledCard = _interopRequireDefault(require("./StippledCard/StippledCard"));
34
41
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-cards-react",
3
- "version": "11.0.3",
3
+ "version": "12.0.0",
4
4
  "description": "React implementation of ffe-react",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -25,7 +25,7 @@
25
25
  "test:watch": "ffe-buildtool jest --watch"
26
26
  },
27
27
  "dependencies": {
28
- "@sb1/ffe-cards": "^15.0.3",
28
+ "@sb1/ffe-cards": "^16.0.0",
29
29
  "prop-types": "^15.7.2"
30
30
  },
31
31
  "devDependencies": {
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "538801ebfd32cc08f84d7b26f4f525772b61612e"
43
+ "gitHead": "10adc7c7a295275039de6714a63c7d4fa8ec0232"
44
44
  }
package/types/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
2
 
3
3
  export type ComponentBaseProps = {
4
- className?: string;
5
4
  element?: HTMLElement | string | React.ElementType;
6
- innerRef?: React.Ref<HTMLElement>;
7
5
  } & (React.ComponentProps<'button'> | React.ComponentProps<'a'>);
8
6
 
9
7
  type TitleProps = {
@@ -34,7 +32,16 @@ export interface IconCardProps<T = {}>
34
32
  extends Omit<ComponentBaseProps, 'children'> {
35
33
  icon: React.ReactNode;
36
34
  condensed?: boolean;
37
- greyCharcoal?: boolean;
35
+ children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
36
+ }
37
+
38
+ export interface StrippledCardProps<T = {}>
39
+ extends Omit<ComponentBaseProps, 'children'> {
40
+ img?: {
41
+ element: React.ReactNode;
42
+ type: 'icon' | 'custom';
43
+ };
44
+ condensed?: boolean;
38
45
  children?: React.ReactNode | ((props: CardRenderProps) => React.ReactNode);
39
46
  }
40
47
 
@@ -51,6 +58,12 @@ declare class IconCard<T = {}> extends React.Component<
51
58
  NoInfer<T> & IconCardProps,
52
59
  any
53
60
  > {}
61
+
62
+ declare class StrippledCard<T = {}> extends React.Component<
63
+ NoInfer<T> & StrippledCardProps,
64
+ any
65
+ > {}
66
+
54
67
  declare class ImageCard<T = {}> extends React.Component<
55
68
  NoInfer<T> & ImageCardProps,
56
69
  any