nsw-design-system 3.18.3 → 3.18.5
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
CHANGED
|
@@ -26,7 +26,7 @@ We recommend the following methods:
|
|
|
26
26
|
|
|
27
27
|
4. **Using JSDelivr CDN:** If you prefer a quicker setup, you can use the JSDelivr content delivery network to directly include the design system's CSS and JavaScript files in your project.
|
|
28
28
|
|
|
29
|
-
Read the [Getting started page](https://designsystem.nsw.gov.au/
|
|
29
|
+
Read the [Getting started page](https://designsystem.nsw.gov.au/docs/content/develop/getting-started.html) for information on the framework contents, templates, examples, and more.
|
|
30
30
|
|
|
31
31
|
## Installing with NPM
|
|
32
32
|
|
|
@@ -144,7 +144,7 @@ View and raise issues and bugs through our [Issues tracker on Github](https://gi
|
|
|
144
144
|
|
|
145
145
|
## Design System Figma UI Kit
|
|
146
146
|
|
|
147
|
-
Access the complete set of design assets required for designing, sharing, and prototyping using our [Figma UI Kit](https://designsystem.nsw.gov.au/
|
|
147
|
+
Access the complete set of design assets required for designing, sharing, and prototyping using our [Figma UI Kit](https://designsystem.nsw.gov.au/docs/content/design/figma-ui-kit.html).
|
|
148
148
|
|
|
149
149
|
## Versioning
|
|
150
150
|
|
|
@@ -158,6 +158,6 @@ Our version numbers consist of MAJOR.MINOR.PATCH, where:
|
|
|
158
158
|
|
|
159
159
|
* **PATCH** version is used for minor backward-compatible updates, new component variations, and bug fixes.
|
|
160
160
|
|
|
161
|
-
See [the Releases section of our GitHub project](https://github.com/digitalnsw/nsw-design-system/releases) for changelogs for each release version. Release posts on our [what’s happening page](https://designsystem.nsw.gov.au/
|
|
161
|
+
See [the Releases section of our GitHub project](https://github.com/digitalnsw/nsw-design-system/releases) for changelogs for each release version. Release posts on our [what’s happening page](https://designsystem.nsw.gov.au/docs/content/about/whats-happening.html) contain summaries of the most noteworthy changes made in each release.
|
|
162
162
|
|
|
163
163
|
Feel free to reach out if you have any questions or need more help with integrating the NSW Design System into your projects!
|
package/dist/js/main.js
CHANGED
|
@@ -1826,6 +1826,12 @@
|
|
|
1826
1826
|
this.createFileList();
|
|
1827
1827
|
}
|
|
1828
1828
|
this.filesList.classList.add('active');
|
|
1829
|
+
const dataTransfer = new DataTransfer();
|
|
1830
|
+
for (let i = 0; i < this.input.files.length; i += 1) {
|
|
1831
|
+
const file = this.input.files[i];
|
|
1832
|
+
dataTransfer.items.add(file);
|
|
1833
|
+
}
|
|
1834
|
+
this.currentFiles = dataTransfer;
|
|
1829
1835
|
let fileListHTML = '';
|
|
1830
1836
|
for (let i = 0; i < this.input.files.length; i += 1) {
|
|
1831
1837
|
const file = this.input.files[i];
|
|
@@ -1836,6 +1842,7 @@
|
|
|
1836
1842
|
} else {
|
|
1837
1843
|
this.filesList.insertAdjacentHTML('beforeend', fileListHTML);
|
|
1838
1844
|
}
|
|
1845
|
+
this.input.files = this.currentFiles.files;
|
|
1839
1846
|
this.removeFile();
|
|
1840
1847
|
}
|
|
1841
1848
|
removeFile() {
|
|
@@ -1845,6 +1852,16 @@
|
|
|
1845
1852
|
if (!event.target.closest('.nsw-icon-button')) return;
|
|
1846
1853
|
event.preventDefault();
|
|
1847
1854
|
const item = event.target.closest('.nsw-file-upload__item');
|
|
1855
|
+
const filename = item.querySelector('.nsw-file-upload__item-filename').textContent;
|
|
1856
|
+
const dataTransfer = new DataTransfer();
|
|
1857
|
+
for (let i = 0; i < this.currentFiles.files.length; i += 1) {
|
|
1858
|
+
const file = this.currentFiles.files[i];
|
|
1859
|
+
if (file.name !== filename) {
|
|
1860
|
+
dataTransfer.items.add(file);
|
|
1861
|
+
}
|
|
1862
|
+
}
|
|
1863
|
+
this.currentFiles = dataTransfer;
|
|
1864
|
+
this.input.files = this.currentFiles.files;
|
|
1848
1865
|
item.remove();
|
|
1849
1866
|
if (this.filesList.children.length === 0) {
|
|
1850
1867
|
this.filesList.classList.remove('active');
|
|
@@ -4219,6 +4236,11 @@
|
|
|
4219
4236
|
ariaExpanded = this.trigger.getAttribute('aria-expanded') === 'true' ? 'false' : 'true';
|
|
4220
4237
|
}
|
|
4221
4238
|
this.trigger.setAttribute('aria-expanded', ariaExpanded);
|
|
4239
|
+
const options = this.dropdown.querySelectorAll(`.js-${this.optionClass}`);
|
|
4240
|
+
options.forEach(option => {
|
|
4241
|
+
const isVisible = ariaExpanded === 'true';
|
|
4242
|
+
option.setAttribute('aria-hidden', !isVisible);
|
|
4243
|
+
});
|
|
4222
4244
|
if (ariaExpanded === 'true') {
|
|
4223
4245
|
const selectedOption = this.getSelectedOption() || this.allButton;
|
|
4224
4246
|
this.constructor.moveFocusFn(selectedOption);
|
|
@@ -4387,7 +4409,8 @@
|
|
|
4387
4409
|
const disabled = options[i].hasAttribute('disabled') ? 'disabled' : '';
|
|
4388
4410
|
const checked = options[i].hasAttribute('selected') ? 'checked' : '';
|
|
4389
4411
|
const uniqueName = this.constructor.createSafeCss(`${this.selectId}-${options[i].value}-${this.optionIndex.toString()}`);
|
|
4390
|
-
|
|
4412
|
+
const ariaHidden = options[i].hasAttribute('hidden') ? 'aria-hidden="true"' : '';
|
|
4413
|
+
list = `${list}<li class="js-${this.optionClass}" role="option" data-value="${options[i].value}" ${selected} ${ariaHidden} data-label="${options[i].text}" data-index="${this.optionIndex}"><input class="${this.prefix}${this.checkboxInputClass} js-${this.checkboxClass}" type="checkbox" id="${uniqueName}" ${checked} ${disabled}><label class="${this.prefix}${this.checkboxLabelClass} ${this.prefix}${this.itemClass} ${this.prefix}${this.itemClass}--option" for="${uniqueName}"><span>${options[i].text}</span></label></li>`;
|
|
4391
4414
|
this.optionIndex += 1;
|
|
4392
4415
|
}
|
|
4393
4416
|
return list;
|
package/package.json
CHANGED
|
@@ -59,6 +59,14 @@ class FileUpload {
|
|
|
59
59
|
|
|
60
60
|
this.filesList.classList.add('active')
|
|
61
61
|
|
|
62
|
+
const dataTransfer = new DataTransfer()
|
|
63
|
+
|
|
64
|
+
for (let i = 0; i < this.input.files.length; i += 1) {
|
|
65
|
+
const file = this.input.files[i]
|
|
66
|
+
dataTransfer.items.add(file)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
this.currentFiles = dataTransfer
|
|
62
70
|
let fileListHTML = ''
|
|
63
71
|
|
|
64
72
|
for (let i = 0; i < this.input.files.length; i += 1) {
|
|
@@ -72,6 +80,7 @@ class FileUpload {
|
|
|
72
80
|
this.filesList.insertAdjacentHTML('beforeend', fileListHTML)
|
|
73
81
|
}
|
|
74
82
|
|
|
83
|
+
this.input.files = this.currentFiles.files
|
|
75
84
|
this.removeFile()
|
|
76
85
|
}
|
|
77
86
|
|
|
@@ -83,6 +92,18 @@ class FileUpload {
|
|
|
83
92
|
if (!event.target.closest('.nsw-icon-button')) return
|
|
84
93
|
event.preventDefault()
|
|
85
94
|
const item = event.target.closest('.nsw-file-upload__item')
|
|
95
|
+
const filename = item.querySelector('.nsw-file-upload__item-filename').textContent
|
|
96
|
+
|
|
97
|
+
const dataTransfer = new DataTransfer()
|
|
98
|
+
for (let i = 0; i < this.currentFiles.files.length; i += 1) {
|
|
99
|
+
const file = this.currentFiles.files[i]
|
|
100
|
+
if (file.name !== filename) {
|
|
101
|
+
dataTransfer.items.add(file)
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
this.currentFiles = dataTransfer
|
|
106
|
+
this.input.files = this.currentFiles.files
|
|
86
107
|
|
|
87
108
|
item.remove()
|
|
88
109
|
|
|
@@ -100,6 +100,13 @@ class Select {
|
|
|
100
100
|
ariaExpanded = this.trigger.getAttribute('aria-expanded') === 'true' ? 'false' : 'true'
|
|
101
101
|
}
|
|
102
102
|
this.trigger.setAttribute('aria-expanded', ariaExpanded)
|
|
103
|
+
|
|
104
|
+
const options = this.dropdown.querySelectorAll(`.js-${this.optionClass}`)
|
|
105
|
+
options.forEach((option) => {
|
|
106
|
+
const isVisible = ariaExpanded === 'true'
|
|
107
|
+
option.setAttribute('aria-hidden', !isVisible)
|
|
108
|
+
})
|
|
109
|
+
|
|
103
110
|
if (ariaExpanded === 'true') {
|
|
104
111
|
const selectedOption = this.getSelectedOption() || this.allButton
|
|
105
112
|
this.constructor.moveFocusFn(selectedOption)
|
|
@@ -296,7 +303,8 @@ class Select {
|
|
|
296
303
|
const disabled = options[i].hasAttribute('disabled') ? 'disabled' : ''
|
|
297
304
|
const checked = options[i].hasAttribute('selected') ? 'checked' : ''
|
|
298
305
|
const uniqueName = this.constructor.createSafeCss(`${this.selectId}-${options[i].value}-${this.optionIndex.toString()}`)
|
|
299
|
-
|
|
306
|
+
const ariaHidden = options[i].hasAttribute('hidden') ? 'aria-hidden="true"' : ''
|
|
307
|
+
list = `${list}<li class="js-${this.optionClass}" role="option" data-value="${options[i].value}" ${selected} ${ariaHidden} data-label="${options[i].text}" data-index="${this.optionIndex}"><input class="${this.prefix}${this.checkboxInputClass} js-${this.checkboxClass}" type="checkbox" id="${uniqueName}" ${checked} ${disabled}><label class="${this.prefix}${this.checkboxLabelClass} ${this.prefix}${this.itemClass} ${this.prefix}${this.itemClass}--option" for="${uniqueName}"><span>${options[i].text}</span></label></li>`
|
|
300
308
|
this.optionIndex += 1
|
|
301
309
|
}
|
|
302
310
|
return list
|