@primer/react 0.0.0-20260624174518 → 0.0.0-20260624193537
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 +2 -26
- package/dist/ButtonGroup/ButtonGroup-54ba293b.css +2 -0
- package/dist/ButtonGroup/ButtonGroup-54ba293b.css.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +0 -1
- package/dist/ButtonGroup/ButtonGroup.module.css.js +2 -2
- package/dist/Checkbox/Checkbox-edc5dc3e.css +2 -0
- package/dist/Checkbox/Checkbox-edc5dc3e.css.map +1 -0
- package/dist/Checkbox/Checkbox.module.css.js +1 -1
- package/dist/ConfirmationDialog/useConfirm.d.ts.map +1 -1
- package/dist/ConfirmationDialog/useConfirm.js +8 -4
- package/dist/DataTable/Pagination-b6f8418c.css +2 -0
- package/dist/DataTable/Pagination-b6f8418c.css.map +1 -0
- package/dist/DataTable/Pagination.module.css.js +1 -1
- package/dist/Radio/Radio.d.ts.map +1 -1
- package/dist/Radio/Radio.js +1 -2
- package/dist/RadioGroup/RadioGroup.js +0 -1
- package/dist/RelativeTime/RelativeTime.js +0 -1
- package/dist/ScrollableRegion/ScrollableRegion.d.ts.map +1 -1
- package/dist/ScrollableRegion/ScrollableRegion.js +0 -1
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +0 -1
- package/dist/SegmentedControl/SegmentedControlButton.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlButton.js +0 -1
- package/dist/SegmentedControl/SegmentedControlIconButton.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControlIconButton.js +0 -1
- package/dist/Select/Select.d.ts.map +1 -1
- package/dist/Select/Select.js +2 -6
- package/dist/SideNav.d.ts.map +1 -1
- package/dist/SideNav.js +0 -2
- package/dist/Skeleton/SkeletonBox.d.ts +0 -1
- package/dist/Skeleton/SkeletonBox.d.ts.map +1 -1
- package/dist/Skeleton/SkeletonBox.js +47 -54
- package/dist/SkeletonText/SkeletonText.d.ts.map +1 -1
- package/dist/SkeletonText/SkeletonText.js +2 -2
- package/dist/Spinner/Spinner.js +0 -1
- 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/UnderlineNav/UnderlineNav-b4b22899.css +2 -0
- package/dist/UnderlineNav/UnderlineNav-b4b22899.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 -339
- 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 -44
- 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 +51 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.d.ts.map +1 -0
- package/dist/UnderlineNav/UnderlineNavItemsRegistry.js +8 -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/_VisuallyHidden.js +2 -2
- package/dist/_VisuallyHidden.module.css.js +2 -2
- 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/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/generated/components.json +2 -2
- package/package.json +2 -2
- package/dist/ButtonGroup/ButtonGroup-be1c1123.css +0 -2
- package/dist/ButtonGroup/ButtonGroup-be1c1123.css.map +0 -1
- package/dist/Checkbox/Checkbox-7476a7ba.css +0 -2
- package/dist/Checkbox/Checkbox-7476a7ba.css.map +0 -1
- package/dist/DataTable/Pagination-aebe86e8.css +0 -2
- package/dist/DataTable/Pagination-aebe86e8.css.map +0 -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
|
@@ -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,11 +8,9 @@ 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 { SCREEN_READER_DELAY, getCharacterCountState } from '../utils/character-counter.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
|
-
import { AriaStatus } from '../live-region/AriaStatus.js';
|
|
16
14
|
import Text from '../Text/Text.js';
|
|
17
15
|
|
|
18
16
|
// using forwardRef is important so that other components can autofocus the input
|
|
@@ -48,22 +46,16 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
48
46
|
'data-component': dataComponent,
|
|
49
47
|
...inputProps
|
|
50
48
|
}, ref) => {
|
|
51
|
-
var _counter$isOverLimit;
|
|
52
49
|
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
53
50
|
const inputRef = useProvidedRefOrCreate(ref);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
const
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
// The counter and validation state are derived directly from the current
|
|
64
|
-
// length, so they stay in sync with the input without an extra render.
|
|
65
|
-
const counter = characterLimit ? getCharacterCountState(currentLength, characterLimit) : undefined;
|
|
66
|
-
const isOverLimit = (_counter$isOverLimit = counter === null || counter === void 0 ? void 0 : counter.isOverLimit) !== null && _counter$isOverLimit !== void 0 ? _counter$isOverLimit : false;
|
|
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('');
|
|
67
59
|
|
|
68
60
|
// this class is necessary to style FilterSearch, plz no touchy!
|
|
69
61
|
const wrapperClasses = clsx(className, 'TextInput-wrapper');
|
|
@@ -92,13 +84,63 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
92
84
|
onBlur && onBlur(e_1);
|
|
93
85
|
}, [onBlur]);
|
|
94
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
|
+
|
|
95
133
|
// Handle input change with character counter
|
|
96
134
|
const handleInputChange = useCallback(e_2 => {
|
|
97
|
-
if (characterLimit &&
|
|
98
|
-
|
|
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);
|
|
140
|
+
}
|
|
99
141
|
}
|
|
100
142
|
onChange === null || onChange === void 0 ? void 0 : onChange(e_2);
|
|
101
|
-
}, [onChange, characterLimit
|
|
143
|
+
}, [onChange, characterLimit]);
|
|
102
144
|
const characterCountId = useId();
|
|
103
145
|
const characterCountStaticMessageId = useId();
|
|
104
146
|
const isValid = isOverLimit ? 'error' : validationStatus;
|
|
@@ -160,11 +202,10 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
160
202
|
children: typeof TrailingVisual !== 'string' && isValidElementType(TrailingVisual) ? /*#__PURE__*/jsx(TrailingVisual, {}) : TrailingVisual
|
|
161
203
|
}), trailingAction]
|
|
162
204
|
}), characterLimit && /*#__PURE__*/jsxs(Fragment, {
|
|
163
|
-
children: [/*#__PURE__*/jsx(
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
children: counter === null || counter === void 0 ? void 0 : counter.message
|
|
205
|
+
children: [/*#__PURE__*/jsx(VisuallyHidden, {
|
|
206
|
+
"aria-live": "polite",
|
|
207
|
+
role: "status",
|
|
208
|
+
children: screenReaderMessage
|
|
168
209
|
}), /*#__PURE__*/jsxs(VisuallyHidden, {
|
|
169
210
|
id: characterCountStaticMessageId,
|
|
170
211
|
children: ["You can enter up to ", characterLimit, " ", characterLimit === 1 ? 'character' : 'characters']
|
|
@@ -176,7 +217,7 @@ const TextInput = /*#__PURE__*/React.forwardRef(({
|
|
|
176
217
|
"data-component": "TextInput.CharacterCounter",
|
|
177
218
|
children: [isOverLimit && /*#__PURE__*/jsx(AlertFillIcon, {
|
|
178
219
|
size: 16
|
|
179
|
-
}),
|
|
220
|
+
}), characterCount]
|
|
180
221
|
})]
|
|
181
222
|
})]
|
|
182
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,14 +1,12 @@
|
|
|
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 {
|
|
6
|
+
import { CharacterCounter } from '../utils/character-counter.js';
|
|
7
7
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
8
|
-
import visuallyHiddenClasses from '../_VisuallyHidden.module.css.js';
|
|
9
8
|
import { clsx } from 'clsx';
|
|
10
9
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
import { AriaStatus } from '../live-region/AriaStatus.js';
|
|
12
10
|
import Text from '../Text/Text.js';
|
|
13
11
|
|
|
14
12
|
const DEFAULT_TEXTAREA_ROWS = 7;
|
|
@@ -19,7 +17,7 @@ const DEFAULT_TEXTAREA_RESIZE = 'both';
|
|
|
19
17
|
* This component accepts all native HTML <textarea> attributes as props.
|
|
20
18
|
*/
|
|
21
19
|
const Textarea = /*#__PURE__*/React.forwardRef((t0, ref) => {
|
|
22
|
-
const $ = c(
|
|
20
|
+
const $ = c(68);
|
|
23
21
|
let block;
|
|
24
22
|
let characterLimit;
|
|
25
23
|
let className;
|
|
@@ -97,170 +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
|
-
let
|
|
114
|
-
if ($[
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
children:
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
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 = {
|
|
174
|
+
minHeight,
|
|
175
|
+
maxHeight,
|
|
176
|
+
...style
|
|
177
|
+
};
|
|
178
|
+
$[29] = maxHeight;
|
|
179
|
+
$[30] = minHeight;
|
|
180
|
+
$[31] = style;
|
|
181
|
+
$[32] = t10;
|
|
182
|
+
} else {
|
|
183
|
+
t10 = $[32];
|
|
184
|
+
}
|
|
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", {
|
|
198
|
+
value: value,
|
|
199
|
+
defaultValue: defaultValue,
|
|
200
|
+
"data-resize": resize,
|
|
201
|
+
"aria-required": required,
|
|
202
|
+
"aria-invalid": t9,
|
|
203
|
+
ref: ref,
|
|
204
|
+
disabled: disabled,
|
|
205
|
+
rows: rows,
|
|
206
|
+
cols: cols,
|
|
207
|
+
className: classes.TextArea,
|
|
208
|
+
onChange: handleTextareaChange,
|
|
209
|
+
style: t10,
|
|
210
|
+
...rest,
|
|
211
|
+
"aria-describedby": t11
|
|
212
|
+
});
|
|
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;
|
|
227
|
+
} else {
|
|
228
|
+
t12 = $[50];
|
|
229
|
+
}
|
|
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,
|
|
234
|
+
disabled: disabled,
|
|
235
|
+
block: block,
|
|
236
|
+
contrast: contrast,
|
|
237
|
+
className: className,
|
|
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]
|
|
235
268
|
})]
|
|
236
269
|
});
|
|
237
|
-
$[
|
|
238
|
-
$[
|
|
239
|
-
$[
|
|
240
|
-
$[
|
|
241
|
-
$[
|
|
242
|
-
$[
|
|
243
|
-
$[
|
|
244
|
-
|
|
245
|
-
$[
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
$[
|
|
253
|
-
$[
|
|
254
|
-
$[
|
|
255
|
-
$[38] = rows;
|
|
256
|
-
$[39] = style;
|
|
257
|
-
$[40] = validationStatus;
|
|
258
|
-
$[41] = value;
|
|
259
|
-
$[42] = t5;
|
|
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;
|
|
260
288
|
} else {
|
|
261
|
-
|
|
289
|
+
t15 = $[67];
|
|
262
290
|
}
|
|
263
|
-
return
|
|
291
|
+
return t15;
|
|
264
292
|
});
|
|
265
293
|
Textarea.displayName = 'Textarea';
|
|
266
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:-9px;pointer-events:none;position:absolute}@media (forced-colors:active){.prc-UnderlineNav-MoreButton-Y8soj[data-current=true]:after{background-color:LinkText}}
|
|
2
|
+
/*# sourceMappingURL=UnderlineNav-b4b22899.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,kBAAmB,CAEnB,mBAAoB,CAJpB,iBAaF,CAJE,8BAVF,4DAYI,yBAEJ,CADE","file":"UnderlineNav-b4b22899.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: -9px;\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"}
|