@ons/design-system 70.0.11 → 70.0.13
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/README.md +36 -0
- package/components/card/_macro.njk +1 -1
- package/components/hero/_macro.njk +1 -1
- package/components/input/_macro.njk +1 -1
- package/components/list/_list.scss +6 -0
- package/components/list/_macro.njk +18 -3
- package/components/list/_macro.spec.js +26 -0
- package/css/main.css +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -144,6 +144,42 @@ Generate a build into `./build`.
|
|
|
144
144
|
yarn build
|
|
145
145
|
```
|
|
146
146
|
|
|
147
|
+
## Manually publish to NPM
|
|
148
|
+
|
|
149
|
+
Make sure you are logged into the CLI with the DS shared npm account
|
|
150
|
+
|
|
151
|
+
Make sure dependencies are installed:
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
yarn install
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
Set the version (replacing "<DS release version>" with actual release version e.g. 70.0.0):
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
npm version <DS release version>
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
Create an NPM package by running:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
yarn npm-bundle
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
**_Once you have published to npm, the version you have published can never be used again so you want to make sure you have the right files included to do this run:_**
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
npm pack
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Then compare this list with the list of the current version here (https://www.npmjs.com/package/@ons/design-system?activeTab=code)
|
|
176
|
+
|
|
177
|
+
If these match or have some expected changes then run this to publish:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
npm publish --access public
|
|
181
|
+
```
|
|
182
|
+
|
|
147
183
|
## Recommended Visual Studio Code Extensions for this project
|
|
148
184
|
|
|
149
185
|
- [axe Accessibility Linter](https://marketplace.visualstudio.com/items?itemName=deque-systems.vscode-axe-linter)
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
{% set headingLevel = params.headingLevel | default(2) | string %}
|
|
3
3
|
{% set openingHeadingTag = "<h" + headingLevel %}
|
|
4
4
|
{% set closingHeadingTag = "</h" + headingLevel + ">" %}
|
|
5
|
-
{% set placeholderSrcset = (params.image.placeholderURL if params.image.placeholderURL) + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderURL if params.image.placeholderURL else "") + "/img/large/placeholder-card.png 2x" %}
|
|
5
|
+
{% set placeholderSrcset = (params.image.placeholderURL if params.image.placeholderURL else "") + "/img/small/placeholder-card.png 1x, " + (params.image.placeholderURL if params.image.placeholderURL else "") + "/img/large/placeholder-card.png 2x" %}
|
|
6
6
|
|
|
7
7
|
<div class="ons-card">
|
|
8
8
|
<a href="{{ params.url }}" class="ons-card__link">
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
|
|
22
22
|
{% if params.button %}
|
|
23
23
|
{% from "components/button/_macro.njk" import onsButton %}
|
|
24
|
-
{% set btnClasses = params.button.classes if params.button.classes %}
|
|
24
|
+
{% set btnClasses = params.button.classes if params.button.classes else '' %}
|
|
25
25
|
{% if params.variants and 'dark' in params.variants %}
|
|
26
26
|
{% set btnClasses = btnClasses + ' ons-btn--ghost' %}
|
|
27
27
|
{% endif %}
|
|
@@ -20,11 +20,17 @@
|
|
|
20
20
|
{% else %}
|
|
21
21
|
{% set listEl = 'ul' %}
|
|
22
22
|
{% endif %}
|
|
23
|
+
|
|
24
|
+
{% if listLength < 2 %}
|
|
25
|
+
{% set attributes = params.itemsList[0].attributes %}
|
|
26
|
+
{% else %}
|
|
27
|
+
{% set attributes = params.attributes %}
|
|
28
|
+
{% endif %}
|
|
23
29
|
{% set openingTag = "<" + listEl %}
|
|
24
30
|
{% set closingTag = "</" + listEl + ">" %}
|
|
25
31
|
|
|
26
32
|
{{ openingTag | safe }}{% if params.id %}{{ ' ' }}id="{{ params.id }}"{% endif %}
|
|
27
|
-
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes %}{% for attribute, value in (
|
|
33
|
+
class="ons-list{{ ' ons-list--p' if listEl == 'p' }}{{ ' ' + params.classes if params.classes else '' }}{% if params.variants %}{% if params.variants is not string %}{% for variant in variants %}{{ ' ' }}ons-list--{{ variant }}{% endfor %}{% else %}{{ ' ' }}ons-list--{{ variants }}{% endif %}{% endif %}{{ ' ' + otherClasses if otherClasses else '' }}"{% if params.attributes or params.itemsList[0].attributes %}{% for attribute, value in (attributes.items() if attributes is mapping and attributes.items else attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}>
|
|
28
34
|
{%- for item in params.itemsList -%}
|
|
29
35
|
{% set sublistClasses = item.listClasses if item.listClasses %}
|
|
30
36
|
{%
|
|
@@ -48,7 +54,10 @@
|
|
|
48
54
|
{% endif %}
|
|
49
55
|
|
|
50
56
|
{%- if item.prefix or (params.iconPosition == 'before') -%}
|
|
51
|
-
<span
|
|
57
|
+
<span
|
|
58
|
+
class="ons-list__prefix{{ ' ons-list__prefix--icon-check' if params.variants == 'summary' and itemIconType == 'check' }}"
|
|
59
|
+
{% if listEl != 'ol' %}aria-hidden="true"{% endif %}
|
|
60
|
+
>
|
|
52
61
|
{%- if item.prefix -%}
|
|
53
62
|
{{- item.prefix -}}.
|
|
54
63
|
{% elif params.iconPosition == 'before' %}
|
|
@@ -72,6 +81,7 @@
|
|
|
72
81
|
})
|
|
73
82
|
}}
|
|
74
83
|
{%- else -%}
|
|
84
|
+
{# Remove setting attributes on link in future update #}
|
|
75
85
|
<a
|
|
76
86
|
href="{{ item.url }}"
|
|
77
87
|
class="ons-list__link{{ ' ons-js-inpagelink' if item.variants == 'inPageLink' }}{{ ' ' + item.classes if item.classes else '' }}"
|
|
@@ -87,7 +97,10 @@
|
|
|
87
97
|
{{- itemText | safe -}}
|
|
88
98
|
{%- endif -%}
|
|
89
99
|
{%- if item.suffix or (params.iconPosition == 'after') -%}
|
|
90
|
-
<span
|
|
100
|
+
<span
|
|
101
|
+
class="ons-list__suffix{{ ' ons-list__suffix--icon-check' if params.variants == 'summary' and itemIconType == 'check' }}"
|
|
102
|
+
{% if listEl != 'ol' %}aria-hidden="true"{% endif %}
|
|
103
|
+
>
|
|
91
104
|
{%- if item.suffix -%}
|
|
92
105
|
{{- item.suffix -}}
|
|
93
106
|
{%- elif (item.index and listEl != 'ol') or (item.index and listEl == 'ol' and 'bare' in variants) -%}
|
|
@@ -110,9 +123,11 @@
|
|
|
110
123
|
{% endset %}
|
|
111
124
|
|
|
112
125
|
{% if listLength > 1 or listEl == 'ul' %}
|
|
126
|
+
{# Remove if not item.url in future update #}
|
|
113
127
|
<li
|
|
114
128
|
class="ons-list__item{{ ' ' + item.listClasses if item.listClasses else '' }}"
|
|
115
129
|
{% if item.current %}aria-current="true"{% endif %}
|
|
130
|
+
{% if not item.url %}{% if item.attributes %}{% for attribute, value in (item.attributes.items() if item.attributes is mapping and item.attributes.items else item.attributes) %}{{ ' ' }}{{ attribute }}{% if value %}="{{ value }}"{% endif %}{% endfor %}{% endif %}{% endif %}
|
|
116
131
|
>
|
|
117
132
|
{{- listItem | safe -}}
|
|
118
133
|
</li>
|
|
@@ -109,6 +109,32 @@ describe('macro: list', () => {
|
|
|
109
109
|
expect($('.ons-list').hasClass('ons-list--icons')).toBe(true);
|
|
110
110
|
});
|
|
111
111
|
|
|
112
|
+
it('has the correct icon class when variants is `summary`, `iconType` is `check` and `iconPosition` is before', () => {
|
|
113
|
+
const $ = cheerio.load(
|
|
114
|
+
renderComponent('list', {
|
|
115
|
+
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
116
|
+
iconPosition: 'before',
|
|
117
|
+
iconType: 'check',
|
|
118
|
+
variants: 'summary',
|
|
119
|
+
}),
|
|
120
|
+
);
|
|
121
|
+
|
|
122
|
+
expect($('.ons-list__prefix').hasClass('ons-list__prefix--icon-check')).toBe(true);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
it('has the correct icon class when variants is `summary`, `iconType` is `check` and `iconPosition` is `after`', () => {
|
|
126
|
+
const $ = cheerio.load(
|
|
127
|
+
renderComponent('list', {
|
|
128
|
+
...EXAMPLE_LIST_TEXT_ITEMS,
|
|
129
|
+
iconPosition: 'after',
|
|
130
|
+
iconType: 'check',
|
|
131
|
+
variants: 'summary',
|
|
132
|
+
}),
|
|
133
|
+
);
|
|
134
|
+
|
|
135
|
+
expect($('.ons-list__suffix').hasClass('ons-list__suffix--icon-check')).toBe(true);
|
|
136
|
+
});
|
|
137
|
+
|
|
112
138
|
it('renders a <ul> element by default', () => {
|
|
113
139
|
const $ = cheerio.load(renderComponent('list', EXAMPLE_LIST_TEXT_ITEMS));
|
|
114
140
|
|