@primer/react 0.0.0-20260622123513 → 0.0.0-20260622150202
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/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +63 -30
- package/dist/Textarea/Textarea.d.ts.map +1 -1
- package/dist/Textarea/Textarea.js +150 -109
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-263b4e8f.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNav.d.ts +1 -2
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +91 -331
- package/dist/UnderlineNav/UnderlineNav.module.css.js +2 -2
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +1 -11
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +1 -4
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css +2 -0
- package/dist/UnderlineNav/UnderlineNavItem-402cd41c.css.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +1 -32
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +33 -38
- package/dist/UnderlineNav/UnderlineNavItem.module.css.js +1 -1
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts +40 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +6 -0
- package/dist/UnderlineNav/index.d.ts +1 -1
- package/dist/UnderlineNav/index.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.d.ts +2 -0
- package/dist/UnderlineNav/utils.d.ts.map +1 -1
- package/dist/UnderlineNav/utils.js +2 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css +2 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels-162f9aed.css.map +1 -0
- package/dist/experimental/UnderlinePanels/UnderlinePanels.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +8 -11
- package/dist/experimental/UnderlinePanels/UnderlinePanels.module.css.js +1 -1
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css +2 -0
- package/dist/internal/components/UnderlineTabbedInterface-1745a3d6.css.map +1 -0
- package/dist/internal/components/UnderlineTabbedInterface.d.ts +0 -1
- package/dist/internal/components/UnderlineTabbedInterface.d.ts.map +1 -1
- package/dist/internal/components/UnderlineTabbedInterface.js +66 -60
- package/dist/internal/components/UnderlineTabbedInterface.module.css.js +1 -1
- 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/generated/components.json +2 -2
- package/package.json +1 -1
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css +0 -2
- package/dist/UnderlineNav/UnderlineNav-4344d9b0.css.map +0 -1
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css +0 -2
- package/dist/UnderlineNav/UnderlineNavItem-b65e8fd3.css.map +0 -1
- package/dist/UnderlineNav/styles.d.ts +0 -16
- package/dist/UnderlineNav/styles.d.ts.map +0 -1
- package/dist/UnderlineNav/styles.js +0 -19
- package/dist/UnderlineNav/types.d.ts +0 -10
- package/dist/UnderlineNav/types.d.ts.map +0 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css +0 -2
- package/dist/experimental/UnderlinePanels/UnderlinePanels-e4b325b9.css.map +0 -1
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css +0 -2
- package/dist/internal/components/UnderlineTabbedInterface-4197ee28.css.map +0 -1
- package/dist/utils/__tests__/useCharacterCountAnnouncement.test.d.ts +0 -2
- package/dist/utils/__tests__/useCharacterCountAnnouncement.test.d.ts.map +0 -1
- package/dist/utils/useCharacterCountAnnouncement.d.ts +0 -14
- package/dist/utils/useCharacterCountAnnouncement.d.ts.map +0 -1
- package/dist/utils/useCharacterCountAnnouncement.js +0 -73
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260622150202
|
|
4
4
|
|
|
5
|
-
###
|
|
5
|
+
### Minor Changes
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- [#7622](https://github.com/primer/react/pull/7622) [`4d8d5e6`](https://github.com/primer/react/commit/4d8d5e6b9b0b1d394d19154369f9c37eabe7cb87) Thanks [@copilot-swe-agent](https://github.com/apps/copilot-swe-agent)! - Refactors `UnderlineNav` overflow handling to use CSS-based overflow detection instead of JavaScript width measurements, eliminating layout shift (CLS) issues and improving performance. The overflow menu is now implemented with `ActionMenu`, and item registration uses a descendant registry instead of the `React.Children` API. Consumer-facing changes: items can now be wrapped in fragments or wrapper components; the current item may appear in the overflow menu when the viewport is narrow; and the overflow menu button is right-aligned.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
### Patch Changes
|
|
10
10
|
|
|
11
|
-
-
|
|
11
|
+
- Fake entry to force publishing
|
|
12
12
|
|
|
13
13
|
## 38.29.0
|
|
14
14
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/TextInput/TextInput.tsx"],"names":[],"mappings":"AACA,OAAO,KAAwD,MAAM,OAAO,CAAA;AAE5E,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAO/F,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,EAAC,kBAAkB,EAAC,MAAM,yCAAyC,CAAA;AAQ/E,MAAM,MAAM,4BAA4B,GAAG;IACzC,uEAAuE;IACvE,IAAI,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACxB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;;;QAKI;IACJ,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAA;IAChD,0DAA0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACnD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,KAAK,CAAC,SAAS,CAAA;IACpD;;OAEG;IACH,cAAc,CAAC,EAAE,KAAK,CAAC,YAAY,CAAC,KAAK,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAAA;IACvE;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAC1B,GAAG,OAAO,CACT,IAAI,CACF,kBAAkB,EAChB,OAAO,GACP,UAAU,GACV,UAAU,GACV,WAAW,GACX,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,GACT,MAAM,GACN,kBAAkB,CACrB,CACF,CAAA;AAED,MAAM,MAAM,cAAc,GAAG,KAAK,CAAC,KAAK,CAAC,wBAAwB,CAAC,OAAO,CAAC,EAAE,4BAA4B,CAAC,CAAA;;;;;;;;;;;AAkQzG,wBAGE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useId, useCallback } from 'react';
|
|
1
|
+
import React, { useState, useRef, useId, useCallback, useEffect } from 'react';
|
|
2
2
|
import { isValidElementType } from 'react-is';
|
|
3
3
|
import { clsx } from 'clsx';
|
|
4
4
|
import { AlertFillIcon } from '@primer/octicons-react';
|
|
@@ -8,8 +8,7 @@ import { TextInputWrapper } from '../internal/components/TextInputWrapper.js';
|
|
|
8
8
|
import TextInputAction from '../internal/components/TextInputInnerAction.js';
|
|
9
9
|
import UnstyledTextInput from '../internal/components/UnstyledTextInput.js';
|
|
10
10
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
11
|
-
import {
|
|
12
|
-
import { useCharacterCountAnnouncement } from '../utils/useCharacterCountAnnouncement.js';
|
|
11
|
+
import { CharacterCounter } from '../utils/character-counter.js';
|
|
13
12
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
14
13
|
import { useProvidedRefOrCreate } from '../hooks/useProvidedRefOrCreate.js';
|
|
15
14
|
import Text from '../Text/Text.js';
|
|
@@ -47,29 +46,16 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
47
46
|
'data-component': dataComponent,
|
|
48
47
|
...inputProps
|
|
49
48
|
}, ref) => {
|
|
50
|
-
var _counter$isOverLimit;
|
|
51
49
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
52
50
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
// The counter and validation state are derived directly from the current
|
|
63
|
-
// length, so they stay in sync with the input without an extra render.
|
|
64
|
-
const counter = characterLimit ? getCharacterCountState(currentLength, characterLimit) : undefined;
|
|
65
|
-
const isOverLimit = (_counter$isOverLimit = counter === null || counter === void 0 ? void 0 : counter.isOverLimit) !== null && _counter$isOverLimit !== void 0 ? _counter$isOverLimit : false;
|
|
66
|
-
|
|
67
|
-
// The debounced screen reader announcement is encapsulated in a shared hook so
|
|
68
|
-
// it never blocks typing and stays consistent with Textarea.
|
|
69
|
-
const {
|
|
70
|
-
screenReaderMessage,
|
|
71
|
-
announce
|
|
72
|
-
} = useCharacterCountAnnouncement(characterLimit);
|
|
51
|
+
const [characterCount, setCharacterCount] = useState('');
|
|
52
|
+
const [isOverLimit, setIsOverLimit] = useState(false);
|
|
53
|
+
const [screenReaderMessage, setScreenReaderMessage] = useState('');
|
|
54
|
+
const characterCounterRef = useRef(null);
|
|
55
|
+
const lastCountedLengthRef = useRef(null);
|
|
56
|
+
const lastCharacterCountRef = useRef('');
|
|
57
|
+
const lastIsOverLimitRef = useRef(false);
|
|
58
|
+
const lastScreenReaderMessageRef = useRef('');
|
|
73
59
|
|
|
74
60
|
// this class is necessary to style FilterSearch, plz no touchy!
|
|
75
61
|
const wrapperClasses = clsx(className, 'TextInput-wrapper');
|
|
@@ -98,16 +84,63 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
98
84
|
onBlur && onBlur(e_1);
|
|
99
85
|
}, [onBlur]);
|
|
100
86
|
|
|
87
|
+
// Initialize character counter
|
|
88
|
+
useEffect(() => {
|
|
89
|
+
if (characterLimit) {
|
|
90
|
+
characterCounterRef.current = new CharacterCounter({
|
|
91
|
+
onCountUpdate: (count, overLimit, message) => {
|
|
92
|
+
if (message !== lastCharacterCountRef.current) {
|
|
93
|
+
lastCharacterCountRef.current = message;
|
|
94
|
+
setCharacterCount(message);
|
|
95
|
+
}
|
|
96
|
+
if (overLimit !== lastIsOverLimitRef.current) {
|
|
97
|
+
lastIsOverLimitRef.current = overLimit;
|
|
98
|
+
setIsOverLimit(overLimit);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onScreenReaderAnnounce: message_0 => {
|
|
102
|
+
if (message_0 !== lastScreenReaderMessageRef.current) {
|
|
103
|
+
lastScreenReaderMessageRef.current = message_0;
|
|
104
|
+
setScreenReaderMessage(message_0);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
lastCountedLengthRef.current = null;
|
|
109
|
+
return () => {
|
|
110
|
+
var _characterCounterRef$;
|
|
111
|
+
(_characterCounterRef$ = characterCounterRef.current) === null || _characterCounterRef$ === void 0 ? void 0 : _characterCounterRef$.cleanup();
|
|
112
|
+
characterCounterRef.current = null;
|
|
113
|
+
lastCountedLengthRef.current = null;
|
|
114
|
+
lastCharacterCountRef.current = '';
|
|
115
|
+
lastIsOverLimitRef.current = false;
|
|
116
|
+
lastScreenReaderMessageRef.current = '';
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
}, [characterLimit]);
|
|
120
|
+
|
|
121
|
+
// Update character count when value changes or on mount
|
|
122
|
+
useEffect(() => {
|
|
123
|
+
if (characterLimit && characterCounterRef.current) {
|
|
124
|
+
const currentValue = value !== undefined ? String(value) : defaultValue !== undefined ? String(defaultValue) : '';
|
|
125
|
+
const currentLength = currentValue.length;
|
|
126
|
+
if (currentLength !== lastCountedLengthRef.current) {
|
|
127
|
+
lastCountedLengthRef.current = currentLength;
|
|
128
|
+
characterCounterRef.current.updateCharacterCount(currentLength, characterLimit);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, [value, defaultValue, characterLimit]);
|
|
132
|
+
|
|
101
133
|
// Handle input change with character counter
|
|
102
134
|
const handleInputChange = useCallback(e_2 => {
|
|
103
|
-
if (characterLimit) {
|
|
104
|
-
|
|
105
|
-
|
|
135
|
+
if (characterLimit && characterCounterRef.current) {
|
|
136
|
+
const currentLength_0 = e_2.target.value.length;
|
|
137
|
+
if (currentLength_0 !== lastCountedLengthRef.current) {
|
|
138
|
+
lastCountedLengthRef.current = currentLength_0;
|
|
139
|
+
characterCounterRef.current.updateCharacterCount(currentLength_0, characterLimit);
|
|
106
140
|
}
|
|
107
|
-
announce(e_2.target.value.length);
|
|
108
141
|
}
|
|
109
142
|
onChange === null || onChange === void 0 ? void 0 : onChange(e_2);
|
|
110
|
-
}, [onChange, characterLimit
|
|
143
|
+
}, [onChange, characterLimit]);
|
|
111
144
|
const characterCountId = useId();
|
|
112
145
|
const characterCountStaticMessageId = useId();
|
|
113
146
|
const isValid = isOverLimit ? 'error' : validationStatus;
|
|
@@ -184,7 +217,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
184
217
|
"data-component": "TextInput.CharacterCounter",
|
|
185
218
|
children: [isOverLimit && /*#__PURE__*/jsx(AlertFillIcon, {
|
|
186
219
|
size: 16
|
|
187
|
-
}),
|
|
220
|
+
}), characterCount]
|
|
188
221
|
})]
|
|
189
222
|
})]
|
|
190
223
|
});
|
|
@@ -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;2FA2IxB,CAAA;wBAK0B,cAAc,CAAC,OAAO,QAAQ,CAAC;AAA1D,wBAA0D"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useId,
|
|
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
5
|
import { AlertFillIcon } from '@primer/octicons-react';
|
|
6
|
-
import {
|
|
7
|
-
import { useCharacterCountAnnouncement } from '../utils/useCharacterCountAnnouncement.js';
|
|
6
|
+
import { CharacterCounter } from '../utils/character-counter.js';
|
|
8
7
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
9
8
|
import { clsx } from 'clsx';
|
|
10
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
@@ -18,8 +17,7 @@ const DEFAULT_TEXTAREA_RESIZE = 'both';
|
|
|
18
17
|
* This component accepts all native HTML <textarea> attributes as props.
|
|
19
18
|
*/
|
|
20
19
|
const Textarea = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
21
|
-
|
|
22
|
-
const $ = c(57);
|
|
20
|
+
const $ = c(68);
|
|
23
21
|
let block;
|
|
24
22
|
let characterLimit;
|
|
25
23
|
let className;
|
|
@@ -97,157 +95,200 @@ const Textarea = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
|
97
95
|
const rows = t1 === undefined ? DEFAULT_TEXTAREA_ROWS : t1;
|
|
98
96
|
const cols = t2 === undefined ? DEFAULT_TEXTAREA_COLS : t2;
|
|
99
97
|
const resize = t3 === undefined ? DEFAULT_TEXTAREA_RESIZE : t3;
|
|
98
|
+
const [characterCount, setCharacterCount] = React.useState("");
|
|
99
|
+
const [isOverLimit, setIsOverLimit] = React.useState(false);
|
|
100
|
+
const [screenReaderMessage, setScreenReaderMessage] = React.useState("");
|
|
101
|
+
const characterCounterRef = useRef(null);
|
|
100
102
|
const characterCountId = useId();
|
|
101
103
|
const characterCountStaticMessageId = useId();
|
|
102
|
-
const isControlled = value !== undefined;
|
|
103
104
|
let t4;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
let t5;
|
|
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;
|
|
107
126
|
$[19] = t4;
|
|
127
|
+
$[20] = t5;
|
|
108
128
|
} else {
|
|
109
129
|
t4 = $[19];
|
|
130
|
+
t5 = $[20];
|
|
110
131
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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 => {
|
|
122
156
|
var _onChange;
|
|
123
|
-
if (characterLimit) {
|
|
124
|
-
|
|
125
|
-
setUncontrolledLength(e.target.value.length);
|
|
126
|
-
}
|
|
127
|
-
announce(e.target.value.length);
|
|
157
|
+
if (characterLimit && characterCounterRef.current) {
|
|
158
|
+
characterCounterRef.current.updateCharacterCount(e.target.value.length, characterLimit);
|
|
128
159
|
}
|
|
129
160
|
(_onChange = onChange) === null || _onChange === void 0 ? void 0 : _onChange(e);
|
|
130
161
|
};
|
|
131
|
-
$[
|
|
132
|
-
$[
|
|
133
|
-
$[
|
|
134
|
-
$[23] = onChange;
|
|
135
|
-
$[24] = t5;
|
|
162
|
+
$[26] = characterLimit;
|
|
163
|
+
$[27] = onChange;
|
|
164
|
+
$[28] = t8;
|
|
136
165
|
} else {
|
|
137
|
-
|
|
166
|
+
t8 = $[28];
|
|
138
167
|
}
|
|
139
|
-
const handleTextareaChange =
|
|
168
|
+
const handleTextareaChange = t8;
|
|
140
169
|
const isValid = isOverLimit ? "error" : validationStatus;
|
|
141
|
-
const
|
|
142
|
-
let
|
|
143
|
-
if ($[
|
|
144
|
-
|
|
170
|
+
const t9 = isValid === "error" ? "true" : "false";
|
|
171
|
+
let t10;
|
|
172
|
+
if ($[29] !== maxHeight || $[30] !== minHeight || $[31] !== style) {
|
|
173
|
+
t10 = {
|
|
145
174
|
minHeight,
|
|
146
175
|
maxHeight,
|
|
147
176
|
...style
|
|
148
177
|
};
|
|
149
|
-
$[
|
|
150
|
-
$[
|
|
151
|
-
$[
|
|
152
|
-
$[
|
|
178
|
+
$[29] = maxHeight;
|
|
179
|
+
$[30] = minHeight;
|
|
180
|
+
$[31] = style;
|
|
181
|
+
$[32] = t10;
|
|
153
182
|
} else {
|
|
154
|
-
|
|
183
|
+
t10 = $[32];
|
|
155
184
|
}
|
|
156
|
-
let
|
|
157
|
-
if ($[
|
|
158
|
-
|
|
159
|
-
$[
|
|
160
|
-
$[
|
|
161
|
-
$[
|
|
162
|
-
$[
|
|
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;
|
|
163
192
|
} else {
|
|
164
|
-
|
|
193
|
+
t11 = $[36];
|
|
165
194
|
}
|
|
166
|
-
let
|
|
167
|
-
if ($[
|
|
168
|
-
|
|
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", {
|
|
169
198
|
value: value,
|
|
170
199
|
defaultValue: defaultValue,
|
|
171
200
|
"data-resize": resize,
|
|
172
201
|
"aria-required": required,
|
|
173
|
-
"aria-invalid":
|
|
202
|
+
"aria-invalid": t9,
|
|
174
203
|
ref: ref,
|
|
175
204
|
disabled: disabled,
|
|
176
205
|
rows: rows,
|
|
177
206
|
cols: cols,
|
|
178
207
|
className: classes.TextArea,
|
|
179
208
|
onChange: handleTextareaChange,
|
|
180
|
-
style:
|
|
209
|
+
style: t10,
|
|
181
210
|
...rest,
|
|
182
|
-
"aria-describedby":
|
|
211
|
+
"aria-describedby": t11
|
|
183
212
|
});
|
|
184
|
-
$[
|
|
185
|
-
$[
|
|
186
|
-
$[
|
|
187
|
-
$[
|
|
188
|
-
$[
|
|
189
|
-
$[
|
|
190
|
-
$[
|
|
191
|
-
$[
|
|
192
|
-
$[
|
|
193
|
-
$[
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
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;
|
|
198
227
|
} else {
|
|
199
|
-
|
|
228
|
+
t12 = $[50];
|
|
200
229
|
}
|
|
201
|
-
let
|
|
202
|
-
if ($[
|
|
203
|
-
|
|
230
|
+
let t13;
|
|
231
|
+
if ($[51] !== block || $[52] !== className || $[53] !== contrast || $[54] !== disabled || $[55] !== isValid || $[56] !== t12) {
|
|
232
|
+
t13 = /*#__PURE__*/jsx(TextInputBaseWrapper, {
|
|
204
233
|
validationStatus: isValid,
|
|
205
234
|
disabled: disabled,
|
|
206
235
|
block: block,
|
|
207
236
|
contrast: contrast,
|
|
208
237
|
className: className,
|
|
209
|
-
children:
|
|
238
|
+
children: t12
|
|
210
239
|
});
|
|
211
|
-
$[
|
|
212
|
-
$[
|
|
213
|
-
$[
|
|
214
|
-
$[
|
|
215
|
-
$[
|
|
216
|
-
$[
|
|
217
|
-
$[
|
|
240
|
+
$[51] = block;
|
|
241
|
+
$[52] = className;
|
|
242
|
+
$[53] = contrast;
|
|
243
|
+
$[54] = disabled;
|
|
244
|
+
$[55] = isValid;
|
|
245
|
+
$[56] = t12;
|
|
246
|
+
$[57] = t13;
|
|
218
247
|
} else {
|
|
219
|
-
|
|
248
|
+
t13 = $[57];
|
|
220
249
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
if ($[54] !== t10 || $[55] !== t11) {
|
|
241
|
-
t12 = /*#__PURE__*/jsxs(Fragment, {
|
|
242
|
-
children: [t10, t11]
|
|
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
|
+
})]
|
|
243
269
|
});
|
|
244
|
-
$[
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
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]
|
|
284
|
+
});
|
|
285
|
+
$[65] = t13;
|
|
286
|
+
$[66] = t14;
|
|
287
|
+
$[67] = t15;
|
|
247
288
|
} else {
|
|
248
|
-
|
|
289
|
+
t15 = $[67];
|
|
249
290
|
}
|
|
250
|
-
return
|
|
291
|
+
return t15;
|
|
251
292
|
});
|
|
252
293
|
Textarea.displayName = 'Textarea';
|
|
253
294
|
Textarea.__SLOT__ = Symbol('Textarea');
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
.prc-UnderlineNav-UnderlineWrapper-GWONT{animation:prc-UnderlineNav-detect-overflow-6HuSH linear;animation-timeline:scroll(self block);--UnderlineNav_moreButton-visibility:hidden;--UnderlineNav_icons-display:inline}.prc-UnderlineNav-UnderlineWrapper-GWONT[data-hide-icons=true]{--UnderlineNav_icons-display:none}.prc-UnderlineNav-UnderlineWrapper-GWONT[data-has-overflow=true]{--UnderlineNav_moreButton-visibility:visible}@keyframes prc-UnderlineNav-detect-overflow-6HuSH{0%,to{--UnderlineNav_moreButton-visibility:visible;--UnderlineNav_icons-display:none}}.prc-UnderlineNav-ItemsList-oj8gN [data-component=icon]{display:var(--UnderlineNav_icons-display)}.prc-UnderlineNav-MoreButtonContainer-Dnrq6{align-items:center;display:flex;visibility:var(--UnderlineNav_moreButton-visibility)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]{position:relative}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current] .prc-UnderlineNav-OverflowMenuItemLabel-F80v6{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-OverflowMenuItem-7SG7M [aria-current]:after{background:var(--underlineNav-borderColor-active,#fd8c73);content:"";inset:var(--base-size-2,.125rem) auto var(--base-size-2,.125rem) 0;position:absolute;width:var(--base-size-2,.125rem)}.prc-UnderlineNav-MoreButtonDivider-dN0a-{border-left:var(--borderWidth-thin,.0625rem) solid var(--borderColor-muted,#d1d9e0b3);display:inline-block;height:var(--base-size-24,1.5rem);margin-inline:var(--base-size-4,.25rem);width:0}.prc-UnderlineNav-MoreButton-Y8soj{font-weight:var(--base-text-weight-normal,400);margin:0;position:relative}.prc-UnderlineNav-MoreButton-Y8soj>[data-component=trailingVisual]{margin-left:0}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]{font-weight:var(--base-text-weight-semibold,600)}.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:var(--underlineNav-borderColor-active,var(--color-primer-border-active,#fd8c73));content:"";height:2px;inset:auto 0 0;margin-bottom:calc(var(--base-size-8,.5rem)*-1);pointer-events:none;position:absolute}@media (forced-colors:active){.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:LinkText}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-263b4e8f.css.map */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/UnderlineNav/UnderlineNav.module.css.js"],"names":[],"mappings":"AAAA,yCAIE,uDAAiC,CACjC,qCAAsC,CAEtC,2CAA4C,CAC5C,mCASF,CAPE,+DACE,iCACF,CAEA,iEACE,4CACF,CAGF,kDACE,MAEE,4CAA6C,CAC7C,iCACF,CACF,CAEA,wDACE,yCACF,CAEA,4CAGE,kBAAmB,CAFnB,YAAa,CACb,oDAEF,CAEA,wDACE,iBAcF,CAZE,sGACE,gDACF,CAEA,8DAME,yDAAkD,CALlD,UAAW,CAGX,kEAAmD,CADnD,iBAAkB,CADlB,gCAKF,CAGF,0CAEE,qFAAmE,CADnE,oBAAqB,CAIrB,iCAA2B,CAD3B,uCAAiC,CADjC,OAGF,CAEA,mCAEE,8CAA2C,CAD3C,QAAS,CAET,iBA2BF,CAzBE,mEACE,aACF,CAIA,sDACE,gDAiBF,CAfE,4DAQE,iGAAoG,CAFpG,UAAW,CAFX,UAAW,CAFX,cAAe,CACf,+CAA4C,CAE5C,mBAAoB,CAJpB,iBAaF,CAJE,8BAVF,4DAYI,yBAEJ,CADE","file":"UnderlineNav-263b4e8f.css","sourcesContent":[".UnderlineWrapper {\n /* Progressive enhancement: Detect overflow using scroll-based animations.\n The idiomatic way would be a scroll-state container query but browser support\n is slightly better for animations. */\n animation: detect-overflow linear;\n animation-timeline: scroll(self block);\n\n --UnderlineNav_moreButton-visibility: hidden;\n --UnderlineNav_icons-display: inline;\n\n &[data-hide-icons='true'] {\n --UnderlineNav_icons-display: none;\n }\n\n &[data-has-overflow='true'] {\n --UnderlineNav_moreButton-visibility: visible;\n }\n}\n\n@keyframes detect-overflow {\n 0%,\n 100% {\n --UnderlineNav_moreButton-visibility: visible;\n --UnderlineNav_icons-display: none;\n }\n}\n\n.ItemsList [data-component='icon'] {\n display: var(--UnderlineNav_icons-display);\n}\n\n.MoreButtonContainer {\n display: flex;\n visibility: var(--UnderlineNav_moreButton-visibility);\n align-items: center;\n}\n\n.OverflowMenuItem [aria-current] {\n position: relative;\n\n .OverflowMenuItemLabel {\n font-weight: var(--base-text-weight-semibold);\n }\n\n &::after {\n content: '';\n width: var(--base-size-2);\n position: absolute;\n inset: var(--base-size-2) auto var(--base-size-2) 0;\n /* stylelint-disable-next-line primer/colors */\n background: var(--underlineNav-borderColor-active);\n }\n}\n\n.MoreButtonDivider {\n display: inline-block;\n border-left: var(--borderWidth-thin) solid var(--borderColor-muted);\n width: 0;\n margin-inline: var(--base-size-4);\n height: var(--base-size-24);\n}\n\n.MoreButton {\n margin: 0; /* reset Safari extra margin */\n font-weight: var(--base-text-weight-normal);\n position: relative;\n\n & > [data-component='trailingVisual'] {\n margin-left: 0;\n }\n\n /* When the current item has overflowed into the menu, style the overflow\n anchor so it looks like the current item (semibold text + active underline). */\n &[data-current='true'] {\n font-weight: var(--base-text-weight-semibold);\n\n &::after {\n position: absolute;\n inset: auto 0 0;\n margin-bottom: calc(-1 * var(--base-size-8));\n height: 2px;\n pointer-events: none;\n content: '';\n /* stylelint-disable-next-line primer/colors */\n background-color: var(--underlineNav-borderColor-active, var(--color-primer-border-active, #fd8c73));\n\n @media (forced-colors: active) {\n /* Support for Windows Forced Color Mode https://learn.microsoft.com/en-us/fluent-ui/web-components/design-system/high-contrast */\n background-color: LinkText;\n }\n }\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import type React from 'react';
|
|
2
2
|
export type UnderlineNavProps = {
|
|
3
3
|
children: React.ReactNode;
|
|
4
4
|
'aria-label'?: React.AriaAttributes['aria-label'];
|
|
@@ -15,6 +15,5 @@ export type UnderlineNavProps = {
|
|
|
15
15
|
*/
|
|
16
16
|
variant?: 'inset' | 'flush';
|
|
17
17
|
};
|
|
18
|
-
export declare const MORE_BTN_WIDTH = 86;
|
|
19
18
|
export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<unknown>>;
|
|
20
19
|
//# sourceMappingURL=UnderlineNav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAgB9B,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAED,eAAO,MAAM,YAAY,mFAsIxB,CAAA"}
|