@gcforms/tag-input 1.0.5 → 1.0.6

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 CHANGED
@@ -5,6 +5,9 @@ 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.6] - 2026-05-07
9
+
10
+ - Allow passing onBlur enabling flows to mark valid and invalid addresses without requiring the user to press Enter
8
11
 
9
12
  ## [1.0.5] - 2025-12-05
10
13
 
@@ -36,6 +39,4 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
36
39
 
37
40
  ## [1.0.0] - 2025-05-14
38
41
 
39
- ### Added
40
-
41
42
  - Initial release
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gcforms/tag-input",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "author": "Canadian Digital Service",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
package/src/TagInput.tsx CHANGED
@@ -28,6 +28,7 @@ export const TagInput = ({
28
28
  restrictDuplicates = true,
29
29
  allowSpacesInTags = true,
30
30
  maxTags,
31
+ onBlur,
31
32
  onTagAdd,
32
33
  onTagRemove,
33
34
  validateTag,
@@ -42,6 +43,10 @@ export const TagInput = ({
42
43
  restrictDuplicates?: boolean;
43
44
  allowSpacesInTags?: boolean;
44
45
  maxTags?: number;
46
+ onBlur?: (
47
+ event: React.FocusEvent<HTMLInputElement>,
48
+ helpers: { addTag: (tag: string) => void }
49
+ ) => void;
45
50
  onTagAdd?: (tag: string) => void;
46
51
  onTagRemove?: (tag: string) => void;
47
52
  validateTag?: (tag: string) => {
@@ -214,6 +219,10 @@ export const TagInput = ({
214
219
  }
215
220
  };
216
221
 
222
+ const handleBlur = (event: React.FocusEvent<HTMLInputElement>) => {
223
+ onBlur?.(event, { addTag: handleAddTag });
224
+ };
225
+
217
226
  return (
218
227
  <div className="gc-tag-input-container" onClick={() => tagInputRef.current?.focus()}>
219
228
  <label htmlFor={id} className="gc-tag-input-label">
@@ -244,6 +253,7 @@ export const TagInput = ({
244
253
  name={name}
245
254
  type="text"
246
255
  placeholder={placeholder}
256
+ onBlur={handleBlur}
247
257
  onKeyDown={handleKeyDown}
248
258
  ref={tagInputRef}
249
259
  />