@astryxdesign/core 0.4.1 → 0.4.2-canary.464a445
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 +55 -0
- package/dist/Avatar/Avatar.d.ts +4 -1
- package/dist/Avatar/Avatar.d.ts.map +1 -1
- package/dist/Avatar/Avatar.js +19 -23
- package/dist/AvatarGroup/AvatarGroupOverflow.d.ts.map +1 -1
- package/dist/AvatarGroup/AvatarGroupOverflow.js +7 -2
- package/dist/Button/Button.d.ts.map +1 -1
- package/dist/Button/Button.js +9 -7
- package/dist/Chat/ChatMessage.d.ts +7 -0
- package/dist/Chat/ChatMessage.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.d.ts +13 -1
- package/dist/Chat/ChatMessageBubble.d.ts.map +1 -1
- package/dist/Chat/ChatMessageBubble.js +19 -1
- package/dist/CheckboxInput/CheckboxInput.d.ts.map +1 -1
- package/dist/CheckboxInput/CheckboxInput.js +5 -0
- package/dist/CommandPalette/CommandPaletteFooter.d.ts.map +1 -1
- package/dist/CommandPalette/CommandPaletteFooter.js +5 -3
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +2 -2
- package/dist/DropdownMenu/DropdownMenuSubMenu.d.ts.map +1 -1
- package/dist/DropdownMenu/DropdownMenuSubMenu.js +19 -15
- package/dist/HoverCard/HoverCard.d.ts +1 -1
- package/dist/HoverCard/HoverCard.d.ts.map +1 -1
- package/dist/HoverCard/HoverCard.js +5 -13
- package/dist/HoverCard/useHoverCard.d.ts.map +1 -1
- package/dist/HoverCard/useHoverCard.js +6 -5
- package/dist/InputGroup/groupStyles.d.ts.map +1 -1
- package/dist/InputGroup/groupStyles.js +7 -2
- package/dist/Layer/layerHost.d.ts +24 -0
- package/dist/Layer/layerHost.d.ts.map +1 -0
- package/dist/Layer/layerHost.js +79 -0
- package/dist/Layer/useLayer.d.ts +14 -6
- package/dist/Layer/useLayer.d.ts.map +1 -1
- package/dist/Layer/useLayer.js +158 -30
- package/dist/NavItem/navItemStyles.stylex.d.ts +17 -5
- package/dist/NavItem/navItemStyles.stylex.d.ts.map +1 -1
- package/dist/NavItem/navItemStyles.stylex.js +11 -5
- package/dist/RadioList/RadioListItem.d.ts.map +1 -1
- package/dist/RadioList/RadioListItem.js +5 -0
- package/dist/SideNav/SideNav.d.ts +7 -9
- package/dist/SideNav/SideNav.d.ts.map +1 -1
- package/dist/SideNav/SideNav.js +32 -5
- package/dist/SideNav/SideNavCollapseButton.d.ts +25 -9
- package/dist/SideNav/SideNavCollapseButton.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseButton.js +39 -15
- package/dist/SideNav/SideNavCollapseContext.d.ts +21 -0
- package/dist/SideNav/SideNavCollapseContext.d.ts.map +1 -1
- package/dist/SideNav/SideNavCollapseContext.js +16 -2
- package/dist/SideNav/SideNavHeading.d.ts.map +1 -1
- package/dist/SideNav/SideNavHeading.js +89 -32
- package/dist/SideNav/SideNavItem.d.ts +7 -2
- package/dist/SideNav/SideNavItem.d.ts.map +1 -1
- package/dist/SideNav/SideNavItem.js +119 -75
- package/dist/SideNav/SideNavSection.d.ts.map +1 -1
- package/dist/SideNav/SideNavSection.js +7 -16
- package/dist/SideNav/index.d.ts +1 -1
- package/dist/SideNav/index.d.ts.map +1 -1
- package/dist/Slider/Slider.d.ts.map +1 -1
- package/dist/Slider/Slider.js +56 -15
- package/dist/Switch/Switch.d.ts.map +1 -1
- package/dist/Switch/Switch.js +5 -0
- package/dist/Thumbnail/Thumbnail.d.ts.map +1 -1
- package/dist/Thumbnail/Thumbnail.js +5 -0
- package/dist/TopNav/TopNavHeading.d.ts.map +1 -1
- package/dist/TopNav/TopNavHeading.js +14 -6
- package/dist/TopNav/TopNavMegaMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMegaMenu.js +25 -93
- package/dist/TopNav/TopNavMegaMenuItem.js +1 -1
- package/dist/TopNav/TopNavMenu.d.ts.map +1 -1
- package/dist/TopNav/TopNavMenu.js +10 -5
- package/dist/astryx.css +13 -7
- package/dist/astryx.umd.js +50 -50
- package/dist/astryx.umd.js.map +4 -4
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useFocusTrap.d.ts.map +1 -1
- package/dist/hooks/useFocusTrap.js +16 -2
- package/dist/hooks/useMenuHover.d.ts +50 -5
- package/dist/hooks/useMenuHover.d.ts.map +1 -1
- package/dist/hooks/useMenuHover.js +171 -51
- package/dist/theme/defineTheme.d.ts +8 -2
- package/dist/theme/defineTheme.d.ts.map +1 -1
- package/dist/theme/defineTheme.js +8 -1
- package/dist/theme/derivedVarRegistry.d.ts.map +1 -1
- package/dist/theme/derivedVarRegistry.js +7 -0
- package/dist/theme/expandColorScale.d.ts.map +1 -1
- package/dist/theme/expandColorScale.js +1 -0
- package/dist/theme/expandMotionScale.d.ts +1 -0
- package/dist/theme/expandMotionScale.d.ts.map +1 -1
- package/dist/theme/expandMotionScale.js +1 -0
- package/dist/theme/expandRadiusScale.d.ts +1 -0
- package/dist/theme/expandRadiusScale.d.ts.map +1 -1
- package/dist/theme/expandRadiusScale.js +1 -0
- package/dist/theme/expandTypeScale.d.ts +1 -0
- package/dist/theme/expandTypeScale.d.ts.map +1 -1
- package/dist/theme/expandTypeScale.js +1 -0
- package/dist/theme/tokens.stylex.d.ts +3 -1
- package/dist/theme/tokens.stylex.d.ts.map +1 -1
- package/dist/theme/tokens.stylex.js +3 -1
- package/locales/en.json +84 -0
- package/locales/pseudo.json +63 -0
- package/package.json +3 -3
- package/src/Avatar/Avatar.doc.mjs +5 -2
- package/src/Avatar/Avatar.test.tsx +51 -0
- package/src/Avatar/Avatar.tsx +30 -20
- package/src/AvatarGroup/AvatarGroup.doc.mjs +1 -1
- package/src/AvatarGroup/AvatarGroup.test.tsx +14 -0
- package/src/AvatarGroup/AvatarGroupOverflow.tsx +3 -2
- package/src/Button/Button.tsx +5 -3
- package/src/ButtonGroup/ButtonGroup.test.tsx +7 -4
- package/src/Card/Card.doc.mjs +2 -0
- package/src/Chat/Chat.doc.mjs +4 -1
- package/src/Chat/ChatMessage.doc.mjs +3 -3
- package/src/Chat/ChatMessage.tsx +7 -0
- package/src/Chat/ChatMessageBubble.doc.mjs +7 -0
- package/src/Chat/ChatMessageBubble.test.tsx +95 -6
- package/src/Chat/ChatMessageBubble.tsx +25 -0
- package/src/CheckboxInput/CheckboxInput.tsx +20 -0
- package/src/CodeBlock/CodeBlock.doc.mjs +3 -0
- package/src/CommandPalette/CommandPaletteFooter.tsx +6 -3
- package/src/DateTimeInput/DateTimeInput.tsx +4 -2
- package/src/DropdownMenu/DropdownMenuSubMenu.test.tsx +72 -1
- package/src/DropdownMenu/DropdownMenuSubMenu.tsx +24 -20
- package/src/HoverCard/HoverCard.doc.mjs +3 -3
- package/src/HoverCard/HoverCard.test.tsx +283 -55
- package/src/HoverCard/HoverCard.tsx +5 -13
- package/src/HoverCard/useHoverCard.tsx +8 -11
- package/src/InputGroup/groupStyles.ts +7 -8
- package/src/Item/Item.doc.mjs +4 -0
- package/src/Layer/layerHost.test.ts +99 -0
- package/src/Layer/layerHost.ts +141 -0
- package/src/Layer/useLayer.doc.mjs +14 -4
- package/src/Layer/useLayer.test.tsx +332 -7
- package/src/Layer/useLayer.tsx +235 -36
- package/src/MobileNav/MobileNav.doc.mjs +7 -0
- package/src/NavItem/navItemStyles.stylex.ts +31 -5
- package/src/RadioList/RadioListItem.tsx +20 -0
- package/src/SideNav/SideNav.doc.mjs +13 -4
- package/src/SideNav/SideNav.test.tsx +858 -2
- package/src/SideNav/SideNav.tsx +37 -16
- package/src/SideNav/SideNavCollapseButton.doc.mjs +28 -6
- package/src/SideNav/SideNavCollapseButton.tsx +67 -15
- package/src/SideNav/SideNavCollapseContext.ts +29 -9
- package/src/SideNav/SideNavHeading.tsx +53 -25
- package/src/SideNav/SideNavItem.doc.mjs +13 -0
- package/src/SideNav/SideNavItem.tsx +97 -84
- package/src/SideNav/SideNavSection.tsx +6 -20
- package/src/SideNav/index.ts +2 -0
- package/src/Slider/Slider.test.tsx +69 -33
- package/src/Slider/Slider.tsx +65 -13
- package/src/Switch/Switch.tsx +20 -0
- package/src/TabList/TabList.doc.mjs +3 -0
- package/src/Text/Text.doc.mjs +1 -1
- package/src/Thumbnail/Thumbnail.doc.mjs +3 -0
- package/src/Thumbnail/Thumbnail.tsx +10 -0
- package/src/Timestamp/Timestamp.test.tsx +40 -22
- package/src/Toolbar/Toolbar.test.tsx +14 -14
- package/src/TopNav/TopNav.test.tsx +86 -1
- package/src/TopNav/TopNavHeading.tsx +21 -14
- package/src/TopNav/TopNavMegaMenu.test.tsx +43 -0
- package/src/TopNav/TopNavMegaMenu.tsx +29 -105
- package/src/TopNav/TopNavMegaMenuItem.tsx +1 -1
- package/src/TopNav/TopNavMenu.test.tsx +41 -0
- package/src/TopNav/TopNavMenu.tsx +14 -4
- package/src/TreeList/TreeList.doc.mjs +1 -0
- package/src/hooks/index.ts +5 -1
- package/src/hooks/useFocusTrap.test.tsx +16 -0
- package/src/hooks/useFocusTrap.ts +20 -2
- package/src/hooks/useMenuHover.test.tsx +364 -0
- package/src/hooks/useMenuHover.ts +243 -47
- package/src/theme/defineTheme.ts +9 -0
- package/src/theme/derivedVarRegistry.test.ts +78 -12
- package/src/theme/derivedVarRegistry.ts +4 -0
- package/src/theme/expandColorScale.ts +1 -0
- package/src/theme/expandMotionScale.ts +1 -0
- package/src/theme/expandRadiusScale.ts +1 -0
- package/src/theme/expandTypeScale.ts +1 -0
- package/src/theme/themingTargets.test.ts +152 -26
- package/src/theme/tokens.stylex.ts +3 -1
- package/src/theme/tokens.test.ts +12 -0
- package/src/theme/useTheme.test.tsx +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,60 @@
|
|
|
1
1
|
# @xds/core
|
|
2
2
|
|
|
3
|
+
# 0.4.2
|
|
4
|
+
|
|
5
|
+
#### New Features
|
|
6
|
+
|
|
7
|
+
- AvatarGroup: expose `size` on the `avatar-group-overflow` theming target so themes can style the "+N" overflow chip per size (matching `avatar-fallback`); the default chip font is unchanged (#5046).
|
|
8
|
+
- Chat: ChatMessageBubble accepts a `width` prop (numbers are pixels, strings pass through, e.g. `width="100%"`), following the sizing convention on Card and other containers. When set it replaces the bubble's default `max(80%, 280px)` width cap; when unset nothing changes. Combined with `variant="ghost"`, custom in-message content (an artifact card, attachment chips, a standalone ChatMessageMetadata) can now align with the bubble's text column at the full message-column width — previously the only workaround was hardcoding the bubble's private padding token at every call site. (#2574)
|
|
9
|
+
- `astryx theme template` writes an annotated theme template into your project (#5048).
|
|
10
|
+
New sibling of `theme add`: where `add` starts you from a theme we ship, `template` starts you from a blank annotated one. `astryx init --features theme` calls the same leaf, so project setup writes it too — it previously printed a one-line hint and wrote nothing, which is the weakest form of the help a theme author needs, since the first problem is not knowing the command but not knowing what the theme surface contains. The file is `theme.template.ts`: every `defineTheme` field with a note on when to reach for it, the token families, the component override syntax, and the consumption steps (providing the theme, loading the fonts you name, building for SSR), each section naming the CLI command that prints its authoritative reference. An existing file is never clobbered.
|
|
11
|
+
|
|
12
|
+
This came out of a vibe test (#5047): agents given an annotated template reached twice as far into the theme surface as agents given only the docs (17 component targets vs 8, and the only arm to use interaction states, custom variants and `onDark`), and shipped a third of the contrast defects.
|
|
13
|
+
|
|
14
|
+
A template that lies is worse than no template, so its claims are machine-checked against live sources rather than trusted: `scripts/check-theme-template.test.mjs` fails when a `defineTheme` field is added and left undocumented, when a token family is missing from the inventory, when a CSS variable or component key it names does not exist, when it cites a docs topic that does not, or when a theme source drops its SYNC reference. `theme build` compiles it warning-free in CI, and the CLI typecheck now covers it.
|
|
15
|
+
|
|
16
|
+
#### Fixes
|
|
17
|
+
|
|
18
|
+
- Avatar: put the avatar box on the element that carries the `astryx-avatar` theme target, so a theme rule on the documented `size` axis resizes the whole avatar instead of growing the wrapper around a fixed-size circle; treat a whitespace-only `name` or `alt` as absent, so it falls through to the default icon rather than rendering an empty plate behind a blank accessible name; warn through the shared `useDevWarning` hook rather than a bare `console.warn` in the render body; and replace the phantom `<OnlineIndicator />` in the JSDoc example with the real `AvatarStatusDot` (#5030)
|
|
19
|
+
- CommandPaletteFooter: wire default keyboard-hint strings through useTranslator so they resolve from the locale catalog instead of being hardcoded English (#4506)
|
|
20
|
+
- `context-menu` component overrides now drive the menu's internal radius and padding vars. `ContextMenu.doc.mjs` has always documented `derived` entries mapping `borderRadius` → `--_dropdown-menu-radius` and `padding` → `--_dropdown-menu-padding`, but `derivedVarRegistry` had no `context-menu` key, so the mapping was dead: `components: {'context-menu': {base: {borderRadius: '12px'}}}` emitted `border-radius` alone and the menu kept reading its own `var(--_dropdown-menu-radius)`. The registry entry now matches the doc, as it already does for `dropdown-menu` (#4783).
|
|
21
|
+
- `useFocusTrap`: a modal surface with no tabbable controls keeps its programmatic focus target instead of letting Tab escape into the page behind it. A dialog that places initial focus on a `tabIndex={-1}` heading or panel had nowhere to advance to, so Tab walked straight out of the trap. `@astryxdesign/core/hooks` also exports `hasActiveFocusTrapEscape` and `isImeKeyEvent`, which coordinate nested traps and skip IME composition keys (#5023).
|
|
22
|
+
- Heading's `type` is a documented theming target, and the docs stop teaching a CSS variable that does not exist (#5016).
|
|
23
|
+
`Heading` reflects `type` as a theme selector — `typography.scale` generates `heading: {'type:display-1' …}` rules for it — but `theming.targets` listed only `level` and `color`, so `astryx theme build` warned `Unknown prop "type" on component "heading"` on every theme that sets a type scale, including the shipped `neutralTheme`. The drift guard missed it twice over: it read a conditional spread (`{level, color, ...(type && {type})}`) as an unknown bag, and it only checked a component against a doc file in its own directory, so `Heading/` — documented from `Text/Text.doc.mjs` — was never checked at all. Both are fixed, which brings three more previously unchecked directories under the guard.
|
|
24
|
+
|
|
25
|
+
Separately, the theme docs' component-override example set `--button-press-scale`, which no component defines: copying it produces CSS that silently never applies. It now sets a real public var, and the example no longer declares the same `button` key twice.
|
|
26
|
+
|
|
27
|
+
- DateTimeInput: the focused-and-empty time placeholder hints ("e.g., 2:30 PM" / "e.g., 14:30") now route through the i18n translator so they localize with the rest of the component. Adds `@astryx.dateTimeInput.timeHint12h` and `@astryx.dateTimeInput.timeHint24h` to the `en` catalog. The live-region "Invalid date" / "Invalid time" announcements this PR also covered landed first in #4363 and now reuse that PR's `@astryx.dateInput.invalidDate` and `@astryx.timeInput.invalidTime` keys. (#4546)
|
|
28
|
+
- Floating layers now declare their own body type instead of inheriting it. The layer container already set `font-family`; it now sets `font-size` and `line-height` from `--text-body-size` / `--text-body-leading` alongside it. A layer is hosted wherever its trigger sits, so any content that did not set its own size took the ambient one — the same Tooltip, Popover or HoverCard rendered at 13px from a caption and at 20px from a lede. Content that goes through `Text`, or sets a size itself (Tooltip's label, DropdownMenu items, NavMenu headings), is unaffected: those already declared their own and still win. Anything that was relying on inheriting a non-body size now renders at the body size and should set one explicitly (#5064).
|
|
29
|
+
- Added a `@astryx.listInput.*` catalog namespace to `packages/core/locales/en.json` so the lab `ListInput` component's action labels, empty state, reorder instructions, and live announcements can be translated. `ListInput` previously hardcoded every visible and assistive-technology-facing string (#4967).
|
|
30
|
+
- Layer: use an inert `<template>` marker to find each context layer's actual JSX position. Safe positions stay inline; positions inside a paragraph, link, button, inline formatting, or a structurally restricted container portal to the nearest safe ancestor. Corrective portals keep CSS custom properties inheriting from that nearby host while preserving direction and writing mode, and `show()` passes the trigger as the popover's invoker `source`. The new `lazyMount` option waits until opening to resolve and mount content; HoverCard uses it so rich content never enters an invalid paragraph during initial render and unmounts again when hidden. Other context layers keep their existing closed-content behavior (#5039).
|
|
31
|
+
- Two guards left failing on `main` by their own landings, so every PR since has been red through no fault of its own. #4963 gave Thumbnail's remove button a coarse-pointer hit-area var and did not document it, which the derived-var guard reads as an undocumented private var; the var is an `inset` on a `::after` overlay, so it is documented as private and listed alongside the other vars no standard CSS property maps onto. #5026 moved `borderDefaults` into `CoreTokenName` — the landing the theme-template guard was explicitly waiting for (its comment says "when #5017 lands, this guard starts requiring the template to cover it") — so the template's token inventory now names `--border-width`.
|
|
32
|
+
- Menus that open on hover no longer close when you click them. A hover-opened menu is already open under the cursor by the time the pointer arrives, so the click that naturally follows was dismissing it — fixed for TopNavMegaMenu in #4555, and now shared: the hover→click guard lives in `useMenuHover`, so TopNavMenu, TopNavHeading, SideNavHeading and DropdownMenuSubMenu get it too, and TopNavMegaMenu runs on the shared machine instead of its own copy. Also from the consolidation: opening a menu moves focus into it synchronously rather than a frame later, closing one returns focus to its trigger instead of dropping it to the document, and keyboard activation always opens rather than toggling an open menu shut (#3121)
|
|
33
|
+
- SideNav: a hardening pass over the family, driven by the component audit. Accessibility, theming, passthrough and code-health defects across `SideNavItem`, `SideNavHeading`, `SideNavSection`, `SideNavCollapseButton` and the `navItemStyles` module the TopNav drawer modes share — the motion guards, the untranslated flyout name, the hand-rolled visually-hidden block, the dropped `...rest`, the missing theming state, the uncleaned timers, and the hand-rolled hover intent, which is now the shared `useMenuHover`. Nav rows also adopt the shared focus outline from #4654, so a keyboard-focused row is ringed with the system's `2px --color-accent` at `3px` offset in every theme instead of falling through to the browser's own ring; in a split-action row the link and the chevron toggle are ringed individually, since they are separate tab stops.
|
|
34
|
+
Three visual fixes came out of review. The collapsed submenu flyout was painting a second, square-cornered surface inside the popover's rounded one, and insetting its own content by 4px instead of standing off the rail — both gone, with the gap moved to the positioned layer where `DropdownMenu` keeps it. The selected row now survives `forced-colors: active`: it marked the current page with a 6% background tint, which forced colors flatten away entirely, and it now paints `Highlight`/`HighlightText` like `ToggleButton` and `SegmentedControlItem`. And the footer icon row comes out one size, with the collapse chevron centred rather than seated 2.42px high on a stray text baseline.
|
|
35
|
+
|
|
36
|
+
Four changes are visible to a consumer. **Hover on a collapsed item's flyout** is now gated on `(hover: hover)` and only closes on `mouseleave` if hover opened it, and a click-to-dismiss no longer springs back open under a stationary pointer. **The footer icon rows cascade a `sm` size** through `SizeContext`, so an unsized `Button` passed to `footerIcons` now matches the built-in collapse button instead of rendering a size larger — pass an explicit `size` to opt out. **`SideNavCollapseButton` takes a `size`**, for placements outside the nav that have no row to inherit from. And **`SideNavCollapseButton` takes the controlled `collapsible` config** — the same `{isCollapsed, onCollapsedChange}` object handed to SideNav — which is how a button rendered outside the sidenav now stays in step with it. `handleRef` on both components is deprecated in its favour: the state the consumer already owns reaches the button through props, with no imperative handle in between.
|
|
37
|
+
|
|
38
|
+
- Slider: the thumb no longer overhangs the component's own box at `min` and `max`. It was centred on the container edge at either extreme, leaving half of it (10px) outside the control, where a tight container clipped it or it overlapped the next element. Thumb travel is now inset by half a thumb at each end — the geometry a native `input[type=range]` uses — and the fill, the marks and the pointer-to-value mapping share that inset, so the thumb also stays under the pointer that grabbed it instead of jumping by up to half its width. Vertical sliders and both thumbs of a range slider are fixed the same way (#5051).
|
|
39
|
+
- Interactive controls meet the WCAG 2.5.8 AA 24px minimum on touch. The Slider track (20px tall, and clickable along its whole length) floors its block size to 24px, Thumbnail's remove button grows its tappable area through a `::after` overlay, and `sm` CheckboxInput, RadioListItem and Switch floor to a 24px target centred on the control. All of it is gated on `@media (pointer: coarse)`, and only the invisible tappable area changes — rails, thumbs and glyphs stay exactly where they were, and fine-pointer rendering is untouched (#4963, #4964).
|
|
40
|
+
|
|
41
|
+
#### Documentation
|
|
42
|
+
|
|
43
|
+
- Ten private (`--_*`) component theming vars are now documented in their owning component's `theming.vars[]`: `--_avatar-group-overlap`, `--_card-elevation`, `--_card-ring`, `--_codeblock-gutter-width`, `--_item-label-color`, `--_item-description-color`, `--_tab-indicator-bottom`, `--_tree-indent` (plus `--_dropdown-menu-radius`/`--_dropdown-menu-padding`, which Breadcrumbs sets on a child menu). They were declared in source and described nowhere, because the drift guard skipped the `--_` prefix outright (#4783).
|
|
44
|
+
|
|
45
|
+
#### Contributors
|
|
46
|
+
|
|
47
|
+
Thanks to everyone who contributed to this release:
|
|
48
|
+
|
|
49
|
+
- @cixzhang
|
|
50
|
+
- @freddymeta
|
|
51
|
+
- @HelloOjasMutreja
|
|
52
|
+
- @imdreamrunner
|
|
53
|
+
- @jiunshinn
|
|
54
|
+
- @rubyycheung
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
3
58
|
# 0.4.1
|
|
4
59
|
|
|
5
60
|
#### New Features
|
package/dist/Avatar/Avatar.d.ts
CHANGED
|
@@ -62,6 +62,9 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
62
62
|
/**
|
|
63
63
|
* The size of the avatar. A named size (`xsm` 20px, `sm` 24px, `md` 36px,
|
|
64
64
|
* `lg` 48px, `xl` 128px) or a specific pixel value.
|
|
65
|
+
*
|
|
66
|
+
* Inside an `AvatarGroup` the group's `size` wins: a group sizes its members
|
|
67
|
+
* uniformly, so this prop is ignored there.
|
|
65
68
|
* @default 'md'
|
|
66
69
|
*/
|
|
67
70
|
size?: AvatarSize;
|
|
@@ -132,7 +135,7 @@ export interface AvatarProps extends BaseProps<HTMLDivElement> {
|
|
|
132
135
|
* ```
|
|
133
136
|
* <Avatar src="/user.jpg" name="John Doe" />
|
|
134
137
|
* <Avatar name="Jane Smith" size="xl" />
|
|
135
|
-
* <Avatar src="/user.jpg" status={<
|
|
138
|
+
* <Avatar src="/user.jpg" status={<AvatarStatusDot variant="success" label="Online" />} />
|
|
136
139
|
* <Avatar name="jsmith" tooltip="Jane Smith, Staff Engineer" />
|
|
137
140
|
* <Avatar name="Jane" tooltip={false} />
|
|
138
141
|
* <Avatar src="/user.jpg" name="John Doe" href="/users/john" />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avatar/Avatar.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAoC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AACxE,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"Avatar.d.ts","sourceRoot":"","sources":["../../src/Avat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OAAO,CAAC;IAC3B;;;;;;;OAOG;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;IACb;;;;OAIG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAChD;AA6ED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,EACrB,GAAG,EACH,aAAa,EAAE,MAAM,EACrB,WAAW,EACX,IAAI,EACJ,IAAW,EACX,GAAG,EACH,MAAM,EACN,OAAc,EACd,IAAI,EACJ,EAAE,EACF,MAAM,EACN,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,KAAK,EACT,EAAE,WAAW,+BA+Pb;yBAlRe,MAAM"}
|
package/dist/Avatar/Avatar.js
CHANGED
|
@@ -27,6 +27,7 @@ import { mergeProps, mergeRefs } from "../utils/index.js";
|
|
|
27
27
|
import { themeProps } from "../utils/themeProps.js";
|
|
28
28
|
import { focusOutlineProps } from "../utils/focusOutline.stylex.js";
|
|
29
29
|
import { useTooltip } from "../Tooltip/useTooltip.js";
|
|
30
|
+
import { useDevWarning } from "../hooks/useDevWarning.js";
|
|
30
31
|
import { useLinkComponent } from "../Link/useLinkComponent.js";
|
|
31
32
|
import { useTranslator } from "../i18n/index.js";
|
|
32
33
|
|
|
@@ -105,15 +106,6 @@ const styles = {
|
|
|
105
106
|
kaIpWk: "xjspbzw",
|
|
106
107
|
$$css: true
|
|
107
108
|
},
|
|
108
|
-
content: {
|
|
109
|
-
k1xSpc: "x78zum5",
|
|
110
|
-
kGNEyG: "x6s0dn4",
|
|
111
|
-
kjj79g: "xl56j7k",
|
|
112
|
-
kaIpWk: "xjspbzw",
|
|
113
|
-
kVQacm: "xb3r6kr",
|
|
114
|
-
kfSwDN: "x87ps6o",
|
|
115
|
-
$$css: true
|
|
116
|
-
},
|
|
117
109
|
fallback: {
|
|
118
110
|
k1xSpc: "x78zum5",
|
|
119
111
|
kGNEyG: "x6s0dn4",
|
|
@@ -287,7 +279,7 @@ function DefaultIcon({
|
|
|
287
279
|
* ```
|
|
288
280
|
* <Avatar src="/user.jpg" name="John Doe" />
|
|
289
281
|
* <Avatar name="Jane Smith" size="xl" />
|
|
290
|
-
* <Avatar src="/user.jpg" status={<
|
|
282
|
+
* <Avatar src="/user.jpg" status={<AvatarStatusDot variant="success" label="Online" />} />
|
|
291
283
|
* <Avatar name="jsmith" tooltip="Jane Smith, Staff Engineer" />
|
|
292
284
|
* <Avatar name="Jane" tooltip={false} />
|
|
293
285
|
* <Avatar src="/user.jpg" name="John Doe" href="/users/john" />
|
|
@@ -320,8 +312,13 @@ export function Avatar({
|
|
|
320
312
|
const [erroredFallbackSrc, setErroredFallbackSrc] = useState(undefined);
|
|
321
313
|
const showImage = src && erroredSrc !== src;
|
|
322
314
|
const showFallbackImage = !showImage && fallbackSrc && erroredFallbackSrc !== fallbackSrc;
|
|
323
|
-
|
|
324
|
-
|
|
315
|
+
// A whitespace-only string carries no identity. Without this it produces no
|
|
316
|
+
// initials (getInitials trims to nothing) and no default icon (a space is
|
|
317
|
+
// truthy), leaving an empty plate behind a blank accessible name.
|
|
318
|
+
const meaningfulName = name?.trim() ? name : undefined;
|
|
319
|
+
const meaningfulAlt = alt?.trim() ? alt : undefined;
|
|
320
|
+
const showInitials = !showImage && !showFallbackImage && meaningfulName;
|
|
321
|
+
const showIcon = !showImage && !showFallbackImage && !meaningfulName;
|
|
325
322
|
|
|
326
323
|
// A meaningful accessible name comes from `alt`/`name`, composed with the
|
|
327
324
|
// status element's `label` when one is present ("Jane Doe, Online") — the
|
|
@@ -332,7 +329,7 @@ export function Avatar({
|
|
|
332
329
|
// it as `presentation`/`aria-hidden` rather than announcing a meaningless
|
|
333
330
|
// generic "Avatar" (obs-9).
|
|
334
331
|
const t = useTranslator();
|
|
335
|
-
const nameLabel =
|
|
332
|
+
const nameLabel = meaningfulAlt || meaningfulName;
|
|
336
333
|
const statusLabel = getStatusLabel(status);
|
|
337
334
|
const accessibleName = nameLabel && statusLabel ? t('@astryx.avatar.nameWithStatus', {
|
|
338
335
|
name: nameLabel,
|
|
@@ -349,7 +346,7 @@ export function Avatar({
|
|
|
349
346
|
// - `true` / omitted → the `name` (a whitespace-only name yields nothing)
|
|
350
347
|
// Note: the *visible* tooltip prefers `name` (not `alt`); the *accessible
|
|
351
348
|
// name* on the root still uses `alt || name` above, independent of this.
|
|
352
|
-
const tooltipContent = tooltip === false ? undefined : typeof tooltip === 'string' ? tooltip :
|
|
349
|
+
const tooltipContent = tooltip === false ? undefined : typeof tooltip === 'string' ? tooltip : meaningfulName;
|
|
353
350
|
const trimmedTooltip = tooltipContent?.trim();
|
|
354
351
|
const showTooltip = trimmedTooltip != null && trimmedTooltip !== '';
|
|
355
352
|
// Whether the tooltip text is a consumer-authored override (a custom string)
|
|
@@ -385,17 +382,16 @@ export function Avatar({
|
|
|
385
382
|
const LinkComponent = useLinkComponent(as);
|
|
386
383
|
|
|
387
384
|
// An interactive control with no accessible name is an unacceptable control
|
|
388
|
-
// name.
|
|
389
|
-
//
|
|
390
|
-
|
|
391
|
-
if (isInteractive && !accessibleName) {
|
|
392
|
-
console.warn('Avatar: an interactive avatar (with `href` or `onClick`) needs a ' + 'meaningful accessible name. Pass `alt` or `name`.');
|
|
393
|
-
}
|
|
385
|
+
// name. `useDevWarning` is the shared guardrail: it warns once per mount
|
|
386
|
+
// rather than on every render, and compiles out of production builds.
|
|
387
|
+
useDevWarning('Avatar', 'an interactive avatar (with `href` or `onClick`) needs a meaningful ' + 'accessible name. Pass `alt` or `name`.', isInteractive && !accessibleName);
|
|
394
388
|
|
|
395
389
|
// The inner visuals are identical across the static and interactive variants.
|
|
396
390
|
const visualContent = /*#__PURE__*/_jsxs(_Fragment, {
|
|
397
391
|
children: [/*#__PURE__*/_jsxs("div", {
|
|
398
|
-
...
|
|
392
|
+
...{
|
|
393
|
+
className: "x78zum5 x6s0dn4 xl56j7k xh8yej3 x5yr21d xjspbzw xb3r6kr x87ps6o"
|
|
394
|
+
},
|
|
399
395
|
children: [showImage && /*#__PURE__*/_jsx("img", {
|
|
400
396
|
src: src,
|
|
401
397
|
alt: "",
|
|
@@ -414,7 +410,7 @@ export function Avatar({
|
|
|
414
410
|
...mergeProps(themeProps('avatar-fallback', {
|
|
415
411
|
size: resolvedSize
|
|
416
412
|
}), stylex.props(styles.fallback, dynamicStyles.fontSize(numericSize))),
|
|
417
|
-
children: getInitials(
|
|
413
|
+
children: getInitials(meaningfulName)
|
|
418
414
|
}), showIcon && /*#__PURE__*/_jsx("div", {
|
|
419
415
|
...mergeProps(themeProps('avatar-fallback', {
|
|
420
416
|
size: resolvedSize
|
|
@@ -437,7 +433,7 @@ export function Avatar({
|
|
|
437
433
|
// `<a>`/`<button>` and the static `<div>` carry the exact same box.
|
|
438
434
|
const rootStylexProps = mergeProps(themeProps('avatar', {
|
|
439
435
|
size: resolvedSize
|
|
440
|
-
}), focusOutlineProps.focusVisible(styles.wrapper, isInteractive && styles.interactive, avatarGroup && groupStyles.ring, avatarGroup && groupStyles.overlap, avatarGroup && groupDynamicStyles.overlap(-avatarGroup.overlap), xstyle), className, style);
|
|
436
|
+
}), focusOutlineProps.focusVisible(styles.wrapper, dynamicStyles.size(numericSize), isInteractive && styles.interactive, avatarGroup && groupStyles.ring, avatarGroup && groupStyles.overlap, avatarGroup && groupDynamicStyles.overlap(-avatarGroup.overlap), xstyle), className, style);
|
|
441
437
|
let rootElement;
|
|
442
438
|
|
|
443
439
|
// `props` is typed for the default `<div>` root (its event handlers are
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AvatarGroupOverflow.d.ts","sourceRoot":"","sources":["../../src/AvatarGroup/AvatarGroupOverflow.tsx"],"names":[],"mappings":"AAG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BAAmB,CAAC,EAClC,GAAG,EACH,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,IAAI,EACR,EAAE,wBAAwB,GAAG,SAAS,CA2DtC;yBApEe,mBAAmB"}
|
|
@@ -107,6 +107,7 @@ export function AvatarGroupOverflow({
|
|
|
107
107
|
}) {
|
|
108
108
|
const t = useTranslator();
|
|
109
109
|
const group = useAvatarGroup();
|
|
110
|
+
const size = group?.size ?? 'md';
|
|
110
111
|
const numericSize = group?.numericSize ?? 36;
|
|
111
112
|
const overlap = group?.overlap ?? 0;
|
|
112
113
|
const label = t('@astryx.avatarGroup.overflow', {
|
|
@@ -121,7 +122,9 @@ export function AvatarGroupOverflow({
|
|
|
121
122
|
...rest,
|
|
122
123
|
"aria-label": label,
|
|
123
124
|
"data-avatar-item": "",
|
|
124
|
-
...mergeProps(themeProps('avatar-group-overflow'
|
|
125
|
+
...mergeProps(themeProps('avatar-group-overflow', {
|
|
126
|
+
size
|
|
127
|
+
}), focusOutlineProps.focusVisible(styles.base, styles.button, styles.overlap, dynamicStyles.size(numericSize), dynamicStyles.fontSize(numericSize), dynamicStyles.overlap(-overlap), xstyle), className, style),
|
|
125
128
|
children: content
|
|
126
129
|
});
|
|
127
130
|
}
|
|
@@ -129,7 +132,9 @@ export function AvatarGroupOverflow({
|
|
|
129
132
|
ref: ref,
|
|
130
133
|
...rest,
|
|
131
134
|
"aria-label": label,
|
|
132
|
-
...mergeProps(themeProps('avatar-group-overflow'
|
|
135
|
+
...mergeProps(themeProps('avatar-group-overflow', {
|
|
136
|
+
size
|
|
137
|
+
}), stylex.props(styles.base, styles.overlap, dynamicStyles.size(numericSize), dynamicStyles.fontSize(numericSize), dynamicStyles.overlap(-overlap), xstyle), className, style),
|
|
133
138
|
children: content
|
|
134
139
|
});
|
|
135
140
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/Button/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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,CA6OzB;yBAtQe,MAAM"}
|
package/dist/Button/Button.js
CHANGED
|
@@ -253,8 +253,10 @@ const loadingStyles = {
|
|
|
253
253
|
*
|
|
254
254
|
* Layers always carry the native `popover` attribute (useLayer.tsx), and a
|
|
255
255
|
* popover is never an in-flow member — it is `display: none` until shown, then
|
|
256
|
-
* promoted to the top layer.
|
|
257
|
-
*
|
|
256
|
+
* promoted to the top layer. Context layers also retain an inert `<template>`
|
|
257
|
+
* marker so they can re-resolve their JSX position. Neither element is a group
|
|
258
|
+
* member, so "last member" is: no following element sibling besides those two
|
|
259
|
+
* pieces of layer infrastructure.
|
|
258
260
|
*
|
|
259
261
|
* Reading it the other way round — marking the *buttons* and testing for a
|
|
260
262
|
* marked sibling — is the trap: it silently reclassifies anything it doesn't
|
|
@@ -270,13 +272,13 @@ const loadingStyles = {
|
|
|
270
272
|
* The leading edge still uses `:first-child` — a member's button always precedes
|
|
271
273
|
* its own layer, so the first button is genuinely `:first-child`.
|
|
272
274
|
*/
|
|
273
|
-
const IS_LAST_ITEM = ':not(:has(~ *:not([popover])))';
|
|
275
|
+
const IS_LAST_ITEM = ':not(:has(~ *:not([popover]):not(template)))';
|
|
274
276
|
const groupStyles = {
|
|
275
277
|
horizontal: {
|
|
276
278
|
krdFHd: "x15mokao x8eehn2",
|
|
277
279
|
kVL7Gh: "xbiv7yw x1xrp5p4",
|
|
278
|
-
kfmiAY: "x1ga7v0g
|
|
279
|
-
kT0f0o: "x16uus16
|
|
280
|
+
kfmiAY: "x1ga7v0g x1tzxhge",
|
|
281
|
+
kT0f0o: "x16uus16 x1rmb4wm",
|
|
280
282
|
k2ei4v: "xgbv0en x1pjv70x",
|
|
281
283
|
kVhnKS: "x1t7ytsu xyf0ibl",
|
|
282
284
|
kGJrpR: "x1j92z86",
|
|
@@ -285,8 +287,8 @@ const groupStyles = {
|
|
|
285
287
|
vertical: {
|
|
286
288
|
krdFHd: "x15mokao x8eehn2",
|
|
287
289
|
kfmiAY: "x1ga7v0g x2qxyot",
|
|
288
|
-
kVL7Gh: "xbiv7yw
|
|
289
|
-
kT0f0o: "x16uus16
|
|
290
|
+
kVL7Gh: "xbiv7yw xturttb",
|
|
291
|
+
kT0f0o: "x16uus16 x1rmb4wm",
|
|
290
292
|
kEafiO: "x11xkdxz x1g31smg",
|
|
291
293
|
kPef9Z: "x13fuv20 x1d9v4yf",
|
|
292
294
|
kLZC3w: "x1pc3f07",
|
|
@@ -20,6 +20,13 @@ import type { BaseProps } from '../BaseProps';
|
|
|
20
20
|
export interface ChatMessageProps extends BaseProps<HTMLElement> {
|
|
21
21
|
ref?: React.Ref<HTMLElement>;
|
|
22
22
|
sender: ChatMessageSender;
|
|
23
|
+
/**
|
|
24
|
+
* Message body — bubbles, tool calls, images, or any free-form content.
|
|
25
|
+
* Custom (non-bubble) children render flush with the message edge; wrap
|
|
26
|
+
* them in a ghost bubble (`<ChatMessageBubble variant="ghost">`) to align
|
|
27
|
+
* them with the bubble's text column, and add `width="100%"` when they
|
|
28
|
+
* should span the full message column.
|
|
29
|
+
*/
|
|
23
30
|
children: ReactNode;
|
|
24
31
|
avatar?: ReactNode;
|
|
25
32
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAQrD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAoFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BA2FlB;yBAxGe,WAAW"}
|
|
1
|
+
{"version":3,"file":"ChatMessage.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessage.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAC,KAAK,SAAS,EAAiB,MAAM,OAAO,CAAC;AAQrD,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,WAAW,EACjB,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAI5C,MAAM,WAAW,gBAAiB,SAAQ,SAAS,CAAC,WAAW,CAAC;IAC9D,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;IAC7B,MAAM,EAAE,iBAAiB,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,SAAS,CAAC;IACnB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB;AAoFD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,WAAW,CAAC,EAC1B,MAAM,EACN,QAAQ,EACR,MAAM,EACN,IAAI,EACJ,QAAQ,EACR,OAAO,EAAE,WAAW,EACpB,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,gBAAgB,+BA2FlB;yBAxGe,WAAW"}
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
* - If you use bubbles on one side (e.g. assistant), use them consistently
|
|
12
12
|
* for all messages on that side. Use `ghost` variant for content that
|
|
13
13
|
* needs alignment without a visual boundary.
|
|
14
|
+
* - For custom content (cards, attachments, citations) that should span
|
|
15
|
+
* the full message column instead of the default width cap, combine
|
|
16
|
+
* `ghost` with `width="100%"` (#2574).
|
|
14
17
|
* - Put `name` on the first bubble in a message, `metadata` on the last.
|
|
15
18
|
* - For unbubbled messages, use ChatMessage's `name` and `metadata`
|
|
16
19
|
* props instead.
|
|
@@ -21,6 +24,7 @@
|
|
|
21
24
|
* - /packages/cli/assets/templates/blocks/components/ChatMessageBubble/ (block examples)
|
|
22
25
|
*/
|
|
23
26
|
import type { ReactNode } from 'react';
|
|
27
|
+
import type { SizeValue } from '../utils/types';
|
|
24
28
|
import type { BaseProps } from '../BaseProps';
|
|
25
29
|
export type ChatMessageBubbleVariant = 'filled' | 'ghost';
|
|
26
30
|
export interface ChatMessageBubbleProps extends BaseProps<HTMLDivElement> {
|
|
@@ -60,6 +64,14 @@ export interface ChatMessageBubbleProps extends BaseProps<HTMLDivElement> {
|
|
|
60
64
|
* Leave unset for standalone bubbles (full radius).
|
|
61
65
|
*/
|
|
62
66
|
group?: 'first' | 'middle' | 'last';
|
|
67
|
+
/**
|
|
68
|
+
* Width of the bubble.
|
|
69
|
+
* Numbers are treated as pixels, strings are used as-is (e.g. "100%").
|
|
70
|
+
* When set, replaces the default `max(80%, 280px)` width cap; leave unset
|
|
71
|
+
* to keep the cap. Combine with `variant="ghost"` to let custom content
|
|
72
|
+
* (an artifact card, attachments) span the full message column.
|
|
73
|
+
*/
|
|
74
|
+
width?: SizeValue;
|
|
63
75
|
}
|
|
64
76
|
/**
|
|
65
77
|
* Styled content container — the chat "bubble."
|
|
@@ -78,7 +90,7 @@ export interface ChatMessageBubbleProps extends BaseProps<HTMLDivElement> {
|
|
|
78
90
|
* </ChatMessage>
|
|
79
91
|
* ```
|
|
80
92
|
*/
|
|
81
|
-
export declare function ChatMessageBubble({ children, variant, name, metadata, group, xstyle, className, style: styleProp, 'data-testid': testId, ref, ...rest }: ChatMessageBubbleProps): import("react").JSX.Element;
|
|
93
|
+
export declare function ChatMessageBubble({ children, variant, name, metadata, group, width, xstyle, className, style: styleProp, 'data-testid': testId, ref, ...rest }: ChatMessageBubbleProps): import("react").JSX.Element;
|
|
82
94
|
export declare namespace ChatMessageBubble {
|
|
83
95
|
var displayName: string;
|
|
84
96
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatMessageBubble.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageBubble.tsx"],"names":[],"mappings":"AAIA
|
|
1
|
+
{"version":3,"file":"ChatMessageBubble.d.ts","sourceRoot":"","sources":["../../src/Chat/ChatMessageBubble.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAWrC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAG5C,MAAM,MAAM,wBAAwB,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,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;;;;;OAKG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAEpC;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAwHD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,QAAQ,EACR,OAAkB,EAClB,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EAAE,SAAS,EAChB,aAAa,EAAE,MAAM,EACrB,GAAG,EACH,GAAG,IAAI,EACR,EAAE,sBAAsB,+BA0FxB;yBAvGe,iBAAiB"}
|
|
@@ -15,6 +15,9 @@
|
|
|
15
15
|
* - If you use bubbles on one side (e.g. assistant), use them consistently
|
|
16
16
|
* for all messages on that side. Use `ghost` variant for content that
|
|
17
17
|
* needs alignment without a visual boundary.
|
|
18
|
+
* - For custom content (cards, attachments, citations) that should span
|
|
19
|
+
* the full message column instead of the default width cap, combine
|
|
20
|
+
* `ghost` with `width="100%"` (#2574).
|
|
18
21
|
* - Put `name` on the first bubble in a message, `metadata` on the last.
|
|
19
22
|
* - For unbubbled messages, use ChatMessage's `name` and `metadata`
|
|
20
23
|
* props instead.
|
|
@@ -144,6 +147,20 @@ const styles = {
|
|
|
144
147
|
}
|
|
145
148
|
};
|
|
146
149
|
|
|
150
|
+
// Dynamic styles for sizing props
|
|
151
|
+
const _temp = {
|
|
152
|
+
ks0D6T: "x1x1rfll",
|
|
153
|
+
"$$css": true
|
|
154
|
+
};
|
|
155
|
+
const dynamicStyles = {
|
|
156
|
+
sizing: width => [_temp, {
|
|
157
|
+
kzqmXN: width != null ? "x5lhr3w" : width,
|
|
158
|
+
$$css: true
|
|
159
|
+
}, {
|
|
160
|
+
"--x-width": (val => typeof val === "number" ? val + "px" : val != null ? val : undefined)(width)
|
|
161
|
+
}]
|
|
162
|
+
};
|
|
163
|
+
|
|
147
164
|
// =============================================================================
|
|
148
165
|
// Component
|
|
149
166
|
// =============================================================================
|
|
@@ -171,6 +188,7 @@ export function ChatMessageBubble({
|
|
|
171
188
|
name,
|
|
172
189
|
metadata,
|
|
173
190
|
group,
|
|
191
|
+
width,
|
|
174
192
|
xstyle,
|
|
175
193
|
className,
|
|
176
194
|
style: styleProp,
|
|
@@ -199,7 +217,7 @@ export function ChatMessageBubble({
|
|
|
199
217
|
sender,
|
|
200
218
|
variant,
|
|
201
219
|
density
|
|
202
|
-
}), stylex.props(styles.content, density === 'compact' && styles.radiusCompact, senderStyle, paddingStyle, variant === 'ghost' && styles.paddingBlockNone, groupStyle, xstyle), className, styleProp),
|
|
220
|
+
}), stylex.props(styles.content, density === 'compact' && styles.radiusCompact, senderStyle, paddingStyle, variant === 'ghost' && styles.paddingBlockNone, groupStyle, width != null && dynamicStyles.sizing(width), xstyle), className, styleProp),
|
|
203
221
|
children: children
|
|
204
222
|
}), metadata && /*#__PURE__*/_jsx("div", {
|
|
205
223
|
...stylex.props(metadataPaddingStyle, styles.metadataReducedGap, isUser && styles.alignEnd),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG9C,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"CheckboxInput.d.ts","sourceRoot":"","sources":["../../src/CheckboxInput/CheckboxInput.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAOL,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,MAAM,MAAM,kBAAkB,CAAC;AAS3C,OAAO,KAAK,EAAC,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AAC,EAAE,OAAO,CAAC;IACrB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACpD;;OAEG;IACH,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACnD;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACjC;;;OAGG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAOD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,KAAK,EACL,UAAkB,EAClB,QAAQ,EACR,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,IAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,MAAM,EACN,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAmMpB;yBA5Ne,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteFooter.d.ts","sourceRoot":"","sources":["../../src/CommandPalette/CommandPaletteFooter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandPaletteFooter.d.ts","sourceRoot":"","sources":["../../src/CommandPalette/CommandPaletteFooter.tsx"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAiC5C,MAAM,WAAW,yBAA0B,SAAQ,SAAS,CAAC,cAAc,CAAC;IAC1E,2CAA2C;IAC3C,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IAEhC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,GAAG,EACH,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,KAAK,EACT,EAAE,yBAAyB,+BAgC3B;yBAvCe,oBAAoB"}
|
|
@@ -18,6 +18,7 @@ import "../theme/tokens.stylex.js";
|
|
|
18
18
|
import { colorVars, spacingVars, typeScaleVars, typographyVars } from "../theme/tokens.stylex.js";
|
|
19
19
|
import { Kbd } from "../Kbd/index.js";
|
|
20
20
|
import { themeProps } from "../utils/themeProps.js";
|
|
21
|
+
import { useTranslator } from "../i18n/index.js";
|
|
21
22
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
23
|
const styles = {
|
|
23
24
|
footer: {
|
|
@@ -61,6 +62,7 @@ export function CommandPaletteFooter({
|
|
|
61
62
|
style,
|
|
62
63
|
...props
|
|
63
64
|
}) {
|
|
65
|
+
const t = useTranslator();
|
|
64
66
|
return /*#__PURE__*/_jsx("div", {
|
|
65
67
|
ref: ref,
|
|
66
68
|
...mergeProps(themeProps('command-palette-footer'), stylex.props(styles.footer, xstyle), className, style),
|
|
@@ -74,21 +76,21 @@ export function CommandPaletteFooter({
|
|
|
74
76
|
keys: "up"
|
|
75
77
|
}), /*#__PURE__*/_jsx(Kbd, {
|
|
76
78
|
keys: "down"
|
|
77
|
-
}),
|
|
79
|
+
}), t('@astryx.commandPalette.footer.navigate')]
|
|
78
80
|
}), /*#__PURE__*/_jsxs("span", {
|
|
79
81
|
...{
|
|
80
82
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
81
83
|
},
|
|
82
84
|
children: [/*#__PURE__*/_jsx(Kbd, {
|
|
83
85
|
keys: "enter"
|
|
84
|
-
}),
|
|
86
|
+
}), t('@astryx.commandPalette.footer.select')]
|
|
85
87
|
}), /*#__PURE__*/_jsxs("span", {
|
|
86
88
|
...{
|
|
87
89
|
className: "x78zum5 x6s0dn4 xzye2dw"
|
|
88
90
|
},
|
|
89
91
|
children: [/*#__PURE__*/_jsx(Kbd, {
|
|
90
92
|
keys: "escape"
|
|
91
|
-
}),
|
|
93
|
+
}), t('@astryx.commandPalette.footer.close')]
|
|
92
94
|
})]
|
|
93
95
|
})
|
|
94
96
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AA0BrB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAO9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,4EAA4E;AAC5E,MAAM,MAAM,0BAA0B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9D,YAAY,EACV,WAAW,IAAI,mBA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AAC,EAAE,0BAA0B,CAAC;IAE3C;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,IAAI,CAAC,EAAE,iBAAiB,CAAC;IAEzB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;IAEvB;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,GAAG,aAAa,CAAC;CAC1C;AAqCD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAC5B,KAAK,EACL,aAAqB,EACrB,WAAW,EACX,UAAkB,EAClB,UAAkB,EAClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,aAAiB,EACjB,QAAgB,EAChB,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,wBAAwB,EACzC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,cAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"AAsCA,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OA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ClB,UAAkB,EAClB,eAAe,EACf,KAAK,EACL,QAAQ,EACR,YAAY,EACZ,SAAiB,EACjB,GAAG,EACH,GAAG,EACH,eAAe,EACf,UAAkB,EAClB,UAAkB,EAClB,aAAiB,EACjB,QAAgB,EAChB,WAAW,EAAE,oBAAoB,EACjC,eAAe,EAAE,wBAAwB,EACzC,SAAS,EACT,IAAI,EAAE,QAAQ,EACd,MAAM,EACN,YAAY,EACZ,cAAkB,EAClB,YAAY,EACZ,KAAK,EACL,MAAM,EACN,SAAS,EACT,KAAK,EACL,GAAG,EACH,GAAG,IAAI,EACR,EAAE,kBAAkB,+BAgpBpB;yBAjrBe,aAAa"}
|
|
@@ -287,10 +287,10 @@ export function DateTimeInput({
|
|
|
287
287
|
}, [timePendingInput, hasSeconds, timeMin, timeMax]);
|
|
288
288
|
const resolvedTimePlaceholder = useMemo(() => {
|
|
289
289
|
if (isTimeFocused && !timeDisplayValue) {
|
|
290
|
-
return hourFormat === '12h' ? '
|
|
290
|
+
return hourFormat === '12h' ? t('@astryx.dateTimeInput.timeHint12h') : t('@astryx.dateTimeInput.timeHint24h');
|
|
291
291
|
}
|
|
292
292
|
return timePlaceholder;
|
|
293
|
-
}, [isTimeFocused, timeDisplayValue, hourFormat, timePlaceholder]);
|
|
293
|
+
}, [isTimeFocused, timeDisplayValue, hourFormat, timePlaceholder, t]);
|
|
294
294
|
|
|
295
295
|
// --- Unified change handler ---
|
|
296
296
|
const fireChange = useCallback(newValue => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenuSubMenu.d.ts","sourceRoot":"","sources":["../../src/DropdownMenu/DropdownMenuSubMenu.tsx"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAEH,OAAc,EAOZ,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAEf,OAAO,EAAuB,KAAK,QAAQ,EAAC,MAAM,SAAS,CAAC;AAoB5D,OAAO,KAAK,EAA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AAW,GAAG,OAAO,CACjC;IACC,2DAA2D;IAC3D,IAAI,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IAC5B,8CAA8C;IAC9C,KAAK,EAAE,SAAS,CAAC;IACjB,4DAA4D;IAC5D,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB;;;;OAIG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,8CAA8C;IAC9C,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,mCAAmC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mCAAmC;IACnC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,wBAAyB,SAAQ,4BAA4B;IAC5E;;;;;;;;OAQG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,wBAAwB,GAC9B,SAAS,CAwVX;yBA1Ve,mBAAmB"}
|
|
@@ -198,9 +198,13 @@ export function DropdownMenuSubMenu(props) {
|
|
|
198
198
|
|
|
199
199
|
// Hover-intent: entering the trigger opens after a short delay; leaving
|
|
200
200
|
// either surface closes after a delay. Hover-open does not steal focus.
|
|
201
|
+
// Hover intent and the shared hover→click guard only: this level owns its own
|
|
202
|
+
// click handling, roving focus and typeahead. popover="manual", so the
|
|
203
|
+
// invoker wiring other consumers need does not apply.
|
|
201
204
|
const {
|
|
202
205
|
triggerProps,
|
|
203
|
-
contentProps
|
|
206
|
+
contentProps,
|
|
207
|
+
confirmHoverOpen
|
|
204
208
|
} = useMenuHover({
|
|
205
209
|
show: showLayer,
|
|
206
210
|
hide: hideLayer,
|
|
@@ -213,18 +217,12 @@ export function DropdownMenuSubMenu(props) {
|
|
|
213
217
|
}
|
|
214
218
|
layer.show();
|
|
215
219
|
if (options?.focusFirst) {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
// arrow keys rove the parent while the empty flyout stays open.
|
|
223
|
-
const focusedItem = focusFirst();
|
|
224
|
-
if (!focusedItem) {
|
|
225
|
-
menuRef.current?.focus();
|
|
226
|
-
}
|
|
227
|
-
});
|
|
220
|
+
// Synchronous by design — see the focus note in useMenuHover. A
|
|
221
|
+
// still-loading flyout has no focusable item, so fall back to the
|
|
222
|
+
// container: keyboard ownership must leave the parent list either way.
|
|
223
|
+
if (!focusFirst()) {
|
|
224
|
+
menuRef.current?.focus();
|
|
225
|
+
}
|
|
228
226
|
}
|
|
229
227
|
}, [canOpen, layer, focusFirst, menuRef]);
|
|
230
228
|
const close = useCallback(options => {
|
|
@@ -244,8 +242,14 @@ export function DropdownMenuSubMenu(props) {
|
|
|
244
242
|
if (isDisabled) {
|
|
245
243
|
return;
|
|
246
244
|
}
|
|
247
|
-
//
|
|
245
|
+
// Toggles, except for the click that follows a hover-open (#3121).
|
|
248
246
|
if (isOpen) {
|
|
247
|
+
if (confirmHoverOpen()) {
|
|
248
|
+
if (!focusFirst()) {
|
|
249
|
+
menuRef.current?.focus();
|
|
250
|
+
}
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
249
253
|
close({
|
|
250
254
|
focusTrigger: true
|
|
251
255
|
});
|
|
@@ -254,7 +258,7 @@ export function DropdownMenuSubMenu(props) {
|
|
|
254
258
|
focusFirst: true
|
|
255
259
|
});
|
|
256
260
|
}
|
|
257
|
-
}, [isDisabled, isOpen, open, close]);
|
|
261
|
+
}, [isDisabled, isOpen, open, close, confirmHoverOpen, focusFirst, menuRef]);
|
|
258
262
|
const handleTriggerKeyDown = useCallback(e => {
|
|
259
263
|
if (isDisabled) {
|
|
260
264
|
return;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @file HoverCard.tsx
|
|
3
3
|
* @input Uses React, useHoverCard hook
|
|
4
4
|
* @output Exports HoverCard component for hover/focus triggered layers
|
|
5
|
-
* @position Layer component;
|
|
5
|
+
* @position Layer component; inline-safe trigger wrapper, floating layer hosted by useLayer
|
|
6
6
|
*
|
|
7
7
|
* SYNC: When modified, update these files to stay in sync:
|
|
8
8
|
* - /packages/core/src/HoverCard/HoverCard.test.tsx
|