@nice-digital/nds-action-banner 4.1.2-alpha.0 → 4.2.1-alpha.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.2-alpha.0",
3
+ "version": "4.2.1-alpha.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.2-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": "6ad38eba73e88e959f6dbd37ff316d7002f457df"
50
+ "gitHead": "02811394f31db6456ee72bda7ce367a3f06c6e9c"
51
51
  }
@@ -14,6 +14,7 @@
14
14
 
15
15
  /// Action banner component. Used to highlight
16
16
  /// and give context to a call-to-action.
17
+ ///
17
18
  /// Modifiers:
18
19
  /// - subtle
19
20
  ///
@@ -63,7 +64,8 @@
63
64
  }
64
65
  }
65
66
 
66
- &--full-width {
67
+ &--full-width,
68
+ &--full-width-subtle {
67
69
  @include layout.fullWidth();
68
70
  @include typography.links-default;
69
71
  background: colours.$action-banner-full-width-background;
@@ -149,7 +151,8 @@
149
151
  }
150
152
 
151
153
  @include media-queries.mq($from: sm) {
152
- &--full-width {
154
+ &--full-width,
155
+ &--full-width-subtle {
153
156
  &__image-container {
154
157
  aspect-ratio: 21 / 9;
155
158
  }
@@ -159,7 +162,8 @@
159
162
  @include media-queries.mq($from: md) {
160
163
  @include layout.clearfix;
161
164
 
162
- &--full-width {
165
+ &--full-width,
166
+ &--full-width-subtle {
163
167
  &__image-container {
164
168
  aspect-ratio: unset;
165
169
  bottom: 0;
@@ -175,7 +179,6 @@
175
179
  }
176
180
 
177
181
  &::before {
178
- background: colours.$action-banner-full-width-background;
179
182
  content: '';
180
183
  flex: 0 0 200px;
181
184
  pointer-events: none;
@@ -192,6 +195,22 @@
192
195
  }
193
196
  }
194
197
 
198
+ &--full-width {
199
+ &__image-container {
200
+ &::before {
201
+ background: colours.$action-banner-full-width-background;
202
+ }
203
+ }
204
+ }
205
+
206
+ &--full-width-subtle {
207
+ &__image-container {
208
+ &::before {
209
+ background: colours.$action-banner-full-width-subtle-background;
210
+ }
211
+ }
212
+ }
213
+
195
214
  &__text {
196
215
  margin-bottom: 0;
197
216
  width: math.percentage(3 * 0.25);