From 466335bb58e89a27e9890c9e2cd6d03a3fb37595 Mon Sep 17 00:00:00 2001 From: Precious Onyenaucheya <86783201+precious-onyenaucheya-ons@users.noreply.github.com> Date: Fri, 10 Jan 2025 11:10:26 +0000 Subject: [PATCH 1/2] Add option to include links in description list (#3464) Co-authored-by: SriHV Co-authored-by: SriHV <123635670+SriHV@users.noreply.github.com> --- ...ample-inline-description-list_0_document_0_desktop.png | 4 ++-- ...xample-inline-description-list_0_document_1_tablet.png | 4 ++-- ...xample-inline-description-list_0_document_2_mobile.png | 4 ++-- src/components/description-list/_macro-options.md | 1 + src/components/description-list/_macro.njk | 8 +++++++- src/components/description-list/_macro.spec.js | 5 ++++- .../description-list/example-inline-description-list.njk | 3 ++- 7 files changed, 20 insertions(+), 9 deletions(-) diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png index 0a08429eb9..501054bf24 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_0_desktop.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:10b3fac1f117b5156eed79c8e8acd67c758bcf750706a405f707127224f296e5 -size 29101 +oid sha256:5e7e64f58cd1df264462b40d72a23456e35e8d3b36079d8d6163380da5669200 +size 29211 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png index 094d8bb803..787d83b991 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_1_tablet.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:f86583c3c214887dfe5a160e4f9e89827597713760b91ed7bef9650d6830abb3 -size 26901 +oid sha256:2f3ce338fc733ae77a2874dca95f1f3496ca0660ce7d0f9ff1ebec76caa226f8 +size 27025 diff --git a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png index f5141703a9..46fe8f06e5 100644 --- a/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png +++ b/backstop_data/bitmaps_reference/ds-vr-test__components_description-list_example-inline-description-list_0_document_2_mobile.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:24353f18540d373c96f4de57c56514d2dfc1c2d792c92436bff1ae9e0fd55e35 -size 23850 +oid sha256:916702efd8bc81c6e9b58f8ff13e097c11f95d564f09a88cbf6a58f7d284e6ba +size 23969 diff --git a/src/components/description-list/_macro-options.md b/src/components/description-list/_macro-options.md index 324f027775..3a64f09971 100644 --- a/src/components/description-list/_macro-options.md +++ b/src/components/description-list/_macro-options.md @@ -21,3 +21,4 @@ | ----------- | ------ | -------- | ----------------------------------------------------- | | id | string | false | The HTML `id` for the description of the related term | | description | string | true | The value of the description of the related term | +| url | string | false | The url of the description of the related term | diff --git a/src/components/description-list/_macro.njk b/src/components/description-list/_macro.njk index 329491b2c9..92e9890a1f 100644 --- a/src/components/description-list/_macro.njk +++ b/src/components/description-list/_macro.njk @@ -21,7 +21,13 @@ {% if descriptionItem.id %}id="{{ descriptionItem.id }}"{% endif %} class="ons-description-list__value ons-grid__col ons-col-{{ params.descriptionCol }}@{{ 'xs@l' if params.variant == 'inline' else 'm' }}" > - {{- descriptionItem.description -}} + {%- if descriptionItem.url -%} + + {{- descriptionItem.description -}} + + {%- else -%} + {{- descriptionItem.description -}} + {%- endif -%} {% endif %} {% endfor %} diff --git a/src/components/description-list/_macro.spec.js b/src/components/description-list/_macro.spec.js index fa45111ceb..508a51cd6d 100644 --- a/src/components/description-list/_macro.spec.js +++ b/src/components/description-list/_macro.spec.js @@ -30,6 +30,7 @@ const EXAMPLE_DESCRIPTION_LIST_FULL = { { id: 'description-3', description: '49300005832', + url: '#', }, ], }, @@ -142,7 +143,9 @@ describe('macro: description-list', () => { expect($listElements[4].tagName).toBe('dd'); expect($($listElements[4]).attr('id')).toBe('description-3'); - expect($($listElements[4]).text()).toBe('49300005832'); + const $link = $($listElements[4]).find('a'); + expect($link.attr('href')).toBe('#'); + expect($link.text()).toBe('49300005832'); }); it.each([ diff --git a/src/components/description-list/example-inline-description-list.njk b/src/components/description-list/example-inline-description-list.njk index e7114ffd1e..a43605286c 100644 --- a/src/components/description-list/example-inline-description-list.njk +++ b/src/components/description-list/example-inline-description-list.njk @@ -49,7 +49,8 @@ "description": "Jacky Turner" }, { - "description": "Louise Goodland" + "description": "Louise Goodland", + 'url': '#' } ] } From 3c12943971d11f495319ef2cde071fbbb5121ef2 Mon Sep 17 00:00:00 2001 From: rmccar <42928680+rmccar@users.noreply.github.com> Date: Fri, 10 Jan 2025 14:00:35 +0000 Subject: [PATCH 2/2] Remove panel title for warn, announcement and bare panels (#3463) --- src/components/panel/_macro-options.md | 26 +++++++++++++------------- src/components/panel/_macro.njk | 2 +- src/components/panel/_macro.spec.js | 16 +++++++++++++++- 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/src/components/panel/_macro-options.md b/src/components/panel/_macro-options.md index 7d0b893587..0541e4cbe5 100644 --- a/src/components/panel/_macro-options.md +++ b/src/components/panel/_macro-options.md @@ -1,13 +1,13 @@ -| Name | Type | Required | Description | -| ------------------- | ------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -| body | string | true | The contents of the panel. This can contain HTML. | -| title | string | false | The title for the error summary panel | -| headingLevel | int | false | Number used to determine the heading level of the title. Use to ensure the title has a correct semantic order on the page. Defaults to `2` | -| type | string | false | A single value to adjust the component using available variants: “success”, “warn”, “ghost”, “bare”, “error”, “branded”, “warn-branded”, and “announcement” | -| spacious | boolean | false | Set to “true” to double the padding spacing surrounding the body content if required | -| classes | string | false | Custom classes to add to the panel | -| id | string | false | The HTML `id` for the panel | -| attributes | object | false | HTML attributes to apply to the panel (for example, data attributes) | -| assistiveTextPrefix | string | false | Sets the visually hidden prefix text for screen readers. Default values for each panel type: