@primer/react 38.6.3-rc.f8f5fddc3 → 38.7.0-rc.b626e5d83
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.
Potentially problematic release.
This version of @primer/react might be problematic. Click here for more details.
- package/CHANGELOG.md +48 -1
- package/dist/ActionBar/ActionBar.d.ts +8 -0
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +83 -53
- package/dist/ActionBar/index.d.ts +1 -0
- package/dist/ActionBar/index.d.ts.map +1 -1
- package/dist/Autocomplete/Autocomplete.d.ts +0 -3
- package/dist/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/Autocomplete/Autocomplete.js +69 -23
- package/dist/Autocomplete/AutocompleteContext.d.ts +23 -3
- package/dist/Autocomplete/AutocompleteContext.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteContext.js +20 -1
- package/dist/Autocomplete/AutocompleteInput.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteInput.js +8 -5
- package/dist/Autocomplete/AutocompleteMenu.d.ts.map +1 -1
- package/dist/Autocomplete/AutocompleteMenu.js +123 -121
- package/dist/{BaseStyles-79fd37c4.css → BaseStyles-7e59cc50.css} +2 -2
- package/dist/BaseStyles-7e59cc50.css.map +1 -0
- package/dist/BaseStyles.module.css.js +1 -1
- package/dist/Dialog/{Dialog-1a61e61a.css → Dialog-92b5e3b7.css} +2 -2
- package/dist/Dialog/Dialog-92b5e3b7.css.map +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +21 -5
- package/dist/Dialog/Dialog.module.css.js +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/DefaultFeatureFlags.js +1 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts +6 -0
- package/dist/FeatureFlags/FeatureFlags.d.ts.map +1 -1
- package/dist/FeatureFlags/FeatureFlags.js +41 -32
- package/dist/FilteredActionList/FilteredActionList.d.ts +6 -1
- package/dist/FilteredActionList/FilteredActionList.d.ts.map +1 -1
- package/dist/FilteredActionList/FilteredActionList.js +4 -2
- package/dist/PageLayout/{PageLayout-c092f3db.css → PageLayout-51007c87.css} +2 -2
- package/dist/PageLayout/PageLayout-51007c87.css.map +1 -0
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +399 -313
- package/dist/PageLayout/PageLayout.module.css.js +1 -1
- package/dist/PageLayout/paneUtils.d.ts +11 -0
- package/dist/PageLayout/paneUtils.d.ts.map +1 -0
- package/dist/PageLayout/paneUtils.js +34 -0
- package/dist/PageLayout/usePaneWidth.d.ts +2 -1
- package/dist/PageLayout/usePaneWidth.d.ts.map +1 -1
- package/dist/PageLayout/usePaneWidth.js +56 -44
- package/dist/SelectPanel/SelectPanel.d.ts +6 -1
- package/dist/SelectPanel/SelectPanel.d.ts.map +1 -1
- package/dist/SelectPanel/SelectPanel.js +3 -1
- package/dist/TextInput/TextInput-dff8f842.css +2 -0
- package/dist/TextInput/TextInput-dff8f842.css.map +1 -0
- package/dist/TextInput/TextInput.d.ts +5 -0
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +125 -51
- package/dist/TextInput/TextInput.module.css.js +5 -0
- package/dist/Textarea/{TextArea-54099020.css → TextArea-53e27580.css} +2 -2
- package/dist/Textarea/TextArea-53e27580.css.map +1 -0
- package/dist/Textarea/TextArea.module.css.js +2 -2
- package/dist/Textarea/Textarea.d.ts +10 -0
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Textarea/Textarea.js +215 -69
- package/dist/ToggleSwitch/ToggleSwitch-40bab513.css +2 -0
- package/dist/ToggleSwitch/ToggleSwitch-40bab513.css.map +1 -0
- package/dist/ToggleSwitch/ToggleSwitch.module.css.js +1 -1
- package/dist/hooks/useFocusZone.d.ts +4 -0
- package/dist/hooks/useFocusZone.d.ts.map +1 -1
- package/dist/internal/utils/hasInteractiveNodes.d.ts.map +1 -1
- package/dist/internal/utils/hasInteractiveNodes.js +22 -16
- package/dist/utils/__tests__/character-counter.test.d.ts +2 -0
- package/dist/utils/__tests__/character-counter.test.d.ts.map +1 -0
- package/dist/utils/character-counter.d.ts +27 -0
- package/dist/utils/character-counter.d.ts.map +1 -0
- package/dist/utils/character-counter.js +65 -0
- package/generated/components.json +16 -0
- package/package.json +9 -9
- package/dist/BaseStyles-79fd37c4.css.map +0 -1
- package/dist/Dialog/Dialog-1a61e61a.css.map +0 -1
- package/dist/PageLayout/PageLayout-c092f3db.css.map +0 -1
- package/dist/Textarea/TextArea-54099020.css.map +0 -1
- package/dist/ToggleSwitch/ToggleSwitch-d1bd60b0.css +0 -2
- package/dist/ToggleSwitch/ToggleSwitch-d1bd60b0.css.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAe,MAAM,OAAO,CAAA;AAC/D,OAAO,
|
|
1
|
+
{"version":3,"file":"Textarea.d.ts","sourceRoot":"","sources":["../../src/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,sBAAsB,EAAe,MAAM,OAAO,CAAA;AAC/D,OAAO,KAA8C,MAAM,OAAO,CAAA;AAElE,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,qCAAqC,CAAA;AAE7E,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,gBAAgB,CAAA;AAOlD,eAAO,MAAM,qBAAqB,IAAI,CAAA;AACtC,eAAO,MAAM,qBAAqB,KAAK,CAAA;AACvC,eAAO,MAAM,uBAAuB,SAAS,CAAA;AAE7C,MAAM,MAAM,aAAa,GAAG;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,gBAAgB,CAAC,EAAE,oBAAoB,CAAA;IACvC;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAA;IACpD;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,aAAa,CAAA;IAC3B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB,GAAG,sBAAsB,CAAC,mBAAmB,CAAC,CAAA;AAE/C;;;GAGG;AACH,QAAA,MAAM,QAAQ;IA/CZ;;OAEG;eACQ,OAAO;IAClB;;OAEG;uBACgB,oBAAoB;IACvC;;OAEG;YACK,OAAO;IACf;;OAEG;aACM,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU;IACpD;;OAEG;eACQ,OAAO;IAClB;;OAEG;gBACS,MAAM;IAClB;;OAEG;gBACS,MAAM;IAClB;;OAEG;gBACS,MAAM;IAClB;;OAEG;YACK,KAAK,CAAC,aAAa;IAC3B;;;OAGG;qBACc,MAAM;2FAyIxB,CAAA;wBAK0B,cAAc,CAAC,OAAO,QAAQ,CAAC;AAA1D,wBAA0D"}
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef, useId, useEffect } from 'react';
|
|
3
3
|
import { TextInputBaseWrapper } from '../internal/components/TextInputWrapper.js';
|
|
4
4
|
import classes from './TextArea.module.css.js';
|
|
5
|
-
import {
|
|
5
|
+
import { AlertFillIcon } from '@primer/octicons-react';
|
|
6
|
+
import { CharacterCounter } from '../utils/character-counter.js';
|
|
7
|
+
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
8
|
+
import { clsx } from 'clsx';
|
|
9
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
10
|
+
import Text from '../Text/Text.js';
|
|
6
11
|
|
|
7
12
|
const DEFAULT_TEXTAREA_ROWS = 7;
|
|
8
13
|
const DEFAULT_TEXTAREA_COLS = 30;
|
|
@@ -12,13 +17,16 @@ const DEFAULT_TEXTAREA_RESIZE = 'both';
|
|
|
12
17
|
* This component accepts all native HTML <textarea> attributes as props.
|
|
13
18
|
*/
|
|
14
19
|
const Textarea = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
15
|
-
const $ = c(
|
|
20
|
+
const $ = c(68);
|
|
16
21
|
let block;
|
|
22
|
+
let characterLimit;
|
|
17
23
|
let className;
|
|
18
24
|
let contrast;
|
|
25
|
+
let defaultValue;
|
|
19
26
|
let disabled;
|
|
20
27
|
let maxHeight;
|
|
21
28
|
let minHeight;
|
|
29
|
+
let onChange;
|
|
22
30
|
let required;
|
|
23
31
|
let rest;
|
|
24
32
|
let style;
|
|
@@ -42,107 +50,245 @@ const Textarea = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
42
50
|
minHeight,
|
|
43
51
|
maxHeight,
|
|
44
52
|
style,
|
|
53
|
+
characterLimit,
|
|
54
|
+
onChange,
|
|
55
|
+
defaultValue,
|
|
45
56
|
...rest
|
|
46
57
|
} = t0);
|
|
47
58
|
$[0] = t0;
|
|
48
59
|
$[1] = block;
|
|
49
|
-
$[2] =
|
|
50
|
-
$[3] =
|
|
51
|
-
$[4] =
|
|
52
|
-
$[5] =
|
|
53
|
-
$[6] =
|
|
54
|
-
$[7] =
|
|
55
|
-
$[8] =
|
|
56
|
-
$[9] =
|
|
57
|
-
$[10] =
|
|
58
|
-
$[11] =
|
|
59
|
-
$[12] =
|
|
60
|
-
$[13] =
|
|
61
|
-
$[14] =
|
|
60
|
+
$[2] = characterLimit;
|
|
61
|
+
$[3] = className;
|
|
62
|
+
$[4] = contrast;
|
|
63
|
+
$[5] = defaultValue;
|
|
64
|
+
$[6] = disabled;
|
|
65
|
+
$[7] = maxHeight;
|
|
66
|
+
$[8] = minHeight;
|
|
67
|
+
$[9] = onChange;
|
|
68
|
+
$[10] = required;
|
|
69
|
+
$[11] = rest;
|
|
70
|
+
$[12] = style;
|
|
71
|
+
$[13] = t1;
|
|
72
|
+
$[14] = t2;
|
|
73
|
+
$[15] = t3;
|
|
74
|
+
$[16] = validationStatus;
|
|
75
|
+
$[17] = value;
|
|
62
76
|
} else {
|
|
63
77
|
block = $[1];
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
characterLimit = $[2];
|
|
79
|
+
className = $[3];
|
|
80
|
+
contrast = $[4];
|
|
81
|
+
defaultValue = $[5];
|
|
82
|
+
disabled = $[6];
|
|
83
|
+
maxHeight = $[7];
|
|
84
|
+
minHeight = $[8];
|
|
85
|
+
onChange = $[9];
|
|
86
|
+
required = $[10];
|
|
87
|
+
rest = $[11];
|
|
88
|
+
style = $[12];
|
|
89
|
+
t1 = $[13];
|
|
90
|
+
t2 = $[14];
|
|
91
|
+
t3 = $[15];
|
|
92
|
+
validationStatus = $[16];
|
|
93
|
+
value = $[17];
|
|
77
94
|
}
|
|
78
95
|
const rows = t1 === undefined ? DEFAULT_TEXTAREA_ROWS : t1;
|
|
79
96
|
const cols = t2 === undefined ? DEFAULT_TEXTAREA_COLS : t2;
|
|
80
97
|
const resize = t3 === undefined ? DEFAULT_TEXTAREA_RESIZE : t3;
|
|
81
|
-
const
|
|
98
|
+
const [characterCount, setCharacterCount] = React.useState("");
|
|
99
|
+
const [isOverLimit, setIsOverLimit] = React.useState(false);
|
|
100
|
+
const [screenReaderMessage, setScreenReaderMessage] = React.useState("");
|
|
101
|
+
const characterCounterRef = useRef(null);
|
|
102
|
+
const characterCountId = useId();
|
|
103
|
+
const characterCountStaticMessageId = useId();
|
|
104
|
+
let t4;
|
|
82
105
|
let t5;
|
|
83
|
-
if ($[
|
|
84
|
-
|
|
106
|
+
if ($[18] !== characterLimit) {
|
|
107
|
+
t4 = () => {
|
|
108
|
+
if (characterLimit) {
|
|
109
|
+
characterCounterRef.current = new CharacterCounter({
|
|
110
|
+
onCountUpdate: (count, overLimit, message) => {
|
|
111
|
+
setCharacterCount(message);
|
|
112
|
+
setIsOverLimit(overLimit);
|
|
113
|
+
},
|
|
114
|
+
onScreenReaderAnnounce: message_0 => {
|
|
115
|
+
setScreenReaderMessage(message_0);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
return () => {
|
|
119
|
+
var _characterCounterRef$;
|
|
120
|
+
(_characterCounterRef$ = characterCounterRef.current) === null || _characterCounterRef$ === void 0 ? void 0 : _characterCounterRef$.cleanup();
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
t5 = [characterLimit];
|
|
125
|
+
$[18] = characterLimit;
|
|
126
|
+
$[19] = t4;
|
|
127
|
+
$[20] = t5;
|
|
128
|
+
} else {
|
|
129
|
+
t4 = $[19];
|
|
130
|
+
t5 = $[20];
|
|
131
|
+
}
|
|
132
|
+
useEffect(t4, t5);
|
|
133
|
+
let t6;
|
|
134
|
+
let t7;
|
|
135
|
+
if ($[21] !== characterLimit || $[22] !== defaultValue || $[23] !== value) {
|
|
136
|
+
t6 = () => {
|
|
137
|
+
if (characterLimit && characterCounterRef.current) {
|
|
138
|
+
const currentValue = value !== undefined ? String(value) : defaultValue !== undefined ? String(defaultValue) : "";
|
|
139
|
+
characterCounterRef.current.updateCharacterCount(currentValue.length, characterLimit);
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
t7 = [value, defaultValue, characterLimit];
|
|
143
|
+
$[21] = characterLimit;
|
|
144
|
+
$[22] = defaultValue;
|
|
145
|
+
$[23] = value;
|
|
146
|
+
$[24] = t6;
|
|
147
|
+
$[25] = t7;
|
|
148
|
+
} else {
|
|
149
|
+
t6 = $[24];
|
|
150
|
+
t7 = $[25];
|
|
151
|
+
}
|
|
152
|
+
useEffect(t6, t7);
|
|
153
|
+
let t8;
|
|
154
|
+
if ($[26] !== characterLimit || $[27] !== onChange) {
|
|
155
|
+
t8 = e => {
|
|
156
|
+
var _onChange;
|
|
157
|
+
if (characterLimit && characterCounterRef.current) {
|
|
158
|
+
characterCounterRef.current.updateCharacterCount(e.target.value.length, characterLimit);
|
|
159
|
+
}
|
|
160
|
+
(_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(e);
|
|
161
|
+
};
|
|
162
|
+
$[26] = characterLimit;
|
|
163
|
+
$[27] = onChange;
|
|
164
|
+
$[28] = t8;
|
|
165
|
+
} else {
|
|
166
|
+
t8 = $[28];
|
|
167
|
+
}
|
|
168
|
+
const handleTextareaChange = t8;
|
|
169
|
+
const isValid = isOverLimit ? "error" : validationStatus;
|
|
170
|
+
const t9 = isValid === "error" ? "true" : "false";
|
|
171
|
+
let t10;
|
|
172
|
+
if ($[29] !== maxHeight || $[30] !== minHeight || $[31] !== style) {
|
|
173
|
+
t10 = {
|
|
85
174
|
minHeight,
|
|
86
175
|
maxHeight,
|
|
87
176
|
...style
|
|
88
177
|
};
|
|
89
|
-
$[
|
|
90
|
-
$[
|
|
91
|
-
$[
|
|
92
|
-
$[
|
|
178
|
+
$[29] = maxHeight;
|
|
179
|
+
$[30] = minHeight;
|
|
180
|
+
$[31] = style;
|
|
181
|
+
$[32] = t10;
|
|
93
182
|
} else {
|
|
94
|
-
|
|
183
|
+
t10 = $[32];
|
|
95
184
|
}
|
|
96
|
-
let
|
|
97
|
-
if ($[
|
|
98
|
-
|
|
185
|
+
let t11;
|
|
186
|
+
if ($[33] !== characterCountStaticMessageId || $[34] !== characterLimit || $[35] !== rest) {
|
|
187
|
+
t11 = characterLimit ? [characterCountStaticMessageId, rest["aria-describedby"]].filter(Boolean).join(" ") || undefined : rest["aria-describedby"];
|
|
188
|
+
$[33] = characterCountStaticMessageId;
|
|
189
|
+
$[34] = characterLimit;
|
|
190
|
+
$[35] = rest;
|
|
191
|
+
$[36] = t11;
|
|
192
|
+
} else {
|
|
193
|
+
t11 = $[36];
|
|
194
|
+
}
|
|
195
|
+
let t12;
|
|
196
|
+
if ($[37] !== cols || $[38] !== defaultValue || $[39] !== disabled || $[40] !== handleTextareaChange || $[41] !== ref || $[42] !== required || $[43] !== resize || $[44] !== rest || $[45] !== rows || $[46] !== t10 || $[47] !== t11 || $[48] !== t9 || $[49] !== value) {
|
|
197
|
+
t12 = /*#__PURE__*/jsx("textarea", {
|
|
99
198
|
value: value,
|
|
199
|
+
defaultValue: defaultValue,
|
|
100
200
|
"data-resize": resize,
|
|
101
201
|
"aria-required": required,
|
|
102
|
-
"aria-invalid":
|
|
202
|
+
"aria-invalid": t9,
|
|
103
203
|
ref: ref,
|
|
104
204
|
disabled: disabled,
|
|
105
205
|
rows: rows,
|
|
106
206
|
cols: cols,
|
|
107
207
|
className: classes.TextArea,
|
|
108
|
-
|
|
109
|
-
|
|
208
|
+
onChange: handleTextareaChange,
|
|
209
|
+
style: t10,
|
|
210
|
+
...rest,
|
|
211
|
+
"aria-describedby": t11
|
|
110
212
|
});
|
|
111
|
-
$[
|
|
112
|
-
$[
|
|
113
|
-
$[
|
|
114
|
-
$[
|
|
115
|
-
$[
|
|
116
|
-
$[
|
|
117
|
-
$[
|
|
118
|
-
$[
|
|
119
|
-
$[
|
|
120
|
-
$[
|
|
121
|
-
$[
|
|
213
|
+
$[37] = cols;
|
|
214
|
+
$[38] = defaultValue;
|
|
215
|
+
$[39] = disabled;
|
|
216
|
+
$[40] = handleTextareaChange;
|
|
217
|
+
$[41] = ref;
|
|
218
|
+
$[42] = required;
|
|
219
|
+
$[43] = resize;
|
|
220
|
+
$[44] = rest;
|
|
221
|
+
$[45] = rows;
|
|
222
|
+
$[46] = t10;
|
|
223
|
+
$[47] = t11;
|
|
224
|
+
$[48] = t9;
|
|
225
|
+
$[49] = value;
|
|
226
|
+
$[50] = t12;
|
|
122
227
|
} else {
|
|
123
|
-
|
|
228
|
+
t12 = $[50];
|
|
124
229
|
}
|
|
125
|
-
let
|
|
126
|
-
if ($[
|
|
127
|
-
|
|
128
|
-
validationStatus:
|
|
230
|
+
let t13;
|
|
231
|
+
if ($[51] !== block || $[52] !== className || $[53] !== contrast || $[54] !== disabled || $[55] !== isValid || $[56] !== t12) {
|
|
232
|
+
t13 = /*#__PURE__*/jsx(TextInputBaseWrapper, {
|
|
233
|
+
validationStatus: isValid,
|
|
129
234
|
disabled: disabled,
|
|
130
235
|
block: block,
|
|
131
236
|
contrast: contrast,
|
|
132
237
|
className: className,
|
|
133
|
-
children:
|
|
238
|
+
children: t12
|
|
239
|
+
});
|
|
240
|
+
$[51] = block;
|
|
241
|
+
$[52] = className;
|
|
242
|
+
$[53] = contrast;
|
|
243
|
+
$[54] = disabled;
|
|
244
|
+
$[55] = isValid;
|
|
245
|
+
$[56] = t12;
|
|
246
|
+
$[57] = t13;
|
|
247
|
+
} else {
|
|
248
|
+
t13 = $[57];
|
|
249
|
+
}
|
|
250
|
+
let t14;
|
|
251
|
+
if ($[58] !== characterCount || $[59] !== characterCountId || $[60] !== characterCountStaticMessageId || $[61] !== characterLimit || $[62] !== isOverLimit || $[63] !== screenReaderMessage) {
|
|
252
|
+
t14 = characterLimit && /*#__PURE__*/jsxs(Fragment, {
|
|
253
|
+
children: [/*#__PURE__*/jsx(VisuallyHidden, {
|
|
254
|
+
"aria-live": "polite",
|
|
255
|
+
role: "status",
|
|
256
|
+
children: screenReaderMessage
|
|
257
|
+
}), /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
258
|
+
id: characterCountStaticMessageId,
|
|
259
|
+
children: ["You can enter up to ", characterLimit, " ", characterLimit === 1 ? "character" : "characters"]
|
|
260
|
+
}), /*#__PURE__*/jsxs(Text, {
|
|
261
|
+
"aria-hidden": "true",
|
|
262
|
+
id: characterCountId,
|
|
263
|
+
size: "small",
|
|
264
|
+
className: clsx(classes.CharacterCounter, isOverLimit && classes["CharacterCounter--error"]),
|
|
265
|
+
children: [isOverLimit && /*#__PURE__*/jsx(AlertFillIcon, {
|
|
266
|
+
size: 16
|
|
267
|
+
}), characterCount]
|
|
268
|
+
})]
|
|
269
|
+
});
|
|
270
|
+
$[58] = characterCount;
|
|
271
|
+
$[59] = characterCountId;
|
|
272
|
+
$[60] = characterCountStaticMessageId;
|
|
273
|
+
$[61] = characterLimit;
|
|
274
|
+
$[62] = isOverLimit;
|
|
275
|
+
$[63] = screenReaderMessage;
|
|
276
|
+
$[64] = t14;
|
|
277
|
+
} else {
|
|
278
|
+
t14 = $[64];
|
|
279
|
+
}
|
|
280
|
+
let t15;
|
|
281
|
+
if ($[65] !== t13 || $[66] !== t14) {
|
|
282
|
+
t15 = /*#__PURE__*/jsxs(Fragment, {
|
|
283
|
+
children: [t13, t14]
|
|
134
284
|
});
|
|
135
|
-
$[
|
|
136
|
-
$[
|
|
137
|
-
$[
|
|
138
|
-
$[33] = disabled;
|
|
139
|
-
$[34] = t6;
|
|
140
|
-
$[35] = validationStatus;
|
|
141
|
-
$[36] = t7;
|
|
285
|
+
$[65] = t13;
|
|
286
|
+
$[66] = t14;
|
|
287
|
+
$[67] = t15;
|
|
142
288
|
} else {
|
|
143
|
-
|
|
289
|
+
t15 = $[67];
|
|
144
290
|
}
|
|
145
|
-
return
|
|
291
|
+
return t15;
|
|
146
292
|
});
|
|
147
293
|
Textarea.displayName = 'Textarea';
|
|
148
294
|
Textarea.__SLOT__ = Symbol('Textarea');
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-ToggleSwitch-ToggleSwitch-rQz-0{--toggleSwitch-transition-duration:80ms;--toggleSwitch-transition-easing:cubic-bezier(0.5,1,0.89,1);align-items:center;display:inline-flex}.prc-ToggleSwitch-ToggleSwitch-rQz-0:where([data-status-label-position=start]){flex-direction:row}.prc-ToggleSwitch-ToggleSwitch-rQz-0:where([data-status-label-position=end]){flex-direction:row-reverse}.prc-ToggleSwitch-LoadingSpinner--4KG4{display:inline-flex}.prc-ToggleSwitch-LoadingSpinner--4KG4:where([data-status-label-position=end]){margin-left:var(--base-size-8,.5rem);margin-right:0}.prc-ToggleSwitch-StatusText-7fNOA{color:var(--fgColor-default,var(--color-fg-default));cursor:pointer;font-size:var(--text-body-size-medium,.875rem);margin-left:var(--base-size-8,.5rem);margin-right:var(--base-size-8,.5rem);position:relative}.prc-ToggleSwitch-StatusText-7fNOA:where([data-disabled=true]){color:var(--fgColor-muted,var(--color-fg-muted));cursor:not-allowed}.prc-ToggleSwitch-StatusText-7fNOA:where([data-size=small]){font-size:var(--text-body-size-small,.75rem)}.prc-ToggleSwitch-StatusText-7fNOA:where([data-size=medium]){font-size:var(--text-body-size-medium,.875rem)}.prc-ToggleSwitch-StatusTextItem-VE86e{display:block;text-align:right}.prc-ToggleSwitch-StatusTextItem-VE86e:where([data-hidden=true]){height:0;overflow:hidden;visibility:hidden}.prc-ToggleSwitch-SwitchButton-1CtM6{appearance:none;border-radius:var(--borderRadius-medium,.375rem);border-style:solid;border-width:var(--borderWidth-thin,.0625rem);cursor:pointer;display:block;height:32px;overflow:hidden;padding:0;position:relative;-webkit-text-decoration:none;text-decoration:none;transition-duration:var(--toggleSwitch-transition-duration);transition-property:background-color,border-color;transition-timing-function:var(--toggleSwitch-transition-easing);-webkit-user-select:none;user-select:none;width:64px}.prc-ToggleSwitch-SwitchButton-1CtM6:focus-visible{outline:2px solid var(--focus-outlineColor,var(--color-accent-fg));outline-offset:3px}.prc-ToggleSwitch-SwitchButton-1CtM6:focus:not(:focus-visible){outline:1px solid transparent}@media (pointer:coarse){.prc-ToggleSwitch-SwitchButton-1CtM6:before{content:"";left:0;min-height:44px;position:absolute;right:0;top:50%;transform:translateY(-50%)}}@media (prefers-reduced-motion){.prc-ToggleSwitch-SwitchButton-1CtM6,.prc-ToggleSwitch-SwitchButton-1CtM6 *{transition:none}}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-size=small]){height:24px;width:48px}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-disabled=true]){background-color:var(--controlTrack-bgColor-disabled,var(--color-switch-track-disabled-bg,#8c959f));border-color:transparent;cursor:not-allowed;transition-property:none}@media (forced-colors:active){.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-disabled=true]){border-color:GrayText}}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=false]:not([data-disabled=true])){background-color:var(--controlTrack-bgColor-rest,var(--color-switch-track-bg,#eaeef2));border-color:var(--controlTrack-borderColor-rest,var(--color-switch-track-border))}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=false]:not([data-disabled=true]):focus-visible),.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=false]:not([data-disabled=true]):hover){background-color:var(--controlTrack-bgColor-hover,var(--color-switch-track-hover-bg,#dfe6ec))}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=false]:not([data-disabled=true]):active),.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=false]:not([data-disabled=true]):active:focus-visible){background-color:var(--controlTrack-bgColor-active,var(--color-switch-track-active-bg,#d9e0e8))}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=true]:not([data-disabled=true])){background-color:var(--control-checked-bgColor-rest,var(--color-switch-track-checked-bg,#0969da));border-color:var(--control-checked-borderColor-rest,transparent)}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=true]:not([data-disabled=true]):focus-visible),.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=true]:not([data-disabled=true]):hover){background-color:var(--control-checked-bgColor-hover,var(--color-switch-track-checked-hover-bg,#0860ca))}.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=true]:not([data-disabled=true]):active),.prc-ToggleSwitch-SwitchButton-1CtM6:where([data-checked=true]:not([data-disabled=true]):active:focus-visible){background-color:var(--control-checked-bgColor-active,var(--color-switch-track-checked-active-bg,#0757ba))}.prc-ToggleSwitch-SwitchButtonContent-u57jo{align-items:center;display:flex;height:100%;overflow:hidden;width:100%}.prc-ToggleSwitch-IconContainer-mUpUm{flex-basis:50%;flex-grow:1;flex-shrink:0;line-height:0;transition-duration:var(--toggleSwitch-transition-duration);transition-property:transform;transition-timing-function:var(--toggleSwitch-transition-easing)}@media (prefers-reduced-motion){.prc-ToggleSwitch-IconContainer-mUpUm{transition:none}}.prc-ToggleSwitch-LineIconContainer-cn8pC{color:var(--control-checked-fgColor-rest,var(--color-switch-track-checked-fg,#fff))}.prc-ToggleSwitch-LineIconContainer-cn8pC:where([data-disabled=true]){color:var(--control-checked-fgColor-disabled,var(--color-switch-track-checked-disabled-fg,#fff))}.prc-ToggleSwitch-LineIconContainer-cn8pC:where([data-checked=true]){transform:translateX(0)}.prc-ToggleSwitch-LineIconContainer-cn8pC:where([data-checked=false]){transform:translateX(-100%)}.prc-ToggleSwitch-CircleIconContainer-XiMW5{color:var(--controlTrack-fgColor-rest,var(--color-switch-track-fg,#656d76))}.prc-ToggleSwitch-CircleIconContainer-XiMW5:where([data-disabled=true]){color:var(--controlTrack-fgColor-disabled,var(--color-switch-track-disabled-fg,#fff))}.prc-ToggleSwitch-CircleIconContainer-XiMW5:where([data-checked=true]){transform:translateX(100%)}.prc-ToggleSwitch-CircleIconContainer-XiMW5:where([data-checked=false]){transform:translateX(0)}.prc-ToggleSwitch-ToggleKnob-N9ops{background-color:var(--controlKnob-bgColor-rest,var(--color-switch-knob-bg,#fff));border-color:var(--controlKnob-borderColor-rest,var(--color-switch-knob-border,#858f99));border-radius:calc(var(--borderRadius-medium,.375rem) - var(--borderWidth-thin,.0625rem));border-style:solid;border-width:var(--borderWidth-thin,.0625rem);bottom:0;position:absolute;top:0;transition-duration:var(--toggleSwitch-transition-duration);transition-property:transform;transition-timing-function:var(--toggleSwitch-transition-easing);width:50%;z-index:1}@media (prefers-reduced-motion){.prc-ToggleSwitch-ToggleKnob-N9ops{transition:none}}.prc-ToggleSwitch-ToggleKnob-N9ops:where([data-checked=false]){transform:translateX(0)}.prc-ToggleSwitch-ToggleKnob-N9ops:where([data-checked=true]){border-color:var(--controlKnob-borderColor-checked,var(--color-switch-knob-checked-border,#0969da));transform:translateX(100%)}.prc-ToggleSwitch-ToggleKnob-N9ops:where([data-disabled=true]){background-color:var(--controlKnob-bgColor-disabled,var(--color-btn-bg));border-color:var(--controlTrack-bgColor-disabled,var(--color-switch-track-disabled-bg,#8c959f))}@media (forced-colors:active){.prc-ToggleSwitch-ToggleKnob-N9ops:where([data-disabled=true]){color:GrayText}}
|
|
2
|
+
/*# sourceMappingURL=ToggleSwitch-40bab513.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/ToggleSwitch/ToggleSwitch.module.css.js"],"names":[],"mappings":"AAAA,qCACE,uCAAwC,CACxC,2DAA+D,CAG/D,kBAAmB,CADnB,mBAEF,CAEA,+EACE,kBACF,CAEA,6EACE,0BACF,CAEA,uCACE,mBACF,CAEA,+EAEE,oCAA+B,CAD/B,cAEF,CAEA,mCAIE,oDAA6B,CAE7B,cAAe,CADf,8CAAuC,CAJvC,oCAA+B,CAC/B,qCAAgC,CAChC,iBAIF,CAEA,+DAEE,gDAA2B,CAD3B,kBAEF,CAEA,4DACE,4CACF,CAEA,6DACE,8CACF,CAEA,uCACE,aAAc,CACd,gBACF,CAEA,iEAEE,QAAS,CACT,eAAgB,CAFhB,iBAGF,CAEA,qCAGE,eAAgB,CAMhB,gDAAyC,CACzC,kBAAmB,CACnB,6CAAqC,CAVrC,cAAe,CAWf,aAAc,CAKd,WAAY,CAHZ,eAAgB,CAThB,SAAU,CAQV,iBAAkB,CATlB,4BAAqB,CAArB,oBAAqB,CAGrB,2DAA4D,CAD5D,iDAAmD,CAEnD,gEAAiE,CANjE,wBAAiB,CAAjB,gBAAiB,CAgBjB,UAiCF,CA9BE,mDACE,kEAA4C,CAC5C,kBACF,CAEA,+DACE,6BACF,CAGA,wBACE,4CACE,UAAW,CAEX,MAAO,CAIP,eAAgB,CALhB,iBAAkB,CAElB,OAAQ,CAER,OAAQ,CADR,0BAGF,CACF,CAGA,gCAGE,4EACE,eACF,CACF,CAIF,8DACE,WAAY,CACZ,UACF,CAGA,iEAEE,mGAAsG,CACtG,wBAAyB,CACzB,kBAAmB,CACnB,wBAKF,CAHE,8BAPF,iEAQI,qBAEJ,CADE,CAGF,2FAEE,sFAAyF,CACzF,kFACF,CAEA,0MAGE,6FACF,CAEA,kNAGE,+FACF,CAEA,0FAEE,iGAAoG,CACpG,gEACF,CAEA,wMAGE,wGACF,CAEA,gNAGE,0GACF,CAEA,4CAEE,kBAAmB,CADnB,YAAa,CAGb,WAAY,CACZ,eAAgB,CAFhB,UAGF,CAEA,sCAGE,cAAe,CAFf,WAAY,CACZ,aAAc,CAGd,aAAc,CAEd,2DAA4D,CAD5D,6BAA8B,CAE9B,gEAKF,CAHE,gCAVF,sCAWI,eAEJ,CADE,CAGF,0CAEE,mFACF,CAEA,sEAEE,gGACF,CAEA,qEACE,uBACF,CAEA,sEACE,2BACF,CAEA,4CAEE,2EACF,CAEA,wEAEE,qFACF,CAEA,uEACE,0BACF,CAEA,wEACE,uBACF,CAEA,mCAEE,iFAAoF,CAIpF,wFAA2F,CAG3F,yFAAyE,CALzE,kBAAmB,CADnB,6CAAqC,CAUrC,QAAS,CAFT,iBAAkB,CAClB,KAAM,CAGN,2DAA4D,CAD5D,6BAA8B,CAE9B,gEAAiE,CANjE,SAAU,CAOV,SAKF,CAHE,gCAnBF,mCAoBI,eAEJ,CADE,CAGF,+DACE,uBACF,CAEA,8DAGE,mGAAsG,CAFtG,0BAGF,CAEA,+DACE,wEAAqD,CAErD,+FAKF,CAHE,8BALF,+DAMI,cAEJ,CADE","file":"ToggleSwitch-40bab513.css","sourcesContent":[".ToggleSwitch {\n --toggleSwitch-transition-duration: 80ms;\n --toggleSwitch-transition-easing: cubic-bezier(0.5, 1, 0.89, 1);\n\n display: inline-flex;\n align-items: center;\n}\n\n.ToggleSwitch:where([data-status-label-position='start']) {\n flex-direction: row;\n}\n\n.ToggleSwitch:where([data-status-label-position='end']) {\n flex-direction: row-reverse;\n}\n\n.LoadingSpinner {\n display: inline-flex;\n}\n\n.LoadingSpinner:where([data-status-label-position='end']) {\n margin-right: 0;\n margin-left: var(--base-size-8);\n}\n\n.StatusText {\n margin-left: var(--base-size-8);\n margin-right: var(--base-size-8);\n position: relative;\n color: var(--fgColor-default);\n font-size: var(--text-body-size-medium);\n cursor: pointer;\n}\n\n.StatusText:where([data-disabled='true']) {\n cursor: not-allowed;\n color: var(--fgColor-muted);\n}\n\n.StatusText:where([data-size='small']) {\n font-size: var(--text-body-size-small);\n}\n\n.StatusText:where([data-size='medium']) {\n font-size: var(--text-body-size-medium);\n}\n\n.StatusTextItem {\n display: block;\n text-align: right;\n}\n\n.StatusTextItem:where([data-hidden='true']) {\n visibility: hidden;\n height: 0;\n overflow: hidden;\n}\n\n.SwitchButton {\n cursor: pointer;\n user-select: none;\n appearance: none;\n text-decoration: none;\n padding: 0;\n transition-property: background-color, border-color;\n transition-duration: var(--toggleSwitch-transition-duration);\n transition-timing-function: var(--toggleSwitch-transition-easing);\n border-radius: var(--borderRadius-medium);\n border-style: solid;\n border-width: var(--borderWidth-thin);\n display: block;\n position: relative;\n overflow: hidden;\n\n /* Default medium size */\n height: 32px;\n width: 64px;\n\n /* Focus styles */\n &:focus-visible {\n outline: 2px solid var(--focus-outlineColor);\n outline-offset: 3px;\n }\n\n &:focus:not(:focus-visible) {\n outline: solid 1px transparent;\n }\n\n /* Touch device support */\n @media (pointer: coarse) {\n &::before {\n content: '';\n position: absolute;\n left: 0;\n right: 0;\n transform: translateY(-50%);\n top: 50%;\n min-height: 44px;\n }\n }\n\n /* Reduced motion support */\n @media (prefers-reduced-motion) {\n transition: none;\n\n * {\n transition: none;\n }\n }\n}\n\n/* Size variants */\n.SwitchButton:where([data-size='small']) {\n height: 24px;\n width: 48px;\n}\n\n/* State variants */\n.SwitchButton:where([data-disabled='true']) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--controlTrack-bgColor-disabled, var(--color-switch-track-disabled-bg, #8c959f));\n border-color: transparent;\n cursor: not-allowed;\n transition-property: none;\n\n @media (forced-colors: active) {\n border-color: GrayText;\n }\n}\n\n.SwitchButton:where([data-checked='false']:not([data-disabled='true'])) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--controlTrack-bgColor-rest, var(--color-switch-track-bg, #eaeef2));\n border-color: var(--controlTrack-borderColor-rest);\n}\n\n.SwitchButton:where([data-checked='false']:not([data-disabled='true']):hover),\n.SwitchButton:where([data-checked='false']:not([data-disabled='true']):focus-visible) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--controlTrack-bgColor-hover, var(--color-switch-track-hover-bg, hsl(210deg, 24%, 90%, 1)));\n}\n\n.SwitchButton:where([data-checked='false']:not([data-disabled='true']):active),\n.SwitchButton:where([data-checked='false']:not([data-disabled='true']):active:focus-visible) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--controlTrack-bgColor-active, var(--color-switch-track-active-bg, hsl(210deg, 24%, 88%, 1)));\n}\n\n.SwitchButton:where([data-checked='true']:not([data-disabled='true'])) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-bgColor-rest, var(--color-switch-track-checked-bg, #0969da));\n border-color: var(--control-checked-borderColor-rest, transparent);\n}\n\n.SwitchButton:where([data-checked='true']:not([data-disabled='true']):hover),\n.SwitchButton:where([data-checked='true']:not([data-disabled='true']):focus-visible) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-bgColor-hover, var(--color-switch-track-checked-hover-bg, #0860ca));\n}\n\n.SwitchButton:where([data-checked='true']:not([data-disabled='true']):active),\n.SwitchButton:where([data-checked='true']:not([data-disabled='true']):active:focus-visible) {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--control-checked-bgColor-active, var(--color-switch-track-checked-active-bg, #0757ba));\n}\n\n.SwitchButtonContent {\n display: flex;\n align-items: center;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n.IconContainer {\n flex-grow: 1;\n flex-shrink: 0;\n flex-basis: 50%;\n /* stylelint-disable-next-line primer/typography */\n line-height: 0;\n transition-property: transform;\n transition-duration: var(--toggleSwitch-transition-duration);\n transition-timing-function: var(--toggleSwitch-transition-easing);\n\n @media (prefers-reduced-motion) {\n transition: none;\n }\n}\n\n.LineIconContainer {\n /* stylelint-disable-next-line primer/colors */\n color: var(--control-checked-fgColor-rest, var(--color-switch-track-checked-fg, #fff));\n}\n\n.LineIconContainer:where([data-disabled='true']) {\n /* stylelint-disable-next-line primer/colors */\n color: var(--control-checked-fgColor-disabled, var(--color-switch-track-checked-disabled-fg, #fff));\n}\n\n.LineIconContainer:where([data-checked='true']) {\n transform: translateX(0);\n}\n\n.LineIconContainer:where([data-checked='false']) {\n transform: translateX(-100%);\n}\n\n.CircleIconContainer {\n /* stylelint-disable-next-line primer/colors */\n color: var(--controlTrack-fgColor-rest, var(--color-switch-track-fg, #656d76));\n}\n\n.CircleIconContainer:where([data-disabled='true']) {\n /* stylelint-disable-next-line primer/colors */\n color: var(--controlTrack-fgColor-disabled, var(--color-switch-track-disabled-fg, #fff));\n}\n\n.CircleIconContainer:where([data-checked='true']) {\n transform: translateX(100%);\n}\n\n.CircleIconContainer:where([data-checked='false']) {\n transform: translateX(0);\n}\n\n.ToggleKnob {\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--controlKnob-bgColor-rest, var(--color-switch-knob-bg, #fff));\n border-width: var(--borderWidth-thin);\n border-style: solid;\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--controlKnob-borderColor-rest, var(--color-switch-knob-border, #858f99));\n /* Use calc to account for 1px border around the control */\n /* stylelint-disable-next-line primer/borders */\n border-radius: calc(var(--borderRadius-medium) - var(--borderWidth-thin));\n width: 50%;\n position: absolute;\n top: 0;\n bottom: 0;\n transition-property: transform;\n transition-duration: var(--toggleSwitch-transition-duration);\n transition-timing-function: var(--toggleSwitch-transition-easing);\n z-index: 1;\n\n @media (prefers-reduced-motion) {\n transition: none;\n }\n}\n\n.ToggleKnob:where([data-checked='false']) {\n transform: translateX(0);\n}\n\n.ToggleKnob:where([data-checked='true']) {\n transform: translateX(100%);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--controlKnob-borderColor-checked, var(--color-switch-knob-checked-border, #0969da));\n}\n\n.ToggleKnob:where([data-disabled='true']) {\n background-color: var(--controlKnob-bgColor-disabled);\n /* stylelint-disable-next-line primer/colors */\n border-color: var(--controlTrack-bgColor-disabled, var(--color-switch-track-disabled-bg, #8c959f));\n\n @media (forced-colors: active) {\n color: GrayText;\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import './ToggleSwitch-
|
|
1
|
+
import './ToggleSwitch-40bab513.css';
|
|
2
2
|
|
|
3
3
|
var classes = {"ToggleSwitch":"prc-ToggleSwitch-ToggleSwitch-rQz-0","LoadingSpinner":"prc-ToggleSwitch-LoadingSpinner--4KG4","StatusText":"prc-ToggleSwitch-StatusText-7fNOA","StatusTextItem":"prc-ToggleSwitch-StatusTextItem-VE86e","SwitchButton":"prc-ToggleSwitch-SwitchButton-1CtM6","SwitchButtonContent":"prc-ToggleSwitch-SwitchButtonContent-u57jo","IconContainer":"prc-ToggleSwitch-IconContainer-mUpUm","LineIconContainer":"prc-ToggleSwitch-LineIconContainer-cn8pC","CircleIconContainer":"prc-ToggleSwitch-CircleIconContainer-XiMW5","ToggleKnob":"prc-ToggleSwitch-ToggleKnob-N9ops"};
|
|
4
4
|
|
|
@@ -18,6 +18,10 @@ export interface FocusZoneHookSettings extends Omit<FocusZoneSettings, 'activeDe
|
|
|
18
18
|
* any time.
|
|
19
19
|
*/
|
|
20
20
|
disabled?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Set to true to allow focus to move to elements that are dynamically prepended to the container.
|
|
23
|
+
*/
|
|
24
|
+
focusPrependedElements?: boolean;
|
|
21
25
|
}
|
|
22
26
|
export declare function useFocusZone(settings?: FocusZoneHookSettings, dependencies?: React.DependencyList): {
|
|
23
27
|
containerRef: React.RefObject<HTMLElement | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFocusZone.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusZone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAC3C,YAAY,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IAC/F;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAElD;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErE;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"useFocusZone.d.ts","sourceRoot":"","sources":["../../src/hooks/useFocusZone.ts"],"names":[],"mappings":"AAAA,OAAO,KAAkB,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,mBAAmB,CAAA;AAExD,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAC3C,YAAY,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAA;AAEhD,MAAM,WAAW,qBAAsB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,yBAAyB,CAAC;IAC/F;;;OAGG;IACH,YAAY,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAElD;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IAErE;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAElB;;OAEG;IACH,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC;AAED,wBAAgB,YAAY,CAC1B,QAAQ,GAAE,qBAA0B,EACpC,YAAY,GAAE,KAAK,CAAC,cAAmB,GACtC;IACD,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;IACjD,0BAA0B,EAAE,KAAK,CAAC,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAA;CAChE,CAoCA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasInteractiveNodes.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/hasInteractiveNodes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hasInteractiveNodes.d.ts","sourceRoot":"","sources":["../../../src/internal/utils/hasInteractiveNodes.ts"],"names":[],"mappings":"AA2BA;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,EAAE,WAAW,CAAC,EAAE,WAAW,EAAE,WAkBxF"}
|
|
@@ -7,6 +7,9 @@ const nonValidSelectors = {
|
|
|
7
7
|
const interactiveElementsSelectors = [`a[href]`, `button`, 'summary', 'select', 'input:not([type=hidden])', 'textarea', '[tabindex="0"]', `audio[controls]`, `video[controls]`, `[contenteditable]`];
|
|
8
8
|
const interactiveElements = interactiveElementsSelectors.map(selector => `${selector}:not(${Object.values(nonValidSelectors).join('):not(')})`);
|
|
9
9
|
|
|
10
|
+
// Combined selector for fast querySelector check
|
|
11
|
+
const interactiveSelector = interactiveElements.join(', ');
|
|
12
|
+
|
|
10
13
|
/**
|
|
11
14
|
* Finds interactive nodes within the passed node.
|
|
12
15
|
* If the node itself is interactive, or children within are, it will return true.
|
|
@@ -23,26 +26,29 @@ function hasInteractiveNodes(node, ignoreNodes) {
|
|
|
23
26
|
// If one does exist, we can abort early.
|
|
24
27
|
|
|
25
28
|
const nodesToIgnore = [node];
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
|
|
30
|
+
// Performance optimization: Use querySelectorAll with combined selector first
|
|
31
|
+
// This avoids recursive getComputedStyle calls for each node
|
|
32
|
+
const candidates = node.querySelectorAll(interactiveSelector);
|
|
33
|
+
for (const candidate of candidates) {
|
|
34
|
+
if (!nodesToIgnore.includes(candidate) && !isNonValidInteractiveNode(candidate)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return false;
|
|
28
39
|
}
|
|
40
|
+
|
|
41
|
+
// Note: Only call getComputedStyle when CSS-based checks are insufficient
|
|
29
42
|
function isNonValidInteractiveNode(node) {
|
|
30
|
-
|
|
43
|
+
// Fast path: Check attribute-based states first (no style recalc needed)
|
|
31
44
|
const isNonInteractive = node.matches('[disabled], [hidden], [inert]');
|
|
45
|
+
if (isNonInteractive) return true;
|
|
46
|
+
|
|
47
|
+
// Only call getComputedStyle if attribute checks passed
|
|
48
|
+
// This is necessary for display:none and visibility:hidden which aren't detectable via attributes
|
|
49
|
+
const nodeStyle = getComputedStyle(node);
|
|
32
50
|
const isHiddenVisually = nodeStyle.display === 'none' || nodeStyle.visibility === 'hidden';
|
|
33
|
-
return
|
|
34
|
-
}
|
|
35
|
-
function findInteractiveChildNodes(node, ignoreNodes) {
|
|
36
|
-
if (!node) return;
|
|
37
|
-
const ignoreSelector = ignoreNodes.find(elem => elem === node);
|
|
38
|
-
const isNotValidNode = isNonValidInteractiveNode(node);
|
|
39
|
-
if (node.matches(interactiveElements.join(', ')) && !ignoreSelector && !isNotValidNode) {
|
|
40
|
-
return node;
|
|
41
|
-
}
|
|
42
|
-
for (const child of node.children) {
|
|
43
|
-
const interactiveNode = findInteractiveChildNodes(child, ignoreNodes);
|
|
44
|
-
if (interactiveNode) return true;
|
|
45
|
-
}
|
|
51
|
+
return isHiddenVisually;
|
|
46
52
|
}
|
|
47
53
|
|
|
48
54
|
export { hasInteractiveNodes };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"character-counter.test.d.ts","sourceRoot":"","sources":["../../../src/utils/__tests__/character-counter.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared character counting functionality for text inputs with character limits.
|
|
3
|
+
* Handles real-time character count updates, validation, and aria-live announcements.
|
|
4
|
+
*/
|
|
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;
|
|
18
|
+
/**
|
|
19
|
+
* Announce character count to screen readers with debouncing
|
|
20
|
+
*/
|
|
21
|
+
private announceToScreenReader;
|
|
22
|
+
/**
|
|
23
|
+
* Clean up any pending timeouts
|
|
24
|
+
*/
|
|
25
|
+
cleanup(): void;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=character-counter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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;IAyBpE;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAc9B;;OAEG;IACH,OAAO,IAAI,IAAI;CAKhB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared character counting functionality for text inputs with character limits.
|
|
3
|
+
* Handles real-time character count updates, validation, and aria-live announcements.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
const SCREEN_READER_DELAY = 500;
|
|
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
|
+
let message = '';
|
|
20
|
+
if (charactersRemaining >= 0) {
|
|
21
|
+
const characterText = charactersRemaining === 1 ? 'character' : 'characters';
|
|
22
|
+
message = `${charactersRemaining} ${characterText} remaining`;
|
|
23
|
+
this.callbacks.onCountUpdate(charactersRemaining, false, message);
|
|
24
|
+
} else {
|
|
25
|
+
const charactersOver = -charactersRemaining;
|
|
26
|
+
const characterText = charactersOver === 1 ? 'character' : 'characters';
|
|
27
|
+
message = `${charactersOver} ${characterText} over`;
|
|
28
|
+
this.callbacks.onCountUpdate(charactersOver, true, message);
|
|
29
|
+
}
|
|
30
|
+
if (!this.isInitialLoad) {
|
|
31
|
+
this.announceToScreenReader(message);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// After first update, set isInitialLoad to false
|
|
35
|
+
if (this.isInitialLoad) {
|
|
36
|
+
this.isInitialLoad = false;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Announce character count to screen readers with debouncing
|
|
42
|
+
*/
|
|
43
|
+
announceToScreenReader(message) {
|
|
44
|
+
if (this.announceTimeout) {
|
|
45
|
+
clearTimeout(this.announceTimeout);
|
|
46
|
+
}
|
|
47
|
+
if (typeof window === 'undefined' || typeof window.setTimeout !== 'function') {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
this.announceTimeout = window.setTimeout(() => {
|
|
51
|
+
this.callbacks.onScreenReaderAnnounce(message);
|
|
52
|
+
}, SCREEN_READER_DELAY);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Clean up any pending timeouts
|
|
57
|
+
*/
|
|
58
|
+
cleanup() {
|
|
59
|
+
if (this.announceTimeout) {
|
|
60
|
+
clearTimeout(this.announceTimeout);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export { CharacterCounter };
|
|
@@ -138,6 +138,12 @@
|
|
|
138
138
|
"type": "Component | 'none'",
|
|
139
139
|
"required": false,
|
|
140
140
|
"description": "Icon displayed when the menu item is within the overflow menu. If 'none' is provided, no icon will be shown in the overflow menu."
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"name": "returnFocusRef",
|
|
144
|
+
"type": "React.RefObject<HTMLElement>",
|
|
145
|
+
"required": false,
|
|
146
|
+
"description": "A ref to an element that should receive focus when the menu is closed."
|
|
141
147
|
}
|
|
142
148
|
]
|
|
143
149
|
}
|
|
@@ -7162,6 +7168,11 @@
|
|
|
7162
7168
|
"defaultValue": "false",
|
|
7163
7169
|
"description": "Creates a full-width input element"
|
|
7164
7170
|
},
|
|
7171
|
+
{
|
|
7172
|
+
"name": "characterLimit",
|
|
7173
|
+
"type": "number",
|
|
7174
|
+
"description": "The maximum number of characters allowed in the input"
|
|
7175
|
+
},
|
|
7165
7176
|
{
|
|
7166
7177
|
"name": "contrast",
|
|
7167
7178
|
"type": "boolean",
|
|
@@ -7501,6 +7512,11 @@
|
|
|
7501
7512
|
"defaultValue": "'both'",
|
|
7502
7513
|
"description": "Changes the resize behavior"
|
|
7503
7514
|
},
|
|
7515
|
+
{
|
|
7516
|
+
"name": "characterLimit",
|
|
7517
|
+
"type": "number",
|
|
7518
|
+
"description": "The maximum number of characters allowed in the textarea"
|
|
7519
|
+
},
|
|
7504
7520
|
{
|
|
7505
7521
|
"name": "contrast",
|
|
7506
7522
|
"type": "boolean",
|