@nice-digital/nds-action-banner 4.1.1-alpha.0 → 4.2.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.
@@ -7,5 +7,6 @@ export interface ActionBannerProps {
7
7
  cta: ReactNode;
8
8
  className?: string;
9
9
  image?: string;
10
+ headingLevel?: number | string;
10
11
  }
11
12
  export declare const ActionBanner: React.FC<ActionBannerProps>;
@@ -19,7 +19,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
19
19
  const classnames_1 = __importDefault(require("classnames"));
20
20
  require("../scss/action-banner.scss");
21
21
  const ActionBanner = (props) => {
22
- const { variant, title, children, cta, className, image } = props, rest = __rest(props, ["variant", "title", "children", "cta", "className", "image"]);
22
+ const { variant, title, children, cta, className, image, headingLevel = 2 } = props, rest = __rest(props, ["variant", "title", "children", "cta", "className", "image", "headingLevel"]);
23
23
  const kebabCaseVariantClassName = variant
24
24
  ? `${variant.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase()}`
25
25
  : "";
@@ -28,6 +28,11 @@ const ActionBanner = (props) => {
28
28
  [`action-banner--${kebabCaseVariantClassName}`]: variant,
29
29
  [`${className}`]: className
30
30
  };
31
- return ((0, jsx_runtime_1.jsxs)("section", Object.assign({ className: (0, classnames_1.default)(classes), "data-component": `action-banner${variant ? `--${variant}` : ""}` }, rest, { children: [image && variant === "fullWidth" ? ((0, jsx_runtime_1.jsx)("div", { className: "action-banner--full-width__image-container", style: { backgroundImage: `url(${image})` } })) : null, (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__container" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "action-banner__inner" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "action-banner__text" }, { children: [(0, jsx_runtime_1.jsx)("h2", Object.assign({ className: "action-banner__title" }, { children: title })), children && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__intro" }, { children: children }))] })), cta && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__actions" }, { children: cta }))] })) }))] })));
31
+ const parsedHeadingLevel = typeof headingLevel === "string"
32
+ ? parseInt(headingLevel, 10)
33
+ : headingLevel;
34
+ const validHeadingLevel = parsedHeadingLevel >= 2 && parsedHeadingLevel <= 6 ? parsedHeadingLevel : 2;
35
+ const HeadingLevel = `h${validHeadingLevel}`;
36
+ return ((0, jsx_runtime_1.jsxs)("section", Object.assign({ className: (0, classnames_1.default)(classes), "data-component": `action-banner${variant ? `--${variant}` : ""}` }, rest, { children: [(variant === "fullWidth" || variant === "fullWidthSubtle") && image && ((0, jsx_runtime_1.jsx)("div", { className: `action-banner--${kebabCaseVariantClassName}__image-container`, style: { backgroundImage: `url(${image})` } })), (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__container" }, { children: (0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "action-banner__inner" }, { children: [(0, jsx_runtime_1.jsxs)("div", Object.assign({ className: "action-banner__text" }, { children: [(0, jsx_runtime_1.jsx)(HeadingLevel, Object.assign({ className: "action-banner__title" }, { children: title })), children && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__intro" }, { children: children }))] })), cta && (0, jsx_runtime_1.jsx)("div", Object.assign({ className: "action-banner__actions" }, { children: cta }))] })) }))] })));
32
37
  };
33
38
  exports.ActionBanner = ActionBanner;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice-digital/nds-action-banner",
3
- "version": "4.1.1-alpha.0",
3
+ "version": "4.2.0",
4
4
  "description": "Action banner component for the NICE Design System",
5
5
  "keywords": [
6
6
  "banner"
@@ -31,8 +31,8 @@
31
31
  "url": "https://github.com/nice-digital/nice-design-system/issues"
32
32
  },
33
33
  "dependencies": {
34
- "@nice-digital/icons": "^6.0.1",
35
- "@nice-digital/nds-core": "^4.1.1-alpha.0",
34
+ "@nice-digital/icons": "^6.1.5",
35
+ "@nice-digital/nds-core": "^4.0.14",
36
36
  "classnames": "^2.3.1"
37
37
  },
38
38
  "peerDependencies": {
@@ -47,5 +47,5 @@
47
47
  "@types/node": "^18.11.9",
48
48
  "typescript": "^4.8.4"
49
49
  },
50
- "gitHead": "fae09f0139d29e4513d74a52b62ed689519caf9f"
50
+ "gitHead": "3f1b2cd5d73de4b50f514582c2f976585c5cf756"
51
51
  }
@@ -63,7 +63,8 @@
63
63
  }
64
64
  }
65
65
 
66
- &--full-width {
66
+ &--full-width,
67
+ &--full-width-subtle {
67
68
  @include layout.fullWidth();
68
69
  @include typography.links-default;
69
70
  background: colours.$action-banner-full-width-background;
@@ -149,7 +150,8 @@
149
150
  }
150
151
 
151
152
  @include media-queries.mq($from: sm) {
152
- &--full-width {
153
+ &--full-width,
154
+ &--full-width-subtle {
153
155
  &__image-container {
154
156
  aspect-ratio: 21 / 9;
155
157
  }
@@ -159,7 +161,8 @@
159
161
  @include media-queries.mq($from: md) {
160
162
  @include layout.clearfix;
161
163
 
162
- &--full-width {
164
+ &--full-width,
165
+ &--full-width-subtle {
163
166
  &__image-container {
164
167
  aspect-ratio: unset;
165
168
  bottom: 0;
@@ -175,7 +178,6 @@
175
178
  }
176
179
 
177
180
  &::before {
178
- background: colours.$action-banner-full-width-background;
179
181
  content: '';
180
182
  flex: 0 0 200px;
181
183
  pointer-events: none;
@@ -192,6 +194,22 @@
192
194
  }
193
195
  }
194
196
 
197
+ &--full-width {
198
+ &__image-container {
199
+ &::before {
200
+ background: colours.$action-banner-full-width-background;
201
+ }
202
+ }
203
+ }
204
+
205
+ &--full-width-subtle {
206
+ &__image-container {
207
+ &::before {
208
+ background: colours.$action-banner-full-width-subtle-background;
209
+ }
210
+ }
211
+ }
212
+
195
213
  &__text {
196
214
  margin-bottom: 0;
197
215
  width: math.percentage(3 * 0.25);