@royallondon/design-system-component-notification-panel 0.0.0-stage → 1.4.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.
package/LICENSE.md ADDED
@@ -0,0 +1,54 @@
1
+ Authorised Use Licence v1.0
2
+
3
+ Copyright © 2026 Royal London.
4
+ All rights reserved.
5
+
6
+ 1. Grant of Licence
7
+
8
+ The Licensor grants a non-exclusive, non-transferable,
9
+ revocable, royalty-free licence to use the Software only where:
10
+
11
+ (a) the individual, organisation, or business has been
12
+ expressly authorised in writing by the Licensor; and
13
+
14
+ (b) such authorisation remains in force.
15
+
16
+ 2. Restrictions
17
+
18
+ The Software may not be:
19
+
20
+ (a) used by any unauthorised person or organisation;
21
+
22
+ (b) redistributed, sublicensed, sold, rented or made
23
+ available to third parties;
24
+
25
+ (c) incorporated into another product or service without
26
+ written approval;
27
+
28
+ (d) reverse engineered except where prohibited by law.
29
+
30
+ 3. Ownership
31
+
32
+ The Software remains the exclusive property of the Licensor.
33
+ No ownership rights are transferred under this Licence.
34
+
35
+ 4. Termination
36
+
37
+ The Licensor may revoke authorisation at any time by
38
+ written notice.
39
+
40
+ Upon termination the Licensee must immediately cease use
41
+ of the Software and destroy all copies.
42
+
43
+ 5. No Warranty
44
+
45
+ The Software is provided "as is" without warranty of any kind.
46
+
47
+ 6. Limitation of Liability
48
+
49
+ The Licensor shall not be liable for any damages arising
50
+ from use of the Software.
51
+
52
+ 7. Governing Law
53
+
54
+ This Licence shall be governed by the laws of England and Wales.
package/README.md CHANGED
@@ -1,3 +1,55 @@
1
- # Temporary Holding Version
1
+ ### Installation
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Install the Notification panel package from npm
4
+
5
+ ```bash
6
+ npm install @royallondon/design-system-component-notification-panel
7
+ ```
8
+
9
+ Import the required CSS file
10
+
11
+ ```css
12
+ @import '@royallondon/design-system-component-notification-panel/dist/notification-panel';
13
+ ```
14
+
15
+ Import the required JS file and then initalise the notification function
16
+
17
+ ```js
18
+ import notificationPanel from '@royallondon/design-system-component-notification-panel/dist/notification-panel';
19
+
20
+ const panel = document.getElementById('notifications');
21
+ notificationPanel(panel);
22
+ ```
23
+
24
+ [Start using the Notification panel component](https://design.royallondon.com/components/notification-panel/#live-example)
25
+
26
+ ### Support
27
+
28
+ Issues and questions are handled through the [Royal London Design System support page](https://design.royallondon.com/support/).
29
+
30
+ ### Licence
31
+
32
+ #### @royallondon/design-system-component-notification-panel
33
+
34
+ This package is published primarily for use in Royal London products. It is made available publicly so that partners and suppliers building Royal London experiences can consume it directly.
35
+
36
+ Use of this package is subject to the Royal London Authorised Use Licence. See the `LICENSE.md` file included in this package.
37
+
38
+ The Notification panel component for the [Royal London Design System](https://design.royallondon.com). For design guidance, examples and accessibility notes, see the [Notification panel page](https://design.royallondon.com/components/notification-panel/).
39
+
40
+ ### Release log
41
+
42
+ | Version | Release notes |
43
+ | ------- | ---------------------------------------------------------------------------------------------------- |
44
+ | 1.4.0 | Prepare for public npm release: add licence, publish `dist` only (`src` removed), remove source maps |
45
+ | 1.3.3 | Move to new feed |
46
+ | 1.3.0 | Apply new icons and latest tokens added to foundations |
47
+ | 1.2.2 | Fix "Mark all as read" button position on sm breakpoint |
48
+ | 1.2.1 | Update TypeScript declaration to support internal functions |
49
+ | 1.2.0 | Add SPA support for notification links and expose internal functions |
50
+ | 1.1.0 | Update foundations dependency version to ensure new tokens |
51
+ | 1.0.4 | Fix width collapse of notification panel when empty |
52
+ | 1.0.3 | Add ts declaration file |
53
+ | 1.0.2 | Add HTML code to the README |
54
+ | 1.0.1 | Add missing dependencies |
55
+ | 1.0.0 | Initial development release of notification panel component |
@@ -0,0 +1 @@
1
+ @custom-media --mq-xsmall (max-width: 31.9375rem);@custom-media --mq-small (min-width: 32rem);@custom-media --mq-medium (min-width: 48rem);@custom-media --mq-large (min-width: 64rem);@custom-media --mq-medium-max (max-width: 47.9375rem);@custom-media --mq-large-max (max-width: 63.9375rem);@custom-media --mq-xs-max (max-width: 31.9375rem);@custom-media --mq-sm (min-width: 32rem);@custom-media --mq-sm-max (max-width: 47.9375rem);@custom-media --mq-md (min-width: 48rem);@custom-media --mq-md-max (max-width: 63.9375rem);@custom-media --mq-lg (min-width: 64rem);@custom-media --mq-lg-max (max-width: 79.9375rem);@custom-media --mq-xl (min-width: 80rem);@custom-media --mq-xl-max (max-width: 95.9375rem);@custom-media --mq-xxl (min-width: 96rem);.rl-c-notification-panel{flex-direction:column;inset:4.5rem 0 auto;max-height:calc(100dvh - 9.5rem);max-width:33.5rem;position:fixed;z-index:var(--z-header)}@media (min-width:32rem){.rl-c-notification-panel{inset:auto;max-height:calc(100vh - 6.75rem);position:absolute;right:calc(var(--spacing-03)*-1);top:calc(100% + var(--spacing-03));width:var(--notification-banner-width)}}@media (--mq-sm ){.rl-c-notification-panel{inset:auto;max-height:calc(100vh - 6.75rem);position:absolute;right:calc(var(--spacing-03)*-1);top:calc(100% + var(--spacing-03));width:var(--notification-banner-width)}}.rl-c-notification-panel:not([hidden]){display:flex}.rl-c-notification-panel .rl-c-notification-banner{background:var(--notification-panel-item-fill);border-style:solid;border-width:0 0 0 .25rem}.rl-c-notification-panel__content,.rl-c-notification-panel__footer,.rl-c-notification-panel__header{padding-inline:var(--spacing-03)}.rl-c-notification-panel__footer,.rl-c-notification-panel__header{align-items:center;display:flex;flex-shrink:0;gap:var(--spacing-04)}:is(.rl-c-notification-panel__header,.rl-c-notification-panel__footer) .rl-c-button--text{margin-left:auto;width:auto}.rl-c-notification-panel__header{background:var(--notification-panel-fill-header);padding-block:var(--spacing-03) var(--spacing-02)}@media (max-width:31.9375rem){.rl-c-notification-panel__header .rl-c-button--text{display:none}}@media (--mq-xs-max ){.rl-c-notification-panel__header .rl-c-button--text{display:none}}.rl-c-notification-panel__heading{color:var(--notification-panel-text-title);margin:0}.rl-c-notification-panel__content{background:var(--notification-panel-fill-container);overflow-y:auto;padding-block:var(--spacing-03)}.rl-c-notification-panel__content:not(:has(.rl-c-notification-banner)){align-items:center;display:flex;flex-direction:column;gap:var(--spacing-02);justify-content:center;min-height:20rem}.rl-c-notification-panel__content .rl-c-tabs__header{margin-bottom:var(--spacing-03)}.rl-c-notification-panel__items{display:flex;flex-direction:column;gap:var(--spacing-02);margin:0}.rl-c-notification-panel__footer{background:var(--notification-panel-fill-container);inset:auto 0 0;padding-block:var(--spacing-03);position:fixed}@media (min-width:32rem){.rl-c-notification-panel__footer{display:none}}@media (--mq-sm ){.rl-c-notification-panel__footer{display:none}}
@@ -0,0 +1,20 @@
1
+ declare function notificationPanel(panel: HTMLElement): {
2
+ // Internal state
3
+ readonly isOpen: boolean;
4
+
5
+ // Elements
6
+ header: Element | null;
7
+ toggle: HTMLElement | null;
8
+ bodyOverlay: HTMLElement | null;
9
+ event: CustomEvent<HTMLElement>;
10
+
11
+ // Functions
12
+ bindEvents: () => void;
13
+ togglePanel: () => void;
14
+ open: () => void;
15
+ close: (resetFocus?: boolean) => void;
16
+ handleKeydown: (e: KeyboardEvent) => void;
17
+ trapFocus: (e: KeyboardEvent) => void;
18
+ };
19
+
20
+ export default notificationPanel;
@@ -0,0 +1,85 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function notificationPanel(panel) {
8
+ const header = panel.closest('.rl-c-header');
9
+ const toggle = panel.parentElement.querySelector('.rl-c-header__actions-item--notifications');
10
+ if (!toggle) return;
11
+ const bodyOverlay = document.getElementById('rl-c-nav__overlay');
12
+ const bannerLinks = panel.querySelectorAll('.rl-c-notification-banner a');
13
+ const event = new CustomEvent('headerOverlayOpen', {
14
+ detail: panel
15
+ });
16
+ let isActive = false;
17
+ bindEvents();
18
+ function bindEvents() {
19
+ toggle.addEventListener('click', togglePanel);
20
+ document.addEventListener('keydown', handleKeydown);
21
+ if (bodyOverlay) {
22
+ bodyOverlay.addEventListener('click', closePanel);
23
+ }
24
+ if (header) {
25
+ header.addEventListener('headerOverlayOpen', e => {
26
+ if (e.detail !== panel) {
27
+ closePanel(false);
28
+ }
29
+ });
30
+ }
31
+ if (bannerLinks.length) {
32
+ bannerLinks.forEach(link => {
33
+ link.addEventListener('click', () => closePanel(false));
34
+ });
35
+ }
36
+ }
37
+ function togglePanel() {
38
+ isActive === true ? closePanel() : openPanel();
39
+ }
40
+ function openPanel() {
41
+ isActive = true;
42
+ if (header) header.dispatchEvent(event);
43
+ toggle.setAttribute('aria-expanded', true);
44
+ panel.removeAttribute('hidden');
45
+ if (bodyOverlay) {
46
+ bodyOverlay.classList.add('active');
47
+ bodyOverlay.setAttribute('aria-hidden', 'false');
48
+ }
49
+ }
50
+ function closePanel(resetFocus = true) {
51
+ isActive = false;
52
+ toggle.setAttribute('aria-expanded', false);
53
+ panel.setAttribute('hidden', 'true');
54
+ if (bodyOverlay) {
55
+ bodyOverlay.classList.remove('active');
56
+ bodyOverlay.setAttribute('aria-hidden', 'true');
57
+ if (resetFocus) toggle.focus();
58
+ }
59
+ }
60
+ function handleKeydown(e) {
61
+ if (e.key === 'Escape' && isActive) {
62
+ closePanel();
63
+ } else if (e.key === 'Tab' && isActive) {
64
+ trapFocus(e);
65
+ }
66
+ }
67
+ function trapFocus(e) {
68
+ const focusable = [...panel.parentElement.querySelectorAll('a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(el => el.checkVisibility());
69
+ const first = focusable[0];
70
+ const last = focusable[focusable.length - 1];
71
+ if (e.shiftKey && document.activeElement === first) {
72
+ e.preventDefault();
73
+ last.focus();
74
+ } else if (!e.shiftKey && document.activeElement === last) {
75
+ e.preventDefault();
76
+ first.focus();
77
+ }
78
+ }
79
+ return {
80
+ open: openPanel,
81
+ close: closePanel,
82
+ isOpen: () => isActive
83
+ };
84
+ }
85
+ var _default = exports.default = notificationPanel;
package/package.json CHANGED
@@ -1,6 +1,48 @@
1
1
  {
2
2
  "name": "@royallondon/design-system-component-notification-panel",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "1.4.0",
4
+ "description": "Royal London Design System - Notification panel package",
5
+ "homepage": "https://design.royallondon.com/components/notification-panel/",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://dev.azure.com/RLG-UK/GTC/_git/design-system",
9
+ "directory": "ds-packages/packages/design-system-component-notification-panel"
10
+ },
11
+ "bugs": {
12
+ "url": "https://design.royallondon.com/support/"
13
+ },
14
+ "keywords": [
15
+ "royal-london-design-system-component-notification-panel",
16
+ "rlds-notification-panel",
17
+ "royal-london"
18
+ ],
19
+ "author": "Design System Squad <DesignSystem@royallondon.com>",
20
+ "license": "SEE LICENSE IN LICENSE.md",
21
+ "main": "dist/notification-panel.css",
22
+ "style": "dist/notification-panel.css",
23
+ "scripts": {
24
+ "build:clean": "npx rimraf dist",
25
+ "build:lint": "stylelint src/**/*.{css,pcss} --fix",
26
+ "build:css": "postcss src/**/notification-panel.pcss --base src --dir dist/ --ext css",
27
+ "build:js": "npm-run-all --serial build:babel build:types",
28
+ "build:babel": "babel src/ --out-dir dist/ --config-file ../../babel.config",
29
+ "build:types": "npx copyfiles -u 1 \"src/**/*.d.ts\" dist",
30
+ "build": "npm-run-all --serial build:clean build:css build:js"
31
+ },
32
+ "devDependencies": {
33
+ "@royallondon/design-system-component-navigation-header": "^1.4.2",
34
+ "@royallondon/design-system-component-notification-banner": "^2.3.2",
35
+ "@royallondon/design-system-foundations": "^2.23.0"
36
+ },
37
+ "peerDependencies": {
38
+ "@royallondon/design-system-component-navigation-header": ">= 1.3.0 < 3",
39
+ "@royallondon/design-system-component-notification-banner": ">= 2.2.0 < 3",
40
+ "@royallondon/design-system-foundations": ">= 2.15.0 < 3"
41
+ },
42
+ "files": [
43
+ "dist"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public"
47
+ }
6
48
  }