@primer/react 0.0.0-20260623140715 → 0.0.0-20260623155122
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 +5 -5
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +12 -7
- package/dist/ConfirmationDialog/useConfirm.d.ts.map +1 -1
- package/dist/ConfirmationDialog/useConfirm.js +4 -8
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +1 -0
- package/dist/LabelGroup/LabelGroup.d.ts.map +1 -1
- package/dist/LabelGroup/LabelGroup.js +35 -30
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +12 -7
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +68 -27
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Textarea/Textarea.js +186 -158
- package/dist/ToggleSwitch/ToggleSwitch.d.ts.map +1 -1
- package/dist/ToggleSwitch/ToggleSwitch.js +7 -8
- package/dist/TreeView/TreeView.d.ts.map +1 -1
- package/dist/_VisuallyHidden.js +2 -2
- package/dist/_VisuallyHidden.module.css.js +2 -2
- package/dist/experimental/SelectPanel2/SelectPanel.d.ts.map +1 -1
- package/dist/experimental/SelectPanel2/SelectPanel.js +2 -0
- package/dist/hooks/useMedia.d.ts.map +1 -1
- package/dist/hooks/useMedia.js +49 -46
- package/dist/internal/components/ValidationAnimationContainer.d.ts.map +1 -1
- package/dist/internal/components/ValidationAnimationContainer.js +18 -32
- package/dist/live-region/Announce.d.ts.map +1 -1
- package/dist/live-region/Announce.js +36 -51
- package/dist/utils/character-counter.d.ts +21 -16
- package/dist/utils/character-counter.d.ts.map +1 -1
- package/dist/utils/character-counter.js +59 -23
- package/package.json +1 -1
|
@@ -1,48 +1,34 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { useState
|
|
2
|
+
import { useState } from 'react';
|
|
3
3
|
import classes from './ValidationAnimationContainer.module.css.js';
|
|
4
4
|
import { jsx } from 'react/jsx-runtime';
|
|
5
5
|
|
|
6
6
|
const ValidationAnimationContainer = t0 => {
|
|
7
|
-
const $ = c(
|
|
7
|
+
const $ = c(7);
|
|
8
8
|
const {
|
|
9
9
|
show,
|
|
10
10
|
children
|
|
11
11
|
} = t0;
|
|
12
12
|
const [shouldRender, setRender] = useState(show);
|
|
13
|
+
if (show && !shouldRender) {
|
|
14
|
+
setRender(true);
|
|
15
|
+
}
|
|
13
16
|
let t1;
|
|
14
|
-
let t2;
|
|
15
17
|
if ($[0] !== show) {
|
|
16
18
|
t1 = () => {
|
|
17
|
-
if (show) {
|
|
18
|
-
setRender(
|
|
19
|
+
if (!show) {
|
|
20
|
+
setRender(false);
|
|
19
21
|
}
|
|
20
22
|
};
|
|
21
|
-
t2 = [show];
|
|
22
23
|
$[0] = show;
|
|
23
24
|
$[1] = t1;
|
|
24
|
-
$[2] = t2;
|
|
25
25
|
} else {
|
|
26
26
|
t1 = $[1];
|
|
27
|
-
t2 = $[2];
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
if ($[3] !== show) {
|
|
32
|
-
|
|
33
|
-
if (!show) {
|
|
34
|
-
setRender(false);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
$[3] = show;
|
|
38
|
-
$[4] = t3;
|
|
39
|
-
} else {
|
|
40
|
-
t3 = $[4];
|
|
41
|
-
}
|
|
42
|
-
const onAnimationEnd = t3;
|
|
43
|
-
let t4;
|
|
44
|
-
if ($[5] !== children || $[6] !== onAnimationEnd || $[7] !== shouldRender || $[8] !== show) {
|
|
45
|
-
t4 = shouldRender ? /*#__PURE__*/jsx("div", {
|
|
28
|
+
const onAnimationEnd = t1;
|
|
29
|
+
let t2;
|
|
30
|
+
if ($[2] !== children || $[3] !== onAnimationEnd || $[4] !== shouldRender || $[5] !== show) {
|
|
31
|
+
t2 = shouldRender ? /*#__PURE__*/jsx("div", {
|
|
46
32
|
style: {
|
|
47
33
|
height: show ? "auto" : 0,
|
|
48
34
|
overflow: "hidden"
|
|
@@ -54,15 +40,15 @@ const ValidationAnimationContainer = t0 => {
|
|
|
54
40
|
children: children
|
|
55
41
|
})
|
|
56
42
|
}) : null;
|
|
57
|
-
$[
|
|
58
|
-
$[
|
|
59
|
-
$[
|
|
60
|
-
$[
|
|
61
|
-
$[
|
|
43
|
+
$[2] = children;
|
|
44
|
+
$[3] = onAnimationEnd;
|
|
45
|
+
$[4] = shouldRender;
|
|
46
|
+
$[5] = show;
|
|
47
|
+
$[6] = t2;
|
|
62
48
|
} else {
|
|
63
|
-
|
|
49
|
+
t2 = $[6];
|
|
64
50
|
}
|
|
65
|
-
return
|
|
51
|
+
return t2;
|
|
66
52
|
};
|
|
67
53
|
|
|
68
54
|
export { ValidationAnimationContainer as default };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Announce.d.ts","sourceRoot":"","sources":["../../src/live-region/Announce.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAEjE,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI,gBAAgB,CACxE,EAAE,EACF,KAAK,EACL;IACE;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;CACpC,CACF,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"Announce.d.ts","sourceRoot":"","sources":["../../src/live-region/Announce.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAI9B,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,6BAA6B,CAAA;AAEjE,MAAM,MAAM,aAAa,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,IAAI,gBAAgB,CACxE,EAAE,EACF,KAAK,EACL;IACE;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAA;IAExB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAA;IAEhB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;IAEhB;;;OAGG;IACH,UAAU,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAA;CACpC,CACF,CAAA;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,aAAa,CAAC,EAAE,CAAC,qBAwGtF"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
2
|
import { announceFromElement } from '@primer/live-region-element';
|
|
3
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { useRef, useState, useEffect } from 'react';
|
|
4
4
|
import { useEffectOnce } from '../internal/hooks/useEffectOnce.js';
|
|
5
5
|
import { useEffectCallback } from '../internal/hooks/useEffectCallback.js';
|
|
6
6
|
import { jsx } from 'react/jsx-runtime';
|
|
@@ -11,7 +11,7 @@ import { jsx } from 'react/jsx-runtime';
|
|
|
11
11
|
* will also announce any changes to the text content of `children`
|
|
12
12
|
*/
|
|
13
13
|
function Announce(props) {
|
|
14
|
-
const $ = c(
|
|
14
|
+
const $ = c(25);
|
|
15
15
|
let children;
|
|
16
16
|
let delayMs;
|
|
17
17
|
let rest;
|
|
@@ -51,10 +51,10 @@ function Announce(props) {
|
|
|
51
51
|
const hidden = t2 === undefined ? false : t2;
|
|
52
52
|
const politeness = t3 === undefined ? "polite" : t3;
|
|
53
53
|
const ref = useRef(null);
|
|
54
|
-
const previousAnnouncementText =
|
|
54
|
+
const [previousAnnouncementText, setPreviousAnnouncementText] = useState(null);
|
|
55
55
|
const savedAnnouncement = useRef(null);
|
|
56
56
|
let t4;
|
|
57
|
-
if ($[8] !== delayMs || $[9] !== hidden || $[10] !== politeness) {
|
|
57
|
+
if ($[8] !== delayMs || $[9] !== hidden || $[10] !== politeness || $[11] !== previousAnnouncementText) {
|
|
58
58
|
t4 = () => {
|
|
59
59
|
var _savedAnnouncement$cu;
|
|
60
60
|
const {
|
|
@@ -70,10 +70,14 @@ function Announce(props) {
|
|
|
70
70
|
if (!textContent) {
|
|
71
71
|
return;
|
|
72
72
|
}
|
|
73
|
-
if (textContent === previousAnnouncementText
|
|
73
|
+
if (textContent === previousAnnouncementText) {
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
const style = window.getComputedStyle(element);
|
|
77
|
+
if (style.display === "none") {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (style.visibility === "hidden") {
|
|
77
81
|
return;
|
|
78
82
|
}
|
|
79
83
|
(_savedAnnouncement$cu = savedAnnouncement.current) === null || _savedAnnouncement$cu === void 0 ? void 0 : _savedAnnouncement$cu.cancel();
|
|
@@ -83,33 +87,34 @@ function Announce(props) {
|
|
|
83
87
|
politeness,
|
|
84
88
|
delayMs
|
|
85
89
|
});
|
|
86
|
-
|
|
90
|
+
setPreviousAnnouncementText(textContent);
|
|
87
91
|
};
|
|
88
92
|
$[8] = delayMs;
|
|
89
93
|
$[9] = hidden;
|
|
90
94
|
$[10] = politeness;
|
|
91
|
-
$[11] =
|
|
95
|
+
$[11] = previousAnnouncementText;
|
|
96
|
+
$[12] = t4;
|
|
92
97
|
} else {
|
|
93
|
-
t4 = $[
|
|
98
|
+
t4 = $[12];
|
|
94
99
|
}
|
|
95
100
|
const announce = useEffectCallback(t4);
|
|
96
101
|
let t5;
|
|
97
|
-
if ($[
|
|
102
|
+
if ($[13] !== announce || $[14] !== announceOnShow) {
|
|
98
103
|
t5 = () => {
|
|
99
104
|
if (announceOnShow) {
|
|
100
105
|
announce();
|
|
101
106
|
}
|
|
102
107
|
};
|
|
103
|
-
$[
|
|
104
|
-
$[
|
|
105
|
-
$[
|
|
108
|
+
$[13] = announce;
|
|
109
|
+
$[14] = announceOnShow;
|
|
110
|
+
$[15] = t5;
|
|
106
111
|
} else {
|
|
107
|
-
t5 = $[
|
|
112
|
+
t5 = $[15];
|
|
108
113
|
}
|
|
109
114
|
useEffectOnce(t5);
|
|
110
115
|
let t6;
|
|
111
116
|
let t7;
|
|
112
|
-
if ($[
|
|
117
|
+
if ($[16] !== announce) {
|
|
113
118
|
t6 = () => {
|
|
114
119
|
const {
|
|
115
120
|
current: container
|
|
@@ -130,17 +135,17 @@ function Announce(props) {
|
|
|
130
135
|
};
|
|
131
136
|
};
|
|
132
137
|
t7 = [announce];
|
|
133
|
-
$[
|
|
134
|
-
$[
|
|
135
|
-
$[
|
|
138
|
+
$[16] = announce;
|
|
139
|
+
$[17] = t6;
|
|
140
|
+
$[18] = t7;
|
|
136
141
|
} else {
|
|
137
|
-
t6 = $[
|
|
138
|
-
t7 = $[
|
|
142
|
+
t6 = $[17];
|
|
143
|
+
t7 = $[18];
|
|
139
144
|
}
|
|
140
145
|
useEffect(t6, t7);
|
|
141
146
|
let t8;
|
|
142
147
|
let t9;
|
|
143
|
-
if ($[
|
|
148
|
+
if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
|
|
144
149
|
t8 = () => () => {
|
|
145
150
|
if (savedAnnouncement.current !== null) {
|
|
146
151
|
savedAnnouncement.current.cancel();
|
|
@@ -148,26 +153,26 @@ function Announce(props) {
|
|
|
148
153
|
}
|
|
149
154
|
};
|
|
150
155
|
t9 = [];
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
156
|
+
$[19] = t8;
|
|
157
|
+
$[20] = t9;
|
|
153
158
|
} else {
|
|
154
|
-
t8 = $[
|
|
155
|
-
t9 = $[
|
|
159
|
+
t8 = $[19];
|
|
160
|
+
t9 = $[20];
|
|
156
161
|
}
|
|
157
162
|
useEffect(t8, t9);
|
|
158
163
|
let t10;
|
|
159
|
-
if ($[
|
|
164
|
+
if ($[21] !== BaseComponent || $[22] !== children || $[23] !== rest) {
|
|
160
165
|
t10 = /*#__PURE__*/jsx(BaseComponent, {
|
|
161
166
|
...rest,
|
|
162
167
|
ref: ref,
|
|
163
168
|
children: children
|
|
164
169
|
});
|
|
165
|
-
$[
|
|
166
|
-
$[
|
|
167
|
-
$[
|
|
168
|
-
$[
|
|
170
|
+
$[21] = BaseComponent;
|
|
171
|
+
$[22] = children;
|
|
172
|
+
$[23] = rest;
|
|
173
|
+
$[24] = t10;
|
|
169
174
|
} else {
|
|
170
|
-
t10 = $[
|
|
175
|
+
t10 = $[24];
|
|
171
176
|
}
|
|
172
177
|
return t10;
|
|
173
178
|
}
|
|
@@ -181,24 +186,4 @@ function getTextContent(element) {
|
|
|
181
186
|
return value ? value.trim() : '';
|
|
182
187
|
}
|
|
183
188
|
|
|
184
|
-
/**
|
|
185
|
-
* Determine if an element is visible (not hidden via `display: none` or
|
|
186
|
-
* `visibility: hidden`). Prefers the native `checkVisibility()` API when
|
|
187
|
-
* available and falls back to `getComputedStyle` for older browsers.
|
|
188
|
-
*/
|
|
189
|
-
function isVisible(element) {
|
|
190
|
-
if (typeof element.checkVisibility === 'function') {
|
|
191
|
-
return element.checkVisibility({
|
|
192
|
-
// `visibilityProperty` is the standard option name (Chrome 116+, Firefox
|
|
193
|
-
// 125+, Safari 17.4+); `checkVisibilityCSS` is the legacy Chromium name
|
|
194
|
-
// (Chrome 105+). Unknown options are ignored, so passing both ensures
|
|
195
|
-
// `visibility: hidden` is treated as not visible across all engines.
|
|
196
|
-
visibilityProperty: true,
|
|
197
|
-
checkVisibilityCSS: true
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
const style = window.getComputedStyle(element);
|
|
201
|
-
return style.display !== 'none' && style.visibility !== 'hidden';
|
|
202
|
-
}
|
|
203
|
-
|
|
204
189
|
export { Announce };
|
|
@@ -1,22 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared character counting
|
|
3
|
-
*
|
|
2
|
+
* Shared character counting functionality for text inputs with character limits.
|
|
3
|
+
* Handles real-time character count updates, validation, and aria-live announcements.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
5
|
+
export interface CharacterCounterCallbacks {
|
|
6
|
+
onCountUpdate: (count: number, isOverLimit: boolean, message: string) => void;
|
|
7
|
+
onScreenReaderAnnounce: (message: string) => void;
|
|
8
|
+
}
|
|
9
|
+
export declare class CharacterCounter {
|
|
10
|
+
private announceTimeout;
|
|
11
|
+
private callbacks;
|
|
12
|
+
private isInitialLoad;
|
|
13
|
+
constructor(callbacks: CharacterCounterCallbacks);
|
|
14
|
+
/**
|
|
15
|
+
* Update the character count based on current input value
|
|
16
|
+
*/
|
|
17
|
+
updateCharacterCount(currentLength: number, maxLength: number): void;
|
|
7
18
|
/**
|
|
8
|
-
*
|
|
9
|
-
* characters over the limit when it has been exceeded.
|
|
19
|
+
* Announce character count to screen readers with debouncing
|
|
10
20
|
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
private announceToScreenReader;
|
|
22
|
+
/**
|
|
23
|
+
* Clean up any pending timeouts
|
|
24
|
+
*/
|
|
25
|
+
cleanup(): void;
|
|
16
26
|
}
|
|
17
|
-
/**
|
|
18
|
-
* Compute the character count state for a given length and limit. This is a pure
|
|
19
|
-
* function so the counter can be derived during render without component state.
|
|
20
|
-
*/
|
|
21
|
-
export declare function getCharacterCountState(currentLength: number, maxLength: number): CharacterCountState;
|
|
22
27
|
//# sourceMappingURL=character-counter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"character-counter.d.ts","sourceRoot":"","sources":["../../src/utils/character-counter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,MAAM,WAAW,yBAAyB;IACxC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7E,sBAAsB,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAClD;AAED,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,eAAe,CAAsB;IAC7C,OAAO,CAAC,SAAS,CAA2B;IAC5C,OAAO,CAAC,aAAa,CAAgB;gBAEzB,SAAS,EAAE,yBAAyB;IAIhD;;OAEG;IACH,oBAAoB,CAAC,aAAa,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IA0BpE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -1,30 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Shared character counting
|
|
3
|
-
*
|
|
2
|
+
* Shared character counting functionality for text inputs with character limits.
|
|
3
|
+
* Handles real-time character count updates, validation, and aria-live announcements.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const SCREEN_READER_DELAY = 500;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
7
|
+
class CharacterCounter {
|
|
8
|
+
announceTimeout = null;
|
|
9
|
+
isInitialLoad = true;
|
|
10
|
+
constructor(callbacks) {
|
|
11
|
+
this.callbacks = callbacks;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Update the character count based on current input value
|
|
16
|
+
*/
|
|
17
|
+
updateCharacterCount(currentLength, maxLength) {
|
|
18
|
+
const charactersRemaining = maxLength - currentLength;
|
|
19
|
+
// eslint-disable-next-line no-useless-assignment
|
|
20
|
+
let message = '';
|
|
21
|
+
if (charactersRemaining >= 0) {
|
|
22
|
+
const characterText = charactersRemaining === 1 ? 'character' : 'characters';
|
|
23
|
+
message = `${charactersRemaining} ${characterText} remaining`;
|
|
24
|
+
this.callbacks.onCountUpdate(charactersRemaining, false, message);
|
|
25
|
+
} else {
|
|
26
|
+
const charactersOver = -charactersRemaining;
|
|
27
|
+
const characterText = charactersOver === 1 ? 'character' : 'characters';
|
|
28
|
+
message = `${charactersOver} ${characterText} over`;
|
|
29
|
+
this.callbacks.onCountUpdate(charactersOver, true, message);
|
|
30
|
+
}
|
|
31
|
+
if (!this.isInitialLoad) {
|
|
32
|
+
this.announceToScreenReader(message);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// After first update, set isInitialLoad to false
|
|
36
|
+
if (this.isInitialLoad) {
|
|
37
|
+
this.isInitialLoad = false;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Announce character count to screen readers with debouncing
|
|
43
|
+
*/
|
|
44
|
+
announceToScreenReader(message) {
|
|
45
|
+
if (this.announceTimeout) {
|
|
46
|
+
clearTimeout(this.announceTimeout);
|
|
47
|
+
}
|
|
48
|
+
if (typeof window === 'undefined' || typeof window.setTimeout !== 'function') {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
this.announceTimeout = window.setTimeout(() => {
|
|
52
|
+
this.callbacks.onScreenReaderAnnounce(message);
|
|
53
|
+
}, SCREEN_READER_DELAY);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Clean up any pending timeouts
|
|
58
|
+
*/
|
|
59
|
+
cleanup() {
|
|
60
|
+
if (this.announceTimeout) {
|
|
61
|
+
clearTimeout(this.announceTimeout);
|
|
62
|
+
}
|
|
20
63
|
}
|
|
21
|
-
const charactersOver = -charactersRemaining;
|
|
22
|
-
const characterText = charactersOver === 1 ? 'character' : 'characters';
|
|
23
|
-
return {
|
|
24
|
-
count: charactersOver,
|
|
25
|
-
isOverLimit: true,
|
|
26
|
-
message: `${charactersOver} ${characterText} over`
|
|
27
|
-
};
|
|
28
64
|
}
|
|
29
65
|
|
|
30
|
-
export {
|
|
66
|
+
export { CharacterCounter };
|
package/package.json
CHANGED