@hjmds/react 1.18.0 → 1.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +41 -9
- package/dist/advanced-display.js.map +1 -1
- package/dist/advanced-forms.d.ts.map +1 -1
- package/dist/advanced-forms.js +22 -9
- package/dist/advanced-forms.js.map +1 -1
- package/dist/agreement.d.ts.map +1 -1
- package/dist/agreement.js +17 -11
- package/dist/agreement.js.map +1 -1
- package/dist/auth-screen.d.ts.map +1 -1
- package/dist/auth-screen.js +15 -2
- package/dist/auth-screen.js.map +1 -1
- package/dist/avatar-blobatar-motion.d.ts.map +1 -1
- package/dist/avatar-blobatar-motion.js +10 -2
- package/dist/avatar-blobatar-motion.js.map +1 -1
- package/dist/bottom-navigation.d.ts.map +1 -1
- package/dist/bottom-navigation.js +1 -1
- package/dist/bottom-navigation.js.map +1 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +10 -2
- package/dist/calendar.js.map +1 -1
- package/dist/carousel-motion.d.ts +1 -0
- package/dist/carousel-motion.d.ts.map +1 -1
- package/dist/carousel-motion.js +4 -3
- package/dist/carousel-motion.js.map +1 -1
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +22 -4
- package/dist/carousel.js.map +1 -1
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +28 -4
- package/dist/collapsible.js.map +1 -1
- package/dist/collection-rail.d.ts.map +1 -1
- package/dist/collection-rail.js +19 -1
- package/dist/collection-rail.js.map +1 -1
- package/dist/color-picker.d.ts.map +1 -1
- package/dist/color-picker.js +12 -4
- package/dist/color-picker.js.map +1 -1
- package/dist/command-palette.d.ts.map +1 -1
- package/dist/command-palette.js +14 -2
- package/dist/command-palette.js.map +1 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +31 -10
- package/dist/context-menu.js.map +1 -1
- package/dist/date-entry.d.ts +1 -1
- package/dist/date-entry.d.ts.map +1 -1
- package/dist/date-entry.js +20 -7
- package/dist/date-entry.js.map +1 -1
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +22 -6
- package/dist/date-picker.js.map +1 -1
- package/dist/display.d.ts +5 -1
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js +3 -2
- package/dist/display.js.map +1 -1
- package/dist/duration-field.d.ts +2 -2
- package/dist/duration-field.d.ts.map +1 -1
- package/dist/duration-field.js +11 -3
- package/dist/duration-field.js.map +1 -1
- package/dist/evidence.d.ts +1 -1
- package/dist/evidence.js +1 -1
- package/dist/evidence.js.map +1 -1
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +3 -2
- package/dist/feedback.js.map +1 -1
- package/dist/field-group.d.ts +4 -2
- package/dist/field-group.d.ts.map +1 -1
- package/dist/field-group.js +4 -3
- package/dist/field-group.js.map +1 -1
- package/dist/file-picker.d.ts.map +1 -1
- package/dist/file-picker.js +15 -5
- package/dist/file-picker.js.map +1 -1
- package/dist/forms.d.ts +2 -2
- package/dist/forms.js +1 -1
- package/dist/forms.js.map +1 -1
- package/dist/gravity-letters.d.ts.map +1 -1
- package/dist/gravity-letters.js +9 -1
- package/dist/gravity-letters.js.map +1 -1
- package/dist/grid-reveal.d.ts.map +1 -1
- package/dist/grid-reveal.js +9 -1
- package/dist/grid-reveal.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/inline-confirm.d.ts.map +1 -1
- package/dist/inline-confirm.js +25 -4
- package/dist/inline-confirm.js.map +1 -1
- package/dist/internal/document-resource.d.ts.map +1 -1
- package/dist/internal/document-resource.js +2 -2
- package/dist/internal/document-resource.js.map +1 -1
- package/dist/masonry.d.ts.map +1 -1
- package/dist/masonry.js +2 -1
- package/dist/masonry.js.map +1 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +12 -4
- package/dist/mentions.js.map +1 -1
- package/dist/menu-morph.js +1 -1
- package/dist/menu-morph.js.map +1 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +43 -19
- package/dist/menubar.js.map +1 -1
- package/dist/modal.d.ts.map +1 -1
- package/dist/modal.js +15 -4
- package/dist/modal.js.map +1 -1
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +8 -2
- package/dist/navigation.js.map +1 -1
- package/dist/number-field.d.ts.map +1 -1
- package/dist/number-field.js +3 -1
- package/dist/number-field.js.map +1 -1
- package/dist/overlay-stack.d.ts.map +1 -1
- package/dist/overlay-stack.js +23 -6
- package/dist/overlay-stack.js.map +1 -1
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +8 -0
- package/dist/overlays.js.map +1 -1
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +16 -4
- package/dist/pagination.js.map +1 -1
- package/dist/saved-items.d.ts.map +1 -1
- package/dist/saved-items.js +6 -1
- package/dist/saved-items.js.map +1 -1
- package/dist/screen-flows.d.ts +1 -2
- package/dist/screen-flows.d.ts.map +1 -1
- package/dist/screen-flows.js +120 -16
- package/dist/screen-flows.js.map +1 -1
- package/dist/screens.d.ts.map +1 -1
- package/dist/screens.js +32 -7
- package/dist/screens.js.map +1 -1
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +6 -1
- package/dist/select.js.map +1 -1
- package/dist/side-panel.d.ts.map +1 -1
- package/dist/side-panel.js +11 -2
- package/dist/side-panel.js.map +1 -1
- package/dist/sidebar.d.ts.map +1 -1
- package/dist/sidebar.js +8 -1
- package/dist/sidebar.js.map +1 -1
- package/dist/skip-nav.d.ts.map +1 -1
- package/dist/skip-nav.js +16 -3
- package/dist/skip-nav.js.map +1 -1
- package/dist/sortable.d.ts.map +1 -1
- package/dist/sortable.js +2 -1
- package/dist/sortable.js.map +1 -1
- package/dist/splitter.d.ts.map +1 -1
- package/dist/splitter.js +23 -11
- package/dist/splitter.js.map +1 -1
- package/dist/statistic-motion.d.ts.map +1 -1
- package/dist/statistic-motion.js +30 -2
- package/dist/statistic-motion.js.map +1 -1
- package/dist/status-text.d.ts +11 -0
- package/dist/status-text.d.ts.map +1 -0
- package/dist/status-text.js +7 -0
- package/dist/status-text.js.map +1 -0
- package/dist/styles.css +19 -4
- package/dist/styles.layered.css +19 -4
- package/dist/supplemental-display.d.ts.map +1 -1
- package/dist/supplemental-display.js +19 -8
- package/dist/supplemental-display.js.map +1 -1
- package/dist/supplemental-navigation.d.ts.map +1 -1
- package/dist/supplemental-navigation.js +10 -1
- package/dist/supplemental-navigation.js.map +1 -1
- package/dist/tags-input.d.ts.map +1 -1
- package/dist/tags-input.js +18 -8
- package/dist/tags-input.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +1 -0
- package/dist/theme.js.map +1 -1
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +31 -16
- package/dist/toast.js.map +1 -1
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +6 -1
- package/dist/toggle-group.js.map +1 -1
- package/dist/tour.d.ts.map +1 -1
- package/dist/tour.js +15 -2
- package/dist/tour.js.map +1 -1
- package/dist/transfer-list.d.ts +1 -1
- package/dist/transfer-list.d.ts.map +1 -1
- package/dist/transfer-list.js +52 -7
- package/dist/transfer-list.js.map +1 -1
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +41 -8
- package/dist/tree.js.map +1 -1
- package/dist/virtual-list.d.ts.map +1 -1
- package/dist/virtual-list.js +44 -7
- package/dist/virtual-list.js.map +1 -1
- package/package.json +8 -3
package/dist/grid-reveal.js
CHANGED
|
@@ -9,8 +9,16 @@ export function GridReveal({ ready, active = true, children, layoutStyle }) {
|
|
|
9
9
|
useLayoutEffect(() => {
|
|
10
10
|
if (!ready || !active || environment.reducedMotion || document.hidden)
|
|
11
11
|
return;
|
|
12
|
-
const animations = [
|
|
12
|
+
const animations = [];
|
|
13
13
|
const stop = () => animations.forEach(animation => animation.cancel());
|
|
14
|
+
// Failed decoration must reveal content, including after partial startup.
|
|
15
|
+
try {
|
|
16
|
+
[...overlay.current.children].forEach((node, index) => animations.push(node.animate([{ opacity: 1 }, { opacity: 0 }], { duration: gridRevealDuration, delay: gridRevealTiles[index].delay, fill: "backwards", easing: "ease-out" })));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
stop();
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
14
22
|
const visibility = () => { if (document.hidden)
|
|
15
23
|
stop(); };
|
|
16
24
|
document.addEventListener("visibilitychange", visibility);
|
package/dist/grid-reveal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-reveal.js","sourceRoot":"","sources":["../src/grid-reveal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AAC1F,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,gGAAgG;AAChG,MAAM,UAAU,UAAU,CAAC,EAAC,KAAK,EAAC,MAAM,GAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAiB;IAClF,MAAK,EAAC,WAAW,EAAC,GAAC,WAAW,EAAE,CAAC;IAAA,MAAM,OAAO,GAAC,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC5E,eAAe,CAAC,GAAE,EAAE;QACnB,IAAG,CAAC,KAAK,IAAE,CAAC,MAAM,IAAE,WAAW,CAAC,aAAa,IAAE,QAAQ,CAAC,MAAM;YAAC,OAAO;QACtE,MAAM,UAAU,GAAC,CAAC,GAAG,OAAO,CAAC,OAAQ,CAAC,QAAQ,CAAC,CAAC,
|
|
1
|
+
{"version":3,"file":"grid-reveal.js","sourceRoot":"","sources":["../src/grid-reveal.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,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AQ,CAAC,MAAM;YAAC,IAAI,EAAE,CAAC,CAAA,CAAC,CAAC;QAAA,QAAQ,CAAC,gBAAgB,CAAC,kBAAkB,EAAC,UAAU,CAAC,CAAC;QAC3G,OAAM,GAAE,EAAE,GAAC,IAAI,EAAE,CAAC,CAAA,QAAQ,CAAC,mBAAmB,CAAC,kBAAkB,EAAC,UAAU,CAAC,CAAC,CAAA,CAAC,CAAC;IACjF,CAAC,EAAC,CAAC,KAAK,EAAC,MAAM,EAAC,WAAW,CAAC,aAAa,CAAC,CAAC,CAAC;IAC5C,OAAO,eAAK,KAAK,EAAE,EAAC,GAAG,WAAW,EAAC,QAAQ,EAAC,UAAU,EAAC,aAAG,QAAQ,EAAC,cAAK,GAAG,EAAE,OAAO,iBAAc,MAAM,EAAC,KAAK,EAAE,EAAC,QAAQ,EAAC,UAAU,EAAC,KAAK,EAAC,CAAC,EAAC,aAAa,EAAC,MAAM,EAAC,OAAO,EAAC,MAAM,EAAC,mBAAmB,EAAC,gBAAgB,EAAC,gBAAgB,EAAC,gBAAgB,EAAC,YAAG,eAAe,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAA,eAAoB,KAAK,EAAE,EAAC,OAAO,EAAC,CAAC,EAAC,UAAU,EAAC,qBAAqB,EAAC,IAA5D,IAAI,CAAC,EAAE,CAAwD,CAAC,GAAO,IAAM,CAAC;AAC/W,CAAC","sourcesContent":["import { useLayoutEffect, useRef, type ReactNode } from \"react\";\nimport { gridRevealTiles, gridRevealDuration } from \"@hjmds/design-contracts/grid-reveal\";\nimport { useHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type GridRevealProps=Readonly<{ready:boolean;active?:boolean;children:ReactNode; /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */ layoutStyle?: HjmCompositionStyleProp;}>;\n/** Connect ready to Image.onLoadStatusChange; the image retains loading/error/accessibility. */\nexport function GridReveal({ready,active=true,children,layoutStyle}:GridRevealProps){\n const{environment}=useHjmTheme();const overlay=useRef<HTMLDivElement>(null);\n useLayoutEffect(()=>{\n if(!ready||!active||environment.reducedMotion||document.hidden)return;\n const animations:Animation[]=[];\n const stop=()=>animations.forEach(animation=>animation.cancel());\n // Failed decoration must reveal content, including after partial startup.\n try{[...overlay.current!.children].forEach((node,index)=>animations.push(node.animate([{opacity:1},{opacity:0}],{duration:gridRevealDuration,delay:gridRevealTiles[index]!.delay,fill:\"backwards\",easing:\"ease-out\"})));}\n catch{stop();return;}\n const visibility=()=>{if(document.hidden)stop();};document.addEventListener(\"visibilitychange\",visibility);\n return()=>{stop();document.removeEventListener(\"visibilitychange\",visibility);};\n },[ready,active,environment.reducedMotion]);\n return <div style={{...layoutStyle,position:\"relative\"}}>{children}<div ref={overlay} aria-hidden=\"true\" style={{position:\"absolute\",inset:0,pointerEvents:\"none\",display:\"grid\",gridTemplateColumns:\"repeat(4, 1fr)\",gridTemplateRows:\"repeat(4, 1fr)\"}}>{gridRevealTiles.map(tile=><span key={tile.id} style={{opacity:0,background:\"var(--hjm-color-bg)\"}}/>)}</div></div>;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
|
@@ -56,4 +56,5 @@ export { Collapsible, type CollapsibleProps } from "./collapsible.js";
|
|
|
56
56
|
export { ContextMenu, type ContextMenuProps } from "./context-menu.js";
|
|
57
57
|
export { Menubar, type MenubarProps } from "./menubar.js";
|
|
58
58
|
export { Asset, AssetGroup, type AssetProps, type AssetGroupProps } from "./asset.js";
|
|
59
|
+
export { StatusText, type StatusTextProps } from "./status-text.js";
|
|
59
60
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,EACX,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,gBAAgB,GACtB,MAAM,eAAe,CAAC;AAEv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aAAa,GACnB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -56,4 +56,5 @@ export { Collapsible } from "./collapsible.js";
|
|
|
56
56
|
export { ContextMenu } from "./context-menu.js";
|
|
57
57
|
export { Menubar } from "./menubar.js";
|
|
58
58
|
export { Asset, AssetGroup } from "./asset.js";
|
|
59
|
+
export { StatusText } from "./status-text.js";
|
|
59
60
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,GAIZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAA6C,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EACL,uBAAuB,GAIxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,WAA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,OAAO,EAAE,GAAG,EAAiB,MAAM,UAAU,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAwB,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,eAAe,EAA6B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAqB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAA6B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,QAAQ,GAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAgC,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,EAA6C,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAyC,MAAM,YAAY,CAAC","sourcesContent":["export {\n HjmProvider,\n useHjmTheme,\n type HjmBrandPalette,\n type HjmProviderHost,\n type HjmProviderProps,\n} from \"./provider.js\";\n\nexport { TopBar, type TopBarProps } from \"./top-bar.js\";\nexport { BottomCTA, type BottomCTAAction, type BottomCTAProps } from \"./bottom-cta.js\";\n\nexport {\n hjmCompositionStyleKeys,\n type HjmCompositionStyle,\n type HjmCompositionStyleKey,\n type HjmCompositionStyleProp,\n} from \"./composition-style.js\";\n\nexport {\n AspectRatio,\n Container,\n Grid,\n Layout,\n Section,\n Stack,\n Surface,\n Text,\n VisuallyHidden,\n type AspectRatioProps,\n type AspectRatioValue,\n type ContainerGutter,\n type ContainerProps,\n type ContainerSize,\n type GridGap,\n type GridProps,\n type LayoutProps,\n type LayoutSidebar,\n type SectionProps,\n type StackAlign,\n type StackAxis,\n type StackGap,\n type StackJustify,\n type StackProps,\n type SurfacePadding,\n type SurfaceProps,\n type SurfaceRadius,\n type SurfaceTone,\n type TextEmphasis,\n type TextProps,\n type TextTone,\n type VisuallyHiddenProps,\n} from \"./layout.js\";\n\nexport {\n Button,\n IconButton,\n Link,\n type ButtonAlign,\n type ButtonProps,\n type ButtonShape,\n type ButtonSize,\n type ButtonTone,\n type IconButtonProps,\n type IconButtonShape,\n type IconButtonSize,\n type IconButtonTone,\n type LinkRenderProps,\n type LinkProps,\n} from \"./actions.js\";\n\nexport {\n Field,\n OtpField,\n PasswordField,\n SearchField,\n TextArea,\n TextField,\n type FieldControlProps,\n type FieldProps,\n type OtpFieldProps,\n type PasswordFieldProps,\n type PasswordFieldToggleRenderProps,\n type SearchFieldProps,\n type SearchFieldIconRenderProps,\n type TextAreaProps,\n type TextFieldProps,\n} from \"./forms.js\";\n\nexport {\n Combobox,\n Form,\n type ComboboxItem,\n type ComboboxOpenChangeReason,\n type ComboboxProps,\n type FormProps,\n type FormSubmitHandler,\n NativeSelect,\n type NativeSelectProps,\n type SelectOption,\n} from \"./advanced-forms.js\";\n\nexport {\n Select,\n type SelectItem,\n type SelectLeadingRenderProps,\n type SelectOptionLeadingRenderProps,\n type SelectProps,\n type SelectSection,\n} from \"./select.js\";\n\nexport {\n NumberField,\n type NumberFieldProps,\n} from \"./number-field.js\";\n\nexport {\n Slider,\n type SliderProps,\n} from \"./slider.js\";\n\nexport {\n DatePicker,\n type DatePickerMonthAction,\n type DatePickerProps,\n} from \"./date-picker.js\";\n\nexport {\n FilePicker,\n type FilePickerProps,\n} from \"./file-picker.js\";\n\nexport {\n Checkbox,\n CheckboxGroup,\n Chip,\n Radio,\n RadioGroup,\n SegmentedControl,\n Switch,\n type CheckboxProps,\n type CheckboxGroupItem,\n type CheckboxGroupProps,\n type ChipProps,\n type ChoiceLeadingRenderProps,\n type RadioProps,\n type RadioGroupItem,\n type RadioGroupProps,\n type SegmentedControlItem,\n type SegmentedControlProps,\n type SwitchProps,\n type SwitchSize,\n} from \"./selection.js\";\n\nexport {\n TabPanel,\n Tabs,\n getDynamicTabPanelId,\n getTabId,\n getTabPanelId,\n type TabLeadingRenderProps,\n type TabItem,\n type TabPanelProps,\n type TabsProps,\n} from \"./navigation.js\";\n\nexport { Breadcrumb, type BreadcrumbProps } from \"./breadcrumb.js\";\nexport { Pagination, type PaginationProps } from \"./pagination.js\";\n\nexport {\n LoadMore,\n type LoadMoreProps,\n} from \"./supplemental-navigation.js\";\n\nexport {\n Steps,\n type StepsProps,\n} from \"./steps.js\";\n\nexport {\n BottomNavigation,\n getBottomNavigationGridColumn,\n isUnmodifiedPrimaryBottomNavigationClick,\n shouldHideBottomNavigationForKeyboard,\n type BottomNavigationIconRenderProps,\n type BottomNavigationLinkRenderProps,\n type BottomNavigationProps,\n} from \"./bottom-navigation.js\";\n\nexport {\n Badge,\n Card,\n ListRow,\n Tag,\n type BadgeProps,\n type BadgeVariant,\n type CardHeadingLevel,\n type CardProps,\n type ListRowProps,\n type TagProps,\n type TagTone,\n} from \"./display.js\";\n\nexport {\n CounterBadge,\n Icon,\n Image,\n type CounterBadgeProps,\n type IconProps,\n type ImageAdapterProps,\n type ImageProps,\n} from \"./supplemental-display.js\";\n\nexport {\n Accordion,\n Avatar,\n AvatarGroup,\n type AvatarGroupProps,\n DescriptionList,\n Divider,\n List,\n Statistic,\n StatisticGroup,\n Table,\n Timeline,\n type AccordionItem,\n type AccordionProps,\n type AvatarProps,\n type DescriptionListProps,\n type DividerInset,\n type DividerOrientation,\n type DividerProps,\n type ListAppearance,\n type ListProps,\n type StatisticProps,\n type StatisticGroupProps,\n type StatisticTrendMarkRenderProps,\n type ComposeStatisticAccessibilityLabel,\n type TableColumn,\n type TableProps,\n type TableSortDirection,\n type TimelineProps,\n} from \"./advanced-display.js\";\n\nexport {\n UploadItem,\n type UploadItemProps,\n} from \"./upload-item.js\";\n\nexport {\n EmptyState,\n Notice,\n Progress,\n Result,\n Skeleton,\n Spinner,\n type EmptyStateProps,\n type NoticeProps,\n type ProgressProps,\n type ResultProps,\n type SkeletonProps,\n type SpinnerProps,\n} from \"./feedback.js\";\n\nexport {\n Toast,\n ToastProvider,\n useToast,\n type ToastApi,\n type ToastProps,\n type ToastProviderProps,\n} from \"./toast.js\";\n\nexport {\n AlertDialog,\n Dialog,\n Menu,\n Sheet,\n Tooltip,\n type AlertDialogProps,\n type DialogOpenChangeReason,\n type DialogProps,\n type MenuItem,\n type MenuAsyncState,\n type MenuOpenChangeReason,\n type MenuProps,\n type MenuSection,\n type OverlayTrigger,\n type SheetPlacement,\n type SheetProps,\n type SheetSize,\n type TooltipProps,\n} from \"./overlays.js\";\n\nexport { Carousel, type CarouselProps, type CarouselLabels } from \"./carousel.js\";\n\nexport { FloatingActionButton, useFloatingActionButtonScroll, resolveFloatingActionButtonContentClearance, type FloatingActionButtonProps } from \"./floating-action-button.js\";\n\nexport { Calendar, type CalendarProps, type CalendarMonthAction, type CalendarHandle, type CalendarOverflow } from \"./calendar.js\";\n\nexport { Anchor, type AnchorProps } from \"./anchor.js\";\n\nexport { Popover, type PopoverProps, type PopoverContentActions } from \"./popover.js\";\nexport { SidePanel, type SidePanelProps } from \"./side-panel.js\";\nexport { Splitter, type SplitterProps } from \"./splitter.js\";\nexport { Tour, type TourProps } from \"./tour.js\";\nexport { Tree, type TreeProps } from \"./tree.js\";\nexport { TransferList, type TransferListProps, type TransferListLabels } from \"./transfer-list.js\";\nexport { Mentions, type MentionsProps, type MentionCandidate } from \"./mentions.js\";\nexport { CommandPalette, type CommandPaletteProps } from \"./command-palette.js\";\nexport { Agreement, type AgreementProps } from \"./agreement.js\";\nexport { Top, type TopProps } from \"./top.js\";\nexport { Heading, type HeadingProps } from \"./heading.js\";\nexport { TextFormat, type TextFormatProps } from \"./text-formats.js\";\nexport { ClipboardButton, type ClipboardButtonProps } from \"./clipboard.js\";\nexport { ToggleGroup, type ToggleGroupProps } from \"./toggle-group.js\";\nexport { TagsInput, type TagsInputProps } from \"./tags-input.js\";\nexport { SkipNav, type SkipNavProps } from \"./skip-nav.js\";\nexport { BottomInfo, type BottomInfoProps } from \"./bottom-info.js\";\nexport { Sidebar, type SidebarProps } from \"./sidebar.js\";\nexport { DateRangePicker, type DateRangePickerProps } from \"./date-range.js\";\nexport {\n OverlayStackProvider,\n useOverlayStack,\n useDialog,\n useSheet,\n type OverlayStackApi,\n type OverlayStackProviderProps,\n type OverlayHandle,\n} from \"./overlay-stack.js\";\nexport { AuthProviderButton, type AuthProviderButtonProps } from \"./provider-button.js\";\nexport { AuthScreenLayout, type AuthScreenLayoutProps } from \"./auth-screen.js\";\nexport { DataTable, type DataTableProps, type DataTableLabels } from \"./data-table.js\";\nexport { Collapsible, type CollapsibleProps } from \"./collapsible.js\";\nexport { ContextMenu, type ContextMenuProps } from \"./context-menu.js\";\nexport { Menubar, type MenubarProps } from \"./menubar.js\";\nexport { Asset, AssetGroup, type AssetProps, type AssetGroupProps } from \"./asset.js\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,WAAW,GAIZ,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,SAAS,EAA6C,MAAM,iBAAiB,CAAC;AAEvF,OAAO,EACL,uBAAuB,GAIxB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACL,WAAW,EACX,SAAS,EACT,IAAI,EACJ,MAAM,EACN,OAAO,EACP,KAAK,EACL,O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OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAwB,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,eAAe,EAA6B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,SAAS,EAAuB,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,OAAO,EAAqB,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,eAAe,EAA6B,MAAM,iBAAiB,CAAC;AAC7E,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,SAAS,EACT,QAAQ,GAIT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,kBAAkB,EAAgC,MAAM,sBAAsB,CAAC;AACxF,OAAO,EAAE,gBAAgB,EAA8B,MAAM,kBAAkB,CAAC;AAChF,OAAO,EAAE,SAAS,EAA6C,MAAM,iBAAiB,CAAC;AACvF,OAAO,EAAE,WAAW,EAAyB,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,WAAW,EAAyB,MAAM,mBAAmB,CAAC;AACvE,OAAO,EAAE,OAAO,EAAqB,MAAM,cAAc,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,UAAU,EAAyC,MAAM,YAAY,CAAC;AAEtF,OAAO,EAAE,UAAU,EAAwB,MAAM,kBAAkB,CAAC","sourcesContent":["export {\n HjmProvider,\n useHjmTheme,\n type HjmBrandPalette,\n type HjmProviderHost,\n type HjmProviderProps,\n} from \"./provider.js\";\n\nexport { TopBar, type TopBarProps } from \"./top-bar.js\";\nexport { BottomCTA, type BottomCTAAction, type BottomCTAProps } from \"./bottom-cta.js\";\n\nexport {\n hjmCompositionStyleKeys,\n type HjmCompositionStyle,\n type HjmCompositionStyleKey,\n type HjmCompositionStyleProp,\n} from \"./composition-style.js\";\n\nexport {\n AspectRatio,\n Container,\n Grid,\n Layout,\n Section,\n Stack,\n Surface,\n Text,\n VisuallyHidden,\n type AspectRatioProps,\n type AspectRatioValue,\n type ContainerGutter,\n type ContainerProps,\n type ContainerSize,\n type GridGap,\n type GridProps,\n type LayoutProps,\n type LayoutSidebar,\n type SectionProps,\n type StackAlign,\n type StackAxis,\n type StackGap,\n type StackJustify,\n type StackProps,\n type SurfacePadding,\n type SurfaceProps,\n type SurfaceRadius,\n type SurfaceTone,\n type TextEmphasis,\n type TextProps,\n type TextTone,\n type VisuallyHiddenProps,\n} from \"./layout.js\";\n\nexport {\n Button,\n IconButton,\n Link,\n type ButtonAlign,\n type ButtonProps,\n type ButtonShape,\n type ButtonSize,\n type ButtonTone,\n type IconButtonProps,\n type IconButtonShape,\n type IconButtonSize,\n type IconButtonTone,\n type LinkRenderProps,\n type LinkProps,\n} from \"./actions.js\";\n\nexport {\n Field,\n OtpField,\n PasswordField,\n SearchField,\n TextArea,\n TextField,\n type FieldControlProps,\n type FieldProps,\n type OtpFieldProps,\n type PasswordFieldProps,\n type PasswordFieldToggleRenderProps,\n type SearchFieldProps,\n type SearchFieldIconRenderProps,\n type TextAreaProps,\n type TextFieldProps,\n} from \"./forms.js\";\n\nexport {\n Combobox,\n Form,\n type ComboboxItem,\n type ComboboxOpenChangeReason,\n type ComboboxProps,\n type FormProps,\n type FormSubmitHandler,\n NativeSelect,\n type NativeSelectProps,\n type SelectOption,\n} from \"./advanced-forms.js\";\n\nexport {\n Select,\n type SelectItem,\n type SelectLeadingRenderProps,\n type SelectOptionLeadingRenderProps,\n type SelectProps,\n type SelectSection,\n} from \"./select.js\";\n\nexport {\n NumberField,\n type NumberFieldProps,\n} from \"./number-field.js\";\n\nexport {\n Slider,\n type SliderProps,\n} from \"./slider.js\";\n\nexport {\n DatePicker,\n type DatePickerMonthAction,\n type DatePickerProps,\n} from \"./date-picker.js\";\n\nexport {\n FilePicker,\n type FilePickerProps,\n} from \"./file-picker.js\";\n\nexport {\n Checkbox,\n CheckboxGroup,\n Chip,\n Radio,\n RadioGroup,\n SegmentedControl,\n Switch,\n type CheckboxProps,\n type CheckboxGroupItem,\n type CheckboxGroupProps,\n type ChipProps,\n type ChoiceLeadingRenderProps,\n type RadioProps,\n type RadioGroupItem,\n type RadioGroupProps,\n type SegmentedControlItem,\n type SegmentedControlProps,\n type SwitchProps,\n type SwitchSize,\n} from \"./selection.js\";\n\nexport {\n TabPanel,\n Tabs,\n getDynamicTabPanelId,\n getTabId,\n getTabPanelId,\n type TabLeadingRenderProps,\n type TabItem,\n type TabPanelProps,\n type TabsProps,\n} from \"./navigation.js\";\n\nexport { Breadcrumb, type BreadcrumbProps } from \"./breadcrumb.js\";\nexport { Pagination, type PaginationProps } from \"./pagination.js\";\n\nexport {\n LoadMore,\n type LoadMoreProps,\n} from \"./supplemental-navigation.js\";\n\nexport {\n Steps,\n type StepsProps,\n} from \"./steps.js\";\n\nexport {\n BottomNavigation,\n getBottomNavigationGridColumn,\n isUnmodifiedPrimaryBottomNavigationClick,\n shouldHideBottomNavigationForKeyboard,\n type BottomNavigationIconRenderProps,\n type BottomNavigationLinkRenderProps,\n type BottomNavigationProps,\n} from \"./bottom-navigation.js\";\n\nexport {\n Badge,\n Card,\n ListRow,\n Tag,\n type BadgeProps,\n type BadgeVariant,\n type CardHeadingLevel,\n type CardProps,\n type ListRowProps,\n type TagProps,\n type TagTone,\n} from \"./display.js\";\n\nexport {\n CounterBadge,\n Icon,\n Image,\n type CounterBadgeProps,\n type IconProps,\n type ImageAdapterProps,\n type ImageProps,\n} from \"./supplemental-display.js\";\n\nexport {\n Accordion,\n Avatar,\n AvatarGroup,\n type AvatarGroupProps,\n DescriptionList,\n Divider,\n List,\n Statistic,\n StatisticGroup,\n Table,\n Timeline,\n type AccordionItem,\n type AccordionProps,\n type AvatarProps,\n type DescriptionListProps,\n type DividerInset,\n type DividerOrientation,\n type DividerProps,\n type ListAppearance,\n type ListProps,\n type StatisticProps,\n type StatisticGroupProps,\n type StatisticTrendMarkRenderProps,\n type ComposeStatisticAccessibilityLabel,\n type TableColumn,\n type TableProps,\n type TableSortDirection,\n type TimelineProps,\n} from \"./advanced-display.js\";\n\nexport {\n UploadItem,\n type UploadItemProps,\n} from \"./upload-item.js\";\n\nexport {\n EmptyState,\n Notice,\n Progress,\n Result,\n Skeleton,\n Spinner,\n type EmptyStateProps,\n type NoticeProps,\n type ProgressProps,\n type ResultProps,\n type SkeletonProps,\n type SpinnerProps,\n} from \"./feedback.js\";\n\nexport {\n Toast,\n ToastProvider,\n useToast,\n type ToastApi,\n type ToastProps,\n type ToastProviderProps,\n} from \"./toast.js\";\n\nexport {\n AlertDialog,\n Dialog,\n Menu,\n Sheet,\n Tooltip,\n type AlertDialogProps,\n type DialogOpenChangeReason,\n type DialogProps,\n type MenuItem,\n type MenuAsyncState,\n type MenuOpenChangeReason,\n type MenuProps,\n type MenuSection,\n type OverlayTrigger,\n type SheetPlacement,\n type SheetProps,\n type SheetSize,\n type TooltipProps,\n} from \"./overlays.js\";\n\nexport { Carousel, type CarouselProps, type CarouselLabels } from \"./carousel.js\";\n\nexport { FloatingActionButton, useFloatingActionButtonScroll, resolveFloatingActionButtonContentClearance, type FloatingActionButtonProps } from \"./floating-action-button.js\";\n\nexport { Calendar, type CalendarProps, type CalendarMonthAction, type CalendarHandle, type CalendarOverflow } from \"./calendar.js\";\n\nexport { Anchor, type AnchorProps } from \"./anchor.js\";\n\nexport { Popover, type PopoverProps, type PopoverContentActions } from \"./popover.js\";\nexport { SidePanel, type SidePanelProps } from \"./side-panel.js\";\nexport { Splitter, type SplitterProps } from \"./splitter.js\";\nexport { Tour, type TourProps } from \"./tour.js\";\nexport { Tree, type TreeProps } from \"./tree.js\";\nexport { TransferList, type TransferListProps, type TransferListLabels } from \"./transfer-list.js\";\nexport { Mentions, type MentionsProps, type MentionCandidate } from \"./mentions.js\";\nexport { CommandPalette, type CommandPaletteProps } from \"./command-palette.js\";\nexport { Agreement, type AgreementProps } from \"./agreement.js\";\nexport { Top, type TopProps } from \"./top.js\";\nexport { Heading, type HeadingProps } from \"./heading.js\";\nexport { TextFormat, type TextFormatProps } from \"./text-formats.js\";\nexport { ClipboardButton, type ClipboardButtonProps } from \"./clipboard.js\";\nexport { ToggleGroup, type ToggleGroupProps } from \"./toggle-group.js\";\nexport { TagsInput, type TagsInputProps } from \"./tags-input.js\";\nexport { SkipNav, type SkipNavProps } from \"./skip-nav.js\";\nexport { BottomInfo, type BottomInfoProps } from \"./bottom-info.js\";\nexport { Sidebar, type SidebarProps } from \"./sidebar.js\";\nexport { DateRangePicker, type DateRangePickerProps } from \"./date-range.js\";\nexport {\n OverlayStackProvider,\n useOverlayStack,\n useDialog,\n useSheet,\n type OverlayStackApi,\n type OverlayStackProviderProps,\n type OverlayHandle,\n} from \"./overlay-stack.js\";\nexport { AuthProviderButton, type AuthProviderButtonProps } from \"./provider-button.js\";\nexport { AuthScreenLayout, type AuthScreenLayoutProps } from \"./auth-screen.js\";\nexport { DataTable, type DataTableProps, type DataTableLabels } from \"./data-table.js\";\nexport { Collapsible, type CollapsibleProps } from \"./collapsible.js\";\nexport { ContextMenu, type ContextMenuProps } from \"./context-menu.js\";\nexport { Menubar, type MenubarProps } from \"./menubar.js\";\nexport { Asset, AssetGroup, type AssetProps, type AssetGroupProps } from \"./asset.js\";\n\nexport { StatusText, type StatusTextProps } from \"./status-text.js\";\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-confirm.d.ts","sourceRoot":"","sources":["../src/inline-confirm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9O,uHAAuH;IACvH,WAAW,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC,CAAC;AAG3C,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+
|
|
1
|
+
{"version":3,"file":"inline-confirm.d.ts","sourceRoot":"","sources":["../src/inline-confirm.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9O,uHAAuH;IACvH,WAAW,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC,CAAC;AAG3C,qFAAqF;AACrF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,+BAyCtD"}
|
package/dist/inline-confirm.js
CHANGED
|
@@ -6,17 +6,28 @@ const emptySubscribe = () => () => { };
|
|
|
6
6
|
const emptySnapshot = () => null;
|
|
7
7
|
/** Low-complexity confirmation using the existing async dialog session semantics. */
|
|
8
8
|
export function InlineConfirm(props) {
|
|
9
|
+
// The displayed prompt can change while confirmation is open. Execute the
|
|
10
|
+
// current action rather than the callback captured when the prompt opened.
|
|
11
|
+
const confirmRef = useRef(props.onConfirm);
|
|
12
|
+
confirmRef.current = props.onConfirm;
|
|
9
13
|
const [session, setSession] = useState(null);
|
|
10
14
|
const [done, setDone] = useState(false);
|
|
11
15
|
const phase = useSyncExternalStore(session?.subscribe ?? emptySubscribe, session?.getSnapshot ?? emptySnapshot, emptySnapshot);
|
|
12
16
|
const trigger = useRef(null);
|
|
13
17
|
const cancel = useRef(null);
|
|
18
|
+
const confirm = useRef(null);
|
|
19
|
+
const group = useRef(null);
|
|
20
|
+
const result = useRef(null);
|
|
21
|
+
const focusResult = useRef(false);
|
|
14
22
|
useEffect(() => { if (session)
|
|
15
23
|
cancel.current?.focus(); }, [session]);
|
|
16
24
|
useEffect(() => {
|
|
17
25
|
if (phase?.status !== "closing")
|
|
18
26
|
return;
|
|
19
27
|
const confirmed = phase.result.outcome === "confirmed";
|
|
28
|
+
// Completion removes both actions. Move only this group's current focus;
|
|
29
|
+
// an async response must not steal focus from another part of the page.
|
|
30
|
+
focusResult.current = confirmed && (group.current?.contains(document.activeElement) ?? false);
|
|
20
31
|
session?.completeExit();
|
|
21
32
|
setDone(confirmed);
|
|
22
33
|
setSession(null);
|
|
@@ -24,14 +35,24 @@ export function InlineConfirm(props) {
|
|
|
24
35
|
if (!confirmed)
|
|
25
36
|
queueMicrotask(() => trigger.current?.focus());
|
|
26
37
|
}, [phase, session]);
|
|
38
|
+
useEffect(() => { if (done && focusResult.current) {
|
|
39
|
+
focusResult.current = false;
|
|
40
|
+
result.current?.focus();
|
|
41
|
+
} }, [done]);
|
|
27
42
|
if (done)
|
|
28
|
-
return _jsx("span", { role: "status", style: props.layoutStyle, children: props.successLabel });
|
|
43
|
+
return _jsx("span", { ref: result, tabIndex: -1, role: "status", style: props.layoutStyle, children: props.successLabel });
|
|
29
44
|
if (!session)
|
|
30
|
-
return _jsx(Button, { ref: trigger, tone: "danger", disabled: props.disabled ?? false, ...(props.layoutStyle === undefined ? {} : { layoutStyle: props.layoutStyle }), onClick: () => setSession(createAlertDialogSession({ mode: "confirm", tone: "danger", title: props.label, description: props.prompt, confirmLabel: props.confirmLabel, cancelLabel: props.cancelLabel, onConfirm:
|
|
45
|
+
return _jsx(Button, { ref: trigger, tone: "danger", disabled: props.disabled ?? false, ...(props.layoutStyle === undefined ? {} : { layoutStyle: props.layoutStyle }), onClick: () => setSession(createAlertDialogSession({ mode: "confirm", tone: "danger", title: props.label, description: props.prompt, confirmLabel: props.confirmLabel, cancelLabel: props.cancelLabel, onConfirm: () => confirmRef.current(), fallbackErrorMessage: props.errorLabel })), children: props.label });
|
|
31
46
|
const busy = phase?.status === "busy";
|
|
32
|
-
return _jsxs("div", { role: "group", "aria-label": props.prompt, onKeyDown: event => { if (event.key === "Escape" && !busy) {
|
|
47
|
+
return _jsxs("div", { ref: group, role: "group", "aria-label": props.prompt, onKeyDown: event => { if (event.key === "Escape" && !busy) {
|
|
33
48
|
event.stopPropagation();
|
|
34
49
|
session.cancel("escape");
|
|
35
|
-
} }, style: { ...props.layoutStyle, display: "grid", gap: "var(--hjm-space-sm)" }, children: [_jsx("span", { children: props.prompt }), phase?.status === "error" && _jsx("span", { role: "alert", children: phase.message }), _jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "var(--hjm-space-sm)" }, children: [_jsx(Button, { ref: cancel, tone: "ghost", disabled: busy, onClick: () => session.cancel("cancel-action"), children: props.cancelLabel }), _jsx(Button, { tone: "danger", loading: busy, disabled:
|
|
50
|
+
} }, style: { ...props.layoutStyle, display: "grid", gap: "var(--hjm-space-sm)" }, children: [_jsx("span", { children: props.prompt }), phase?.status === "error" && _jsx("span", { role: "alert", children: phase.message }), _jsxs("div", { style: { display: "flex", flexWrap: "wrap", gap: "var(--hjm-space-sm)" }, children: [_jsx(Button, { ref: cancel, tone: "ghost", disabled: busy, onClick: () => session.cancel("cancel-action"), children: props.cancelLabel }), _jsx(Button, { ref: confirm, tone: "danger", loading: busy, disabled: props.disabled ?? false, onClick: event => {
|
|
51
|
+
// WebKit pointer activation can leave focus on the now-disabled cancel
|
|
52
|
+
// button. Transfer it before submitting; loading already blocks repeats.
|
|
53
|
+
if (event.detail > 0 || group.current?.contains(document.activeElement))
|
|
54
|
+
confirm.current?.focus();
|
|
55
|
+
void session.confirm();
|
|
56
|
+
}, children: busy ? props.pendingLabel : props.confirmLabel })] })] });
|
|
36
57
|
}
|
|
37
58
|
//# sourceMappingURL=inline-confirm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inline-confirm.js","sourceRoot":"","sources":["../src/inline-confirm.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,wBAAwB,EAA2B,MAAM,iDAAiD,CAAC;AACpH,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAKtC,MAAM,cAAc,GAAG,GAAG,EAAE,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;AACtC,MAAM,aAAa,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AACjC,qFAAqF;AACrF,MAAM,UAAU,aAAa,CAAC,KAAyB;IACrD,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAA4B,IAAI,CAAC,CAAC;IACxE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,oBAAoB,CAAC,OAAO,EAAE,SAAS,IAAI,cAAc,EAAE,OAAO,EAAE,WAAW,IAAI,aAAa,EAAE,aAAa,CAAC,CAAC;IAC/H,MAAM,OAAO,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,SAAS,CAAC,GAAG,EAAE,GAAG,IAAI,OAAO;QAAE,MAAM,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,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,aAAa,CAAC;gCAAE,OAAO,CAAC,OAAO,EAAE,KAAK,EAAE,CAAC;4BAClG,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC;wBACzB,CAAC,YAAG,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,GAAU,IACxD,IACF,CAAC;AACT,CAAC","sourcesContent":["import { useEffect, useRef, useState, useSyncExternalStore } from \"react\";\nimport { createAlertDialogSession, type AlertDialogSession } from \"@hjmds/design-contracts/components/alert-dialog\";\nimport { Button } from \"./actions.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type InlineConfirmProps = Readonly<{ label: string; prompt: string; confirmLabel: string; cancelLabel: string; pendingLabel: string; successLabel: string; errorLabel: string; disabled?: boolean; onConfirm: () => void | Promise<void>;\n /** Canonical layout-only placement, applied to whichever root the current phase renders so the block does not jump. */\n layoutStyle?: HjmCompositionStyleProp }>;\nconst emptySubscribe = () => () => {};\nconst emptySnapshot = () => null;\n/** Low-complexity confirmation using the existing async dialog session semantics. */\nexport function InlineConfirm(props: InlineConfirmProps) {\n // The displayed prompt can change while confirmation is open. Execute the\n // current action rather than the callback captured when the prompt opened.\n const confirmRef = useRef(props.onConfirm);\n confirmRef.current = props.onConfirm;\n const [session, setSession] = useState<AlertDialogSession | null>(null);\n const [done, setDone] = useState(false);\n const phase = useSyncExternalStore(session?.subscribe ?? emptySubscribe, session?.getSnapshot ?? emptySnapshot, emptySnapshot);\n const trigger = useRef<HTMLButtonElement>(null);\n const cancel = useRef<HTMLButtonElement>(null);\n const confirm = useRef<HTMLButtonElement>(null);\n const group = useRef<HTMLDivElement>(null);\n const result = useRef<HTMLSpanElement>(null);\n const focusResult = useRef(false);\n useEffect(() => { if (session) cancel.current?.focus(); }, [session]);\n useEffect(() => {\n if (phase?.status !== \"closing\") return;\n const confirmed = phase.result.outcome === \"confirmed\";\n // Completion removes both actions. Move only this group's current focus;\n // an async response must not steal focus from another part of the page.\n focusResult.current = confirmed && (group.current?.contains(document.activeElement) ?? false);\n session?.completeExit();setDone(confirmed);setSession(null);\n // Cancel returns focus to the original action; success leaves a live result.\n if (!confirmed) queueMicrotask(() => trigger.current?.focus());\n }, [phase, session]);\n useEffect(() => { if (done && focusResult.current) { focusResult.current = false; result.current?.focus(); } }, [done]);\n if (done) return <span ref={result} tabIndex={-1} role=\"status\" style={props.layoutStyle}>{props.successLabel}</span>;\n if (!session) return <Button ref={trigger} tone=\"danger\" disabled={props.disabled ?? false} {...(props.layoutStyle === undefined ? {} : { layoutStyle: props.layoutStyle })} onClick={() => setSession(createAlertDialogSession({ mode: \"confirm\", tone: \"danger\", title: props.label, description: props.prompt, confirmLabel: props.confirmLabel, cancelLabel: props.cancelLabel, onConfirm: () => confirmRef.current(), fallbackErrorMessage: props.errorLabel }))}>{props.label}</Button>;\n const busy = phase?.status === \"busy\";\n return <div ref={group} role=\"group\" aria-label={props.prompt} onKeyDown={event => { if (event.key === \"Escape\" && !busy) { event.stopPropagation();session.cancel(\"escape\"); } }} style={{ ...props.layoutStyle, display: \"grid\", gap: \"var(--hjm-space-sm)\" }}>\n <span>{props.prompt}</span>{phase?.status === \"error\" && <span role=\"alert\">{phase.message}</span>}\n <div style={{ display: \"flex\", flexWrap: \"wrap\", gap: \"var(--hjm-space-sm)\" }}>\n <Button ref={cancel} tone=\"ghost\" disabled={busy} onClick={() => session.cancel(\"cancel-action\")}>{props.cancelLabel}</Button>\n <Button ref={confirm} tone=\"danger\" loading={busy} disabled={props.disabled ?? false} onClick={event => {\n // WebKit pointer activation can leave focus on the now-disabled cancel\n // button. Transfer it before submitting; loading already blocks repeats.\n if (event.detail > 0 || group.current?.contains(document.activeElement)) confirm.current?.focus();\n void session.confirm();\n }}>{busy ? props.pendingLabel : props.confirmLabel}</Button>\n </div>\n </div>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-resource.d.ts","sourceRoot":"","sources":["../../src/internal/document-resource.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAmC,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAI3H,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,GAAG,QAAQ,CAAC;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAEzH,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+
|
|
1
|
+
{"version":3,"file":"document-resource.d.ts","sourceRoot":"","sources":["../../src/internal/document-resource.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAmC,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAI3H,MAAM,MAAM,qBAAqB,GAAG,wBAAwB,GAAG,QAAQ,CAAC;IAAE,OAAO,CAAC,EAAE,SAAS,CAAC;IAAC,UAAU,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAAC;AAEzH,uEAAuE;AACvE,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,KAAK,EAAE,EAAE,qBAAqB,+BAwDxF"}
|
|
@@ -31,7 +31,7 @@ export function DocumentResource({ preview, moreAction, ...props }) {
|
|
|
31
31
|
}
|
|
32
32
|
previousId.current = resource.id;
|
|
33
33
|
});
|
|
34
|
-
return _jsx(Surface, { padding: "md", radius: "lg", role: "group", "aria-label": resource.name, children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { emphasis: "strong", style: { overflowWrap: "anywhere" }, children: resource.name }), resource.metadata.map((label, index) => _jsx(Text, { variant: "caption", tone: "muted", children: label }, index)), resource.description ? _jsx(Text, { children: resource.description }) : null, resource.preview.status === "ready" ? preview : null, resource.preview.status === "none" ? _jsx(Text, { tone: "muted", children: labels.previewUnavailable }) : null, resource.preview.status === "loading" ? _jsx(Text, { role: "status", children: labels.previewLoading }) : null, previewFailed ? _jsx(Text, { tone: "danger", role: "alert", children: resource.preview.status === "error" ? resource.preview.message : "" }) : null, props.onPreview ? _jsx(Button, { ref: previewButton, tone: "secondary", disabled: !resource.canPreview, onClick: props.onPreview, children: labels.preview }) : null, previewFailed && resource.preview.retryable ? _jsx(Button, { ref: attachRetry, tone: "secondary", disabled: !resource.canRetryPreview, onClick: props.onRetryPreview, children: labels.retryPreview }) : null, _jsx(Button, { ref: saveButton, disabled: saveFailed ? !resource.canRetrySave : !resource.canSave, loading: resource.save.status === "pending", onClick: saveFailed ? props.onRetrySave : props.onSave, children: saveFailed ? labels.retrySave : resource.save.status === "pending" ? labels.saving : labels.save }), saveFailed ? _jsx(Text, { tone: "danger", role: "alert", children: resource.save.status === "error" ? resource.save.message : "" }) : null, resource.save.status === "started" || resource.save.status === "saved" || resource.save.status === "cancelled"
|
|
35
|
-
|
|
34
|
+
return _jsx(Surface, { padding: "md", radius: "lg", role: "group", "aria-label": resource.name, children: _jsxs(Stack, { gap: "sm", children: [_jsx(Text, { emphasis: "strong", style: { overflowWrap: "anywhere" }, children: resource.name }), resource.metadata.map((label, index) => _jsx(Text, { variant: "caption", tone: "muted", children: label }, index)), resource.description ? _jsx(Text, { children: resource.description }) : null, resource.preview.status !== "ready" || preview != null || props.onPreview ? _jsxs(Stack, { gap: "sm", justify: "center", children: [resource.preview.status === "ready" ? preview : null, resource.preview.status === "none" ? _jsx(Text, { tone: "muted", style: { textAlign: "center" }, children: labels.previewUnavailable }) : null, resource.preview.status === "loading" ? _jsx(Text, { role: "status", style: { textAlign: "center" }, children: labels.previewLoading }) : null, previewFailed ? _jsx(Text, { tone: "danger", role: "alert", style: { textAlign: "center" }, children: resource.preview.status === "error" ? resource.preview.message : "" }) : null, props.onPreview ? _jsx(Button, { ref: previewButton, tone: "secondary", disabled: !resource.canPreview, onClick: props.onPreview, children: labels.preview }) : null, previewFailed && resource.preview.retryable ? _jsx(Button, { ref: attachRetry, tone: "secondary", disabled: !resource.canRetryPreview, onClick: props.onRetryPreview, children: labels.retryPreview }) : null] }) : null, _jsxs(Stack, { gap: "sm", justify: "center", children: [_jsx(Button, { ref: saveButton, disabled: saveFailed ? !resource.canRetrySave : !resource.canSave, loading: resource.save.status === "pending", onClick: saveFailed ? props.onRetrySave : props.onSave, children: saveFailed ? labels.retrySave : resource.save.status === "pending" ? labels.saving : labels.save }), saveFailed ? _jsx(Text, { tone: "danger", role: "alert", style: { textAlign: "center" }, children: resource.save.status === "error" ? resource.save.message : "" }) : null, resource.save.status === "started" || resource.save.status === "saved" || resource.save.status === "cancelled"
|
|
35
|
+
? _jsx(Text, { role: "status", style: { textAlign: "center" }, children: labels[resource.save.status] }) : null] }), moreAction] }) });
|
|
36
36
|
}
|
|
37
37
|
//# sourceMappingURL=document-resource.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-resource.js","sourceRoot":"","sources":["../../src/internal/document-resource.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,EAAkB,MAAM,OAAO,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAiC,MAAM,2CAA2C,CAAC;AAC3H,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAIpD,uEAAuE;AACvE,MAAM,UAAU,gBAAgB,CAAC,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,KAAK,EAAyB;IACvF,MAAM,QAAQ,GAAG,+BAA+B,CAAC,KAAK,CAAC,CAAC;IACxD,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACzB,MAAM,aAAa,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,KAAK,OAAO,CAAC;IA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AAO,EACxF,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,EAC3C,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,YACrD,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAC1F,EACR,UAAU,CAAC,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,GAAQ,CAAC,CAAC,CAAC,IAAI,EAC3J,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,WAAW;4BAC7G,CAAC,CAAC,KAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,EAAC,KAAK,EAAE,EAAE,SAAS,EAAE,QAAQ,EAAE,YAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,GAAQ,CAAC,CAAC,CAAC,IAAI,IAC9F,EACP,UAAU,IACL,GACA,CAAC;AACb,CAAC","sourcesContent":["import { useCallback, useLayoutEffect, useRef, type ReactNode } from \"react\";\nimport { resolveDocumentResourceControls, type DocumentResourceControls } from \"@hjmds/design-contracts/document-resource\";\nimport { Button } from \"../actions.js\";\nimport { Stack, Surface, Text } from \"../layout.js\";\n\nexport type DocumentResourceProps = DocumentResourceControls & Readonly<{ preview?: ReactNode; moreAction?: ReactNode }>;\n\n/** Rendering a host result never initiates file access or transfer. */\nexport function DocumentResource({ preview, moreAction, ...props }: DocumentResourceProps) {\n const resource = resolveDocumentResourceControls(props);\n const { labels } = props;\n const previewFailed = resource.preview.status === \"error\";\n const saveFailed = resource.save.status === \"error\";\n const previewButton = useRef<HTMLButtonElement>(null);\n const saveButton = useRef<HTMLButtonElement>(null);\n const retryButton = useRef<HTMLButtonElement | null>(null);\n const previousId = useRef(resource.id);\n const detachedFocus = useRef<Document | null>(null);\n const attachRetry = useCallback((node: HTMLButtonElement | null) => {\n const old = retryButton.current;\n // Capture before removal: after commit the browser has already dropped focus to body.\n if (!node && old && old.ownerDocument.activeElement === old) detachedFocus.current = old.ownerDocument;\n retryButton.current = node;\n }, []);\n useLayoutEffect(() => {\n const owner = detachedFocus.current;\n detachedFocus.current = null;\n // Only recover our removed control; never move focus across file identities or from another control.\n if (owner && previousId.current === resource.id && owner.activeElement === owner.body) {\n const target = [previewButton.current, saveButton.current].find(button =>\n button && !button.disabled && button.getAttribute(\"aria-disabled\") !== \"true\");\n target?.focus();\n }\n previousId.current = resource.id;\n });\n return <Surface padding=\"md\" radius=\"lg\" role=\"group\" aria-label={resource.name}>\n <Stack gap=\"sm\">\n {/* A file name is not automatically a page heading. Keep it readable when the preview fails. */}\n <Text emphasis=\"strong\" style={{ overflowWrap: \"anywhere\" }}>{resource.name}</Text>\n {resource.metadata.map((label, index) => <Text key={index} variant=\"caption\" tone=\"muted\">{label}</Text>)}\n {resource.description ? <Text>{resource.description}</Text> : null}\n {/* Center each state with its own actions without moving the document metadata. */}\n {resource.preview.status !== \"ready\" || preview != null || props.onPreview ? <Stack gap=\"sm\" justify=\"center\">\n {resource.preview.status === \"ready\" ? preview : null}\n {resource.preview.status === \"none\" ? <Text tone=\"muted\" style={{ textAlign: \"center\" }}>{labels.previewUnavailable}</Text> : null}\n {resource.preview.status === \"loading\" ? <Text role=\"status\" style={{ textAlign: \"center\" }}>{labels.previewLoading}</Text> : null}\n {previewFailed ? <Text tone=\"danger\" role=\"alert\" style={{ textAlign: \"center\" }}>{resource.preview.status === \"error\" ? resource.preview.message : \"\"}</Text> : null}\n {/* Independent buttons prevent preview navigation from swallowing save/menu interaction. */}\n {props.onPreview ? <Button ref={previewButton} tone=\"secondary\" disabled={!resource.canPreview} onClick={props.onPreview}>{labels.preview}</Button> : null}\n {previewFailed && resource.preview.retryable ? <Button ref={attachRetry} tone=\"secondary\" disabled={!resource.canRetryPreview} onClick={props.onRetryPreview}>{labels.retryPreview}</Button> : null}\n </Stack> : null}\n <Stack gap=\"sm\" justify=\"center\">\n <Button ref={saveButton} disabled={saveFailed ? !resource.canRetrySave : !resource.canSave}\n loading={resource.save.status === \"pending\"}\n onClick={saveFailed ? props.onRetrySave : props.onSave}>\n {saveFailed ? labels.retrySave : resource.save.status === \"pending\" ? labels.saving : labels.save}\n </Button>\n {saveFailed ? <Text tone=\"danger\" role=\"alert\" style={{ textAlign: \"center\" }}>{resource.save.status === \"error\" ? resource.save.message : \"\"}</Text> : null}\n {resource.save.status === \"started\" || resource.save.status === \"saved\" || resource.save.status === \"cancelled\"\n ? <Text role=\"status\" style={{ textAlign: \"center\" }}>{labels[resource.save.status]}</Text> : null}\n </Stack>\n {moreAction}\n </Stack>\n </Surface>;\n}\n"]}
|
package/dist/masonry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masonry.d.ts","sourceRoot":"","sources":["../src/masonry.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI;IAAE,KAAK,EAAE,SAAS,CAAC,EAAE,CAAC;IAAC,YAAY,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAAC,UAAU,EAAE,CAAC,I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,EAAE,SAAS,CAAC;IAChR,+HAA+H;IAC/H,WAAW,CAAC,EAAE,uBAAuB,CAAA;CAAE,CAAC;AAC1C,wBAAgB,OAAO,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,KAAK,EAAE,OAAW,EAAE,GAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,YAAY,CAAC,CAAC,CAAC,+BAWtJ"}
|
package/dist/masonry.js
CHANGED
|
@@ -8,8 +8,9 @@ export function Masonry({ items, keyExtractor, renderItem, getItemHeight, width,
|
|
|
8
8
|
const layout = resolveMasonryLayout(items.map(item => getItemHeight(item, itemWidth)), width, columns, gap);
|
|
9
9
|
// A named div without a role is not exposed with its name (ARIA prohibits aria-label on generic).
|
|
10
10
|
// `group` keeps the collection name with the empty copy; `list` was rejected because the empty slot is not a listitem.
|
|
11
|
+
// The empty collection keeps its measured width and centers within host-allocated space.
|
|
11
12
|
if (!items.length)
|
|
12
|
-
return _jsx("div", { role: "group", "aria-label": label, style: layoutStyle, children: empty });
|
|
13
|
+
return _jsx("div", { role: "group", "aria-label": label, style: { ...layoutStyle, width, display: "flex", flexDirection: "column", alignItems: "center", justifyContent: "center", textAlign: "center" }, children: empty });
|
|
13
14
|
return _jsx("div", { "data-hjm-masonry": true, role: "list", "aria-label": label, style: { ...layoutStyle, position: "relative", width, height: layout.height }, children: items.map((item, index) => { const frame = layout.items[index]; return _jsx("div", { role: "listitem", style: { position: "absolute", insetInlineStart: frame.left, top: frame.top, width: frame.width, height: frame.height }, children: renderItem(item, index) }, keys[index]); }) });
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=masonry.js.map
|
package/dist/masonry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masonry.js","sourceRoot":"","sources":["../src/masonry.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AA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,CAAC,IAA9J,IAAI,CAAC,KAAK,CAAC,CAA0J,CAAC,CAAC,CAAC,CAAC,GACxQ,CAAC;AACT,CAAC","sourcesContent":["import type { ReactNode } from \"react\";\nimport { resolveMasonryLayout } from \"@hjmds/design-contracts/components/masonry\";\nimport { validateListKeys } from \"@hjmds/design-contracts/components/virtual-list\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type MasonryProps<T> = { items: readonly T[]; keyExtractor: (item: T) => string; renderItem: (item: T, index: number) => ReactNode; getItemHeight: (item: T, itemWidth: number) => number; width: number; columns?: number; gap?: number; label: string; empty?: ReactNode;\n /** Canonical layout-only placement on the root. The measured `width`/height still win: absolute item frames depend on them. */\n layoutStyle?: HjmCompositionStyleProp };\nexport function Masonry<T>({ items, keyExtractor, renderItem, getItemHeight, width, columns = 2, gap = 12, label, empty, layoutStyle }: MasonryProps<T>) {\n const keys = items.map(keyExtractor); validateListKeys(keys, label);\n const itemWidth = resolveMasonryLayout([], width, columns, gap).itemWidth;\n const layout = resolveMasonryLayout(items.map(item => getItemHeight(item, itemWidth)), width, columns, gap);\n // A named div without a role is not exposed with its name (ARIA prohibits aria-label on generic).\n // `group` keeps the collection name with the empty copy; `list` was rejected because the empty slot is not a listitem.\n // The empty collection keeps its measured width and centers within host-allocated space.\n if (!items.length) return <div role=\"group\" aria-label={label} style={{ ...layoutStyle, width, display: \"flex\", flexDirection: \"column\", alignItems: \"center\", justifyContent: \"center\", textAlign: \"center\" }}>{empty}</div>;\n return <div data-hjm-masonry role=\"list\" aria-label={label} style={{ ...layoutStyle, position: \"relative\", width, height: layout.height }}>\n {items.map((item, index) => { const frame = layout.items[index]!; return <div role=\"listitem\" key={keys[index]} style={{ position: \"absolute\", insetInlineStart: frame.left, top: frame.top, width: frame.width, height: frame.height }}>{renderItem(item, index)}</div>; })}\n </div>;\n}\n"]}
|
package/dist/mentions.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../src/mentions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAAY,EACjB,KAAK,oBAAoB,EAC1B,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AAI1D,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,sEAAsE;IACtE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CAAC;AAEH,MAAM,MAAM,aAAa,CAAC,SAAS,SAAS,MAAM,GAAG,MAAM,IACzD,IAAI,CAAC,aAAa,EAAE,OAAO,GAAG,cAAc,GAAG,UAAU,GAAG,UAAU,CAAC,GACvE,QAAQ,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,QAAQ,EAAE,SAAS,oBAAoB,CAAC,SAAS,CAAC,EAAE,CAAC;IACrD,+EAA+E;IAC/E,UAAU,EAAE,SAAS,gBAAgB,EAAE,CAAC;IACxC,0EAA0E;IAC1E,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,SAAS,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;IACvE,yEAAyE;IACzE,YAAY,EAAE,MAAM,CAAC;IACrB,wDAAwD;IACxD,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,gBAAgB,KAAK,SAAS,CAAC;CAC9D,CAAC,CAAC;AAEL,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../src/mentions.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,YAA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AC,YAAY,GAAG,IAAI,CAAC"}
|
package/dist/mentions.js
CHANGED
|
@@ -15,7 +15,8 @@ layoutStyle, ...textAreaProps }, forwardedRef) {
|
|
|
15
15
|
const [activeIndex, setActiveIndex] = useState(0);
|
|
16
16
|
const [list, setList] = useState(null);
|
|
17
17
|
const id = `${useId().replaceAll(":", "")}-mentions`;
|
|
18
|
-
const
|
|
18
|
+
const unavailable = textAreaProps.disabled || textAreaProps.readOnly;
|
|
19
|
+
const open = match !== null && !unavailable;
|
|
19
20
|
const activeCandidate = candidates[Math.min(activeIndex, Math.max(candidates.length - 1, 0))];
|
|
20
21
|
const notifyRef = useRef(onMentionQueryChange);
|
|
21
22
|
notifyRef.current = onMentionQueryChange;
|
|
@@ -23,14 +24,14 @@ layoutStyle, ...textAreaProps }, forwardedRef) {
|
|
|
23
24
|
const syncMatch = (text, cursor) => {
|
|
24
25
|
// The contract owns trigger detection, including "a space closes it" and
|
|
25
26
|
// "the nearer trigger wins"; this component only reports the cursor.
|
|
26
|
-
const next = findActiveMentionTrigger(text, cursor, triggers);
|
|
27
|
+
const next = unavailable ? null : findActiveMentionTrigger(text, cursor, triggers);
|
|
27
28
|
setMatch((previous) => (previous?.triggerStart === next?.triggerStart && previous?.query === next?.query ? previous : next));
|
|
28
29
|
if (next === null || next.query !== match?.query)
|
|
29
30
|
setActiveIndex(0);
|
|
30
31
|
};
|
|
31
32
|
const commit = (candidate) => {
|
|
32
33
|
const input = inputRef.current;
|
|
33
|
-
if (!match || !input)
|
|
34
|
+
if (unavailable || !match || !input)
|
|
34
35
|
return;
|
|
35
36
|
const result = resolveMentionInsertion(value, match, input.selectionStart ?? value.length, candidate.insertText ?? candidate.label);
|
|
36
37
|
onValueChange(result.text);
|
|
@@ -41,7 +42,7 @@ layoutStyle, ...textAreaProps }, forwardedRef) {
|
|
|
41
42
|
});
|
|
42
43
|
};
|
|
43
44
|
const onKeyDown = (event) => {
|
|
44
|
-
if (!open)
|
|
45
|
+
if (!open || event.defaultPrevented || event.nativeEvent.isComposing || event.keyCode === 229)
|
|
45
46
|
return;
|
|
46
47
|
if (event.key === "ArrowDown" || event.key === "ArrowUp") {
|
|
47
48
|
if (candidates.length === 0)
|
|
@@ -78,11 +79,18 @@ layoutStyle, ...textAreaProps }, forwardedRef) {
|
|
|
78
79
|
}, onKeyUp: (event) => {
|
|
79
80
|
// Caret moves without an edit (arrows, clicks) change which trigger is
|
|
80
81
|
// active, so the match is re-read from the caret, not only from input.
|
|
82
|
+
textAreaProps.onKeyUp?.(event);
|
|
83
|
+
// Escape keyup must not reopen the token dismissed on keydown.
|
|
84
|
+
if (event.defaultPrevented || event.key === "Escape" || event.nativeEvent.isComposing || event.keyCode === 229)
|
|
85
|
+
return;
|
|
81
86
|
if (open && (event.key === "ArrowDown" || event.key === "ArrowUp"))
|
|
82
87
|
return;
|
|
83
88
|
const input = event.currentTarget;
|
|
84
89
|
syncMatch(input.value, input.selectionStart ?? input.value.length);
|
|
85
90
|
}, onClick: (event) => {
|
|
91
|
+
textAreaProps.onClick?.(event);
|
|
92
|
+
if (event.defaultPrevented)
|
|
93
|
+
return;
|
|
86
94
|
const input = event.currentTarget;
|
|
87
95
|
syncMatch(input.value, input.selectionStart ?? input.value.length);
|
|
88
96
|
}, onBlur: (event) => { textAreaProps.onBlur?.(event); setMatch(null); }, onKeyDown: (event) => { textAreaProps.onKeyDown?.(event); onKeyDown(event); } }), open ? (_jsx(AnchoredPortal, { anchorRef: inputRef, children: _jsx("div", { ref: setList, id: id, role: "listbox", "aria-label": listLabel, className: "hjm-mentions__list", style: position.style, children: candidates.length === 0 ? (_jsx("p", { className: "hjm-mentions__empty", role: "status", children: emptyMessage })) : candidates.map((candidate, index) => (_jsx("div", { id: `${id}-${candidate.id}`, role: "option", "aria-selected": candidate.id === activeCandidate?.id, className: "hjm-mentions__option",
|
package/dist/mentions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mentions.js","sourceRoot":"","sources":["../src/mentions.t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Ae,EAAE,EAAE,EACnD,SAAS,EAAC,sBAAsB;wBAChC,gEAAgE;wBAChE,2DAA2D;wBAC3D,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACtE,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,YAExC,eAAe,EAAE,CAAC,SAAS,CAAC,IAAI,CAC/B,8BACE,yBAAO,SAAS,CAAC,KAAK,GAAQ,EAC7B,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,2BAA2B,YAAE,SAAS,CAAC,WAAW,GAAQ,CAAC,CAAC,CAAC,IAAI,IACzG,CACJ,IAfI,SAAS,CAAC,EAAE,CAgBb,CACP,CAAC,GACE,GACS,CAClB,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAE6B,CAAC","sourcesContent":["import { layer } from \"@hjmds/design-contracts/foundations\";\nimport { comboboxRecipe } from \"@hjmds/design-contracts/recipes\";\nimport {\n findActiveMentionTrigger,\n resolveMentionInsertion,\n type MentionMatch,\n type MentionTriggerConfig,\n} from \"@hjmds/design-contracts/components/mentions\";\nimport {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { TextArea, type TextAreaProps } from \"./forms.js\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { AnchoredPortal, useAnchoredPopup } from \"./portal.js\";\n\nexport type MentionCandidate = Readonly<{\n id: string;\n label: string;\n /** Text inserted after the trigger character; defaults to `label`. */\n insertText?: string;\n description?: string;\n}>;\n\nexport type MentionsProps<TriggerId extends string = string> =\n Omit<TextAreaProps, \"value\" | \"defaultValue\" | \"onChange\" | \"children\"> &\n Readonly<{\n value: string;\n onValueChange: (value: string) => void;\n triggers: readonly MentionTriggerConfig<TriggerId>[];\n /** Candidates for the active query; the product owns filtering and loading. */\n candidates: readonly MentionCandidate[];\n /** Fires whenever the active trigger match changes, including to null. */\n onMentionQueryChange?: (match: MentionMatch<TriggerId> | null) => void;\n /** Localized message shown when the popup is open with no candidates. */\n emptyMessage: string;\n /** Localized accessible name for the candidate list. */\n listLabel: string;\n renderCandidate?: (candidate: MentionCandidate) => ReactNode;\n }>;\n\nexport const Mentions = forwardRef(function Mentions<TriggerId extends string = string>(\n {\n value,\n onValueChange,\n triggers,\n candidates,\n onMentionQueryChange,\n emptyMessage,\n listLabel,\n renderCandidate,\n className,\n // Inherited from TextAreaProps; taken here so placement moves the whole\n // mentions block (field + candidate popup anchor), not only the inner field.\n layoutStyle,\n ...textAreaProps\n }: MentionsProps<TriggerId>,\n forwardedRef: React.Ref<HTMLTextAreaElement>,\n) {\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const [match, setMatch] = useState<MentionMatch<TriggerId> | null>(null);\n const [activeIndex, setActiveIndex] = useState(0);\n const [list, setList] = useState<HTMLDivElement | null>(null);\n const id = `${useId().replaceAll(\":\", \"\")}-mentions`;\n const open = match !== null;\n const activeCandidate = candidates[Math.min(activeIndex, Math.max(candidates.length - 1, 0))];\n\n const notifyRef = useRef(onMentionQueryChange);\n notifyRef.current = onMentionQueryChange;\n useEffect(() => { notifyRef.current?.(match); }, [match]);\n\n const syncMatch = (text: string, cursor: number) => {\n // The contract owns trigger detection, including \"a space closes it\" and\n // \"the nearer trigger wins\"; this component only reports the cursor.\n const next = findActiveMentionTrigger(text, cursor, triggers);\n setMatch((previous) => (previous?.triggerStart === next?.triggerStart && previous?.query === next?.query ? previous : next));\n if (next === null || next.query !== match?.query) setActiveIndex(0);\n };\n const commit = (candidate: MentionCandidate) => {\n const input = inputRef.current;\n if (!match || !input) return;\n const result = resolveMentionInsertion(value, match, input.selectionStart ?? value.length, candidate.insertText ?? candidate.label);\n onValueChange(result.text);\n setMatch(null);\n queueMicrotask(() => {\n input.focus();\n input.setSelectionRange(result.cursorPosition, result.cursorPosition);\n });\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (!open) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n if (candidates.length === 0) return;\n event.preventDefault();\n setActiveIndex((previous) => {\n const next = event.key === \"ArrowDown\" ? previous + 1 : previous - 1;\n return (next + candidates.length) % candidates.length;\n });\n return;\n }\n if (event.key === \"Escape\") {\n // Dismissing the popup must not touch the text the user already typed.\n event.preventDefault();\n event.stopPropagation();\n setMatch(null);\n return;\n }\n if (event.key === \"Enter\" && activeCandidate && candidates.length > 0) {\n event.preventDefault();\n commit(activeCandidate);\n }\n };\n\n const position = useAnchoredPopup(inputRef, open ? list : null, {\n placement: \"bottom\", align: \"start\", matchAnchorWidth: true, zIndex: layer.dropdown,\n // The candidate list is Combobox's popover contract verbatim (mentions.ts), so its offset and edge padding are\n // comboboxRecipe.popover's 8/8. Until 2026-10-06 the helper defaults (8 and 16) applied, a Web-only 16 edge.\n gap: comboboxRecipe.popover.sideOffset,\n viewportPadding: comboboxRecipe.popover.collisionPadding,\n });\n\n return (\n <div className={classNames(\"hjm-mentions\", className)} style={layoutStyle}>\n <TextArea\n {...textAreaProps}\n ref={composeRefs(inputRef, forwardedRef)}\n value={value}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={open ? id : undefined}\n aria-autocomplete=\"list\"\n aria-activedescendant={open && activeCandidate ? `${id}-${activeCandidate.id}` : undefined}\n onChange={(event) => {\n onValueChange(event.target.value);\n syncMatch(event.target.value, event.target.selectionStart ?? event.target.value.length);\n }}\n onKeyUp={(event) => {\n // Caret moves without an edit (arrows, clicks) change which trigger is\n // active, so the match is re-read from the caret, not only from input.\n if (open && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) return;\n const input = event.currentTarget;\n syncMatch(input.value, input.selectionStart ?? input.value.length);\n }}\n onClick={(event) => {\n const input = event.currentTarget;\n syncMatch(input.value, input.selectionStart ?? input.value.length);\n }}\n onBlur={(event) => { textAreaProps.onBlur?.(event); setMatch(null); }}\n onKeyDown={(event) => { textAreaProps.onKeyDown?.(event); onKeyDown(event); }}\n />\n {open ? (\n <AnchoredPortal anchorRef={inputRef}>\n <div\n ref={setList}\n id={id}\n role=\"listbox\"\n aria-label={listLabel}\n className=\"hjm-mentions__list\"\n style={position.style as CSSProperties}\n >\n {candidates.length === 0 ? (\n <p className=\"hjm-mentions__empty\" role=\"status\">{emptyMessage}</p>\n ) : candidates.map((candidate, index) => (\n <div\n key={candidate.id}\n id={`${id}-${candidate.id}`}\n role=\"option\"\n aria-selected={candidate.id === activeCandidate?.id}\n className=\"hjm-mentions__option\"\n // Pointer commit must not blur the textarea first, or the caret\n // position the insertion depends on would already be gone.\n onMouseDown={(event) => { event.preventDefault(); commit(candidate); }}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {renderCandidate?.(candidate) ?? (\n <>\n <span>{candidate.label}</span>\n {candidate.description ? <span className=\"hjm-mentions__description\">{candidate.description}</span> : null}\n </>\n )}\n </div>\n ))}\n </div>\n </AnchoredPortal>\n ) : null}\n </div>\n );\n}) as <TriggerId extends string = string>(\n props: MentionsProps<TriggerId> & { ref?: React.Ref<HTMLTextAreaElement> },\n) => React.ReactElement | null;\n"]}
|
|
1
|
+
{"version":3,"file":"mentions.js","sourceRoot":"","sources":["../src/mentions.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAGxB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,QAAQ,EAAsB,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;A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,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,EAAE,CAAC,CACvC,cAEE,EAAE,EAAE,GAAG,EAAE,IAAI,SAAS,CAAC,EAAE,EAAE,EAC3B,IAAI,EAAC,QAAQ,mBACE,SAAS,CAAC,EAAE,KAAK,eAAe,EAAE,EAAE,EACnD,SAAS,EAAC,sBAAsB;wBAChC,gEAAgE;wBAChE,2DAA2D;wBAC3D,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,GAAG,KAAK,CAAC,cAAc,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EACtE,YAAY,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,KAAK,CAAC,YAExC,eAAe,EAAE,CAAC,SAAS,CAAC,IAAI,CAC/B,8BACE,yBAAO,SAAS,CAAC,KAAK,GAAQ,EAC7B,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,eAAM,SAAS,EAAC,2BAA2B,YAAE,SAAS,CAAC,WAAW,GAAQ,CAAC,CAAC,CAAC,IAAI,IACzG,CACJ,IAfI,SAAS,CAAC,EAAE,CAgBb,CACP,CAAC,GACE,GACS,CAClB,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAE6B,CAAC","sourcesContent":["import { layer } from \"@hjmds/design-contracts/foundations\";\nimport { comboboxRecipe } from \"@hjmds/design-contracts/recipes\";\nimport {\n findActiveMentionTrigger,\n resolveMentionInsertion,\n type MentionMatch,\n type MentionTriggerConfig,\n} from \"@hjmds/design-contracts/components/mentions\";\nimport {\n forwardRef,\n useEffect,\n useId,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { TextArea, type TextAreaProps } from \"./forms.js\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { AnchoredPortal, useAnchoredPopup } from \"./portal.js\";\n\nexport type MentionCandidate = Readonly<{\n id: string;\n label: string;\n /** Text inserted after the trigger character; defaults to `label`. */\n insertText?: string;\n description?: string;\n}>;\n\nexport type MentionsProps<TriggerId extends string = string> =\n Omit<TextAreaProps, \"value\" | \"defaultValue\" | \"onChange\" | \"children\"> &\n Readonly<{\n value: string;\n onValueChange: (value: string) => void;\n triggers: readonly MentionTriggerConfig<TriggerId>[];\n /** Candidates for the active query; the product owns filtering and loading. */\n candidates: readonly MentionCandidate[];\n /** Fires whenever the active trigger match changes, including to null. */\n onMentionQueryChange?: (match: MentionMatch<TriggerId> | null) => void;\n /** Localized message shown when the popup is open with no candidates. */\n emptyMessage: string;\n /** Localized accessible name for the candidate list. */\n listLabel: string;\n renderCandidate?: (candidate: MentionCandidate) => ReactNode;\n }>;\n\nexport const Mentions = forwardRef(function Mentions<TriggerId extends string = string>(\n {\n value,\n onValueChange,\n triggers,\n candidates,\n onMentionQueryChange,\n emptyMessage,\n listLabel,\n renderCandidate,\n className,\n // Inherited from TextAreaProps; taken here so placement moves the whole\n // mentions block (field + candidate popup anchor), not only the inner field.\n layoutStyle,\n ...textAreaProps\n }: MentionsProps<TriggerId>,\n forwardedRef: React.Ref<HTMLTextAreaElement>,\n) {\n const inputRef = useRef<HTMLTextAreaElement>(null);\n const [match, setMatch] = useState<MentionMatch<TriggerId> | null>(null);\n const [activeIndex, setActiveIndex] = useState(0);\n const [list, setList] = useState<HTMLDivElement | null>(null);\n const id = `${useId().replaceAll(\":\", \"\")}-mentions`;\n const unavailable = textAreaProps.disabled || textAreaProps.readOnly;\n const open = match !== null && !unavailable;\n const activeCandidate = candidates[Math.min(activeIndex, Math.max(candidates.length - 1, 0))];\n\n const notifyRef = useRef(onMentionQueryChange);\n notifyRef.current = onMentionQueryChange;\n useEffect(() => { notifyRef.current?.(match); }, [match]);\n\n const syncMatch = (text: string, cursor: number) => {\n // The contract owns trigger detection, including \"a space closes it\" and\n // \"the nearer trigger wins\"; this component only reports the cursor.\n const next = unavailable ? null : findActiveMentionTrigger(text, cursor, triggers);\n setMatch((previous) => (previous?.triggerStart === next?.triggerStart && previous?.query === next?.query ? previous : next));\n if (next === null || next.query !== match?.query) setActiveIndex(0);\n };\n const commit = (candidate: MentionCandidate) => {\n const input = inputRef.current;\n if (unavailable || !match || !input) return;\n const result = resolveMentionInsertion(value, match, input.selectionStart ?? value.length, candidate.insertText ?? candidate.label);\n onValueChange(result.text);\n setMatch(null);\n queueMicrotask(() => {\n input.focus();\n input.setSelectionRange(result.cursorPosition, result.cursorPosition);\n });\n };\n\n const onKeyDown = (event: KeyboardEvent<HTMLTextAreaElement>) => {\n if (!open || event.defaultPrevented || event.nativeEvent.isComposing || event.keyCode === 229) return;\n if (event.key === \"ArrowDown\" || event.key === \"ArrowUp\") {\n if (candidates.length === 0) return;\n event.preventDefault();\n setActiveIndex((previous) => {\n const next = event.key === \"ArrowDown\" ? previous + 1 : previous - 1;\n return (next + candidates.length) % candidates.length;\n });\n return;\n }\n if (event.key === \"Escape\") {\n // Dismissing the popup must not touch the text the user already typed.\n event.preventDefault();\n event.stopPropagation();\n setMatch(null);\n return;\n }\n if (event.key === \"Enter\" && activeCandidate && candidates.length > 0) {\n event.preventDefault();\n commit(activeCandidate);\n }\n };\n\n const position = useAnchoredPopup(inputRef, open ? list : null, {\n placement: \"bottom\", align: \"start\", matchAnchorWidth: true, zIndex: layer.dropdown,\n // The candidate list is Combobox's popover contract verbatim (mentions.ts), so its offset and edge padding are\n // comboboxRecipe.popover's 8/8. Until 2026-10-06 the helper defaults (8 and 16) applied, a Web-only 16 edge.\n gap: comboboxRecipe.popover.sideOffset,\n viewportPadding: comboboxRecipe.popover.collisionPadding,\n });\n\n return (\n <div className={classNames(\"hjm-mentions\", className)} style={layoutStyle}>\n <TextArea\n {...textAreaProps}\n ref={composeRefs(inputRef, forwardedRef)}\n value={value}\n role=\"combobox\"\n aria-expanded={open}\n aria-controls={open ? id : undefined}\n aria-autocomplete=\"list\"\n aria-activedescendant={open && activeCandidate ? `${id}-${activeCandidate.id}` : undefined}\n onChange={(event) => {\n onValueChange(event.target.value);\n syncMatch(event.target.value, event.target.selectionStart ?? event.target.value.length);\n }}\n onKeyUp={(event) => {\n // Caret moves without an edit (arrows, clicks) change which trigger is\n // active, so the match is re-read from the caret, not only from input.\n textAreaProps.onKeyUp?.(event);\n // Escape keyup must not reopen the token dismissed on keydown.\n if (event.defaultPrevented || event.key === \"Escape\" || event.nativeEvent.isComposing || event.keyCode === 229) return;\n if (open && (event.key === \"ArrowDown\" || event.key === \"ArrowUp\")) return;\n const input = event.currentTarget;\n syncMatch(input.value, input.selectionStart ?? input.value.length);\n }}\n onClick={(event) => {\n textAreaProps.onClick?.(event);\n if (event.defaultPrevented) return;\n const input = event.currentTarget;\n syncMatch(input.value, input.selectionStart ?? input.value.length);\n }}\n onBlur={(event) => { textAreaProps.onBlur?.(event); setMatch(null); }}\n onKeyDown={(event) => { textAreaProps.onKeyDown?.(event); onKeyDown(event); }}\n />\n {open ? (\n <AnchoredPortal anchorRef={inputRef}>\n <div\n ref={setList}\n id={id}\n role=\"listbox\"\n aria-label={listLabel}\n className=\"hjm-mentions__list\"\n style={position.style as CSSProperties}\n >\n {candidates.length === 0 ? (\n <p className=\"hjm-mentions__empty\" role=\"status\">{emptyMessage}</p>\n ) : candidates.map((candidate, index) => (\n <div\n key={candidate.id}\n id={`${id}-${candidate.id}`}\n role=\"option\"\n aria-selected={candidate.id === activeCandidate?.id}\n className=\"hjm-mentions__option\"\n // Pointer commit must not blur the textarea first, or the caret\n // position the insertion depends on would already be gone.\n onMouseDown={(event) => { event.preventDefault(); commit(candidate); }}\n onMouseEnter={() => setActiveIndex(index)}\n >\n {renderCandidate?.(candidate) ?? (\n <>\n <span>{candidate.label}</span>\n {candidate.description ? <span className=\"hjm-mentions__description\">{candidate.description}</span> : null}\n </>\n )}\n </div>\n ))}\n </div>\n </AnchoredPortal>\n ) : null}\n </div>\n );\n}) as <TriggerId extends string = string>(\n props: MentionsProps<TriggerId> & { ref?: React.Ref<HTMLTextAreaElement> },\n) => React.ReactElement | null;\n"]}
|
package/dist/menu-morph.js
CHANGED
|
@@ -75,7 +75,7 @@ export function MorphingMenu({ label, items, onAction, disabled = false, open: c
|
|
|
75
75
|
nodes[next]?.focus();
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
return _jsx("div", { ref: root, className: "hjm-menu-morph", style: layoutStyle, onKeyDownCapture: keyDown, children: _jsx(Bloom.Root, { direction: "bottom", open: open, onOpenChange: change, modal: false, children: _jsxs(Bloom.Container, { buttonSize: { width: 160, height: 44 }, menuWidth: 240, style: { background: theme.palette.theme.bg, color: theme.palette.theme.text }, children: [_jsx(Bloom.Trigger, { disabled: disabled, children: label }), _jsx(Bloom.Content, { children: items.map(item => _jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, className: "hjm-menu-morph__item", disabled: !open || (item.disabled ?? false), "data-tone": item.tone, "aria-label": item.textValue, onClick: () => { if (!item.disabled) {
|
|
78
|
+
return _jsx("div", { ref: root, className: "hjm-menu-morph", style: layoutStyle, onKeyDownCapture: keyDown, children: _jsx(Bloom.Root, { direction: "bottom", open: open, onOpenChange: change, modal: false, children: _jsxs(Bloom.Container, { buttonSize: { width: 160, height: 44 }, menuWidth: 240, style: { background: theme.palette.theme.bg, color: theme.palette.theme.text }, children: [_jsx(Bloom.Trigger, { disabled: disabled, children: label }), _jsx(Bloom.Content, { children: items.map(item => _jsxs("button", { type: "button", role: "menuitem", tabIndex: -1, className: "hjm-menu-morph__item", disabled: !open || disabled || (item.disabled ?? false), "data-tone": item.tone, "aria-label": item.textValue, onClick: () => { if (!disabled && !item.disabled) {
|
|
79
79
|
change(false);
|
|
80
80
|
onAction?.(item.id);
|
|
81
81
|
} }, children: [item.leading, item.label, item.trailing] }, item.id)) })] }) }) });
|
package/dist/menu-morph.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu-morph.js","sourceRoot":"","sources":["../src/menu-morph.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qB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I,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gCAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gCAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;4BAAC,CAAC,CAAC,CAAC,aAC7E,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,KAHmE,IAAI,CAAC,EAAE,CAI3G,CAAC,GACI,IACA,GACP,GACT,CAAC;AACT,CAAC","sourcesContent":["import { resolveMenuTypeahead } from \"./menu-typeahead.js\";\nimport { Menu as Bloom } from \"bloom-menu\";\nimport { useEffect, useRef, useState, type KeyboardEvent } from \"react\";\nimport { Button } from \"./actions.js\";\nimport { Menu, type MenuItem } from \"./overlays.js\";\nimport { useHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type MorphingMenuProps = {\n label: string;\n items: readonly MenuItem[];\n onAction?: (id: string) => void;\n disabled?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Canonical layout-only placement. Applied to the morph root, or to the\n * canonical Menu's wrapper when reduced motion/RTL falls back to it, so\n * placement survives the switch.\n */\n layoutStyle?: HjmCompositionStyleProp;\n};\n\n/** Action-only morph presentation. Selection/async menus retain the full Menu. */\nexport function MorphingMenu({ label, items, onAction, disabled = false, open: controlled, onOpenChange, layoutStyle }: MorphingMenuProps) {\n const theme = useHjmTheme();\n const [localOpen, setLocalOpen] = useState(false);\n const open = controlled ?? localOpen;\n const root = useRef<HTMLDivElement>(null);\n const previousOpen = useRef(false);\n const restoreFocus = useRef(true);\n const search = useRef({ value: \"\", time: 0 });\n const change = (value: boolean) => { if (value) restoreFocus.current = true; setLocalOpen(value); onOpenChange?.(value); };\n if (!label.trim() || !items.length || new Set(items.map(item => item.id)).size !== items.length ||\n items.some(item => !item.id.trim() || !(item.textValue ?? (typeof item.label === \"string\" ? item.label : \"\")).trim())) {\n throw new TypeError(\"MorphingMenu needs a label and unique, named items\");\n }\n useEffect(() => {\n const host = root.current;\n if (open) {\n search.current = { value: \"\", time: 0 };\n host?.querySelector('[role=\"menu\"]')?.setAttribute(\"aria-label\", label);\n host?.querySelector<HTMLElement>('[role=\"menuitem\"]:not([disabled])')?.focus();\n } else if (previousOpen.current && restoreFocus.current && (host?.contains(document.activeElement) || document.activeElement === document.body)) host?.querySelector<HTMLElement>('[role=\"button\"]')?.focus();\n previousOpen.current = open;\n }, [open, label]);\n // The canonical Menu owns static/RTL behavior; Bloom's left/right geometry is physical.\n if (theme.environment.reducedMotion || theme.environment.direction === \"rtl\") {\n return <Menu label={label} trigger={<Button tone=\"secondary\">{label}</Button>} items={items} disabled={disabled} open={open}\n {...(layoutStyle === undefined ? {} : { layoutStyle })} onOpenChange={change} {...(onAction ? { onAction } : {})} />;\n }\n const keyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!open) {\n if (!disabled && [\"ArrowDown\", \"ArrowUp\"].includes(event.key)) { event.preventDefault(); event.stopPropagation(); change(true); }\n return;\n }\n const nodes = Array.from(root.current?.querySelectorAll<HTMLElement>('[role=\"menuitem\"]:not([disabled])') ?? []);\n const index = nodes.indexOf(document.activeElement as HTMLElement);\n let next: number | undefined;\n if (event.key === \"ArrowDown\") next = (index + 1) % nodes.length;\n if (event.key === \"ArrowUp\") next = (index - 1 + nodes.length) % nodes.length;\n if (event.key === \"Home\") next = 0;\n if (event.key === \"End\") next = nodes.length - 1;\n if (event.key === \"Escape\" || event.key === \"Tab\") { if (event.key === \"Tab\") restoreFocus.current = false; change(false); if (event.key === \"Escape\") event.preventDefault(); }\n if (event.key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey && event.key !== \" \") {\n const result = resolveMenuTypeahead(\n items.filter(item => !item.disabled).map(item => ({\n textValue: item.textValue ?? (typeof item.label === \"string\" ? item.label : \"\"),\n })), index, event.key, search.current, Date.now(),\n );\n search.current = result.state;\n next = result.index;\n }\n if (next !== undefined && next >= 0) { event.preventDefault(); event.stopPropagation(); nodes[next]?.focus(); }\n };\n return <div ref={root} className=\"hjm-menu-morph\" style={layoutStyle} onKeyDownCapture={keyDown}>\n {/* Open toward following content; upstream defaults upward and can cover preceding values. */}\n <Bloom.Root direction=\"bottom\" open={open} onOpenChange={change} modal={false}>\n <Bloom.Container buttonSize={{ width: 160, height: 44 }} menuWidth={240}\n style={{ background: theme.palette.theme.bg, color: theme.palette.theme.text }}>\n <Bloom.Trigger disabled={disabled}>{label}</Bloom.Trigger>\n <Bloom.Content>\n {items.map(item => <button type=\"button\" role=\"menuitem\" tabIndex={-1} className=\"hjm-menu-morph__item\" key={item.id} disabled={!open || (item.disabled ?? false)}\n data-tone={item.tone} aria-label={item.textValue}\n onClick={() => { if (!item.disabled) { change(false); onAction?.(item.id); } }}>\n {item.leading}{item.label}{item.trailing}\n </button>)}\n </Bloom.Content>\n </Bloom.Container>\n </Bloom.Root>\n </div>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"menu-morph.js","sourceRoot":"","sources":["../src/menu-morph.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,IAAI,EAAiB,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAkB5C,kFAAkF;AAClF,MAAM,UAAU,YAAY,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAqB;IACvI,MAAM,KAAK,GAAG,WAAW,EAAE,CAAC;IAC5B,MAAM,CAAC,SAAS,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AAC,KAAK,CAAC,SAAS,IAAC,UAAU,EAAE,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,SAAS,EAAE,GAAG,EACrE,KAAK,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,aAC9E,KAAC,KAAK,CAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,YAAG,KAAK,GAAiB,EAC1D,KAAC,KAAK,CAAC,OAAO,cACX,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,kBAAQ,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,UAAU,EAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,SAAS,EAAC,sBAAsB,EAAe,QAAQ,EAAE,CAAC,IAAI,IAAI,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,KAAK,CAAC,eAChK,IAAI,CAAC,IAAI,gBAAc,IAAI,CAAC,SAAS,EAChD,OAAO,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gCAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gCAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;4BAAC,CAAC,CAAC,CAAC,aAC1F,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,QAAQ,KAHmE,IAAI,CAAC,EAAE,CAI3G,CAAC,GACI,IACA,GACP,GACT,CAAC;AACT,CAAC","sourcesContent":["import { resolveMenuTypeahead } from \"./menu-typeahead.js\";\nimport { Menu as Bloom } from \"bloom-menu\";\nimport { useEffect, useRef, useState, type KeyboardEvent } from \"react\";\nimport { Button } from \"./actions.js\";\nimport { Menu, type MenuItem } from \"./overlays.js\";\nimport { useHjmTheme } from \"./provider.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type MorphingMenuProps = {\n label: string;\n items: readonly MenuItem[];\n onAction?: (id: string) => void;\n disabled?: boolean;\n open?: boolean;\n onOpenChange?: (open: boolean) => void;\n /**\n * Canonical layout-only placement. Applied to the morph root, or to the\n * canonical Menu's wrapper when reduced motion/RTL falls back to it, so\n * placement survives the switch.\n */\n layoutStyle?: HjmCompositionStyleProp;\n};\n\n/** Action-only morph presentation. Selection/async menus retain the full Menu. */\nexport function MorphingMenu({ label, items, onAction, disabled = false, open: controlled, onOpenChange, layoutStyle }: MorphingMenuProps) {\n const theme = useHjmTheme();\n const [localOpen, setLocalOpen] = useState(false);\n const open = controlled ?? localOpen;\n const root = useRef<HTMLDivElement>(null);\n const previousOpen = useRef(false);\n const restoreFocus = useRef(true);\n const search = useRef({ value: \"\", time: 0 });\n const change = (value: boolean) => { if (value) restoreFocus.current = true; setLocalOpen(value); onOpenChange?.(value); };\n if (!label.trim() || !items.length || new Set(items.map(item => item.id)).size !== items.length ||\n items.some(item => !item.id.trim() || !(item.textValue ?? (typeof item.label === \"string\" ? item.label : \"\")).trim())) {\n throw new TypeError(\"MorphingMenu needs a label and unique, named items\");\n }\n useEffect(() => {\n const host = root.current;\n if (open) {\n search.current = { value: \"\", time: 0 };\n host?.querySelector('[role=\"menu\"]')?.setAttribute(\"aria-label\", label);\n host?.querySelector<HTMLElement>('[role=\"menuitem\"]:not([disabled])')?.focus();\n } else if (previousOpen.current && restoreFocus.current && (host?.contains(document.activeElement) || document.activeElement === document.body)) host?.querySelector<HTMLElement>('[role=\"button\"]')?.focus();\n previousOpen.current = open;\n }, [open, label]);\n // The canonical Menu owns static/RTL behavior; Bloom's left/right geometry is physical.\n if (theme.environment.reducedMotion || theme.environment.direction === \"rtl\") {\n return <Menu label={label} trigger={<Button tone=\"secondary\">{label}</Button>} items={items} disabled={disabled} open={open}\n {...(layoutStyle === undefined ? {} : { layoutStyle })} onOpenChange={change} {...(onAction ? { onAction } : {})} />;\n }\n const keyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n if (!open) {\n if (!disabled && [\"ArrowDown\", \"ArrowUp\"].includes(event.key)) { event.preventDefault(); event.stopPropagation(); change(true); }\n return;\n }\n const nodes = Array.from(root.current?.querySelectorAll<HTMLElement>('[role=\"menuitem\"]:not([disabled])') ?? []);\n const index = nodes.indexOf(document.activeElement as HTMLElement);\n let next: number | undefined;\n if (event.key === \"ArrowDown\") next = (index + 1) % nodes.length;\n if (event.key === \"ArrowUp\") next = (index - 1 + nodes.length) % nodes.length;\n if (event.key === \"Home\") next = 0;\n if (event.key === \"End\") next = nodes.length - 1;\n if (event.key === \"Escape\" || event.key === \"Tab\") { if (event.key === \"Tab\") restoreFocus.current = false; change(false); if (event.key === \"Escape\") event.preventDefault(); }\n if (event.key.length === 1 && !event.altKey && !event.ctrlKey && !event.metaKey && event.key !== \" \") {\n const result = resolveMenuTypeahead(\n items.filter(item => !item.disabled).map(item => ({\n textValue: item.textValue ?? (typeof item.label === \"string\" ? item.label : \"\"),\n })), index, event.key, search.current, Date.now(),\n );\n search.current = result.state;\n next = result.index;\n }\n if (next !== undefined && next >= 0) { event.preventDefault(); event.stopPropagation(); nodes[next]?.focus(); }\n };\n return <div ref={root} className=\"hjm-menu-morph\" style={layoutStyle} onKeyDownCapture={keyDown}>\n {/* Open toward following content; upstream defaults upward and can cover preceding values. */}\n <Bloom.Root direction=\"bottom\" open={open} onOpenChange={change} modal={false}>\n <Bloom.Container buttonSize={{ width: 160, height: 44 }} menuWidth={240}\n style={{ background: theme.palette.theme.bg, color: theme.palette.theme.text }}>\n <Bloom.Trigger disabled={disabled}>{label}</Bloom.Trigger>\n <Bloom.Content>\n {items.map(item => <button type=\"button\" role=\"menuitem\" tabIndex={-1} className=\"hjm-menu-morph__item\" key={item.id} disabled={!open || disabled || (item.disabled ?? false)}\n data-tone={item.tone} aria-label={item.textValue}\n onClick={() => { if (!disabled && !item.disabled) { change(false); onAction?.(item.id); } }}>\n {item.leading}{item.label}{item.trailing}\n </button>)}\n </Bloom.Content>\n </Bloom.Container>\n </Bloom.Root>\n </div>;\n}\n"]}
|