@astryxdesign/core 0.7.3-canary.fba04ed → 0.7.3
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 +88 -0
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +15 -2
- package/dist/Chat/ChatComposer.d.ts.map +1 -1
- package/dist/Chat/ChatComposer.js +25 -2
- package/dist/Chat/ChatSystemMessage.d.ts +4 -0
- package/dist/Chat/ChatSystemMessage.d.ts.map +1 -1
- package/dist/Chat/ChatSystemMessage.js +4 -2
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts +9 -5
- package/dist/DropdownMenu/DropdownMenuRadioGroup.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuRadioGroup.js +2 -0
- package/package.json +4 -4
- package/src/Button/Button.test.tsx +13 -2
- package/src/Button/Button.tsx +23 -2
- package/src/Button/__tests__/Button.a11y.states.ts +4 -3
- package/src/Carousel/Carousel.spec.md +146 -0
- package/src/Chat/ChatComposer.spec.md +26 -26
- package/src/Chat/ChatComposer.test.tsx +58 -2
- package/src/Chat/ChatComposer.tsx +25 -1
- package/src/Chat/ChatSystemMessage.doc.mjs +1 -1
- package/src/Chat/ChatSystemMessage.test.tsx +25 -3
- package/src/Chat/ChatSystemMessage.tsx +6 -4
- package/src/Chat/__tests__/ChatSystemMessage.a11y.chromium.spec.ts +8 -9
- package/src/CheckboxList/__tests__/CheckboxList.a11y.chromium.spec.ts +7 -6
- package/src/DropdownMenu/DropdownMenuRadioGroup.doc.mjs +62 -7
- package/src/DropdownMenu/DropdownMenuRadioGroup.spec.md +190 -0
- package/src/DropdownMenu/DropdownMenuRadioGroup.tsx +10 -4
- package/src/DropdownMenu/DropdownMenuSelectable.test.tsx +93 -0
- package/src/DropdownMenu/__tests__/DropdownMenuRadioGroupAudit.a11y.chromium.spec.ts +327 -0
- package/src/FieldStatus/FieldStatus.spec.md +4 -4
- package/src/FieldStatus/__tests__/StatusMessage.a11y.renders.tsx +0 -18
- package/src/FieldStatus/__tests__/StatusMessage.a11y.states.ts +3 -18
- package/src/FieldStatus/__tests__/StatusMessage.a11y.test.tsx +1 -2
- package/src/Markdown/Markdown.helpers.perf.test.ts +25 -19
- package/src/Table/plugins/columnResize/useTableColumnResize.spec.md +11 -11
- package/src/Table/plugins/rowStatus/useTableRowStatus.spec.md +4 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,93 @@
|
|
|
1
1
|
# @xds/core
|
|
2
2
|
|
|
3
|
+
# 0.7.3
|
|
4
|
+
|
|
5
|
+
#### New Features
|
|
6
|
+
|
|
7
|
+
- `DropdownMenuSubMenu` takes `header` and `footer`, as the root `DropdownMenu` does, so a sub-menu can have a filter field above its rows, or an action such as "New folder" below them, outside the sub-menu's menu itself. With either, the sub-menu's surface (the flyout, or the drilled-in view on a phone) is a modal dialog named by its row: the row says `aria-haspopup="dialog"`, Tab and Shift+Tab walk the header, the rows and the footer and wrap, Escape returns to the row, and a pointer leaving the flyout closes it only once focus leaves too. A `ContextMenu` does not show a sub-menu's `header` or `footer`. Without them nothing changes.
|
|
8
|
+
|
|
9
|
+
```diff
|
|
10
|
+
<DropdownMenuSubMenu
|
|
11
|
+
label="Move to"
|
|
12
|
+
+ header={<TextInput label="Filter folders" isLabelHidden value={query} onChange={setQuery} />}
|
|
13
|
+
+ footer={<Button label="New folder" onClick={createFolder} />}
|
|
14
|
+
>
|
|
15
|
+
<DropdownMenuItem label="Folder A" onClick={() => move('a')} />
|
|
16
|
+
</DropdownMenuSubMenu>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
#### Fixes
|
|
20
|
+
|
|
21
|
+
- `TimeInput`'s arrow keys ignore a fractional increment instead of writing a malformed time such as "14:30.5": `adjustTime` returns the time unchanged for a fractional minute delta ([#7823](https://github.com/facebook/astryx/pull/7823)).
|
|
22
|
+
- Screen readers now announce a `Button` that is first rendered with `isLoading` (for example after a remount). Its visually hidden loading live region mounts empty and gets "Loading" on the next frame, because screen readers skip a live region that already holds its text when it appears. A Button that becomes loading after it mounts is unchanged, and a Button mounted idle does no extra render.
|
|
23
|
+
- `ChatComposer`: screen readers now announce a status message, errors assertively and warnings politely, once per occasion: a rerender does not repeat it, and a status that clears and then returns is announced again. Before, the status bar mounted as a `role="alert"` or `role="status"` region already holding its text, which screen readers often skip. The message now goes through the shared announcement channel, and the visible bar no longer carries a live role. No API changes.
|
|
24
|
+
- `ChatSystemMessage`: a new chat notice inside a `ChatMessageList` now has one live region announcing it, the list's polite log, instead of also being a second live region nested in it (WCAG 2.2 SC 4.1.3). Its root no longer forces `role="status"`, in either variant, so date and divider rows are no longer presented as status messages, and a `role` passed to the component reaches its root. Tests that found a system message by the `status` role should query it by its text instead.
|
|
25
|
+
- Keyboard and screen-reader users can now reach disabled `CheckboxInput`, `CheckboxList` items, `Switch`, `Slider` and `FileInput`, and hear that they are disabled. Before, they rendered the native `disabled` attribute unless a `disabledMessage` was set, so Tab skipped them. Now every disabled control exposes `aria-disabled="true"` and keeps the Tab stop it has when enabled, while toggling, selecting, dragging, opening the file picker and any `onClick` stay blocked, and its value is still left out of form submission. A focused disabled checkbox, switch, slider thumb or file input shows its keyboard focus indicator. No API changes.
|
|
26
|
+
- The agent guide that global mode writes to the home folder now tells agents to deliver a page built with Astryx, not only how to find things. Before, agents that found the right template could still build the page with a tool that cannot install packages and deliver a page with no Astryx in it. The guide now tells agents to work in a project folder (creating one if there is none); add `@astryxdesign/core` and `@astryxdesign/cli` to a new project or one without Core, or, in a project that already has `@astryxdesign/core`, the CLI at the same version; run `astryx init` there; follow the same template-first workflow and self-check the project agent docs give; and end by building the project and delivering that build. The guide stays version-free and names only commands every release keeps. The project agent docs are unchanged, and so is what `@astryxdesign/core`'s install script prints: its copy of the shared agent-docs file only gains the same workflow lines.
|
|
27
|
+
- Keyboard and screen-reader users can now reach a disabled `ComplexSelector` and hear that it is unavailable (WCAG 2.2 SC 2.1.1 and 4.1.2). Before, its trigger rendered the native `disabled` attribute, so Tab skipped it and a focused trigger lost focus when disabled; now it exposes `aria-disabled="true"`, keeps focus, shows its keyboard focus outline, and still opens nothing. A press or key on it reaches no handler: not the toggle, not a caller's `onClick` or `onKeyDown`, and not an ancestor's click handler.
|
|
28
|
+
- Keyboard and screen-reader users can now reach a disabled `Calendar` day or `Pagination` dot and hear that it is disabled. Disabled `TreeList` rows' expand toggle and action button, disabled `Pagination` dots and disabled `Calendar` days expose `aria-disabled="true"` instead of the native `disabled` attribute, while clicks, Enter and Space still do nothing and arrow keys still skip disabled days as before. No API changes.
|
|
29
|
+
- `DateInput`: keyboard and screen-reader users can now reach a disabled date field and hear that it is disabled. A disabled or busy field no longer renders native `disabled`: its input and calendar button keep their place in the focus order and expose `aria-disabled`, while typing and opening stay blocked, and a focused disabled field shows its focus ring. Tests that query a disabled DateInput with `toBeDisabled()` or `:disabled` should check `aria-disabled="true"` instead.
|
|
30
|
+
- `DateRangeInput`: keyboard and screen-reader users can now reach a disabled field or preset and hear that it is disabled. A disabled or busy field and a disabled preset no longer render native `disabled`: the trigger, calendar button and presets keep their place in the focus order and expose `aria-disabled`, while opening and selecting stay blocked, and a focused disabled field shows its focus ring. Tests that query them with `toBeDisabled()` or `:disabled` should check `aria-disabled="true"` instead ([#7866](https://github.com/facebook/astryx/pull/7866)).
|
|
31
|
+
- `DateTimeInput`: keyboard and screen-reader users can now reach a disabled or busy field and hear that it is disabled. It no longer renders native `disabled` on its text, native-picker or touch fields, or on its calendar and clock buttons: they keep their place in the focus order and expose `aria-disabled`, while typing, picking, opening and a caller's `onClick` stay blocked, and a focused disabled field shows its focus ring. `TimeInput`'s native picker button, which shares the time segment and stays out of the tab order, also moves from `disabled` to `aria-disabled` and stays inert. Tests that query a disabled DateTimeInput with `toBeDisabled()` or `:disabled` should check `aria-disabled="true"` instead.
|
|
32
|
+
- Apps that use Core's prebuilt CSS without a StyleX build step now get the default data colors: the prebuilt CSS defines the canonical `dataVars` defaults, so compiled imports and raw CSS references paint correctly.
|
|
33
|
+
- `Dialog`, `BottomSheet` and `BottomSheetSwitcher` stay open when a file picker inside them is dismissed. A file input fires a bubbling `cancel` event when its picker closes without a choice, and all three took that event for a close request of their own and closed (a switcher closed its whole flow). They now act only on a `cancel` aimed at their own `<dialog>`, so Escape and platform close requests (the Android back gesture) behave as before. No API changes.
|
|
34
|
+
- `DropdownMenuRadioGroup` now forwards `ref`, and its docs explain controlled selection, how to name the group, when the menu closes, and how it composes inside a `DropdownMenu`.
|
|
35
|
+
- `astryx init` writes the agent docs at the project root, in files the project commits, so Codex, Gemini CLI, Copilot CLI and Claude Code all read the block from the project root or any folder below it ([#7497](https://github.com/facebook/astryx/pull/7497)). It no longer writes agent docs into a project's subfolder, the home folder, or a settings folder in it such as `~/.gemini`.
|
|
36
|
+
- `AGENTS.md` holds the block, created when missing. Before, a project with only `CLAUDE.md` got the block only there, so Codex and Gemini CLI never saw it.
|
|
37
|
+
- Claude Code skips `AGENTS.md` in a folder that has a `CLAUDE.md` or `.claude/CLAUDE.md`, so the Claude Code file the project already has keeps a full copy: root `CLAUDE.md`, else `.claude/CLAUDE.md`. It keeps the copy even when it imports `AGENTS.md`, because Claude Code does not follow that import in a session started in a subfolder; started at the root, Claude Code then reads two. When both exist, the copy goes in root `CLAUDE.md`, which projects commit even when they ignore `.claude/`, and a block in `.claude/CLAUDE.md` is removed. Init creates no Claude file. `astryx upgrade` refreshes every copy, except in a project at the top of a home settings folder (see the next entry).
|
|
38
|
+
- Gemini CLI reads only `GEMINI.md`: init adds a one-line import, `@./AGENTS.md`, creating `GEMINI.md` when it is missing. It adds none when `GEMINI.md` already imports `AGENTS.md`, inline or on its own line. It adds the import even when the project's `.gemini/settings.json` has Gemini read `AGENTS.md` through `context.fileName`: Gemini loads those settings only when it starts at the project root, so a session started in a subfolder would otherwise get no copy. Started at the root, Gemini then reads two.
|
|
39
|
+
- The project root is the nearest folder at or above where init runs whose `package.json` declares an `@astryxdesign` package, else the nearest with any `package.json`. The search stops at a repository root and never counts the home folder. With no `package.json` found, init writes where it runs, as before. `docsWritten` still lists each file relative to where init ran, for example `../../AGENTS.md`.
|
|
40
|
+
- A `GEMINI.md` that resolves outside the project, for example a link to a shared file, is skipped and reported in `docsError` with one note (not an error line), in the default layout and in a project's own layout; the rest is written and init exits 0.
|
|
41
|
+
- The managed block belongs to Astryx: init and `astryx upgrade` write, refresh, and remove only the block, whatever ignore rules or generated markers say, as 0.7.1 did, and never change the text around it. Every write stays inside the project: run in the folder 0.7.1 wrote, an agent file 0.7.1 wrote there whose path leaves the project still refuses the run with exit 1. The project's Claude Code file (root `CLAUDE.md`, or `.claude/CLAUDE.md` when there is no root one) that resolves outside the project and is a block-less import of an existing `AGENTS.md`, which 0.7.1 left alone, is skipped and reported in `docsError` with one note, and init exits 0. Run from a folder below the project root, where 0.7.1 wrote in that folder instead, a project-root file whose path leaves the project is skipped and reported in `docsError` with one note, the rest is written, and init exits 0.
|
|
42
|
+
- While root `CLAUDE.md` is untracked and ignored by the repository's ignore rules (any ignore file from the repository root down, such as a monorepo's root `.gitignore`, the local exclude file, or configured excludes; init asks git, Sapling or Mercurial), a `.claude/CLAUDE.md` the project commits gets the copy too, so a fresh clone still gives Claude Code a copy; `--agent claude` and `--agent all` write it there as well. A file the repository tracks counts as committed whatever the ignore rules say, as git and Mercurial ignore only untracked files, and when the repository cannot answer, the copy is kept, on the first run as on later ones. Such a copy that resolves outside the project refuses the run with exit 1 where 0.7.1 wrote it too; one 0.7.1 did not write (the one `--agent claude` adds, or a block-less import of an existing `AGENTS.md`) is skipped and reported in `docsError` with one note, and init exits 0. So is a `.claude/CLAUDE.md` whose block `--agent claude` would remove beside a `CLAUDE.md`, since 0.7.1's `claude` preset wrote only `CLAUDE.md` there. Beside a committed root `CLAUDE.md`, with `.claude` linked outside the project, three cases that 0.7.1 refused now exit 0 with nothing written: the default with a `.claude/CLAUDE.md` of plain text, and `--agent all` with one of plain text or a block-less import of `AGENTS.md`; root `CLAUDE.md` holds the copy, so no write leaves the project. In a project that keeps its own layout, a `GEMINI.md` that imports no agent file now gets a copy, as the other agent files do.
|
|
43
|
+
- The copy in `.claude/CLAUDE.md` is removed only once root `CLAUDE.md` holds the same block, and only the managed block between its markers: the rest of the file stays, and the file is deleted only when nothing but whitespace is left. `astryx init --remove-agents` deletes a file it created only when nothing but whitespace or init's own heading is left; 0.7.0 also deleted a file whose remaining text had a heading and any line with the word "guidance".
|
|
44
|
+
- `astryx init --remove-agents` removes the block at the project root, where `init` writes it, and in the folder it runs in. Run from a subfolder, it removes what `init` wrote at the root, and a block an earlier version left in that subfolder; a root agent file with a block that resolves outside the project is left as it is with a note, and the run exits 0, as 0.7.1 did when it touched only the subfolder. Exit codes and the JSON shape are unchanged.
|
|
45
|
+
- `--agent claude` and `--agent all` never leave a block in both `CLAUDE.md` and `.claude/CLAUDE.md`, unless the project ignores `CLAUDE.md`: when `CLAUDE.md` gets the block, a block in `.claude/CLAUDE.md` is removed. `--agent all` keeps the `GEMINI.md` import. The `--agent` help and the working-with-AI guide say so. `--agent-docs-path` writes where init runs, as before.
|
|
46
|
+
- `astryx doctor` fails when the `GEMINI.md` import points at an `AGENTS.md` with no block. The setup check in the CLI and in `@astryxdesign/core` no longer counts that import as set up, and looks at `GEMINI.md`. The reminder to run `init` that commands print looks at the project root too, so it stops once `init` has run in a nested package.
|
|
47
|
+
- `astryx init` and `astryx upgrade` no longer write agent docs into your home folder, or into a settings folder in it such as `~/.gemini` or `~/.claude` outside a project. Agents read the files in those folders in every project, so a block there reached unrelated work. This follows the CLI's existing rules that no command writes agent docs into those folders and that a write outside a command's own folder is refused before anything is written.
|
|
48
|
+
- **Refused by `init`:** the home folder itself, and the top of any folder in it whose name starts with a dot (every such folder is a settings folder), even when it holds a `package.json`. A folder below it with its own `package.json` is a project and is set up normally, such as an agent worktree in `~/.codex/worktrees/` or `~/.cursor/worktrees/`, and `astryx upgrade` refreshes it. With `--agent-docs-path`, each file's own folder is checked: from the home folder, `notes/AI.md` is written as before, while `AI.md` or `.claude/CLAUDE.md` is refused.
|
|
49
|
+
- **What `init` does instead:** it writes no agent docs, reports `docsError` as `install-failed` with the reason, and exits 0, as before.
|
|
50
|
+
- **Refused by `upgrade`:** refreshing a block in a project whose root is the home folder or the top of a settings folder, such as `~/.dotfiles` with a `package.json`, with or without `--apply`. It leaves the block as it is, sets `agentDocs.action` to `error` (never `would-refresh`), and warns with the folder and why; its other steps and its exit status are as before. With no block there, it gives the same reason instead of suggesting `astryx init`. `astryx doctor`'s agent-docs fix does the same, and the setup reminder after each command stays quiet.
|
|
51
|
+
- **Migration:** run `astryx init` from the project's own folder, or add the block to the file by hand. Move a project rooted at the home folder or a settings folder into a folder of its own, or update or remove its block by hand. To remove a block an earlier version wrote into `~/.claude/CLAUDE.md`, run `astryx init --remove-agents` in the home folder.
|
|
52
|
+
- Keyboard and screen-reader users can now reach a disabled `MultiSelector` and hear that it is unavailable (WCAG 2.2 SC 2.1.1 and 4.1.2). Before, its trigger rendered the native `disabled` attribute and `tabIndex={-1}`, so Tab skipped it and a focused trigger lost focus when disabled; now it exposes `aria-disabled="true"`, keeps focus, still opens nothing, and submits no form value. Like a natively disabled button, it runs no caller event handler other than focus and blur, and a press on it reaches no handler. A focused disabled trigger shows a keyboard focus ring, dimmed with the rest of the control (WCAG 2.2 SC 2.4.7).
|
|
53
|
+
- Keyboard and screen-reader users can now reach a disabled `Link` or `ClickableCard`, and the buttons of a disabled `Token`. Before, they rendered the native `disabled` attribute or `tabIndex={-1}`, so Tab skipped them. Now each disabled control exposes `aria-disabled="true"` and keeps the Tab stop it has when enabled, while activation by click, Enter or Space, `onClick`, removal and navigation stay blocked; a disabled Link keeps no live destination and is exposed with the link role. A `Popover` no longer opens from a wrapped or `anchorRef` trigger marked `aria-disabled="true"` (for example a disabled `Button` with a `tooltip`), including for a click dispatched straight on the trigger; before, such a click opened it. No API changes.
|
|
54
|
+
- Keyboard and screen-reader users can now reach a disabled `Selector` and hear that it is unavailable (WCAG 2.2 SC 2.1.1 and 4.1.2). Before, its trigger rendered the native `disabled` attribute and `tabIndex={-1}`, so Tab skipped it and a focused trigger lost focus when disabled; now it exposes `aria-disabled="true"`, keeps focus, still opens nothing, and submits no form value. Like a natively disabled button, it runs no caller event handler other than focus and blur, and a press on it reaches no handler. A focused disabled trigger shows a keyboard focus ring, dimmed with the rest of the control (WCAG 2.2 SC 2.4.7).
|
|
55
|
+
- `Selector` options in a narrow list now shrink and truncate a long label with an ellipsis instead of being clipped past the list edge.
|
|
56
|
+
- `Switch`: a busy switch announces "Loading" once per busy start. Under React StrictMode the announcement used to be made twice.
|
|
57
|
+
- `TimeInput`: keyboard and screen-reader users can now reach a disabled field, or a busy bottom-sheet field, and hear that it is disabled. It no longer renders native `disabled` on its typed, native-picker or touch input or its picker button: they keep their place in the focus order and expose `aria-disabled`, while typing, arrow-key adjustment, opening, submitting a surrounding form with Enter, and a caller's `onClick` stay blocked, a draft typed before the field became disabled is dropped, and a focused disabled field shows its focus ring. Tests that query a disabled or busy TimeInput with `toBeDisabled()` or `:disabled` should check `aria-disabled="true"` instead.
|
|
58
|
+
- Pages that use `Timestamp` with an absolute format (`date`, `time`, `date_time` and the other fixed formats) now prerender in Next.js with `cacheComponents` turned on, where they used to fail the build: `Timestamp` no longer reads the current time while rendering on the server, and absolute formats never read the clock. `relative`, `relative_short` and `auto` read the clock on the client only: a server render or static prerender shows the full date and time in UTC, labelled, and the client switches to the format's normal output right after hydration, so server and client markup now always match. Client-only rendering is unchanged. No API changes ([#7883](https://github.com/facebook/astryx/pull/7883)).
|
|
59
|
+
- `Tooltip`: moving the pointer straight from the trigger onto the tooltip in one step no longer hides it, so it stays open while hovered (WCAG 2.2 SC 1.4.13).
|
|
60
|
+
- A `SideNavItem` in a collapsed `SideNav` now shows its tooltip on hover and gets `aria-describedby`, even when the item first appears inside an already-collapsed `SideNav`, the common case for saved collapse state. Before, only an item that collapsed after it appeared got a tooltip. Fixes [#7692](https://github.com/facebook/astryx/issues/7692).
|
|
61
|
+
|
|
62
|
+
A `Tooltip` with an `anchorRef` that renders inside the very element the ref points at, as `SideNavItem` does, now attaches however it mounted. The effect now re-checks the anchor once the commit has finished attaching refs; event listeners and the `aria-describedby` merge and restore are unchanged.
|
|
63
|
+
|
|
64
|
+
- `TopNav` on narrow screens: a long `TopNavHeading` now gives way (it truncates with an ellipsis, or wraps when the heading is a link) instead of pushing the end content and the menu toggle past the edge of the bar, and the mobile drawer's close button is back on screen.
|
|
65
|
+
- `Typeahead`: clearing the value while editing it now empties the input and reports `onChangeQuery('')`, instead of leaving the old label in a field with no value. Fixes [#7038](https://github.com/facebook/astryx/issues/7038).
|
|
66
|
+
|
|
67
|
+
#### Performance
|
|
68
|
+
|
|
69
|
+
- Pages with many code blocks, such as a long Markdown document, paint sooner on first load: `CodeBlock` inserts its syntax-highlight rules before the first layout read instead of after it, which cut first paint by 16–19% in 100–500 KB test documents ([#7875](https://github.com/facebook/astryx/pull/7875)). The rules and the highlighted output are unchanged.
|
|
70
|
+
- Pages that update around a long `Markdown` document stay responsive: Markdown skips re-rendering its document when a parent re-renders without changing the text or any rendering prop, and a link handler passed as a new function on each render no longer forces that work. The rendered output is unchanged.
|
|
71
|
+
|
|
72
|
+
#### Documentation
|
|
73
|
+
|
|
74
|
+
- The `DropdownMenuItem` docs now explain when an item is an action or a destination, disabled items, and supporting content.
|
|
75
|
+
|
|
76
|
+
#### Contributors
|
|
77
|
+
|
|
78
|
+
Thanks to everyone who contributed to this release:
|
|
79
|
+
|
|
80
|
+
- @aashish254
|
|
81
|
+
- @cixzhang
|
|
82
|
+
- @ejhammond
|
|
83
|
+
- @HelloOjasMutreja
|
|
84
|
+
- @josephfarina
|
|
85
|
+
- @kyu-rong
|
|
86
|
+
- @Pushpak731
|
|
87
|
+
- @vjeux
|
|
88
|
+
|
|
89
|
+
---
|
|
90
|
+
|
|
3
91
|
# 0.7.2
|
|
4
92
|
|
|
5
93
|
#### Experimental APIs
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAKL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AA4B3C,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAMrD,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,SAAS,CAAC;AAgI9C,QAAA,MAAM,UAAU;;;;;;;;;;EAUd,CAAC;AA2CH;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,OAAO,UAAU,CAAC;AAQjD,MAAM,WAAW,WAAY,SAAQ,SAAS,CAAC,iBAAiB,CAAC;IAC/D,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;IACnC,oDAAoD;IACpD,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC;IACrC,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAChD,uDAAuD;IACvD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;;;;;;;OAQG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IACrD;;OAEG;IACH,WAAW,CAAC,EAAE,CACZ,CAAC,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,KACnC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1B;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAuJD;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAqB,EACrB,IAAI,EAAE,QAAQ,EACd,IAAe,EACf,UAAkB,EAClB,SAAiB,EACjB,eAAuB,EACvB,WAAW,EACX,IAAI,EACJ,UAAkB,EAClB,KAAK,EACL,SAAkB,EAClB,QAAQ,EACR,UAAU,EACV,OAAO,EACP,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,GAAG,SAAS,CAySzB;yBAlUe,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
*
|
|
18
18
|
* Last synced props: label, variant, size, isDisabled, isLoading, isInterruptible, clickAction, icon, isIconOnly, width, children, tooltip, endContent, href, as, target, rel
|
|
19
19
|
*/
|
|
20
|
-
import { useRef, useTransition } from 'react';
|
|
20
|
+
import { useEffect, useRef, useState, useTransition } from 'react';
|
|
21
21
|
import * as stylex from '@stylexjs/stylex';
|
|
22
22
|
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
23
23
|
import "../theme/tokens.stylex.js";
|
|
@@ -357,6 +357,19 @@ export function Button({
|
|
|
357
357
|
// re-click can land and interrupt the in-flight action with a fresh one.
|
|
358
358
|
const actionInFlightRef = useRef(false);
|
|
359
359
|
const isLoadingState = isLoading || isPending;
|
|
360
|
+
// The loading live region must exist empty before it receives "Loading":
|
|
361
|
+
// many screen readers skip a live region that mounts already holding its
|
|
362
|
+
// text, which is what a Button first rendered loading did (spec:AST-086
|
|
363
|
+
// FR3). Only that case holds the text back, until the frame after the
|
|
364
|
+
// region mounts; a Button mounted idle never re-renders for this.
|
|
365
|
+
const [isLiveRegionReady, setIsLiveRegionReady] = useState(() => !isLoadingState);
|
|
366
|
+
useEffect(() => {
|
|
367
|
+
if (isLiveRegionReady) {
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const frame = requestAnimationFrame(() => setIsLiveRegionReady(true));
|
|
371
|
+
return () => cancelAnimationFrame(frame);
|
|
372
|
+
}, [isLiveRegionReady]);
|
|
360
373
|
// Delay the spinner reveal for action-driven loading (clickAction's own
|
|
361
374
|
// transition) so a fast action that settles within the delay does not flash
|
|
362
375
|
// a spinner. Interruptible loading is delayed too, so rapid re-clicks settle
|
|
@@ -506,7 +519,7 @@ export function Button({
|
|
|
506
519
|
}), /*#__PURE__*/_jsx(VisuallyHidden, {
|
|
507
520
|
role: "status",
|
|
508
521
|
"aria-live": "polite",
|
|
509
|
-
children: isLoadingState ? t('@astryx.button.loading') : ''
|
|
522
|
+
children: isLoadingState && isLiveRegionReady ? t('@astryx.button.loading') : ''
|
|
510
523
|
})]
|
|
511
524
|
});
|
|
512
525
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatComposer.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatComposer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"ChatComposer.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatComposer.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,EAMZ,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAgC5C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,UAAU,CAAC;AAEtE,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAC7C,SAAS,CAAC,cAAc,CAAC,EACzB,UAAU,GAAG,UAAU,CACxB;IACC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAChC,+CAA+C;IAC/C,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB,kFAAkF;IAClF,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,0CAA0C;IAC1C,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,uCAAuC;IACvC,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,sBAAsB;IACtB,OAAO,CAAC,EAAE,mBAAmB,CAAC;IAC9B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAI3B,6GAA6G;IAC7G,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB,yHAAyH;IACzH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,yGAAyG;IACzG,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,gHAAgH;IAChH,aAAa,CAAC,EAAE,SAAS,CAAC;IAC1B,gHAAgH;IAChH,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,gDAAgD;IAChD,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,iEAAiE;IACjE,MAAM,CAAC,EAAE,kBAAkB,CAAC;IAC5B,oDAAoD;IACpD,cAAc,CAAC,EAAE,KAAK,GAAG,QAAQ,CAAC;CACnC;AAkND;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,qBAwOpD;yBAxOe,YAAY"}
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* - /apps/storybook/stories/ChatComposer.stories.tsx
|
|
23
23
|
* - /packages/cli/assets/templates/blocks/components/ChatComposer/ (block examples)
|
|
24
24
|
*/
|
|
25
|
-
import React, { useState, useCallback, useRef, useMemo } from 'react';
|
|
25
|
+
import React, { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
26
26
|
import * as stylex from '@stylexjs/stylex';
|
|
27
27
|
import "../theme/tokens.stylex.js";
|
|
28
28
|
import { colorVars, spacingVars, radiusVars, shadowVars, durationVars, easeVars, borderVars, typeScaleVars, typographyVars } from "../theme/tokens.stylex.js";
|
|
@@ -33,6 +33,7 @@ import { ChatComposerContext } from "./ChatContext.js";
|
|
|
33
33
|
import { ChatSendButton } from "./ChatSendButton.js";
|
|
34
34
|
import { themeProps } from "../utils/themeProps.js";
|
|
35
35
|
import { useTranslator } from "../i18n/index.js";
|
|
36
|
+
import { useAnnounce } from "../hooks/useAnnounce.js";
|
|
36
37
|
import { focusOutlineStyles } from "../utils/focusOutline.stylex.js";
|
|
37
38
|
import { getInteractionModality, useInteractionModalityTracking } from "../utils/interactionModality.js";
|
|
38
39
|
|
|
@@ -191,8 +192,30 @@ export function ChatComposer(props) {
|
|
|
191
192
|
setHasKeyboardEditorFocus(false);
|
|
192
193
|
}
|
|
193
194
|
}, []);
|
|
195
|
+
|
|
196
|
+
// The status bar mounts together with its message, and a live region born
|
|
197
|
+
// holding its text is not reliably announced, so the message goes through
|
|
198
|
+
// the shared channel instead: errors assertively, warnings politely
|
|
199
|
+
// (spec:AST-086 FR2, FR5). The ref keeps a rerender or a StrictMode effect
|
|
200
|
+
// replay from repeating it; clearing the status re-arms it, so the same
|
|
201
|
+
// message shown again is a new occasion (FR6).
|
|
202
|
+
const announce = useAnnounce();
|
|
203
|
+
const statusType = status?.type;
|
|
204
|
+
const statusMessage = status?.message;
|
|
205
|
+
const announcedStatusRef = useRef(null);
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (!statusMessage) {
|
|
208
|
+
announcedStatusRef.current = null;
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
const occasion = `${statusType}\u0000${statusMessage}`;
|
|
212
|
+
if (announcedStatusRef.current === occasion) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
announcedStatusRef.current = occasion;
|
|
216
|
+
announce(statusMessage, statusType === 'error' ? 'assertive' : 'polite');
|
|
217
|
+
}, [announce, statusType, statusMessage]);
|
|
194
218
|
const statusEl = status ? /*#__PURE__*/_jsxs("div", {
|
|
195
|
-
role: status.type === 'error' ? 'alert' : 'status',
|
|
196
219
|
...{
|
|
197
220
|
0: {
|
|
198
221
|
className: "x1n2onr6 x1ja2u2z x78zum5 x6s0dn4 x1txdalj x1pzlopt x141an7d x1ltkj2j x9ynric x1htvmrp xvpcij2 xckg3cf xkvxy4d x6k0y1c"
|
|
@@ -44,6 +44,10 @@ export interface ChatSystemMessageProps extends BaseProps<HTMLDivElement> {
|
|
|
44
44
|
* "user joined", status changes. Supports a divider variant with horizontal
|
|
45
45
|
* lines on each side of the text.
|
|
46
46
|
*
|
|
47
|
+
* It carries no live role: a notice added to a `ChatMessageList` is announced
|
|
48
|
+
* by the list's log, which owns content added inside it (`spec:AST-086` FR4),
|
|
49
|
+
* and a date or divider row is ordinary transcript content.
|
|
50
|
+
*
|
|
47
51
|
* @example
|
|
48
52
|
* ```
|
|
49
53
|
* <ChatSystemMessage>Conversation started</ChatSystemMessage>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatSystemMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSystemMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACvE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAwCD
|
|
1
|
+
{"version":3,"file":"ChatSystemMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatSystemMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,wBAAwB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE7D,MAAM,WAAW,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IACvE,wCAAwC;IACxC,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;IAEnC;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAwCD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAmB,EACnB,IAAI,EACJ,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,sBAAsB,+BAiCxB;yBA1Ce,iBAAiB"}
|
|
@@ -60,6 +60,10 @@ const styles = {
|
|
|
60
60
|
* "user joined", status changes. Supports a divider variant with horizontal
|
|
61
61
|
* lines on each side of the text.
|
|
62
62
|
*
|
|
63
|
+
* It carries no live role: a notice added to a `ChatMessageList` is announced
|
|
64
|
+
* by the list's log, which owns content added inside it (`spec:AST-086` FR4),
|
|
65
|
+
* and a date or divider row is ordinary transcript content.
|
|
66
|
+
*
|
|
63
67
|
* @example
|
|
64
68
|
* ```
|
|
65
69
|
* <ChatSystemMessage>Conversation started</ChatSystemMessage>
|
|
@@ -84,7 +88,6 @@ export function ChatSystemMessage({
|
|
|
84
88
|
variant
|
|
85
89
|
}), stylex.props(styles.dividerWrap, xstyle), className, styleProp),
|
|
86
90
|
...rest,
|
|
87
|
-
role: "status",
|
|
88
91
|
children: /*#__PURE__*/_jsx(Divider, {
|
|
89
92
|
label: children
|
|
90
93
|
})
|
|
@@ -96,7 +99,6 @@ export function ChatSystemMessage({
|
|
|
96
99
|
variant
|
|
97
100
|
}), stylex.props(styles.root, xstyle), className, styleProp),
|
|
98
101
|
...rest,
|
|
99
|
-
role: "status",
|
|
100
102
|
children: /*#__PURE__*/_jsxs("span", {
|
|
101
103
|
...{
|
|
102
104
|
className: "x3nfvp2 x6s0dn4 x1s4dlld"
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* comes from the parent DropdownMenu's useListFocus, which matches
|
|
10
10
|
* menuitemradio rows.
|
|
11
11
|
*/
|
|
12
|
-
import { type ReactNode } from 'react';
|
|
12
|
+
import { type ReactNode, type Ref } from 'react';
|
|
13
13
|
import type { BaseProps } from '../BaseProps';
|
|
14
14
|
export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'> {
|
|
15
15
|
/**
|
|
@@ -24,9 +24,9 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
24
24
|
/**
|
|
25
25
|
* Accessible name for the group, announced by screen readers so the radios
|
|
26
26
|
* read as a named set (e.g. "Sort by"). Applied as the group's `aria-label`.
|
|
27
|
-
* Required
|
|
28
|
-
*
|
|
29
|
-
*
|
|
27
|
+
* Required even when `aria-labelledby` (via base props) points to visible
|
|
28
|
+
* text; that visible reference becomes the computed name while `label`
|
|
29
|
+
* remains the fallback.
|
|
30
30
|
*/
|
|
31
31
|
label: string;
|
|
32
32
|
/**
|
|
@@ -36,6 +36,10 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
36
36
|
* @default true
|
|
37
37
|
*/
|
|
38
38
|
hasCloseOnSelect?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Ref forwarded to the role="group" root.
|
|
41
|
+
*/
|
|
42
|
+
ref?: Ref<HTMLDivElement>;
|
|
39
43
|
/**
|
|
40
44
|
* The `DropdownMenuRadioItem`s that make up the group.
|
|
41
45
|
*/
|
|
@@ -58,7 +62,7 @@ export interface DropdownMenuRadioGroupProps extends Omit<BaseProps, 'onChange'>
|
|
|
58
62
|
* </DropdownMenu>
|
|
59
63
|
* ```
|
|
60
64
|
*/
|
|
61
|
-
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, xstyle, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
65
|
+
export declare function DropdownMenuRadioGroup({ value, onChange, label, hasCloseOnSelect, children, ref, xstyle, className, style, ...rest }: DropdownMenuRadioGroupProps): import("react").JSX.Element;
|
|
62
66
|
export declare namespace DropdownMenuRadioGroup {
|
|
63
67
|
var displayName: string;
|
|
64
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"DropdownMenuRadioGroup.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuRadioGroup.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;GAUG;AAEH,OAAO,EAAU,KAAK,SAAS,EAAE,KAAK,GAAG,EAAC,MAAM,OAAO,CAAC;AAIxD,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiB5C,MAAM,WAAW,2BAA4B,SAAQ,IAAI,CACvD,SAAS,EACT,UAAU,CACX;IACC;;;OAGG;IACH,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,GAAG,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;IAC1B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EACrC,KAAK,EACL,QAAQ,EACR,KAAK,EACL,gBAAuB,EACvB,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,2BAA2B,+BAkB7B;yBA7Be,sBAAsB"}
|
|
@@ -51,6 +51,7 @@ export function DropdownMenuRadioGroup({
|
|
|
51
51
|
label,
|
|
52
52
|
hasCloseOnSelect = true,
|
|
53
53
|
children,
|
|
54
|
+
ref,
|
|
54
55
|
xstyle,
|
|
55
56
|
className,
|
|
56
57
|
style,
|
|
@@ -63,6 +64,7 @@ export function DropdownMenuRadioGroup({
|
|
|
63
64
|
}), [value, onChange, hasCloseOnSelect]);
|
|
64
65
|
return /*#__PURE__*/_jsx("div", {
|
|
65
66
|
...rest,
|
|
67
|
+
ref: ref,
|
|
66
68
|
role: "group",
|
|
67
69
|
"aria-label": label,
|
|
68
70
|
...mergeProps(stylex.props(styles.group, xstyle), {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/core",
|
|
3
|
-
"version": "0.7.3
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"displayName": "Astryx Core",
|
|
5
5
|
"description": "The component library. Accessible, themeable React components with built-in spacing, dark mode, and StyleX styling.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -792,8 +792,6 @@
|
|
|
792
792
|
"react-dom": ">=19.0.0"
|
|
793
793
|
},
|
|
794
794
|
"devDependencies": {
|
|
795
|
-
"@astryxdesign/a11y-spec": "0.7.3-canary.fba04ed",
|
|
796
|
-
"@astryxdesign/cli": "0.7.3-canary.fba04ed",
|
|
797
795
|
"@babel/cli": "^7.29.7",
|
|
798
796
|
"@babel/core": "^7.29.7",
|
|
799
797
|
"@babel/preset-react": "^7.29.7",
|
|
@@ -804,7 +802,9 @@
|
|
|
804
802
|
"@testing-library/jest-dom": "^6.6.0",
|
|
805
803
|
"@testing-library/react": "^16.3.2",
|
|
806
804
|
"@types/babel__core": "^7.20.5",
|
|
807
|
-
"tailwindcss": "^4.3.2"
|
|
805
|
+
"tailwindcss": "^4.3.2",
|
|
806
|
+
"@astryxdesign/a11y-spec": "0.0.0",
|
|
807
|
+
"@astryxdesign/cli": "0.7.3"
|
|
808
808
|
},
|
|
809
809
|
"dependencies": {
|
|
810
810
|
"intl-messageformat": "^11.2.9"
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
fireEvent,
|
|
18
18
|
createEvent,
|
|
19
19
|
act,
|
|
20
|
+
waitFor,
|
|
20
21
|
} from '@testing-library/react';
|
|
21
22
|
import userEvent from '@testing-library/user-event';
|
|
22
23
|
import {Button} from './Button';
|
|
@@ -643,7 +644,17 @@ describe('Button', () => {
|
|
|
643
644
|
expect(liveRegion).toHaveTextContent('Loading');
|
|
644
645
|
});
|
|
645
646
|
|
|
646
|
-
it('
|
|
647
|
+
it('mounts the loading live region empty when first rendered loading, then fills it (spec:AST-086 FR3)', async () => {
|
|
648
|
+
render(<Button label="Submit" isLoading />);
|
|
649
|
+
const button = screen.getByRole('button');
|
|
650
|
+
// The Spinner also has role="status", so grab the live region explicitly.
|
|
651
|
+
const regions = button.querySelectorAll('[role="status"]');
|
|
652
|
+
const liveRegion = regions[regions.length - 1];
|
|
653
|
+
expect(liveRegion).toHaveTextContent('');
|
|
654
|
+
await waitFor(() => expect(liveRegion).toHaveTextContent('Loading'));
|
|
655
|
+
});
|
|
656
|
+
|
|
657
|
+
it('localizes the loading announcement through the i18n catalog', async () => {
|
|
647
658
|
render(
|
|
648
659
|
<InternationalizationProvider
|
|
649
660
|
locale="fr"
|
|
@@ -655,7 +666,7 @@ describe('Button', () => {
|
|
|
655
666
|
// The Spinner also has role="status", so grab the live region explicitly.
|
|
656
667
|
const regions = button.querySelectorAll('[role="status"]');
|
|
657
668
|
const liveRegion = regions[regions.length - 1];
|
|
658
|
-
expect(liveRegion).toHaveTextContent('Chargement');
|
|
669
|
+
await waitFor(() => expect(liveRegion).toHaveTextContent('Chargement'));
|
|
659
670
|
});
|
|
660
671
|
|
|
661
672
|
describe('in a narrow row', () => {
|
package/src/Button/Button.tsx
CHANGED
|
@@ -18,7 +18,13 @@
|
|
|
18
18
|
* Last synced props: label, variant, size, isDisabled, isLoading, isInterruptible, clickAction, icon, isIconOnly, width, children, tooltip, endContent, href, as, target, rel
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
useEffect,
|
|
23
|
+
useRef,
|
|
24
|
+
useState,
|
|
25
|
+
useTransition,
|
|
26
|
+
type ReactNode,
|
|
27
|
+
} from 'react';
|
|
22
28
|
import type {BaseProps} from '../BaseProps';
|
|
23
29
|
import type {Elevation, SizeValue} from '../utils/types';
|
|
24
30
|
import * as stylex from '@stylexjs/stylex';
|
|
@@ -587,6 +593,21 @@ export function Button({
|
|
|
587
593
|
// re-click can land and interrupt the in-flight action with a fresh one.
|
|
588
594
|
const actionInFlightRef = useRef(false);
|
|
589
595
|
const isLoadingState = isLoading || isPending;
|
|
596
|
+
// The loading live region must exist empty before it receives "Loading":
|
|
597
|
+
// many screen readers skip a live region that mounts already holding its
|
|
598
|
+
// text, which is what a Button first rendered loading did (spec:AST-086
|
|
599
|
+
// FR3). Only that case holds the text back, until the frame after the
|
|
600
|
+
// region mounts; a Button mounted idle never re-renders for this.
|
|
601
|
+
const [isLiveRegionReady, setIsLiveRegionReady] = useState(
|
|
602
|
+
() => !isLoadingState,
|
|
603
|
+
);
|
|
604
|
+
useEffect(() => {
|
|
605
|
+
if (isLiveRegionReady) {
|
|
606
|
+
return;
|
|
607
|
+
}
|
|
608
|
+
const frame = requestAnimationFrame(() => setIsLiveRegionReady(true));
|
|
609
|
+
return () => cancelAnimationFrame(frame);
|
|
610
|
+
}, [isLiveRegionReady]);
|
|
590
611
|
// Delay the spinner reveal for action-driven loading (clickAction's own
|
|
591
612
|
// transition) so a fast action that settles within the delay does not flash
|
|
592
613
|
// a spinner. Interruptible loading is delayed too, so rapid re-clicks settle
|
|
@@ -767,7 +788,7 @@ export function Button({
|
|
|
767
788
|
</span>
|
|
768
789
|
{/* Live region for loading state announcements */}
|
|
769
790
|
<VisuallyHidden role="status" aria-live="polite">
|
|
770
|
-
{isLoadingState ? t('@astryx.button.loading') : ''}
|
|
791
|
+
{isLoadingState && isLiveRegionReady ? t('@astryx.button.loading') : ''}
|
|
771
792
|
</VisuallyHidden>
|
|
772
793
|
</>
|
|
773
794
|
);
|
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* BUTTON_PATTERN_EXCLUSIONS, the parts deliberately left to another pattern.
|
|
9
9
|
* @position The binding inventory required before any assertion moves
|
|
10
10
|
* (`docs/specs/AST-021/spec.md` FR2, FR4), and the single definition of what
|
|
11
|
-
* each state IS.
|
|
11
|
+
* each state IS. Disabled ClickableCard remains focusable and inert under
|
|
12
|
+
* `docs/specs/AST-085-focusable-disabled/spec.md` FR1 and FR2.
|
|
12
13
|
*
|
|
13
14
|
* A state earns a row when it can change what the button pattern promises: a
|
|
14
15
|
* different name source, a different operability, a different exposure of
|
|
@@ -223,8 +224,8 @@ export const BUTTON_BINDING_STATES = [
|
|
|
223
224
|
{
|
|
224
225
|
id: 'clickable-card-disabled',
|
|
225
226
|
binding: 'ClickableCard',
|
|
226
|
-
summary: 'a disabled action card',
|
|
227
|
-
facts: facts({operable: false, focusable:
|
|
227
|
+
summary: 'a disabled action card: focusable, unavailable, and inert',
|
|
228
|
+
facts: facts({operable: false, focusable: true, unavailable: true}),
|
|
228
229
|
visibleLabel: null,
|
|
229
230
|
pointerTargetSelector: '[data-a11y-pointer-target]',
|
|
230
231
|
storyId: 'a11y-button-pattern--clickable-card-disabled',
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
---
|
|
2
|
+
schema_version: 3
|
|
3
|
+
template_version: 7
|
|
4
|
+
kind: component
|
|
5
|
+
id: component:Carousel
|
|
6
|
+
authority: current
|
|
7
|
+
archive_reason: null
|
|
8
|
+
superseded_by: null
|
|
9
|
+
approved_by: cixzhang
|
|
10
|
+
approved_at: 2026-10-22
|
|
11
|
+
owners: [cixzhang]
|
|
12
|
+
review_triggers: [behavior, accessibility]
|
|
13
|
+
verified_by:
|
|
14
|
+
[
|
|
15
|
+
packages/core/src/Carousel/Carousel.test.tsx,
|
|
16
|
+
packages/core/src/Carousel/__tests__/Carousel.a11y.chromium.spec.ts,
|
|
17
|
+
]
|
|
18
|
+
modules: []
|
|
19
|
+
families: [family:buttons]
|
|
20
|
+
design_specs: []
|
|
21
|
+
architecture: [architecture:interaction-modality]
|
|
22
|
+
contributing: []
|
|
23
|
+
system_specs: [spec:AST-085, spec:AST-025]
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
# Carousel component contract
|
|
27
|
+
|
|
28
|
+
## Contract at a glance
|
|
29
|
+
|
|
30
|
+
| Area | Contract |
|
|
31
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
32
|
+
| Public contract | None changes. |
|
|
33
|
+
| Behavior | An edge scroll button whose direction has run out is hidden and takes no tab stop. When the focused edge button runs out, focus moves to the scroll area. |
|
|
34
|
+
| End-user impact | A keyboard user who scrolls to the first or last item stays inside the carousel instead of landing on the page body or on an invisible control. The scroll area has no role or name yet, so screen-reader users hear little at the destination until it meets `spec:AST-025` FR12. |
|
|
35
|
+
| Builder impact | None. |
|
|
36
|
+
| Compatibility/readiness | No API change. Shipped Carousel and its current tests still use native `disabled` and hand focus to the opposite button; they change with conformance work. |
|
|
37
|
+
| Review checks | Reject focus left on a hidden edge button, focus dropped to the page body, or an edge handoff that moves focus to anything but the scroll area. |
|
|
38
|
+
| Governing rules | `spec:AST-085` FR1, FR4; `spec:AST-025` FR12; `architecture:interaction-modality` INV1. |
|
|
39
|
+
|
|
40
|
+
This table is a review projection; the body below is authoritative.
|
|
41
|
+
|
|
42
|
+
## Intent
|
|
43
|
+
|
|
44
|
+
Carousel shows a horizontally scrolling row of items inside a labelled region,
|
|
45
|
+
with optional scroll buttons at each edge. This record covers only what the edge
|
|
46
|
+
scroll buttons do when their direction runs out. Other Carousel behavior is
|
|
47
|
+
uncontracted until this record grows.
|
|
48
|
+
|
|
49
|
+
## Compatibility and migration
|
|
50
|
+
|
|
51
|
+
- Released default preserved: yes, except where focus lands at an edge.
|
|
52
|
+
- Compatibility class: behavior correction; no API change.
|
|
53
|
+
- Controlled/uncontrolled behavior: unchanged.
|
|
54
|
+
- Migration decision: DEC-1.
|
|
55
|
+
|
|
56
|
+
Consumer migration instructions belong in consumer docs and release notes.
|
|
57
|
+
|
|
58
|
+
## Ownership boundary
|
|
59
|
+
|
|
60
|
+
**Owns**
|
|
61
|
+
|
|
62
|
+
- Edge scroll button visibility, tab order, and the focus destination when one
|
|
63
|
+
runs out.
|
|
64
|
+
|
|
65
|
+
**Does not own / non-goals**
|
|
66
|
+
|
|
67
|
+
- Scroll area keyboard access and naming — `spec:AST-025`.
|
|
68
|
+
- Disabled control semantics in general — `spec:AST-085`.
|
|
69
|
+
- Button naming, sizing, and activation — `family:buttons`.
|
|
70
|
+
- Looping, snapping, edge fades, and slide semantics — uncontracted.
|
|
71
|
+
|
|
72
|
+
## Public concepts
|
|
73
|
+
|
|
74
|
+
| Concept | Closed values or states | Meaning | Availability by variant/orientation/state | Default | Owner | Stability | Invalid-value behavior |
|
|
75
|
+
| ------------------ | ----------------------- | -------------------------------------------------- | ----------------------------------------- | ------- | -------------------- | --------- | ---------------------- |
|
|
76
|
+
| Edge scroll button | available, run out | Whether content remains in that button's direction | Both edges when the carousel overflows | — | `component:Carousel` | stable | not applicable |
|
|
77
|
+
|
|
78
|
+
## Behavioral and layout contract
|
|
79
|
+
|
|
80
|
+
| ID | Candidate invariant | Basis | Draft review state |
|
|
81
|
+
| --- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | ------------------ |
|
|
82
|
+
| FR1 | An edge scroll button whose direction has run out is hidden. While hidden it takes no tab stop and is not exposed to assistive technology. It stays mounted so layout does not shift. This is removal under `spec:AST-085` FR4, not a disabled control. | DEC-1 | settled |
|
|
83
|
+
| FR2 | When the focused edge scroll button runs out, focus moves to the scroll area without scrolling it. This holds when the content no longer overflows and the scroll area is out of the tab order (`spec:AST-025` FR12): it still takes focus programmatically. Focus never lands on the page body or on a hidden button. | DEC-1; `spec:AST-085` FR4 | settled |
|
|
84
|
+
| FR3 | The handoff happens once per edge transition, and only while the edge button held focus. An edge reached by swipe, resize, or wheel while focus is elsewhere moves nothing. | `architecture:interaction-modality` INV8 | settled |
|
|
85
|
+
| FR4 | An edge scroll button that is available behaves as an ordinary Button. | `family:buttons` | settled |
|
|
86
|
+
|
|
87
|
+
### Representative states
|
|
88
|
+
|
|
89
|
+
| State | Required invariant | Allowed variation |
|
|
90
|
+
| -------------------------------------- | --------------------------------------------------------------- | ----------------------- |
|
|
91
|
+
| Mid-scroll | Both edge buttons available | Loop keeps both enabled |
|
|
92
|
+
| Focused "Scroll right" reaches the end | Button hides; focus is on the scroll area; no extra scroll | Reduced motion |
|
|
93
|
+
| Edge reached by swipe, focus elsewhere | Button hides; focus does not move | — |
|
|
94
|
+
| Content shrinks to fit | Both buttons hidden; a focused one hands off to the scroll area | — |
|
|
95
|
+
|
|
96
|
+
## Accessibility contract
|
|
97
|
+
|
|
98
|
+
- **AR1 — No invisible tab stops.** A hidden edge button is not focusable and is
|
|
99
|
+
not exposed to assistive technology (FR1).
|
|
100
|
+
- **AR2 — Focus stays in the region.** The edge handoff keeps focus inside the
|
|
101
|
+
labelled carousel region (FR2), and the keyboard focus indicator follows
|
|
102
|
+
`architecture:interaction-modality` INV1.
|
|
103
|
+
|
|
104
|
+
## Design relationships
|
|
105
|
+
|
|
106
|
+
No design record governs Carousel yet. Edge button visuals stay in code and
|
|
107
|
+
visual evidence.
|
|
108
|
+
|
|
109
|
+
## Family and system relationships
|
|
110
|
+
|
|
111
|
+
- `spec:AST-085` FR4 lets a component name a focus destination for a control it
|
|
112
|
+
removes; FR2 names the scroll area.
|
|
113
|
+
- `spec:AST-025` FR12 owns the scroll area's tab stop and naming.
|
|
114
|
+
- `family:buttons` owns the edge buttons' behavior while available.
|
|
115
|
+
|
|
116
|
+
## Verification map
|
|
117
|
+
|
|
118
|
+
| Contract | Verification | Representative states | Mutation or failure expectation | Audit section |
|
|
119
|
+
| -------- | --------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------ | ------------------------------ |
|
|
120
|
+
| FR1, AR1 | Unit and accessibility-tree tests | at rest at each edge; no overflow | A hidden button that is focusable or exposed fails | `audit:Carousel/accessibility` |
|
|
121
|
+
| FR2, AR2 | Real-browser keyboard test | Enter on "Scroll right" until the end; same on the start | Focus on the page body, a hidden button, or the opposite button fails | `audit:Carousel/accessibility` |
|
|
122
|
+
| FR3 | Real-browser test with swipe and resize | edge reached with focus outside the carousel | Focus moving without an edge-button press, or moving twice for one edge, fails | `audit:Carousel/accessibility` |
|
|
123
|
+
|
|
124
|
+
## Decision log
|
|
125
|
+
|
|
126
|
+
### DEC-1 — The scroll area receives focus when an edge button runs out
|
|
127
|
+
|
|
128
|
+
**Reference:** `component:Carousel/DEC-1`
|
|
129
|
+
**Decider:** cixzhang, 2026-10-22
|
|
130
|
+
|
|
131
|
+
Carousel hides an edge button whose direction has run out, so keeping focus on
|
|
132
|
+
it would leave a keyboard user on an invisible control. The scroll area is always
|
|
133
|
+
mounted inside the labelled region and can take focus whether or not it is in the
|
|
134
|
+
tab order, so focus moving there keeps the user in place inside the carousel.
|
|
135
|
+
|
|
136
|
+
Rejected: the opposite edge button — it may be hidden too, and focus would jump
|
|
137
|
+
across the carousel.
|
|
138
|
+
|
|
139
|
+
## Open questions
|
|
140
|
+
|
|
141
|
+
None.
|
|
142
|
+
|
|
143
|
+
## Content boundary
|
|
144
|
+
|
|
145
|
+
This file does not duplicate consumer prop tables/examples, current audit
|
|
146
|
+
results, implementation steps, or family/system rules. It links to their owners.
|