@astryxdesign/lab 0.7.2-canary.fdd384f → 0.7.3-canary.02f5fe4
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/dist/Chat/ChatTypingIndicator.d.ts +3 -2
- package/dist/Chat/ChatTypingIndicator.d.ts.map +1 -1
- package/dist/Chat/ChatTypingIndicator.js +39 -9
- package/dist/Comments/CommentComposer.d.ts.map +1 -1
- package/dist/Comments/CommentComposer.js +14 -2
- package/dist/Comments/CommentParts.d.ts.map +1 -1
- package/dist/Comments/CommentParts.js +4 -3
- package/dist/MobileTokenizer/MobileTokenizer.d.ts.map +1 -1
- package/dist/MobileTokenizer/MobileTokenizer.js +49 -11
- package/dist/lab.css +2 -1
- package/package.json +4 -4
- package/src/Chat/ChatTypingIndicator.doc.mjs +3 -3
- package/src/Chat/ChatTypingIndicator.test.tsx +66 -1
- package/src/Chat/ChatTypingIndicator.tsx +43 -9
- package/src/Chat/__tests__/ChatTypingIndicator.a11y.renders.tsx +30 -7
- package/src/Chat/__tests__/ChatTypingIndicator.a11y.states.ts +19 -19
- package/src/Chat/__tests__/ChatTypingIndicator.a11y.test.tsx +2 -0
- package/src/Comments/CommentComposer.test.tsx +83 -1
- package/src/Comments/CommentComposer.tsx +14 -2
- package/src/Comments/CommentParts.tsx +3 -6
- package/src/Comments/Comments.test.tsx +5 -14
- package/src/MobileTokenizer/MobileTokenizer.test.tsx +138 -0
- package/src/MobileTokenizer/MobileTokenizer.tsx +81 -10
- package/src/TransferList/TransferListSelector.test.tsx +3 -1
|
@@ -14,8 +14,9 @@ export interface ChatTypingIndicatorProps extends BaseProps<HTMLDivElement> {
|
|
|
14
14
|
* Animated three-dot typing hint with a name-aware label.
|
|
15
15
|
*
|
|
16
16
|
* The dots bounce with staggered delays (disabled under
|
|
17
|
-
* prefers-reduced-motion)
|
|
18
|
-
*
|
|
17
|
+
* prefers-reduced-motion). Each new label is announced politely to screen
|
|
18
|
+
* readers through the shared announcement channel, unless an enclosing live
|
|
19
|
+
* container such as a chat log delivers it.
|
|
19
20
|
*
|
|
20
21
|
* @example
|
|
21
22
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatTypingIndicator.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatTypingIndicator.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ChatTypingIndicator.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatTypingIndicator.tsx"],"names":[],"mappings":"AAiCA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAOlD,MAAM,WAAW,wBAAyB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACzE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB;AAkGD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CAAC,EAClC,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,GACJ,EAAE,wBAAwB,+BAkD1B;yBAzDe,mBAAmB"}
|
|
@@ -10,19 +10,22 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Three staggered bouncing dots (stylex.keyframes, reduced-motion safe)
|
|
12
12
|
* with a grammar-aware label: "Ana is typing…", "Ana and Ben are typing…",
|
|
13
|
-
* or "Ana and 2 others are typing…".
|
|
14
|
-
*
|
|
13
|
+
* or "Ana and 2 others are typing…". The label is announced once per change
|
|
14
|
+
* through the shared polite channel (`useAnnounce`), or left to an enclosing
|
|
15
|
+
* live container such as a chat log; the element itself carries no live role
|
|
16
|
+
* (spec:AST-086 FR2, FR4). Renders dots only when no names are provided.
|
|
15
17
|
*
|
|
16
18
|
* SYNC: When modified, update these files to stay in sync:
|
|
17
19
|
* - /packages/lab/src/Chat/index.ts (exports)
|
|
18
20
|
* - /packages/lab/src/Chat/ChatTypingIndicator.doc.mjs
|
|
19
21
|
* - /apps/storybook/stories/ChatAdditions.stories.tsx (examples)
|
|
20
22
|
*/
|
|
21
|
-
import { useMemo } from 'react';
|
|
23
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
22
24
|
import * as stylex from '@stylexjs/stylex';
|
|
23
25
|
import '@astryxdesign/core/theme/tokens.stylex';
|
|
24
26
|
import { colorVars, spacingVars, radiusVars, durationVars, typographyVars, typeScaleVars } from '@astryxdesign/core/theme/tokens.stylex';
|
|
25
|
-
import { mergeProps } from '@astryxdesign/core/utils';
|
|
27
|
+
import { mergeProps, mergeRefs } from '@astryxdesign/core/utils';
|
|
28
|
+
import { useAnnounce } from '@astryxdesign/core/hooks';
|
|
26
29
|
import { themeProps } from '@astryxdesign/core/utils';
|
|
27
30
|
import { useLocale, useTranslator } from '@astryxdesign/core/i18n';
|
|
28
31
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -67,6 +70,13 @@ function typingLabel(names, t, listFormat) {
|
|
|
67
70
|
});
|
|
68
71
|
}
|
|
69
72
|
|
|
73
|
+
/**
|
|
74
|
+
* An enclosing live container (a chat transcript's role="log", or any element
|
|
75
|
+
* the page made live) already delivers content added inside it, so the
|
|
76
|
+
* indicator must not announce the same words again (spec:AST-086 FR4).
|
|
77
|
+
*/
|
|
78
|
+
const LIVE_CONTAINER_SELECTOR = '[role="log"], [role="status"], [role="alert"], [aria-live="polite"], [aria-live="assertive"]';
|
|
79
|
+
|
|
70
80
|
// =============================================================================
|
|
71
81
|
// Component
|
|
72
82
|
// =============================================================================
|
|
@@ -75,8 +85,9 @@ function typingLabel(names, t, listFormat) {
|
|
|
75
85
|
* Animated three-dot typing hint with a name-aware label.
|
|
76
86
|
*
|
|
77
87
|
* The dots bounce with staggered delays (disabled under
|
|
78
|
-
* prefers-reduced-motion)
|
|
79
|
-
*
|
|
88
|
+
* prefers-reduced-motion). Each new label is announced politely to screen
|
|
89
|
+
* readers through the shared announcement channel, unless an enclosing live
|
|
90
|
+
* container such as a chat log delivers it.
|
|
80
91
|
*
|
|
81
92
|
* @example
|
|
82
93
|
* ```
|
|
@@ -99,10 +110,29 @@ export function ChatTypingIndicator({
|
|
|
99
110
|
type: 'conjunction'
|
|
100
111
|
}), [locale]);
|
|
101
112
|
const label = typingLabel(names, t, listFormat);
|
|
113
|
+
const rootRef = useRef(null);
|
|
114
|
+
const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);
|
|
115
|
+
const announce = useAnnounce();
|
|
116
|
+
// The label last announced, so a rerender or a StrictMode effect replay does
|
|
117
|
+
// not repeat it; cleared when nobody is typing, so the same people starting
|
|
118
|
+
// again is a new occasion (spec:AST-086 FR6).
|
|
119
|
+
const announcedLabelRef = useRef(null);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (label == null) {
|
|
122
|
+
announcedLabelRef.current = null;
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
if (announcedLabelRef.current === label) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
announcedLabelRef.current = label;
|
|
129
|
+
const isInsideLiveContainer = rootRef.current?.parentElement?.closest(LIVE_CONTAINER_SELECTOR) != null;
|
|
130
|
+
if (!isInsideLiveContainer) {
|
|
131
|
+
announce(label, 'polite');
|
|
132
|
+
}
|
|
133
|
+
}, [announce, label]);
|
|
102
134
|
return /*#__PURE__*/_jsxs("div", {
|
|
103
|
-
ref:
|
|
104
|
-
role: "status",
|
|
105
|
-
"aria-live": "polite",
|
|
135
|
+
ref: mergedRef,
|
|
106
136
|
"data-testid": testId,
|
|
107
137
|
...mergeProps(themeProps('chat-typing-indicator'), stylex.props(styles.root, xstyle), className, styleProp),
|
|
108
138
|
children: [/*#__PURE__*/_jsxs("span", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentComposer.d.ts","sourceRoot":"","sources":["../../src/Comments/CommentComposer.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CAAC,SAAS,oBAAoB,EAAE,CAAC,CAAC;IAC7E,wDAAwD;IACxD,QAAQ,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC1C,6DAA6D;IAC7D,aAAa,CAAC,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAC/C,2DAA2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,EAC9B,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,KAAK,EACL,YAAoB,EACpB,KAAK,EACL,OAAO,EACP,MAAM,EACN,eAAe,EACf,cAAyB,EACzB,cAAc,EACd,QAAsB,EACtB,aAAiC,EACjC,cAAqB,EACrB,QAAQ,EACR,GAAG,EACH,GAAG,SAAS,EACb,EAAE,oBAAoB,+BAyBtB;yBA5Ce,eAAe"}
|
|
@@ -152,6 +152,8 @@ export function CommentComposerBase({
|
|
|
152
152
|
latestValueRef.current = value;
|
|
153
153
|
const isMountedRef = useRef(true);
|
|
154
154
|
const actionPendingRef = useRef(false);
|
|
155
|
+
const isSubmittingRef = useRef(isSubmitting);
|
|
156
|
+
isSubmittingRef.current = isSubmitting;
|
|
155
157
|
const imageInputRef = useRef(null);
|
|
156
158
|
const inputRef = useRef(null);
|
|
157
159
|
// Focus lands once per `focusKey`, when the input attaches: the handle ref
|
|
@@ -224,7 +226,15 @@ export function CommentComposerBase({
|
|
|
224
226
|
setActionError({
|
|
225
227
|
title: t('@astryx.commentComposer.imagesOnly'),
|
|
226
228
|
actionLabel: t('@astryx.commentComposer.chooseImages'),
|
|
227
|
-
onAction: () =>
|
|
229
|
+
onAction: () => {
|
|
230
|
+
// The picker input is never natively disabled, so its click() would
|
|
231
|
+
// open the file chooser while busy and the busy guard would drop
|
|
232
|
+
// the pick.
|
|
233
|
+
if (isSubmittingRef.current || actionPendingRef.current) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
imageInputRef.current?.click();
|
|
237
|
+
}
|
|
228
238
|
});
|
|
229
239
|
return;
|
|
230
240
|
}
|
|
@@ -329,10 +339,12 @@ export function CommentComposerBase({
|
|
|
329
339
|
accept: "image/*",
|
|
330
340
|
multiple: true,
|
|
331
341
|
hidden: true,
|
|
332
|
-
disabled: isBusy,
|
|
333
342
|
onChange: event => {
|
|
334
343
|
const files = Array.from(event.currentTarget.files ?? []);
|
|
335
344
|
event.currentTarget.value = '';
|
|
345
|
+
if (isBusy) {
|
|
346
|
+
return;
|
|
347
|
+
}
|
|
336
348
|
beginImageUpload(files);
|
|
337
349
|
}
|
|
338
350
|
}), /*#__PURE__*/_jsx(IconButton, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommentParts.d.ts","sourceRoot":"","sources":["../../src/Comments/CommentParts.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;GASG;AAEH,OAAO,EAAW,KAAK,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAC7E,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAqC3C,OAAO,EAAgB,KAAK,UAAU,EAAC,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACrB,MAAM,SAAS,CAAC;AAEjB,4EAA4E;AAC5E,eAAO,MAAM,WAAW,QAAwE,CAAC;AAwBjG;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,GAC7C,MAAM,CAAC,KAAK,MAAM,EAAE,EAAE,MAAM,CAE7B,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAyIrB,CAAC;AA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,EAAC,IAAI,EAAC,EAAE;IAAC,IAAI,EAAE,WAAW,CAAA;CAAC,+BAY7D;AAED,gEAAgE;AAChE,wBAAgB,YAAY,gCAM3B;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,KAAK,EACL,WAAW,GACZ,EAAE;IACD,KAAK,EAAE,oBAAoB,CAAC;IAC5B,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,SAAS,CAAC;CAC1D,+BAgDA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,UAAU,CAAC;IACpB,QAAQ,EAAE,SAAS,cAAc,EAAE,CAAC;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,OAAO,EACP,OAAO,EACP,iBAAiB,GAClB,EAAE;IACD,OAAO,EAAE,YAAY,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,iBAAiB,EAAE,CAAC,OAAO,EAAE,cAAc,KAAK,SAAS,CAAC;CAC3D,sCA4EA;AAwFD,+EAA+E;AAC/E,wBAAgB,4BAA4B,CAAC,EAC3C,SAAS,GACV,EAAE;IACD,SAAS,EAAE,SAAS,GAAG,MAAM,CAAC;CAC/B,+BAaA;AAED,0EAA0E;AAC1E,wBAAgB,8BAA8B,CAAC,EAC7C,WAAW,GACZ,EAAE;IACD,WAAW,EAAE,MAAM,CAAC;CACrB,+BAuCA"}
|
|
@@ -334,9 +334,10 @@ export function MetadataActionLink({
|
|
|
334
334
|
type: textType,
|
|
335
335
|
color: "secondary",
|
|
336
336
|
xstyle: partStyles.noWrap,
|
|
337
|
-
"data-metadata-action": actionRole
|
|
338
|
-
|
|
339
|
-
|
|
337
|
+
"data-metadata-action": actionRole
|
|
338
|
+
// Link keeps a disabled link in the tab order (spec:AST-085 FR1).
|
|
339
|
+
,
|
|
340
|
+
isDisabled: isDisabled,
|
|
340
341
|
onClick: event => {
|
|
341
342
|
event.preventDefault();
|
|
342
343
|
if (isDisabled !== true) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MobileTokenizer.d.ts","sourceRoot":"","sources":["../../src/MobileTokenizer/MobileTokenizer.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAYlD,OAAO,KAAK,EAAC,cAAc,EAAE,YAAY,EAAC,MAAM,8BAA8B,CAAC;AAQ/E,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,cAAc,IACtD;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,KAAK,CAAA;CAAC,GACtB;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GACzB;IAAC,IAAI,EAAE,CAAC,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GACzB;IAAC,IAAI,EAAE,SAAS,CAAA;CAAC,CAAC;AAEtB,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,IAAI,CAC1E,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,CACX;IACC,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAC9B,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,QAAQ,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,qBAAqB,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC;IACjE,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,C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SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACzC;AA8KD,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EAAE,EACxD,KAAK,EACL,YAAY,EACZ,KAAK,EACL,QAAQ,EACR,WAAW,EACX,WAAW,EACX,UAAU,EACV,UAAkB,EAClB,SAAiB,EACjB,UAAU,EACV,YAAiB,EACjB,cAAkB,EAClB,UAAgB,EAChB,sBAA2C,EAC3C,aAAa,EACb,MAAM,GACP,EAAE,oBAAoB,CAAC,CAAC,CAAC,+BA2WzB;yBA5Xe,eAAe"}
|
|
@@ -67,6 +67,14 @@ function ListBulletIcon(props) {
|
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
const styles = {
|
|
70
|
+
tokenDisabled: {
|
|
71
|
+
kMwMTN: "x1tgivj0 x1bhcspo",
|
|
72
|
+
$$css: true
|
|
73
|
+
},
|
|
74
|
+
indicatorDisabled: {
|
|
75
|
+
kVAM5u: "x14i3s5s xmnqt3w",
|
|
76
|
+
$$css: true
|
|
77
|
+
},
|
|
70
78
|
footerAction: {
|
|
71
79
|
kzQI83: "x1iyjqo2",
|
|
72
80
|
kCS8Yb: "x1r8uery",
|
|
@@ -229,23 +237,37 @@ export function MobileTokenizer({
|
|
|
229
237
|
"aria-haspopup": "dialog",
|
|
230
238
|
"aria-expanded": activeSheet != null,
|
|
231
239
|
"aria-label": label,
|
|
232
|
-
disabled: isDisabled,
|
|
240
|
+
"aria-disabled": isDisabled || undefined,
|
|
233
241
|
onClick: () => {
|
|
242
|
+
if (isDisabled) {
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
234
245
|
setSelectedItemsAtOpen(value);
|
|
235
246
|
lastLoadScrollHeightRef.current = null;
|
|
236
247
|
setRenderedItemCount(LIST_RENDER_BATCH_SIZE);
|
|
237
248
|
setActiveSheet('manage');
|
|
238
249
|
},
|
|
239
250
|
...{
|
|
240
|
-
|
|
241
|
-
|
|
251
|
+
0: {
|
|
252
|
+
className: "x78zum5 x1a02dak x6s0dn4 xzye2dw xh8yej3 x1gg8mnh xu0wf1k xf314gf xmkeg23 x1y0btm7 x14i3s5s xh6dtrn xjbqb8w x1yc453h x1ypdohk x16khyan"
|
|
253
|
+
},
|
|
254
|
+
1: {
|
|
255
|
+
className: "x78zum5 x1a02dak x6s0dn4 xzye2dw xh8yej3 x1gg8mnh xu0wf1k xf314gf xmkeg23 x1y0btm7 xh6dtrn xjbqb8w x1yc453h x1ypdohk x16khyan x14i3s5s xmnqt3w x1bhcspo"
|
|
256
|
+
}
|
|
257
|
+
}[!!isDisabled << 0],
|
|
242
258
|
children: value.length > 0 ? value.map(item => /*#__PURE__*/_jsx(Token, {
|
|
243
259
|
label: item.label,
|
|
244
|
-
isDisabled: isDisabled
|
|
260
|
+
isDisabled: isDisabled,
|
|
261
|
+
xstyle: isDisabled ? styles.tokenDisabled : undefined
|
|
245
262
|
}, item.id)) : /*#__PURE__*/_jsx("span", {
|
|
246
263
|
...{
|
|
247
|
-
|
|
248
|
-
|
|
264
|
+
0: {
|
|
265
|
+
className: "xv1l7n4"
|
|
266
|
+
},
|
|
267
|
+
1: {
|
|
268
|
+
className: "xv1l7n4 x1bhcspo"
|
|
269
|
+
}
|
|
270
|
+
}[!!isDisabled << 0],
|
|
249
271
|
children: placeholder ?? ''
|
|
250
272
|
})
|
|
251
273
|
}), !isDisabled && /*#__PURE__*/_jsx(BottomSheetSwitcher, {
|
|
@@ -341,23 +363,39 @@ export function MobileTokenizer({
|
|
|
341
363
|
role: "checkbox",
|
|
342
364
|
"aria-checked": isSelected,
|
|
343
365
|
"aria-label": item.label,
|
|
344
|
-
disabled: rowDisabled,
|
|
345
|
-
onClick: () =>
|
|
346
|
-
|
|
347
|
-
|
|
366
|
+
"aria-disabled": rowDisabled || undefined,
|
|
367
|
+
onClick: () => {
|
|
368
|
+
if (rowDisabled) {
|
|
369
|
+
return;
|
|
370
|
+
}
|
|
371
|
+
if (isSelected) {
|
|
372
|
+
handleRemove(item);
|
|
373
|
+
} else {
|
|
374
|
+
handleAdd(item);
|
|
375
|
+
}
|
|
348
376
|
},
|
|
377
|
+
...{
|
|
378
|
+
0: {
|
|
379
|
+
className: "x78zum5 x6s0dn4 x1qughib x1txdalj xh8yej3 x1gg8mnh xce4md1 x7a5moj xc342km xh6dtrn xjbqb8w x1tgivj0 x1yc453h x1ypdohk x16khyan"
|
|
380
|
+
},
|
|
381
|
+
1: {
|
|
382
|
+
className: "x78zum5 x6s0dn4 x1qughib x1txdalj xh8yej3 x1gg8mnh xce4md1 x7a5moj xc342km xh6dtrn xjbqb8w x1yc453h x1ypdohk x16khyan x1tgivj0 x1bhcspo"
|
|
383
|
+
}
|
|
384
|
+
}[!!rowDisabled << 0],
|
|
349
385
|
children: [/*#__PURE__*/_jsx("span", {
|
|
350
386
|
...{
|
|
351
387
|
className: "x1iyjqo2 xeuugli"
|
|
352
388
|
},
|
|
353
389
|
children: /*#__PURE__*/_jsx(Text, {
|
|
354
390
|
type: "body",
|
|
391
|
+
color: rowDisabled ? 'inherit' : undefined,
|
|
355
392
|
children: item.label
|
|
356
393
|
})
|
|
357
394
|
}), /*#__PURE__*/_jsx(CheckboxIndicator, {
|
|
358
395
|
state: isSelected ? 'checked' : 'unchecked',
|
|
359
396
|
size: "md",
|
|
360
|
-
isDisabled: rowDisabled
|
|
397
|
+
isDisabled: rowDisabled,
|
|
398
|
+
xstyle: rowDisabled ? styles.indicatorDisabled : undefined
|
|
361
399
|
})]
|
|
362
400
|
}, item.id);
|
|
363
401
|
})]
|
package/dist/lab.css
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
@keyframes x9ppb3p-B{0%{stroke-dasharray:2%,300%;stroke-dashoffset:0%;}50%{stroke-dasharray:175%,300%;stroke-dashoffset:-68%;}100%{stroke-dasharray:2%,300%;stroke-dashoffset:-302%;}}
|
|
29
29
|
@keyframes xqng64z-B{0%{transform:rotate(0deg);}100%{transform:rotate(360deg);}}
|
|
30
30
|
@keyframes x17t2jll-B{0%{transform:translateY(0);opacity:.35;}30%{transform:translateY(-3px);opacity:1;}60%{transform:translateY(0);opacity:.35;}100%{transform:translateY(0);opacity:.35;}}
|
|
31
|
-
:root, .x7j7z01{--color-data-categorical-blue:light-dark(#0171E3, #0171E3);--color-data-categorical-orange:light-dark(#EB6E00, #EB6E00);--color-data-categorical-purple:light-dark(#6B1EFD, #6B1EFD);--color-data-categorical-green:light-dark(#0B991F, #0B991F);--color-data-categorical-pink:light-dark(#F351C0, #F351C0);--color-data-categorical-cyan:light-dark(#0171A4, #0171A4);--color-data-categorical-red:light-dark(#F5394F, #F5394F);--color-data-categorical-teal:light-dark(#08A3A3, #08A3A3);--color-data-categorical-brown:light-dark(#965E03, #965E03);--color-data-categorical-indigo:light-dark(#6F8AFF, #6F8AFF);--color-data-neutral:light-dark(#8494A3, #8C939B);--color-data-blue-5:light-dark(#02165E, #02165E);--color-data-blue-4:light-dark(#004CBC, #004CBC);--color-data-blue-3:light-dark(#2694FE, #2694FE);--color-data-blue-2:light-dark(#78BEFF, #78BEFF);--color-data-blue-1:light-dark(#DBECFF, #DBECFF);--color-data-shamrock-5:light-dark(#0B603D, #0B603D);--color-data-shamrock-4:light-dark(#138546, #138546);--color-data-shamrock-3:light-dark(#24BB5E, #24BB5E);--color-data-shamrock-2:light-dark(#8EF7AA, #8EF7AA);--color-data-shamrock-1:light-dark(#D6FEE4, #D6FEE4);--color-data-orange-5:light-dark(#A13F04, #A13F04);--color-data-orange-4:light-dark(#D66100, #D66100);--color-data-orange-3:light-dark(#FD9537, #FD9537);--color-data-orange-2:light-dark(#FDB876, #FDB876);--color-data-orange-1:light-dark(#FFE6CF, #FFE6CF);--color-data-pink-5:light-dark(#8E1073, #8E1073);--color-data-pink-4:light-dark(#D123A1, #D123A1);--color-data-pink-3:light-dark(#F989D3, #F989D3);--color-data-pink-2:light-dark(#FEADE3, #FEADE3);--color-data-pink-1:light-dark(#FCE3F4, #FCE3F4);--color-data-purple-5:light-dark(#3E0697, #3E0697);--color-data-purple-4:light-dark(#6B1EFD, #6B1EFD);--color-data-purple-3:light-dark(#9081FF, #9081FF);--color-data-purple-2:light-dark(#B3B0FE, #B3B0FE);--color-data-purple-1:light-dark(#E8E8FB, #E8E8FB);--color-data-red-5:light-dark(#9D0519, #9D0519);--color-data-red-4:light-dark(#D31130, #D31130);--color-data-red-3:light-dark(#FB7D87, #FB7D87);--color-data-red-2:light-dark(#FFB2B8, #FFB2B8);--color-data-red-1:light-dark(#FEE4E6, #FEE4E6);--color-data-teal-5:light-dark(#08767D, #08767D);--color-data-teal-4:light-dark(#0C9293, #0C9293);--color-data-teal-3:light-dark(#0DB7AF, #0DB7AF);--color-data-teal-2:light-dark(#6CE6D8, #6CE6D8);--color-data-teal-1:light-dark(#D7FCF8, #D7FCF8);--color-data-yellow-5:light-dark(#8A5001, #8A5001);--color-data-yellow-4:light-dark(#D69804, #D69804);--color-data-yellow-3:light-dark(#FBCE03, #FBCE03);--color-data-yellow-2:light-dark(#FCEC85, #FCEC85);--color-data-yellow-1:light-dark(#FDF6BA, #FDF6BA);--color-data-gray-5:light-dark(#25363F, #333338);--color-data-gray-4:light-dark(#5D6C7B, #666A72);--color-data-gray-3:light-dark(#AFB9C4, #B2B8BE);--color-data-gray-2:light-dark(#CCD3DB, #D0D3D6);--color-data-gray-1:light-dark(#F1F4F7, #F2F4F6);}
|
|
32
31
|
:root, .x1ucsbpz{--icon-layer-primary-fill:none;--icon-layer-primary-stroke:currentColor;--icon-layer-primary-opacity:1;--icon-layer-primary-stroke-role-fill:none;--icon-layer-primary-stroke-role-stroke:currentColor;--icon-layer-primary-stroke-role-opacity:1;--icon-layer-primary-stroke-role-width:1.5;--icon-layer-secondary-fill:none;--icon-layer-secondary-stroke:currentColor;--icon-layer-secondary-opacity:1;--icon-layer-secondary-stroke-role-fill:none;--icon-layer-secondary-stroke-role-stroke:currentColor;--icon-layer-secondary-stroke-role-opacity:1;--icon-layer-secondary-stroke-role-width:1.5;--icon-size:24px;--icon-stroke-width:1.5;--icon-stroke-linecap:round;--icon-stroke-linejoin:round;--icon-padding:0px;--icon-inline-offset:0px;--icon-block-offset:0px;--icon-bold-stroke-boost:0.5;--icon-gap:0.75;--icon-gap-linejoin:round;}
|
|
33
32
|
:root, .xc6kv0w{--transfer-list-panel-min-block-size:12rem;--transfer-list-panel-max-block-size:20rem;}
|
|
34
33
|
.x1eijsz{--icon-layer-primary-fill:currentColor}
|
|
@@ -158,6 +157,7 @@
|
|
|
158
157
|
.xz7zccy.xz7zccy:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){border-color:var(--color-accent)}
|
|
159
158
|
.xg9gykk.xg9gykk:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){text-decoration:underline}
|
|
160
159
|
@media (forced-colors: active){.x1w1tqly.x1w1tqly:not(#\#):not(#\#){border-color:CanvasText}}
|
|
160
|
+
@media (forced-colors: active){.xmnqt3w.xmnqt3w:not(#\#):not(#\#){border-color:GrayText}}
|
|
161
161
|
@media (forced-colors: active){.x1n2ykn.x1n2ykn:not(#\#):not(#\#){border-color:Highlight}}
|
|
162
162
|
@media (hover: hover){.xmhmdd9.xmhmdd9.xmhmdd9:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){border-color:var(--color-accent)}}
|
|
163
163
|
@media (hover: hover){.x1xwh4np.x1xwh4np.x1xwh4np:hover:where(:not(:disabled,[aria-disabled="true"])):not(#\#):not(#\#){border-color:var(--color-border-emphasized)}}
|
|
@@ -597,6 +597,7 @@
|
|
|
597
597
|
@media (prefers-reduced-motion: reduce) and (not (forced-colors: active)){.x1peun2k.x1peun2k:not(#\#):not(#\#):not(#\#){background-image:none}}
|
|
598
598
|
@media (forced-colors: active){.xwaqzdf.xwaqzdf:not(#\#):not(#\#):not(#\#){box-shadow:none}}
|
|
599
599
|
@media (forced-colors: active){.xs5hli.xs5hli:not(#\#):not(#\#):not(#\#){color:CanvasText}}
|
|
600
|
+
@media (forced-colors: active){.x1bhcspo.x1bhcspo:not(#\#):not(#\#):not(#\#){color:GrayText}}
|
|
600
601
|
@media (forced-colors: active){.x1k5gbb1.x1k5gbb1:not(#\#):not(#\#):not(#\#){color:HighlightText}}
|
|
601
602
|
@media (prefers-reduced-motion: reduce) and (not (forced-colors: active)){.x1wi2gft.x1wi2gft:not(#\#):not(#\#):not(#\#){color:var(--color-text-secondary)}}
|
|
602
603
|
@media (forced-colors: active){.x1tbh5bv.x1tbh5bv:not(#\#):not(#\#):not(#\#){opacity:1}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/lab",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3-canary.02f5fe4",
|
|
4
4
|
"description": "Experimental Astryx components — published to npm only under the @canary dist-tag for early testing; never released as a stable (latest) version.",
|
|
5
5
|
"author": "Meta Open Source",
|
|
6
6
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@stylexjs/stylex": ">=0.10.0",
|
|
52
|
-
"@astryxdesign/core": "0.7.
|
|
52
|
+
"@astryxdesign/core": "0.7.3-canary.02f5fe4",
|
|
53
53
|
"react": ">=19.0.0",
|
|
54
54
|
"react-dom": ">=19.0.0"
|
|
55
55
|
},
|
|
@@ -59,8 +59,8 @@
|
|
|
59
59
|
"d3-shape": "^3.2.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@astryxdesign/a11y-spec": "0.7.
|
|
63
|
-
"@astryxdesign/cli": "0.7.
|
|
62
|
+
"@astryxdesign/a11y-spec": "0.7.3-canary.02f5fe4",
|
|
63
|
+
"@astryxdesign/cli": "0.7.3-canary.02f5fe4",
|
|
64
64
|
"@babel/cli": "^7.29.7",
|
|
65
65
|
"@babel/core": "^7.29.7",
|
|
66
66
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -8,7 +8,7 @@ export const docs = {
|
|
|
8
8
|
group: 'Chat',
|
|
9
9
|
category: 'Chat',
|
|
10
10
|
displayName: 'Chat Typing Indicator',
|
|
11
|
-
description: 'Animated three-dot typing hint with a localized, grammar-aware label: "Ana is typing...", "Ana and Ben are typing...", or "Ana and 2 others are typing...". Dots bounce with staggered stylex.keyframes delays, disabled under prefers-reduced-motion
|
|
11
|
+
description: 'Animated three-dot typing hint with a localized, grammar-aware label: "Ana is typing...", "Ana and Ben are typing...", or "Ana and 2 others are typing...". Dots bounce with staggered stylex.keyframes delays, disabled under prefers-reduced-motion. Each new label is announced once, politely, through the shared announcement channel (useAnnounce); inside a chat log the log announces it instead. The indicator itself carries no live role, so it can mount conditionally without being skipped or heard twice.',
|
|
12
12
|
props: [
|
|
13
13
|
{
|
|
14
14
|
name: 'names',
|
|
@@ -21,7 +21,7 @@ export const docs = {
|
|
|
21
21
|
export const docsZh = {
|
|
22
22
|
name: 'ChatTypingIndicator',
|
|
23
23
|
displayName: 'Chat Typing Indicator',
|
|
24
|
-
description: '带语法感知标签的三点跳动输入提示:"Ana is typing..."、"Ana and Ben are typing..." 或 "Ana and 2 others are typing..."。圆点用 stylex.keyframes 交错跳动,prefers-reduced-motion
|
|
24
|
+
description: '带语法感知标签的三点跳动输入提示:"Ana is typing..."、"Ana and Ben are typing..." 或 "Ana and 2 others are typing..."。圆点用 stylex.keyframes 交错跳动,prefers-reduced-motion 下禁用。每个新标签通过共享播报通道(useAnnounce)礼貌播报一次;位于聊天记录(role="log")内时由记录负责播报。指示器本身不带 live 角色,因此可按条件挂载,既不会被跳过,也不会重复播报。',
|
|
25
25
|
propDescriptions: {
|
|
26
26
|
names: '正在输入的人名。一个名字渲染 "is typing",两个渲染双名,更多折叠为 "and N others"。语句取自 i18n 词条,人名由 Intl.ListFormat 按当前语言拼接,因此措辞与连接词随语言而变。省略或为空时仅渲染动画圆点。',
|
|
27
27
|
},
|
|
@@ -30,7 +30,7 @@ export const docsZh = {
|
|
|
30
30
|
export const docsDense = {
|
|
31
31
|
name: 'ChatTypingIndicator',
|
|
32
32
|
displayName: 'Chat Typing Indicator',
|
|
33
|
-
description: 'bouncing three-dot typing hint; label grammar 1/2/N names; reduced-motion safe keyframes; role=
|
|
33
|
+
description: 'bouncing three-dot typing hint; label grammar 1/2/N names; reduced-motion safe keyframes; announces each new label once via useAnnounce (polite), or leaves it to an enclosing role=log; no live role on the element; dots-only when names empty',
|
|
34
34
|
propDescriptions: {
|
|
35
35
|
names:
|
|
36
36
|
"string[]; 1='X is typing', 2='X and Y', 3+='X and N others'; phrases from i18n catalog, names joined by Intl.ListFormat; empty=dots only",
|
|
@@ -1,10 +1,21 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import {StrictMode} from 'react';
|
|
4
|
+
import {beforeEach, describe, it, expect, vi} from 'vitest';
|
|
4
5
|
import {render, screen} from '@testing-library/react';
|
|
5
6
|
import {ChatTypingIndicator} from './ChatTypingIndicator';
|
|
6
7
|
import {InternationalizationProvider} from '@astryxdesign/core/i18n';
|
|
7
8
|
|
|
9
|
+
const announce = vi.fn();
|
|
10
|
+
vi.mock('@astryxdesign/core/hooks', async importOriginal => ({
|
|
11
|
+
...(await importOriginal<typeof import('@astryxdesign/core/hooks')>()),
|
|
12
|
+
useAnnounce: () => announce,
|
|
13
|
+
}));
|
|
14
|
+
|
|
15
|
+
beforeEach(() => {
|
|
16
|
+
announce.mockClear();
|
|
17
|
+
});
|
|
18
|
+
|
|
8
19
|
describe('ChatTypingIndicator', () => {
|
|
9
20
|
it('renders "X is typing…" for one name', () => {
|
|
10
21
|
render(<ChatTypingIndicator names={['Ana']} />);
|
|
@@ -84,4 +95,58 @@ describe('ChatTypingIndicator', () => {
|
|
|
84
95
|
'astryx-chat-typing-indicator',
|
|
85
96
|
);
|
|
86
97
|
});
|
|
98
|
+
|
|
99
|
+
describe('status announcement (spec:AST-086)', () => {
|
|
100
|
+
it('mounts with its label but carries no live role (FR2)', () => {
|
|
101
|
+
const {container} = render(<ChatTypingIndicator names={['Ana']} />);
|
|
102
|
+
const root = container.firstElementChild as HTMLElement;
|
|
103
|
+
expect(root).toHaveTextContent('Ana is typing…');
|
|
104
|
+
expect(root).not.toHaveAttribute('role');
|
|
105
|
+
expect(root).not.toHaveAttribute('aria-live');
|
|
106
|
+
expect(screen.queryByRole('status')).toBeNull();
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('announces a mounted label once through the polite channel, even under StrictMode (FR2, FR6)', () => {
|
|
110
|
+
const {rerender} = render(
|
|
111
|
+
<StrictMode>
|
|
112
|
+
<ChatTypingIndicator names={['Ana']} />
|
|
113
|
+
</StrictMode>,
|
|
114
|
+
);
|
|
115
|
+
rerender(
|
|
116
|
+
<StrictMode>
|
|
117
|
+
<ChatTypingIndicator names={['Ana']} />
|
|
118
|
+
</StrictMode>,
|
|
119
|
+
);
|
|
120
|
+
expect(announce.mock.calls).toEqual([['Ana is typing…', 'polite']]);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('announces each new label, nothing on clear, and the same people again as a new occasion (FR6)', () => {
|
|
124
|
+
const {rerender} = render(<ChatTypingIndicator names={[]} />);
|
|
125
|
+
expect(announce).not.toHaveBeenCalled();
|
|
126
|
+
rerender(<ChatTypingIndicator names={['Ana']} />);
|
|
127
|
+
rerender(<ChatTypingIndicator names={['Ana', 'Ben']} />);
|
|
128
|
+
rerender(<ChatTypingIndicator names={[]} />);
|
|
129
|
+
rerender(<ChatTypingIndicator names={['Ana', 'Ben']} />);
|
|
130
|
+
expect(announce.mock.calls).toEqual([
|
|
131
|
+
['Ana is typing…', 'polite'],
|
|
132
|
+
['Ana and Ben are typing…', 'polite'],
|
|
133
|
+
['Ana and Ben are typing…', 'polite'],
|
|
134
|
+
]);
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it('leaves delivery to an enclosing chat log (FR4)', () => {
|
|
138
|
+
const {rerender} = render(
|
|
139
|
+
<div role="log">
|
|
140
|
+
<ChatTypingIndicator names={['Ana']} />
|
|
141
|
+
</div>,
|
|
142
|
+
);
|
|
143
|
+
rerender(
|
|
144
|
+
<div role="log">
|
|
145
|
+
<ChatTypingIndicator names={['Ana', 'Ben']} />
|
|
146
|
+
</div>,
|
|
147
|
+
);
|
|
148
|
+
expect(announce).not.toHaveBeenCalled();
|
|
149
|
+
expect(screen.queryByRole('status')).toBeNull();
|
|
150
|
+
});
|
|
151
|
+
});
|
|
87
152
|
});
|
|
@@ -10,8 +10,10 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Three staggered bouncing dots (stylex.keyframes, reduced-motion safe)
|
|
12
12
|
* with a grammar-aware label: "Ana is typing…", "Ana and Ben are typing…",
|
|
13
|
-
* or "Ana and 2 others are typing…".
|
|
14
|
-
*
|
|
13
|
+
* or "Ana and 2 others are typing…". The label is announced once per change
|
|
14
|
+
* through the shared polite channel (`useAnnounce`), or left to an enclosing
|
|
15
|
+
* live container such as a chat log; the element itself carries no live role
|
|
16
|
+
* (spec:AST-086 FR2, FR4). Renders dots only when no names are provided.
|
|
15
17
|
*
|
|
16
18
|
* SYNC: When modified, update these files to stay in sync:
|
|
17
19
|
* - /packages/lab/src/Chat/index.ts (exports)
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
* - /apps/storybook/stories/ChatAdditions.stories.tsx (examples)
|
|
20
22
|
*/
|
|
21
23
|
|
|
22
|
-
import {useMemo} from 'react';
|
|
24
|
+
import {useEffect, useMemo, useRef} from 'react';
|
|
23
25
|
import * as stylex from '@stylexjs/stylex';
|
|
24
26
|
import {
|
|
25
27
|
colorVars,
|
|
@@ -30,7 +32,8 @@ import {
|
|
|
30
32
|
typeScaleVars,
|
|
31
33
|
} from '@astryxdesign/core/theme/tokens.stylex';
|
|
32
34
|
import type {BaseProps} from '@astryxdesign/core';
|
|
33
|
-
import {mergeProps} from '@astryxdesign/core/utils';
|
|
35
|
+
import {mergeProps, mergeRefs} from '@astryxdesign/core/utils';
|
|
36
|
+
import {useAnnounce} from '@astryxdesign/core/hooks';
|
|
34
37
|
import {themeProps} from '@astryxdesign/core/utils';
|
|
35
38
|
import {useLocale, useTranslator} from '@astryxdesign/core/i18n';
|
|
36
39
|
import type {TranslatorFn} from '@astryxdesign/core/i18n';
|
|
@@ -132,6 +135,14 @@ function typingLabel(
|
|
|
132
135
|
});
|
|
133
136
|
}
|
|
134
137
|
|
|
138
|
+
/**
|
|
139
|
+
* An enclosing live container (a chat transcript's role="log", or any element
|
|
140
|
+
* the page made live) already delivers content added inside it, so the
|
|
141
|
+
* indicator must not announce the same words again (spec:AST-086 FR4).
|
|
142
|
+
*/
|
|
143
|
+
const LIVE_CONTAINER_SELECTOR =
|
|
144
|
+
'[role="log"], [role="status"], [role="alert"], [aria-live="polite"], [aria-live="assertive"]';
|
|
145
|
+
|
|
135
146
|
// =============================================================================
|
|
136
147
|
// Component
|
|
137
148
|
// =============================================================================
|
|
@@ -140,8 +151,9 @@ function typingLabel(
|
|
|
140
151
|
* Animated three-dot typing hint with a name-aware label.
|
|
141
152
|
*
|
|
142
153
|
* The dots bounce with staggered delays (disabled under
|
|
143
|
-
* prefers-reduced-motion)
|
|
144
|
-
*
|
|
154
|
+
* prefers-reduced-motion). Each new label is announced politely to screen
|
|
155
|
+
* readers through the shared announcement channel, unless an enclosing live
|
|
156
|
+
* container such as a chat log delivers it.
|
|
145
157
|
*
|
|
146
158
|
* @example
|
|
147
159
|
* ```
|
|
@@ -164,11 +176,33 @@ export function ChatTypingIndicator({
|
|
|
164
176
|
[locale],
|
|
165
177
|
);
|
|
166
178
|
const label = typingLabel(names, t, listFormat);
|
|
179
|
+
|
|
180
|
+
const rootRef = useRef<HTMLDivElement>(null);
|
|
181
|
+
const mergedRef = useMemo(() => mergeRefs(rootRef, ref), [ref]);
|
|
182
|
+
const announce = useAnnounce();
|
|
183
|
+
// The label last announced, so a rerender or a StrictMode effect replay does
|
|
184
|
+
// not repeat it; cleared when nobody is typing, so the same people starting
|
|
185
|
+
// again is a new occasion (spec:AST-086 FR6).
|
|
186
|
+
const announcedLabelRef = useRef<string | null>(null);
|
|
187
|
+
useEffect(() => {
|
|
188
|
+
if (label == null) {
|
|
189
|
+
announcedLabelRef.current = null;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
192
|
+
if (announcedLabelRef.current === label) {
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
announcedLabelRef.current = label;
|
|
196
|
+
const isInsideLiveContainer =
|
|
197
|
+
rootRef.current?.parentElement?.closest(LIVE_CONTAINER_SELECTOR) != null;
|
|
198
|
+
if (!isInsideLiveContainer) {
|
|
199
|
+
announce(label, 'polite');
|
|
200
|
+
}
|
|
201
|
+
}, [announce, label]);
|
|
202
|
+
|
|
167
203
|
return (
|
|
168
204
|
<div
|
|
169
|
-
ref={
|
|
170
|
-
role="status"
|
|
171
|
-
aria-live="polite"
|
|
205
|
+
ref={mergedRef}
|
|
172
206
|
data-testid={testId}
|
|
173
207
|
{...mergeProps(
|
|
174
208
|
themeProps('chat-typing-indicator'),
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
/** Shared jsdom and Storybook renderings for ChatTypingIndicator status states. */
|
|
6
6
|
|
|
7
|
-
import {useState, type ReactElement} from 'react';
|
|
7
|
+
import {useEffect, useState, type ReactElement} from 'react';
|
|
8
|
+
import {useAnnounce} from '@astryxdesign/core/hooks';
|
|
8
9
|
import {ChatTypingIndicator} from '../ChatTypingIndicator';
|
|
9
10
|
import type {ChatTypingStatusStateId} from './ChatTypingIndicator.a11y.states';
|
|
10
11
|
|
|
@@ -27,12 +28,35 @@ function TransitionButton({
|
|
|
27
28
|
);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Establishes the singleton polite channel the indicator announces through,
|
|
33
|
+
* then clears the seed, so the binding inspects the pre-existing empty region.
|
|
34
|
+
*/
|
|
35
|
+
function PrimePoliteChannel() {
|
|
36
|
+
const announce = useAnnounce();
|
|
37
|
+
const [isReady, setIsReady] = useState(false);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
let secondFrame = 0;
|
|
40
|
+
announce('Preparing status channel', 'polite');
|
|
41
|
+
const firstFrame = requestAnimationFrame(() => {
|
|
42
|
+
secondFrame = requestAnimationFrame(() => {
|
|
43
|
+
announce('', 'polite');
|
|
44
|
+
setIsReady(true);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
return () => {
|
|
48
|
+
cancelAnimationFrame(firstFrame);
|
|
49
|
+
cancelAnimationFrame(secondFrame);
|
|
50
|
+
};
|
|
51
|
+
}, [announce]);
|
|
52
|
+
return <span data-a11y-ready={String(isReady)} hidden />;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function TypingHarness() {
|
|
56
|
+
const [names, setNames] = useState<string[]>([]);
|
|
33
57
|
return (
|
|
34
58
|
<div>
|
|
35
|
-
<
|
|
59
|
+
<PrimePoliteChannel />
|
|
36
60
|
<button data-a11y-relation="focus-anchor" type="button">
|
|
37
61
|
Keep focus
|
|
38
62
|
</button>
|
|
@@ -53,8 +77,7 @@ export const CHAT_TYPING_STATUS_STATE_RENDERS: Record<
|
|
|
53
77
|
ChatTypingStatusStateId,
|
|
54
78
|
ChatTypingStatusStateRender
|
|
55
79
|
> = {
|
|
56
|
-
'chat-typing-empty-to-message': () => <TypingHarness
|
|
57
|
-
'chat-typing-name-mounted': () => <TypingHarness startsNamed />,
|
|
80
|
+
'chat-typing-empty-to-message': () => <TypingHarness />,
|
|
58
81
|
};
|
|
59
82
|
|
|
60
83
|
export {transitionTestId};
|
|
@@ -9,12 +9,11 @@
|
|
|
9
9
|
|
|
10
10
|
import type {StatusMessageStateFacts} from '@astryxdesign/a11y-spec';
|
|
11
11
|
|
|
12
|
-
export type ChatTypingStatusStateId =
|
|
13
|
-
'chat-typing-empty-to-message' | 'chat-typing-name-mounted';
|
|
12
|
+
export type ChatTypingStatusStateId = 'chat-typing-empty-to-message';
|
|
14
13
|
|
|
15
14
|
export interface ChatTypingStatusBindingDefinition {
|
|
16
15
|
readonly id: ChatTypingStatusStateId;
|
|
17
|
-
readonly binding: 'ChatTypingIndicator';
|
|
16
|
+
readonly binding: 'ChatTypingIndicator announcement channel';
|
|
18
17
|
readonly summary: string;
|
|
19
18
|
readonly facts: StatusMessageStateFacts;
|
|
20
19
|
readonly storyId: string;
|
|
@@ -28,30 +27,19 @@ const LIFECYCLE_FACTS: StatusMessageStateFacts = {
|
|
|
28
27
|
initialMessage: '',
|
|
29
28
|
message: 'Ana is typing…',
|
|
30
29
|
replacement: 'Ana and Ben are typing…',
|
|
31
|
-
semanticTransitions: ['show', 'replace'
|
|
30
|
+
semanticTransitions: ['show', 'replace'],
|
|
32
31
|
};
|
|
33
32
|
|
|
34
33
|
export const CHAT_TYPING_STATUS_BINDING_STATES: ReadonlyArray<ChatTypingStatusBindingDefinition> =
|
|
35
34
|
[
|
|
36
35
|
{
|
|
37
36
|
id: 'chat-typing-empty-to-message',
|
|
38
|
-
binding: 'ChatTypingIndicator',
|
|
37
|
+
binding: 'ChatTypingIndicator announcement channel',
|
|
39
38
|
summary:
|
|
40
|
-
'
|
|
39
|
+
'one name, then two, reach the persistent polite channel as the indicator updates',
|
|
41
40
|
facts: LIFECYCLE_FACTS,
|
|
42
41
|
storyId: 'a11y-status-message-pattern--chat-typing-empty-to-message',
|
|
43
42
|
},
|
|
44
|
-
{
|
|
45
|
-
id: 'chat-typing-name-mounted',
|
|
46
|
-
binding: 'ChatTypingIndicator',
|
|
47
|
-
summary: 'the documented named indicator is mounted with its status text',
|
|
48
|
-
facts: {
|
|
49
|
-
...LIFECYCLE_FACTS,
|
|
50
|
-
initialMessage: 'Ana is typing…',
|
|
51
|
-
semanticTransitions: ['replace'],
|
|
52
|
-
},
|
|
53
|
-
storyId: 'a11y-status-message-pattern--chat-typing-name-mounted',
|
|
54
|
-
},
|
|
55
43
|
];
|
|
56
44
|
|
|
57
45
|
export type ChatTypingStatusBindingState = ChatTypingStatusBindingDefinition;
|
|
@@ -61,7 +49,19 @@ export const CHAT_TYPING_STATUS_EXCLUSIONS = [
|
|
|
61
49
|
owner: 'ChatTypingIndicator',
|
|
62
50
|
part: 'omitted names',
|
|
63
51
|
reason:
|
|
64
|
-
'Omitted names and an empty names array render the same
|
|
52
|
+
'Omitted names and an empty names array render the same dots-only indicator and announce nothing, so one binding row covers both inputs.',
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
owner: 'ChatTypingIndicator',
|
|
56
|
+
part: 'indicator mounted with names',
|
|
57
|
+
reason:
|
|
58
|
+
'A named indicator that mounts announces its label once through the same channel; the channel text clears on its own timer, so the mount occasion is asserted with a channel spy in ChatTypingIndicator.test.tsx rather than as a bound initial state.',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
owner: 'useAnnounce',
|
|
62
|
+
part: 'clearing the names',
|
|
63
|
+
reason:
|
|
64
|
+
'Clearing removes the visible label and announces nothing; the channel clears its own text after each announcement, so no clear transition is observable on it.',
|
|
65
65
|
},
|
|
66
66
|
{
|
|
67
67
|
owner: 'ChatTypingIndicator and theme',
|
|
@@ -73,6 +73,6 @@ export const CHAT_TYPING_STATUS_EXCLUSIONS = [
|
|
|
73
73
|
owner: 'ChatMessageList',
|
|
74
74
|
part: 'transcript log announcements',
|
|
75
75
|
reason:
|
|
76
|
-
'
|
|
76
|
+
'Inside a role=log the indicator announces nothing and the log delivers the label as added content (spec:AST-086 FR4), asserted in ChatTypingIndicator.test.tsx.',
|
|
77
77
|
},
|
|
78
78
|
] as const;
|
|
@@ -71,6 +71,8 @@ describe('ChatTypingIndicator status-message binding — jsdom lane', () => {
|
|
|
71
71
|
it('records equivalent and separately owned states explicitly', () => {
|
|
72
72
|
expect(CHAT_TYPING_STATUS_EXCLUSIONS.map(entry => entry.part)).toEqual([
|
|
73
73
|
'omitted names',
|
|
74
|
+
'indicator mounted with names',
|
|
75
|
+
'clearing the names',
|
|
74
76
|
'typing-dot animation and reduced motion',
|
|
75
77
|
'transcript log announcements',
|
|
76
78
|
]);
|
|
@@ -25,7 +25,7 @@ vi.mock('../EmojiPicker/emojiData', () => ({
|
|
|
25
25
|
],
|
|
26
26
|
}));
|
|
27
27
|
|
|
28
|
-
import {CommentComposer} from './CommentComposer';
|
|
28
|
+
import {CommentComposer, CommentComposerBase} from './CommentComposer';
|
|
29
29
|
|
|
30
30
|
const originalMatches = HTMLElement.prototype.matches;
|
|
31
31
|
const popoverOpenState = new WeakMap<HTMLElement, boolean>();
|
|
@@ -101,6 +101,34 @@ describe('CommentComposer', () => {
|
|
|
101
101
|
expect(onSubmit).toHaveBeenCalledWith('Looks good');
|
|
102
102
|
});
|
|
103
103
|
|
|
104
|
+
it('keeps Cancel in the tab order but inert while submitting (AST-085 FR1, FR2)', () => {
|
|
105
|
+
const onCancel = vi.fn();
|
|
106
|
+
render(
|
|
107
|
+
<CommentComposerBase
|
|
108
|
+
value="Draft"
|
|
109
|
+
onChange={() => {}}
|
|
110
|
+
onSubmit={() => {}}
|
|
111
|
+
placeholder="Edit comment"
|
|
112
|
+
onCancel={onCancel}
|
|
113
|
+
context={{kind: 'edit', commentId: 'c1'}}
|
|
114
|
+
contextLabel="Editing comment"
|
|
115
|
+
highlightColor="yellow"
|
|
116
|
+
triggers={[]}
|
|
117
|
+
agentCommands={[]}
|
|
118
|
+
hasEmojiPicker={false}
|
|
119
|
+
isSubmitting
|
|
120
|
+
/>,
|
|
121
|
+
);
|
|
122
|
+
const cancel = screen.getByText('Cancel').closest('a, button')!;
|
|
123
|
+
expect(cancel).toHaveAttribute('aria-disabled', 'true');
|
|
124
|
+
expect(cancel).not.toHaveAttribute('tabindex', '-1');
|
|
125
|
+
act(() => (cancel as HTMLElement).focus());
|
|
126
|
+
expect(cancel).toHaveFocus();
|
|
127
|
+
fireEvent.click(cancel);
|
|
128
|
+
fireEvent.keyDown(cancel, {key: 'Enter'});
|
|
129
|
+
expect(onCancel).not.toHaveBeenCalled();
|
|
130
|
+
});
|
|
131
|
+
|
|
104
132
|
it('shows the placeholder as the input’s name, and keeps Post focusable while submitting', () => {
|
|
105
133
|
const onSubmit = vi.fn();
|
|
106
134
|
const {container} = render(
|
|
@@ -185,6 +213,60 @@ describe('CommentComposer', () => {
|
|
|
185
213
|
);
|
|
186
214
|
});
|
|
187
215
|
|
|
216
|
+
it('keeps the image picker free of native disabled and refuses files while busy (AST-085 FR1, FR2)', async () => {
|
|
217
|
+
const onUploadImages = vi.fn();
|
|
218
|
+
render(
|
|
219
|
+
<CommentComposer
|
|
220
|
+
value="Draft"
|
|
221
|
+
onChange={() => {}}
|
|
222
|
+
onSubmit={() => {}}
|
|
223
|
+
onUploadImages={onUploadImages}
|
|
224
|
+
isSubmitting
|
|
225
|
+
/>,
|
|
226
|
+
);
|
|
227
|
+
const input = document.querySelector('input[type="file"]');
|
|
228
|
+
if (!(input instanceof HTMLInputElement)) {
|
|
229
|
+
throw new Error('File input not found');
|
|
230
|
+
}
|
|
231
|
+
expect(input).not.toHaveAttribute('disabled');
|
|
232
|
+
const file = new File(['png'], 'chart.png', {type: 'image/png'});
|
|
233
|
+
await act(async () => {
|
|
234
|
+
fireEvent.change(input, {target: {files: [file]}});
|
|
235
|
+
await Promise.resolve();
|
|
236
|
+
});
|
|
237
|
+
expect(onUploadImages).not.toHaveBeenCalled();
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
it('does not open the image chooser from the error banner while busy', async () => {
|
|
241
|
+
const onUploadImages = vi.fn();
|
|
242
|
+
const props = {
|
|
243
|
+
value: 'Draft',
|
|
244
|
+
onChange: () => {},
|
|
245
|
+
onSubmit: () => {},
|
|
246
|
+
onUploadImages,
|
|
247
|
+
};
|
|
248
|
+
const view = render(<CommentComposer {...props} />);
|
|
249
|
+
const input = document.querySelector('input[type="file"]');
|
|
250
|
+
if (!(input instanceof HTMLInputElement)) {
|
|
251
|
+
throw new Error('File input not found');
|
|
252
|
+
}
|
|
253
|
+
const openChooser = vi.spyOn(input, 'click').mockImplementation(() => {});
|
|
254
|
+
await act(async () => {
|
|
255
|
+
fireEvent.change(input, {
|
|
256
|
+
target: {
|
|
257
|
+
files: [new File(['%PDF'], 'doc.pdf', {type: 'application/pdf'})],
|
|
258
|
+
},
|
|
259
|
+
});
|
|
260
|
+
});
|
|
261
|
+
view.rerender(<CommentComposer {...props} isSubmitting />);
|
|
262
|
+
fireEvent.click(screen.getByRole('button', {name: 'Choose images'}));
|
|
263
|
+
expect(openChooser).not.toHaveBeenCalled();
|
|
264
|
+
|
|
265
|
+
view.rerender(<CommentComposer {...props} />);
|
|
266
|
+
fireEvent.click(screen.getByRole('button', {name: 'Choose images'}));
|
|
267
|
+
expect(openChooser).toHaveBeenCalledTimes(1);
|
|
268
|
+
});
|
|
269
|
+
|
|
188
270
|
it('refuses files that are not images', async () => {
|
|
189
271
|
const onUploadImages = vi.fn();
|
|
190
272
|
render(
|
|
@@ -239,6 +239,8 @@ export function CommentComposerBase({
|
|
|
239
239
|
latestValueRef.current = value;
|
|
240
240
|
const isMountedRef = useRef(true);
|
|
241
241
|
const actionPendingRef = useRef(false);
|
|
242
|
+
const isSubmittingRef = useRef(isSubmitting);
|
|
243
|
+
isSubmittingRef.current = isSubmitting;
|
|
242
244
|
const imageInputRef = useRef<HTMLInputElement>(null);
|
|
243
245
|
const inputRef = useRef<ChatComposerInputHandle | null>(null);
|
|
244
246
|
// Focus lands once per `focusKey`, when the input attaches: the handle ref
|
|
@@ -323,7 +325,15 @@ export function CommentComposerBase({
|
|
|
323
325
|
setActionError({
|
|
324
326
|
title: t('@astryx.commentComposer.imagesOnly'),
|
|
325
327
|
actionLabel: t('@astryx.commentComposer.chooseImages'),
|
|
326
|
-
onAction: () =>
|
|
328
|
+
onAction: () => {
|
|
329
|
+
// The picker input is never natively disabled, so its click() would
|
|
330
|
+
// open the file chooser while busy and the busy guard would drop
|
|
331
|
+
// the pick.
|
|
332
|
+
if (isSubmittingRef.current || actionPendingRef.current) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
imageInputRef.current?.click();
|
|
336
|
+
},
|
|
327
337
|
});
|
|
328
338
|
return;
|
|
329
339
|
}
|
|
@@ -439,10 +449,12 @@ export function CommentComposerBase({
|
|
|
439
449
|
accept="image/*"
|
|
440
450
|
multiple
|
|
441
451
|
hidden
|
|
442
|
-
disabled={isBusy}
|
|
443
452
|
onChange={event => {
|
|
444
453
|
const files = Array.from(event.currentTarget.files ?? []);
|
|
445
454
|
event.currentTarget.value = '';
|
|
455
|
+
if (isBusy) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
446
458
|
beginImageUpload(files);
|
|
447
459
|
}}
|
|
448
460
|
/>
|
|
@@ -382,8 +382,8 @@ export function MetadataActionLink({
|
|
|
382
382
|
color="secondary"
|
|
383
383
|
xstyle={partStyles.noWrap}
|
|
384
384
|
data-metadata-action={actionRole}
|
|
385
|
-
|
|
386
|
-
|
|
385
|
+
// Link keeps a disabled link in the tab order (spec:AST-085 FR1).
|
|
386
|
+
isDisabled={isDisabled}
|
|
387
387
|
onClick={event => {
|
|
388
388
|
event.preventDefault();
|
|
389
389
|
if (isDisabled !== true) {
|
|
@@ -725,10 +725,7 @@ export function HistoryDialog({
|
|
|
725
725
|
content={
|
|
726
726
|
<LayoutContent>
|
|
727
727
|
{history.isLoading ? (
|
|
728
|
-
<Spinner
|
|
729
|
-
size="lg"
|
|
730
|
-
label={t('@astryx.comments.historyLoading')}
|
|
731
|
-
/>
|
|
728
|
+
<Spinner size="lg" label={t('@astryx.comments.historyLoading')} />
|
|
732
729
|
) : history.error != null ? (
|
|
733
730
|
<Banner
|
|
734
731
|
status="error"
|
|
@@ -402,9 +402,7 @@ describe('Comments rendering', () => {
|
|
|
402
402
|
it('removes the fading New badge from layout when its animation ends', () => {
|
|
403
403
|
render(
|
|
404
404
|
<Sized>
|
|
405
|
-
<Comments
|
|
406
|
-
comments={[{...COMMENTS[0], isUnread: true, replies: []}]}
|
|
407
|
-
/>
|
|
405
|
+
<Comments comments={[{...COMMENTS[0], isUnread: true, replies: []}]} />
|
|
408
406
|
</Sized>,
|
|
409
407
|
);
|
|
410
408
|
const badge = document.querySelector('[data-comment-unread-badge="true"]');
|
|
@@ -586,8 +584,9 @@ describe('Comments live collaboration seams', () => {
|
|
|
586
584
|
await click(screen.getByRole('button', {name: 'Thread by Avery Kim'}));
|
|
587
585
|
const typingStatus = screen
|
|
588
586
|
.getByText('Maya Chen and Release Assistant are typing…')
|
|
589
|
-
.closest('
|
|
587
|
+
.closest('.astryx-chat-typing-indicator');
|
|
590
588
|
expect(typingStatus).not.toBeNull();
|
|
589
|
+
expect(typingStatus).not.toHaveAttribute('role');
|
|
591
590
|
expect(
|
|
592
591
|
(typingStatus as HTMLElement).style.getPropertyValue(
|
|
593
592
|
'--astryx-chat-typing-indicator-dots-column-width',
|
|
@@ -867,11 +866,7 @@ describe('Comments threads', () => {
|
|
|
867
866
|
const onReact = vi.fn().mockResolvedValue(undefined);
|
|
868
867
|
render(
|
|
869
868
|
<Sized>
|
|
870
|
-
<Comments
|
|
871
|
-
comments={COMMENTS}
|
|
872
|
-
currentUser={VIEWER}
|
|
873
|
-
onReact={onReact}
|
|
874
|
-
/>
|
|
869
|
+
<Comments comments={COMMENTS} currentUser={VIEWER} onReact={onReact} />
|
|
875
870
|
</Sized>,
|
|
876
871
|
);
|
|
877
872
|
const article = articleByAuthor('Avery Kim');
|
|
@@ -896,11 +891,7 @@ describe('Comments threads', () => {
|
|
|
896
891
|
.mockResolvedValue(undefined);
|
|
897
892
|
render(
|
|
898
893
|
<Sized>
|
|
899
|
-
<Comments
|
|
900
|
-
comments={COMMENTS}
|
|
901
|
-
currentUser={VIEWER}
|
|
902
|
-
onReact={onReact}
|
|
903
|
-
/>
|
|
894
|
+
<Comments comments={COMMENTS} currentUser={VIEWER} onReact={onReact} />
|
|
904
895
|
</Sized>,
|
|
905
896
|
);
|
|
906
897
|
await click(
|
|
@@ -15,6 +15,8 @@ import {
|
|
|
15
15
|
within,
|
|
16
16
|
} from '@testing-library/react';
|
|
17
17
|
import {useState} from 'react';
|
|
18
|
+
import * as stylex from '@stylexjs/stylex';
|
|
19
|
+
import {colorVars} from '@astryxdesign/core/theme/tokens.stylex';
|
|
18
20
|
import {MobileTokenizer, type MobileTokenizerChange} from './MobileTokenizer';
|
|
19
21
|
import type {SearchSource, SearchableItem} from '@astryxdesign/core/Typeahead';
|
|
20
22
|
|
|
@@ -337,4 +339,140 @@ describe('MobileTokenizer (Lab, single-sheet flow)', () => {
|
|
|
337
339
|
expect.objectContaining({type: 'remove'}),
|
|
338
340
|
);
|
|
339
341
|
});
|
|
342
|
+
|
|
343
|
+
it('keeps a disabled trigger focusable without opening the sheet (AST-085 FR1, FR2)', () => {
|
|
344
|
+
render(
|
|
345
|
+
<MobileTokenizer
|
|
346
|
+
label="Tags"
|
|
347
|
+
searchSource={source}
|
|
348
|
+
value={[ITEMS[0]]}
|
|
349
|
+
onChange={() => {}}
|
|
350
|
+
isDisabled
|
|
351
|
+
/>,
|
|
352
|
+
);
|
|
353
|
+
const trigger = screen.getByRole('button', {name: /Tags/});
|
|
354
|
+
expect(trigger).not.toHaveAttribute('disabled');
|
|
355
|
+
expect(trigger).toHaveAttribute('aria-disabled', 'true');
|
|
356
|
+
trigger.focus();
|
|
357
|
+
expect(trigger).toHaveFocus();
|
|
358
|
+
fireEvent.click(trigger);
|
|
359
|
+
expect(trigger).toHaveAttribute('aria-expanded', 'false');
|
|
360
|
+
expect(
|
|
361
|
+
screen.queryByTestId('mobile-tokenizer-list'),
|
|
362
|
+
).not.toBeInTheDocument();
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it('keeps an unselectable row at the limit focusable but inert (AST-085 FR1, FR2)', async () => {
|
|
366
|
+
const spy = vi.fn();
|
|
367
|
+
render(
|
|
368
|
+
<MobileTokenizer
|
|
369
|
+
label="Tags"
|
|
370
|
+
searchSource={source}
|
|
371
|
+
value={[ITEMS[0]]}
|
|
372
|
+
maxEntries={1}
|
|
373
|
+
debounceMs={0}
|
|
374
|
+
onChange={spy}
|
|
375
|
+
/>,
|
|
376
|
+
);
|
|
377
|
+
fireEvent.click(screen.getByRole('button', {name: /Tags/}));
|
|
378
|
+
const row = await screen.findByRole('checkbox', {name: 'Energizer'});
|
|
379
|
+
expect(row).not.toHaveAttribute('disabled');
|
|
380
|
+
expect(row).toHaveAttribute('aria-disabled', 'true');
|
|
381
|
+
fireEvent.click(row);
|
|
382
|
+
expect(spy).not.toHaveBeenCalled();
|
|
383
|
+
expect(row).toHaveAttribute('aria-checked', 'false');
|
|
384
|
+
// In forced colors its indicator border takes GrayText (AST-085 FR6).
|
|
385
|
+
const indicatorClasses = stylex
|
|
386
|
+
.props(
|
|
387
|
+
stylex.create({
|
|
388
|
+
border: {
|
|
389
|
+
borderColor: {
|
|
390
|
+
default: colorVars['--color-border'],
|
|
391
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
}).border,
|
|
395
|
+
)
|
|
396
|
+
.className!.split(' ')
|
|
397
|
+
.filter(name => !name.includes('__'));
|
|
398
|
+
const indicator = row.querySelector('.astryx-checkbox-indicator')!;
|
|
399
|
+
for (const name of indicatorClasses) {
|
|
400
|
+
expect(indicator).toHaveClass(name);
|
|
401
|
+
}
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
it('paints the placeholder of a disabled empty trigger GrayText in forced colors (AST-085 FR6)', () => {
|
|
405
|
+
const placeholderClasses = stylex
|
|
406
|
+
.props(
|
|
407
|
+
stylex.create({
|
|
408
|
+
placeholder: {
|
|
409
|
+
color: {
|
|
410
|
+
default: colorVars['--color-text-secondary'],
|
|
411
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
412
|
+
},
|
|
413
|
+
},
|
|
414
|
+
}).placeholder,
|
|
415
|
+
)
|
|
416
|
+
.className!.split(' ')
|
|
417
|
+
.filter(name => !name.includes('__'));
|
|
418
|
+
render(
|
|
419
|
+
<MobileTokenizer
|
|
420
|
+
label="Tags"
|
|
421
|
+
searchSource={source}
|
|
422
|
+
value={[]}
|
|
423
|
+
onChange={() => {}}
|
|
424
|
+
placeholder="Add tags"
|
|
425
|
+
isDisabled
|
|
426
|
+
/>,
|
|
427
|
+
);
|
|
428
|
+
const placeholder = screen.getByText('Add tags');
|
|
429
|
+
for (const name of placeholderClasses) {
|
|
430
|
+
expect(placeholder).toHaveClass(name);
|
|
431
|
+
}
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it('paints a disabled trigger and its tokens GrayText in forced colors (AST-085 FR6)', () => {
|
|
435
|
+
// The same declarations as the component's styles compile to the same
|
|
436
|
+
// atomic classes; without them the tokens keep their CanvasText label.
|
|
437
|
+
const atoms = (style: stylex.StyleXStyles) =>
|
|
438
|
+
stylex
|
|
439
|
+
.props(style)
|
|
440
|
+
.className!.split(' ')
|
|
441
|
+
.filter(name => !name.includes('__'));
|
|
442
|
+
const forced = stylex.create({
|
|
443
|
+
trigger: {
|
|
444
|
+
borderColor: {
|
|
445
|
+
default: colorVars['--color-border'],
|
|
446
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
447
|
+
},
|
|
448
|
+
color: {default: null, '@media (forced-colors: active)': 'GrayText'},
|
|
449
|
+
},
|
|
450
|
+
token: {
|
|
451
|
+
color: {
|
|
452
|
+
default: colorVars['--color-text-primary'],
|
|
453
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
});
|
|
457
|
+
render(
|
|
458
|
+
<MobileTokenizer
|
|
459
|
+
label="Tags"
|
|
460
|
+
searchSource={source}
|
|
461
|
+
value={[ITEMS[0], ITEMS[1]]}
|
|
462
|
+
onChange={() => {}}
|
|
463
|
+
isDisabled
|
|
464
|
+
/>,
|
|
465
|
+
);
|
|
466
|
+
const trigger = screen.getByRole('button', {name: /Tags/});
|
|
467
|
+
for (const name of atoms(forced.trigger)) {
|
|
468
|
+
expect(trigger).toHaveClass(name);
|
|
469
|
+
}
|
|
470
|
+
const tokens = trigger.querySelectorAll('.astryx-token');
|
|
471
|
+
expect(tokens).toHaveLength(2);
|
|
472
|
+
for (const token of tokens) {
|
|
473
|
+
for (const name of atoms(forced.token)) {
|
|
474
|
+
expect(token).toHaveClass(name);
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
});
|
|
340
478
|
});
|
|
@@ -118,9 +118,28 @@ const styles = stylex.create({
|
|
|
118
118
|
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
119
119
|
},
|
|
120
120
|
},
|
|
121
|
+
// An aria-disabled button gets no system disabled paint in forced colors;
|
|
122
|
+
// GrayText is the platform's disabled affordance there. Defaults repeat the
|
|
123
|
+
// base values, since StyleX merges per property.
|
|
124
|
+
triggerDisabled: {
|
|
125
|
+
borderColor: {
|
|
126
|
+
default: colorVars['--color-border'],
|
|
127
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
128
|
+
},
|
|
129
|
+
color: {
|
|
130
|
+
default: null,
|
|
131
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
121
134
|
triggerPlaceholder: {
|
|
122
135
|
color: colorVars['--color-text-secondary'],
|
|
123
136
|
},
|
|
137
|
+
triggerPlaceholderDisabled: {
|
|
138
|
+
color: {
|
|
139
|
+
default: colorVars['--color-text-secondary'],
|
|
140
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
141
|
+
},
|
|
142
|
+
},
|
|
124
143
|
sheetBody: {
|
|
125
144
|
display: 'flex',
|
|
126
145
|
flexDirection: 'column',
|
|
@@ -158,6 +177,29 @@ const styles = stylex.create({
|
|
|
158
177
|
':is(:disabled,[aria-disabled="true"])': 'default',
|
|
159
178
|
},
|
|
160
179
|
},
|
|
180
|
+
// A Token authors its own color, which forced colors replace with
|
|
181
|
+
// CanvasText; GrayText marks the tokens of a disabled trigger as disabled.
|
|
182
|
+
// The default repeats Token's own default color.
|
|
183
|
+
tokenDisabled: {
|
|
184
|
+
color: {
|
|
185
|
+
default: colorVars['--color-text-primary'],
|
|
186
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
187
|
+
},
|
|
188
|
+
},
|
|
189
|
+
// Same for the indicator's border: GrayText in forced colors, and the
|
|
190
|
+
// default repeats the indicator's disabled border.
|
|
191
|
+
indicatorDisabled: {
|
|
192
|
+
borderColor: {
|
|
193
|
+
default: colorVars['--color-border'],
|
|
194
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
rowDisabled: {
|
|
198
|
+
color: {
|
|
199
|
+
default: colorVars['--color-text-primary'],
|
|
200
|
+
'@media (forced-colors: active)': 'GrayText',
|
|
201
|
+
},
|
|
202
|
+
},
|
|
161
203
|
rowLabel: {
|
|
162
204
|
flexGrow: 1,
|
|
163
205
|
minWidth: 0,
|
|
@@ -376,20 +418,32 @@ export function MobileTokenizer<T extends SearchableItem>({
|
|
|
376
418
|
aria-haspopup="dialog"
|
|
377
419
|
aria-expanded={activeSheet != null}
|
|
378
420
|
aria-label={label}
|
|
379
|
-
disabled={isDisabled}
|
|
421
|
+
aria-disabled={isDisabled || undefined}
|
|
380
422
|
onClick={() => {
|
|
423
|
+
if (isDisabled) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
381
426
|
setSelectedItemsAtOpen(value);
|
|
382
427
|
lastLoadScrollHeightRef.current = null;
|
|
383
428
|
setRenderedItemCount(LIST_RENDER_BATCH_SIZE);
|
|
384
429
|
setActiveSheet('manage');
|
|
385
430
|
}}
|
|
386
|
-
{...stylex.props(styles.trigger)}>
|
|
431
|
+
{...stylex.props(styles.trigger, isDisabled && styles.triggerDisabled)}>
|
|
387
432
|
{value.length > 0 ? (
|
|
388
433
|
value.map(item => (
|
|
389
|
-
<Token
|
|
434
|
+
<Token
|
|
435
|
+
key={item.id}
|
|
436
|
+
label={item.label}
|
|
437
|
+
isDisabled={isDisabled}
|
|
438
|
+
xstyle={isDisabled ? styles.tokenDisabled : undefined}
|
|
439
|
+
/>
|
|
390
440
|
))
|
|
391
441
|
) : (
|
|
392
|
-
<span
|
|
442
|
+
<span
|
|
443
|
+
{...stylex.props(
|
|
444
|
+
styles.triggerPlaceholder,
|
|
445
|
+
isDisabled && styles.triggerPlaceholderDisabled,
|
|
446
|
+
)}>
|
|
393
447
|
{placeholder ?? ''}
|
|
394
448
|
</span>
|
|
395
449
|
)}
|
|
@@ -500,18 +554,35 @@ export function MobileTokenizer<T extends SearchableItem>({
|
|
|
500
554
|
role="checkbox"
|
|
501
555
|
aria-checked={isSelected}
|
|
502
556
|
aria-label={item.label}
|
|
503
|
-
disabled={rowDisabled}
|
|
504
|
-
onClick={() =>
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
557
|
+
aria-disabled={rowDisabled || undefined}
|
|
558
|
+
onClick={() => {
|
|
559
|
+
if (rowDisabled) {
|
|
560
|
+
return;
|
|
561
|
+
}
|
|
562
|
+
if (isSelected) {
|
|
563
|
+
handleRemove(item);
|
|
564
|
+
} else {
|
|
565
|
+
handleAdd(item);
|
|
566
|
+
}
|
|
567
|
+
}}
|
|
568
|
+
{...stylex.props(
|
|
569
|
+
styles.row,
|
|
570
|
+
rowDisabled && styles.rowDisabled,
|
|
571
|
+
)}>
|
|
508
572
|
<span {...stylex.props(styles.rowLabel)}>
|
|
509
|
-
<Text
|
|
573
|
+
<Text
|
|
574
|
+
type="body"
|
|
575
|
+
color={rowDisabled ? 'inherit' : undefined}>
|
|
576
|
+
{item.label}
|
|
577
|
+
</Text>
|
|
510
578
|
</span>
|
|
511
579
|
<CheckboxIndicator
|
|
512
580
|
state={isSelected ? 'checked' : 'unchecked'}
|
|
513
581
|
size="md"
|
|
514
582
|
isDisabled={rowDisabled}
|
|
583
|
+
xstyle={
|
|
584
|
+
rowDisabled ? styles.indicatorDisabled : undefined
|
|
585
|
+
}
|
|
515
586
|
/>
|
|
516
587
|
</button>
|
|
517
588
|
);
|
|
@@ -461,7 +461,9 @@ describe('TransferListSelector', () => {
|
|
|
461
461
|
expect(cancel).toBeEnabled();
|
|
462
462
|
expect(fieldset).not.toContainElement(cancel);
|
|
463
463
|
expect(apply).toBeDisabled();
|
|
464
|
-
expect(
|
|
464
|
+
expect(
|
|
465
|
+
screen.getByRole('button', {name: 'Visible fields'}),
|
|
466
|
+
).toHaveAttribute('aria-disabled', 'true');
|
|
465
467
|
|
|
466
468
|
view.rerender(
|
|
467
469
|
<TransferListSelector
|