@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,117 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/hooks/use-projection.ts
|
|
4
|
+
import { useCallback, useEffect, useState } from "react";
|
|
5
|
+
function readResult(raw) {
|
|
6
|
+
if (raw === null || typeof raw !== "object") return void 0;
|
|
7
|
+
const obj = raw;
|
|
8
|
+
if (typeof obj.hiddenCount !== "number") return void 0;
|
|
9
|
+
const trimmedAxes = Array.isArray(obj.trimmedAxes) ? obj.trimmedAxes.filter((a) => typeof a === "string") : [];
|
|
10
|
+
return { full: obj.full, hiddenCount: obj.hiddenCount, trimmedAxes };
|
|
11
|
+
}
|
|
12
|
+
function entityIdOf(value) {
|
|
13
|
+
if (value === null || typeof value !== "object") return "";
|
|
14
|
+
const id = value.id;
|
|
15
|
+
return typeof id === "string" ? id : "";
|
|
16
|
+
}
|
|
17
|
+
var NO_AXES = [];
|
|
18
|
+
function useProjection(projectionProp, entity) {
|
|
19
|
+
const [expanded, setExpanded] = useState(false);
|
|
20
|
+
const toggle = useCallback(() => setExpanded((e) => !e), []);
|
|
21
|
+
const entityId = entityIdOf(entity);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
setExpanded(false);
|
|
24
|
+
}, [entityId]);
|
|
25
|
+
const result = readResult(projectionProp);
|
|
26
|
+
if (result === void 0) {
|
|
27
|
+
return {
|
|
28
|
+
active: false,
|
|
29
|
+
expanded: false,
|
|
30
|
+
hiddenCount: 0,
|
|
31
|
+
trimmedAxes: NO_AXES,
|
|
32
|
+
fullEntity: void 0,
|
|
33
|
+
toggle
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
active: true,
|
|
38
|
+
expanded,
|
|
39
|
+
hiddenCount: result.hiddenCount,
|
|
40
|
+
trimmedAxes: result.trimmedAxes,
|
|
41
|
+
fullEntity: result.full,
|
|
42
|
+
toggle
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// src/hooks/use-focus-trap.ts
|
|
47
|
+
import React from "react";
|
|
48
|
+
var FOCUSABLE_SELECTOR = [
|
|
49
|
+
"a[href]",
|
|
50
|
+
"button:not([disabled])",
|
|
51
|
+
"input:not([disabled])",
|
|
52
|
+
"select:not([disabled])",
|
|
53
|
+
"textarea:not([disabled])",
|
|
54
|
+
'[tabindex]:not([tabindex="-1"])'
|
|
55
|
+
].join(", ");
|
|
56
|
+
function useFocusTrap(ref, active) {
|
|
57
|
+
React.useEffect(() => {
|
|
58
|
+
if (!active) return;
|
|
59
|
+
const container = ref.current;
|
|
60
|
+
if (!container) return;
|
|
61
|
+
const doc = container.ownerDocument;
|
|
62
|
+
const previouslyFocused = doc.activeElement;
|
|
63
|
+
const initial = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
64
|
+
if (initial.length > 0) {
|
|
65
|
+
initial[0].focus();
|
|
66
|
+
} else {
|
|
67
|
+
container.tabIndex = -1;
|
|
68
|
+
container.focus();
|
|
69
|
+
}
|
|
70
|
+
const onKeyDown = (e) => {
|
|
71
|
+
if (e.key !== "Tab") return;
|
|
72
|
+
const items = container.querySelectorAll(FOCUSABLE_SELECTOR);
|
|
73
|
+
if (items.length === 0) return;
|
|
74
|
+
const first = items[0];
|
|
75
|
+
const last = items[items.length - 1];
|
|
76
|
+
const current = doc.activeElement;
|
|
77
|
+
const inside = current instanceof HTMLElement && container.contains(current);
|
|
78
|
+
if (e.shiftKey) {
|
|
79
|
+
if (!inside || current === first) {
|
|
80
|
+
e.preventDefault();
|
|
81
|
+
last.focus();
|
|
82
|
+
}
|
|
83
|
+
} else if (!inside || current === last) {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
first.focus();
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
doc.addEventListener("keydown", onKeyDown);
|
|
89
|
+
return () => {
|
|
90
|
+
doc.removeEventListener("keydown", onKeyDown);
|
|
91
|
+
if (previouslyFocused instanceof HTMLElement) previouslyFocused.focus();
|
|
92
|
+
};
|
|
93
|
+
}, [ref, active]);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// src/hooks/use-container-width.ts
|
|
97
|
+
import { useEffect as useEffect2, useRef, useState as useState2 } from "react";
|
|
98
|
+
function useContainerWidth() {
|
|
99
|
+
const ref = useRef(null);
|
|
100
|
+
const [width, setWidth] = useState2(0);
|
|
101
|
+
useEffect2(() => {
|
|
102
|
+
const el = ref.current;
|
|
103
|
+
if (!el) return;
|
|
104
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
105
|
+
if (entry) setWidth(entry.contentRect.width);
|
|
106
|
+
});
|
|
107
|
+
observer.observe(el);
|
|
108
|
+
return () => observer.disconnect();
|
|
109
|
+
}, []);
|
|
110
|
+
return [ref, width];
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export {
|
|
114
|
+
useProjection,
|
|
115
|
+
useFocusTrap,
|
|
116
|
+
useContainerWidth
|
|
117
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
// src/hooks/keyboard.ts
|
|
4
|
+
function activateOnSpaceEnter(onActivate) {
|
|
5
|
+
return (e) => {
|
|
6
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
7
|
+
e.preventDefault();
|
|
8
|
+
onActivate();
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function submitOnEnter(onSubmit) {
|
|
13
|
+
return (e) => {
|
|
14
|
+
if (e.key === "Enter" && !e.shiftKey) {
|
|
15
|
+
e.preventDefault();
|
|
16
|
+
onSubmit();
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// src/hooks/use-dismiss-on-outside.ts
|
|
22
|
+
import React from "react";
|
|
23
|
+
function useDismissOnOutside({
|
|
24
|
+
active,
|
|
25
|
+
onDismiss,
|
|
26
|
+
containerRef,
|
|
27
|
+
dismissOnScrollRefs
|
|
28
|
+
}) {
|
|
29
|
+
const onDismissRef = React.useRef(onDismiss);
|
|
30
|
+
onDismissRef.current = onDismiss;
|
|
31
|
+
React.useEffect(() => {
|
|
32
|
+
if (!active) return;
|
|
33
|
+
const fire = () => onDismissRef.current();
|
|
34
|
+
const onKey = (e) => {
|
|
35
|
+
if (e.key === "Escape") fire();
|
|
36
|
+
};
|
|
37
|
+
const onDown = (e) => {
|
|
38
|
+
const target = e.target;
|
|
39
|
+
const container = containerRef.current;
|
|
40
|
+
if (!container) return;
|
|
41
|
+
if (target instanceof Node && !container.contains(target)) fire();
|
|
42
|
+
};
|
|
43
|
+
const scrollers = [];
|
|
44
|
+
if (dismissOnScrollRefs) {
|
|
45
|
+
for (const r of dismissOnScrollRefs) {
|
|
46
|
+
const el = r.current;
|
|
47
|
+
if (el) scrollers.push(el);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
window.addEventListener("keydown", onKey);
|
|
51
|
+
window.addEventListener("mousedown", onDown);
|
|
52
|
+
window.addEventListener("scroll", fire, { passive: true });
|
|
53
|
+
for (const el of scrollers) el.addEventListener("scroll", fire, { passive: true });
|
|
54
|
+
return () => {
|
|
55
|
+
window.removeEventListener("keydown", onKey);
|
|
56
|
+
window.removeEventListener("mousedown", onDown);
|
|
57
|
+
window.removeEventListener("scroll", fire);
|
|
58
|
+
for (const el of scrollers) el.removeEventListener("scroll", fire);
|
|
59
|
+
};
|
|
60
|
+
}, [active, containerRef]);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/hooks/use-focus-on-change.ts
|
|
64
|
+
import React2 from "react";
|
|
65
|
+
function useFocusOnChange(ref, active, delayMs = 0) {
|
|
66
|
+
React2.useEffect(() => {
|
|
67
|
+
if (!active) return;
|
|
68
|
+
if (delayMs === 0) {
|
|
69
|
+
ref.current?.focus();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const id = window.setTimeout(() => ref.current?.focus(), delayMs);
|
|
73
|
+
return () => window.clearTimeout(id);
|
|
74
|
+
}, [ref, active, delayMs]);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// src/hooks/use-scroll-threshold.ts
|
|
78
|
+
import React3 from "react";
|
|
79
|
+
function useScrollThreshold(scrollerRef, threshold) {
|
|
80
|
+
const [crossed, setCrossed] = React3.useState(false);
|
|
81
|
+
React3.useEffect(() => {
|
|
82
|
+
const el = scrollerRef.current;
|
|
83
|
+
if (!el) return;
|
|
84
|
+
const emitter = el === document.scrollingElement ? window : el;
|
|
85
|
+
const update = () => setCrossed(el.scrollTop > threshold);
|
|
86
|
+
emitter.addEventListener("scroll", update, { passive: true });
|
|
87
|
+
update();
|
|
88
|
+
return () => emitter.removeEventListener("scroll", update);
|
|
89
|
+
}, [scrollerRef, threshold]);
|
|
90
|
+
return crossed;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// src/hooks/use-textarea-autosize.ts
|
|
94
|
+
import React4 from "react";
|
|
95
|
+
function useTextareaAutosize(ref, value, { maxLines = 4, lineHeightPx = 22, extraDeps = [] } = {}) {
|
|
96
|
+
React4.useEffect(() => {
|
|
97
|
+
const ta = ref.current;
|
|
98
|
+
if (!ta) return;
|
|
99
|
+
ta.style.height = "auto";
|
|
100
|
+
const max = maxLines * lineHeightPx;
|
|
101
|
+
ta.style.height = Math.min(ta.scrollHeight, max) + "px";
|
|
102
|
+
}, [ref, value, maxLines, lineHeightPx, ...extraDeps]);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export {
|
|
106
|
+
activateOnSpaceEnter,
|
|
107
|
+
submitOnEnter,
|
|
108
|
+
useDismissOnOutside,
|
|
109
|
+
useFocusOnChange,
|
|
110
|
+
useScrollThreshold,
|
|
111
|
+
useTextareaAutosize
|
|
112
|
+
};
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
@fourty/ui shared kinetics — keyframes + utility classes brand packages
|
|
3
|
+
opt into. Pair with the JS-side motionPresets/hoverPresets in
|
|
4
|
+
'@fourty/ui/motion' so kinetics stay version-locked across brands.
|
|
5
|
+
========================================================================== */
|
|
6
|
+
|
|
7
|
+
/* The platform mobile morph island (island ⇄ conversation sheet) — generic,
|
|
8
|
+
tokenized surface every brand's DefaultMobileShell renders. Imported here so
|
|
9
|
+
every brand pulling `@fourty/ui/motion.css` gets the island styling. */
|
|
10
|
+
@import "../shell/mobile/island.css";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Composer rim pulse — applied to the chat input wrapper while the
|
|
14
|
+
* agent is streaming a response. Soft ring expands/contracts around
|
|
15
|
+
* the existing border so the visitor feels "alive" feedback without
|
|
16
|
+
* layout shift. Colour follows the brand's --color-primary token;
|
|
17
|
+
* brands without one fall back to a calm slate.
|
|
18
|
+
*/
|
|
19
|
+
@keyframes fourty-rim-pulse {
|
|
20
|
+
0%, 100% {
|
|
21
|
+
box-shadow: 0 0 0 0 color-mix(in srgb, var(--color-primary, #475569) 0%, transparent);
|
|
22
|
+
}
|
|
23
|
+
50% {
|
|
24
|
+
box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-primary, #475569) 22%, transparent);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.fourty-composer-rim-pulse {
|
|
29
|
+
animation: fourty-rim-pulse 1.6s ease-in-out infinite;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
@media (prefers-reduced-motion: reduce) {
|
|
33
|
+
.fourty-composer-rim-pulse {
|
|
34
|
+
animation: none;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Streaming-state hairline — a 1px gradient sweeping left to right under
|
|
40
|
+
* the agent's current-phase whisper. Replaces the dot+text "loading"
|
|
41
|
+
* cliche with a quiet kinetic surface. Brand controls width by sizing
|
|
42
|
+
* the parent; this rule only owns the sweep.
|
|
43
|
+
*/
|
|
44
|
+
@keyframes fourty-stream-shimmer {
|
|
45
|
+
0% {
|
|
46
|
+
background-position: -200% 0;
|
|
47
|
+
}
|
|
48
|
+
100% {
|
|
49
|
+
background-position: 200% 0;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.fourty-stream-hairline {
|
|
54
|
+
height: 1px;
|
|
55
|
+
width: 100%;
|
|
56
|
+
background-image: linear-gradient(
|
|
57
|
+
90deg,
|
|
58
|
+
transparent 0%,
|
|
59
|
+
color-mix(in srgb, var(--color-primary, #475569) 35%, transparent) 50%,
|
|
60
|
+
transparent 100%
|
|
61
|
+
);
|
|
62
|
+
background-size: 50% 100%;
|
|
63
|
+
background-repeat: no-repeat;
|
|
64
|
+
animation: fourty-stream-shimmer 1.8s linear infinite;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@media (prefers-reduced-motion: reduce) {
|
|
68
|
+
.fourty-stream-hairline {
|
|
69
|
+
animation: none;
|
|
70
|
+
background-image: linear-gradient(
|
|
71
|
+
90deg,
|
|
72
|
+
transparent 0%,
|
|
73
|
+
color-mix(in srgb, var(--color-primary, #475569) 20%, transparent) 50%,
|
|
74
|
+
transparent 100%
|
|
75
|
+
);
|
|
76
|
+
background-size: 100% 100%;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/* ──────────────────────────────────────
|
|
2
|
+
40rty Tailwind theme — the design tokens and variants every Tailwind build
|
|
3
|
+
on the platform shares.
|
|
4
|
+
|
|
5
|
+
Imported by the console (apps/platform/app/globals.css) AND by a brand
|
|
6
|
+
package's own Tailwind build (`bundle.tailwind` in forty.config.json), so a
|
|
7
|
+
published brand generates exactly the utilities the console would have —
|
|
8
|
+
`bg-surface-raised`, `text-2xs`, `rounded-xl` — without the console having
|
|
9
|
+
to scan the brand's source.
|
|
10
|
+
|
|
11
|
+
Only Tailwind THEME lives here: `@theme` tokens, `@theme inline` mappings
|
|
12
|
+
and custom variants. No selectors, no base styles — this file emits no CSS
|
|
13
|
+
on its own. The `var(--…)` values the inline mappings read (`--background`,
|
|
14
|
+
`--surface-N`, …) are defined by the page that hosts the brand.
|
|
15
|
+
────────────────────────────────────── */
|
|
16
|
+
|
|
17
|
+
@custom-variant dark (&:is(.dark *):not(.spacefront-preview *));
|
|
18
|
+
|
|
19
|
+
@theme {
|
|
20
|
+
/* ── Brand ── (admin.css overrides values for .admin-shell) */
|
|
21
|
+
--color-brand-primary: #6366F1;
|
|
22
|
+
--color-brand-primaryHover: #4F46E5;
|
|
23
|
+
--color-brand-primarySoft: #E0E7FF;
|
|
24
|
+
/* Text ON a brand-primary fill. `console.css` has defined this for the
|
|
25
|
+
console (`#F4F2EE`, cream) since the theme was written, but it was never
|
|
26
|
+
declared HERE — and `@theme` is what mints the utility, so `text-
|
|
27
|
+
brand-primaryFg` generated no rule at all and every element wearing it
|
|
28
|
+
silently inherited its parent's colour. Where that parent is the active
|
|
29
|
+
filter trigger, which paints itself `text-brand-primary`, the result was a
|
|
30
|
+
count badge in the same blue as its own background: a solid dot with an
|
|
31
|
+
invisible number inside it. Measured on the sessions queue — the "Review
|
|
32
|
+
state 1" badge computed `color` and `background-color` both to
|
|
33
|
+
rgb(27,63,141). Declaring it here mints the utility; console.css's value
|
|
34
|
+
still wins inside the console, exactly as it does for `brand-primary`. */
|
|
35
|
+
--color-brand-primaryFg: #FFFFFF;
|
|
36
|
+
--color-brand-accent: #22D3EE;
|
|
37
|
+
--color-brand-accentHover: #06B6D4;
|
|
38
|
+
--color-brand-accentSoft: #CFFAFE;
|
|
39
|
+
--color-brand-warning: #F59E0B;
|
|
40
|
+
--color-brand-warningMuted: #FEF3C7;
|
|
41
|
+
--color-brand-danger: #EF4444;
|
|
42
|
+
--color-brand-success: #059669;
|
|
43
|
+
|
|
44
|
+
/* ── Surfaces ── defaults (admin.css overrides for .admin-shell) */
|
|
45
|
+
--color-surface-base: #FFFFFF;
|
|
46
|
+
--color-surface-raised: #F7F7F5;
|
|
47
|
+
--color-surface-overlay: #EFEFED;
|
|
48
|
+
--color-surface-border: #DDDCD8;
|
|
49
|
+
|
|
50
|
+
/* ── Text ── defaults (admin.css overrides for .admin-shell) */
|
|
51
|
+
--color-text-primary: #1A1A1A;
|
|
52
|
+
--color-text-secondary: #4A4A4A;
|
|
53
|
+
--color-text-muted: #999999;
|
|
54
|
+
--color-text-label: #6B6B6B;
|
|
55
|
+
|
|
56
|
+
/* ── Zones ── */
|
|
57
|
+
--color-zone-top: #6366F1;
|
|
58
|
+
--color-zone-mid: #22D3EE;
|
|
59
|
+
--color-zone-support: #F59E0B;
|
|
60
|
+
--color-zone-bottom: #A855F7;
|
|
61
|
+
|
|
62
|
+
/* ── Latency ── */
|
|
63
|
+
--color-latency-fast: #059669;
|
|
64
|
+
--color-latency-ok: #22D3EE;
|
|
65
|
+
--color-latency-slow: #F59E0B;
|
|
66
|
+
--color-latency-over: #EF4444;
|
|
67
|
+
|
|
68
|
+
/* ── Typography ── */
|
|
69
|
+
--font-sans: var(--font-inter-tight), ui-sans-serif, system-ui, sans-serif;
|
|
70
|
+
--font-mono: ui-monospace, 'JetBrains Mono', 'SF Mono', Menlo, monospace;
|
|
71
|
+
--text-2xs: 0.6875rem;
|
|
72
|
+
--text-xs: 0.8125rem;
|
|
73
|
+
--text-sm: 0.875rem;
|
|
74
|
+
--text-base: 0.9375rem;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@theme inline {
|
|
78
|
+
--font-heading: var(--font-sans);
|
|
79
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
80
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
81
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
82
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
83
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
84
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
85
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
86
|
+
--color-sidebar: var(--sidebar);
|
|
87
|
+
--color-chart-5: var(--chart-5);
|
|
88
|
+
--color-chart-4: var(--chart-4);
|
|
89
|
+
--color-chart-3: var(--chart-3);
|
|
90
|
+
--color-chart-2: var(--chart-2);
|
|
91
|
+
--color-chart-1: var(--chart-1);
|
|
92
|
+
--color-ring: var(--ring);
|
|
93
|
+
--color-input: var(--input);
|
|
94
|
+
--color-border: var(--border);
|
|
95
|
+
--color-destructive: var(--destructive);
|
|
96
|
+
--color-accent-foreground: var(--accent-foreground);
|
|
97
|
+
--color-accent: var(--accent);
|
|
98
|
+
--color-muted-foreground: var(--muted-foreground);
|
|
99
|
+
--color-muted: var(--muted);
|
|
100
|
+
--color-secondary-foreground: var(--secondary-foreground);
|
|
101
|
+
--color-secondary: var(--secondary);
|
|
102
|
+
--color-primary-foreground: var(--primary-foreground);
|
|
103
|
+
--color-primary: var(--primary);
|
|
104
|
+
--color-popover-foreground: var(--popover-foreground);
|
|
105
|
+
--color-popover: var(--popover);
|
|
106
|
+
--color-card-foreground: var(--card-foreground);
|
|
107
|
+
--color-card: var(--card);
|
|
108
|
+
--color-foreground: var(--foreground);
|
|
109
|
+
--color-background: var(--background);
|
|
110
|
+
--radius-sm: calc(var(--radius) * 0.6);
|
|
111
|
+
--radius-md: calc(var(--radius) * 0.8);
|
|
112
|
+
--radius-lg: var(--radius);
|
|
113
|
+
--radius-xl: calc(var(--radius) * 1.4);
|
|
114
|
+
--radius-2xl: calc(var(--radius) * 1.8);
|
|
115
|
+
--radius-3xl: calc(var(--radius) * 2.2);
|
|
116
|
+
--radius-4xl: calc(var(--radius) * 2.6);
|
|
117
|
+
--color-surface-1: var(--surface-1);
|
|
118
|
+
--color-surface-2: var(--surface-2);
|
|
119
|
+
--color-surface-3: var(--surface-3);
|
|
120
|
+
--color-surface-4: var(--surface-4);
|
|
121
|
+
--color-surface-5: var(--surface-5);
|
|
122
|
+
--color-surface-6: var(--surface-6);
|
|
123
|
+
--color-surface-7: var(--surface-7);
|
|
124
|
+
--color-surface-8: var(--surface-8);
|
|
125
|
+
--shadow-surface-1: var(--shadow-1);
|
|
126
|
+
--shadow-surface-2: var(--shadow-2);
|
|
127
|
+
--shadow-surface-3: var(--shadow-3);
|
|
128
|
+
--shadow-surface-4: var(--shadow-4);
|
|
129
|
+
--shadow-surface-5: var(--shadow-5);
|
|
130
|
+
--shadow-surface-6: var(--shadow-6);
|
|
131
|
+
--shadow-surface-7: var(--shadow-7);
|
|
132
|
+
--shadow-surface-8: var(--shadow-8);
|
|
133
|
+
--color-dm-drop: var(--dm-drop);
|
|
134
|
+
--color-dm-ring-high: var(--dm-ring-high);
|
|
135
|
+
--color-dm-ring-mid: var(--dm-ring-mid);
|
|
136
|
+
--color-dm-ring-base: var(--dm-ring-base);
|
|
137
|
+
--color-dm-hi-peak: var(--dm-hi-peak);
|
|
138
|
+
--color-dm-hi-high: var(--dm-hi-high);
|
|
139
|
+
--color-dm-hi-mid: var(--dm-hi-mid);
|
|
140
|
+
--color-dm-hi-base: var(--dm-hi-base);
|
|
141
|
+
--shadow-8: var(--shadow-8);
|
|
142
|
+
--shadow-7: var(--shadow-7);
|
|
143
|
+
--shadow-6: var(--shadow-6);
|
|
144
|
+
--shadow-5: var(--shadow-5);
|
|
145
|
+
--shadow-4: var(--shadow-4);
|
|
146
|
+
--shadow-3: var(--shadow-3);
|
|
147
|
+
--shadow-2: var(--shadow-2);
|
|
148
|
+
--shadow-1: var(--shadow-1);
|
|
149
|
+
--color-shadow-color: var(--shadow-color);
|
|
150
|
+
@keyframes spinner-move {
|
|
151
|
+
to {
|
|
152
|
+
stroke-dashoffset: -100;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
@keyframes spinner-dash {
|
|
156
|
+
0%, 100% {
|
|
157
|
+
stroke-dasharray: 15 85;
|
|
158
|
+
}
|
|
159
|
+
50% {
|
|
160
|
+
stroke-dasharray: 40 60;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|