@hjmds/react 1.12.1 → 1.13.1
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/actions.d.ts +4 -0
- package/dist/actions.d.ts.map +1 -1
- package/dist/actions.js +4 -1
- package/dist/actions.js.map +1 -1
- package/dist/activity-heatmap.d.ts +4 -1
- package/dist/activity-heatmap.d.ts.map +1 -1
- package/dist/activity-heatmap.js +1 -1
- package/dist/activity-heatmap.js.map +1 -1
- package/dist/advanced-display.d.ts +31 -3
- package/dist/advanced-display.d.ts.map +1 -1
- package/dist/advanced-display.js +26 -27
- package/dist/advanced-display.js.map +1 -1
- package/dist/advanced-forms.d.ts +27 -2
- package/dist/advanced-forms.d.ts.map +1 -1
- package/dist/advanced-forms.js +11 -7
- package/dist/advanced-forms.js.map +1 -1
- package/dist/affix.d.ts +4 -1
- package/dist/affix.d.ts.map +1 -1
- package/dist/affix.js +2 -2
- package/dist/affix.js.map +1 -1
- package/dist/agreement.d.ts +3 -0
- package/dist/agreement.d.ts.map +1 -1
- package/dist/agreement.js +14 -3
- package/dist/agreement.js.map +1 -1
- package/dist/anchor.d.ts +5 -0
- package/dist/anchor.d.ts.map +1 -1
- package/dist/anchor.js +2 -2
- package/dist/anchor.js.map +1 -1
- package/dist/asset.d.ts +8 -1
- package/dist/asset.d.ts.map +1 -1
- package/dist/asset.js +4 -4
- package/dist/asset.js.map +1 -1
- package/dist/auth-screen.d.ts +5 -0
- package/dist/auth-screen.d.ts.map +1 -1
- package/dist/auth-screen.js +2 -1
- package/dist/auth-screen.js.map +1 -1
- package/dist/bottom-cta.d.ts +5 -0
- package/dist/bottom-cta.d.ts.map +1 -1
- package/dist/bottom-cta.js +2 -2
- package/dist/bottom-cta.js.map +1 -1
- package/dist/bottom-info.d.ts +5 -0
- package/dist/bottom-info.d.ts.map +1 -1
- package/dist/bottom-info.js +2 -2
- package/dist/bottom-info.js.map +1 -1
- package/dist/bottom-navigation.d.ts +3 -0
- package/dist/bottom-navigation.d.ts.map +1 -1
- package/dist/bottom-navigation.js +2 -1
- package/dist/bottom-navigation.js.map +1 -1
- package/dist/breadcrumb.d.ts +3 -0
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +2 -2
- package/dist/breadcrumb.js.map +1 -1
- package/dist/calendar.d.ts +4 -1
- package/dist/calendar.d.ts.map +1 -1
- package/dist/calendar.js +2 -2
- package/dist/calendar.js.map +1 -1
- package/dist/carousel-motion.d.ts +3 -0
- package/dist/carousel-motion.d.ts.map +1 -1
- package/dist/carousel-motion.js +1 -1
- package/dist/carousel-motion.js.map +1 -1
- package/dist/carousel.d.ts +3 -0
- package/dist/carousel.d.ts.map +1 -1
- package/dist/carousel.js +2 -2
- package/dist/carousel.js.map +1 -1
- package/dist/celebration.d.ts.map +1 -1
- package/dist/celebration.js.map +1 -1
- package/dist/clipboard.d.ts.map +1 -1
- package/dist/clipboard.js +6 -2
- package/dist/clipboard.js.map +1 -1
- package/dist/code-block.d.ts +4 -1
- package/dist/code-block.d.ts.map +1 -1
- package/dist/code-block.js +1 -1
- package/dist/code-block.js.map +1 -1
- package/dist/collapsible.d.ts +3 -0
- package/dist/collapsible.d.ts.map +1 -1
- package/dist/collapsible.js +2 -2
- package/dist/collapsible.js.map +1 -1
- package/dist/color-picker.d.ts +4 -1
- package/dist/color-picker.d.ts.map +1 -1
- package/dist/color-picker.js +2 -2
- package/dist/color-picker.js.map +1 -1
- package/dist/command-palette.d.ts +6 -0
- package/dist/command-palette.d.ts.map +1 -1
- package/dist/command-palette.js +49 -15
- package/dist/command-palette.js.map +1 -1
- package/dist/composition-style.d.ts +14 -1
- package/dist/composition-style.d.ts.map +1 -1
- package/dist/composition-style.js.map +1 -1
- package/dist/content-transition.d.ts +6 -2
- package/dist/content-transition.d.ts.map +1 -1
- package/dist/content-transition.js +4 -4
- package/dist/content-transition.js.map +1 -1
- package/dist/context-menu.d.ts +4 -1
- package/dist/context-menu.d.ts.map +1 -1
- package/dist/context-menu.js +2 -2
- package/dist/context-menu.js.map +1 -1
- package/dist/data-table.d.ts +3 -0
- package/dist/data-table.d.ts.map +1 -1
- package/dist/data-table.js +31 -11
- package/dist/data-table.js.map +1 -1
- package/dist/date-picker.d.ts +4 -1
- package/dist/date-picker.d.ts.map +1 -1
- package/dist/date-picker.js +2 -2
- package/dist/date-picker.js.map +1 -1
- package/dist/date-range.d.ts +4 -1
- package/dist/date-range.d.ts.map +1 -1
- package/dist/date-range.js +2 -2
- package/dist/date-range.js.map +1 -1
- package/dist/display.d.ts +4 -0
- package/dist/display.d.ts.map +1 -1
- package/dist/display.js.map +1 -1
- package/dist/duration-field.d.ts +4 -2
- package/dist/duration-field.d.ts.map +1 -1
- package/dist/duration-field.js +2 -2
- package/dist/duration-field.js.map +1 -1
- package/dist/effect-surface.d.ts +4 -2
- package/dist/effect-surface.d.ts.map +1 -1
- package/dist/effect-surface.js +2 -2
- package/dist/effect-surface.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 +24 -13
- package/dist/feedback.d.ts.map +1 -1
- package/dist/feedback.js +17 -15
- package/dist/feedback.js.map +1 -1
- package/dist/file-picker.d.ts +5 -0
- package/dist/file-picker.d.ts.map +1 -1
- package/dist/file-picker.js +2 -2
- package/dist/file-picker.js.map +1 -1
- package/dist/floating-action-button.d.ts.map +1 -1
- package/dist/floating-action-button.js.map +1 -1
- package/dist/folder-preview.d.ts +4 -1
- package/dist/folder-preview.d.ts.map +1 -1
- package/dist/folder-preview.js +2 -2
- package/dist/folder-preview.js.map +1 -1
- package/dist/forms.d.ts +35 -3
- package/dist/forms.d.ts.map +1 -1
- package/dist/forms.js +55 -36
- package/dist/forms.js.map +1 -1
- package/dist/gravity-letters.d.ts +4 -2
- package/dist/gravity-letters.d.ts.map +1 -1
- package/dist/gravity-letters.js +2 -2
- package/dist/gravity-letters.js.map +1 -1
- package/dist/grid-reveal.d.ts +4 -2
- package/dist/grid-reveal.d.ts.map +1 -1
- package/dist/grid-reveal.js +2 -2
- package/dist/grid-reveal.js.map +1 -1
- package/dist/heading.d.ts +5 -0
- package/dist/heading.d.ts.map +1 -1
- package/dist/heading.js +8 -1
- package/dist/heading.js.map +1 -1
- package/dist/inline-confirm.d.ts +3 -0
- package/dist/inline-confirm.d.ts.map +1 -1
- package/dist/inline-confirm.js +3 -3
- package/dist/inline-confirm.js.map +1 -1
- package/dist/internal/message-reactions.d.ts +16 -0
- package/dist/internal/message-reactions.d.ts.map +1 -0
- package/dist/internal/message-reactions.js +42 -0
- package/dist/internal/message-reactions.js.map +1 -0
- package/dist/internal/spinner.d.ts +18 -0
- package/dist/internal/spinner.d.ts.map +1 -0
- package/dist/internal/spinner.js +10 -0
- package/dist/internal/spinner.js.map +1 -0
- package/dist/layout.d.ts +12 -0
- package/dist/layout.d.ts.map +1 -1
- package/dist/layout.js +6 -6
- package/dist/layout.js.map +1 -1
- package/dist/masonry.d.ts +4 -1
- package/dist/masonry.d.ts.map +1 -1
- package/dist/masonry.js +5 -3
- package/dist/masonry.js.map +1 -1
- package/dist/mentions.d.ts.map +1 -1
- package/dist/mentions.js +12 -3
- package/dist/mentions.js.map +1 -1
- package/dist/menu-morph.d.ts +8 -1
- package/dist/menu-morph.d.ts.map +1 -1
- package/dist/menu-morph.js +3 -3
- package/dist/menu-morph.js.map +1 -1
- package/dist/menubar.d.ts +4 -1
- package/dist/menubar.d.ts.map +1 -1
- package/dist/menubar.js +4 -3
- package/dist/menubar.js.map +1 -1
- package/dist/modal.d.ts.map +1 -1
- package/dist/modal.js +4 -1
- package/dist/modal.js.map +1 -1
- package/dist/navigation-bar.d.ts +4 -1
- package/dist/navigation-bar.d.ts.map +1 -1
- package/dist/navigation-bar.js +2 -2
- package/dist/navigation-bar.js.map +1 -1
- package/dist/navigation.d.ts +5 -0
- package/dist/navigation.d.ts.map +1 -1
- package/dist/navigation.js +6 -6
- package/dist/navigation.js.map +1 -1
- package/dist/notification-bell.d.ts +4 -1
- package/dist/notification-bell.d.ts.map +1 -1
- package/dist/notification-bell.js +5 -3
- package/dist/notification-bell.js.map +1 -1
- package/dist/number-field.d.ts +11 -0
- package/dist/number-field.d.ts.map +1 -1
- package/dist/number-field.js +8 -3
- package/dist/number-field.js.map +1 -1
- package/dist/overlay-stack.d.ts.map +1 -1
- package/dist/overlay-stack.js.map +1 -1
- package/dist/overlays.d.ts +5 -0
- package/dist/overlays.d.ts.map +1 -1
- package/dist/overlays.js +35 -11
- package/dist/overlays.js.map +1 -1
- package/dist/pagination.d.ts +5 -0
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +2 -2
- package/dist/pagination.js.map +1 -1
- package/dist/popover.d.ts.map +1 -1
- package/dist/popover.js +5 -4
- package/dist/popover.js.map +1 -1
- package/dist/portal.d.ts.map +1 -1
- package/dist/portal.js +2 -1
- package/dist/portal.js.map +1 -1
- package/dist/provider-button.d.ts +5 -0
- package/dist/provider-button.d.ts.map +1 -1
- package/dist/provider-button.js +2 -2
- package/dist/provider-button.js.map +1 -1
- package/dist/provider.d.ts.map +1 -1
- package/dist/provider.js.map +1 -1
- package/dist/qr-code.d.ts +4 -1
- package/dist/qr-code.d.ts.map +1 -1
- package/dist/qr-code.js +2 -2
- package/dist/qr-code.js.map +1 -1
- package/dist/reaction-picker.d.ts +6 -2
- package/dist/reaction-picker.d.ts.map +1 -1
- package/dist/reaction-picker.js +20 -4
- package/dist/reaction-picker.js.map +1 -1
- package/dist/saved-items.d.ts +33 -0
- package/dist/saved-items.d.ts.map +1 -0
- package/dist/saved-items.js +19 -0
- package/dist/saved-items.js.map +1 -0
- package/dist/screen-flows.d.ts +326 -0
- package/dist/screen-flows.d.ts.map +1 -0
- package/dist/screen-flows.js +222 -0
- package/dist/screen-flows.js.map +1 -0
- package/dist/screens.d.ts +120 -0
- package/dist/screens.d.ts.map +1 -0
- package/dist/screens.js +66 -0
- package/dist/screens.js.map +1 -0
- package/dist/select.d.ts +6 -0
- package/dist/select.d.ts.map +1 -1
- package/dist/select.js +13 -3
- package/dist/select.js.map +1 -1
- package/dist/selection.d.ts +28 -1
- package/dist/selection.d.ts.map +1 -1
- package/dist/selection.js +12 -12
- package/dist/selection.js.map +1 -1
- package/dist/side-panel.d.ts.map +1 -1
- package/dist/side-panel.js.map +1 -1
- package/dist/sidebar.d.ts +3 -0
- package/dist/sidebar.d.ts.map +1 -1
- package/dist/sidebar.js +2 -2
- package/dist/sidebar.js.map +1 -1
- package/dist/skip-nav.d.ts.map +1 -1
- package/dist/skip-nav.js.map +1 -1
- package/dist/slider.d.ts +5 -0
- package/dist/slider.d.ts.map +1 -1
- package/dist/slider.js +2 -1
- package/dist/slider.js.map +1 -1
- package/dist/sortable.d.ts +3 -0
- package/dist/sortable.d.ts.map +1 -1
- package/dist/sortable.js +1 -1
- package/dist/sortable.js.map +1 -1
- package/dist/splitter.d.ts +5 -0
- package/dist/splitter.d.ts.map +1 -1
- package/dist/splitter.js +28 -3
- package/dist/splitter.js.map +1 -1
- package/dist/step-player.d.ts +4 -1
- package/dist/step-player.d.ts.map +1 -1
- package/dist/step-player.js +2 -2
- package/dist/step-player.js.map +1 -1
- package/dist/steps.d.ts +5 -0
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +2 -2
- package/dist/steps.js.map +1 -1
- package/dist/styles.css +256 -70
- package/dist/styles.layered.css +256 -70
- package/dist/supplemental-display.d.ts +4 -0
- package/dist/supplemental-display.d.ts.map +1 -1
- package/dist/supplemental-display.js +7 -4
- package/dist/supplemental-display.js.map +1 -1
- package/dist/supplemental-navigation.d.ts +5 -0
- package/dist/supplemental-navigation.d.ts.map +1 -1
- package/dist/supplemental-navigation.js +2 -2
- package/dist/supplemental-navigation.js.map +1 -1
- package/dist/swipe-actions.d.ts +4 -1
- package/dist/swipe-actions.d.ts.map +1 -1
- package/dist/swipe-actions.js +2 -2
- package/dist/swipe-actions.js.map +1 -1
- package/dist/tags-input.d.ts +5 -0
- package/dist/tags-input.d.ts.map +1 -1
- package/dist/tags-input.js +2 -2
- package/dist/tags-input.js.map +1 -1
- package/dist/task-list.d.ts +4 -1
- package/dist/task-list.d.ts.map +1 -1
- package/dist/task-list.js +3 -3
- package/dist/task-list.js.map +1 -1
- package/dist/text-formats.d.ts +5 -0
- package/dist/text-formats.d.ts.map +1 -1
- package/dist/text-formats.js +2 -1
- package/dist/text-formats.js.map +1 -1
- package/dist/theme.d.ts.map +1 -1
- package/dist/theme.js +22 -2
- package/dist/theme.js.map +1 -1
- package/dist/thinking-orb.d.ts +4 -1
- package/dist/thinking-orb.d.ts.map +1 -1
- package/dist/thinking-orb.js +2 -2
- package/dist/thinking-orb.js.map +1 -1
- package/dist/toast.d.ts.map +1 -1
- package/dist/toast.js +10 -4
- package/dist/toast.js.map +1 -1
- package/dist/toggle-group.d.ts +3 -0
- package/dist/toggle-group.d.ts.map +1 -1
- package/dist/toggle-group.js +2 -1
- package/dist/toggle-group.js.map +1 -1
- package/dist/top-bar.d.ts +5 -0
- package/dist/top-bar.d.ts.map +1 -1
- package/dist/top-bar.js +2 -2
- package/dist/top-bar.js.map +1 -1
- package/dist/top.d.ts +5 -0
- package/dist/top.d.ts.map +1 -1
- package/dist/top.js +2 -2
- package/dist/top.js.map +1 -1
- package/dist/tour.d.ts.map +1 -1
- package/dist/tour.js +3 -2
- package/dist/tour.js.map +1 -1
- package/dist/transfer-list.d.ts +3 -0
- package/dist/transfer-list.d.ts.map +1 -1
- package/dist/transfer-list.js +2 -2
- package/dist/transfer-list.js.map +1 -1
- package/dist/tree.d.ts +3 -0
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +17 -5
- package/dist/tree.js.map +1 -1
- package/dist/upload-item.d.ts +5 -0
- package/dist/upload-item.d.ts.map +1 -1
- package/dist/upload-item.js +2 -2
- package/dist/upload-item.js.map +1 -1
- package/dist/virtual-list.d.ts +4 -1
- package/dist/virtual-list.d.ts.map +1 -1
- package/dist/virtual-list.js +2 -2
- package/dist/virtual-list.js.map +1 -1
- package/dist/voice-note.d.ts +4 -1
- package/dist/voice-note.d.ts.map +1 -1
- package/dist/voice-note.js +2 -2
- package/dist/voice-note.js.map +1 -1
- package/dist/watermark.d.ts +4 -1
- package/dist/watermark.d.ts.map +1 -1
- package/dist/watermark.js +2 -2
- package/dist/watermark.js.map +1 -1
- package/package.json +18 -3
package/dist/celebration.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"celebration.js","sourceRoot":"","sources":["../src/celebration.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAA0B,MAAM,yDAAyD,CAAC;AACxJ,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"celebration.js","sourceRoot":"","sources":["../src/celebration.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAA0B,MAAM,yDAAyD,CAAC;AACxJ,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,UAAU,WAAW,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa,EAAE,UAAU,EAAoB;IAC3F,eAAe,CAAC,OAAO,CAAC,CAAC;IACzB,MAAM,MAAM,GAAG,MAAM,CAAoB,IAAI,CAAC,CAAC;IAC/C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,GAAG,EAAU,CAAC,CAAC;IACvC,MAAM,EAAE,WAAW,EAAE,OAAO,EAAE,GAAG,WAAW,EAAE,CAAC;IAC/C,MAAM,MAAM,GAAG,MAAM,CAAC,EAA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C;AAC3I,CAAC","sourcesContent":["import { useEffect, useRef } from \"react\";\nimport confetti from \"canvas-confetti\";\nimport { celebrationColors, celebrationRecipe, validateEventId, type CelebrationPreset } from \"@hjmds/design-contracts/components/interaction-adapters\";\nimport { useHjmTheme } from \"./provider.js\";\n\n// No `layoutStyle`: a full-viewport, pointer-transparent effect layer.\nexport type CelebrationProps = { eventId: string; preset?: CelebrationPreset; onComplete?(): void };\nexport function Celebration({ eventId, preset = \"small-burst\", onComplete }: CelebrationProps) {\n validateEventId(eventId);\n const canvas = useRef<HTMLCanvasElement>(null);\n const seen = useRef(new Set<string>());\n const { environment, palette } = useHjmTheme();\n const latest = useRef({ preset, onComplete, environment, palette }); latest.current = { preset, onComplete, environment, palette };\n const stop = useRef<() => void>(() => {});\n useEffect(() => {\n let disposed = false; let done = false; let started = false;\n let fire: ReturnType<typeof confetti.create> | undefined;\n let timer: ReturnType<typeof setTimeout> | undefined;\n const finish = () => { fire?.reset(); if (!disposed && !done && started) { done = true; latest.current.onComplete?.(); } };\n stop.current = finish;\n // Wait until after Strict Mode's probe cleanup before consuming an event.\n queueMicrotask(() => {\n if (disposed || seen.current.has(eventId)) return;\n seen.current.add(eventId); started = true;\n const current = latest.current;\n if (current.environment.reducedMotion || document.hidden) { finish(); return; }\n fire = confetti.create(canvas.current!, { resize: true, disableForReducedMotion: true });\n // A private canvas avoids cancelling another screen's animation on cleanup.\n void fire({ particleCount: celebrationRecipe[current.preset].count,\n colors: celebrationColors(current.palette.theme.primary, current.palette.statusAccents), origin: { y: 0.7 } });\n timer = setTimeout(finish, celebrationRecipe[current.preset].duration);\n });\n const visibility = () => { if (document.hidden) finish(); };\n document.addEventListener(\"visibilitychange\", visibility);\n return () => { disposed = true; clearTimeout(timer); document.removeEventListener(\"visibilitychange\", visibility); fire?.reset(); };\n }, [eventId]);\n useEffect(() => { if (environment.reducedMotion) stop.current(); }, [environment.reducedMotion]);\n return <canvas ref={canvas} aria-hidden style={{ position: \"fixed\", inset: 0, width: \"100%\", height: \"100%\", pointerEvents: \"none\" }} />;\n}\n"]}
|
package/dist/clipboard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAKxD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC,GACrF,QAAQ,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,MAAM,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACzD,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC,CAAC;AAIL;;;;;GAKG;AACH,eAAO,MAAM,eAAe;WAjBjB,MAAM;IACb,oEAAoE;YAC5D,QAAQ,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,CAAC;IACxD,8CAA8C;uBAC3B,MAAM;aAChB,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;kBAClB,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;
|
|
1
|
+
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAwD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAKxD,MAAM,MAAM,oBAAoB,GAAG,IAAI,CAAC,WAAW,EAAE,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAC,GACrF,QAAQ,CAAC;IACP,KAAK,EAAE,MAAM,CAAC;IACd,oEAAoE;IACpE,MAAM,EAAE,QAAQ,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,CAAC,CAAC;IACzD,8CAA8C;IAC9C,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CACxC,CAAC,CAAC;AAIL;;;;;GAKG;AACH,eAAO,MAAM,eAAe;WAjBjB,MAAM;IACb,oEAAoE;YAC5D,QAAQ,CAAC;QAAE,IAAI,EAAE,SAAS,CAAC;QAAC,MAAM,EAAE,SAAS,CAAA;KAAE,CAAC;IACxD,8CAA8C;uBAC3B,MAAM;aAChB,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI;kBAClB,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI;sDAqDzC,CAAC"}
|
package/dist/clipboard.js
CHANGED
|
@@ -8,7 +8,11 @@ const defaultFeedbackDuration = 2000;
|
|
|
8
8
|
* The last one is the part that was always missing — a label that only changes
|
|
9
9
|
* visually tells a non-sighted user nothing happened.
|
|
10
10
|
*/
|
|
11
|
-
export const ClipboardButton = forwardRef(function ClipboardButton(
|
|
11
|
+
export const ClipboardButton = forwardRef(function ClipboardButton(
|
|
12
|
+
// Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the
|
|
13
|
+
// inherited Button default `primary` added a second primary to screens that already had one.
|
|
14
|
+
// Pass `tone="primary"` explicitly when copying *is* the screen's main action.
|
|
15
|
+
{ value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = "secondary", ...props }, forwardedRef) {
|
|
12
16
|
const [copied, setCopied] = useState(false);
|
|
13
17
|
const timer = useRef(undefined);
|
|
14
18
|
useEffect(() => () => { if (timer.current !== undefined)
|
|
@@ -35,6 +39,6 @@ export const ClipboardButton = forwardRef(function ClipboardButton({ value, labe
|
|
|
35
39
|
onCopyError?.(error);
|
|
36
40
|
}
|
|
37
41
|
}, [value, feedbackDuration, onCopy, onCopyError]);
|
|
38
|
-
return (_jsxs(_Fragment, { children: [_jsx(Button, { ...props, ref: forwardedRef, onClick: () => { void copy(); }, children: copied ? labels.copied : labels.idle }), _jsx("span", { role: "status", className: "hjm-visually-hidden", children: copied ? labels.copied : "" })] }));
|
|
42
|
+
return (_jsxs(_Fragment, { children: [_jsx(Button, { ...props, tone: tone, ref: forwardedRef, onClick: () => { void copy(); }, children: copied ? labels.copied : labels.idle }), _jsx("span", { role: "status", className: "hjm-visually-hidden", children: copied ? labels.copied : "" })] }));
|
|
39
43
|
});
|
|
40
44
|
//# sourceMappingURL=clipboard.js.map
|
package/dist/clipboard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AAgBxD,MAAM,uBAAuB,GAAG,IAAI,CAAC;AAErC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CACvC,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"clipboard.js","sourceRoot":"","sources":["../src/clipboard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAkB,MAAM,OAAO,CAAC;AAC7F,OAAO,EAAE,MAAM,EAAoB,MAAM,cAAc,CAAC;AA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C,KAAK,CAAC,EAAE,gBAAgB,CAAC,CAAC;QACvE,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,uEAAuE;YACvE,kCAAkC;YAClC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAEnD,OAAO,CACL,8BACE,KAAC,MAAM,OAAK,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC,YAC9E,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,GAC9B,EAET,eAAM,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,qBAAqB,YAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,GAAQ,IACvF,CACJ,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import { forwardRef, useCallback, useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { Button, type ButtonProps } from \"./actions.js\";\n\n// `onCopy` also names the DOM clipboard event handler on ButtonProps; intersected, the\n// value callback had to accept a ClipboardEvent too and no product could pass it. The\n// renderer consumes the prop and never forwards the DOM event, so omitting is lossless.\nexport type ClipboardButtonProps = Omit<ButtonProps, \"children\" | \"onClick\" | \"onCopy\"> &\n Readonly<{\n value: string;\n /** Localized copy for both states; the renderer invents neither. */\n labels: Readonly<{ idle: ReactNode; copied: ReactNode }>;\n /** How long the copied state stays, in ms. */\n feedbackDuration?: number;\n onCopy?: (value: string) => void;\n onCopyError?: (error: unknown) => void;\n }>;\n\nconst defaultFeedbackDuration = 2000;\n\n/**\n * Copying is three things products kept re-deriving: the async clipboard call,\n * the temporary \"copied\" state, and announcing that state to a screen reader.\n * The last one is the part that was always missing — a label that only changes\n * visually tells a non-sighted user nothing happened.\n */\nexport const ClipboardButton = forwardRef<HTMLButtonElement, ClipboardButtonProps>(\n function ClipboardButton(\n // Default `secondary` (2026-10-06): copying is a helper beside the screen's main action, and the\n // inherited Button default `primary` added a second primary to screens that already had one.\n // Pass `tone=\"primary\"` explicitly when copying *is* the screen's main action.\n { value, labels, feedbackDuration = defaultFeedbackDuration, onCopy, onCopyError, tone = \"secondary\", ...props },\n forwardedRef,\n ) {\n const [copied, setCopied] = useState(false);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n useEffect(() => () => { if (timer.current !== undefined) clearTimeout(timer.current); }, []);\n useEffect(() => {\n // A new value makes the previous \"copied\" claim false: it referred to the\n // old string, and leaving it up tells the user something untrue.\n setCopied(false);\n if (timer.current !== undefined) clearTimeout(timer.current);\n }, [value]);\n\n const copy = useCallback(async () => {\n try {\n await navigator.clipboard.writeText(value);\n setCopied(true);\n onCopy?.(value);\n if (timer.current !== undefined) clearTimeout(timer.current);\n timer.current = setTimeout(() => setCopied(false), feedbackDuration);\n } catch (error) {\n // Clipboard access can be denied; swallowing that would leave the user\n // believing the value was copied.\n onCopyError?.(error);\n }\n }, [value, feedbackDuration, onCopy, onCopyError]);\n\n return (\n <>\n <Button {...props} tone={tone} ref={forwardedRef} onClick={() => { void copy(); }}>\n {copied ? labels.copied : labels.idle}\n </Button>\n {/* The state change is announced, not only painted. */}\n <span role=\"status\" className=\"hjm-visually-hidden\">{copied ? labels.copied : \"\"}</span>\n </>\n );\n },\n);\n"]}
|
package/dist/code-block.d.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import { type CodeBlockDescriptor } from '@hjmds/design-contracts/code-block';
|
|
3
|
+
import type { HjmCompositionStyleProp } from "./composition-style.js";
|
|
3
4
|
export type CodeBlockProps = CodeBlockDescriptor & Readonly<{
|
|
4
5
|
copyAction?: ReactNode;
|
|
6
|
+
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
7
|
+
layoutStyle?: HjmCompositionStyleProp;
|
|
5
8
|
}>;
|
|
6
9
|
/** Token text is rendered as React text, never executable HTML. */
|
|
7
|
-
export declare function CodeBlock({ copyAction, ...descriptor }: CodeBlockProps): import("react").JSX.Element;
|
|
10
|
+
export declare function CodeBlock({ copyAction, layoutStyle, ...descriptor }: CodeBlockProps): import("react").JSX.Element;
|
|
8
11
|
//# sourceMappingURL=code-block.d.ts.map
|
package/dist/code-block.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../src/code-block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAkB,KAAK,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAC7F,MAAM,MAAM,cAAc,GAAC,mBAAmB,GAAG,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"code-block.d.ts","sourceRoot":"","sources":["../src/code-block.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAkB,KAAK,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AAC7F,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACtE,MAAM,MAAM,cAAc,GAAC,mBAAmB,GAAG,QAAQ,CAAC;IACxD,UAAU,CAAC,EAAC,SAAS,CAAC;IACtB,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEH,mEAAmE;AACnE,wBAAgB,SAAS,CAAC,EAAC,UAAU,EAAC,WAAW,EAAC,GAAG,UAAU,EAAC,EAAC,cAAc,+BAAuwB"}
|
package/dist/code-block.js
CHANGED
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { resolveCodeBlock } from '@hjmds/design-contracts/code-block';
|
|
3
3
|
const colors = { plain: 'var(--hjm-color-text)', keyword: 'var(--hjm-color-content-brand)', string: 'var(--hjm-color-text)', comment: 'var(--hjm-color-text-muted)', number: 'var(--hjm-color-content-brand)' };
|
|
4
4
|
/** Token text is rendered as React text, never executable HTML. */
|
|
5
|
-
export function CodeBlock({ copyAction, ...descriptor }) { const spec = resolveCodeBlock(descriptor); return _jsxs("section", { "aria-label": spec.label, style: { minWidth: 0, borderRadius: 'var(--hjm-radius-lg)', background: 'var(--hjm-color-surface-alt)', color: 'var(--hjm-color-text)', overflow: 'hidden' }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 'var(--hjm-space-sm)', padding: 'var(--hjm-space-md)' }, children: [_jsx("span", { children: spec.language ?? spec.label }), copyAction] }), _jsx("pre", { tabIndex: 0, "aria-label": spec.label, style: { margin: 0, padding: 'var(--hjm-space-md)', overflowX: 'auto', whiteSpace: spec.wrap ? 'pre-wrap' : 'pre', overflowWrap: spec.wrap ? 'anywhere' : undefined }, children: _jsx("code", { children: spec.tokens.map((token, index) => _jsx("span", { style: { color: colors[token.tone ?? 'plain'] }, children: token.text }, index)) }) })] }); }
|
|
5
|
+
export function CodeBlock({ copyAction, layoutStyle, ...descriptor }) { const spec = resolveCodeBlock(descriptor); return _jsxs("section", { "aria-label": spec.label, style: { minWidth: 0, borderRadius: 'var(--hjm-radius-lg)', background: 'var(--hjm-color-surface-alt)', color: 'var(--hjm-color-text)', overflow: 'hidden', ...layoutStyle }, children: [_jsxs("div", { style: { display: 'flex', alignItems: 'center', justifyContent: 'space-between', gap: 'var(--hjm-space-sm)', padding: 'var(--hjm-space-md)' }, children: [_jsx("span", { children: spec.language ?? spec.label }), copyAction] }), _jsx("pre", { tabIndex: 0, "aria-label": spec.label, style: { margin: 0, padding: 'var(--hjm-space-md)', overflowX: 'auto', whiteSpace: spec.wrap ? 'pre-wrap' : 'pre', overflowWrap: spec.wrap ? 'anywhere' : undefined }, children: _jsx("code", { children: spec.tokens.map((token, index) => _jsx("span", { style: { color: colors[token.tone ?? 'plain'] }, children: token.text }, index)) }) })] }); }
|
|
6
6
|
//# sourceMappingURL=code-block.js.map
|
package/dist/code-block.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block.js","sourceRoot":"","sources":["../src/code-block.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,gBAAgB,EAA0B,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"code-block.js","sourceRoot":"","sources":["../src/code-block.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,gBAAgB,EAA0B,MAAM,oCAAoC,CAAC;AAO7F,MAAM,MAAM,GAAC,EAAC,KAAK,EAAC,uBAAuB,EAAC,OAAO,EAAC,gCAAgC,EAAC,MAAM,EAAC,uBAAuB,EAAC,OAAO,EAAC,6BAA6B,EAAC,MAAM,EAAC,gCAAgC,EAAC,CAAC;AACnM,mEAAmE;AACnE,MAAM,UAAU,SAAS,CAAC,EAAC,UAAU,EAAC,WAAW,EAAC,GAAG,UAAU,EAAgB,IAAE,MAAM,IAAI,GAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAA,OAAO,iCAAqB,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,QAAQ,EAAC,CAAC,EAAC,YAAY,EAAC,sBAAsB,EAAC,UAAU,EAAC,8BAA8B,EAAC,KAAK,EAAC,uBAAuB,EAAC,QAAQ,EAAC,QAAQ,EAAC,GAAG,WAAW,EAAC,aAAE,eAAK,KAAK,EAAE,EAAC,OAAO,EAAC,MAAM,EAAC,UAAU,EAAC,QAAQ,EAAC,cAAc,EAAC,eAAe,EAAC,GAAG,EAAC,qBAAqB,EAAC,OAAO,EAAC,qBAAqB,EAAC,aAAE,yBAAO,IAAI,CAAC,QAAQ,IAAE,IAAI,CAAC,KAAK,GAAQ,EAAC,UAAU,IAAO,EAAA,cAAK,QAAQ,EAAE,CAAC,gBAAc,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,MAAM,EAAC,CAAC,EAAC,OAAO,EAAC,qBAAqB,EAAC,SAAS,EAAC,MAAM,EAAC,UAAU,EAAC,IAAI,CAAC,IAAI,CAAA,CAAC,CAAA,UAAU,CAAA,CAAC,CAAA,KAAK,EAAC,YAAY,EAAC,IAAI,CAAC,IAAI,CAAA,CAAC,CAAA,UAAU,CAAA,CAAC,CAAA,SAAS,EAAC,YAAE,yBAAO,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAC,KAAK,EAAC,EAAE,CAAA,eAAkB,KAAK,EAAE,EAAC,KAAK,EAAC,MAAM,CAAC,KAAK,CAAC,IAAI,IAAE,OAAO,CAAC,EAAC,YAAG,KAAK,CAAC,IAAI,IAA9D,KAAK,CAAiE,CAAC,GAAQ,GAAM,IAAU,CAAC,CAAA,CAAC","sourcesContent":["import type {ReactNode} from 'react';\nimport {resolveCodeBlock,type CodeBlockDescriptor} from '@hjmds/design-contracts/code-block';\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nexport type CodeBlockProps=CodeBlockDescriptor & Readonly<{\n copyAction?:ReactNode;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\nconst colors={plain:'var(--hjm-color-text)',keyword:'var(--hjm-color-content-brand)',string:'var(--hjm-color-text)',comment:'var(--hjm-color-text-muted)',number:'var(--hjm-color-content-brand)'};\n/** Token text is rendered as React text, never executable HTML. */\nexport function CodeBlock({copyAction,layoutStyle,...descriptor}:CodeBlockProps){const spec=resolveCodeBlock(descriptor);return <section aria-label={spec.label} style={{minWidth:0,borderRadius:'var(--hjm-radius-lg)',background:'var(--hjm-color-surface-alt)',color:'var(--hjm-color-text)',overflow:'hidden',...layoutStyle}}><div style={{display:'flex',alignItems:'center',justifyContent:'space-between',gap:'var(--hjm-space-sm)',padding:'var(--hjm-space-md)'}}><span>{spec.language??spec.label}</span>{copyAction}</div><pre tabIndex={0} aria-label={spec.label} style={{margin:0,padding:'var(--hjm-space-md)',overflowX:'auto',whiteSpace:spec.wrap?'pre-wrap':'pre',overflowWrap:spec.wrap?'anywhere':undefined}}><code>{spec.tokens.map((token,index)=><span key={index} style={{color:colors[token.tone??'plain']}}>{token.text}</span>)}</code></pre></section>;}\n"]}
|
package/dist/collapsible.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { type CollapsibleOpenState } from "@hjmds/design-contracts/components/collapsible";
|
|
2
2
|
import { type ReactNode } from "react";
|
|
3
|
+
import type { HjmCompositionStyleProp } from "./composition-style.js";
|
|
3
4
|
export type CollapsibleProps = CollapsibleOpenState & Readonly<{
|
|
4
5
|
/** The control's label; it also tells the user what will appear. */
|
|
5
6
|
trigger: ReactNode;
|
|
6
7
|
children: ReactNode;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
className?: string;
|
|
10
|
+
/** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */
|
|
11
|
+
layoutStyle?: HjmCompositionStyleProp;
|
|
9
12
|
}>;
|
|
10
13
|
export declare const Collapsible: import("react").ForwardRefExoticComponent<CollapsibleProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
14
|
//# sourceMappingURL=collapsible.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsible.d.ts","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,oBAAoB,EAC1B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAmD,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAExF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,oBAAoB,GACjD,QAAQ,CAAC;IACP,oEAAoE;IACpE,OAAO,EAAE,SAAS,CAAC;IACnB,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gGAAgG;IAChG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AAEL,eAAO,MAAM,WAAW,6GAyCtB,CAAC"}
|
package/dist/collapsible.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { collapsibleRecipe, validateCollapsibleOpenState, } from "@hjmds/design-contracts/components/collapsible";
|
|
3
3
|
import { forwardRef, useId, useState } from "react";
|
|
4
4
|
import { classNames } from "./internal.js";
|
|
5
|
-
export const Collapsible = forwardRef(function Collapsible({ trigger, children, disabled = false, className, ...openState }, forwardedRef) {
|
|
5
|
+
export const Collapsible = forwardRef(function Collapsible({ trigger, children, disabled = false, className, layoutStyle, ...openState }, forwardedRef) {
|
|
6
6
|
validateCollapsibleOpenState(openState);
|
|
7
7
|
const controlled = openState.open !== undefined;
|
|
8
8
|
const [internalOpen, setInternalOpen] = useState(openState.defaultOpen ?? false);
|
|
9
9
|
const open = openState.open ?? internalOpen;
|
|
10
10
|
const id = `${useId().replaceAll(":", "")}-collapsible`;
|
|
11
|
-
return (_jsxs("div", { ref: forwardedRef, className: classNames("hjm-collapsible", className), "data-state": open ? "open" : "closed", style: { "--hjm-collapsible-gap": `${collapsibleRecipe.gap}px` }, children: [_jsxs("button", { type: "button", className: "hjm-collapsible__trigger", "aria-expanded": open, "aria-controls": `${id}-content`, disabled: disabled, onClick: () => {
|
|
11
|
+
return (_jsxs("div", { ref: forwardedRef, className: classNames("hjm-collapsible", className), "data-state": open ? "open" : "closed", style: { ...layoutStyle, "--hjm-collapsible-gap": `${collapsibleRecipe.gap}px` }, children: [_jsxs("button", { type: "button", className: "hjm-collapsible__trigger", "aria-expanded": open, "aria-controls": `${id}-content`, disabled: disabled, onClick: () => {
|
|
12
12
|
const next = !open;
|
|
13
13
|
if (!controlled)
|
|
14
14
|
setInternalOpen(next);
|
package/dist/collapsible.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAE7B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"collapsible.js","sourceRoot":"","sources":["../src/collapsible.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,iBAAiB,EACjB,4BAA4B,GAE7B,MAAM,gDAAgD,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAsC,MAAM,OAAO,CAAC;AACxF,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAc3C,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CAAmC,SAAS,WAAW,CAC1F,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,GAAG,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,SAAS,EAAE,EAC7E,YAAY;IAEZ,4BAA4B,CAAC,SAAiC,CAAC,CAAC;IAChE,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,KAAK,SAAS,CAAC;IAChD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAAC,SAAS,CAAC,WAAW,IAAI,KAAK,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,IAAI,YAAY,CAAC;IAC5C,MAAM,EAAE,GAAG,GAAG,KAAK,EAAE,CAAC,UAAU,CAAC,GAAG,EAAE,EAAE,CAAC,cAAc,CAAC;IACxD,OAAO,CACL,eACE,GAAG,EAAE,YAAY,EACjB,SAAS,EAAE,UAAU,CAAC,iBAAiB,EAAE,SAAS,CAAC,gBACvC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,EACpC,KAAK,EAAE,EAAE,GAAG,WAAW,EAAE,uBAAuB,EAAE,GAAG,iBAAiB,CAAC,GAAG,IAAI,EAAmB,aAEjG,kBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,0BAA0B,mBACrB,IAAI,mBACJ,GAAG,EAAE,UAAU,EAC9B,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,GAAG,EAAE;oBACZ,MAAM,IAAI,GAAG,CAAC,IAAI,CAAC;oBACnB,IAAI,CAAC,UAAU;wBAAE,eAAe,CAAC,IAAI,CAAC,CAAC;oBACvC,SAAS,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,CAAC;gBACjC,CAAC,aAEA,OAAO,EACR,8BAAkB,MAAM,EAAC,SAAS,EAAC,yBAAyB,YAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAQ,IAC/E,EAMR,IAAI,CAAC,CAAC,CAAC,CACN,cAAK,EAAE,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAO,CAC9F,CAAC,CAAC,CAAC,IAAI,IACJ,CACP,CAAC;AACJ,CAAC,CAAC,CAAC","sourcesContent":["import {\n collapsibleRecipe,\n validateCollapsibleOpenState,\n type CollapsibleOpenState,\n} from \"@hjmds/design-contracts/components/collapsible\";\nimport { forwardRef, useId, useState, type CSSProperties, type ReactNode } from \"react\";\nimport { classNames } from \"./internal.js\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\n\nexport type CollapsibleProps = CollapsibleOpenState &\n Readonly<{\n /** The control's label; it also tells the user what will appear. */\n trigger: ReactNode;\n children: ReactNode;\n disabled?: boolean;\n className?: string;\n /** Canonical layout-only placement on the root element. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n }>;\n\nexport const Collapsible = forwardRef<HTMLDivElement, CollapsibleProps>(function Collapsible(\n { trigger, children, disabled = false, className, layoutStyle, ...openState },\n forwardedRef,\n) {\n validateCollapsibleOpenState(openState as CollapsibleOpenState);\n const controlled = openState.open !== undefined;\n const [internalOpen, setInternalOpen] = useState(openState.defaultOpen ?? false);\n const open = openState.open ?? internalOpen;\n const id = `${useId().replaceAll(\":\", \"\")}-collapsible`;\n return (\n <div\n ref={forwardedRef}\n className={classNames(\"hjm-collapsible\", className)}\n data-state={open ? \"open\" : \"closed\"}\n style={{ ...layoutStyle, \"--hjm-collapsible-gap\": `${collapsibleRecipe.gap}px` } as CSSProperties}\n >\n <button\n type=\"button\"\n className=\"hjm-collapsible__trigger\"\n aria-expanded={open}\n aria-controls={`${id}-content`}\n disabled={disabled}\n onClick={() => {\n const next = !open;\n if (!controlled) setInternalOpen(next);\n openState.onOpenChange?.(next);\n }}\n >\n {trigger}\n <span aria-hidden=\"true\" className=\"hjm-collapsible__marker\">{open ? \"▾\" : \"▸\"}</span>\n </button>\n {/*\n Unmounted when closed rather than visually hidden: content left in the\n tree stays reachable by search and by a screen reader, which contradicts\n what the collapsed state says.\n */}\n {open ? (\n <div id={`${id}-content`} role=\"region\" className=\"hjm-collapsible__content\">{children}</div>\n ) : null}\n </div>\n );\n});\n"]}
|
package/dist/color-picker.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { HjmCompositionStyleProp } from "./composition-style.js";
|
|
1
2
|
export type ColorPickerLabels = Readonly<{
|
|
2
3
|
color: string;
|
|
3
4
|
hex: string;
|
|
@@ -12,7 +13,9 @@ export type ColorPickerProps = Readonly<{
|
|
|
12
13
|
alpha?: boolean;
|
|
13
14
|
disabled?: boolean;
|
|
14
15
|
presets?: readonly string[];
|
|
16
|
+
/** Canonical layout-only placement on the root `<fieldset>`. Controlled visual keys are excluded. */
|
|
17
|
+
layoutStyle?: HjmCompositionStyleProp;
|
|
15
18
|
}>;
|
|
16
19
|
/** Controlled value; invalid text stays local until corrected or escaped. Native color UI supplies RGB only. */
|
|
17
|
-
export declare function ColorPicker({ label, labels, value, onValueChange, alpha, disabled, presets }: ColorPickerProps): import("react").JSX.Element;
|
|
20
|
+
export declare function ColorPicker({ label, labels, value, onValueChange, alpha, disabled, presets, layoutStyle }: ColorPickerProps): import("react").JSX.Element;
|
|
18
21
|
//# sourceMappingURL=color-picker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAEtE,MAAM,MAAM,iBAAiB,GAAG,QAAQ,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAC3G,MAAM,MAAM,gBAAgB,GAAG,QAAQ,CAAC;IACtC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,iBAAiB,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChG,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjE,qGAAqG;IACrG,WAAW,CAAC,EAAE,uBAAuB,CAAC;CACvC,CAAC,CAAC;AACH,gHAAgH;AAChH,wBAAgB,WAAW,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,KAAa,EAAE,QAAgB,EAAE,OAAY,EAAE,WAAW,EAAE,EAAE,gBAAgB,+BAiChJ"}
|
package/dist/color-picker.js
CHANGED
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect, useId, useState } from "react";
|
|
3
3
|
import { colorPickerRecipe, normalizePickerColor, pickerOpacity, withPickerOpacity } from "@hjmds/design-contracts/components/color-picker";
|
|
4
4
|
/** Controlled value; invalid text stays local until corrected or escaped. Native color UI supplies RGB only. */
|
|
5
|
-
export function ColorPicker({ label, labels, value, onValueChange, alpha = false, disabled = false, presets = [] }) {
|
|
5
|
+
export function ColorPicker({ label, labels, value, onValueChange, alpha = false, disabled = false, presets = [], layoutStyle }) {
|
|
6
6
|
const color = normalizePickerColor(value, alpha);
|
|
7
7
|
// HEX is an ordered code, so isolate its LTR text even when the surrounding labels use RTL.
|
|
8
8
|
const palette = [...new Set(presets.map(preset => normalizePickerColor(preset, alpha)))];
|
|
@@ -28,7 +28,7 @@ export function ColorPicker({ label, labels, value, onValueChange, alpha = false
|
|
|
28
28
|
}
|
|
29
29
|
emit(next);
|
|
30
30
|
}
|
|
31
|
-
return _jsxs("fieldset", { className: "hjm-color-picker", style: { "--hjm-color-picker-target": `${colorPickerRecipe.minTargetSize}px` }, "data-hjm-color-picker": true, disabled: disabled, children: [_jsx("legend", { children: label }), _jsxs("div", { className: "hjm-color-picker__row", children: [_jsxs("label", { className: "hjm-color-picker__native", children: [_jsx("span", { children: labels.color }), _jsx("input", { type: "color", value: color.slice(0, 7), onChange: event => emit(event.target.value + (alpha ? color.slice(7) : "")) })] }), _jsxs("label", { className: "hjm-color-picker__hex", children: [_jsx("span", { children: labels.hex }), _jsx("input", { type: "text", dir: "ltr", value: draft, spellCheck: false, autoComplete: "off", "aria-invalid": invalid || undefined, "aria-describedby": invalid ? `${id}-error` : undefined, onChange: event => { setDraft(event.target.value); setInvalid(false); }, onBlur: commit, onKeyDown: event => { if (event.key === "Enter") {
|
|
31
|
+
return _jsxs("fieldset", { className: "hjm-color-picker", style: { ...layoutStyle, "--hjm-color-picker-target": `${colorPickerRecipe.minTargetSize}px` }, "data-hjm-color-picker": true, disabled: disabled, children: [_jsx("legend", { children: label }), _jsxs("div", { className: "hjm-color-picker__row", children: [_jsxs("label", { className: "hjm-color-picker__native", children: [_jsx("span", { children: labels.color }), _jsx("input", { type: "color", value: color.slice(0, 7), onChange: event => emit(event.target.value + (alpha ? color.slice(7) : "")) })] }), _jsxs("label", { className: "hjm-color-picker__hex", children: [_jsx("span", { children: labels.hex }), _jsx("input", { type: "text", dir: "ltr", value: draft, spellCheck: false, autoComplete: "off", "aria-invalid": invalid || undefined, "aria-describedby": invalid ? `${id}-error` : undefined, onChange: event => { setDraft(event.target.value); setInvalid(false); }, onBlur: commit, onKeyDown: event => { if (event.key === "Enter") {
|
|
32
32
|
event.preventDefault();
|
|
33
33
|
commit();
|
|
34
34
|
} if (event.key === "Escape") {
|
package/dist/color-picker.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"color-picker.js","sourceRoot":"","sources":["../src/color-picker.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAsB,MAAM,OAAO,CAAC;AAEvE,OAAO,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AA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QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAI,IAAQ,EAC1W,cAAK,SAAS,EAAC,2BAA2B,iBAAa,MAAM,EAAC,KAAK,EAAE,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,EAClG,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,cAAK,SAAS,EAAC,2BAA2B,YAAE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,kBAAQ,IAAI,EAAC,QAAQ,kBAA4B,MAAM,KAAK,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,aAAE,8BAAkB,MAAM,EAAC,SAAS,EAAC,0BAA0B,EAAC,KAAK,EAAE,EAAE,eAAe,EAAE,MAAM,EAAE,GAAI,EAAA,cAAK,GAAG,EAAC,KAAK,YAAE,MAAM,GAAO,KAAtM,MAAM,CAAyM,CAAC,GAAO,IAClU,CAAC;AACd,CAAC","sourcesContent":["import { useEffect, useId, useState, type CSSProperties } from \"react\";\nimport type { HjmCompositionStyleProp } from \"./composition-style.js\";\nimport { colorPickerRecipe, normalizePickerColor, pickerOpacity, withPickerOpacity } from \"@hjmds/design-contracts/components/color-picker\";\nexport type ColorPickerLabels = Readonly<{ color: string; hex: string; opacity: string; invalid: string }>;\nexport type ColorPickerProps = Readonly<{\n label: string; labels: ColorPickerLabels; value: string; onValueChange: (value: string) => void;\n alpha?: boolean; disabled?: boolean; presets?: readonly string[];\n /** Canonical layout-only placement on the root `<fieldset>`. Controlled visual keys are excluded. */\n layoutStyle?: HjmCompositionStyleProp;\n}>;\n/** Controlled value; invalid text stays local until corrected or escaped. Native color UI supplies RGB only. */\nexport function ColorPicker({ label, labels, value, onValueChange, alpha = false, disabled = false, presets = [], layoutStyle }: ColorPickerProps) {\n const color = normalizePickerColor(value, alpha);\n // HEX is an ordered code, so isolate its LTR text even when the surrounding labels use RTL.\n const palette = [...new Set(presets.map(preset => normalizePickerColor(preset, alpha)))];\n if (![label, ...Object.values(labels)].every(text => text.trim())) throw new TypeError(\"ColorPicker labels must not be empty\");\n const id = useId();\n const [draft, setDraft] = useState(color);\n const [invalid, setInvalid] = useState(false);\n useEffect(() => { setDraft(color); setInvalid(false); }, [color]);\n function emit(next: string) { setDraft(next); setInvalid(false); if (next !== color) onValueChange(next); }\n function commit() {\n let next: string;\n try {\n // A typed 3/6-digit HEX names only the hue. Keep the current opacity instead of resetting it to 100%,\n // matching the native color input; an 8-digit HEX still sets alpha explicitly (2026-09-30 review).\n const digits = draft.trim().replace(/^#/, \"\").length;\n next = alpha && (digits === 3 || digits === 6) ? normalizePickerColor(draft, false) + color.slice(7) : normalizePickerColor(draft, alpha);\n } catch { setInvalid(true); return; }\n emit(next);\n }\n return <fieldset className=\"hjm-color-picker\" style={{ ...layoutStyle, \"--hjm-color-picker-target\": `${colorPickerRecipe.minTargetSize}px` } as CSSProperties} data-hjm-color-picker disabled={disabled}>\n <legend>{label}</legend>\n <div className=\"hjm-color-picker__row\">\n <label className=\"hjm-color-picker__native\"><span>{labels.color}</span><input type=\"color\" value={color.slice(0, 7)} onChange={event => emit(event.target.value + (alpha ? color.slice(7) : \"\"))} /></label>\n <label className=\"hjm-color-picker__hex\"><span>{labels.hex}</span><input type=\"text\" dir=\"ltr\" value={draft} spellCheck={false} autoComplete=\"off\" aria-invalid={invalid || undefined} aria-describedby={invalid ? `${id}-error` : undefined}\n onChange={event => { setDraft(event.target.value); setInvalid(false); }} onBlur={commit}\n onKeyDown={event => { if (event.key === \"Enter\") { event.preventDefault(); commit(); } if (event.key === \"Escape\") { event.preventDefault(); setDraft(color); setInvalid(false); } }} /></label>\n </div>\n {invalid && <p id={`${id}-error`} role=\"alert\" className=\"hjm-color-picker__error\">{labels.invalid}</p>}\n {alpha && <label className=\"hjm-color-picker__opacity\"><span>{labels.opacity} <output>{pickerOpacity(color)}%</output></span><input type=\"range\" min={0} max={100} step={1} value={pickerOpacity(color)} aria-label={labels.opacity} aria-valuetext={`${pickerOpacity(color)}%`} onChange={event => emit(withPickerOpacity(color, Number(event.target.value)))} /></label>}\n <div className=\"hjm-color-picker__preview\" aria-hidden=\"true\" style={{ backgroundColor: color }} />\n {palette.length > 0 && <div className=\"hjm-color-picker__presets\">{palette.map(preset => <button type=\"button\" key={preset} aria-pressed={preset === color} onClick={() => emit(preset)}><span aria-hidden=\"true\" className=\"hjm-color-picker__swatch\" style={{ backgroundColor: preset }} /><bdi dir=\"ltr\">{preset}</bdi></button>)}</div>}\n </fieldset>;\n}\n"]}
|
|
@@ -9,6 +9,12 @@ export type CommandPaletteProps<Key extends string = string> = Readonly<{
|
|
|
9
9
|
onActivate: CommandPaletteActivateHandler<Key>;
|
|
10
10
|
/** Runs after the palette is gone, for a command that opens the next surface. */
|
|
11
11
|
onActivateAfterDismiss?: CommandPaletteActivateHandler<Key>;
|
|
12
|
+
/**
|
|
13
|
+
* Combobox's collection state. Omitted or `filtering: "local"` filters
|
|
14
|
+
* `source` by `query` in the renderer (label/textValue substring); pass
|
|
15
|
+
* `filtering: "external"` with `queryValue`/`resultQuery` when the product
|
|
16
|
+
* already filtered or ranked the results (server or fuzzy search).
|
|
17
|
+
*/
|
|
12
18
|
queryState?: CommandPaletteQueryState;
|
|
13
19
|
dismissPolicy?: Partial<CommandPaletteDismissPolicy>;
|
|
14
20
|
open?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.d.ts","sourceRoot":"","sources":["../src/command-palette.tsx"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,6BAA6B,EAElC,KAAK,wBAAwB,EAC7B,KAAK,2BAA2B,EAEhC,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,oBAAoB,EAC1B,MAAM,oDAAoD,CAAC;
|
|
1
|
+
{"version":3,"file":"command-palette.d.ts","sourceR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AM,GAAG,MAAM,EAChC,KAAK,EAAE,mBAAmB,CAAC,GAAG,CAAC,GAAG;IAAE,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,cAAc,CAAC,CAAA;CAAE,KAClE,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC"}
|
package/dist/command-palette.js
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { canDismissCommandPalette, commandPaletteBehaviorDefaults, commandPaletteRecipe, validateCommandPaletteDescriptor, } from "@hjmds/design-contracts/components/command-palette";
|
|
3
|
-
import {
|
|
3
|
+
import { getCollectionNavigationIntent, getCollectionNavigationTarget, isComboboxResultCurrent, } from "@hjmds/design-contracts/components/collection";
|
|
4
4
|
import { forwardRef, useEffect, useId, useMemo, useRef, useState, } from "react";
|
|
5
5
|
import { classNames, composeRefs } from "./internal.js";
|
|
6
6
|
import { getModalLayer, HjmPortal, renderTrigger, useModalFocus } from "./modal.js";
|
|
7
|
+
// Local filter = Native Combobox substring rule; why not prefix/contracts:
|
|
8
|
+
// docs/command-palette.md "2026-10-06" (comments ship in dist byte budgets).
|
|
9
|
+
function resolveResults(source, query, queryState, emptyMessage) {
|
|
10
|
+
const external = queryState?.filtering === "external";
|
|
11
|
+
const needle = query.trim().toLocaleLowerCase();
|
|
12
|
+
const keep = (item) => external || `${item.label} ${item.textValue}`.toLocaleLowerCase().includes(needle);
|
|
13
|
+
const sections = (source.sections
|
|
14
|
+
? source.sections.map((section) => ({
|
|
15
|
+
id: section.id,
|
|
16
|
+
label: section.label,
|
|
17
|
+
// validateCollection's precedence.
|
|
18
|
+
name: section.accessibilityLabel?.trim() || section.label?.trim() || undefined,
|
|
19
|
+
items: section.items.filter(keep),
|
|
20
|
+
}))
|
|
21
|
+
: [{ id: "__all", label: undefined, name: undefined, items: source.items.filter(keep) }]).filter((section) => section.items.length > 0);
|
|
22
|
+
const items = sections.flatMap((section) => section.items);
|
|
23
|
+
const asyncState = queryState?.asyncState ?? { status: "idle" };
|
|
24
|
+
const status = asyncState.status !== "idle"
|
|
25
|
+
? { kind: asyncState.status, message: asyncState.message }
|
|
26
|
+
: items.length > 0 || emptyMessage === undefined ? null : { kind: "empty", message: emptyMessage };
|
|
27
|
+
return {
|
|
28
|
+
sections,
|
|
29
|
+
items,
|
|
30
|
+
current: !external || isComboboxResultCurrent(queryState.queryValue, queryState.resultQuery),
|
|
31
|
+
status,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
7
34
|
export const CommandPalette = forwardRef(function CommandPalette({ descriptor, source, query, onQueryChange, onActivate, onActivateAfterDismiss, queryState, dismissPolicy, open: openProp, defaultOpen, onOpenChange, trigger, renderLeading, portalContainer, className, }, forwardedRef) {
|
|
8
35
|
validateCommandPaletteDescriptor(descriptor);
|
|
9
36
|
const policy = { ...commandPaletteBehaviorDefaults, ...dismissPolicy };
|
|
10
37
|
const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);
|
|
11
38
|
const open = openProp ?? internalOpen;
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
// the palette adds no second loading vocabulary of its own.
|
|
16
|
-
const asyncState = queryState?.asyncState ?? { status: "idle" };
|
|
39
|
+
const results = useMemo(() => resolveResults(source, query, queryState, descriptor.emptyMessage), [source, query, queryState, descriptor.emptyMessage]);
|
|
40
|
+
// Stale external rows stay visible but inert, as in the Native Combobox.
|
|
41
|
+
const enabled = results.current ? results.items.filter((item) => !item.disabled) : [];
|
|
17
42
|
const [activeId, setActiveId] = useState(null);
|
|
18
43
|
const contentRef = useRef(null);
|
|
19
44
|
const triggerRef = useRef(null);
|
|
@@ -22,9 +47,13 @@ export const CommandPalette = forwardRef(function CommandPalette({ descriptor, s
|
|
|
22
47
|
const active = enabled.find((item) => item.id === activeId) ?? enabled[0] ?? null;
|
|
23
48
|
useEffect(() => {
|
|
24
49
|
// A new query builds a new result list; the first enabled row becomes active
|
|
25
|
-
// so Enter always has an unambiguous target.
|
|
50
|
+
// so Enter always has an unambiguous target. Only the query resets it: products
|
|
51
|
+
// often pass `source`/`queryState` as inline objects, and keying on their
|
|
52
|
+
// identity snapped the active row back to the first item on every render
|
|
53
|
+
// (2026-10-06 usage-guide audit). A row that disappears from the results
|
|
54
|
+
// already falls back to the first enabled row through `active` above.
|
|
26
55
|
setActiveId(null);
|
|
27
|
-
}, [query
|
|
56
|
+
}, [query]);
|
|
28
57
|
const change = (next, reason) => {
|
|
29
58
|
if (openProp === undefined)
|
|
30
59
|
setInternalOpen(next);
|
|
@@ -65,18 +94,23 @@ export const CommandPalette = forwardRef(function CommandPalette({ descriptor, s
|
|
|
65
94
|
activate(active.id, "keyboard");
|
|
66
95
|
}
|
|
67
96
|
};
|
|
97
|
+
const searchInput = (_jsx("input", { ref: inputRef, type: "text", role: "combobox", "aria-expanded": true, "aria-controls": `${id}-results`, "aria-activedescendant": active ? `${id}-${active.id}` : undefined, "aria-label": descriptor.accessibilityLabel, placeholder: descriptor.searchPlaceholder, className: "hjm-command-palette__search", value: query, onChange: (event) => onQueryChange(event.target.value), onKeyDown: onKeyDown }));
|
|
68
98
|
const renderedTrigger = trigger === undefined
|
|
69
99
|
? null
|
|
70
100
|
: renderTrigger(trigger, triggerRef, open, id, "dialog", () => change(true, "trigger"));
|
|
71
101
|
if (!open)
|
|
72
102
|
return renderedTrigger;
|
|
73
|
-
const rows = (source.sections ?? [{ id: "__all", label: undefined, items: source.items ?? [] }]);
|
|
74
103
|
return (_jsxs(_Fragment, { children: [renderedTrigger, _jsx(HjmPortal, { ...(portalContainer === undefined ? {} : { container: portalContainer }), children: _jsx("div", { className: "hjm-overlay hjm-command-palette-positioner", "data-kind": "command-palette", style: { zIndex: getModalLayer(0) }, onMouseDown: (event) => { if (event.target === event.currentTarget)
|
|
75
|
-
requestClose("outside"); }, children: _jsxs("div", { ref: composeRefs(contentRef, forwardedRef), id: id, role: "dialog", "aria-modal": "true", "aria-label": descriptor.accessibilityLabel, "data-hjm-modal-content": "", className: classNames("hjm-command-palette", className), style: { maxInlineSize: commandPaletteRecipe.content.maxWidth, maxBlockSize: commandPaletteRecipe.content.maxHeight }, children: [
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
104
|
+
requestClose("outside"); }, children: _jsxs("div", { ref: composeRefs(contentRef, forwardedRef), id: id, role: "dialog", "aria-modal": "true", "aria-label": descriptor.accessibilityLabel, "data-hjm-modal-content": "", className: classNames("hjm-command-palette", className), style: { maxInlineSize: commandPaletteRecipe.content.maxWidth, maxBlockSize: commandPaletteRecipe.content.maxHeight }, children: [descriptor.closeLabel ? (_jsxs("div", { className: "hjm-command-palette__search-row", children: [searchInput, _jsx("button", { type: "button", className: "hjm-dialog__close hjm-command-palette__close", "aria-label": descriptor.closeLabel, onClick: () => requestClose("close-action"), children: _jsx("span", { "aria-hidden": "true", children: "\u00D7" }) })] })) : searchInput, _jsxs("div", { id: `${id}-results`, role: "listbox", "aria-label": descriptor.accessibilityLabel, className: "hjm-command-palette__viewport", children: [results.status === null ? null : (
|
|
105
|
+
// Once for the whole list, never per section.
|
|
106
|
+
_jsx("p", { className: "hjm-command-palette__state", "data-kind": results.status.kind, role: results.status.kind === "error" ? "alert" : "status", children: results.status.message })), results.sections.map((section) => (_jsxs("div", { className: "hjm-command-palette__section", ...(section.name === undefined ? { role: "presentation" } : { role: "group", "aria-label": section.name }), children: [section.label ? _jsx("p", { className: "hjm-command-palette__section-label", "aria-hidden": "true", children: section.label }) : null, section.items.map((item) => {
|
|
107
|
+
const inert = item.disabled === true || !results.current;
|
|
108
|
+
return (_jsxs("div", { id: `${id}-${item.id}`, role: "option", "aria-selected": item.id === active?.id, "aria-disabled": inert || undefined, className: "hjm-command-palette__item", "data-tone": item.tone, onMouseDown: (event) => {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
if (!inert)
|
|
111
|
+
activate(item.id, "pointer");
|
|
112
|
+
}, onMouseEnter: () => { if (!inert)
|
|
113
|
+
setActiveId(item.id); }, children: [renderLeading?.(item.id), _jsxs("span", { className: "hjm-command-palette__copy", children: [_jsx("span", { children: item.label }), item.description ? _jsx("span", { className: "hjm-command-palette__description", children: item.description }) : null] }), item.shortcut ? _jsx("kbd", { className: "hjm-command-palette__shortcut", children: item.shortcut }) : null] }, item.id));
|
|
114
|
+
})] }, section.id)))] })] }) }) })] }));
|
|
81
115
|
});
|
|
82
116
|
//# sourceMappingURL=command-palette.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-palette.js","sourceRoot":"","sources":["../src/command-palette.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,gCAAgC,GASjC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,sBAAsB,EACtB,6BAA6B,EAC7B,6BAA6B,GAC9B,MAAM,+CAA+C,CAAC;AACvD,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAuB,MAAM,YAAY,CAAC;AAqBzG,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC,SAAS,cAAc,CAC9D,EACE,UAAU,EACV,MAAM,EACN,KAAK,EACL,aAAa,EACb,UAAU,EACV,sBAAsB,EACtB,UAAU,EACV,aAAa,EACb,IAAI,EAAE,QAAQ,EACd,WAAW,EACX,YAAY,EACZ,OAAO,EACP,aAAa,EACb,eAAe,EACf,SAAS,GACgB,EAC3B,YAAuC;IAEvC,gCAAgC,CAAC,UAAU,CAAC,CAAC;IAC7C,MAAM,MAAM,GAAgC,EAAE,GAAG,8BAA8B,EAAE,GAAG,aAAa,EAAE,CAAC;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ACF,GACI,IACX,CACJ,CAAC;AACJ,CAAC,CAE6B,CAAC","sourcesContent":["import {\n canDismissCommandPalette,\n commandPaletteBehaviorDefaults,\n commandPaletteRecipe,\n validateCommandPaletteDescriptor,\n type CommandPaletteActivateHandler,\n type CommandPaletteActivateReason,\n type CommandPaletteDescriptor,\n type CommandPaletteDismissPolicy,\n type CommandPaletteDismissReason,\n type CommandPaletteOpenChangeDetails,\n type CommandPaletteQueryState,\n type CommandPaletteSource,\n} from \"@hjmds/design-contracts/components/command-palette\";\nimport {\n flattenCollectionItems,\n getCollectionNavigationIntent,\n getCollectionNavigationTarget,\n} from \"@hjmds/design-contracts/components/collection\";\nimport {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { getModalLayer, HjmPortal, renderTrigger, useModalFocus, type OverlayTrigger } from \"./modal.js\";\n\nexport type CommandPaletteProps<Key extends string = string> = Readonly<{\n descriptor: CommandPaletteDescriptor;\n source: CommandPaletteSource<Key, string>;\n query: string;\n onQueryChange: (query: string) => void;\n onActivate: CommandPaletteActivateHandler<Key>;\n /** Runs after the palette is gone, for a command that opens the next surface. */\n onActivateAfterDismiss?: CommandPaletteActivateHandler<Key>;\n queryState?: CommandPaletteQueryState;\n dismissPolicy?: Partial<CommandPaletteDismissPolicy>;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, details: CommandPaletteOpenChangeDetails) => void;\n trigger?: OverlayTrigger;\n renderLeading?: (itemId: Key) => ReactNode;\n portalContainer?: HTMLElement;\n className?: string;\n}>;\n\nexport const CommandPalette = forwardRef(function CommandPalette<Key extends string = string>(\n {\n descriptor,\n source,\n query,\n onQueryChange,\n onActivate,\n onActivateAfterDismiss,\n queryState,\n dismissPolicy,\n open: openProp,\n defaultOpen,\n onOpenChange,\n trigger,\n renderLeading,\n portalContainer,\n className,\n }: CommandPaletteProps<Key>,\n forwardedRef: React.Ref<HTMLDivElement>,\n) {\n validateCommandPaletteDescriptor(descriptor);\n const policy: CommandPaletteDismissPolicy = { ...commandPaletteBehaviorDefaults, ...dismissPolicy };\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);\n const open = openProp ?? internalOpen;\n const items = useMemo(() => flattenCollectionItems<Key, string>(source), [source]);\n const enabled = items.filter((item) => !item.disabled);\n // The query state is Combobox's, so the message to show is its async slice —\n // the palette adds no second loading vocabulary of its own.\n const asyncState = queryState?.asyncState ?? { status: \"idle\" as const };\n const [activeId, setActiveId] = useState<Key | null>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const id = `${useId().replaceAll(\":\", \"\")}-command-palette`;\n const active = enabled.find((item) => item.id === activeId) ?? enabled[0] ?? null;\n\n useEffect(() => {\n // A new query builds a new result list; the first enabled row becomes active\n // so Enter always has an unambiguous target.\n setActiveId(null);\n }, [query, source]);\n\n const change = (next: boolean, reason: CommandPaletteOpenChangeDetails[\"reason\"]) => {\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next, { reason });\n };\n const requestClose = (reason: CommandPaletteDismissReason) => {\n if (!canDismissCommandPalette(reason, policy)) return;\n change(false, reason);\n };\n const activate = (itemId: Key, reason: CommandPaletteActivateReason) => {\n onActivate(itemId, reason);\n // Running a command always closes the palette — `activation` is a dismiss\n // reason no policy can veto — and the follow-up surface opens after that.\n change(false, \"activation\");\n if (onActivateAfterDismiss) queueMicrotask(() => onActivateAfterDismiss(itemId, reason));\n };\n\n useModalFocus({\n active: open,\n contentRef,\n initialFocusRef: inputRef,\n ...(trigger === undefined ? {} : { fallbackReturnRef: triggerRef }),\n onEscape: () => requestClose(\"escape\"),\n });\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const intent = getCollectionNavigationIntent(event.key as never);\n if (intent) {\n const target = getCollectionNavigationTarget({ items: enabled }, active?.id ?? null, intent, true);\n if (target === undefined) return;\n event.preventDefault();\n setActiveId(target as Key);\n return;\n }\n if (event.key === \"Enter\" && active) {\n event.preventDefault();\n activate(active.id as Key, \"keyboard\");\n }\n };\n\n const renderedTrigger = trigger === undefined\n ? null\n : renderTrigger(trigger, triggerRef, open, id, \"dialog\", () => change(true, \"trigger\"));\n if (!open) return renderedTrigger;\n\n const rows = (source.sections ?? [{ id: \"__all\", label: undefined, items: source.items ?? [] }]) as readonly {\n id: string; label?: string; items: readonly (typeof items)[number][];\n }[];\n return (\n <>\n {renderedTrigger}\n <HjmPortal {...(portalContainer === undefined ? {} : { container: portalContainer })}>\n <div\n className=\"hjm-overlay hjm-command-palette-positioner\"\n data-kind=\"command-palette\"\n style={{ zIndex: getModalLayer(0) }}\n onMouseDown={(event) => { if (event.target === event.currentTarget) requestClose(\"outside\"); }}\n >\n <div\n ref={composeRefs(contentRef, forwardedRef)}\n id={id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={descriptor.accessibilityLabel}\n data-hjm-modal-content=\"\"\n className={classNames(\"hjm-command-palette\", className)}\n style={{ maxInlineSize: commandPaletteRecipe.content.maxWidth, maxBlockSize: commandPaletteRecipe.content.maxHeight } as CSSProperties}\n >\n <input\n ref={inputRef}\n type=\"text\"\n role=\"combobox\"\n aria-expanded\n aria-controls={`${id}-results`}\n aria-activedescendant={active ? `${id}-${active.id}` : undefined}\n aria-label={descriptor.accessibilityLabel}\n placeholder={descriptor.searchPlaceholder}\n className=\"hjm-command-palette__search\"\n value={query}\n onChange={(event) => onQueryChange(event.target.value)}\n onKeyDown={onKeyDown}\n />\n <div id={`${id}-results`} role=\"listbox\" aria-label={descriptor.accessibilityLabel} className=\"hjm-command-palette__viewport\">\n {asyncState.status === \"idle\" ? null : (\n <p className=\"hjm-command-palette__state\" role={asyncState.status === \"error\" ? \"alert\" : \"status\"}>{asyncState.message}</p>\n )}\n {rows.map((section) => (\n <div key={section.id} className=\"hjm-command-palette__section\" role=\"group\" aria-label={section.label}>\n {section.label ? <p className=\"hjm-command-palette__section-label\">{section.label}</p> : null}\n {section.items.map((item) => (\n <div\n key={item.id}\n id={`${id}-${item.id}`}\n role=\"option\"\n aria-selected={item.id === active?.id}\n aria-disabled={item.disabled || undefined}\n className=\"hjm-command-palette__item\"\n data-tone={item.tone}\n onMouseDown={(event) => {\n event.preventDefault();\n if (!item.disabled) activate(item.id as Key, \"pointer\");\n }}\n onMouseEnter={() => { if (!item.disabled) setActiveId(item.id as Key); }}\n >\n {renderLeading?.(item.id as Key)}\n <span className=\"hjm-command-palette__copy\">\n <span>{item.label}</span>\n {item.description ? <span className=\"hjm-command-palette__description\">{item.description}</span> : null}\n </span>\n {item.shortcut ? <kbd className=\"hjm-command-palette__shortcut\">{item.shortcut}</kbd> : null}\n </div>\n ))}\n </div>\n ))}\n </div>\n </div>\n </div>\n </HjmPortal>\n </>\n );\n}) as <Key extends string = string>(\n props: CommandPaletteProps<Key> & { ref?: React.Ref<HTMLDivElement> },\n) => React.ReactElement | null;\n"]}
|
|
1
|
+
{"version":3,"file":"command-palette.js","sourceRoot":"","sources":["../src/command-palette.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,gCAAgC,GASjC,MAAM,oDAAoD,CAAC;AAC5D,OAAO,EACL,6BAA6B,EAC7B,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,+CAA+C,CAAC;AAEvD,OAAO,EACL,UAAU,EACV,SAAS,EACT,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,GAIT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,aAAa,EAAE,aAAa,EAAuB,MAAM,YAAY,CAAC;AASzG,2EAA2E;AAC3E,6EAA6E;AAC7E,SAAS,cAAc,CACrB,MAAyC,EACzC,KAAa,EACb,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AAI,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAK,SAAS,EAAC,+BAA+B,YAAE,IAAI,CAAC,QAAQ,GAAO,CAAC,CAAC,CAAC,IAAI,KAlBvF,IAAI,CAAC,EAAE,CAmBR,CACL,CAAC;4CACJ,CAAC,CAAC,KA9BG,OAAO,CAAC,EAAE,CA+BX,CACP,CAAC,IACE,IACF,GACF,GACI,IACX,CACJ,CAAC;AACJ,CAAC,CAE6B,CAAC","sourcesContent":["import {\n canDismissCommandPalette,\n commandPaletteBehaviorDefaults,\n commandPaletteRecipe,\n validateCommandPaletteDescriptor,\n type CommandPaletteActivateHandler,\n type CommandPaletteActivateReason,\n type CommandPaletteDescriptor,\n type CommandPaletteDismissPolicy,\n type CommandPaletteDismissReason,\n type CommandPaletteOpenChangeDetails,\n type CommandPaletteQueryState,\n type CommandPaletteSource,\n} from \"@hjmds/design-contracts/components/command-palette\";\nimport {\n getCollectionNavigationIntent,\n getCollectionNavigationTarget,\n isComboboxResultCurrent,\n} from \"@hjmds/design-contracts/components/collection\";\nimport type { CommandPaletteItemDescriptor } from \"@hjmds/design-contracts/components/command-palette\";\nimport {\n forwardRef,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n type CSSProperties,\n type KeyboardEvent,\n type ReactNode,\n} from \"react\";\nimport { classNames, composeRefs } from \"./internal.js\";\nimport { getModalLayer, HjmPortal, renderTrigger, useModalFocus, type OverlayTrigger } from \"./modal.js\";\n\ntype ResultSection<Key extends string> = Readonly<{\n id: string;\n label: string | undefined;\n name: string | undefined;\n items: readonly CommandPaletteItemDescriptor<Key>[];\n}>;\n\n// Local filter = Native Combobox substring rule; why not prefix/contracts:\n// docs/command-palette.md \"2026-10-06\" (comments ship in dist byte budgets).\nfunction resolveResults<Key extends string>(\n source: CommandPaletteSource<Key, string>,\n query: string,\n queryState: CommandPaletteQueryState | undefined,\n emptyMessage: string | undefined,\n) {\n const external = queryState?.filtering === \"external\";\n const needle = query.trim().toLocaleLowerCase();\n const keep = (item: CommandPaletteItemDescriptor<Key>) =>\n external || `${item.label} ${item.textValue}`.toLocaleLowerCase().includes(needle);\n const sections: ResultSection<Key>[] = (source.sections\n ? source.sections.map((section) => ({\n id: section.id,\n label: section.label,\n // validateCollection's precedence.\n name: section.accessibilityLabel?.trim() || section.label?.trim() || undefined,\n items: section.items.filter(keep),\n }))\n : [{ id: \"__all\", label: undefined, name: undefined, items: source.items.filter(keep) }]\n ).filter((section) => section.items.length > 0);\n const items = sections.flatMap((section) => section.items);\n const asyncState = queryState?.asyncState ?? { status: \"idle\" as const };\n const status = asyncState.status !== \"idle\"\n ? { kind: asyncState.status, message: asyncState.message }\n : items.length > 0 || emptyMessage === undefined ? null : { kind: \"empty\" as const, message: emptyMessage };\n return {\n sections,\n items,\n current: !external || isComboboxResultCurrent(queryState.queryValue, queryState.resultQuery),\n status,\n };\n}\n\nexport type CommandPaletteProps<Key extends string = string> = Readonly<{\n descriptor: CommandPaletteDescriptor;\n source: CommandPaletteSource<Key, string>;\n query: string;\n onQueryChange: (query: string) => void;\n onActivate: CommandPaletteActivateHandler<Key>;\n /** Runs after the palette is gone, for a command that opens the next surface. */\n onActivateAfterDismiss?: CommandPaletteActivateHandler<Key>;\n /**\n * Combobox's collection state. Omitted or `filtering: \"local\"` filters\n * `source` by `query` in the renderer (label/textValue substring); pass\n * `filtering: \"external\"` with `queryValue`/`resultQuery` when the product\n * already filtered or ranked the results (server or fuzzy search).\n */\n queryState?: CommandPaletteQueryState;\n dismissPolicy?: Partial<CommandPaletteDismissPolicy>;\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean, details: CommandPaletteOpenChangeDetails) => void;\n trigger?: OverlayTrigger;\n renderLeading?: (itemId: Key) => ReactNode;\n portalContainer?: HTMLElement;\n className?: string;\n}>;\n\nexport const CommandPalette = forwardRef(function CommandPalette<Key extends string = string>(\n {\n descriptor,\n source,\n query,\n onQueryChange,\n onActivate,\n onActivateAfterDismiss,\n queryState,\n dismissPolicy,\n open: openProp,\n defaultOpen,\n onOpenChange,\n trigger,\n renderLeading,\n portalContainer,\n className,\n }: CommandPaletteProps<Key>,\n forwardedRef: React.Ref<HTMLDivElement>,\n) {\n validateCommandPaletteDescriptor(descriptor);\n const policy: CommandPaletteDismissPolicy = { ...commandPaletteBehaviorDefaults, ...dismissPolicy };\n const [internalOpen, setInternalOpen] = useState(defaultOpen ?? false);\n const open = openProp ?? internalOpen;\n const results = useMemo(\n () => resolveResults<Key>(source, query, queryState, descriptor.emptyMessage),\n [source, query, queryState, descriptor.emptyMessage],\n );\n // Stale external rows stay visible but inert, as in the Native Combobox.\n const enabled = results.current ? results.items.filter((item) => !item.disabled) : [];\n const [activeId, setActiveId] = useState<Key | null>(null);\n const contentRef = useRef<HTMLDivElement>(null);\n const triggerRef = useRef<HTMLElement>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const id = `${useId().replaceAll(\":\", \"\")}-command-palette`;\n const active = enabled.find((item) => item.id === activeId) ?? enabled[0] ?? null;\n\n useEffect(() => {\n // A new query builds a new result list; the first enabled row becomes active\n // so Enter always has an unambiguous target. Only the query resets it: products\n // often pass `source`/`queryState` as inline objects, and keying on their\n // identity snapped the active row back to the first item on every render\n // (2026-10-06 usage-guide audit). A row that disappears from the results\n // already falls back to the first enabled row through `active` above.\n setActiveId(null);\n }, [query]);\n\n const change = (next: boolean, reason: CommandPaletteOpenChangeDetails[\"reason\"]) => {\n if (openProp === undefined) setInternalOpen(next);\n onOpenChange?.(next, { reason });\n };\n const requestClose = (reason: CommandPaletteDismissReason) => {\n if (!canDismissCommandPalette(reason, policy)) return;\n change(false, reason);\n };\n const activate = (itemId: Key, reason: CommandPaletteActivateReason) => {\n onActivate(itemId, reason);\n // Running a command always closes the palette — `activation` is a dismiss\n // reason no policy can veto — and the follow-up surface opens after that.\n change(false, \"activation\");\n if (onActivateAfterDismiss) queueMicrotask(() => onActivateAfterDismiss(itemId, reason));\n };\n\n useModalFocus({\n active: open,\n contentRef,\n initialFocusRef: inputRef,\n ...(trigger === undefined ? {} : { fallbackReturnRef: triggerRef }),\n onEscape: () => requestClose(\"escape\"),\n });\n\n const onKeyDown = (event: KeyboardEvent<HTMLInputElement>) => {\n const intent = getCollectionNavigationIntent(event.key as never);\n if (intent) {\n const target = getCollectionNavigationTarget({ items: enabled }, active?.id ?? null, intent, true);\n if (target === undefined) return;\n event.preventDefault();\n setActiveId(target as Key);\n return;\n }\n if (event.key === \"Enter\" && active) {\n event.preventDefault();\n activate(active.id as Key, \"keyboard\");\n }\n };\n\n const searchInput = (\n <input\n ref={inputRef}\n type=\"text\"\n role=\"combobox\"\n aria-expanded\n aria-controls={`${id}-results`}\n aria-activedescendant={active ? `${id}-${active.id}` : undefined}\n aria-label={descriptor.accessibilityLabel}\n placeholder={descriptor.searchPlaceholder}\n className=\"hjm-command-palette__search\"\n value={query}\n onChange={(event) => onQueryChange(event.target.value)}\n onKeyDown={onKeyDown}\n />\n );\n\n const renderedTrigger = trigger === undefined\n ? null\n : renderTrigger(trigger, triggerRef, open, id, \"dialog\", () => change(true, \"trigger\"));\n if (!open) return renderedTrigger;\n\n return (\n <>\n {renderedTrigger}\n <HjmPortal {...(portalContainer === undefined ? {} : { container: portalContainer })}>\n <div\n className=\"hjm-overlay hjm-command-palette-positioner\"\n data-kind=\"command-palette\"\n style={{ zIndex: getModalLayer(0) }}\n onMouseDown={(event) => { if (event.target === event.currentTarget) requestClose(\"outside\"); }}\n >\n <div\n ref={composeRefs(contentRef, forwardedRef)}\n id={id}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={descriptor.accessibilityLabel}\n data-hjm-modal-content=\"\"\n className={classNames(\"hjm-command-palette\", className)}\n style={{ maxInlineSize: commandPaletteRecipe.content.maxWidth, maxBlockSize: commandPaletteRecipe.content.maxHeight } as CSSProperties}\n >\n {/*\n Opt-in through descriptor.closeLabel because the renderer must not\n invent untranslated copy. Reuses Dialog's close chrome instead of a\n second close-button style (styles.css is at its byte budget).\n */}\n {descriptor.closeLabel ? (\n <div className=\"hjm-command-palette__search-row\">\n {searchInput}\n <button\n type=\"button\"\n className=\"hjm-dialog__close hjm-command-palette__close\"\n aria-label={descriptor.closeLabel}\n onClick={() => requestClose(\"close-action\")}\n >\n <span aria-hidden=\"true\">×</span>\n </button>\n </div>\n ) : searchInput}\n <div id={`${id}-results`} role=\"listbox\" aria-label={descriptor.accessibilityLabel} className=\"hjm-command-palette__viewport\">\n {results.status === null ? null : (\n // Once for the whole list, never per section.\n <p\n className=\"hjm-command-palette__state\"\n data-kind={results.status.kind}\n role={results.status.kind === \"error\" ? \"alert\" : \"status\"}\n >\n {results.status.message}\n </p>\n )}\n {results.sections.map((section) => (\n <div\n key={section.id}\n className=\"hjm-command-palette__section\"\n {...(section.name === undefined ? { role: \"presentation\" } : { role: \"group\", \"aria-label\": section.name })}\n >\n {section.label ? <p className=\"hjm-command-palette__section-label\" aria-hidden=\"true\">{section.label}</p> : null}\n {section.items.map((item) => {\n const inert = item.disabled === true || !results.current;\n return (\n <div\n key={item.id}\n id={`${id}-${item.id}`}\n role=\"option\"\n aria-selected={item.id === active?.id}\n aria-disabled={inert || undefined}\n className=\"hjm-command-palette__item\"\n data-tone={item.tone}\n onMouseDown={(event) => {\n event.preventDefault();\n if (!inert) activate(item.id as Key, \"pointer\");\n }}\n onMouseEnter={() => { if (!inert) setActiveId(item.id as Key); }}\n >\n {renderLeading?.(item.id as Key)}\n <span className=\"hjm-command-palette__copy\">\n <span>{item.label}</span>\n {item.description ? <span className=\"hjm-command-palette__description\">{item.description}</span> : null}\n </span>\n {item.shortcut ? <kbd className=\"hjm-command-palette__shortcut\">{item.shortcut}</kbd> : null}\n </div>\n );\n })}\n </div>\n ))}\n </div>\n </div>\n </div>\n </HjmPortal>\n </>\n );\n}) as <Key extends string = string>(\n props: CommandPaletteProps<Key> & { ref?: React.Ref<HTMLDivElement> },\n) => React.ReactElement | null;\n"]}
|
|
@@ -18,7 +18,20 @@ type HjmControlledStyleKey = Exclude<keyof CSSProperties, HjmCompositionStyleKey
|
|
|
18
18
|
type HjmControlledStyleExclusions = Readonly<{
|
|
19
19
|
[Key in HjmControlledStyleKey]?: never;
|
|
20
20
|
}>;
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Canonical, layout-only style accepted by HJM component roots.
|
|
23
|
+
*
|
|
24
|
+
* Every public Web component with an in-flow root takes `layoutStyle` (2026-10-06
|
|
25
|
+
* sweep; `test/composition-style.ssr.test.tsx` renders them), including the
|
|
26
|
+
* `./screens`, `./screen-flows` and `./saved-items` screens through ScreenLayout
|
|
27
|
+
* (ListDetailScreen and SavedItemsScreen place their outer two-pane host). The
|
|
28
|
+
* exceptions have no in-flow box to place: providers (HjmProvider, OverlayStackProvider,
|
|
29
|
+
* ToastProvider), viewport/portal layers (Dialog, AlertDialog, Sheet, PhotoSourceSheet,
|
|
30
|
+
* SidePanel, Popover, Tour, CommandPalette, Toast, Celebration), and recipe-pinned or
|
|
31
|
+
* hidden elements (FloatingActionButton, SkipNav, VisuallyHidden). Most of their props
|
|
32
|
+
* types carry the reason. CommandPalette's and PhotoSourceSheet's are recorded only here:
|
|
33
|
+
* both render a modal portal surface.
|
|
34
|
+
*/
|
|
22
35
|
export type HjmCompositionStyle = Readonly<Pick<CSSProperties, HjmCompositionStyleKey>> & HjmControlledStyleExclusions;
|
|
23
36
|
/** React DOM form of `HjmCompositionStyle`. */
|
|
24
37
|
export type HjmCompositionStyleProp = HjmCompositionStyle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-style.d.ts","sourceRoot":"","sources":["../src/composition-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,oQAmBiB,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,KAAK,qBAAqB,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,sBAAsB,CAAC,CAAC;AAElF,KAAK,4BAA4B,GAAG,QAAQ,CAAC;KAC1C,GAAG,IAAI,qBAAqB,CAAC,CAAC,EAAE,KAAK;CACvC,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"composition-style.d.ts","sourceRoot":"","sources":["../src/composition-style.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,uBAAuB,oQAmBiB,CAAC;AAEtD,MAAM,MAAM,sBAAsB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,KAAK,qBAAqB,GAAG,OAAO,CAAC,MAAM,aAAa,EAAE,sBAAsB,CAAC,CAAC;AAElF,KAAK,4BAA4B,GAAG,QAAQ,CAAC;KAC1C,GAAG,IAAI,qBAAqB,CAAC,CAAC,EAAE,KAAK;CACvC,CAAC,CAAC;AAEH;;;;;;;;;;;;;GAaG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,IAAI,CAAC,aAAa,EAAE,sBAAsB,CAAC,CAAC,GACrF,4BAA4B,CAAC;AAE/B,+CAA+C;AAC/C,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"composition-style.js","sourceRoot":"","sources":["../src/composition-style.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW;IACX,MAAM;IACN,WAAW;IACX,UAAU;IACV,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,aAAa;IACb,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,WAAW;IACX,eAAe;IACf,UAAU;IACV,eAAe;IACf,UAAU;IACV,OAAO;CAC4C,CAAC","sourcesContent":["import type { CSSProperties } from \"react\";\n\n/**\n * Layout-only keys that an app may use to place an HJM component in a page.\n *\n * Color, typography, radius, height, opacity, transform, padding, gap, border,\n * and interaction-state properties are intentionally absent because the HJM\n * recipe or semantic product-theme adapter owns them.\n *\n * Mirrors React Native's `hjmCompositionStyleKeys`, mapping the physical\n * direction keys (`marginHorizontal`, `marginStart`) onto CSS logical\n * properties so placement keeps the same meaning under RTL.\n *\n * @see ../../react-native/src/composition-style.ts\n */\nexport const hjmCompositionStyleKeys = [\n \"alignSelf\",\n \"flex\",\n \"flexBasis\",\n \"flexGrow\",\n \"flexShrink\",\n \"flexWrap\",\n \"margin\",\n \"marginBlock\",\n \"marginBottom\",\n \"marginInline\",\n \"marginInlineEnd\",\n \"marginInlineStart\",\n \"marginTop\",\n \"maxInlineSize\",\n \"maxWidth\",\n \"minInlineSize\",\n \"minWidth\",\n \"width\",\n] as const satisfies readonly (keyof CSSProperties)[];\n\nexport type HjmCompositionStyleKey = (typeof hjmCompositionStyleKeys)[number];\n\ntype HjmControlledStyleKey = Exclude<keyof CSSProperties, HjmCompositionStyleKey>;\n\ntype HjmControlledStyleExclusions = Readonly<{\n [Key in HjmControlledStyleKey]?: never;\n}>;\n\n
|
|
1
|
+
{"version":3,"file":"composition-style.js","sourceRoot":"","sources":["../src/composition-style.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,WAAW;IACX,MAAM;IACN,WAAW;IACX,UAAU;IACV,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,aAAa;IACb,cAAc;IACd,cAAc;IACd,iBAAiB;IACjB,mBAAmB;IACnB,WAAW;IACX,eAAe;IACf,UAAU;IACV,eAAe;IACf,UAAU;IACV,OAAO;CAC4C,CAAC","sourcesContent":["import type { CSSProperties } from \"react\";\n\n/**\n * Layout-only keys that an app may use to place an HJM component in a page.\n *\n * Color, typography, radius, height, opacity, transform, padding, gap, border,\n * and interaction-state properties are intentionally absent because the HJM\n * recipe or semantic product-theme adapter owns them.\n *\n * Mirrors React Native's `hjmCompositionStyleKeys`, mapping the physical\n * direction keys (`marginHorizontal`, `marginStart`) onto CSS logical\n * properties so placement keeps the same meaning under RTL.\n *\n * @see ../../react-native/src/composition-style.ts\n */\nexport const hjmCompositionStyleKeys = [\n \"alignSelf\",\n \"flex\",\n \"flexBasis\",\n \"flexGrow\",\n \"flexShrink\",\n \"flexWrap\",\n \"margin\",\n \"marginBlock\",\n \"marginBottom\",\n \"marginInline\",\n \"marginInlineEnd\",\n \"marginInlineStart\",\n \"marginTop\",\n \"maxInlineSize\",\n \"maxWidth\",\n \"minInlineSize\",\n \"minWidth\",\n \"width\",\n] as const satisfies readonly (keyof CSSProperties)[];\n\nexport type HjmCompositionStyleKey = (typeof hjmCompositionStyleKeys)[number];\n\ntype HjmControlledStyleKey = Exclude<keyof CSSProperties, HjmCompositionStyleKey>;\n\ntype HjmControlledStyleExclusions = Readonly<{\n [Key in HjmControlledStyleKey]?: never;\n}>;\n\n/**\n * Canonical, layout-only style accepted by HJM component roots.\n *\n * Every public Web component with an in-flow root takes `layoutStyle` (2026-10-06\n * sweep; `test/composition-style.ssr.test.tsx` renders them), including the\n * `./screens`, `./screen-flows` and `./saved-items` screens through ScreenLayout\n * (ListDetailScreen and SavedItemsScreen place their outer two-pane host). The\n * exceptions have no in-flow box to place: providers (HjmProvider, OverlayStackProvider,\n * ToastProvider), viewport/portal layers (Dialog, AlertDialog, Sheet, PhotoSourceSheet,\n * SidePanel, Popover, Tour, CommandPalette, Toast, Celebration), and recipe-pinned or\n * hidden elements (FloatingActionButton, SkipNav, VisuallyHidden). Most of their props\n * types carry the reason. CommandPalette's and PhotoSourceSheet's are recorded only here:\n * both render a modal portal surface.\n */\nexport type HjmCompositionStyle = Readonly<Pick<CSSProperties, HjmCompositionStyleKey>> &\n HjmControlledStyleExclusions;\n\n/** React DOM form of `HjmCompositionStyle`. */\nexport type HjmCompositionStyleProp = HjmCompositionStyle;\n"]}
|