@royallondon/design-system-component-accordion 0.0.0-stage → 3.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,58 @@
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 Accordion package from npm
4
+
5
+ ```bash
6
+ npm install @royallondon/design-system-component-accordion
7
+ ```
8
+
9
+ Import the required CSS file
10
+
11
+ ```css
12
+ @import '@royallondon/design-system-component-accordion/dist/accordion';
13
+ ```
14
+
15
+ Import the required JS file and initialise the accordion function
16
+
17
+ ```js
18
+ import accordion from '@royallondon/design-system-component-accordion/dist/accordion';
19
+ const accordionContainers = document.querySelectorAll('.rl-c-accordion');
20
+ if (accordionContainers) {
21
+ accordion(accordionContainers);
22
+ }
23
+ ```
24
+
25
+ [Start using the Accordion component](https://design.royallondon.com/components/accordion/#live-example)
26
+
27
+ ### Support
28
+
29
+ Issues and questions are handled through the [Royal London Design System support page](https://design.royallondon.com/support/).
30
+
31
+ ### Licence
32
+
33
+ #### @royallondon/design-system-component-accordion
34
+
35
+ 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.
36
+
37
+ Use of this package is subject to the Royal London Authorised Use Licence. See the `LICENSE.md` file included in this package.
38
+
39
+ The Accordion component for the [Royal London Design System](https://design.royallondon.com). For design guidance, examples and accessibility notes, see the [Accordion page](https://design.royallondon.com/components/accordion/).
40
+
41
+ ### Release log
42
+
43
+ | Version | Release notes |
44
+ | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
45
+ | 3.4.0 | Prepare for public npm release: add licence, publish `dist` only (`src` removed), remove source maps |
46
+ | 3.3.3 | Move to new feed |
47
+ | 3.3.0 | Apply new icons and latest tokens added to foundations package |
48
+ | 3.2.2 | Add TypeScript declaration file |
49
+ | 3.2.1 | Correct build output for accordion component |
50
+ | 3.2.0 | Update accordion to use type tokens |
51
+ | 3.1.0 | Update typography and sizing |
52
+ | 3.0.0 | Remove obsolete ts file from dist to avoid import name conflict and fix readme content |
53
+ | 2.1.0 | Updates to font sizing with header title and accordion title |
54
+ | 2.0.0 | Upgrade for compatibility with foundations v2 |
55
+ | 1.0.3 | Fixed TypeScript |
56
+ | 1.0.2 | Fixed action focus state bottom border was sitting behind accordion |
57
+ | 1.0.1 | Fixed incorrect focus state for accordion item action and hide accordion content so that links inside aren't tabable when content is hidden |
58
+ | 1.0.0 | First release of 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-accordion-header{border-bottom:2px solid var(--accordion-stroke-title);display:flex;flex-direction:column;font-family:var(--typography-font-family-display-small);padding-block:var(--spacing-04)}.rl-c-accordion-header:has(>.rl-f-icon),.rl-c-accordion-header:has(>[class*=rl-icon__]){display:grid;gap:var(--spacing-02) var(--spacing-03);grid-template-areas:"accordion-first-icon accordion-heading" " . accordion-open-all";grid-template-columns:1.5rem 1fr}@media (min-width:48rem){.rl-c-accordion-header:has(>.rl-f-icon),.rl-c-accordion-header:has(>[class*=rl-icon__]){grid-template-areas:"accordion-first-icon accordion-heading accordion-open-all";grid-template-columns:2rem 1fr}}@media (--mq-medium ){.rl-c-accordion-header:has(>.rl-f-icon),.rl-c-accordion-header:has(>[class*=rl-icon__]){grid-template-areas:"accordion-first-icon accordion-heading accordion-open-all";grid-template-columns:2rem 1fr}}:is(.rl-c-accordion-header:has(>[class*=rl-icon__]),.rl-c-accordion-header:has(>.rl-f-icon)) [class*=rl-icon__]{height:1.5rem;width:1.5rem}@media (min-width:48rem){:is(.rl-c-accordion-header:has(>[class*=rl-icon__]),.rl-c-accordion-header:has(>.rl-f-icon)) [class*=rl-icon__]{height:2rem;width:2rem}}@media (--mq-medium ){:is(.rl-c-accordion-header:has(>[class*=rl-icon__]),.rl-c-accordion-header:has(>.rl-f-icon)) [class*=rl-icon__]{height:2rem;width:2rem}}.rl-c-accordion-header .rl-f-icon:first-child,.rl-c-accordion-header [class*=rl-icon__]:first-child{grid-area:accordion-first-icon}.rl-c-accordion-header__content{grid-area:accordion-heading}.rl-c-accordion-header__actions{grid-area:accordion-open-all}.rl-c-accordion-header__title{color:var(--accordion-text-title-headline);font-family:var(--typography-font-family-headline-small);font-size:var(--typography-size-headline-small);font-weight:var(--typography-weight-headline-small);line-height:var(--type-line-height);margin-bottom:0}.rl-c-accordion-header__description{color:var(--accordion-text-title-body);font-family:var(--typography-font-family-body-medium);margin-bottom:0}.rl-c-accordion-header__open-all{float:right;width:auto}.rl-c-accordion-item{border-bottom:1px solid var(--accordion-stroke-row)}.rl-c-accordion-item:hover{background:var(--accordion-fill-row-hover)}.rl-c-accordion-item--open{border-bottom-color:var(--accordion-stroke-row-active)}.rl-c-accordion-item--open:hover{background:var(--accordion-fill-row-active-hover)}.rl-c-accordion-item__action{align-items:flex-start;display:flex;gap:var(--spacing-02) var(--spacing-03);padding:var(--spacing-04) var(--spacing-03);position:relative;width:100%;z-index:1}@media (min-width:48rem){.rl-c-accordion-item__action{gap:var(--spacing-03)}}@media (--mq-medium ){.rl-c-accordion-item__action{gap:var(--spacing-03)}}.rl-c-accordion-item__action:has(>.rl-f-icon:first-child),.rl-c-accordion-item__action:has(>[class*=rl-icon__]:first-child){display:grid;grid-template-columns:1.25rem 1fr 1.25rem}@media (min-width:48rem){.rl-c-accordion-item__action:has(>.rl-f-icon:first-child),.rl-c-accordion-item__action:has(>[class*=rl-icon__]:first-child){grid-template-columns:1.5rem 1fr 1.5rem}}@media (--mq-medium ){.rl-c-accordion-item__action:has(>.rl-f-icon:first-child),.rl-c-accordion-item__action:has(>[class*=rl-icon__]:first-child){grid-template-columns:1.5rem 1fr 1.5rem}}.rl-c-accordion-item__action .rl-f-icon,.rl-c-accordion-item__action [class*=rl-icon__]{flex-shrink:0}.rl-c-accordion-item__action [class*=rl-icon__]{height:1.25rem;width:1.25rem}@media (min-width:48rem){.rl-c-accordion-item__action [class*=rl-icon__]{height:1.5rem;width:1.5rem}}@media (--mq-medium ){.rl-c-accordion-item__action [class*=rl-icon__]{height:1.5rem;width:1.5rem}}.rl-c-accordion-item__header{display:flex;flex-direction:column;flex-grow:1;gap:var(--spacing-01);position:relative;text-align:left}.rl-c-accordion-item__title{color:var(--accordion-text-row-title);font-family:var(--typography-font-family-title-small);font-size:var(--typography-size-title-small);font-weight:var(--typography-weight-title-small);line-height:var(--type-line-height-body);margin:0}.rl-c-accordion-item__description{color:var(--accordion-text-row-hint);font-family:var(--typography-font-family-body-small);font-size:var(--typography-size-body-small);font-weight:var(--typography-weight-body-small);line-height:var(--type-line-height);margin-bottom:0}.rl-c-accordion-item__action:not([class*=rl-c-badge])[class*=rl-icon__]{border-radius:50%;font-size:.75rem;height:1.25rem;width:1.25rem}@media (min-width:48rem){.rl-c-accordion-item__action:not([class*=rl-c-badge])[class*=rl-icon__]{font-size:1rem;height:1.5rem;width:1.5rem}}@media (--mq-medium ){.rl-c-accordion-item__action:not([class*=rl-c-badge])[class*=rl-icon__]{font-size:1rem;height:1.5rem;width:1.5rem}}.rl-c-accordion-item__action>.rl-f-icon:last-child,.rl-c-accordion-item__action>[class*=rl-icon__]:last-child{color:var(--icons-fill-symbol-secondary-100);flex-shrink:0;font-size:1.25rem;position:relative;transform:none;transition:all .3s ease-in-out}.rl-c-accordion-item--open :is(.rl-c-accordion-item__action>.rl-f-icon:last-child,.rl-c-accordion-item__action>[class*=rl-icon__]:last-child){transform:rotate(180deg)}.rl-c-accordion-item__action>.rl-f-icon:last-child{margin-block:var(--spacing-01)}.rl-c-accordion-item__content{color:var(--accordion-text-row-body);max-height:0;overflow:hidden;padding-inline:var(--spacing-03);transition:max-height .2s ease-in-out;visibility:hidden}@media (min-width:48rem){.rl-c-accordion-item__content{padding-right:var(--spacing-07)}}@media (--mq-medium ){.rl-c-accordion-item__content{padding-right:var(--spacing-07)}}.rl-c-accordion-item__content-inner{max-width:var(--size-limit-text-max);padding-block:var(--spacing-03) var(--spacing-07)}.rl-c-accordion-item__content-inner>:last-child{margin-bottom:0}.rl-c-accordion-item__content-open{height:auto;visibility:visible}
@@ -0,0 +1,2 @@
1
+ declare function accordion(accordionContainers: NodeListOf<HTMLElement>): void;
2
+ export default accordion;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ function toggleAccordionContent(item) {
8
+ const action = item.querySelector(".rl-c-accordion-item__action");
9
+ const content = item.querySelector(".rl-c-accordion-item__content");
10
+ item.classList.toggle("rl-c-accordion-item--open");
11
+ content.classList.toggle("rl-c-accordion-item__content-open");
12
+
13
+ // Update aria-expanded attribute
14
+ const expanded = item.classList.contains("rl-c-accordion-item--open");
15
+ action.setAttribute("aria-expanded", expanded);
16
+
17
+ // Update aria-hidden attribute
18
+ const hidden = !expanded;
19
+ content.setAttribute("aria-hidden", hidden);
20
+ if (content.style.maxHeight) {
21
+ content.style.maxHeight = "";
22
+ } else {
23
+ content.style.maxHeight = content.scrollHeight + "px";
24
+ }
25
+ }
26
+ function isAllOpen(accordionItems) {
27
+ return Array.from(accordionItems).every(item => item.classList.contains("rl-c-accordion-item--open"));
28
+ }
29
+ function updateOpenAllButtonText(openAll, accordionItems) {
30
+ openAll.innerText = isAllOpen(accordionItems) ? "Close all" : "Open all";
31
+ }
32
+ function initAccordions(accordion) {
33
+ const openAll = accordion.querySelector(".rl-c-accordion-header__open-all");
34
+ const accordionItems = accordion.querySelectorAll(".rl-c-accordion-item");
35
+ accordionItems.forEach(item => {
36
+ const action = item.querySelector(".rl-c-accordion-item__action");
37
+ action.addEventListener("click", () => {
38
+ toggleAccordionContent(item);
39
+ if (openAll) {
40
+ updateOpenAllButtonText(openAll, accordionItems);
41
+ }
42
+ });
43
+ });
44
+ function updateMaxHeights() {
45
+ accordionItems.forEach(item => {
46
+ const content = item.querySelector(".rl-c-accordion-item__content");
47
+ if (item.classList.contains("rl-c-accordion-item--open")) {
48
+ content.style.maxHeight = content.scrollHeight + "px";
49
+ }
50
+ });
51
+ }
52
+ window.addEventListener("resize", updateMaxHeights);
53
+ if (openAll) {
54
+ openAll.addEventListener("click", () => {
55
+ const isOpen = !isAllOpen(accordionItems);
56
+ accordionItems.forEach(item => {
57
+ if (isOpen && !item.classList.contains("rl-c-accordion-item--open") || !isOpen && item.classList.contains("rl-c-accordion-item--open")) {
58
+ toggleAccordionContent(item);
59
+ }
60
+ });
61
+ updateOpenAllButtonText(openAll, accordionItems);
62
+ updateMaxHeights();
63
+ });
64
+ }
65
+ }
66
+ function accordion(accordionContainers) {
67
+ accordionContainers.forEach(accordion => {
68
+ initAccordions(accordion);
69
+ });
70
+ }
71
+ var _default = exports.default = accordion;
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "@royallondon/design-system-component-accordion",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "3.4.0",
4
+ "description": "Royal London Design System - Accordion package",
5
+ "homepage": "https://design.royallondon.com/components/accordion/",
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-accordion"
10
+ },
11
+ "bugs": {
12
+ "url": "https://design.royallondon.com/support/"
13
+ },
14
+ "keywords": [
15
+ "royal-london-design-system-component-accordion",
16
+ "rlds-accordion",
17
+ "royal-london"
18
+ ],
19
+ "author": "Design System Squad <DesignSystem@royallondon.com>",
20
+ "license": "SEE LICENSE IN LICENSE.md",
21
+ "main": "dist/accordion.css",
22
+ "style": "dist/accordion.css",
23
+ "scripts": {
24
+ "build:clean": "npx rimraf dist",
25
+ "build:lint": "stylelint src/**/*.{css,pcss} --fix",
26
+ "build:css": "postcss src/**/accordion.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-foundations": "^2.23.0"
34
+ },
35
+ "peerDependencies": {
36
+ "@royallondon/design-system-foundations": ">= 2.15.0 < 3"
37
+ },
38
+ "files": [
39
+ "dist"
40
+ ],
41
+ "publishConfig": {
42
+ "access": "public"
43
+ }
6
44
  }