nsw-design-system 3.18.4 → 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/nsw-design-system/docs/content/develop/getting-started.html) for information on the framework contents, templates, examples, and more.
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/nsw-design-system/docs/content/design/figma-ui-kit.html).
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/nsw-design-system/docs/content/about/whats-happening.html) contain summaries of the most noteworthy changes made in each release.
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!
@@ -13,6 +13,7 @@ declare class FileUpload {
13
13
  createFileList(): void;
14
14
  createFileItem(file: any): string;
15
15
  updateFileList(): void;
16
+ currentFiles: DataTransfer | undefined;
16
17
  removeFile(): void;
17
18
  handleFileRemove(event: any): void;
18
19
  }
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');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nsw-design-system",
3
- "version": "3.18.4",
3
+ "version": "3.18.5",
4
4
  "description": "Design system for Digital NSW",
5
5
  "main": "dist/js/main.js",
6
6
  "types": "dist/js/main.d.ts",
@@ -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