@40rty/ams-ui 0.1.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/agent.js +148 -0
- package/dist/catalog-data.js +93 -0
- package/dist/catalog-entries.js +8 -0
- package/dist/chunk-432XYPDT.js +1012 -0
- package/dist/chunk-54QPRWEG.js +2800 -0
- package/dist/chunk-CKGGECAQ.js +239 -0
- package/dist/chunk-E3IJDSKY.js +173 -0
- package/dist/chunk-JQNZ5UUK.js +226 -0
- package/dist/chunk-LQLOG2V3.js +649 -0
- package/dist/chunk-MHUEIBJ3.js +117 -0
- package/dist/chunk-ORIOBWTD.js +112 -0
- package/dist/css/preset/motion.css +78 -0
- package/dist/css/preset/tailwind-theme.css +163 -0
- package/dist/css/shell/mobile/island.css +478 -0
- package/dist/hooks.js +25 -0
- package/dist/index.js +7165 -0
- package/dist/motion.js +113 -0
- package/dist/shell.js +5621 -0
- package/dist/types/agent/AgentStreamingState.d.ts +58 -0
- package/dist/types/agent/ProseSurface.d.ts +31 -0
- package/dist/types/agent/index.d.ts +8 -0
- package/dist/types/agent/phase-label.d.ts +13 -0
- package/dist/types/agent/presence/AgentPresenceWidget.d.ts +85 -0
- package/dist/types/agent/presence/BriefIdentity.d.ts +9 -0
- package/dist/types/agent/presence/CompactRead.d.ts +44 -0
- package/dist/types/agent/presence/CriteriaRail.d.ts +68 -0
- package/dist/types/agent/presence/DefaultNotch.d.ts +2 -0
- package/dist/types/agent/presence/FactChip.d.ts +10 -0
- package/dist/types/agent/presence/InlinePresenceRead.d.ts +25 -0
- package/dist/types/agent/presence/KnowledgePeek.d.ts +23 -0
- package/dist/types/agent/presence/LayoutMorphSkeleton.d.ts +59 -0
- package/dist/types/agent/presence/PresenceBrief.d.ts +29 -0
- package/dist/types/agent/presence/PresenceFiller.d.ts +24 -0
- package/dist/types/agent/presence/SourceSift.d.ts +48 -0
- package/dist/types/agent/presence/StreamRead.d.ts +50 -0
- package/dist/types/agent/presence/VoiceLine.d.ts +19 -0
- package/dist/types/agent/presence/band-beat.d.ts +40 -0
- package/dist/types/agent/presence/band-row.d.ts +188 -0
- package/dist/types/agent/presence/cite-image.d.ts +9 -0
- package/dist/types/agent/presence/class-names.d.ts +134 -0
- package/dist/types/agent/presence/element-view.d.ts +83 -0
- package/dist/types/agent/presence/fact-forms/baseline-forms.d.ts +20 -0
- package/dist/types/agent/presence/fact-forms/class-names.d.ts +14 -0
- package/dist/types/agent/presence/fact-forms/index.d.ts +3 -0
- package/dist/types/agent/presence/fact-forms/register.d.ts +9 -0
- package/dist/types/agent/presence/fact-rail.d.ts +76 -0
- package/dist/types/agent/presence/fact-slots.d.ts +97 -0
- package/dist/types/agent/presence/folded.d.ts +26 -0
- package/dist/types/agent/presence/forms.d.ts +5 -0
- package/dist/types/agent/presence/index.d.ts +39 -0
- package/dist/types/agent/presence/notch/PresenceNotch.d.ts +20 -0
- package/dist/types/agent/presence/parts.d.ts +29 -0
- package/dist/types/agent/presence/read-data.d.ts +48 -0
- package/dist/types/agent/presence/reads.d.ts +37 -0
- package/dist/types/agent/presence/sift-deck.d.ts +58 -0
- package/dist/types/agent/presence/source-cards/ArticleSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/CollectionSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/PolicySourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ProductSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/ReviewSourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/SourceCard.d.ts +4 -0
- package/dist/types/agent/presence/source-cards/card-frame.d.ts +38 -0
- package/dist/types/agent/presence/source-cards/card-marks.d.ts +69 -0
- package/dist/types/agent/presence/source-cards/card-plate.d.ts +20 -0
- package/dist/types/agent/presence/source-cards/card-shell.d.ts +91 -0
- package/dist/types/agent/presence/source-cards/register.d.ts +6 -0
- package/dist/types/agent/presence/source-cards/review-passage.d.ts +53 -0
- package/dist/types/agent/presence/swatch.d.ts +4 -0
- package/dist/types/agent/presence/use-band-facts.d.ts +9 -0
- package/dist/types/agent/presence/use-forget-fact.d.ts +56 -0
- package/dist/types/agent/presence/use-measured-height.d.ts +11 -0
- package/dist/types/catalog-data/base.d.ts +2 -0
- package/dist/types/catalog-data/chat.d.ts +55 -0
- package/dist/types/catalog-data/content.d.ts +1129 -0
- package/dist/types/catalog-data/ecommerce.d.ts +4842 -0
- package/dist/types/catalog-data/index.d.ts +7 -0
- package/dist/types/catalog-data/social.d.ts +1552 -0
- package/dist/types/catalog-data/tokens.d.ts +20 -0
- package/dist/types/catalog-data/ugc.d.ts +50 -0
- package/dist/types/catalog-entries.d.ts +35 -0
- package/dist/types/catalog.d.ts +18 -0
- package/dist/types/components/SkeletonSwap.d.ts +27 -0
- package/dist/types/components/agentic/AgentText.d.ts +44 -0
- package/dist/types/components/agentic/Turn.d.ts +21 -0
- package/dist/types/components/browse/CanvasBootLoader.d.ts +16 -0
- package/dist/types/components/browse/ContinuationLoading.d.ts +22 -0
- package/dist/types/components/browse/canvas-booting.d.ts +37 -0
- package/dist/types/components/browse/constants.d.ts +2 -0
- package/dist/types/components/browse/index.d.ts +4 -0
- package/dist/types/components/chat/SuggestionCards.d.ts +2 -0
- package/dist/types/components/chat/index.d.ts +1 -0
- package/dist/types/components/content/FAQ.d.ts +12 -0
- package/dist/types/components/content/FeatureGrid.d.ts +11 -0
- package/dist/types/components/content/InfoCards.d.ts +16 -0
- package/dist/types/components/content/Reviews.d.ts +9 -0
- package/dist/types/components/content/RichText.d.ts +10 -0
- package/dist/types/components/content/article/ArticleDetail.d.ts +15 -0
- package/dist/types/components/content/article/BlogCard.d.ts +11 -0
- package/dist/types/components/content/article/BlogPosts.d.ts +19 -0
- package/dist/types/components/content/page/PageDetail.d.ts +13 -0
- package/dist/types/components/content/page/PolicyDetail.d.ts +23 -0
- package/dist/types/components/ecommerce/cart/AddToCartButton.d.ts +9 -0
- package/dist/types/components/ecommerce/cart/CartContent.d.ts +40 -0
- package/dist/types/components/ecommerce/cart/CartDrawer.d.ts +41 -0
- package/dist/types/components/ecommerce/cart/CartFoot.d.ts +30 -0
- package/dist/types/components/ecommerce/cart/CartLineItem.d.ts +13 -0
- package/dist/types/components/ecommerce/cart/CartLineRow.d.ts +17 -0
- package/dist/types/components/ecommerce/cart/CartPromoCode.d.ts +29 -0
- package/dist/types/components/ecommerce/cart/CartSummary.d.ts +7 -0
- package/dist/types/components/ecommerce/cart/CartWidget.d.ts +10 -0
- package/dist/types/components/ecommerce/cart/VariantPickerModal.d.ts +12 -0
- package/dist/types/components/ecommerce/cart/cart-format.d.ts +8 -0
- package/dist/types/components/ecommerce/cart/use-cart-view.d.ts +50 -0
- package/dist/types/components/ecommerce/collection/CollectionCard.d.ts +10 -0
- package/dist/types/components/ecommerce/collection/CollectionGrid.d.ts +8 -0
- package/dist/types/components/ecommerce/collection/CollectionList.d.ts +13 -0
- package/dist/types/components/ecommerce/collection/internal/CollectionListItem.d.ts +13 -0
- package/dist/types/components/ecommerce/product/AddToRegistry.d.ts +36 -0
- package/dist/types/components/ecommerce/product/ComparisonTable.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ComparisonTableSkeleton.d.ts +11 -0
- package/dist/types/components/ecommerce/product/PresenceProductRail.d.ts +35 -0
- package/dist/types/components/ecommerce/product/ProductBadge.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductCard.d.ts +27 -0
- package/dist/types/components/ecommerce/product/ProductDetail.d.ts +25 -0
- package/dist/types/components/ecommerce/product/ProductGallery.d.ts +19 -0
- package/dist/types/components/ecommerce/product/ProductGrid.d.ts +26 -0
- package/dist/types/components/ecommerce/product/ProductImage.d.ts +54 -0
- package/dist/types/components/ecommerce/product/ProductOption.d.ts +9 -0
- package/dist/types/components/ecommerce/product/ProductPrice.d.ts +8 -0
- package/dist/types/components/ecommerce/product/ProductVideoPlayer.d.ts +17 -0
- package/dist/types/components/ecommerce/product/comparison-table-parts.d.ts +41 -0
- package/dist/types/components/ecommerce/product/comparison-table-rows.d.ts +24 -0
- package/dist/types/components/ecommerce/product/image-trim.d.ts +35 -0
- package/dist/types/components/ecommerce/product/product-card-glyphs.d.ts +2 -0
- package/dist/types/components/ecommerce/product/registry-logos.d.ts +2 -0
- package/dist/types/components/ecommerce/product/trim-geometry.d.ts +45 -0
- package/dist/types/components/ecommerce/wishlist/WishlistDrawer.d.ts +16 -0
- package/dist/types/components/feedback/Skeleton.d.ts +13 -0
- package/dist/types/components/feedback/Thinking.d.ts +15 -0
- package/dist/types/components/layout/AspectRatio.d.ts +5 -0
- package/dist/types/components/layout/Backdrop.d.ts +32 -0
- package/dist/types/components/layout/Container.d.ts +6 -0
- package/dist/types/components/layout/Divider.d.ts +5 -0
- package/dist/types/components/layout/Drawer.d.ts +9 -0
- package/dist/types/components/layout/DrawerDockSlot.d.ts +40 -0
- package/dist/types/components/layout/Grid.d.ts +8 -0
- package/dist/types/components/layout/Modal.d.ts +25 -0
- package/dist/types/components/layout/Page.d.ts +11 -0
- package/dist/types/components/layout/Section.d.ts +6 -0
- package/dist/types/components/layout/Stack.d.ts +7 -0
- package/dist/types/components/marketing/AnnouncementBar.d.ts +15 -0
- package/dist/types/components/marketing/BrandStory.d.ts +19 -0
- package/dist/types/components/marketing/HeroBanner.d.ts +69 -0
- package/dist/types/components/marketing/HeroBannerFeatures.d.ts +10 -0
- package/dist/types/components/marketing/HeroBannerInline.d.ts +20 -0
- package/dist/types/components/marketing/PromoBanner.d.ts +11 -0
- package/dist/types/components/marketing/internal/AnnouncementLink.d.ts +5 -0
- package/dist/types/components/marketing/internal/AnnouncementMessage.d.ts +10 -0
- package/dist/types/components/navigation/Breadcrumbs.d.ts +10 -0
- package/dist/types/components/navigation/Footer.d.ts +15 -0
- package/dist/types/components/navigation/Header.d.ts +14 -0
- package/dist/types/components/navigation/internal/BreadcrumbLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/FooterLink.d.ts +5 -0
- package/dist/types/components/navigation/internal/HeaderLink.d.ts +5 -0
- package/dist/types/components/shell/BaseMark.d.ts +11 -0
- package/dist/types/components/shell/CartPill.d.ts +13 -0
- package/dist/types/components/shell/ComposerDock.d.ts +9 -0
- package/dist/types/components/shell/ErrorBanner.d.ts +14 -0
- package/dist/types/components/shell/HistoryMenu.d.ts +15 -0
- package/dist/types/components/shell/MenuButton.d.ts +31 -0
- package/dist/types/components/shell/MountainRidges.d.ts +11 -0
- package/dist/types/components/shell/PendingTurn.d.ts +1 -0
- package/dist/types/components/shell/ShellTop.d.ts +35 -0
- package/dist/types/components/shell/brand-shell.d.ts +441 -0
- package/dist/types/components/shell/index.d.ts +9 -0
- package/dist/types/components/shell/marks/index.d.ts +5 -0
- package/dist/types/components/social/ReviewCard.d.ts +9 -0
- package/dist/types/components/social/ReviewSummary.d.ts +7 -0
- package/dist/types/components/social/TestimonialCard.d.ts +9 -0
- package/dist/types/components/social/TestimonialCarousel.d.ts +16 -0
- package/dist/types/components/social/UgcCard.d.ts +9 -0
- package/dist/types/components/social/UgcGallery.d.ts +8 -0
- package/dist/types/hooks/index.d.ts +8 -0
- package/dist/types/hooks/keyboard.d.ts +18 -0
- package/dist/types/hooks/use-container-width.d.ts +11 -0
- package/dist/types/hooks/use-dismiss-on-outside.d.ts +23 -0
- package/dist/types/hooks/use-focus-on-change.d.ts +8 -0
- package/dist/types/hooks/use-focus-trap.d.ts +12 -0
- package/dist/types/hooks/use-media-query.d.ts +12 -0
- package/dist/types/hooks/use-projection.d.ts +24 -0
- package/dist/types/hooks/use-reduced-motion.d.ts +1 -0
- package/dist/types/hooks/use-scroll-lock.d.ts +19 -0
- package/dist/types/hooks/use-scroll-threshold.d.ts +14 -0
- package/dist/types/hooks/use-textarea-autosize.d.ts +16 -0
- package/dist/types/index.d.ts +74 -0
- package/dist/types/labels-context.d.ts +18 -0
- package/dist/types/labels.d.ts +240 -0
- package/dist/types/motion/ease.d.ts +10 -0
- package/dist/types/motion/generation/ActiveBlockIndicator.d.ts +27 -0
- package/dist/types/motion/generation/BlurUpImage.d.ts +23 -0
- package/dist/types/motion/generation/ResolveEntrance.d.ts +22 -0
- package/dist/types/motion/generation/ShimmerSkeleton.d.ts +20 -0
- package/dist/types/motion/generation/WordReveal.d.ts +26 -0
- package/dist/types/motion/generation/index.d.ts +6 -0
- package/dist/types/motion/hooks/useInViewOnce.d.ts +14 -0
- package/dist/types/motion/hooks/useScrollDirection.d.ts +38 -0
- package/dist/types/motion/hooks/useScrollProgress.d.ts +23 -0
- package/dist/types/motion/hooks/useStableValue.d.ts +36 -0
- package/dist/types/motion/hooks/useSuccessFlash.d.ts +1 -0
- package/dist/types/motion/index.d.ts +18 -0
- package/dist/types/motion/presets.d.ts +335 -0
- package/dist/types/motion/primitives/Agent.d.ts +118 -0
- package/dist/types/motion/primitives/MorphRegion.d.ts +16 -0
- package/dist/types/motion/primitives/Parallax.d.ts +19 -0
- package/dist/types/motion/primitives/Pin.d.ts +26 -0
- package/dist/types/motion/primitives/Reveal.d.ts +29 -0
- package/dist/types/motion/primitives/RevealStagger.d.ts +16 -0
- package/dist/types/motion/primitives/StickyShelf.d.ts +18 -0
- package/dist/types/primitives/Badge/index.d.ts +12 -0
- package/dist/types/primitives/Button/index.d.ts +25 -0
- package/dist/types/primitives/Input/index.d.ts +5 -0
- package/dist/types/primitives/Money/index.d.ts +13 -0
- package/dist/types/primitives/Select/index.d.ts +5 -0
- package/dist/types/primitives/Skeleton/index.d.ts +4 -0
- package/dist/types/shell/AnimatedPlaceholder.d.ts +13 -0
- package/dist/types/shell/BottomSheet.d.ts +54 -0
- package/dist/types/shell/Button.d.ts +19 -0
- package/dist/types/shell/ChromeSurface.d.ts +33 -0
- package/dist/types/shell/Composer.d.ts +56 -0
- package/dist/types/shell/ComposerChipStrip.d.ts +9 -0
- package/dist/types/shell/ConversationTransition.d.ts +27 -0
- package/dist/types/shell/DictationButton.d.ts +24 -0
- package/dist/types/shell/DragSheet.d.ts +34 -0
- package/dist/types/shell/InlineCompletion.d.ts +38 -0
- package/dist/types/shell/LauncherDock.d.ts +40 -0
- package/dist/types/shell/ListeningWaveform.d.ts +18 -0
- package/dist/types/shell/MenuAccordionPanel.d.ts +26 -0
- package/dist/types/shell/MenuDrawer.d.ts +72 -0
- package/dist/types/shell/MenuFlyout.d.ts +22 -0
- package/dist/types/shell/MenuNav.d.ts +30 -0
- package/dist/types/shell/MenuNavBar.d.ts +22 -0
- package/dist/types/shell/ShellMenuChrome.d.ts +66 -0
- package/dist/types/shell/ShellScaffold.d.ts +92 -0
- package/dist/types/shell/SideDock.d.ts +75 -0
- package/dist/types/shell/Skeleton.d.ts +22 -0
- package/dist/types/shell/Spinner.d.ts +10 -0
- package/dist/types/shell/TypedPlaceholder.d.ts +11 -0
- package/dist/types/shell/VoiceControl.d.ts +23 -0
- package/dist/types/shell/VoiceIsland.d.ts +24 -0
- package/dist/types/shell/canvas-gutter-style.d.ts +15 -0
- package/dist/types/shell/composer/AttachButton.d.ts +14 -0
- package/dist/types/shell/composer/AttachmentStrip.d.ts +12 -0
- package/dist/types/shell/composer/ClearSessionButton.d.ts +16 -0
- package/dist/types/shell/composer/ConversationHistoryButton.d.ts +25 -0
- package/dist/types/shell/composer/ShareCanvasButton.d.ts +19 -0
- package/dist/types/shell/composer/ThreadJumpRail.d.ts +43 -0
- package/dist/types/shell/composer/composer-metrics.d.ts +6 -0
- package/dist/types/shell/composer/field-metrics.d.ts +97 -0
- package/dist/types/shell/composer/heic-convert.d.ts +6 -0
- package/dist/types/shell/composer/use-field-autosize.d.ts +26 -0
- package/dist/types/shell/composer/useComposerAttachments.d.ts +37 -0
- package/dist/types/shell/composer/usePromptComposer.d.ts +51 -0
- package/dist/types/shell/dock-context.d.ts +10 -0
- package/dist/types/shell/index.d.ts +36 -0
- package/dist/types/shell/menu-columns.d.ts +19 -0
- package/dist/types/shell/mobile/DefaultMobileShell.d.ts +88 -0
- package/dist/types/shell/mobile/IslandComposeGroup.d.ts +41 -0
- package/dist/types/shell/mobile/IslandInputBar.d.ts +61 -0
- package/dist/types/shell/mobile/IslandNavButtons.d.ts +20 -0
- package/dist/types/shell/mobile/IslandTrailingAction.d.ts +34 -0
- package/dist/types/shell/mobile/MobileChrome.d.ts +34 -0
- package/dist/types/shell/mobile/MobileVoiceConsole.d.ts +42 -0
- package/dist/types/shell/mobile/MorphIsland.d.ts +105 -0
- package/dist/types/shell/mobile/RestIsland.d.ts +41 -0
- package/dist/types/shell/mobile/constants.d.ts +26 -0
- package/dist/types/shell/mobile/document-scroll-ref.d.ts +22 -0
- package/dist/types/shell/mobile/hero-entry-point.d.ts +110 -0
- package/dist/types/shell/mobile/island-metrics.d.ts +131 -0
- package/dist/types/shell/mobile/sheet-detents.d.ts +49 -0
- package/dist/types/shell/mobile/turn-end-action.d.ts +44 -0
- package/dist/types/shell/mobile/use-blur-on-canvas-gesture.d.ts +31 -0
- package/dist/types/shell/mobile/use-island-fold-scroll.d.ts +28 -0
- package/dist/types/shell/mobile/use-keyboard-inset.d.ts +18 -0
- package/dist/types/shell/mobile/use-sheet-fold-gesture.d.ts +57 -0
- package/dist/types/shell/slots.d.ts +16 -0
- package/dist/types/shell/thread-reland.d.ts +22 -0
- package/dist/types/shell/use-dock-state.d.ts +54 -0
- package/dist/types/types/commerce.d.ts +1 -0
- package/dist/types/utils/cn.d.ts +2 -0
- package/dist/types/utils/format-money.d.ts +2 -0
- package/dist/types/utils/html-to-text.d.ts +8 -0
- package/dist/types/utils/sanitize-html.d.ts +12 -0
- package/dist/types/utils/use-backdrop-presence.d.ts +24 -0
- package/dist/types/utils/use-composer-mode.d.ts +26 -0
- package/dist/types/utils/use-is-seed-home.d.ts +13 -0
- package/dist/types/utils/use-safe-cart.d.ts +17 -0
- package/dist/types/utils/use-safe-facts.d.ts +9 -0
- package/dist/types/utils/use-safe-fourty-session.d.ts +15 -0
- package/package.json +80 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ShellMenuItem } from '@40rty/ams-sdk';
|
|
3
|
+
import type { MenuDrawerItem } from './MenuDrawer';
|
|
4
|
+
/**
|
|
5
|
+
* MenuNavBar — the desktop counterpart to the platform category drawer: an
|
|
6
|
+
* inline row of top-level labels (mounted beside the logo in `ShellMenuChrome`)
|
|
7
|
+
* instead of a hamburger trigger. A row with `megaMenu` columns opens them in a
|
|
8
|
+
* dropdown anchored beneath the label on hover; a row with only an `action`
|
|
9
|
+
* dispatches on click. Touch/phone form factors never mount this — they keep
|
|
10
|
+
* the hamburger trigger + `MenuDrawer`, where a side flyout has no room and
|
|
11
|
+
* hover doesn't exist (see `ShellMenuChrome`).
|
|
12
|
+
*
|
|
13
|
+
* Same split as the drawer: dumb chrome that reports a picked item through
|
|
14
|
+
* `onSelectItem`; the harness owns what a selection means. Columns render
|
|
15
|
+
* through the same `MenuColumn` the drawer's `MenuFlyout` uses, so desktop
|
|
16
|
+
* drawer and nav-bar dropdowns never drift into two link renderings.
|
|
17
|
+
*/
|
|
18
|
+
export declare function MenuNavBar({ items, onSelectItem, gap, }: {
|
|
19
|
+
items: MenuDrawerItem[];
|
|
20
|
+
onSelectItem: (item: ShellMenuItem) => void;
|
|
21
|
+
gap?: number;
|
|
22
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ShellMenuItem } from '@40rty/ams-sdk';
|
|
3
|
+
import { type MenuDrawerItem } from './MenuDrawer';
|
|
4
|
+
export interface ShellMenuChromeProps {
|
|
5
|
+
/** Brand mark — floats beside the trigger on the canvas. */
|
|
6
|
+
logo: React.ReactNode;
|
|
7
|
+
/** Hamburger/menu glyph for the trigger — the brand supplies its own icon. */
|
|
8
|
+
menuIcon: React.ReactNode;
|
|
9
|
+
/** Drawer entries. When empty, the trigger is omitted (logo-only chrome). */
|
|
10
|
+
items: MenuDrawerItem[];
|
|
11
|
+
/** Dispatches a picked drawer/flyout item. */
|
|
12
|
+
onSelectItem: (item: ShellMenuItem) => void;
|
|
13
|
+
/** Floating row height in px (desktop only — the mobile bar owns its own
|
|
14
|
+
* height and this row stretches to it). Default 56. */
|
|
15
|
+
height?: number;
|
|
16
|
+
/** Horizontal inset of the floating row in px (desktop only — on mobile the
|
|
17
|
+
* platform top bar owns the inset, so the trigger lands in the true corner,
|
|
18
|
+
* flush with the launcher cluster opposite it). Default 20. */
|
|
19
|
+
insetX?: number;
|
|
20
|
+
/** Gap between the nav and the logo in px (desktop only). Default 18. */
|
|
21
|
+
gap?: number;
|
|
22
|
+
/** Drawer panel width in px. Default 340 (see `MenuDrawer`). */
|
|
23
|
+
panelWidth?: number;
|
|
24
|
+
/** Extra class on the floating row — a brand hooks brand-specific CSS
|
|
25
|
+
* (e.g. a fold-out-on-canvas-thinking rule) onto this. */
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* ShellMenuChrome — the platform's default header: a floating row (brand logo
|
|
30
|
+
* + nav) over the canvas. Only the nav/trigger + logo capture pointer events
|
|
31
|
+
* (the row itself is `pointerEvents: none`), so the canvas keeps scrolling in
|
|
32
|
+
* the gaps.
|
|
33
|
+
*
|
|
34
|
+
* It paints nothing WHILE THERE IS NOTHING BEHIND IT — at rest the canvas
|
|
35
|
+
* reserves the band (`canvasPaddingTop`), and a painted bar would only seam
|
|
36
|
+
* against the brand's own hero. Once the canvas scrolls under the row, a
|
|
37
|
+
* `ChromeSurface` fades in and lifts. That state is not cosmetic: a header
|
|
38
|
+
* that stays transparent over scrolling content puts nav labels straight on
|
|
39
|
+
* top of product photography — legible chrome one moment, illegible the next.
|
|
40
|
+
*
|
|
41
|
+
* Desktop gets an inline `MenuNavBar` (top-level labels, hover-open
|
|
42
|
+
* mega-menu dropdowns) beside the logo. Touch/phone form factors — where
|
|
43
|
+
* hover doesn't exist and a dropdown has no room — get the hamburger
|
|
44
|
+
* `MenuTrigger` + slide-in `MenuDrawer` instead. The split is driven by
|
|
45
|
+
* `useFormFactor()`, the same signal `MenuDrawer` itself uses to pick
|
|
46
|
+
* hover-vs-accordion drill-down.
|
|
47
|
+
*
|
|
48
|
+
* MOBILE LAYOUT — the two form factors don't just swap the nav, they lay the
|
|
49
|
+
* row out differently, because a phone bar is the storefront-header shape:
|
|
50
|
+
* `[hamburger] [brand mark] [launchers]`. So on mobile this row spans the
|
|
51
|
+
* whole bar as a `1fr auto 1fr` grid — icon-only trigger in the left corner,
|
|
52
|
+
* the logo in the CENTER track (exactly screen-centered, since the two `1fr`
|
|
53
|
+
* tracks are equal by construction), and the right track left empty for the
|
|
54
|
+
* launcher cluster the platform's `MobileChrome` paints in its own cell. The
|
|
55
|
+
* trigger's label word is dropped there: it costs width the centered mark
|
|
56
|
+
* needs, and a hamburger reads as "menu" without it. A brand whose mark is
|
|
57
|
+
* too wide to sit between the trigger and the launchers passes a narrower
|
|
58
|
+
* one through the mobile `logo` slot (`ShellScaffold`'s `logo` prop).
|
|
59
|
+
*
|
|
60
|
+
* Mount this as a shell's ENTIRE `header` slot; it owns the open/close
|
|
61
|
+
* state internally, so a brand supplies only its logo, icon, and nav data —
|
|
62
|
+
* no local `menuOpen` state, no separate `MenuDrawer` wiring in the
|
|
63
|
+
* `drawers` slot. One implementation, reskinned per brand through CSS vars +
|
|
64
|
+
* the `logo`/`menuIcon` slots.
|
|
65
|
+
*/
|
|
66
|
+
export declare function ShellMenuChrome({ logo, menuIcon, items, onSelectItem, height, insetX, gap, panelWidth, className, }: ShellMenuChromeProps): React.ReactElement;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ShellScaffold — the reusable spacefront shell skeleton.
|
|
3
|
+
*
|
|
4
|
+
* Extracts the layout structure every brand shell re-implements by hand
|
|
5
|
+
* (the 2,808-line Steve Madden shell being the reference): a flex-col
|
|
6
|
+
* container → presence notch → a relative canvas region with the agent canvas
|
|
7
|
+
* scroll, a floating header overlay, the side-dock composer, a floating
|
|
8
|
+
* launcher row, and drawers — plus the dock open/close state and the mobile
|
|
9
|
+
* breakpoint swap. A brand supplies its chrome through slots and keeps zero
|
|
10
|
+
* layout/dock plumbing of its own.
|
|
11
|
+
*
|
|
12
|
+
* Additive: existing brand shells are untouched; new brands mount this instead
|
|
13
|
+
* of copying the skeleton.
|
|
14
|
+
*/
|
|
15
|
+
import React from 'react';
|
|
16
|
+
import { resolveShellSlot, type ShellSlot, type ShellDockState } from './slots';
|
|
17
|
+
export { resolveShellSlot };
|
|
18
|
+
export type { ShellSlot, ShellDockState };
|
|
19
|
+
export interface ShellScaffoldProps {
|
|
20
|
+
/** The agent canvas (e.g. `<FourtyCanvas />`). Wrapped in ConversationTransition by default. */
|
|
21
|
+
canvas: React.ReactNode;
|
|
22
|
+
/** Composer mounted inside the side dock (and the mobile island's sheet). */
|
|
23
|
+
composer: ShellSlot;
|
|
24
|
+
/**
|
|
25
|
+
* Desktop: the prompt input lives IN the page — mounted sticky at the bottom
|
|
26
|
+
* of the canvas scroll. For a shell whose conversation IS the canvas (each
|
|
27
|
+
* turn a page with its own answer). The side dock stays available as an
|
|
28
|
+
* optional view of the thread: it never opens by itself, only on the
|
|
29
|
+
* visitor's toggle. Mobile keeps the island, fed by `composer`.
|
|
30
|
+
*/
|
|
31
|
+
canvasComposer?: ShellSlot;
|
|
32
|
+
/** Ref attached to the scrolling `<main>` — the platform scroll container
|
|
33
|
+
* (`useScrollContainerRef`). Wire it so scroll-to-element + restore work. */
|
|
34
|
+
scrollRef?: React.Ref<HTMLElement>;
|
|
35
|
+
/** Top presence band. Omit to render none. */
|
|
36
|
+
presenceNotch?: React.ReactNode;
|
|
37
|
+
/** Floating header overlay (logo / menu). */
|
|
38
|
+
header?: ShellSlot;
|
|
39
|
+
/** Bare brand mark for the mobile chrome (just the wordmark, no full nav). The
|
|
40
|
+
* `DefaultMobileShell` uses this; when omitted it falls back to `header`
|
|
41
|
+
* (which is usually the full desktop nav — too wide for mobile). */
|
|
42
|
+
logo?: ShellSlot;
|
|
43
|
+
/** Control cluster (cart / wishlist / account / chat launchers). Mount it in a
|
|
44
|
+
* `LauncherDock` — that component owns the placement, which differs per
|
|
45
|
+
* shell: pinned over the canvas here, in-flow (bar-centred) in the mobile top
|
|
46
|
+
* chrome. A self-pinned cluster reads correctly on only one of the two. */
|
|
47
|
+
launchers?: ShellSlot;
|
|
48
|
+
/** Footer rendered at the end of the scrollable canvas. */
|
|
49
|
+
footer?: React.ReactNode;
|
|
50
|
+
/** Cart / wishlist drawers + dock-anchored overlays (slot: receives dock state). */
|
|
51
|
+
drawers?: ShellSlot;
|
|
52
|
+
/** Rendered below `mobileBreakpoint` instead of the desktop layout. When
|
|
53
|
+
* omitted, the platform `DefaultMobileShell` renders from these same slots. */
|
|
54
|
+
mobile?: React.ReactNode;
|
|
55
|
+
/** Rest-affordance copy for the `DefaultMobileShell` island (mobile default only). */
|
|
56
|
+
placeholder?: string;
|
|
57
|
+
/** Brand-authored example prompts the island cycles through before the agent
|
|
58
|
+
* has a rotation of its own (mobile default only). See
|
|
59
|
+
* `useComposerPlaceholder`'s `seed`. */
|
|
60
|
+
placeholderExamples?: readonly string[];
|
|
61
|
+
/** The mark the mobile island's pill carries once it has collapsed (mobile
|
|
62
|
+
* default only). Brand-owned by design — a letterform says whose assistant
|
|
63
|
+
* this is in a way no platform glyph can. `MorphIsland` documents how to
|
|
64
|
+
* draw one; omit it for the platform's own silhouette. */
|
|
65
|
+
collapsedMark?: React.ReactNode;
|
|
66
|
+
/** Side-dock width in px. */
|
|
67
|
+
dockWidth?: number;
|
|
68
|
+
/** Side-dock top offset in px. */
|
|
69
|
+
dockTop?: number;
|
|
70
|
+
/** Side-dock z-index. */
|
|
71
|
+
dockZIndex?: number;
|
|
72
|
+
/** Top padding of the canvas scroll (clears the floating header). */
|
|
73
|
+
canvasPaddingTop?: number;
|
|
74
|
+
/** Horizontal gutter applied to canvas content. */
|
|
75
|
+
gutter?: number;
|
|
76
|
+
/** Max-width media query below which `mobile` renders. */
|
|
77
|
+
mobileBreakpoint?: string;
|
|
78
|
+
/** Wrap the canvas in ConversationTransition (calm switch crossfade). Default true. */
|
|
79
|
+
wrapCanvasInTransition?: boolean;
|
|
80
|
+
/** Reopen the side dock on every new user turn — even after a manual fold —
|
|
81
|
+
* so a fresh prompt is never answered into a closed panel. The engagement
|
|
82
|
+
* latch below only supplies a DEFAULT (a manual fold pins the dock shut);
|
|
83
|
+
* this pins it back open on the next message. Default false. */
|
|
84
|
+
reopenDockOnMessage?: boolean;
|
|
85
|
+
/** Let the visitor drag the dock's left edge to resize the panel. `dockWidth`
|
|
86
|
+
* becomes the initial width; the live width is held in state and clamped to
|
|
87
|
+
* `[minDockWidth, maxDockWidth]`. Default false (fixed width). */
|
|
88
|
+
resizableDock?: boolean;
|
|
89
|
+
minDockWidth?: number;
|
|
90
|
+
maxDockWidth?: number;
|
|
91
|
+
}
|
|
92
|
+
export declare function ShellScaffold(props: ShellScaffoldProps): React.ReactElement;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Single source of truth for the side-dock reveal choreography. The dock
|
|
4
|
+
* slide (transform, compositor thread) and the canvas make-room (padding,
|
|
5
|
+
* layout) share this timing so the panel edge and the canvas edge track
|
|
6
|
+
* together. Brand shells must not redefine their own durations/easings
|
|
7
|
+
* for this choreography.
|
|
8
|
+
*/
|
|
9
|
+
export declare const SIDE_DOCK_REVEAL_MS = 400;
|
|
10
|
+
export declare const SIDE_DOCK_EASE = "cubic-bezier(0.22, 1, 0.36, 1)";
|
|
11
|
+
export interface SideDockProps {
|
|
12
|
+
/** Whether the dock is revealed. The dock stays mounted when closed —
|
|
13
|
+
* it slides off-screen and becomes inert. Keeping the subtree mounted
|
|
14
|
+
* means opening costs zero React work on the click's critical path. */
|
|
15
|
+
open: boolean;
|
|
16
|
+
/** Dock column width in px. */
|
|
17
|
+
width: number;
|
|
18
|
+
/** Distance from the top of the positioned ancestor (the brand shell's
|
|
19
|
+
* relative container) — reserves room for brand chrome above the dock. */
|
|
20
|
+
top: number;
|
|
21
|
+
/** Stacking order within the shell. Defaults to 40 — below drawer
|
|
22
|
+
* slots (≈60), above canvas content. */
|
|
23
|
+
zIndex?: number;
|
|
24
|
+
/** When set, the dock's left edge becomes a drag handle: the user resizes
|
|
25
|
+
* the panel and this reports the new width (clamped to min/max). Omit for a
|
|
26
|
+
* fixed-width dock (the default). */
|
|
27
|
+
onWidthChange?: (width: number) => void;
|
|
28
|
+
/** Fires when a resize drag begins / ends — lets the host drop the canvas
|
|
29
|
+
* make-room transition during the drag so the canvas edge tracks the panel
|
|
30
|
+
* 1:1 instead of easing behind it. */
|
|
31
|
+
onResizeStart?: () => void;
|
|
32
|
+
onResizeEnd?: () => void;
|
|
33
|
+
/** Resize clamp (px). Defaults 320–680. */
|
|
34
|
+
minWidth?: number;
|
|
35
|
+
maxWidth?: number;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* SideDock — the platform-owned side panel reveal.
|
|
40
|
+
*
|
|
41
|
+
* Brand shells mount the Composer (+ their header strip) inside this
|
|
42
|
+
* wrapper. SideDock owns the choreography invariants:
|
|
43
|
+
*
|
|
44
|
+
* - **Transform-only slide.** The reveal animates `transform` via a CSS
|
|
45
|
+
* transition, which runs on the compositor thread — the slide stays at
|
|
46
|
+
* full frame rate even while the main thread renders streamed layout
|
|
47
|
+
* patches. Never animate layout properties (width / right / padding)
|
|
48
|
+
* here.
|
|
49
|
+
* - **Keep-mounted.** Closed = slid off-screen, `visibility: hidden`,
|
|
50
|
+
* `inert`. The panel subtree never unmounts, so opening never pays a
|
|
51
|
+
* React mount on the interaction's critical path.
|
|
52
|
+
* - **No fixed positioning inside.** Children position against this
|
|
53
|
+
* wrapper (`position: absolute`), never the viewport. `position: fixed`
|
|
54
|
+
* inside a transformed ancestor resolves against the ancestor while the
|
|
55
|
+
* transform is live, then snaps to the viewport when the transform
|
|
56
|
+
* clears — a guaranteed end-of-animation jump.
|
|
57
|
+
* - **Reduced motion.** The slide collapses to an instant toggle.
|
|
58
|
+
*/
|
|
59
|
+
export declare function SideDock({ open, width, top, zIndex, onWidthChange, onResizeStart, onResizeEnd, minWidth, maxWidth, children, }: SideDockProps): React.ReactElement;
|
|
60
|
+
/**
|
|
61
|
+
* Canvas make-room styles, paired to the SideDock reveal. The brand shell
|
|
62
|
+
* spreads the returned styles onto its main canvas scroller so the canvas
|
|
63
|
+
* cedes the dock column with the same timing/easing as the panel slide:
|
|
64
|
+
*
|
|
65
|
+
* ```tsx
|
|
66
|
+
* const canvasSpacing = useSideDockSpacing(dock.value, SIDE_DOCK_WIDTH);
|
|
67
|
+
* <main style={{ ...scrollerStyles, ...canvasSpacing }}>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* This is the one place the reveal touches layout (padding reflows the
|
|
71
|
+
* canvas content). It is CSS-driven — no per-frame JS — and the panel's
|
|
72
|
+
* own compositor-driven slide never depends on this staying under the
|
|
73
|
+
* frame budget: on a heavy canvas the content may lag, the panel glides.
|
|
74
|
+
*/
|
|
75
|
+
export declare function useSideDockSpacing(open: boolean, width: number, animate?: boolean): React.CSSProperties;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Shimmer placeholder for loading state. Themable via `--color-surface-alt`
|
|
4
|
+
* (base) and `--radius-skeleton` (corner radius — defaults to 0 so brands
|
|
5
|
+
* with sharp visual languages get the right edge by default; round-corner
|
|
6
|
+
* brands override the var).
|
|
7
|
+
*
|
|
8
|
+
* Variants:
|
|
9
|
+
* `block` — solid block (default). For images, hero panels.
|
|
10
|
+
* `text` — single-line text shimmer with consistent line-height.
|
|
11
|
+
* `pill` — small rounded shimmer for chips / tags / prices.
|
|
12
|
+
*
|
|
13
|
+
* Sizing comes from the caller via `width` / `height` props or CSS.
|
|
14
|
+
*/
|
|
15
|
+
export interface SkeletonProps {
|
|
16
|
+
variant?: 'block' | 'text' | 'pill';
|
|
17
|
+
width?: number | string;
|
|
18
|
+
height?: number | string;
|
|
19
|
+
className?: string;
|
|
20
|
+
style?: React.CSSProperties;
|
|
21
|
+
}
|
|
22
|
+
export declare function Skeleton({ variant, width, height, className, style, }: SkeletonProps): React.ReactElement;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Tiny inline spinner. Single-color, sized in px, uses `currentColor`
|
|
4
|
+
* so the brand's text-color cascade drives the visible tint. Rotation
|
|
5
|
+
* is framer-motion-driven so the component is self-contained (no
|
|
6
|
+
* global @keyframes dependency).
|
|
7
|
+
*/
|
|
8
|
+
export declare function Spinner({ size }: {
|
|
9
|
+
size?: number;
|
|
10
|
+
}): React.ReactElement;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface TypedPlaceholderProps {
|
|
3
|
+
/** The rotation. Cycles in order; a single entry types once and stays. */
|
|
4
|
+
entries: readonly string[];
|
|
5
|
+
/** Show the blinking caret. Pass `false` while the real field has focus —
|
|
6
|
+
* the visitor's own caret is already sitting at position 0 and a second one
|
|
7
|
+
* chasing the end of a phantom sentence reads as a bug. */
|
|
8
|
+
caret?: boolean;
|
|
9
|
+
className?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function TypedPlaceholder({ entries, caret, className }: TypedPlaceholderProps): React.ReactElement | null;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface VoiceControlProps {
|
|
3
|
+
/** Auto-commit after this many ms of speech silence. Omit for the hook's
|
|
4
|
+
* default (1500ms). */
|
|
5
|
+
silenceMs?: number;
|
|
6
|
+
/** Brand override hooks — merged after the token-based defaults. */
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: React.CSSProperties;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* `VoiceControl` — the mobile island's voice-first widget.
|
|
12
|
+
*
|
|
13
|
+
* Self-contained: it wires `useVoiceCapture` to the session's send seam, so
|
|
14
|
+
* speaking sends a turn with no composer round-trip. Tap to listen, speak, and
|
|
15
|
+
* after a short silence the captured prompt auto-commits; the live caption shows
|
|
16
|
+
* the interim transcript so the visitor sees what's being heard. Renders nothing
|
|
17
|
+
* when the browser has no speech support (Firefox) — the island falls back to
|
|
18
|
+
* its presence read + the tap-to-open composer.
|
|
19
|
+
*
|
|
20
|
+
* It reuses `DictationButton` for the mic glyph / listening waveform, so the
|
|
21
|
+
* idle↔listening visual is identical to the desktop composer's mic.
|
|
22
|
+
*/
|
|
23
|
+
export declare function VoiceControl({ silenceMs, className, style, }: VoiceControlProps): React.ReactElement | null;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface VoiceIslandProps {
|
|
3
|
+
/** Live transcript so far (empty before the first word). */
|
|
4
|
+
transcript: string;
|
|
5
|
+
/** Send now. The host commits whatever was heard and folds the island away —
|
|
6
|
+
* the turn also auto-submits on its own after a pause, so this is just the
|
|
7
|
+
* explicit "I'm done" control. */
|
|
8
|
+
onStop: () => void;
|
|
9
|
+
/** Bail out — end the capture WITHOUT sending. The escape hatch for an
|
|
10
|
+
* accidental tap or a thought the visitor changed their mind about;
|
|
11
|
+
* without it the only exits both submit. */
|
|
12
|
+
onCancel: () => void;
|
|
13
|
+
/** Idle-pause hint shown before any speech is recognized. */
|
|
14
|
+
idleHint?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* VoiceIsland — the compact, horizontal listening surface. PRESENTATIONAL only:
|
|
18
|
+
* the host owns `useVoiceCapture` (so `start()` fires on the Speak gesture, when
|
|
19
|
+
* support is already resolved) and passes the live transcript down. It morphs in
|
|
20
|
+
* from the Speak bar (same dark stamped slab) and shows a live waveform + the
|
|
21
|
+
* running transcript with a single stop control. It does NOT cover the canvas —
|
|
22
|
+
* a small island at the bottom, so the layout keeps building behind it.
|
|
23
|
+
*/
|
|
24
|
+
export declare function VoiceIsland({ transcript, onStop, onCancel, idleHint }: VoiceIslandProps): React.ReactElement;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* `--fourty-canvas-gutter` is the single source of truth for "how much
|
|
4
|
+
* ambient horizontal padding does the currently-mounted shell apply to
|
|
5
|
+
* canvas content." `ShellScaffold` (desktop) and `DefaultMobileShell`
|
|
6
|
+
* (mobile) each publish their OWN resolved gutter under this same name on
|
|
7
|
+
* whichever one is actually mounted, so a brand's full-bleed component can
|
|
8
|
+
* read `var(--fourty-canvas-gutter)` and always get the correct live value
|
|
9
|
+
* instead of hand-typing a number that can silently drift from the shell's
|
|
10
|
+
* real gutter (mobile's is a capped derivative of the desktop prop, not a
|
|
11
|
+
* fixed constant — see `DefaultMobileShell`'s `MOBILE_GUTTER_MAX`).
|
|
12
|
+
*/
|
|
13
|
+
export type CanvasGutterStyle = React.CSSProperties & {
|
|
14
|
+
'--fourty-canvas-gutter': string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface AttachButtonProps {
|
|
3
|
+
/** Called with the picked files. */
|
|
4
|
+
onFiles: (files: FileList) => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `AttachButton` — the composer's photo/attachment trigger (an image glyph). Owns a hidden file input
|
|
10
|
+
* whose `accept` is derived from the shared allow-list; clicking the glyph opens
|
|
11
|
+
* the OS picker. Footprint mirrors the dictation + send buttons so the controls
|
|
12
|
+
* read as one set.
|
|
13
|
+
*/
|
|
14
|
+
export declare function AttachButton({ onFiles, className, style }: AttachButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ComposerAttachment } from './useComposerAttachments';
|
|
3
|
+
export interface AttachmentStripProps {
|
|
4
|
+
attachments: ComposerAttachment[];
|
|
5
|
+
onRemove: (localId: string) => void;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* `AttachmentStrip` — the row of attachment thumbnails above the composer
|
|
9
|
+
* input. Each thumb shows the image preview (or a file glyph), an uploading
|
|
10
|
+
* spinner, an error tint, and a remove button. Renders nothing when empty.
|
|
11
|
+
*/
|
|
12
|
+
export declare function AttachmentStrip({ attachments, onRemove, }: AttachmentStripProps): React.ReactElement | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface ClearSessionButtonProps {
|
|
3
|
+
/** Drop the current conversation + layout and start fresh. */
|
|
4
|
+
onClear: () => void;
|
|
5
|
+
className?: string;
|
|
6
|
+
style?: React.CSSProperties;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* `ClearSessionButton` — a deliberately quiet "start a new conversation"
|
|
10
|
+
* affordance. Pinned in the panel's top corner away from the send control so
|
|
11
|
+
* it never reads as a primary action and can't be fat-fingered while the
|
|
12
|
+
* visitor is composing. The brand restyles it via `.fourty-composer-clear`
|
|
13
|
+
* (colour) or the `--fourty-clear-color` token; the SDK only owns the glyph +
|
|
14
|
+
* footprint. Wire `onClear` to `session.clearSession()`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ClearSessionButton({ onClear, className, style, }: ClearSessionButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { ConversationSummary } from '@40rty/ams-sdk';
|
|
3
|
+
export interface ConversationHistoryButtonProps {
|
|
4
|
+
/** Recent conversations, most-recent-first (incl. the current one). */
|
|
5
|
+
conversations: ConversationSummary[];
|
|
6
|
+
/** The active conversation's session id — marked + non-actionable in the list. */
|
|
7
|
+
currentSessionId: string | null;
|
|
8
|
+
/** Jump to a conversation by session id. */
|
|
9
|
+
onSelect: (sessionId: string) => void;
|
|
10
|
+
className?: string;
|
|
11
|
+
style?: React.CSSProperties;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* `ConversationHistoryButton` — a quiet "older conversations" affordance for
|
|
15
|
+
* the composer's top-right gutter. Twins the clear/new control beside it: same
|
|
16
|
+
* muted glyph, surfaces on hover. Tapping opens a small dropdown of the
|
|
17
|
+
* visitor's recent conversations (local to this browser); selecting one
|
|
18
|
+
* restores it via the SDK's switch path. The current conversation is marked
|
|
19
|
+
* and inert.
|
|
20
|
+
*
|
|
21
|
+
* Presentational only — the conversation list + switch action are owned by the
|
|
22
|
+
* SDK (`useFourtySession().recentConversations` / `switchConversation`); this
|
|
23
|
+
* component just renders + reports.
|
|
24
|
+
*/
|
|
25
|
+
export declare function ConversationHistoryButton({ conversations, currentSessionId, onSelect, className, style, }: ConversationHistoryButtonProps): React.ReactElement;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* SHARE THIS PAGE — opens a popover carrying the link, what it grants, and an
|
|
4
|
+
* explicit copy.
|
|
5
|
+
*
|
|
6
|
+
* It began as copy-on-click with the outcome written only into `aria-label`,
|
|
7
|
+
* which reads as nothing happening: the sender gets no sight of WHAT they are
|
|
8
|
+
* about to send, and no confirmation they can trust. Sending a link is an
|
|
9
|
+
* outward-facing act, so the surface shows the artifact before it leaves.
|
|
10
|
+
*
|
|
11
|
+
* The popover answers the one question worth asking before pasting a link into
|
|
12
|
+
* a group chat — what does the person on the other end actually get? A frozen
|
|
13
|
+
* page, not an account: no conversation, no cart, no write access. (See the
|
|
14
|
+
* API's `canvas-share.ts` for why it cannot be the session id.)
|
|
15
|
+
*
|
|
16
|
+
* Minting happens on OPEN, not on copy, so the URL is on screen to read before
|
|
17
|
+
* the visitor commits to sending it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function ShareCanvasButton(): React.ReactElement | null;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ThreadJumpMark } from '@40rty/ams-sdk';
|
|
3
|
+
/** Below this many prompts, a rail has nothing worth navigating — the whole
|
|
4
|
+
* thread already fits a quick scroll. `Composer` gates BOTH the rail mount
|
|
5
|
+
* and the scroller gutter it reserves on this same constant, so the two can
|
|
6
|
+
* never disagree. */
|
|
7
|
+
export declare const MIN_JUMP_RAIL_MARKS = 3;
|
|
8
|
+
/** Width the composer scroller reserves for the collapsed cluster so ticks
|
|
9
|
+
* float in their own gutter and never sit over prose. Sized well past
|
|
10
|
+
* `TICK_WIDTH` + the track's inset so a clear band of air sits between the
|
|
11
|
+
* bars and the message bubbles — ticks that crowd the prose edge read as
|
|
12
|
+
* attached to the last bubble instead of as their own gutter. */
|
|
13
|
+
export declare const JUMP_RAIL_GUTTER_PX = 64;
|
|
14
|
+
export interface ThreadJumpRailProps {
|
|
15
|
+
/** Jump targets, thread order (oldest first) — from `useThreadJumpMarks`.
|
|
16
|
+
* `Composer` owns the data; this component only renders + reports. */
|
|
17
|
+
marks: ThreadJumpMark[];
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* ChatGPT-style quick-TOC for a long thread: a compact, vertically-centered
|
|
22
|
+
* cluster of small ticks in the composer scroller's reserved right gutter
|
|
23
|
+
* (`JUMP_RAIL_GUTTER_PX` — the rail never overlaps prose). The cluster is a
|
|
24
|
+
* static affordance, not an interactive one: hovering it opens one rounded
|
|
25
|
+
* popover that spreads left out of the cluster, listing every past prompt as
|
|
26
|
+
* a stacked row. The ticks never animate under the cursor — the panel replaces
|
|
27
|
+
* them within `OPEN_INTENT_MS`, so any magnification would play out on pixels
|
|
28
|
+
* that are already fading away.
|
|
29
|
+
*
|
|
30
|
+
* The panel REPLACES the cluster — the ticks hide while it is open, since they
|
|
31
|
+
* are just the collapsed form of the list now on screen. That frees the full
|
|
32
|
+
* panel width for the rows, so the cursor is already sitting on one the moment
|
|
33
|
+
* it opens and never has to travel left to reach a target. The current turn and
|
|
34
|
+
* the hovered row are styled from SEPARATE token pairs — "you are here" must
|
|
35
|
+
* stay legible while the cursor roams. Clicking a row time-travels to that turn
|
|
36
|
+
* and scrolls the thread to it.
|
|
37
|
+
*
|
|
38
|
+
* Purely presentational — `Composer` supplies the marks and gates mounting
|
|
39
|
+
* on `MIN_JUMP_RAIL_MARKS`. Brand styling hooks: `.fourty-thread-jump-rail`
|
|
40
|
+
* (root) / `__track` / `__panel` / `__row`, plus the `--fourty-jump-rail-*`
|
|
41
|
+
* CSS vars.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ThreadJumpRail({ marks, className }: ThreadJumpRailProps): React.ReactElement | null;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const CHIP_AREA_PX = 160;
|
|
2
|
+
/** The reserved chip band for a form factor. Both the scroller's bottom padding
|
|
3
|
+
* and the jump rail's lower bound key off this — they must never disagree, or
|
|
4
|
+
* the rail's popover floats over the chips (or a gap of dead space). */
|
|
5
|
+
export declare function chipAreaPx(isMobile: boolean): number;
|
|
6
|
+
export declare const DOCK_HEADER_AREA_PX = 64;
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composer field metrics — the SINGLE source for the input's text box model.
|
|
3
|
+
*
|
|
4
|
+
* These numbers are shared by three collaborators that must agree exactly or
|
|
5
|
+
* the field visibly breaks:
|
|
6
|
+
*
|
|
7
|
+
* 1. the `<textarea>`'s own inline style (font metrics + min/max height),
|
|
8
|
+
* 2. the autosize pass that grows the field as content wraps,
|
|
9
|
+
* 3. `InlineCompletion`'s ghost overlay, a transparent twin of the typed
|
|
10
|
+
* text that must line up character-for-character and clip identically.
|
|
11
|
+
*
|
|
12
|
+
* They were previously duplicated at all three sites and had already drifted:
|
|
13
|
+
* the autosize clamped to `6 * 22 = 132px` while the real line box is
|
|
14
|
+
* `14 * 1.5 = 21px`, so "six lines" was neither six lines nor the same cap the
|
|
15
|
+
* overlay used. Derive everything from `FONT_SIZE` / `LINE_HEIGHT` here and the
|
|
16
|
+
* three can no longer disagree.
|
|
17
|
+
*/
|
|
18
|
+
/** Field font size (px). Mirrored into the textarea's inline style. */
|
|
19
|
+
export declare const COMPOSER_FONT_SIZE_PX = 14;
|
|
20
|
+
/** Field line-height, unitless — the CSS `line-height` value. */
|
|
21
|
+
export declare const COMPOSER_LINE_HEIGHT = 1.5;
|
|
22
|
+
/** Vertical padding above AND below the text, per side (px). */
|
|
23
|
+
export declare const COMPOSER_FIELD_PAD_Y_PX = 4;
|
|
24
|
+
/**
|
|
25
|
+
* Height of one rendered line of text (px). `line-height: 1.5` on a 14px font
|
|
26
|
+
* is a 21px line box — NOT the 22px the old autosize constant assumed.
|
|
27
|
+
*/
|
|
28
|
+
export declare const COMPOSER_LINE_PX: number;
|
|
29
|
+
/**
|
|
30
|
+
* How tall the field may grow before it scrolls internally. Product decision
|
|
31
|
+
* (40R-235): the box grows with the content up to five lines, then holds and
|
|
32
|
+
* scrolls — the visitor can always reach text past the cap, which a hard
|
|
33
|
+
* truncation would strand.
|
|
34
|
+
*/
|
|
35
|
+
export declare const COMPOSER_MAX_LINES = 5;
|
|
36
|
+
/** Collapsed (single-line) field height, padding included. */
|
|
37
|
+
export declare const COMPOSER_MIN_FIELD_PX: number;
|
|
38
|
+
/** Fully-grown field height at the line cap, padding included. */
|
|
39
|
+
export declare const COMPOSER_MAX_FIELD_PX: number;
|
|
40
|
+
/**
|
|
41
|
+
* Edge length of a composer control (attach / dictate / send), px.
|
|
42
|
+
*
|
|
43
|
+
* The controls declare `alignSelf: 'stretch'` so that on a ONE-LINE field they
|
|
44
|
+
* rise to the full pill height — the intended look, and every brand's current
|
|
45
|
+
* one. On a grown field that same rule turned the send button into a 32×113
|
|
46
|
+
* lozenge (visible in 40R-235's first screenshot). Rather than teach three
|
|
47
|
+
* shared components — they're also mounted by the mobile island — about the
|
|
48
|
+
* expanded state, the composer gives them a LANE of this height to stretch
|
|
49
|
+
* inside; `stretch` then resolves to a square control. One number, one place.
|
|
50
|
+
*/
|
|
51
|
+
export declare const COMPOSER_CONTROL_PX = 32;
|
|
52
|
+
/**
|
|
53
|
+
* True once the field has grown past its collapsed single-line height.
|
|
54
|
+
*
|
|
55
|
+
* Drives the chrome that only makes sense on a one-line field: a full-pill
|
|
56
|
+
* corner radius (a brand may set `--fourty-chat-radius: 999px`; on a tall box
|
|
57
|
+
* that stadium shape swallows the corners and pushes the send button out of
|
|
58
|
+
* bounds) and vertically-centred controls (which should anchor to the last
|
|
59
|
+
* line once the text wraps). Half a line of slack absorbs sub-pixel rounding
|
|
60
|
+
* so a plain one-line field never reads as expanded.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isFieldExpanded(fieldPx: number): boolean;
|
|
63
|
+
/**
|
|
64
|
+
* The field's line/height clamps read off the LAID-OUT element rather than the
|
|
65
|
+
* constants above.
|
|
66
|
+
*
|
|
67
|
+
* The constants are the field's DECLARED metrics — what the composer writes
|
|
68
|
+
* into the textarea's inline style. They stop being the rendered metrics the
|
|
69
|
+
* moment a stylesheet outranks that inline style, which is exactly what the
|
|
70
|
+
* touch-field floor in the preset does: `@media (pointer: coarse)` lifts every
|
|
71
|
+
* text control to 16px with `!important`, because a sub-16px field makes iOS
|
|
72
|
+
* Safari zoom the page on focus and leaves the whole spacefront panned
|
|
73
|
+
* off-centre (the rule carries the full account).
|
|
74
|
+
*
|
|
75
|
+
* On a phone, then, the field renders a 24px line box while
|
|
76
|
+
* `COMPOSER_LINE_PX` still says 21 — so a cap meant to hold five lines holds
|
|
77
|
+
* 4.7, and the collapsed floor sits a line-fragment short. Deriving from
|
|
78
|
+
* `getComputedStyle` costs one read per measure pass and cannot drift: it is
|
|
79
|
+
* the size the glyphs are actually being set at, whoever won the cascade.
|
|
80
|
+
*
|
|
81
|
+
* `line-height` reaches us in any of three shapes and only one of them is a
|
|
82
|
+
* length. Browsers resolve the composer's unitless 1.5 to px before handing it
|
|
83
|
+
* back, but the computed value of a NUMBER is specified to stay that number,
|
|
84
|
+
* and a keyword (`normal`, from a brand's reset) is neither. So the unit is
|
|
85
|
+
* checked rather than assumed: a bare ratio is multiplied by the rendered font
|
|
86
|
+
* size, and anything unreadable falls back to the declared ratio. Every branch
|
|
87
|
+
* lands on a real px line box; parsing `1.5` as `1.5px` would collapse the
|
|
88
|
+
* field to nothing.
|
|
89
|
+
*
|
|
90
|
+
* `maxLines` defaults to the composer's own cap. The mobile island passes its
|
|
91
|
+
* smaller one (`ISLAND_FIELD_MAX_LINES`): same growth rule, less room, because
|
|
92
|
+
* that field floats over the canvas instead of sitting in a dock beside it.
|
|
93
|
+
*/
|
|
94
|
+
export declare function fieldClampsFrom(el: HTMLElement, maxLines?: number): {
|
|
95
|
+
minPx: number;
|
|
96
|
+
maxPx: number;
|
|
97
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** True for an iPhone HEIC/HEIF file — by MIME, or by extension when the
|
|
2
|
+
* browser reports an empty type (which it does for HEIC). */
|
|
3
|
+
export declare function isHeic(file: File): boolean;
|
|
4
|
+
/** Decode a HEIC file to a JPEG `File` (renamed `.jpg`). Throws if libheif
|
|
5
|
+
* can't decode it — the caller falls back to the original. */
|
|
6
|
+
export declare function heicToJpeg(file: File): Promise<File>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Grow the composer's textarea to fit its content, capped at
|
|
4
|
+
* `COMPOSER_MAX_FIELD_PX` (five lines) after which it scrolls internally.
|
|
5
|
+
*
|
|
6
|
+
* ## Why `ghostPx` is a parameter
|
|
7
|
+
*
|
|
8
|
+
* The field's VISIBLE content is not just what the visitor typed — an inline
|
|
9
|
+
* completion paints a ghost continuation over the same box (`InlineCompletion`).
|
|
10
|
+
* Sizing from `textarea.scrollHeight` alone measures only the typed value, so a
|
|
11
|
+
* one-word prompt with a six-line suggestion left the field ~21px tall while the
|
|
12
|
+
* overlay painted ~126px of text, which spilled straight out of the composer's
|
|
13
|
+
* pill and over the canvas (40R-235).
|
|
14
|
+
*
|
|
15
|
+
* The overlay is the only thing that can measure the ghost — it's the element
|
|
16
|
+
* that lays it out, at the same width and metrics as the field — so it reports
|
|
17
|
+
* its own content height up and this hook takes the max. The textarea stays the
|
|
18
|
+
* single sizing authority; the ghost just contributes a floor.
|
|
19
|
+
*
|
|
20
|
+
* `maxLines` overrides the composer's own five-line cap — the mobile island
|
|
21
|
+
* shares this hook and passes its own (see `ISLAND_FIELD_MAX_LINES`).
|
|
22
|
+
*
|
|
23
|
+
* Returns the applied height so the composer can key its expanded-state chrome
|
|
24
|
+
* (radius clamp, control alignment) off the same number it wrote.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useFieldAutosize(taRef: React.RefObject<HTMLTextAreaElement | null>, value: string, ghostPx: number, maxLines?: number): number;
|