@kumix/ui 0.4.1 → 0.4.2
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/README.md +37 -30
- package/dist/{cascader-types-DVT-znZ-.d.ts → cascader-types-zhnUQ4sP.d.ts} +11 -3
- package/dist/cascader-types-zhnUQ4sP.d.ts.map +1 -0
- package/dist/components/agents/agent-code.js +1 -1
- package/dist/components/charts/candlestick-chart/context.d.ts.map +1 -1
- package/dist/components/charts/donut-chart/context.d.ts.map +1 -1
- package/dist/components/charts/liquidity-heatmap.d.ts.map +1 -1
- package/dist/components/charts/order-book.d.ts.map +1 -1
- package/dist/components/charts/treemap.d.ts.map +1 -1
- package/dist/components/charts/volume-profile.d.ts.map +1 -1
- package/dist/components/motion/action-swap.d.ts +1 -1
- package/dist/components/motion/action-swap.d.ts.map +1 -1
- package/dist/components/motion/action-swap.js +43 -20
- package/dist/components/motion/action-swap.js.map +1 -1
- package/dist/components/motion/animated-badge.d.ts +1 -1
- package/dist/components/motion/animated-badge.d.ts.map +1 -1
- package/dist/components/motion/animated-badge.js +60 -101
- package/dist/components/motion/animated-badge.js.map +1 -1
- package/dist/components/motion/animated-sidebar.js +1 -1
- package/dist/components/motion/animated-toast-stack.js +1 -1
- package/dist/components/motion/attachment-upload.js +1 -1
- package/dist/components/motion/availability-scheduler/copy-menu.js +1 -1
- package/dist/components/motion/availability-scheduler/day-row.js +1 -1
- package/dist/components/motion/availability-scheduler/index.js +1 -1
- package/dist/components/motion/bloom-menu.d.ts.map +1 -1
- package/dist/components/motion/bloom-menu.js +73 -8
- package/dist/components/motion/bloom-menu.js.map +1 -1
- package/dist/components/motion/bottom-sheet.d.ts.map +1 -1
- package/dist/components/motion/bottom-sheet.js +6 -10
- package/dist/components/motion/bottom-sheet.js.map +1 -1
- package/dist/components/motion/bouncy-accordion.d.ts.map +1 -1
- package/dist/components/motion/bouncy-accordion.js +35 -22
- package/dist/components/motion/bouncy-accordion.js.map +1 -1
- package/dist/components/motion/center-morph-modal.js +1 -1
- package/dist/components/motion/color-picker.d.ts.map +1 -1
- package/dist/components/motion/command-palette.js +1 -1
- package/dist/components/motion/context-menu.js +1 -1
- package/dist/components/motion/date-range-picker.d.ts.map +1 -1
- package/dist/components/motion/drawer.d.ts +1 -1
- package/dist/components/motion/drawer.d.ts.map +1 -1
- package/dist/components/motion/drawer.js +10 -10
- package/dist/components/motion/drawer.js.map +1 -1
- package/dist/components/motion/expandable-action-bar.d.ts.map +1 -1
- package/dist/components/motion/feedback-widget.js +4 -1
- package/dist/components/motion/feedback-widget.js.map +1 -1
- package/dist/components/motion/morphing-lightbox.d.ts.map +1 -1
- package/dist/components/motion/morphing-lightbox.js +1 -1
- package/dist/components/motion/morphing-modal.d.ts +6 -1
- package/dist/components/motion/morphing-modal.d.ts.map +1 -1
- package/dist/components/motion/morphing-modal.js +37 -5
- package/dist/components/motion/morphing-modal.js.map +1 -1
- package/dist/components/motion/morphing-search.js +1 -1
- package/dist/components/motion/morphing-tabs.js +1 -1
- package/dist/components/motion/otp-input.js +19 -11
- package/dist/components/motion/otp-input.js.map +1 -1
- package/dist/components/motion/popover-morph.d.ts +4 -3
- package/dist/components/motion/popover-morph.d.ts.map +1 -1
- package/dist/components/motion/popover-morph.js +47 -55
- package/dist/components/motion/popover-morph.js.map +1 -1
- package/dist/components/motion/popover.js +7 -1
- package/dist/components/motion/popover.js.map +1 -1
- package/dist/components/motion/prediction-market-card.js +1 -1
- package/dist/components/motion/prediction-market.js +1 -1
- package/dist/components/motion/project-folder.js +1 -1
- package/dist/components/motion/radio.d.ts +5 -1
- package/dist/components/motion/radio.d.ts.map +1 -1
- package/dist/components/motion/radio.js +53 -5
- package/dist/components/motion/radio.js.map +1 -1
- package/dist/components/motion/select-morph.d.ts +1 -1
- package/dist/components/motion/select-morph.d.ts.map +1 -1
- package/dist/components/motion/select-morph.js +89 -21
- package/dist/components/motion/select-morph.js.map +1 -1
- package/dist/components/motion/select.d.ts.map +1 -1
- package/dist/components/motion/select.js +153 -135
- package/dist/components/motion/select.js.map +1 -1
- package/dist/components/motion/shader-background.d.ts +3 -2
- package/dist/components/motion/shader-background.d.ts.map +1 -1
- package/dist/components/motion/shader-background.js +9 -3
- package/dist/components/motion/shader-background.js.map +1 -1
- package/dist/components/motion/shared-layout-bg.d.ts.map +1 -1
- package/dist/components/motion/shared-layout-bg.js +17 -3
- package/dist/components/motion/shared-layout-bg.js.map +1 -1
- package/dist/components/motion/swipeable-list.d.ts.map +1 -1
- package/dist/components/motion/swipeable-list.js +61 -4
- package/dist/components/motion/swipeable-list.js.map +1 -1
- package/dist/components/motion/table/row-handle.js +1 -1
- package/dist/components/motion/table/table-header.js +1 -1
- package/dist/components/motion/tabs.d.ts +12 -3
- package/dist/components/motion/tabs.d.ts.map +1 -1
- package/dist/components/motion/tabs.js +248 -26
- package/dist/components/motion/tabs.js.map +1 -1
- package/dist/components/motion/theme-toggle.js +1 -1
- package/dist/components/reui/alert.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts +1 -1
- package/dist/components/reui/autocomplete.d.ts.map +1 -1
- package/dist/components/reui/autocomplete.js +1 -1
- package/dist/components/reui/autocomplete.js.map +1 -1
- package/dist/components/reui/badge.d.ts +2 -2
- package/dist/components/reui/cascader/cascader-async.d.ts +21 -5
- package/dist/components/reui/cascader/cascader-async.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-async.js +61 -34
- package/dist/components/reui/cascader/cascader-async.js.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-columns.js +5 -2
- package/dist/components/reui/cascader/cascader-columns.js.map +1 -1
- package/dist/components/reui/cascader/cascader-context.d.ts +3 -1
- package/dist/components/reui/cascader/cascader-context.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-context.js.map +1 -1
- package/dist/components/reui/cascader/cascader-i18n.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-item.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-lib.d.ts +34 -8
- package/dist/components/reui/cascader/cascader-lib.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader-lib.js +145 -29
- package/dist/components/reui/cascader/cascader-lib.js.map +1 -1
- package/dist/components/reui/cascader/cascader-nav.d.ts +1 -1
- package/dist/components/reui/cascader/cascader-types.d.ts +1 -1
- package/dist/components/reui/cascader/cascader.d.ts +13 -8
- package/dist/components/reui/cascader/cascader.d.ts.map +1 -1
- package/dist/components/reui/cascader/cascader.js +31 -16
- package/dist/components/reui/cascader/cascader.js.map +1 -1
- package/dist/components/reui/code-block/code-block.d.ts.map +1 -1
- package/dist/components/reui/color-picker.js +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-cell-selection.js +1 -0
- package/dist/components/reui/data-grid/data-grid-cell-selection.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-filter.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-filter.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts +6 -8
- package/dist/components/reui/data-grid/data-grid-column-header.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-header.js +7 -8
- package/dist/components/reui/data-grid/data-grid-column-header.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-column-visibility.js +1 -0
- package/dist/components/reui/data-grid/data-grid-column-visibility.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-pagination.js +1 -0
- package/dist/components/reui/data-grid/data-grid-pagination.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-scroll-area.js +1 -0
- package/dist/components/reui/data-grid/data-grid-scroll-area.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js +3 -2
- package/dist/components/reui/data-grid/data-grid-table-dnd-rows.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js +2 -1
- package/dist/components/reui/data-grid/data-grid-table-dnd.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js +2 -1
- package/dist/components/reui/data-grid/data-grid-table-virtual.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.d.ts +6 -11
- package/dist/components/reui/data-grid/data-grid-table.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid-table.js +22 -22
- package/dist/components/reui/data-grid/data-grid-table.js.map +1 -1
- package/dist/components/reui/data-grid/data-grid.d.ts +16 -1
- package/dist/components/reui/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/reui/data-grid/data-grid.js +80 -22
- package/dist/components/reui/data-grid/data-grid.js.map +1 -1
- package/dist/components/reui/date-selector.d.ts.map +1 -1
- package/dist/components/reui/date-selector.js +21 -15
- package/dist/components/reui/date-selector.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js +3 -5
- package/dist/components/reui/event-calendar/event-calendar-agenda-view.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar-nav.js +2 -2
- package/dist/components/reui/event-calendar/event-calendar-nav.js.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.d.ts.map +1 -1
- package/dist/components/reui/event-calendar/event-calendar.js +34 -31
- package/dist/components/reui/event-calendar/event-calendar.js.map +1 -1
- package/dist/components/reui/file-type.d.ts +302 -6
- package/dist/components/reui/file-type.d.ts.map +1 -1
- package/dist/components/reui/file-type.js +416 -13
- package/dist/components/reui/file-type.js.map +1 -1
- package/dist/components/reui/filters/filters-builder.d.ts +1 -1
- package/dist/components/reui/filters/filters-lib.d.ts +1 -1
- package/dist/components/reui/frame.d.ts +1 -1
- package/dist/components/reui/gantt/gantt-nav.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt-nav.js +2 -2
- package/dist/components/reui/gantt/gantt-nav.js.map +1 -1
- package/dist/components/reui/gantt/gantt.d.ts.map +1 -1
- package/dist/components/reui/gantt/gantt.js +5 -2
- package/dist/components/reui/gantt/gantt.js.map +1 -1
- package/dist/components/reui/icon-tile.d.ts +2 -2
- package/dist/components/reui/number-field.d.ts +3 -3
- package/dist/components/reui/phone-input.js +30 -27
- package/dist/components/reui/phone-input.js.map +1 -1
- package/dist/components/reui/rating.d.ts +1 -1
- package/dist/components/reui/time-picker.js +1 -1
- package/dist/components/ui/attachment.d.ts +2 -2
- package/dist/components/ui/badge.d.ts +1 -1
- package/dist/components/ui/bubble.d.ts +1 -1
- package/dist/components/ui/button.d.ts +2 -2
- package/dist/components/ui/chart.d.ts.map +1 -1
- package/dist/components/ui/code-block.d.ts +29 -0
- package/dist/components/ui/code-block.d.ts.map +1 -0
- package/dist/components/ui/code-block.js +124 -0
- package/dist/components/ui/code-block.js.map +1 -0
- package/dist/components/ui/empty.d.ts +1 -1
- package/dist/components/ui/item.d.ts +2 -2
- package/dist/components/ui/marker.d.ts +1 -1
- package/dist/components/ui/sidebar.d.ts +1 -1
- package/dist/components/ui/toggle.d.ts +1 -1
- package/dist/components/ui/trace.d.ts +21 -0
- package/dist/components/ui/trace.d.ts.map +1 -0
- package/dist/components/ui/trace.js +77 -0
- package/dist/components/ui/trace.js.map +1 -0
- package/dist/context-BYXeJQnz.d.ts.map +1 -1
- package/dist/{copy-menu-BXUh52bu.js → copy-menu-DOg9Jh-U.js} +2 -2
- package/dist/{copy-menu-BXUh52bu.js.map → copy-menu-DOg9Jh-U.js.map} +1 -1
- package/dist/hooks/use-focus-trap.d.ts +22 -0
- package/dist/hooks/use-focus-trap.d.ts.map +1 -0
- package/dist/hooks/use-focus-trap.js +80 -0
- package/dist/hooks/use-focus-trap.js.map +1 -0
- package/dist/hooks/use-highlighted-code.d.ts +5 -0
- package/dist/hooks/use-highlighted-code.d.ts.map +1 -0
- package/dist/hooks/use-highlighted-code.js +128 -0
- package/dist/hooks/use-highlighted-code.js.map +1 -0
- package/dist/hooks/use-listbox.d.ts +29 -0
- package/dist/hooks/use-listbox.d.ts.map +1 -0
- package/dist/hooks/use-listbox.js +75 -0
- package/dist/hooks/use-listbox.js.map +1 -0
- package/dist/tooltip-C01qUgsW.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/cascader-types-DVT-znZ-.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bottom-sheet.js","names":[],"sources":["../../../src/components/motion/bottom-sheet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\nimport { TOUCH_GESTURE_CONTENT_CLASS } from \"../../lib/touch\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const descriptionId = `${uid}-description`;\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n const onKey = (event: KeyboardEvent) => {\n if (event.key === \"Escape\") {\n event.preventDefault();\n onOpenChange(false);\n }\n };\n window.addEventListener(\"keydown\", onKey);\n\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open, onOpenChange]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n // Two fixed siblings, no wrapper: the scrim spans the viewport edges but\n // carries a colour, and the sheet is pinned to the bottom, stops short of the\n // top edge at every snap point the component ships, and paints an opaque\n // surface either way. Both hang off `PresenceGate`, so interaction releases in\n // the same commit that starts the exit rather than when it ends.\n return createPortal(\n <AnimatePresence>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n {...gate}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto fixed inset-0 z-50 bg-background/40 backdrop-blur-sm\"\n />\n )}\n </PresenceGate>\n ) : null}\n {open ? (\n <PresenceGate key=\"sheet\">\n {({ gate }) => (\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n {...gate}\n style={{ ...heightStyle, ...gate.style }}\n className={cn(\n \"pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-label={title ? undefined : \"Bottom sheet\"}\n >\n <div className=\"flex flex-col items-center px-4 pt-3 pb-2\">\n {/* Drag only the pill so the title and description stay selectable. */}\n <div\n onPointerDown={(event) => dragControls.start(event)}\n // A slow pull must not hand the gesture to iOS's callout,\n // which would leave the sheet frozen mid-drag.\n className={cn(\n \"flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing\",\n TOUCH_GESTURE_CONTENT_CLASS,\n )}\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n </div>\n {title || description ? (\n <div className=\"mt-2 w-full\">\n {title ? (\n <h2 id={titleId} className=\"font-semibold text-base text-foreground\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"mt-0.5 text-muted-foreground text-sm\">\n {description}\n </p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA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heet.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useId, useRef, useState } from \"react\";\nimport {\n AnimatePresence,\n motion,\n type PanInfo,\n useDragControls,\n useReducedMotion,\n} from \"motion/react\";\nimport { createPortal } from \"react-dom\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useFocusTrap } from \"../../hooks/use-focus-trap\";\nimport { EASE_DRAWER } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\nimport { TOUCH_GESTURE_CONTENT_CLASS } from \"../../lib/touch\";\n\n// Vaul-style glide: a long, fully-damped tween reads smoother than a spring on\n// open — no settle/overshoot, just one clean decel. Same curve drives the\n// backdrop fade so the surface and scrim move as one.\nconst DRAWER = { duration: 0.5, ease: EASE_DRAWER } as const;\n\nexport interface BottomSheetProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n /** Heights (0-1 = fraction of viewport, or \"auto\"). First entry is default. */\n snapPoints?: (number | \"auto\")[];\n defaultSnap?: number;\n title?: string;\n description?: string;\n children?: ReactNode;\n className?: string;\n /** Min drag distance (px) past current snap to dismiss. */\n dismissThreshold?: number;\n}\n\nexport function BottomSheet({\n open,\n onOpenChange,\n snapPoints = [0.5, 0.92],\n defaultSnap = 0,\n title,\n description,\n children,\n className,\n dismissThreshold = 120,\n}: BottomSheetProps) {\n const [snap, setSnap] = useState(defaultSnap);\n const [mounted, setMounted] = useState(false);\n const dragControls = useDragControls();\n const sheetRef = useRef<HTMLDivElement>(null);\n const reduce = useReducedMotion();\n const heightRef = useRef(0);\n const uid = useId();\n const titleId = `${uid}-title`;\n const descriptionId = `${uid}-description`;\n\n useEffect(() => {\n setMounted(true);\n }, []);\n\n useEffect(() => {\n if (open) setSnap(defaultSnap);\n }, [open, defaultSnap]);\n\n // Focus moves into the sheet on open, Tab stays inside it, and focus returns\n // to the opener on close. `mounted` gates it because the sheet only exists\n // once the portal can render.\n useFocusTrap(open && mounted, sheetRef, {\n onEscape: () => onOpenChange(false),\n });\n\n // Lock background scroll while open. overflow:hidden alone is ignored by\n // iOS Safari — boundary scrolls inside the sheet chain to the page, which\n // scrolls underneath and ends up somewhere else on close. position:fixed\n // is the lock that actually holds; restore the scroll position after.\n useEffect(() => {\n if (!open) return;\n const body = document.body;\n const scrollY = window.scrollY;\n const prev = {\n position: body.style.position,\n top: body.style.top,\n left: body.style.left,\n right: body.style.right,\n overflow: body.style.overflow,\n };\n body.style.position = \"fixed\";\n body.style.top = `-${scrollY}px`;\n body.style.left = \"0\";\n body.style.right = \"0\";\n body.style.overflow = \"hidden\";\n\n return () => {\n body.style.position = prev.position;\n body.style.top = prev.top;\n body.style.left = prev.left;\n body.style.right = prev.right;\n body.style.overflow = prev.overflow;\n window.scrollTo(0, scrollY);\n };\n }, [open]);\n\n const onDragEnd = (_: unknown, info: PanInfo) => {\n const velocity = info.velocity.y;\n const offset = info.offset.y;\n\n // Strong downward fling or large drag → dismiss.\n if (velocity > 600 || offset > dismissThreshold) {\n const smaller = snapPoints.map((_, i) => i).filter((i) => i < snap);\n if (smaller.length && velocity < 800 && offset < dismissThreshold * 1.6) {\n setSnap(smaller[smaller.length - 1]);\n } else {\n onOpenChange(false);\n }\n return;\n }\n\n // Strong upward fling → next snap.\n if (velocity < -500) {\n setSnap((current) => Math.min(snapPoints.length - 1, current + 1));\n return;\n }\n\n // Otherwise snap to nearest by current offset.\n setSnap((current) => {\n if (offset > 80 && current > 0) return current - 1;\n if (offset < -80 && current < snapPoints.length - 1) return current + 1;\n return current;\n });\n };\n\n const snapValue = snapPoints[snap];\n const heightStyle =\n snapValue === \"auto\" ? { maxHeight: \"92vh\" } : { height: `${snapValue * 100}vh` };\n\n // Portal to <body>: an ancestor with backdrop-filter or transform becomes\n // the containing block for fixed descendants, which would position the\n // sheet against that ancestor instead of the viewport.\n if (!mounted) return null;\n\n // Two fixed siblings, no wrapper: the scrim spans the viewport edges but\n // carries a colour, and the sheet is pinned to the bottom, stops short of the\n // top edge at every snap point the component ships, and paints an opaque\n // surface either way. Both hang off `PresenceGate`, so interaction releases in\n // the same commit that starts the exit rather than when it ends.\n return createPortal(\n <AnimatePresence>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close bottom sheet\"\n // Outside the sheet, so the focus trap never lands on it; it is\n // a pointer target, and Escape closes from the keyboard.\n tabIndex={-1}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={DRAWER}\n {...gate}\n onClick={() => onOpenChange(false)}\n // A dim scrim with a light blur. backdrop-blur is GPU-expensive and\n // re-rasterizes every frame the sheet drags over it; a small radius\n // plus more opacity keeps the glass look without the jank.\n className=\"pointer-events-auto fixed inset-0 z-50 bg-background/40 backdrop-blur-sm\"\n />\n )}\n </PresenceGate>\n ) : null}\n {open ? (\n <PresenceGate key=\"sheet\">\n {({ gate }) => (\n <motion.div\n ref={sheetRef}\n drag=\"y\"\n dragControls={dragControls}\n dragListener={false}\n dragConstraints={{ top: 0, bottom: 0 }}\n dragElastic={{ top: 0.02, bottom: 0.4 }}\n dragMomentum={false}\n onDragEnd={onDragEnd}\n initial={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n animate={reduce ? { y: 0, opacity: 1 } : { y: 0 }}\n exit={reduce ? { y: 0, opacity: 0 } : { y: \"100%\" }}\n transition={reduce ? { duration: 0.18, ease: EASE_DRAWER } : DRAWER}\n onAnimationComplete={() => {\n if (sheetRef.current) heightRef.current = sheetRef.current.offsetHeight;\n }}\n {...gate}\n style={{ ...heightStyle, ...gate.style }}\n className={cn(\n \"pointer-events-auto fixed right-0 bottom-0 left-0 z-50 mx-auto flex max-w-2xl flex-col overflow-hidden rounded-t-3xl outline-none will-change-transform\",\n \"border border-border bg-background shadow-xl\",\n className,\n )}\n role=\"dialog\"\n aria-modal=\"true\"\n tabIndex={-1}\n aria-labelledby={title ? titleId : undefined}\n aria-describedby={description ? descriptionId : undefined}\n aria-label={title ? undefined : \"Bottom sheet\"}\n >\n <div className=\"flex flex-col items-center px-4 pt-3 pb-2\">\n {/* Drag only the pill so the title and description stay selectable. */}\n <div\n onPointerDown={(event) => dragControls.start(event)}\n // A slow pull must not hand the gesture to iOS's callout,\n // which would leave the sheet frozen mid-drag.\n className={cn(\n \"flex cursor-grab touch-none items-center justify-center py-1 active:cursor-grabbing\",\n TOUCH_GESTURE_CONTENT_CLASS,\n )}\n >\n <div className=\"h-1.5 w-10 rounded-full bg-muted-foreground/40\" />\n </div>\n {title || description ? (\n <div className=\"mt-2 w-full\">\n {title ? (\n <h2 id={titleId} className=\"font-semibold text-base text-foreground\">\n {title}\n </h2>\n ) : null}\n {description ? (\n <p id={descriptionId} className=\"mt-0.5 text-muted-foreground text-sm\">\n {description}\n </p>\n ) : null}\n </div>\n ) : null}\n </div>\n {/* overscroll-contain stops boundary scrolls from chaining to the page. */}\n <div className=\"flex-1 overflow-y-auto overscroll-contain px-4 pb-6\">{children}</div>\n </motion.div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>,\n document.body,\n );\n}\n"],"mappings":";;;;;;;;;;;AAqBA,MAAM,SAAS;CAAE,UAAU;CAAK,MAAM;AAAY;AAgBlD,SAAgB,YAAY,EAC1B,MACA,cACA,aAAa,CAAC,IAAK,GAAI,GACvB,cAAc,GACd,OACA,aACA,UACA,WACA,mBAAmB,OACA;CACnB,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAC5C,MAAM,eAAe,gBAAgB;CACrC,MAAM,WAAW,OAAuB,IAAI;CAC5C,MAAM,SAAS,iBAAiB;CAChC,MAAM,YAAY,OAAO,CAAC;CAC1B,MAAM,MAAM,MAAM;CAClB,MAAM,UAAU,GAAG,IAAI;CACvB,MAAM,gBAAgB,GAAG,IAAI;CAE7B,gBAAgB;EACd,WAAW,IAAI;CACjB,GAAG,CAAC,CAAC;CAEL,gBAAgB;EACd,IAAI,MAAM,QAAQ,W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B,QAAQ,UAAU,KAAA;EACnC,oBAAkB,cAAc,gBAAgB,KAAA;EAChD,cAAY,QAAQ,KAAA,IAAY;EA5BlC,UAAA,CA8BE,qBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CAEE,oBAAC,OAAD;IACE,gBAAgB,UAAU,aAAa,MAAM,KAAK;IAGlD,WAAW,GACT,uFACA,2BACF;IAEA,UAAA,oBAAC,OAAD,EAAK,WAAU,iDAAkD,CAAA;GAC9D,CAAA,GACJ,SAAS,cACR,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACG,QACC,oBAAC,MAAD;KAAI,IAAI;KAAS,WAAU;KACxB,UAAA;IACC,CAAA,IACF,MACH,cACC,oBAAC,KAAD;KAAG,IAAI;KAAe,WAAU;KAC7B,UAAA;IACA,CAAA,IACD,IACD;GACH,CAAA,IAAA,IACD;EAEL,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAU;GAAuD;EAAc,CAAA,CAC1E;CAEF,CAAA,EAAA,GAhEI,OAgEJ,IACZ,IACW,EAAA,CAAA,GACjB,SAAS,IACX;AACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bouncy-accordion.d.ts","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"mappings":";;YASY;EACV;EACA,OAAO;EACP,cAAc;EACd,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;;
|
|
1
|
+
{"version":3,"file":"bouncy-accordion.d.ts","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"mappings":";;YASY;EACV;EACA,OAAO;EACP,cAAc;EACd,OAAO;EACP;;YAGU;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,iBAAiB;EACjB;EACA;EACA,aAAa;;wBAwNC,kBACd,OACA,OACA,cACA,eACA,aACA,WACA,cACC,uCAAoB,IAAA"}
|
|
@@ -6,20 +6,15 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { motion, useReducedMotion } from "motion/react";
|
|
7
7
|
import { ChevronDown } from "lucide-react";
|
|
8
8
|
//#region src/components/motion/bouncy-accordion.tsx
|
|
9
|
-
const
|
|
10
|
-
type: "spring",
|
|
11
|
-
duration: .55,
|
|
12
|
-
bounce: .38
|
|
13
|
-
};
|
|
14
|
-
const CONTENT_OPEN_TRANSITION = {
|
|
9
|
+
const EXPAND_TRANSITION = {
|
|
15
10
|
type: "spring",
|
|
16
11
|
duration: .58,
|
|
17
12
|
bounce: .32
|
|
18
13
|
};
|
|
19
|
-
const
|
|
14
|
+
const COLLAPSE_TRANSITION = {
|
|
20
15
|
type: "spring",
|
|
21
16
|
duration: .46,
|
|
22
|
-
bounce:
|
|
17
|
+
bounce: 0
|
|
23
18
|
};
|
|
24
19
|
const DESCRIPTION_TRANSITION = {
|
|
25
20
|
duration: .18,
|
|
@@ -33,12 +28,12 @@ const CHEVRON_TRANSITION = {
|
|
|
33
28
|
function useControllableAccordionValue({ value, defaultValue, onValueChange }) {
|
|
34
29
|
const [internalValue, setInternalValue] = useState(defaultValue ?? null);
|
|
35
30
|
const isControlled = value !== void 0;
|
|
36
|
-
return [value
|
|
31
|
+
return [isControlled ? value : internalValue, useCallback((next) => {
|
|
37
32
|
if (!isControlled) setInternalValue(next);
|
|
38
33
|
onValueChange?.(next);
|
|
39
34
|
}, [isControlled, onValueChange])];
|
|
40
35
|
}
|
|
41
|
-
function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromPrevious, contentId, triggerId, reduce, classNames, onToggle }) {
|
|
36
|
+
function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromPrevious, contentId, triggerId, reduce, layoutTransition, layoutDependency, classNames, onToggle }) {
|
|
42
37
|
const contentRef = useRef(null);
|
|
43
38
|
const [contentHeight, setContentHeight] = useState(0);
|
|
44
39
|
useLayoutEffect(() => {
|
|
@@ -55,12 +50,15 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
|
|
|
55
50
|
};
|
|
56
51
|
}, []);
|
|
57
52
|
return /* @__PURE__ */ jsx(motion.div, {
|
|
58
|
-
layout: "position",
|
|
53
|
+
layout: reduce ? false : "position",
|
|
54
|
+
layoutDependency,
|
|
59
55
|
initial: false,
|
|
60
56
|
style: { marginTop: separatedFromPrevious ? 12 : 0 },
|
|
61
|
-
transition:
|
|
57
|
+
transition: { layout: layoutTransition },
|
|
62
58
|
children: /* @__PURE__ */ jsxs(motion.div, {
|
|
63
59
|
"data-state": open ? "open" : "closed",
|
|
60
|
+
layout: !reduce,
|
|
61
|
+
layoutDependency,
|
|
64
62
|
initial: false,
|
|
65
63
|
animate: {
|
|
66
64
|
borderTopLeftRadius: startsGroup ? 28 : 0,
|
|
@@ -68,15 +66,20 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
|
|
|
68
66
|
borderBottomLeftRadius: endsGroup ? 28 : 0,
|
|
69
67
|
borderBottomRightRadius: endsGroup ? 28 : 0
|
|
70
68
|
},
|
|
71
|
-
transition: reduce ? { duration: 0 } :
|
|
69
|
+
transition: reduce ? { duration: 0 } : layoutTransition,
|
|
70
|
+
style: { originY: 0 },
|
|
72
71
|
className: cn("overflow-hidden bg-card text-card-foreground", item.disabled && "opacity-50", classNames?.item),
|
|
73
|
-
children: [/* @__PURE__ */ jsxs(
|
|
72
|
+
children: [/* @__PURE__ */ jsxs(motion.button, {
|
|
74
73
|
id: triggerId,
|
|
75
74
|
type: "button",
|
|
76
75
|
disabled: item.disabled,
|
|
77
76
|
"aria-expanded": open,
|
|
78
77
|
"aria-controls": contentId,
|
|
79
78
|
onClick: onToggle,
|
|
79
|
+
layout: reduce ? false : "position",
|
|
80
|
+
layoutDependency,
|
|
81
|
+
transition: { layout: layoutTransition },
|
|
82
|
+
style: { originY: 0 },
|
|
80
83
|
className: cn("flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors", "focus-visible:bg-muted/25", "disabled:pointer-events-none", classNames?.trigger),
|
|
81
84
|
children: [
|
|
82
85
|
item.icon ? /* @__PURE__ */ jsx("span", {
|
|
@@ -95,21 +98,24 @@ function BouncyAccordionRow({ item, open, startsGroup, endsGroup, separatedFromP
|
|
|
95
98
|
children: /* @__PURE__ */ jsx(ChevronDown, { className: "h-4 w-4" })
|
|
96
99
|
})
|
|
97
100
|
]
|
|
98
|
-
}), /* @__PURE__ */ jsx(
|
|
99
|
-
layout: "size",
|
|
101
|
+
}), /* @__PURE__ */ jsx("section", {
|
|
100
102
|
id: contentId,
|
|
101
|
-
role: "region",
|
|
102
103
|
"aria-labelledby": triggerId,
|
|
103
104
|
"aria-hidden": !open,
|
|
104
105
|
inert: !open,
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
transition: reduce ? { duration: 0 } : open ? CONTENT_OPEN_TRANSITION : CONTENT_CLOSE_TRANSITION,
|
|
108
|
-
className: cn("overflow-hidden", classNames?.content),
|
|
106
|
+
style: { height: open && item.description ? contentHeight || "auto" : 0 },
|
|
107
|
+
className: cn(classNames?.content),
|
|
109
108
|
children: /* @__PURE__ */ jsx(motion.div, {
|
|
110
109
|
ref: contentRef,
|
|
110
|
+
layout: reduce ? false : "position",
|
|
111
|
+
layoutDependency,
|
|
112
|
+
initial: false,
|
|
111
113
|
animate: { opacity: open ? 1 : 0 },
|
|
112
|
-
transition:
|
|
114
|
+
transition: {
|
|
115
|
+
opacity: reduce ? { duration: 0 } : DESCRIPTION_TRANSITION,
|
|
116
|
+
layout: layoutTransition
|
|
117
|
+
},
|
|
118
|
+
style: { originY: 0 },
|
|
113
119
|
className: "px-5 pb-5",
|
|
114
120
|
children: /* @__PURE__ */ jsx("div", {
|
|
115
121
|
className: cn("text-[15px] text-muted-foreground leading-6", classNames?.description),
|
|
@@ -129,6 +135,11 @@ function BouncyAccordion({ items, value, defaultValue = null, onValueChange, col
|
|
|
129
135
|
onValueChange
|
|
130
136
|
});
|
|
131
137
|
const activeIndex = items.findIndex((item) => item.id === activeValue);
|
|
138
|
+
const previousValue = useRef(activeValue);
|
|
139
|
+
const layoutTransition = activeValue === null || previousValue.current !== null ? COLLAPSE_TRANSITION : EXPAND_TRANSITION;
|
|
140
|
+
useLayoutEffect(() => {
|
|
141
|
+
previousValue.current = activeValue;
|
|
142
|
+
}, [activeValue]);
|
|
132
143
|
const toggleItem = useCallback((id) => {
|
|
133
144
|
if (activeValue === id) {
|
|
134
145
|
if (collapsible) setActiveValue(null);
|
|
@@ -160,6 +171,8 @@ function BouncyAccordion({ items, value, defaultValue = null, onValueChange, col
|
|
|
160
171
|
contentId,
|
|
161
172
|
triggerId,
|
|
162
173
|
reduce,
|
|
174
|
+
layoutTransition,
|
|
175
|
+
layoutDependency: activeValue,
|
|
163
176
|
classNames,
|
|
164
177
|
onToggle: () => toggleItem(item.id)
|
|
165
178
|
}, item.id);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bouncy-accordion.js","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type BouncyAccordionItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n};\n\nexport type BouncyAccordionClassNames = {\n root?: string;\n item?: string;\n trigger?: string;\n icon?: string;\n title?: string;\n chevron?: string;\n content?: string;\n description?: string;\n};\n\nexport interface BouncyAccordionProps {\n items: BouncyAccordionItem[];\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n collapsible?: boolean;\n className?: string;\n classNames?: BouncyAccordionClassNames;\n}\n\n// Local springs keep the accordion's connected groups moving together while\n// avoiding scale projection on text-heavy row contents.\n// Gap spring: must not overshoot y — positive y overshoot drifts items below\n// their mt-3 resting point and briefly overlaps the next item.\nconst ROW_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.55,\n bounce: 0.38,\n};\n\nconst CONTENT_OPEN_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.58,\n bounce: 0.32,\n};\n\nconst CONTENT_CLOSE_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0.26,\n};\n\nconst DESCRIPTION_TRANSITION: Transition = {\n duration: 0.18,\n ease: EASE_OUT,\n};\n\nconst CHEVRON_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.42,\n bounce: 0.28,\n};\n\nfunction useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n}: {\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n}) {\n const [internalValue, setInternalValue] = useState(defaultValue ?? null);\n const isControlled = value !== undefined;\n const currentValue = value ?? internalValue;\n\n const setValue = useCallback(\n (next: string | null) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n return [currentValue, setValue] as const;\n}\n\nfunction BouncyAccordionRow({\n item,\n open,\n startsGroup,\n endsGroup,\n separatedFromPrevious,\n contentId,\n triggerId,\n reduce,\n classNames,\n onToggle,\n}: {\n item: BouncyAccordionItem;\n open: boolean;\n startsGroup: boolean;\n endsGroup: boolean;\n separatedFromPrevious: boolean;\n contentId: string;\n triggerId: string;\n reduce: boolean | null;\n classNames?: BouncyAccordionClassNames;\n onToggle: () => void;\n}) {\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n useLayoutEffect(() => {\n const node = contentRef.current;\n if (!node) return;\n\n const updateHeight = () => {\n setContentHeight(node.offsetHeight);\n };\n\n updateHeight();\n\n const observer = new ResizeObserver(updateHeight);\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return (\n <motion.div\n layout=\"position\"\n initial={false}\n style={{ marginTop: separatedFromPrevious ? 12 : 0 }}\n transition={reduce ? { duration: 0 } : ROW_TRANSITION}\n >\n <motion.div\n data-state={open ? \"open\" : \"closed\"}\n initial={false}\n animate={{\n borderTopLeftRadius: startsGroup ? 28 : 0,\n borderTopRightRadius: startsGroup ? 28 : 0,\n borderBottomLeftRadius: endsGroup ? 28 : 0,\n borderBottomRightRadius: endsGroup ? 28 : 0,\n }}\n transition={reduce ? { duration: 0 } : ROW_TRANSITION}\n className={cn(\n \"overflow-hidden bg-card text-card-foreground\",\n item.disabled && \"opacity-50\",\n classNames?.item,\n )}\n >\n <button\n id={triggerId}\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={open}\n aria-controls={contentId}\n onClick={onToggle}\n className={cn(\n \"flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors\",\n \"focus-visible:bg-muted/25\",\n \"disabled:pointer-events-none\",\n classNames?.trigger,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"grid h-7 w-7 shrink-0 place-items-center text-muted-foreground\",\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate font-medium text-[15px] text-foreground\",\n classNames?.title,\n )}\n >\n {item.title}\n </span>\n <motion.span\n aria-hidden\n animate={{ rotate: open ? 180 : 0 }}\n transition={reduce ? { duration: 0 } : CHEVRON_TRANSITION}\n className={cn(\n \"grid h-6 w-6 shrink-0 place-items-center text-muted-foreground\",\n classNames?.chevron,\n )}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </motion.span>\n </button>\n\n <motion.div\n layout=\"size\"\n id={contentId}\n role=\"region\"\n aria-labelledby={triggerId}\n aria-hidden={!open}\n inert={!open}\n initial={false}\n style={{ height: open && item.description ? contentHeight : 0 }}\n transition={\n reduce ? { duration: 0 } : open ? CONTENT_OPEN_TRANSITION : CONTENT_CLOSE_TRANSITION\n }\n className={cn(\"overflow-hidden\", classNames?.content)}\n >\n <motion.div\n ref={contentRef}\n animate={{\n opacity: open ? 1 : 0,\n }}\n transition={reduce ? { duration: 0 } : DESCRIPTION_TRANSITION}\n className=\"px-5 pb-5\"\n >\n <div\n className={cn(\"text-[15px] text-muted-foreground leading-6\", classNames?.description)}\n >\n {item.description}\n </div>\n </motion.div>\n </motion.div>\n </motion.div>\n </motion.div>\n );\n}\n\nexport function BouncyAccordion({\n items,\n value,\n defaultValue = null,\n onValueChange,\n collapsible = true,\n className,\n classNames,\n}: BouncyAccordionProps) {\n const reduce = useReducedMotion();\n const baseId = useId();\n const [activeValue, setActiveValue] = useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n });\n const activeIndex = items.findIndex((item) => item.id === activeValue);\n\n const toggleItem = useCallback(\n (id: string) => {\n if (activeValue === id) {\n if (collapsible) {\n setActiveValue(null);\n }\n return;\n }\n\n setActiveValue(id);\n },\n [activeValue, collapsible, setActiveValue],\n );\n\n return (\n <div className={cn(\"w-full\", className, classNames?.root)}>\n {items.map((item, index) => {\n const open = activeValue === item.id;\n const previousIsOpen = activeIndex === index - 1;\n const nextIsOpen = activeIndex === index + 1;\n const startsGroup = open || index === 0 || previousIsOpen;\n const endsGroup = open || index === items.length - 1 || nextIsOpen;\n const separatedFromPrevious = index > 0 && (open || previousIsOpen);\n const contentId = `${baseId}-${item.id}-content`;\n const triggerId = `${baseId}-${item.id}-trigger`;\n\n return (\n <BouncyAccordionRow\n key={item.id}\n item={item}\n open={open}\n startsGroup={startsGroup}\n endsGroup={endsGroup}\n separatedFromPrevious={separatedFromPrevious}\n contentId={contentId}\n triggerId={triggerId}\n reduce={reduce}\n classNames={classNames}\n onToggle={() => toggleItem(item.id)}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AA0CA,MAAM,iBAA6B;CACjC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,0BAAsC;CAC1C,MAAM;CACN,U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Ac,MACd,WACA,cACuB;CACvB,MAAM,SAAS,iBAAiB;CAChC,MAAM,SAAS,MAAM;CACrB,MAAM,CAAC,aAAa,kBAAkB,8BAA8B;EAClE;EACA;EACA;CACF,CAAC;CACD,MAAM,cAAc,MAAM,WAAW,SAAS,KAAK,OAAO,WAAW;CAErE,MAAM,aAAa,aAChB,OAAe;EACd,IAAI,gBAAgB,IAAI;GACtB,IAAI,aACF,eAAe,IAAI;GAErB;EACF;EAEA,eAAe,EAAE;CACnB,GACA;EAAC;EAAa;EAAa;CAAc,CAC3C;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,UAAU,WAAW,YAAY,IAAI;EACrD,UAAA,MAAM,KAAK,MAAM,UAAU;GAC1B,MAAM,OAAO,gBAAgB,KAAK;GAClC,MAAM,iBAAiB,gBAAgB,QAAQ;GAC/C,MAAM,aAAa,gBAAgB,QAAQ;GAC3C,MAAM,cAAc,QAAQ,UAAU,KAAK;GAC3C,MAAM,YAAY,QAAQ,UAAU,MAAM,SAAS,KAAK;GACxD,MAAM,wBAAwB,QAAQ,MAAM,QAAQ;GACpD,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GACvC,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GAEvC,OACE,oBAAC,oBAAD;IAEQ;IACA;IACO;IACF;IACY;IACZ;IACA;IACH;IACI;IACZ,gBAAgB,WAAW,KAAK,EAAE;GACnC,GAXM,KAAK,EAWX;EAEL,CAAC;CACE,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"bouncy-accordion.js","names":[],"sources":["../../../src/components/motion/bouncy-accordion.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useId, useLayoutEffect, useRef, useState } from \"react\";\nimport { ChevronDown } from \"lucide-react\";\nimport { motion, type Transition, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\n\nexport type BouncyAccordionItem = {\n id: string;\n title: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n disabled?: boolean;\n};\n\nexport type BouncyAccordionClassNames = {\n root?: string;\n item?: string;\n trigger?: string;\n icon?: string;\n title?: string;\n chevron?: string;\n content?: string;\n description?: string;\n};\n\nexport interface BouncyAccordionProps {\n items: BouncyAccordionItem[];\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n collapsible?: boolean;\n className?: string;\n classNames?: BouncyAccordionClassNames;\n}\n\n// Rows, cards and scale-corrected text share a transition so their edges\n// stay joined. A close or switch uses the faster non-overshooting spring;\n// opening from all-closed keeps the weighted bounce.\nconst EXPAND_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.58,\n bounce: 0.32,\n};\n\nconst COLLAPSE_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.46,\n bounce: 0,\n};\n\nconst DESCRIPTION_TRANSITION: Transition = {\n duration: 0.18,\n ease: EASE_OUT,\n};\n\nconst CHEVRON_TRANSITION: Transition = {\n type: \"spring\",\n duration: 0.42,\n bounce: 0.28,\n};\n\nfunction useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n}: {\n value?: string | null;\n defaultValue?: string | null;\n onValueChange?: (value: string | null) => void;\n}) {\n const [internalValue, setInternalValue] = useState(defaultValue ?? null);\n const isControlled = value !== undefined;\n const currentValue = isControlled ? value : internalValue;\n\n const setValue = useCallback(\n (next: string | null) => {\n if (!isControlled) {\n setInternalValue(next);\n }\n\n onValueChange?.(next);\n },\n [isControlled, onValueChange],\n );\n\n return [currentValue, setValue] as const;\n}\n\nfunction BouncyAccordionRow({\n item,\n open,\n startsGroup,\n endsGroup,\n separatedFromPrevious,\n contentId,\n triggerId,\n reduce,\n layoutTransition,\n layoutDependency,\n classNames,\n onToggle,\n}: {\n item: BouncyAccordionItem;\n open: boolean;\n startsGroup: boolean;\n endsGroup: boolean;\n separatedFromPrevious: boolean;\n contentId: string;\n triggerId: string;\n reduce: boolean | null;\n layoutTransition: Transition;\n layoutDependency: string | null;\n classNames?: BouncyAccordionClassNames;\n onToggle: () => void;\n}) {\n const contentRef = useRef<HTMLDivElement>(null);\n const [contentHeight, setContentHeight] = useState(0);\n\n useLayoutEffect(() => {\n const node = contentRef.current;\n if (!node) return;\n\n const updateHeight = () => {\n setContentHeight(node.offsetHeight);\n };\n\n updateHeight();\n\n const observer = new ResizeObserver(updateHeight);\n observer.observe(node);\n\n return () => {\n observer.disconnect();\n };\n }, []);\n\n return (\n <motion.div\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n initial={false}\n style={{ marginTop: separatedFromPrevious ? 12 : 0 }}\n transition={{ layout: layoutTransition }}\n >\n <motion.div\n data-state={open ? \"open\" : \"closed\"}\n layout={!reduce}\n layoutDependency={layoutDependency}\n initial={false}\n animate={{\n borderTopLeftRadius: startsGroup ? 28 : 0,\n borderTopRightRadius: startsGroup ? 28 : 0,\n borderBottomLeftRadius: endsGroup ? 28 : 0,\n borderBottomRightRadius: endsGroup ? 28 : 0,\n }}\n transition={reduce ? { duration: 0 } : layoutTransition}\n style={{ originY: 0 }}\n className={cn(\n \"overflow-hidden bg-card text-card-foreground\",\n item.disabled && \"opacity-50\",\n classNames?.item,\n )}\n >\n <motion.button\n id={triggerId}\n type=\"button\"\n disabled={item.disabled}\n aria-expanded={open}\n aria-controls={contentId}\n onClick={onToggle}\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n transition={{ layout: layoutTransition }}\n style={{ originY: 0 }}\n className={cn(\n \"flex min-h-[54px] w-full items-center gap-4 px-5 text-left outline-none transition-colors\",\n \"focus-visible:bg-muted/25\",\n \"disabled:pointer-events-none\",\n classNames?.trigger,\n )}\n >\n {item.icon ? (\n <span\n className={cn(\n \"grid h-7 w-7 shrink-0 place-items-center text-muted-foreground\",\n classNames?.icon,\n )}\n >\n {item.icon}\n </span>\n ) : null}\n <span\n className={cn(\n \"min-w-0 flex-1 truncate font-medium text-[15px] text-foreground\",\n classNames?.title,\n )}\n >\n {item.title}\n </span>\n <motion.span\n aria-hidden\n animate={{ rotate: open ? 180 : 0 }}\n transition={reduce ? { duration: 0 } : CHEVRON_TRANSITION}\n className={cn(\n \"grid h-6 w-6 shrink-0 place-items-center text-muted-foreground\",\n classNames?.chevron,\n )}\n >\n <ChevronDown className=\"h-4 w-4\" />\n </motion.span>\n </motion.button>\n\n <section\n id={contentId}\n aria-labelledby={triggerId}\n aria-hidden={!open}\n inert={!open}\n style={{ height: open && item.description ? contentHeight || \"auto\" : 0 }}\n className={cn(classNames?.content)}\n >\n <motion.div\n ref={contentRef}\n // The card clips this full-size layout node. Correcting only the\n // card scale avoids a one-pixel clip and its extreme text scale.\n // Size changes outside a toggle snap to their natural geometry.\n layout={reduce ? false : \"position\"}\n layoutDependency={layoutDependency}\n initial={false}\n animate={{ opacity: open ? 1 : 0 }}\n transition={{\n opacity: reduce ? { duration: 0 } : DESCRIPTION_TRANSITION,\n layout: layoutTransition,\n }}\n style={{ originY: 0 }}\n className=\"px-5 pb-5\"\n >\n <div\n className={cn(\"text-[15px] text-muted-foreground leading-6\", classNames?.description)}\n >\n {item.description}\n </div>\n </motion.div>\n </section>\n </motion.div>\n </motion.div>\n );\n}\n\nexport function BouncyAccordion({\n items,\n value,\n defaultValue = null,\n onValueChange,\n collapsible = true,\n className,\n classNames,\n}: BouncyAccordionProps) {\n const reduce = useReducedMotion();\n const baseId = useId();\n const [activeValue, setActiveValue] = useControllableAccordionValue({\n value,\n defaultValue,\n onValueChange,\n });\n const activeIndex = items.findIndex((item) => item.id === activeValue);\n const previousValue = useRef(activeValue);\n const layoutTransition =\n activeValue === null || previousValue.current !== null\n ? COLLAPSE_TRANSITION\n : EXPAND_TRANSITION;\n useLayoutEffect(() => {\n previousValue.current = activeValue;\n }, [activeValue]);\n\n const toggleItem = useCallback(\n (id: string) => {\n if (activeValue === id) {\n if (collapsible) {\n setActiveValue(null);\n }\n return;\n }\n\n setActiveValue(id);\n },\n [activeValue, collapsible, setActiveValue],\n );\n\n return (\n <div className={cn(\"w-full\", className, classNames?.root)}>\n {items.map((item, index) => {\n const open = activeValue === item.id;\n const previousIsOpen = activeIndex === index - 1;\n const nextIsOpen = activeIndex === index + 1;\n const startsGroup = open || index === 0 || previousIsOpen;\n const endsGroup = open || index === items.length - 1 || nextIsOpen;\n const separatedFromPrevious = index > 0 && (open || previousIsOpen);\n const contentId = `${baseId}-${item.id}-content`;\n const triggerId = `${baseId}-${item.id}-trigger`;\n\n return (\n <BouncyAccordionRow\n key={item.id}\n item={item}\n open={open}\n startsGroup={startsGroup}\n endsGroup={endsGroup}\n separatedFromPrevious={separatedFromPrevious}\n contentId={contentId}\n triggerId={triggerId}\n reduce={reduce}\n layoutTransition={layoutTransition}\n layoutDependency={activeValue}\n classNames={classNames}\n onToggle={() => toggleItem(item.id)}\n />\n );\n })}\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAyCA,MAAM,oBAAgC;CACpC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,sBAAkC;CACtC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,MAAM,yBAAqC;CACzC,UAAU;CACV,MAAM;AACR;AAEA,MAAM,qBAAiC;CACrC,MAAM;CACN,UAAU;CACV,QAAQ;AACV;AAEA,SAAS,8BAA8B,EACrC,OACA,cACA,iBAKC;CACD,MAAM,CAAC,eAAe,oBAAoB,SAAS,gBAAgB,IAAI;CACvE,MAAM,eAAe,UAAU,KAAA;CAc/B,OAAO,CAbc,eAAe,QAAQ,eAE3B,aACd,SAAwB;EACvB,IAAI,CAAC,cACH,iBAAiB,IAAI;EAGvB,gBAAgB,IAAI;CACtB,GACA,CAAC,cAAc,aAAa,CAGD,CAAC;AAChC;AAEA,SAAS,mBAAmB,EAC1B,MACA,MACA,aACA,WACA,uBACA,WACA,WACA,QACA,kBACA,kBACA,YACA,YAcC;CACD,MAAM,aAAa,OAAuB,IAAI;CAC9C,MAAM,CAAC,eAAe,oBAAoB,SAAS,CAAC;CAE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,eAAe,EAAE;CACnB,GACA;EAAC;EAAa;EAAa;CAAc,CAC3C;CAEA,OACE,oBAAC,OAAD;EAAK,WAAW,GAAG,UAAU,WAAW,YAAY,IAAI;EACrD,UAAA,MAAM,KAAK,MAAM,UAAU;GAC1B,MAAM,OAAO,gBAAgB,KAAK;GAClC,MAAM,iBAAiB,gBAAgB,QAAQ;GAC/C,MAAM,aAAa,gBAAgB,QAAQ;GAC3C,MAAM,cAAc,QAAQ,UAAU,KAAK;GAC3C,MAAM,YAAY,QAAQ,UAAU,MAAM,SAAS,KAAK;GACxD,MAAM,wBAAwB,QAAQ,MAAM,QAAQ;GACpD,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GACvC,MAAM,YAAY,GAAG,OAAO,GAAG,KAAK,GAAG;GAEvC,OACE,oBAAC,oBAAD;IAEQ;IACA;IACO;IACF;IACY;IACZ;IACA;IACH;IACU;IAClB,kBAAkB;IACN;IACZ,gBAAgB,WAAW,KAAK,EAAE;GACnC,GAbM,KAAK,EAaX;EAEL,CAAC;CACE,CAAA;AAET"}
|
|
@@ -5,8 +5,8 @@ import { cloneElement, createContext, isValidElement, useCallback, useContext, u
|
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
|
-
import { X } from "lucide-react";
|
|
9
8
|
import { createPortal } from "react-dom";
|
|
9
|
+
import { X } from "lucide-react";
|
|
10
10
|
//#region src/components/motion/center-morph-modal.tsx
|
|
11
11
|
const CenterMorphModalContext = createContext(null);
|
|
12
12
|
function useCenterMorphModalContext(component) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"color-picker.d.ts","names":[],"sources":["../../../src/components/motion/color-picker.tsx"],"mappings":";;;YA4CY;EAAS;EAAW;EAAW;EAAW;;;YAE1C;EAAS;EAAW;EAAW;EAAW;;wBAQtC,aAAa,GAAG,GAAG,GAAG,KAAK,OAAO;;wBAWlC,aAAa,GAAG,GAAG,GAAG,KAAK,MAAM,WAAW,OAAO;;wBAqBnD,SAAS,gBAAgB;;wBAUzB,YAAY,GAAG,GAAG,GAAG,KAAK;;wBAiD1B
|
|
1
|
+
{"version":3,"file":"color-picker.d.ts","names":[],"sources":["../../../src/components/motion/color-picker.tsx"],"mappings":";;;YA4CY;EAAS;EAAW;EAAW;EAAW;;;YAE1C;EAAS;EAAW;EAAW;EAAW;;wBAQtC,aAAa,GAAG,GAAG,GAAG,KAAK,OAAO;;wBAWlC,aAAa,GAAG,GAAG,GAAG,KAAK,MAAM,WAAW,OAAO;;wBAqBnD,SAAS,gBAAgB;;wBAUzB,YAAY,GAAG,GAAG,GAAG,KAAK;;wBAiD1B;;;;;;;EASM,WAAA;;iBASL,yBACP,KAAK;;EAEb;EACA;;EAEA,iBAAiB;;EAEjB,iBAAiB;;EAEjB;;EAEA;;EAEA;EACA;EACA,gBAAgB;;;wBAIF,cACd,OACA,cACA,eACA,eACA,OACA,UACA,MACA,MAAM,UACN,aACA,cACA,MACA,WACA,aACG,SACF,mCAAgB,IAAA;iBA+PF,6BAA6B,KAAK;;EAEjD;;wBAWc,kBACd,OACA,WACA,UACG,SACF,uCAAoB,IAAA;iBA8KN,4BAA4B,KAAK;EAChD;;wBAGc,iBAAiB,UAAkB,SAAS,sCAAmB,IAAA;iBAiB9D,8BAA8B,KAAK;EAClD;;;wBAIc,mBAAmB,UAAsB,SAAS,wCAAqB,IAAA;YAuB3E,yBAAyB,KAAK;;wBAG1B,oBAAoB,WAAW,UAAU,SAAS,yCAAsB,IAAA;iBAqCvE,iCACP,KAAK;;wBAGC,sBACd,WACA,UACA,QACA,yBACc,cACX,SACF,2CAAwB,IAAA;iBAmHV,iCAAiC,KAAK;;EAErD;;;wBAIc,sBACd,QACA,cACG,SACF,2CAAwB,IAAA;iBA8EV,mCAAmC,KAAK;EACvD,WAAW;;;wBAIG,wBACd,WACA,UACA,uBACc,cACX,SACF,6CAA0B,IAAA;YAuDjB,0BAA0B;wBAEtB,qBAAqB,WAAW,aAAa,SAAS,0CAAuB,IAAA;iBAS5E,+BACP,KAAK;;EAEb;;EAEA;;wBAGc,oBACd,OACA,OACA,WACA,YACG,SACF,yCAAsB,IAAA;iBAsDR,gCAAgC,KAAK;;EAEpD,WAAW;;;wBA+DG,qBACd,WACA,UACA,YACG,SACF,0CAAuB,IAAA;iBA4CT,gCAAgC,KAAK;;EAEpD;;;;;;;wBA6Bc,qBACd,OACA,WACA,aACG,SACF,0CAAuB,IAAA"}
|
|
@@ -9,8 +9,8 @@ import { useCallback, useEffect, useId, useMemo, useRef, useState } from "react"
|
|
|
9
9
|
import { cn } from "@kumix/utils";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
12
|
-
import { Search } from "lucide-react";
|
|
13
12
|
import { createPortal } from "react-dom";
|
|
13
|
+
import { Search } from "lucide-react";
|
|
14
14
|
//#region src/components/motion/command-palette.tsx
|
|
15
15
|
const PANEL_SPRING = {
|
|
16
16
|
type: "spring",
|
|
@@ -5,8 +5,8 @@ import { cloneElement, createContext, isValidElement, useCallback, useContext, u
|
|
|
5
5
|
import { cn } from "@kumix/utils";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
|
-
import { Check } from "lucide-react";
|
|
9
8
|
import { createPortal } from "react-dom";
|
|
9
|
+
import { Check } from "lucide-react";
|
|
10
10
|
//#region src/components/motion/context-menu.tsx
|
|
11
11
|
const VIEWPORT_PADDING = 8;
|
|
12
12
|
const LONG_PRESS_DELAY = 520;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-range-picker.d.ts","names":[],"sources":["../../../src/components/motion/date-range-picker/types.ts","../../../src/components/motion/date-range-picker.tsx"],"mappings":";;;;;UAGiB;EACf;EACA;;UAEe;EACf;EACA,OAAO;;UAEQ;EACf,QAAQ;EACR,eAAe;EACf,iBAAiB,OAAO;EACxB;EACA;EACA;EACA,kBAAkB;EAClB,UAAU;EACV;EACA;EACA;;EAEA;;EAEA;EACA;;EAEA,WAAW;EACX;EACA;EACA,gBAAgB;;EAEhB;;;;;wBCgBc
|
|
1
|
+
{"version":3,"file":"date-range-picker.d.ts","names":[],"sources":["../../../src/components/motion/date-range-picker/types.ts","../../../src/components/motion/date-range-picker.tsx"],"mappings":";;;;;UAGiB;EACf;EACA;;UAEe;EACf;EACA,OAAO;;UAEQ;EACf,QAAQ;EACR,eAAe;EACf,iBAAiB,OAAO;EACxB;EACA;EACA;EACA,kBAAkB;EAClB,UAAU;EACV;EACA;EACA;;EAEA;;EAEA;EACA;;EAEA,WAAW;EACX;EACA;EACA,gBAAgB;;EAEhB;;;;;wBCgBc;;;;;;;;;;;;;;;;;;;;;wBAyBA,kBAAkB,UAAU,cAAc,SAAS,uCAAoB,IAAA;iBAetE,qCAAqC;EACpD;;;wBAIc,0BACd,UACA,WACA,gBACG,SACF,+CAA4B,IAAA;YAqCnB,8BAA8B,KAAK;wBAC/B,yBAAyB,cAAc,SAAS,8CAA2B,IAAA;YAoC/E,6BAA6B,KAAK;wBAC9B,wBAAwB,cAAc,SAAS,6CAA0B,IAAA;YA2F7E,2BAA2B,KAAK;wBAC5B,sBACd,WACA,mBACG,SACF,2CAAwB,IAAA;YAiOf,gCAAgC;wBAC5B,2BACd,UACA,cACG,SACF,gDAA6B,IAAA;YAcpB,4BAA4B;wBACxB,uBACd,UACA,WACA,SACA,aACG,SACF,4CAAyB,IAAA;YAsBhB,6BAA6B;wBACzB,wBACd,UACA,cACG,SACF,6CAA0B,IAAA;YAkBjB,8BAA8B;wBAC1B,yBACd,UACA,cACG,SACF,8CAA2B,IAAA;iBAgBb,mCAAmC,KAAK;EACvD,OAAO;;EAEP;;wBAEc,wBACd,OACA,OACA,UACA,WACA,UACA,YACG,SACF,6CAA0B,IAAA;iBA2BZ,oCAAoC;EACnD;;wBAEc,yBACd,UACA,aACA,WACA,UACA,QACG,SACF,8CAA2B,IAAA;iBA2Eb,oCAAoC;;EAEnD;;wBAWc,yBACd,UACA,WACA,WACA,oBACG,SACF,8CAA2B,IAAA;iBAyBb,qCAAqC,KAAK;EACzD;EACA;EACA;;;wBAGc,0BACd,aACA,kBACA,mBACA,WACA,gBACG,SACF,+CAA4B,IAAA"}
|
|
@@ -10,7 +10,7 @@ export interface DrawerProps {
|
|
|
10
10
|
/** Class for the backdrop. */
|
|
11
11
|
backdropClassName?: string;
|
|
12
12
|
ariaLabel?: string;
|
|
13
|
-
/** Close when the backdrop is clicked. Default true. */
|
|
13
|
+
/** Close when the backdrop is clicked or Escape is pressed. Default true. */
|
|
14
14
|
dismissable?: boolean;
|
|
15
15
|
}
|
|
16
16
|
export declare function Drawer({ open, onOpenChange, side, children, className, backdropClassName, ariaLabel, dismissable }: DrawerProps): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.d.ts","names":[],"sources":["../../../src/components/motion/drawer.tsx"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"drawer.d.ts","names":[],"sources":["../../../src/components/motion/drawer.tsx"],"mappings":";;iBAUiB;EACf;EACA,eAAe;EACf;EACA,UAAU;;EAEV;;EAEA;EACA;;EAEA;;wBAGc,SACd,MACA,cACA,MACA,UACA,WACA,mBACA,WACA,eACC,8BAAW,IAAA"}
|
|
@@ -1,31 +1,29 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { useFocusTrap } from "../../hooks/use-focus-trap.js";
|
|
2
3
|
import { EASE_OUT, SPRING_PANEL } from "../../lib/ease.js";
|
|
3
4
|
import { t as PresenceGate } from "../../presence-gate-BekdC4Bo.js";
|
|
4
|
-
import { useEffect } from "react";
|
|
5
|
+
import { useEffect, useRef } from "react";
|
|
5
6
|
import { cn } from "@kumix/utils";
|
|
6
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
8
9
|
//#region src/components/motion/drawer.tsx
|
|
9
10
|
function Drawer({ open, onOpenChange, side = "right", children, className, backdropClassName, ariaLabel, dismissable = true }) {
|
|
10
11
|
const reduce = useReducedMotion();
|
|
12
|
+
const panelRef = useRef(null);
|
|
13
|
+
useFocusTrap(open, panelRef, { onEscape: dismissable ? () => onOpenChange(false) : void 0 });
|
|
11
14
|
useEffect(() => {
|
|
12
15
|
if (!open) return;
|
|
13
|
-
const onKey = (e) => {
|
|
14
|
-
if (e.key === "Escape") onOpenChange(false);
|
|
15
|
-
};
|
|
16
|
-
window.addEventListener("keydown", onKey);
|
|
17
16
|
const prevOverflow = document.body.style.overflow;
|
|
18
17
|
document.body.style.overflow = "hidden";
|
|
19
18
|
return () => {
|
|
20
|
-
window.removeEventListener("keydown", onKey);
|
|
21
19
|
document.body.style.overflow = prevOverflow;
|
|
22
20
|
};
|
|
23
|
-
}, [open
|
|
21
|
+
}, [open]);
|
|
24
22
|
const offscreen = side === "right" ? "100%" : "-100%";
|
|
25
23
|
return /* @__PURE__ */ jsxs(AnimatePresence, { children: [open ? /* @__PURE__ */ jsx(PresenceGate, { children: ({ gate }) => /* @__PURE__ */ jsx(motion.button, {
|
|
26
24
|
type: "button",
|
|
27
25
|
"aria-label": "Close",
|
|
28
|
-
tabIndex:
|
|
26
|
+
tabIndex: -1,
|
|
29
27
|
onClick: () => dismissable && onOpenChange(false),
|
|
30
28
|
initial: { opacity: 0 },
|
|
31
29
|
animate: { opacity: 1 },
|
|
@@ -36,7 +34,9 @@ function Drawer({ open, onOpenChange, side = "right", children, className, backd
|
|
|
36
34
|
},
|
|
37
35
|
...gate,
|
|
38
36
|
className: cn("fixed inset-0 z-50 h-full w-full cursor-default bg-black/40 backdrop-blur-sm", backdropClassName)
|
|
39
|
-
}) }, "backdrop") : null, open ? /* @__PURE__ */ jsx(PresenceGate, { children: ({ gate }) => /* @__PURE__ */ jsx(motion.
|
|
37
|
+
}) }, "backdrop") : null, open ? /* @__PURE__ */ jsx(PresenceGate, { children: ({ gate }) => /* @__PURE__ */ jsx(motion.div, {
|
|
38
|
+
ref: panelRef,
|
|
39
|
+
tabIndex: -1,
|
|
40
40
|
role: "dialog",
|
|
41
41
|
"aria-modal": "true",
|
|
42
42
|
"aria-label": ariaLabel,
|
|
@@ -48,7 +48,7 @@ function Drawer({ open, onOpenChange, side = "right", children, className, backd
|
|
|
48
48
|
ease: EASE_OUT
|
|
49
49
|
} : SPRING_PANEL,
|
|
50
50
|
...gate,
|
|
51
|
-
className: cn("fixed inset-y-0 z-50 flex w-80 max-w-[85vw] flex-col bg-background shadow-2xl", side === "right" ? "right-0 border-border border-l" : "left-0 border-border border-r", className),
|
|
51
|
+
className: cn("fixed inset-y-0 z-50 flex w-80 max-w-[85vw] flex-col bg-background shadow-2xl outline-none", side === "right" ? "right-0 border-border border-l" : "left-0 border-border border-r", className),
|
|
52
52
|
children
|
|
53
53
|
}) }, "panel") : null] });
|
|
54
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/motion/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\n\nexport interface DrawerProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n side?: \"left\" | \"right\";\n children: ReactNode;\n /** Class for the panel surface. */\n className?: string;\n /** Class for the backdrop. */\n backdropClassName?: string;\n ariaLabel?: string;\n /** Close when the backdrop is clicked. Default true. */\n dismissable?: boolean;\n}\n\nexport function Drawer({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n backdropClassName,\n ariaLabel,\n dismissable = true,\n}: DrawerProps) {\n const reduce = useReducedMotion();\n
|
|
1
|
+
{"version":3,"file":"drawer.js","names":[],"sources":["../../../src/components/motion/drawer.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useEffect, useRef } from \"react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { useFocusTrap } from \"../../hooks/use-focus-trap\";\nimport { EASE_OUT, SPRING_PANEL } from \"../../lib/ease\";\nimport { PresenceGate } from \"../../lib/presence-gate\";\n\nexport interface DrawerProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n side?: \"left\" | \"right\";\n children: ReactNode;\n /** Class for the panel surface. */\n className?: string;\n /** Class for the backdrop. */\n backdropClassName?: string;\n ariaLabel?: string;\n /** Close when the backdrop is clicked or Escape is pressed. Default true. */\n dismissable?: boolean;\n}\n\nexport function Drawer({\n open,\n onOpenChange,\n side = \"right\",\n children,\n className,\n backdropClassName,\n ariaLabel,\n dismissable = true,\n}: DrawerProps) {\n const reduce = useReducedMotion();\n const panelRef = useRef<HTMLDivElement>(null);\n\n // Focus moves into the panel on open, Tab stays inside it, and focus returns\n // to the opener on close.\n useFocusTrap(open, panelRef, {\n onEscape: dismissable ? () => onOpenChange(false) : undefined,\n });\n\n useEffect(() => {\n if (!open) return;\n const prevOverflow = document.body.style.overflow;\n document.body.style.overflow = \"hidden\";\n return () => {\n document.body.style.overflow = prevOverflow;\n };\n }, [open]);\n\n const offscreen = side === \"right\" ? \"100%\" : \"-100%\";\n\n // Two fixed siblings, no wrapper: the backdrop spans the viewport edges but\n // paints the scrim, and the panel is inset off one side and paints its own\n // surface, so neither is a transparent edge-spanning layer. Both hang off\n // `PresenceGate`, so interaction releases in the same commit that starts the\n // exit rather than when it ends.\n return (\n <AnimatePresence>\n {open ? (\n <PresenceGate key=\"backdrop\">\n {({ gate }) => (\n <motion.button\n type=\"button\"\n aria-label=\"Close\"\n // Outside the panel, so the focus trap never lands on it; it is\n // a pointer target only.\n tabIndex={-1}\n onClick={() => dismissable && onOpenChange(false)}\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n exit={{ opacity: 0 }}\n transition={{ duration: 0.25, ease: EASE_OUT }}\n {...gate}\n className={cn(\n \"fixed inset-0 z-50 h-full w-full cursor-default bg-black/40 backdrop-blur-sm\",\n backdropClassName,\n )}\n />\n )}\n </PresenceGate>\n ) : null}\n {open ? (\n <PresenceGate key=\"panel\">\n {({ gate }) => (\n <motion.div\n ref={panelRef}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={ariaLabel}\n initial={reduce ? { opacity: 0 } : { x: offscreen }}\n animate={reduce ? { opacity: 1 } : { x: 0 }}\n exit={reduce ? { opacity: 0 } : { x: offscreen }}\n transition={reduce ? { duration: 0.2, ease: EASE_OUT } : SPRING_PANEL}\n {...gate}\n className={cn(\n \"fixed inset-y-0 z-50 flex w-80 max-w-[85vw] flex-col bg-background shadow-2xl outline-none\",\n side === \"right\"\n ? \"right-0 border-border border-l\"\n : \"left-0 border-border border-r\",\n className,\n )}\n >\n {children}\n </motion.div>\n )}\n </PresenceGate>\n ) : null}\n </AnimatePresence>\n );\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAgB,OAAO,EACrB,MACA,cACA,OAAO,SACP,UACA,WACA,mBACA,WACA,cAAc,QACA;CACd,MAAM,SAAS,iBAAiB;CAChC,MAAM,WAAW,OAAuB,IAAI;CAI5C,aAAa,MAAM,UAAU,EAC3B,UAAU,oBAAoB,aAAa,KAAK,IAAI,KAAA,EACtD,CAAC;CAED,gBAAgB;EACd,IAAI,CAAC,MAAM;EACX,MAAM,eAAe,SAAS,KAAK,MAAM;EACzC,SAAS,KAAK,MAAM,WAAW;EAC/B,aAAa;GACX,SAAS,KAAK,MAAM,WAAW;EACjC;CACF,GAAG,CAAC,IAAI,CAAC;CAET,MAAM,YAAY,SAAS,UAAU,SAAS;CAO9C,OACE,qBAAC,iBAAD,EAAA,UAAA,CACG,OACC,oBAAC,cAAD,EAAA,WACI,EAAE,WACF,oBAAC,OAAO,QAAR;EACE,MAAK;EACL,cAAW;EAGX,UAAU;EACV,eAAe,eAAe,aAAa,KAAK;EAChD,SAAS,EAAE,SAAS,EAAE;EACtB,SAAS,EAAE,SAAS,EAAE;EACtB,MAAM,EAAE,SAAS,EAAE;EACnB,YAAY;GAAE,UAAU;GAAM,MAAM;EAAS;EAC7C,GAAI;EACJ,WAAW,GACT,gFACA,iBACF;CACD,CAAA,EAES,GApBI,UAoBJ,IACZ,MACH,OACC,oBAAC,cAAD,EAAA,WACI,EAAE,WACF,oBAAC,OAAO,KAAR;EACE,KAAK;EACL,UAAU;EACV,MAAK;EACL,cAAW;EACX,cAAY;EACZ,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAU;EAClD,SAAS,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,EAAE;EAC1C,MAAM,SAAS,EAAE,SAAS,EAAE,IAAI,EAAE,GAAG,UAAU;EAC/C,YAAY,SAAS;GAAE,UAAU;GAAK,MAAM;EAAS,IAAI;EACzD,GAAI;EACJ,WAAW,GACT,8FACA,SAAS,UACL,mCACA,iCACJ,SACF;EAEC;CACS,CAAA,EAEF,GAxBI,OAwBJ,IACZ,IACW,EAAA,CAAA;AAErB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expandable-action-bar.d.ts","names":[],"sources":["../../../src/components/motion/expandable-action-bar.tsx"],"mappings":";;YAqBY;YAEA;EACV;EACA,OAAO;EACP,MAAM;EACN;EACA;EACA;EACA,QAAQ;EACR,WAAW;;YAGD;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,oBAAoB;EACpB;EACA,YAAY,MAAM;EAClB,OAAO;;;;;;;EAOP;EACA;EACA;EACA;EACA,aAAa;EACb,cACE,MAAM,yBACN;IAAS;IAAmB;QACzB;;wBAwDS,sBACd,OACA,UACA,iBACA,kBACA,UACA,UACA,MACA,eACA,eACA,eACA,WACA,YACA,cACC,2CAAwB,IAAA;wBAyQX,uBAAuB,OAAO
|
|
1
|
+
{"version":3,"file":"expandable-action-bar.d.ts","names":[],"sources":["../../../src/components/motion/expandable-action-bar.tsx"],"mappings":";;YAqBY;YAEA;EACV;EACA,OAAO;EACP,MAAM;EACN;EACA;EACA;EACA,QAAQ;EACR,WAAW;;YAGD;EACV;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;iBAGe;EACf,OAAO;EACP;EACA;EACA,oBAAoB;EACpB;EACA,YAAY,MAAM;EAClB,OAAO;;;;;;;EAOP;EACA;EACA;EACA;EACA,aAAa;EACb,cACE,MAAM,yBACN;IAAS;IAAmB;QACzB;;wBAwDS,sBACd,OACA,UACA,iBACA,kBACA,UACA,UACA,MACA,eACA,eACA,eACA,WACA,YACA,cACC,2CAAwB,IAAA;wBAyQX,uBAAuB,OAAO"}
|
|
@@ -3,7 +3,7 @@ import { EASE_OUT } from "../../lib/ease.js";
|
|
|
3
3
|
import { Button } from "./button/base.js";
|
|
4
4
|
import { StatefulButton } from "./button/stateful.js";
|
|
5
5
|
import "./button/index.js";
|
|
6
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
6
|
+
import { useCallback, useEffect, useId, useRef, useState } from "react";
|
|
7
7
|
import { cn } from "@kumix/utils";
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { AnimatePresence, motion, useReducedMotion } from "motion/react";
|
|
@@ -40,6 +40,7 @@ function FeedbackWidget({ onSubmit, position = "bottom-right", title = "Help us
|
|
|
40
40
|
const reduce = useReducedMotion();
|
|
41
41
|
const rootRef = useRef(null);
|
|
42
42
|
const textareaRef = useRef(null);
|
|
43
|
+
const titleId = useId();
|
|
43
44
|
const closeTimerRef = useRef(null);
|
|
44
45
|
const [status, setStatus] = useState("idle");
|
|
45
46
|
const [message, setMessage] = useState("");
|
|
@@ -319,6 +320,7 @@ function FeedbackWidget({ onSubmit, position = "bottom-right", title = "Help us
|
|
|
319
320
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
320
321
|
className: "flex items-start justify-between gap-3",
|
|
321
322
|
children: [/* @__PURE__ */ jsx("h3", {
|
|
323
|
+
id: titleId,
|
|
322
324
|
className: "font-semibold text-foreground text-sm",
|
|
323
325
|
children: title
|
|
324
326
|
}), /* @__PURE__ */ jsx("button", {
|
|
@@ -330,6 +332,7 @@ function FeedbackWidget({ onSubmit, position = "bottom-right", title = "Help us
|
|
|
330
332
|
})]
|
|
331
333
|
}), /* @__PURE__ */ jsx("textarea", {
|
|
332
334
|
ref: textareaRef,
|
|
335
|
+
"aria-labelledby": titleId,
|
|
333
336
|
value: message,
|
|
334
337
|
onChange: (e) => setMessage(e.target.value),
|
|
335
338
|
placeholder,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-widget.js","names":[],"sources":["../../../src/components/motion/feedback-widget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useRef, useState } from \"react\";\nimport { AlertCircle, MessageSquare, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { Button, StatefulButton } from \"./button\";\n\ntype Status = \"idle\" | \"open\" | \"sending\" | \"sent\" | \"error\";\n\nconst SUCCESS_DURATION_MS = 1600;\n\n// The trigger grows into the panel with a slight overshoot on open, then uses\n// a calmer curve on close so dismissing feels faster and less prominent.\nconst MORPH_OPEN_EASE = [0.34, 1.25, 0.64, 1] as const;\nconst MORPH_CLOSE_EASE = [0.22, 1, 0.36, 1] as const;\nconst MORPH_OPEN_DURATION = 0.4;\nconst MORPH_CLOSE_DURATION = 0.28;\nconst MORPH_FADE_DURATION = 0.22;\nconst MORPH_SLIDE = 40;\nconst MORPH_SCALE = 0.97;\nconst MORPH_BLUR = \"blur(2px)\";\n\n// Celebration sprinkles that burst from the success icon.\nconst SPRINKLES = Array.from({ length: 8 }, (_, i) => {\n const angle = (i / 8) * Math.PI * 2;\n return {\n x: Math.cos(angle) * 26,\n y: Math.sin(angle) * 26,\n color: i % 2 === 0 ? \"var(--color-success)\" : \"var(--accent)\",\n };\n});\n\nexport interface FeedbackData {\n message: string;\n}\n\nexport interface FeedbackWidgetProps {\n /** Called on submit. May be async; the button shows a sending state until it resolves. */\n onSubmit?: (data: FeedbackData) => void | Promise<void>;\n position?: \"bottom-right\" | \"bottom-left\";\n title?: string;\n placeholder?: string;\n icon?: ReactNode;\n className?: string;\n}\n\nexport function FeedbackWidget({\n onSubmit,\n position = \"bottom-right\",\n title = \"Help us improve\",\n placeholder = \"Share an idea or report a bug\",\n icon,\n className,\n}: FeedbackWidgetProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const [status, setStatus] = useState<Status>(\"idle\");\n const [message, setMessage] = useState(\"\");\n\n const open = status !== \"idle\";\n const busy = status === \"sending\";\n\n const clearCloseTimer = useCallback(() => {\n if (closeTimerRef.current === null) return;\n clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }, []);\n\n const close = useCallback(() => {\n clearCloseTimer();\n setStatus(\"idle\");\n setMessage(\"\");\n }, [clearCloseTimer]);\n\n useEffect(\n () => () => {\n if (closeTimerRef.current !== null) {\n clearTimeout(closeTimerRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (status !== \"open\") return;\n\n // Match the wallet account switcher's staged interaction: focusing while\n // the surface is still expanding makes the caret and focus state appear\n // inside a scaled panel. Arm the field once the open morph has settled.\n const timer = window.setTimeout(\n () => textareaRef.current?.focus(),\n reduce ? 0 : MORPH_OPEN_DURATION * 1000,\n );\n return () => window.clearTimeout(timer);\n }, [status, reduce]);\n\n // Dismiss on escape or outside click while open (but not mid-send).\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && !busy) close();\n };\n const onPointer = (e: PointerEvent) => {\n if (!busy && rootRef.current && !rootRef.current.contains(e.target as Node)) {\n close();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, busy, close]);\n\n const scheduleSuccessClose = () => {\n clearCloseTimer();\n closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);\n };\n\n const submit = async () => {\n if (busy || message.trim().length === 0) return;\n setStatus(\"sending\");\n try {\n await onSubmit?.({ message });\n setStatus(\"sent\");\n scheduleSuccessClose();\n } catch {\n // Preserve the message so a rejected submission can be retried.\n setStatus(\"error\");\n }\n };\n\n const left = position === \"bottom-left\";\n const contentOffset = left ? -MORPH_SLIDE : MORPH_SLIDE;\n const surfaceTransition = reduce\n ? { duration: 0 }\n : {\n layout: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n borderRadius: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n };\n const contentTransition = reduce\n ? { duration: 0 }\n : {\n opacity: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n x: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n scale: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n filter: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n rotate: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n };\n const viewInitial = reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(4px)\" };\n const viewAnimate = reduce\n ? {\n opacity: 1,\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n : {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.24, ease: EASE_OUT },\n };\n const viewExit = reduce\n ? {\n opacity: 0,\n transition: { duration: 0.14, ease: EASE_OUT },\n }\n : {\n opacity: 0,\n y: -8,\n filter: \"blur(4px)\",\n transition: { duration: 0.16, ease: EASE_OUT },\n };\n\n return (\n <div\n ref={rootRef}\n className={cn(\n \"pointer-events-none absolute bottom-4 z-30\",\n left ? \"left-4\" : \"right-4\",\n className,\n )}\n >\n {/* One persistent shell grows out of the corner trigger. The shell and\n its contents use separate timing so the surface leads the reveal. */}\n <motion.div\n layout\n animate={{ borderRadius: open ? 20 : 40 }}\n transition={surfaceTransition}\n style={{ transformOrigin: left ? \"bottom left\" : \"bottom right\" }}\n className={cn(\n \"pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg\",\n open ? \"w-[min(86vw,320px)] p-2\" : \"h-12 w-12 p-0\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n >\n <motion.div layout=\"position\">\n <AnimatePresence mode=\"popLayout\" initial={false} propagate>\n {status === \"sent\" ? (\n <motion.div\n key=\"sent\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center\">\n <div className=\"relative mb-1 flex h-12 w-12 items-center justify-center\">\n {reduce\n ? null\n : SPRINKLES.map((s, i) => (\n <motion.span\n key={`${s.x}-${s.y}`}\n initial={{ opacity: 0, scale: 0.4, x: 0, y: 0 }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, 1, 0.4],\n x: s.x,\n y: s.y,\n }}\n transition={{\n duration: 0.6,\n delay: 0.18 + i * 0.02,\n ease: \"easeOut\",\n }}\n style={{ backgroundColor: s.color }}\n className=\"absolute h-1.5 w-1.5 rounded-full\"\n />\n ))}\n <motion.div\n initial={reduce ? { scale: 1 } : { scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 22,\n delay: 0.04,\n }}\n className=\"flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)\"\n >\n <motion.svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n className=\"h-5 w-5 text-white\"\n >\n <motion.path\n d=\"M5 12.5l4.5 4.5L19 7.5\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{\n duration: 0.35,\n ease: \"easeOut\",\n delay: 0.15,\n }}\n />\n </motion.svg>\n </motion.div>\n </div>\n <h3 className=\"font-semibold text-foreground text-sm\">Thanks!</h3>\n <p className=\"text-muted-foreground text-xs leading-relaxed\">\n Your feedback helps us build something better.\n </p>\n </div>\n </motion.div>\n ) : status === \"error\" ? (\n <motion.div\n key=\"error\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div\n role=\"alert\"\n className=\"rounded-[20px] bg-border/60 px-4 py-5 text-center\"\n >\n <div className=\"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive\">\n <AlertCircle className=\"h-5 w-5\" />\n </div>\n <h3 className=\"mt-3 font-semibold text-foreground text-sm\">\n Something went wrong\n </h3>\n <p className=\"mt-1 text-muted-foreground text-xs leading-relaxed\">\n We couldn't send your feedback. Please try again.\n </p>\n <Button size=\"sm\" onClick={submit} className=\"mt-4\">\n Try again\n </Button>\n </div>\n </motion.div>\n ) : (\n <motion.div\n key=\"form\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3 className=\"font-semibold text-foreground text-sm\">{title}</h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </div>\n <textarea\n ref={textareaRef}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={placeholder}\n disabled={busy}\n rows={3}\n className=\"mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm\"\n />\n </div>\n\n <div className=\"flex items-center gap-2 px-1 pt-2 pb-1\">\n <Button\n variant=\"secondary\"\n size=\"md\"\n onClick={close}\n disabled={busy}\n className=\"flex-1 bg-border text-muted-foreground hover:text-foreground\"\n >\n Cancel\n </Button>\n <StatefulButton\n state={busy ? \"loading\" : \"idle\"}\n loadingText=\"Sending\"\n size=\"md\"\n onClick={submit}\n disabled={busy || message.trim().length === 0}\n className=\"flex-1 bg-foreground text-background hover:bg-foreground/90\"\n >\n Submit\n </StatefulButton>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n onClick={() => {\n clearCloseTimer();\n setStatus(\"open\");\n }}\n aria-label={title}\n aria-haspopup=\"dialog\"\n whileTap={reduce ? undefined : { scale: 0.92 }}\n className={cn(\n \"absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <motion.span\n initial={reduce ? false : { rotate: 45, scale: MORPH_SCALE }}\n animate={{ rotate: 0, scale: 1 }}\n exit={{ rotate: 45, scale: MORPH_SCALE }}\n transition={contentTransition}\n className=\"grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full\"\n >\n {icon ?? <MessageSquare className=\"h-5 w-5\" />}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </motion.div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,sBAAsB;AAI5B,MAAM,kBAAkB;CAAC;CAAM;CAAM;CAAM;AAAC;AAC5C,MAAM,mBAAmB;CAAC;CAAM;CAAG;CAAM;AAAC;AAC1C,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,aAAa;AAGnB,MAAM,YAAY,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;CACpD,MAAM,QAAS,IAAI,IAAK,KAAK,KAAK;CAClC,OAAO;EACL,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,OAAO,IAAI,MAAM,IAAI,yBAAyB;CAChD;AACF,CAAC;AAgBD,SAAgB,eAAe,EAC7B,UACA,WAAW,gBACX,QAAQ,mBACR,cAAc,iCACd,MACA,aACsB;CACtB,MAAM,SAAS,iBAAiB;CAChC,MAAM,UAAU,OAAuB,IAAI;CAC3C,MAAM,cAAc,OAA4B,IAAI;CACpD,MAAM,gBAAgB,OAA6C,IAAI;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AE;MAC/B,MAAM;OAAE,QAAQ;OAAI,OAAO;MAAY;MACvC,YAAY;MACZ,WAAU;MAET,UAAA,QAAQ,oBAAC,eAAD,EAAe,WAAU,UAAW,CAAA;KAClC,CAAA;IACA,GA3CT,SA2CS;GAEF,CAAA;EACP,CAAA;CACT,CAAA;AAET"}
|
|
1
|
+
{"version":3,"file":"feedback-widget.js","names":[],"sources":["../../../src/components/motion/feedback-widget.tsx"],"sourcesContent":["\"use client\";\n\nimport { type ReactNode, useCallback, useEffect, useId, useRef, useState } from \"react\";\nimport { AlertCircle, MessageSquare, X } from \"lucide-react\";\nimport { AnimatePresence, motion, useReducedMotion } from \"motion/react\";\n\nimport { cn } from \"@kumix/utils\";\nimport { EASE_OUT } from \"../../lib/ease\";\nimport { Button, StatefulButton } from \"./button\";\n\ntype Status = \"idle\" | \"open\" | \"sending\" | \"sent\" | \"error\";\n\nconst SUCCESS_DURATION_MS = 1600;\n\n// The trigger grows into the panel with a slight overshoot on open, then uses\n// a calmer curve on close so dismissing feels faster and less prominent.\nconst MORPH_OPEN_EASE = [0.34, 1.25, 0.64, 1] as const;\nconst MORPH_CLOSE_EASE = [0.22, 1, 0.36, 1] as const;\nconst MORPH_OPEN_DURATION = 0.4;\nconst MORPH_CLOSE_DURATION = 0.28;\nconst MORPH_FADE_DURATION = 0.22;\nconst MORPH_SLIDE = 40;\nconst MORPH_SCALE = 0.97;\nconst MORPH_BLUR = \"blur(2px)\";\n\n// Celebration sprinkles that burst from the success icon.\nconst SPRINKLES = Array.from({ length: 8 }, (_, i) => {\n const angle = (i / 8) * Math.PI * 2;\n return {\n x: Math.cos(angle) * 26,\n y: Math.sin(angle) * 26,\n color: i % 2 === 0 ? \"var(--color-success)\" : \"var(--accent)\",\n };\n});\n\nexport interface FeedbackData {\n message: string;\n}\n\nexport interface FeedbackWidgetProps {\n /** Called on submit. May be async; the button shows a sending state until it resolves. */\n onSubmit?: (data: FeedbackData) => void | Promise<void>;\n position?: \"bottom-right\" | \"bottom-left\";\n title?: string;\n placeholder?: string;\n icon?: ReactNode;\n className?: string;\n}\n\nexport function FeedbackWidget({\n onSubmit,\n position = \"bottom-right\",\n title = \"Help us improve\",\n placeholder = \"Share an idea or report a bug\",\n icon,\n className,\n}: FeedbackWidgetProps) {\n const reduce = useReducedMotion();\n const rootRef = useRef<HTMLDivElement>(null);\n const textareaRef = useRef<HTMLTextAreaElement>(null);\n const titleId = useId();\n const closeTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n\n const [status, setStatus] = useState<Status>(\"idle\");\n const [message, setMessage] = useState(\"\");\n\n const open = status !== \"idle\";\n const busy = status === \"sending\";\n\n const clearCloseTimer = useCallback(() => {\n if (closeTimerRef.current === null) return;\n clearTimeout(closeTimerRef.current);\n closeTimerRef.current = null;\n }, []);\n\n const close = useCallback(() => {\n clearCloseTimer();\n setStatus(\"idle\");\n setMessage(\"\");\n }, [clearCloseTimer]);\n\n useEffect(\n () => () => {\n if (closeTimerRef.current !== null) {\n clearTimeout(closeTimerRef.current);\n }\n },\n [],\n );\n\n useEffect(() => {\n if (status !== \"open\") return;\n\n // Match the wallet account switcher's staged interaction: focusing while\n // the surface is still expanding makes the caret and focus state appear\n // inside a scaled panel. Arm the field once the open morph has settled.\n const timer = window.setTimeout(\n () => textareaRef.current?.focus(),\n reduce ? 0 : MORPH_OPEN_DURATION * 1000,\n );\n return () => window.clearTimeout(timer);\n }, [status, reduce]);\n\n // Dismiss on escape or outside click while open (but not mid-send).\n useEffect(() => {\n if (!open) return;\n const onKey = (e: KeyboardEvent) => {\n if (e.key === \"Escape\" && !busy) close();\n };\n const onPointer = (e: PointerEvent) => {\n if (!busy && rootRef.current && !rootRef.current.contains(e.target as Node)) {\n close();\n }\n };\n window.addEventListener(\"keydown\", onKey);\n window.addEventListener(\"pointerdown\", onPointer);\n return () => {\n window.removeEventListener(\"keydown\", onKey);\n window.removeEventListener(\"pointerdown\", onPointer);\n };\n }, [open, busy, close]);\n\n const scheduleSuccessClose = () => {\n clearCloseTimer();\n closeTimerRef.current = setTimeout(close, SUCCESS_DURATION_MS);\n };\n\n const submit = async () => {\n if (busy || message.trim().length === 0) return;\n setStatus(\"sending\");\n try {\n await onSubmit?.({ message });\n setStatus(\"sent\");\n scheduleSuccessClose();\n } catch {\n // Preserve the message so a rejected submission can be retried.\n setStatus(\"error\");\n }\n };\n\n const left = position === \"bottom-left\";\n const contentOffset = left ? -MORPH_SLIDE : MORPH_SLIDE;\n const surfaceTransition = reduce\n ? { duration: 0 }\n : {\n layout: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n borderRadius: {\n duration: open ? MORPH_OPEN_DURATION : MORPH_CLOSE_DURATION,\n ease: open ? MORPH_OPEN_EASE : MORPH_CLOSE_EASE,\n },\n };\n const contentTransition = reduce\n ? { duration: 0 }\n : {\n opacity: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n x: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n scale: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n filter: {\n duration: MORPH_FADE_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n rotate: {\n duration: MORPH_OPEN_DURATION,\n ease: MORPH_CLOSE_EASE,\n },\n };\n const viewInitial = reduce ? { opacity: 0 } : { opacity: 0, y: 8, filter: \"blur(4px)\" };\n const viewAnimate = reduce\n ? {\n opacity: 1,\n transition: { duration: 0.18, ease: EASE_OUT },\n }\n : {\n opacity: 1,\n y: 0,\n filter: \"blur(0px)\",\n transition: { duration: 0.24, ease: EASE_OUT },\n };\n const viewExit = reduce\n ? {\n opacity: 0,\n transition: { duration: 0.14, ease: EASE_OUT },\n }\n : {\n opacity: 0,\n y: -8,\n filter: \"blur(4px)\",\n transition: { duration: 0.16, ease: EASE_OUT },\n };\n\n return (\n <div\n ref={rootRef}\n className={cn(\n \"pointer-events-none absolute bottom-4 z-30\",\n left ? \"left-4\" : \"right-4\",\n className,\n )}\n >\n {/* One persistent shell grows out of the corner trigger. The shell and\n its contents use separate timing so the surface leads the reveal. */}\n <motion.div\n layout\n animate={{ borderRadius: open ? 20 : 40 }}\n transition={surfaceTransition}\n style={{ transformOrigin: left ? \"bottom left\" : \"bottom right\" }}\n className={cn(\n \"pointer-events-auto absolute bottom-0 overflow-hidden border border-border bg-background text-foreground shadow-lg\",\n open ? \"w-[min(86vw,320px)] p-2\" : \"h-12 w-12 p-0\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <AnimatePresence initial={false} mode=\"popLayout\">\n {open ? (\n <motion.div\n key=\"panel\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, scale: 1, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: contentOffset,\n scale: MORPH_SCALE,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n >\n <motion.div layout=\"position\">\n <AnimatePresence mode=\"popLayout\" initial={false} propagate>\n {status === \"sent\" ? (\n <motion.div\n key=\"sent\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"flex flex-col items-center justify-center gap-1.5 rounded-[20px] bg-border/60 px-4 py-6 text-center\">\n <div className=\"relative mb-1 flex h-12 w-12 items-center justify-center\">\n {reduce\n ? null\n : SPRINKLES.map((s, i) => (\n <motion.span\n key={`${s.x}-${s.y}`}\n initial={{ opacity: 0, scale: 0.4, x: 0, y: 0 }}\n animate={{\n opacity: [0, 1, 0],\n scale: [0, 1, 0.4],\n x: s.x,\n y: s.y,\n }}\n transition={{\n duration: 0.6,\n delay: 0.18 + i * 0.02,\n ease: \"easeOut\",\n }}\n style={{ backgroundColor: s.color }}\n className=\"absolute h-1.5 w-1.5 rounded-full\"\n />\n ))}\n <motion.div\n initial={reduce ? { scale: 1 } : { scale: 0 }}\n animate={{ scale: 1 }}\n transition={{\n type: \"spring\",\n stiffness: 500,\n damping: 22,\n delay: 0.04,\n }}\n className=\"flex h-12 w-12 items-center justify-center rounded-full bg-(--color-success)\"\n >\n <motion.svg\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n className=\"h-5 w-5 text-white\"\n >\n <motion.path\n d=\"M5 12.5l4.5 4.5L19 7.5\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n initial={reduce ? { pathLength: 1 } : { pathLength: 0 }}\n animate={{ pathLength: 1 }}\n transition={{\n duration: 0.35,\n ease: \"easeOut\",\n delay: 0.15,\n }}\n />\n </motion.svg>\n </motion.div>\n </div>\n <h3 className=\"font-semibold text-foreground text-sm\">Thanks!</h3>\n <p className=\"text-muted-foreground text-xs leading-relaxed\">\n Your feedback helps us build something better.\n </p>\n </div>\n </motion.div>\n ) : status === \"error\" ? (\n <motion.div\n key=\"error\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div\n role=\"alert\"\n className=\"rounded-[20px] bg-border/60 px-4 py-5 text-center\"\n >\n <div className=\"mx-auto flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10 text-destructive\">\n <AlertCircle className=\"h-5 w-5\" />\n </div>\n <h3 className=\"mt-3 font-semibold text-foreground text-sm\">\n Something went wrong\n </h3>\n <p className=\"mt-1 text-muted-foreground text-xs leading-relaxed\">\n We couldn't send your feedback. Please try again.\n </p>\n <Button size=\"sm\" onClick={submit} className=\"mt-4\">\n Try again\n </Button>\n </div>\n </motion.div>\n ) : (\n <motion.div\n key=\"form\"\n initial={viewInitial}\n animate={viewAnimate}\n exit={viewExit}\n >\n <div className=\"min-h-[150px] rounded-[20px] bg-border/60 px-4 py-3.5\">\n <div className=\"flex items-start justify-between gap-3\">\n <h3 id={titleId} className=\"font-semibold text-foreground text-sm\">\n {title}\n </h3>\n <button\n type=\"button\"\n onClick={close}\n aria-label=\"Close\"\n className=\"flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-foreground/[0.07] text-muted-foreground transition-colors hover:text-foreground\"\n >\n <X className=\"h-3 w-3\" />\n </button>\n </div>\n <textarea\n ref={textareaRef}\n aria-labelledby={titleId}\n value={message}\n onChange={(e) => setMessage(e.target.value)}\n placeholder={placeholder}\n disabled={busy}\n rows={3}\n className=\"mt-2 w-full resize-none bg-transparent text-base text-foreground outline-none placeholder:text-muted-foreground/60 md:text-sm\"\n />\n </div>\n\n <div className=\"flex items-center gap-2 px-1 pt-2 pb-1\">\n <Button\n variant=\"secondary\"\n size=\"md\"\n onClick={close}\n disabled={busy}\n className=\"flex-1 bg-border text-muted-foreground hover:text-foreground\"\n >\n Cancel\n </Button>\n <StatefulButton\n state={busy ? \"loading\" : \"idle\"}\n loadingText=\"Sending\"\n size=\"md\"\n onClick={submit}\n disabled={busy || message.trim().length === 0}\n className=\"flex-1 bg-foreground text-background hover:bg-foreground/90\"\n >\n Submit\n </StatefulButton>\n </div>\n </motion.div>\n )}\n </AnimatePresence>\n </motion.div>\n </motion.div>\n ) : (\n <motion.button\n key=\"trigger\"\n type=\"button\"\n initial={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n animate={{ opacity: 1, x: 0, filter: \"blur(0px)\" }}\n exit={\n reduce\n ? { opacity: 0 }\n : {\n opacity: 0,\n x: -contentOffset,\n filter: MORPH_BLUR,\n }\n }\n transition={contentTransition}\n onClick={() => {\n clearCloseTimer();\n setStatus(\"open\");\n }}\n aria-label={title}\n aria-haspopup=\"dialog\"\n whileTap={reduce ? undefined : { scale: 0.92 }}\n className={cn(\n \"absolute bottom-0 flex h-12 w-12 items-center justify-center bg-transparent text-foreground\",\n left ? \"left-0\" : \"right-0\",\n )}\n >\n <motion.span\n initial={reduce ? false : { rotate: 45, scale: MORPH_SCALE }}\n animate={{ rotate: 0, scale: 1 }}\n exit={{ rotate: 45, scale: MORPH_SCALE }}\n transition={contentTransition}\n className=\"grid h-5 w-5 shrink-0 place-items-center [&>svg]:h-full [&>svg]:w-full\"\n >\n {icon ?? <MessageSquare className=\"h-5 w-5\" />}\n </motion.span>\n </motion.button>\n )}\n </AnimatePresence>\n </motion.div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AAYA,MAAM,sBAAsB;AAI5B,MAAM,kBAAkB;CAAC;CAAM;CAAM;CAAM;AAAC;AAC5C,MAAM,mBAAmB;CAAC;CAAM;CAAG;CAAM;AAAC;AAC1C,MAAM,sBAAsB;AAC5B,MAAM,uBAAuB;AAC7B,MAAM,sBAAsB;AAC5B,MAAM,cAAc;AACpB,MAAM,cAAc;AACpB,MAAM,aAAa;AAGnB,MAAM,YAAY,MAAM,KAAK,EAAE,QAAQ,EAAE,IAAI,GAAG,MAAM;CACpD,MAAM,QAAS,IAAI,IAAK,KAAK,KAAK;CAClC,OAAO;EACL,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,GAAG,KAAK,IAAI,KAAK,IAAI;EACrB,OAAO,IAAI,MAAM,IAAI,yBAAyB;CAChD;AACF,CAAC;AAgBD,SAAgB,eAAe,EAC7B,UACA,WAAW,gBACX,QAAQ,mBACR,cAAc,iCACd,MACA,aACsB;CACtB,MAAM,SAAS,iBAAiB;CAChC,MAAM,UAAU,OAAuB,IAAI;CAC3C,MAAM,cAAc,OAA4B,IAAI;CACpD,MAAM,UAAU,MAAM;CACtB,MAAM,gBAAgB,OAA6C,IAAI;CAEvE,MAAM,CAAC,QAAQ,aAAa,SAAiB,MAAM;CACnD,MAAM,CAAC,SAAS,cAAc,SAAS,EAAE;CAEzC,MAAM,OAAO,WAAW;CACxB,MAAM,OAAO,WAAW;CAExB,MAAM,kBAAkB,kBAAkB;EACxC,IAAI,cAAc,YAAY,MAAM;EACpC,aAAa,cAAc,OAAO;EAClC,cAAc,UAAU;CAC1B,GAAG,C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
-
{"version":3,"file":"morphing-lightbox.d.ts","names":[],"sources":["../../../src/components/motion/morphing-lightbox.tsx"],"mappings":";;;iBA+BiB;EACf;EACA;EACA;;EAEA;EACA;EACA;;iBAGe;EACf,QAAQ;EACR;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA,iBAAiB,OAAO,kBAAkB;;EAE1C,WAAW;;YAkCD,mBAAmB;YACnB,mBAAmB;;wBAuBf
|
|
1
|
+
{"version":3,"file":"morphing-lightbox.d.ts","names":[],"sources":["../../../src/components/motion/morphing-lightbox.tsx"],"mappings":";;;iBA+BiB;EACf;EACA;EACA;;EAEA;EACA;EACA;;iBAGe;EACf,QAAQ;EACR;EACA;EACA,iBAAiB;EACjB;EACA;EACA;EACA,iBAAiB,OAAO,kBAAkB;;EAE1C,WAAW;;YAkCD,mBAAmB;YACnB,mBAAmB;;wBAuBf;;;;;;;EAZD,SAAA;;;;;;wBA6BC,cACd,QACA,OAAO,iBACP,cACA,eACA,OACA,WACA,oBACA,eACA,YACC,mCAAgB,IAAA;wBAqEH,qBAAqB,cAAc,SAAS,mDAAgC,IAAA;iBAW3E,kCAAkC,KAAK;EACtD;EACA;EACA,WAAW;;;wBAIG,uBACd,SACA,WACA,gBACA,UACA,SACA,aACG,SACF,4CAAyB,IAAA;wBAuCZ,qBAAqB,cAAc,SAAS,gDAA6B,IAAA;wBASzE,qBACd,WACA,aACG,SACF,+CAA4B,IAAA;KAc1B,oBAAoB;wBA0CT,iBAAiB,OAAO,oCAAiB,IAAA;wBAGzC,oBAAoB,OAAO,oCAAiB,IAAA;wBAG5C,gBAAgB,OAAO,oCAAiB,IAAA;iBAIvC;EACf;;EAEA,SAAS;;EAET,WAAW;;;wBAIG,qBAAqB,WAAW,QAAQ,YAAY,0CAAuB"}
|
|
@@ -6,8 +6,8 @@ import { createContext, useContext, useEffect, useId, useLayoutEffect, useRef, u
|
|
|
6
6
|
import { cn } from "@kumix/utils";
|
|
7
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { AnimatePresence, LayoutGroup, motion, useIsPresent, useMotionValue, useReducedMotion } from "motion/react";
|
|
9
|
-
import { ChevronLeft, ChevronRight, Minus, Plus, X } from "lucide-react";
|
|
10
9
|
import { createPortal } from "react-dom";
|
|
10
|
+
import { ChevronLeft, ChevronRight, Minus, Plus, X } from "lucide-react";
|
|
11
11
|
//#region src/components/motion/morphing-lightbox.tsx
|
|
12
12
|
const IMAGE_SLIDE_TRANSITION = {
|
|
13
13
|
type: "tween",
|