@gcforms/tag-input 0.0.0 → 1.0.2
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/CHANGELOG.md +16 -0
- package/package.json +2 -2
- package/src/TagInput.tsx +10 -3
- package/src/i18n/en.json +1 -0
- package/src/i18n/fr.json +1 -0
- package/src/styles.css +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.0.2] - 2025-06-23
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- Update Yarn to version 4.9.2
|
|
13
|
+
|
|
14
|
+
## [1.0.1] - 2025-06-12
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
|
|
18
|
+
- Add allowSpacesInTags prop. When false, enable space to close tags.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Improved styling on tag input element
|
|
23
|
+
|
|
8
24
|
## [1.0.0] - 2025-05-14
|
|
9
25
|
|
|
10
26
|
### Added
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gcforms/tag-input",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"author": "Canadian Digital Service",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
-
"packageManager": "yarn@4.
|
|
9
|
+
"packageManager": "yarn@4.9.2",
|
|
10
10
|
"peerDependencies": {
|
|
11
11
|
"react": "^19.1.0",
|
|
12
12
|
"react-dom": "^19.1.0"
|
package/src/TagInput.tsx
CHANGED
|
@@ -26,6 +26,7 @@ export const TagInput = ({
|
|
|
26
26
|
placeholder,
|
|
27
27
|
description,
|
|
28
28
|
restrictDuplicates = true,
|
|
29
|
+
allowSpacesInTags = true,
|
|
29
30
|
maxTags,
|
|
30
31
|
onTagAdd,
|
|
31
32
|
onTagRemove,
|
|
@@ -39,6 +40,7 @@ export const TagInput = ({
|
|
|
39
40
|
placeholder?: string;
|
|
40
41
|
description?: string;
|
|
41
42
|
restrictDuplicates?: boolean;
|
|
43
|
+
allowSpacesInTags?: boolean;
|
|
42
44
|
maxTags?: number;
|
|
43
45
|
onTagAdd?: (tag: string) => void;
|
|
44
46
|
onTagRemove?: (tag: string) => void;
|
|
@@ -136,7 +138,12 @@ export const TagInput = ({
|
|
|
136
138
|
resetMessages();
|
|
137
139
|
|
|
138
140
|
const { key } = event;
|
|
139
|
-
const acceptKeys = [
|
|
141
|
+
const acceptKeys = [
|
|
142
|
+
keys.ENTER,
|
|
143
|
+
keys.TAB,
|
|
144
|
+
keys.COMMA,
|
|
145
|
+
...(allowSpacesInTags ? [] : [keys.SPACE]),
|
|
146
|
+
];
|
|
140
147
|
const navigateKeys = [keys.ARROW_LEFT, keys.ARROW_RIGHT];
|
|
141
148
|
|
|
142
149
|
// Clear selection when entering text input
|
|
@@ -213,7 +220,7 @@ export const TagInput = ({
|
|
|
213
220
|
{label}
|
|
214
221
|
</label>
|
|
215
222
|
{description && <p className="gc-tag-input-description">{description}</p>}
|
|
216
|
-
<span id="input-instructions"
|
|
223
|
+
<span id="input-instructions" className="gc-visually-hidden">
|
|
217
224
|
{t("inputLabel", { tags: selectedTags.length.toString() })}
|
|
218
225
|
</span>
|
|
219
226
|
<div className="gc-tag-input">
|
|
@@ -224,7 +231,7 @@ export const TagInput = ({
|
|
|
224
231
|
className={`gc-tag ${selectedTagIndex === index ? "gc-selected-tag" : ""}`}
|
|
225
232
|
>
|
|
226
233
|
<div>{tag}</div>
|
|
227
|
-
<button type="button" onClick={() => handleRemoveTag(index)}>
|
|
234
|
+
<button type="button" onClick={() => handleRemoveTag(index)} aria-label={t("delete")}>
|
|
228
235
|
<CancelIcon />
|
|
229
236
|
</button>
|
|
230
237
|
</div>
|
package/src/i18n/en.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"announceTagAdded": "Tag \"{tag}\" added",
|
|
5
5
|
"announceTagRemoved": "Tag \"{tag}\" removed",
|
|
6
6
|
"announceTagSelected": "Tag \"{tag}\" selected",
|
|
7
|
+
"delete": "Delete",
|
|
7
8
|
"duplicateTag": "Tag already added",
|
|
8
9
|
"inputLabel": "{tags} tags. Use Enter, Tab, or a comma to create a tag. Use left and right arrow keys to navigate tags. Use Backspace or Delete to remove a tag.",
|
|
9
10
|
"maxTagsReached": "Maximum number of tags reached ({max})"
|
package/src/i18n/fr.json
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
"announceTagAdded": "Balise \"{tag}\" ajoutée",
|
|
5
5
|
"announceTagRemoved": "Balise \"{tag}\" supprimée",
|
|
6
6
|
"announceTagSelected": "Tag \"{tag}\" sélectionnée",
|
|
7
|
+
"delete": "Supprimer",
|
|
7
8
|
"duplicateTag": "La balise a déjà été ajoutée",
|
|
8
9
|
"inputLabel": "Balises {tags}. Utilisez Entrée, la touche Tab ou une virgule pour créer une balise. Utilisez les touches fléchées gauche et droite pour naviguer dans les balises. Utilisez le retour en arrière ou Supprimer pour enlever une balise.",
|
|
9
10
|
"maxTagsReached": "Le nombre maximal de balises a été atteint ({max})"
|