@astryxdesign/core 0.7.3-canary.fba04ed → 0.7.4-canary.3f6ea7d
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/BottomSheet/BottomSheet.d.ts +18 -6
- package/dist/BottomSheet/BottomSheet.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheet.js +268 -58
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts +41 -12
- package/dist/BottomSheet/BottomSheetSwitcher.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcher.js +294 -165
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts +51 -1
- package/dist/BottomSheet/BottomSheetSwitcherContext.d.ts.map +1 -1
- package/dist/BottomSheet/BottomSheetSwitcherContext.js +13 -1
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +15 -2
- package/dist/Carousel/Carousel.d.ts.map +1 -1
- package/dist/Carousel/Carousel.js +7 -11
- 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/Chat/useTriggerMenu.d.ts.map +1 -1
- package/dist/Chat/useTriggerMenu.js +46 -7
- package/dist/ComplexSelector/ComplexSelector.d.ts.map +1 -1
- package/dist/ComplexSelector/ComplexSelector.js +6 -1
- package/dist/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/ContextMenu/ContextMenu.js +12 -0
- package/dist/DateInput/DateInput.d.ts.map +1 -1
- package/dist/DateInput/DateInput.js +6 -1
- package/dist/DateInput/NativeDateField.d.ts.map +1 -1
- package/dist/DateInput/NativeDateField.js +6 -1
- package/dist/DateInput/TouchDateField.d.ts.map +1 -1
- package/dist/DateInput/TouchDateField.js +9 -1
- package/dist/DateRangeInput/DateRangeInput.d.ts.map +1 -1
- package/dist/DateRangeInput/DateRangeInput.js +6 -1
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +6 -1
- package/dist/DateTimeInput/TouchDateTimeField.d.ts.map +1 -1
- package/dist/DateTimeInput/TouchDateTimeField.js +9 -1
- 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/dist/MultiSelector/MultiSelector.d.ts.map +1 -1
- package/dist/MultiSelector/MultiSelector.js +6 -1
- package/dist/Selector/Selector.d.ts.map +1 -1
- package/dist/Selector/Selector.js +6 -1
- package/dist/TextArea/TextArea.d.ts.map +1 -1
- package/dist/TextArea/TextArea.js +6 -1
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -1
- package/dist/TimeInput/TimeInput.d.ts.map +1 -1
- package/dist/TimeInput/TimeInput.js +6 -1
- package/dist/TimeInput/TouchTimeField.d.ts.map +1 -1
- package/dist/TimeInput/TouchTimeField.js +9 -1
- package/dist/Tokenizer/Tokenizer.d.ts.map +1 -1
- package/dist/Tokenizer/Tokenizer.js +9 -1
- package/dist/Typeahead/BaseTypeahead.d.ts.map +1 -1
- package/dist/Typeahead/BaseTypeahead.js +7 -1
- package/dist/Typeahead/Typeahead.d.ts.map +1 -1
- package/dist/Typeahead/Typeahead.js +9 -1
- package/dist/astryx.css +2 -0
- package/dist/hooks/useBusyAnnouncement.d.ts +22 -0
- package/dist/hooks/useBusyAnnouncement.d.ts.map +1 -0
- package/dist/hooks/useBusyAnnouncement.js +87 -0
- package/dist/hooks/useMenuPress.d.ts +2 -2
- package/dist/hooks/useMenuPress.d.ts.map +1 -1
- package/dist/hooks/useMenuPress.js +5 -1
- package/dist/hooks/useTypeahead.d.ts.map +1 -1
- package/dist/hooks/useTypeahead.js +7 -2
- package/dist/i18n/generated-locales/en.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/en.generated.js +1 -0
- package/dist/i18n/generated-locales/pseudo.generated.d.ts.map +1 -1
- package/dist/i18n/generated-locales/pseudo.generated.js +1 -0
- package/locales/en.json +6 -2
- package/locales/pseudo.json +3 -0
- package/package.json +3 -3
- package/src/BottomSheet/BottomSheet.doc.mjs +2 -2
- package/src/BottomSheet/BottomSheet.spec.md +2 -5
- package/src/BottomSheet/BottomSheet.tsx +260 -47
- package/src/BottomSheet/BottomSheetEdgeTint.test.tsx +4 -2
- package/src/BottomSheet/BottomSheetSwitcher.doc.mjs +11 -10
- package/src/BottomSheet/BottomSheetSwitcher.spec.md +28 -35
- package/src/BottomSheet/BottomSheetSwitcher.test.tsx +830 -48
- package/src/BottomSheet/BottomSheetSwitcher.tsx +396 -215
- package/src/BottomSheet/BottomSheetSwitcherContext.ts +57 -2
- 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/Carousel/Carousel.test.tsx +8 -12
- package/src/Carousel/Carousel.tsx +6 -13
- 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/ChatComposerInput.test.tsx +167 -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/Chat/useTriggerMenu.tsx +55 -6
- package/src/CheckboxList/__tests__/CheckboxList.a11y.chromium.spec.ts +7 -6
- package/src/ComplexSelector/ComplexSelector.tsx +5 -1
- package/src/ContextMenu/ContextMenu.test.tsx +34 -0
- package/src/ContextMenu/ContextMenu.tsx +13 -1
- package/src/DateInput/DateInput.tsx +5 -1
- package/src/DateInput/DateInputTouch.test.tsx +45 -0
- package/src/DateInput/NativeDateField.test.tsx +10 -2
- package/src/DateInput/NativeDateField.tsx +5 -1
- package/src/DateInput/TouchDateField.tsx +14 -2
- package/src/DateRangeInput/DateRangeInput.tsx +5 -1
- package/src/DateTimeInput/DateTimeInput.tsx +5 -1
- package/src/DateTimeInput/TouchDateTimeField.tsx +14 -2
- 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/MultiSelector/MultiSelector.test.tsx +18 -4
- package/src/MultiSelector/MultiSelector.tsx +5 -1
- package/src/ProgressBar/ProgressBar.test.tsx +4 -21
- package/src/ProgressBar/__tests__/ProgressBar.a11y.chromium.spec.ts +114 -0
- package/src/ProgressBar/__tests__/ProgressBar.a11y.known-failures.ts +12 -0
- package/src/ProgressBar/__tests__/ProgressBar.a11y.renders.tsx +38 -0
- package/src/ProgressBar/__tests__/ProgressBar.a11y.states.ts +123 -0
- package/src/ProgressBar/__tests__/ProgressBar.a11y.test.tsx +107 -0
- package/src/Selector/Selector.test.tsx +22 -5
- package/src/Selector/Selector.tsx +5 -1
- package/src/Table/plugins/columnResize/useTableColumnResize.spec.md +11 -11
- package/src/Table/plugins/rowStatus/useTableRowStatus.spec.md +4 -3
- package/src/TextArea/TextArea.test.tsx +9 -1
- package/src/TextArea/TextArea.tsx +5 -1
- package/src/TextInput/TextInput.tsx +5 -1
- package/src/TimeInput/TimeInput.tsx +5 -1
- package/src/TimeInput/TouchTimeField.tsx +12 -2
- package/src/Tokenizer/Tokenizer.test.tsx +17 -12
- package/src/Tokenizer/Tokenizer.tsx +10 -1
- package/src/Typeahead/BaseTypeahead.tsx +14 -1
- package/src/Typeahead/Typeahead.test.tsx +32 -41
- package/src/Typeahead/Typeahead.tsx +10 -1
- package/src/__tests__/BusyOwnerAnnouncement.test.tsx +470 -0
- package/src/hooks/__tests__/MenuPressShadowRoot.a11y.chromium.spec.ts +50 -0
- package/src/hooks/useBusyAnnouncement.ts +100 -0
- package/src/hooks/useMenuPress.test.tsx +27 -1
- package/src/hooks/useMenuPress.ts +12 -3
- package/src/hooks/useTypeahead.test.tsx +42 -1
- package/src/hooks/useTypeahead.ts +7 -2
- package/src/i18n/generated-locales/en.generated.ts +1 -0
- package/src/i18n/generated-locales/pseudo.generated.ts +1 -0
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
|
|
@@ -6,10 +6,22 @@
|
|
|
6
6
|
*
|
|
7
7
|
* BottomSheet selects one of two focused hosts. A standalone host owns its
|
|
8
8
|
* native dialog lifecycle and joins the shared layer dismissal stack; a
|
|
9
|
-
* switcher item
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
9
|
+
* switcher item owns a native dialog of its own too, but hands its lifecycle
|
|
10
|
+
* to the parent's transition state machine, scrim ownership, and dismissal
|
|
11
|
+
* registration. Both render the same BottomSheetPanel, which owns sheet
|
|
12
|
+
* presentation, content padding, gestures, mobile-keyboard accommodation,
|
|
13
|
+
* and motion completion.
|
|
14
|
+
*
|
|
15
|
+
* Every sheet dialog is native first. A scrim-backed sheet is presented with
|
|
16
|
+
* showModal(): the browser makes the page inert and keeps focus inside the
|
|
17
|
+
* dialog, delivers Escape and the platform close as `cancel`, paints the
|
|
18
|
+
* scrim as `::backdrop`, and returns focus to the opener on close(). Page
|
|
19
|
+
* scroll is locked by the shared useScrollLock hook, as for Dialog: a
|
|
20
|
+
* standalone sheet holds it while presented, a switcher holds one for the
|
|
21
|
+
* whole modal flow. The remaining script is what no single dialog can
|
|
22
|
+
* decide: gating `cancel` by `purpose` and the shared dismissal stack, and,
|
|
23
|
+
* in a switcher, handing one scrim between two dialogs and keeping focus in
|
|
24
|
+
* the active sheet when a retained dialog closes.
|
|
13
25
|
*
|
|
14
26
|
* SYNC: When modified, update these files to stay in sync:
|
|
15
27
|
* - /packages/core/src/BottomSheet/BottomSheetPanel.tsx
|
|
@@ -82,8 +94,8 @@ interface SwitcherBottomSheetProps extends BottomSheetSharedProps {
|
|
|
82
94
|
}
|
|
83
95
|
export type BottomSheetProps = StandaloneBottomSheetProps | SwitcherBottomSheetProps;
|
|
84
96
|
/**
|
|
85
|
-
* A mobile touch sheet that
|
|
86
|
-
* BottomSheetSwitcher
|
|
97
|
+
* A mobile touch sheet that owns a native dialog. Given a sheetId inside a
|
|
98
|
+
* BottomSheetSwitcher, that switcher coordinates the dialog's lifecycle.
|
|
87
99
|
*/
|
|
88
100
|
export declare function BottomSheet(props: BottomSheetProps): import("react").JSX.Element;
|
|
89
101
|
export declare namespace BottomSheet {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.ts","sourceRoot":"","sources":["../../src/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAOL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAoBhD,YAAY,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAC,iBAAiB,EAAE,oBAAoB,EAAC,MAAM,oBAAoB,CAAC;AA2FhF,UAAU,sBAAuB,SAAQ,SAAS,CAAC,cAAc,CAAC;IAChE,qDAAqD;IACrD,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAC;IAEd,0EAA0E;IAC1E,QAAQ,EAAE,SAAS,CAAC;IAEpB;;;;;;;;OAQG;IACH,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,wGAAwG;IACxG,MAAM,CAAC,EAAE,iBAAiB,GAAG,MAAM,GAAG,MAAM,CAAC;IAE7C;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,aAAa,CAAC,oBAAoB,CAAC,CAAC;IAEjD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,UAAU,0BAA2B,SAAQ,sBAAsB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAC9C,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB;AAED,UAAU,wBAAyB,SAAQ,sBAAsB;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;IACf,YAAY,CAAC,EAAE,KAAK,CAAC;IACrB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB;AAED,MAAM,MAAM,gBAAgB,GAC1B,0BAA0B,GAAG,wBAAwB,CAAC;AAikBxD;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA6BlD;yBA7Be,WAAW"}
|
|
@@ -10,10 +10,22 @@
|
|
|
10
10
|
*
|
|
11
11
|
* BottomSheet selects one of two focused hosts. A standalone host owns its
|
|
12
12
|
* native dialog lifecycle and joins the shared layer dismissal stack; a
|
|
13
|
-
* switcher item
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
13
|
+
* switcher item owns a native dialog of its own too, but hands its lifecycle
|
|
14
|
+
* to the parent's transition state machine, scrim ownership, and dismissal
|
|
15
|
+
* registration. Both render the same BottomSheetPanel, which owns sheet
|
|
16
|
+
* presentation, content padding, gestures, mobile-keyboard accommodation,
|
|
17
|
+
* and motion completion.
|
|
18
|
+
*
|
|
19
|
+
* Every sheet dialog is native first. A scrim-backed sheet is presented with
|
|
20
|
+
* showModal(): the browser makes the page inert and keeps focus inside the
|
|
21
|
+
* dialog, delivers Escape and the platform close as `cancel`, paints the
|
|
22
|
+
* scrim as `::backdrop`, and returns focus to the opener on close(). Page
|
|
23
|
+
* scroll is locked by the shared useScrollLock hook, as for Dialog: a
|
|
24
|
+
* standalone sheet holds it while presented, a switcher holds one for the
|
|
25
|
+
* whole modal flow. The remaining script is what no single dialog can
|
|
26
|
+
* decide: gating `cancel` by `purpose` and the shared dismissal stack, and,
|
|
27
|
+
* in a switcher, handing one scrim between two dialogs and keeping focus in
|
|
28
|
+
* the active sheet when a retained dialog closes.
|
|
17
29
|
*
|
|
18
30
|
* SYNC: When modified, update these files to stay in sync:
|
|
19
31
|
* - /packages/core/src/BottomSheet/BottomSheetPanel.tsx
|
|
@@ -32,6 +44,7 @@ import * as stylex from '@stylexjs/stylex';
|
|
|
32
44
|
import "../theme/tokens.stylex.js";
|
|
33
45
|
import { colorVars, durationVars, easeVars } from "../theme/tokens.stylex.js";
|
|
34
46
|
import { useDevWarning, useScrollLock } from "../hooks/index.js";
|
|
47
|
+
import { mergeProps } from "../utils/index.js";
|
|
35
48
|
import { LayerDepthProvider } from "../Layer/LayerDepthContext.js";
|
|
36
49
|
import { useLayerDismissal } from "../Layer/useLayerDismissal.js";
|
|
37
50
|
import { focusForLastInput } from "../utils/focusReturn.js";
|
|
@@ -40,6 +53,53 @@ import { BottomSheetPanel } from "./BottomSheetPanel.js";
|
|
|
40
53
|
import { BottomSheetEdgeTint } from "./BottomSheetEdgeTint.js";
|
|
41
54
|
import { BottomSheetSwitcherContext } from "./BottomSheetSwitcherContext.js";
|
|
42
55
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
56
|
+
const styles = {
|
|
57
|
+
dialog: {
|
|
58
|
+
kVAEAm: "xixxii4",
|
|
59
|
+
kpwlN0: "x10a8y8t",
|
|
60
|
+
kzqmXN: "x1o6l61p",
|
|
61
|
+
kZKoxP: "xtdtrs8",
|
|
62
|
+
ks0D6T: "x1x1rfll",
|
|
63
|
+
kskxy: "x7ab17h",
|
|
64
|
+
kogj98: "x1ghz6dp",
|
|
65
|
+
kmVPX3: "x1717udv",
|
|
66
|
+
kMzoRj: "xc342km",
|
|
67
|
+
ksu8eU: "xng3xce",
|
|
68
|
+
kWkggS: "xjbqb8w",
|
|
69
|
+
kVQacm: "x1rea2x4",
|
|
70
|
+
k1xSpc: "x1s85apg",
|
|
71
|
+
kI3sdo: "x1a2a7pz",
|
|
72
|
+
$$css: true
|
|
73
|
+
},
|
|
74
|
+
dialogOpen: {
|
|
75
|
+
k1xSpc: "x1lliihq",
|
|
76
|
+
$$css: true
|
|
77
|
+
},
|
|
78
|
+
scrim: {
|
|
79
|
+
kGyWv1: "xnixb3f",
|
|
80
|
+
k5sjJv: "xni466t xxiuuzi",
|
|
81
|
+
kND0Po: "xc0dz0a",
|
|
82
|
+
k9an0g: "x10buo38",
|
|
83
|
+
kb4ib: "x15h3t91",
|
|
84
|
+
kwHxkk: "x142juwg",
|
|
85
|
+
k4oj2o: "x15l12jy",
|
|
86
|
+
$$css: true
|
|
87
|
+
},
|
|
88
|
+
dialogNonModalItem: {
|
|
89
|
+
kfzvcC: "x47corl",
|
|
90
|
+
kzqmXN: "xh8yej3",
|
|
91
|
+
kZKoxP: "x5yr21d",
|
|
92
|
+
$$css: true
|
|
93
|
+
},
|
|
94
|
+
dialogNonModalItemTop: {
|
|
95
|
+
kY2c9j: "x1vjfegm",
|
|
96
|
+
$$css: true
|
|
97
|
+
},
|
|
98
|
+
scrimClosing: {
|
|
99
|
+
kb4ib: "x1cz9k3x",
|
|
100
|
+
$$css: true
|
|
101
|
+
}
|
|
102
|
+
};
|
|
43
103
|
function panelStateForSwitcherPhase(phase, alignmentOffset) {
|
|
44
104
|
switch (phase) {
|
|
45
105
|
case 'active':
|
|
@@ -91,6 +151,43 @@ function focusPanel(panel, isModal) {
|
|
|
91
151
|
});
|
|
92
152
|
}
|
|
93
153
|
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Present a switcher step's dialog modally with no focus to return to.
|
|
157
|
+
* showModal() records the element focused at that moment and close() moves
|
|
158
|
+
* focus back to it, in Chromium and WebKit even when focus is in another
|
|
159
|
+
* dialog by then. For a step that element is the control that advanced the
|
|
160
|
+
* flow (Continue, Back) or the flow's opener, and the dialog closes a fade
|
|
161
|
+
* later, while the user is in the next step: the return would pull focus
|
|
162
|
+
* off the active panel with no user action. Blurring first leaves nothing
|
|
163
|
+
* recorded, so the close moves nothing; the entering step then focuses its
|
|
164
|
+
* own panel, and the switcher returns focus to the opener itself when the
|
|
165
|
+
* flow ends. The blur happens in the same task as the present, so no frame
|
|
166
|
+
* paints without focus.
|
|
167
|
+
*/
|
|
168
|
+
function presentStepModally(dialog) {
|
|
169
|
+
const focused = dialog.ownerDocument.activeElement;
|
|
170
|
+
if (focused instanceof HTMLElement && focused !== dialog.ownerDocument.body) {
|
|
171
|
+
focused.blur();
|
|
172
|
+
}
|
|
173
|
+
dialog.showModal();
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Present a switcher dialog whose backdrop must start, and stay, clear: the
|
|
178
|
+
* opacity is set with the scrim transition pinned to 0s, the dialog is
|
|
179
|
+
* presented, and the pin is lifted only after a style flush has applied the
|
|
180
|
+
* clear backdrop, so no frame eases from a previous backdrop value.
|
|
181
|
+
*/
|
|
182
|
+
function presentWithClearScrim(dialog) {
|
|
183
|
+
dialog.style.setProperty('--_sheet-scrim-duration', '0s');
|
|
184
|
+
dialog.style.setProperty('--_sheet-scrim-opacity', '0');
|
|
185
|
+
presentStepModally(dialog);
|
|
186
|
+
if (typeof getComputedStyle === 'function') {
|
|
187
|
+
void getComputedStyle(dialog, '::backdrop').opacity;
|
|
188
|
+
}
|
|
189
|
+
dialog.style.removeProperty('--_sheet-scrim-duration');
|
|
190
|
+
}
|
|
94
191
|
function StandaloneBottomSheet({
|
|
95
192
|
ref,
|
|
96
193
|
isOpen,
|
|
@@ -231,10 +328,10 @@ function StandaloneBottomSheet({
|
|
|
231
328
|
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq"
|
|
232
329
|
},
|
|
233
330
|
4: {
|
|
234
|
-
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a
|
|
331
|
+
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x15h3t91 x142juwg x15l12jy"
|
|
235
332
|
},
|
|
236
333
|
12: {
|
|
237
|
-
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a
|
|
334
|
+
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x15h3t91 x142juwg x15l12jy"
|
|
238
335
|
},
|
|
239
336
|
2: {
|
|
240
337
|
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x"
|
|
@@ -243,10 +340,10 @@ function StandaloneBottomSheet({
|
|
|
243
340
|
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x"
|
|
244
341
|
},
|
|
245
342
|
6: {
|
|
246
|
-
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a
|
|
343
|
+
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x142juwg x15l12jy x1cz9k3x"
|
|
247
344
|
},
|
|
248
345
|
14: {
|
|
249
|
-
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a
|
|
346
|
+
className: "xixxii4 x10a8y8t x1o6l61p xtdtrs8 x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x142juwg x15l12jy x1cz9k3x"
|
|
250
347
|
},
|
|
251
348
|
1: {
|
|
252
349
|
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x47corl xfo81ep xh8yej3 x5yr21d"
|
|
@@ -255,10 +352,10 @@ function StandaloneBottomSheet({
|
|
|
255
352
|
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x47corl xfo81ep xh8yej3 x5yr21d"
|
|
256
353
|
},
|
|
257
354
|
5: {
|
|
258
|
-
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a
|
|
355
|
+
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x15h3t91 x142juwg x15l12jy x47corl xfo81ep xh8yej3 x5yr21d"
|
|
259
356
|
},
|
|
260
357
|
13: {
|
|
261
|
-
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a
|
|
358
|
+
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x15h3t91 x142juwg x15l12jy x47corl xfo81ep xh8yej3 x5yr21d"
|
|
262
359
|
},
|
|
263
360
|
3: {
|
|
264
361
|
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"
|
|
@@ -267,10 +364,10 @@ function StandaloneBottomSheet({
|
|
|
267
364
|
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"
|
|
268
365
|
},
|
|
269
366
|
7: {
|
|
270
|
-
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a
|
|
367
|
+
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1s85apg x1a2a7pz xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x142juwg x15l12jy x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"
|
|
271
368
|
},
|
|
272
369
|
15: {
|
|
273
|
-
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a
|
|
370
|
+
className: "xixxii4 x10a8y8t x1x1rfll x7ab17h x1ghz6dp x1717udv xc342km xng3xce xjbqb8w x1rea2x4 x1a2a7pz x1lliihq xnixb3f xni466t xxiuuzi xc0dz0a x10buo38 x142juwg x15l12jy x1cz9k3x x47corl xfo81ep xh8yej3 x5yr21d"
|
|
274
371
|
}
|
|
275
372
|
}[!!shouldPresent << 3 | !!hasScrim << 2 | !!(hasScrim && !isOpen && isPresented) << 1 | !!!hasScrim << 0],
|
|
276
373
|
ref: dialogRef,
|
|
@@ -324,12 +421,21 @@ function SwitcherBottomSheetItem({
|
|
|
324
421
|
onActiveSheetChange,
|
|
325
422
|
getSheetPhase,
|
|
326
423
|
getSheetAlignmentOffset,
|
|
424
|
+
hostSheet,
|
|
425
|
+
isScrimOwner,
|
|
426
|
+
isFlowClosing,
|
|
327
427
|
registerSheetElement,
|
|
328
|
-
|
|
428
|
+
registerSheetDialog,
|
|
329
429
|
registerSheetPurpose,
|
|
430
|
+
onBeforeSheetPresent,
|
|
431
|
+
isCoveredInTopLayer,
|
|
330
432
|
onSheetEnterStart,
|
|
331
433
|
onSheetTransitionComplete,
|
|
332
|
-
onSheetScrimOpacityChange
|
|
434
|
+
onSheetScrimOpacityChange,
|
|
435
|
+
dialogProps,
|
|
436
|
+
onDialogCancel,
|
|
437
|
+
onDialogClick,
|
|
438
|
+
onDialogKeyDown
|
|
333
439
|
} = switcher;
|
|
334
440
|
const hasValidSheetId = typeof sheetId === 'string' && sheetId.length > 0;
|
|
335
441
|
const phase = hasValidSheetId ? getSheetPhase(sheetId) : 'hidden';
|
|
@@ -339,6 +445,10 @@ function SwitcherBottomSheetItem({
|
|
|
339
445
|
const isInactive = phase === 'covered' || phase === 'aligning' || phase === 'fading' || phase === 'exiting';
|
|
340
446
|
const isPresented = phase !== 'hidden';
|
|
341
447
|
const isTopSheet = phase === 'active' || phase === 'entering';
|
|
448
|
+
const ownsScrim = hasValidSheetId && isScrimOwner(sheetId);
|
|
449
|
+
const isHostSheet = hasValidSheetId && hostSheet === sheetId;
|
|
450
|
+
const dialogRef = useRef(null);
|
|
451
|
+
const dialogModeRef = useRef(null);
|
|
342
452
|
const panelRef = useRef(null);
|
|
343
453
|
const previousPhaseRef = useRef(phase);
|
|
344
454
|
const previousPhase = previousPhaseRef.current;
|
|
@@ -357,6 +467,12 @@ function SwitcherBottomSheetItem({
|
|
|
357
467
|
registerSheetElement(sheetId, element);
|
|
358
468
|
}
|
|
359
469
|
}, [hasValidSheetId, registerSheetElement, sheetId]);
|
|
470
|
+
const handleDialogElementChange = useCallback(element => {
|
|
471
|
+
dialogRef.current = element;
|
|
472
|
+
if (hasValidSheetId) {
|
|
473
|
+
registerSheetDialog(sheetId, element);
|
|
474
|
+
}
|
|
475
|
+
}, [hasValidSheetId, registerSheetDialog, sheetId]);
|
|
360
476
|
const handleMotionStart = useCallback(motion => {
|
|
361
477
|
if (motion === 'entering' && hasValidSheetId) {
|
|
362
478
|
onSheetEnterStart(sheetId);
|
|
@@ -375,13 +491,6 @@ function SwitcherBottomSheetItem({
|
|
|
375
491
|
onSheetScrimOpacityChange(sheetId, opacity);
|
|
376
492
|
}
|
|
377
493
|
}, [hasValidSheetId, onSheetScrimOpacityChange, sheetId]);
|
|
378
|
-
useLayoutEffect(() => {
|
|
379
|
-
if (!hasValidSheetId) {
|
|
380
|
-
return;
|
|
381
|
-
}
|
|
382
|
-
registerSheetLabel(sheetId, label);
|
|
383
|
-
return () => registerSheetLabel(sheetId, null);
|
|
384
|
-
}, [hasValidSheetId, label, registerSheetLabel, sheetId]);
|
|
385
494
|
useLayoutEffect(() => {
|
|
386
495
|
if (!hasValidSheetId) {
|
|
387
496
|
return;
|
|
@@ -389,6 +498,70 @@ function SwitcherBottomSheetItem({
|
|
|
389
498
|
registerSheetPurpose(sheetId, purpose);
|
|
390
499
|
return () => registerSheetPurpose(sheetId, null);
|
|
391
500
|
}, [hasValidSheetId, purpose, registerSheetPurpose, sheetId]);
|
|
501
|
+
|
|
502
|
+
// Present this sheet's own dialog while the switcher keeps the sheet on
|
|
503
|
+
// screen, and close it once the sheet is hidden. A scrim flow presents
|
|
504
|
+
// modally: an entering dialog is shown above the retained one in the top
|
|
505
|
+
// layer, and the retained dialog closes only after its panel has faded. A
|
|
506
|
+
// modal dialog that is still open beneath a newer one -- the user went back
|
|
507
|
+
// to a sheet that was still fading -- re-presents to become topmost again:
|
|
508
|
+
// the document is blocked by the topmost modal dialog, so a lower one is
|
|
509
|
+
// inert whatever the switcher calls it.
|
|
510
|
+
//
|
|
511
|
+
// Every present blurs first, so no step dialog records an element to
|
|
512
|
+
// return focus to: a close while another sheet is active moves nothing,
|
|
513
|
+
// and when the flow ends the switcher focuses the flow's opener itself.
|
|
514
|
+
useLayoutEffect(() => {
|
|
515
|
+
const dialog = dialogRef.current;
|
|
516
|
+
if (dialog == null || !hasValidSheetId) {
|
|
517
|
+
return;
|
|
518
|
+
}
|
|
519
|
+
if (!isPresented) {
|
|
520
|
+
if (dialog.open) {
|
|
521
|
+
dialog.close();
|
|
522
|
+
}
|
|
523
|
+
dialogModeRef.current = null;
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
const nextMode = hasScrim ? 'modal' : 'non-modal';
|
|
527
|
+
if (dialog.open && dialogModeRef.current !== nextMode) {
|
|
528
|
+
dialog.close();
|
|
529
|
+
}
|
|
530
|
+
if (dialog.open && hasScrim && isInteractive && isCoveredInTopLayer(sheetId)) {
|
|
531
|
+
dialog.close();
|
|
532
|
+
}
|
|
533
|
+
if (!dialog.open) {
|
|
534
|
+
if (hasScrim) {
|
|
535
|
+
onBeforeSheetPresent(sheetId);
|
|
536
|
+
if (ownsScrim) {
|
|
537
|
+
presentStepModally(dialog);
|
|
538
|
+
} else {
|
|
539
|
+
// Entering above a retained dialog whose backdrop already dims the
|
|
540
|
+
// page: present with a clear backdrop so the page is not dimmed
|
|
541
|
+
// twice and the previous panel stays undimmed beneath this one.
|
|
542
|
+
// Pinned to 0s across the present: a dialog re-presented from the
|
|
543
|
+
// retained position (the user went back while it was fading)
|
|
544
|
+
// closed with its backdrop at 1, and would otherwise ease it down
|
|
545
|
+
// over the scrim duration on top of the new owner's backdrop.
|
|
546
|
+
presentWithClearScrim(dialog);
|
|
547
|
+
}
|
|
548
|
+
} else {
|
|
549
|
+
dialog.show();
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
dialogModeRef.current = nextMode;
|
|
553
|
+
}, [hasScrim, hasValidSheetId, isCoveredInTopLayer, isInteractive, isPresented, onBeforeSheetPresent, ownsScrim, sheetId]);
|
|
554
|
+
|
|
555
|
+
// A sheet removed while presented -- a consumer unmounts the closing sheet
|
|
556
|
+
// in the same update that closes the flow -- takes its dialog out of the
|
|
557
|
+
// top layer with it, but the element would keep its `open` state. Close it
|
|
558
|
+
// while it is still attached so the native lifecycle ends cleanly.
|
|
559
|
+
useLayoutEffect(() => () => {
|
|
560
|
+
const dialog = dialogRef.current;
|
|
561
|
+
if (dialog?.open) {
|
|
562
|
+
dialog.close();
|
|
563
|
+
}
|
|
564
|
+
}, []);
|
|
392
565
|
useEffect(() => {
|
|
393
566
|
if (isInteractive) {
|
|
394
567
|
const wasInteractive = previousPhase === 'active' || previousPhase === 'entering';
|
|
@@ -401,50 +574,87 @@ function SwitcherBottomSheetItem({
|
|
|
401
574
|
}
|
|
402
575
|
}, [hasScrim, isInteractive, phase, previousPhase]);
|
|
403
576
|
useDevWarning('BottomSheet', 'requires a non-empty `label` for an accessible name; the open sheet ' + 'has no built-in heading to derive one from.', isInteractive && !label);
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
577
|
+
|
|
578
|
+
// The switcher's dialog surface applies to every sheet dialog, except the
|
|
579
|
+
// attributes that identify one element: those render on the host dialog
|
|
580
|
+
// only, the one the switcher's ref resolves to. Of the attributes set
|
|
581
|
+
// explicitly below, only `role` has a consumer value to keep: a required
|
|
582
|
+
// step forces `alertdialog`, otherwise the switcher's `role` stands, as on
|
|
583
|
+
// a shared dialog. `aria-label`/`aria-labelledby` keep consumer precedence
|
|
584
|
+
// above; `aria-modal`, `aria-hidden`, and `inert` are the host's own state.
|
|
585
|
+
const {
|
|
586
|
+
className: switcherClassName,
|
|
587
|
+
style: switcherStyle,
|
|
588
|
+
xstyle: switcherXstyle,
|
|
589
|
+
'aria-label': switcherAriaLabel,
|
|
590
|
+
'aria-labelledby': switcherAriaLabelledBy,
|
|
591
|
+
id: switcherId,
|
|
592
|
+
'data-testid': switcherTestId,
|
|
593
|
+
...switcherDialogProps
|
|
594
|
+
} = dialogProps;
|
|
595
|
+
const dialogPresentationProps = mergeProps(stylex.props(styles.dialog, isPresented && styles.dialogOpen, hasScrim && styles.scrim, hasScrim && ownsScrim && isFlowClosing && styles.scrimClosing, !hasScrim && styles.dialogNonModalItem, !hasScrim && isTopSheet && styles.dialogNonModalItemTop, switcherXstyle), switcherClassName, switcherStyle);
|
|
596
|
+
return /*#__PURE__*/_jsxs("dialog", {
|
|
597
|
+
...switcherDialogProps,
|
|
598
|
+
...dialogPresentationProps,
|
|
599
|
+
id: isHostSheet ? switcherId : undefined,
|
|
600
|
+
"data-testid": isHostSheet ? switcherTestId : undefined,
|
|
601
|
+
ref: handleDialogElementChange,
|
|
602
|
+
"aria-label": switcherAriaLabel ?? (switcherAriaLabelledBy == null ? label : undefined),
|
|
603
|
+
"aria-labelledby": switcherAriaLabelledBy,
|
|
604
|
+
"aria-modal": hasScrim && isInteractive ? 'true' : undefined,
|
|
420
605
|
"aria-hidden": isInactive ? 'true' : undefined,
|
|
421
606
|
inert: isInactive ? true : undefined,
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
607
|
+
role: purpose === 'required' ? 'alertdialog' : switcherDialogProps.role,
|
|
608
|
+
onCancel: onDialogCancel,
|
|
609
|
+
onClick: onDialogClick,
|
|
610
|
+
onKeyDown: onDialogKeyDown,
|
|
611
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
612
|
+
...{
|
|
613
|
+
0: {
|
|
614
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl"
|
|
615
|
+
},
|
|
616
|
+
2: {
|
|
617
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg"
|
|
618
|
+
},
|
|
619
|
+
1: {
|
|
620
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c x78zum5 xl56j7k x47corl x1vjfegm"
|
|
621
|
+
},
|
|
622
|
+
3: {
|
|
623
|
+
className: "x10l6tqk x17y0mx6 x1ey2m1c xl56j7k x47corl x1s85apg x1vjfegm"
|
|
624
|
+
}
|
|
625
|
+
}[!!!isPresented << 1 | !!isTopSheet << 0],
|
|
626
|
+
hidden: !isPresented,
|
|
627
|
+
"aria-hidden": isInactive ? 'true' : undefined,
|
|
628
|
+
inert: isInactive ? true : undefined,
|
|
629
|
+
children: /*#__PURE__*/_jsx(BottomSheetPanel, {
|
|
630
|
+
...props,
|
|
631
|
+
ref: ref,
|
|
632
|
+
state: panelState,
|
|
633
|
+
height: height,
|
|
634
|
+
label: label,
|
|
635
|
+
snapPoints: snapPoints,
|
|
636
|
+
isSwipeDismissAllowed: purpose === 'info',
|
|
637
|
+
isPageScrollLocked: hasScrim,
|
|
638
|
+
xstyle: xstyle,
|
|
639
|
+
onDismiss: dismissOnSwipe,
|
|
640
|
+
onScrimOpacity: handleScrimOpacity,
|
|
641
|
+
onElementChange: handlePanelElementChange,
|
|
642
|
+
onMotionStart: handleMotionStart,
|
|
643
|
+
onMotionComplete: handleMotionComplete,
|
|
644
|
+
children: /*#__PURE__*/_jsx(BottomSheetSwitcherContext, {
|
|
645
|
+
value: null,
|
|
646
|
+
children: /*#__PURE__*/_jsx(LayerDepthProvider, {
|
|
647
|
+
children: children
|
|
648
|
+
})
|
|
649
|
+
})
|
|
440
650
|
})
|
|
441
|
-
})
|
|
651
|
+
}), isPresented && /*#__PURE__*/_jsx(BottomSheetEdgeTint, {})]
|
|
442
652
|
});
|
|
443
653
|
}
|
|
444
654
|
|
|
445
655
|
/**
|
|
446
|
-
* A mobile touch sheet that
|
|
447
|
-
* BottomSheetSwitcher
|
|
656
|
+
* A mobile touch sheet that owns a native dialog. Given a sheetId inside a
|
|
657
|
+
* BottomSheetSwitcher, that switcher coordinates the dialog's lifecycle.
|
|
448
658
|
*/
|
|
449
659
|
export function BottomSheet(props) {
|
|
450
660
|
const switcher = use(BottomSheetSwitcherContext);
|