@sb1/ffe-cards-react 19.0.13 → 19.1.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.
@@ -23,13 +23,13 @@ var __rest = (this && this.__rest) || function (s, e) {
23
23
  import classNames from 'classnames';
24
24
  import React from 'react';
25
25
  import { fixedForwardRef } from '../fixedForwardRef';
26
- function GroupCardWithForwardRef(_a, ref) {
27
- var _b;
28
- var className = _a.className, children = _a.children, _c = _a.bgColor, bgColor = _c === void 0 ? 'primary' : _c, noMargin = _a.noMargin, rest = __rest(_a, ["className", "children", "bgColor", "noMargin"]);
29
- return (React.createElement("div", __assign({ className: classNames('ffe-group-card', (_b = {
26
+ function GroupCardWithForwardRef(props, ref) {
27
+ var _a;
28
+ var className = props.className, children = props.children, _b = props.bgColor, bgColor = _b === void 0 ? 'primary' : _b, noMargin = props.noMargin, _c = props.as, Comp = _c === void 0 ? 'div' : _c, rest = __rest(props, ["className", "children", "bgColor", "noMargin", "as"]);
29
+ return (React.createElement(Comp, __assign({ className: classNames('ffe-group-card', (_a = {
30
30
  'ffe-group-card--no-margin': noMargin
31
31
  },
32
- _b["ffe-group-card--bg-".concat(bgColor)] = bgColor,
33
- _b), className), role: "group" }, rest, { ref: ref }), children));
32
+ _a["ffe-group-card--bg-".concat(bgColor)] = bgColor,
33
+ _a), className), role: Comp === 'div' && 'group' }, rest, { ref: ref }), children));
34
34
  }
35
35
  export var GroupCard = fixedForwardRef(GroupCardWithForwardRef);
@@ -29,13 +29,13 @@ exports.GroupCard = void 0;
29
29
  var classnames_1 = __importDefault(require("classnames"));
30
30
  var react_1 = __importDefault(require("react"));
31
31
  var fixedForwardRef_1 = require("../fixedForwardRef");
32
- function GroupCardWithForwardRef(_a, ref) {
33
- var _b;
34
- var className = _a.className, children = _a.children, _c = _a.bgColor, bgColor = _c === void 0 ? 'primary' : _c, noMargin = _a.noMargin, rest = __rest(_a, ["className", "children", "bgColor", "noMargin"]);
35
- return (react_1.default.createElement("div", __assign({ className: (0, classnames_1.default)('ffe-group-card', (_b = {
32
+ function GroupCardWithForwardRef(props, ref) {
33
+ var _a;
34
+ var className = props.className, children = props.children, _b = props.bgColor, bgColor = _b === void 0 ? 'primary' : _b, noMargin = props.noMargin, _c = props.as, Comp = _c === void 0 ? 'div' : _c, rest = __rest(props, ["className", "children", "bgColor", "noMargin", "as"]);
35
+ return (react_1.default.createElement(Comp, __assign({ className: (0, classnames_1.default)('ffe-group-card', (_a = {
36
36
  'ffe-group-card--no-margin': noMargin
37
37
  },
38
- _b["ffe-group-card--bg-".concat(bgColor)] = bgColor,
39
- _b), className), role: "group" }, rest, { ref: ref }), children));
38
+ _a["ffe-group-card--bg-".concat(bgColor)] = bgColor,
39
+ _a), className), role: Comp === 'div' && 'group' }, rest, { ref: ref }), children));
40
40
  }
41
41
  exports.GroupCard = (0, fixedForwardRef_1.fixedForwardRef)(GroupCardWithForwardRef);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-cards-react",
3
- "version": "19.0.13",
3
+ "version": "19.1.0",
4
4
  "description": "React implementation of ffe-react",
5
5
  "license": "MIT",
6
6
  "author": "SpareBank 1",
@@ -26,7 +26,7 @@
26
26
  "test:watch": "ffe-buildtool jest --watch"
27
27
  },
28
28
  "dependencies": {
29
- "@sb1/ffe-cards": "^22.0.13"
29
+ "@sb1/ffe-cards": "^22.1.0"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@sb1/ffe-buildtool": "^0.10.0",
@@ -40,5 +40,5 @@
40
40
  "publishConfig": {
41
41
  "access": "public"
42
42
  },
43
- "gitHead": "e9e1f82136970a49ad5597ff0ebcbadaaef85b3c"
43
+ "gitHead": "e63d153c5918b2d631c8aa2a11271400c21e3078"
44
44
  }
@@ -1,6 +1,6 @@
1
- import React from 'react';
2
- import { BackgroundColor } from '../types';
3
- export interface GroupCardProps extends Omit<React.ComponentPropsWithoutRef<'div'>, 'children'> {
1
+ import React, { ElementType } from 'react';
2
+ import { ComponentAsPropParams, BackgroundColor } from '../types';
3
+ export type GroupCardProps<As extends ElementType = 'div'> = Omit<ComponentAsPropParams<As>, 'children'> & {
4
4
  /** The children of the GroupCard component */
5
5
  children: React.ReactNode;
6
6
  /**
@@ -18,5 +18,23 @@ export interface GroupCardProps extends Omit<React.ComponentPropsWithoutRef<'div
18
18
  bgDarkmodeColor?: never;
19
19
  /** No margin on card */
20
20
  noMargin?: boolean;
21
- }
22
- export declare const GroupCard: (props: GroupCardProps & React.RefAttributes<any>) => React.JSX.Element;
21
+ };
22
+ export declare const GroupCard: <As extends ElementType>(props: Omit<ComponentAsPropParams<As>, "children"> & {
23
+ /** The children of the GroupCard component */
24
+ children: React.ReactNode;
25
+ /**
26
+ * The background color of the whole groupcard element
27
+ *
28
+ * Property has new values that work with dark and accent mode as part of the Semantic Color update
29
+ * Possible values: `primary` `secondary` `tertiary`
30
+ * [Read more in the upgrade guide](https://sparebank1.github.io/designsystem/?path=/docs/introduksjon-changelog--docs#2025---februar---semantiske-farger)
31
+ */
32
+ bgColor?: BackgroundColor;
33
+ /** @deprecated as part of update to Semantic Colors
34
+ *
35
+ * Property is replaced by the updated values for `bgColor` that works on dark mode
36
+ * [Read more in the upgrade guide](https://sparebank1.github.io/designsystem/?path=/docs/introduksjon-changelog--docs#2025---februar---semantiske-farger) */
37
+ bgDarkmodeColor?: never;
38
+ /** No margin on card */
39
+ noMargin?: boolean;
40
+ } & React.RefAttributes<any>) => React.JSX.Element;