@exegia/corpora-ui 0.23.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exegia/corpora-ui",
3
- "version": "0.23.0",
3
+ "version": "0.25.0",
4
4
  "description": "shadcn-ready React UI library for the corpora manuscript-research apps.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -82,7 +82,6 @@ export function ScaffoldPanel({
82
82
  // floor would overflow it.
83
83
  minWidth: id !== undefined ? SCAFFOLD_PANEL_MIN_WIDTH : 0,
84
84
  scaleX: 1,
85
- flexDirection: isSwapped ? "column-reverse" : "column",
86
85
  // The hovered tab's panel keeps full opacity; the rest fade back
87
86
  // so the tab↔panel pairing reads at a glance. Inline (not a
88
87
  // class) because motion owns this element's opacity.
@@ -93,10 +92,15 @@ export function ScaffoldPanel({
93
92
  style={{ originX: 0.5 }}
94
93
  aria-label={name}
95
94
  className={cn(
96
- "group/panel relative flex min-w-0 flex-1 flex-col w-full",
95
+ "group/panel relative flex w-full min-w-0 flex-1",
96
+ // Swap flips the direction as a class, NOT an animate target:
97
+ // flex-direction is discrete, so motion would apply it instantly —
98
+ // the flip lands in one commit and the children's `layout` FLIP is
99
+ // what glides the cards past each other.
100
+ isSwapped ? "flex-col-reverse" : "flex-col",
97
101
  className
98
102
  )}
99
- layout={"size"}
103
+ layout
100
104
  data-slot="scaffold-panel"
101
105
  data-dimmed={dimmed ? "" : undefined}
102
106
  data-swapped={isSwapped ? "" : undefined}
@@ -106,7 +110,13 @@ export function ScaffoldPanel({
106
110
  {children}
107
111
  </ScaffoldSubPanel>
108
112
  {(onSwap || onCloseSecondary) && SecondaryPanel && (
109
- <div className="relative flex h-2 items-center justify-center">
113
+ // `layout` keeps the seam glued to the moving boundary while the
114
+ // cards trade places around it.
115
+ <motion.div
116
+ layout
117
+ transition={transition}
118
+ className="relative flex h-2 items-center justify-center"
119
+ >
110
120
  <PanelMenuButton
111
121
  label={swapLabel}
112
122
  onClick={handleSwap}
@@ -116,7 +126,7 @@ export function ScaffoldPanel({
116
126
  swapped={isSwapped}
117
127
  sound={sound}
118
128
  />
119
- </div>
129
+ </motion.div>
120
130
  )}
121
131
  {SecondaryPanel && (
122
132
  <ScaffoldSubPanel id="bottom" expanded={subPanelPosition === "bottom"}>
@@ -1,26 +1,28 @@
1
-
2
1
  import * as React from "react"
3
- import { motion, useReducedMotion } from "framer-motion"
2
+ import { motion, useReducedMotion } from "motion/react"
4
3
  import { cn } from "@/lib/utils"
5
4
  import type { ScaffoldSubPanelProps } from "./type"
6
5
  import { subPanelVariant } from "@/components/blocks/scaffold/utils.ts"
7
6
  import { SCAFFOLD_EASE, SCAFFOLD_MORPH_DURATION } from "./constants"
8
7
 
9
8
  export function ScaffoldSubPanel({
10
- className,
11
- children,
12
- variant = 'card',
13
- primary = false,
14
- expanded,
15
- ...rest
16
- }: ScaffoldSubPanelProps): React.ReactElement {
9
+ className,
10
+ children,
11
+ variant = "card",
12
+ primary = false,
13
+ expanded,
14
+ ...rest
15
+ }: ScaffoldSubPanelProps): React.ReactElement {
17
16
  const reduce = useReducedMotion()
18
17
  // The primary card holds the flexible slot unless the panel says otherwise.
19
18
  const isExpanded = expanded ?? primary
20
19
 
21
20
  return (
22
21
  <motion.div
23
- layout={"size"}
22
+ // Full `layout` (position + size), not `layout="size"`: a swap flips
23
+ // the panel's flex direction in a single commit, and only a position
24
+ // FLIP makes the two cards glide past each other instead of teleport.
25
+ layout
24
26
  id={`scaffold-sub-panel-${variant}`}
25
27
  // Grow is animated as a style, not a class flip — a class flip rides the
26
28
  // layout FLIP, which scales both cards into a swap-like morph. Animating
@@ -38,7 +40,7 @@ export function ScaffoldSubPanel({
38
40
  subPanelVariant[variant],
39
41
  // basis-14 + clip let the primary squeeze down to the strip height;
40
42
  // the strip keeps its natural (basis-auto) height when collapsed.
41
- primary ? "basis-14 min-h-14 overflow-clip" : "basis-auto min-h-14",
43
+ primary ? "min-h-14 basis-14 overflow-clip" : "min-h-14 basis-auto",
42
44
  className
43
45
  )}
44
46
  data-slot={`scaffold-sub-panel-${variant}`}
@@ -40,7 +40,12 @@ export function ShellLayout({
40
40
  <AnimatedPanelProvider
41
41
  {...panelControlProps}
42
42
  defaultOpen={initialOpen}
43
- className={cn("relative h-full min-h-0 px-2 pb-2", className, background)}
43
+ className={cn(
44
+ "relative h-full min-h-0 px-2 pb-2",
45
+ variant === "web" && "pt-2",
46
+ className,
47
+ background
48
+ )}
44
49
  style={{
45
50
  paddingTop: variant === "desktop" ? TITLE_BAR_HEIGHT : 0,
46
51
  }}
@@ -59,7 +64,7 @@ export function ShellLayout({
59
64
  <AnimatedPanelInset>
60
65
  <header className="flex h-12 flex-row! items-center justify-between gap-2 border-b px-2">
61
66
  {panels?.left?.component && (
62
- <div className="flex min-w-0 flex-1 items-center gap-2">
67
+ <div className="flex min-w-0 shrink-0 items-center justify-start gap-2">
63
68
  <AnimatedPanelTrigger side="left">
64
69
  <MotionIcon name="PanelLeft" size={24} animation="press" />
65
70
  </AnimatedPanelTrigger>
@@ -69,7 +74,7 @@ export function ShellLayout({
69
74
  <div className="flex w-full flex-1 items-center">{header}</div>
70
75
  )}
71
76
  {panels?.right?.component && (
72
- <div className="flex flex-1 items-center justify-end gap-2">
77
+ <div className="flex w-full shrink items-center justify-end gap-2">
73
78
  <AnimatedPanelTrigger aria-label="Toggle panel" side="right">
74
79
  <MotionIcon
75
80
  className="opacity-70"
@@ -1,7 +1,7 @@
1
1
  import { mergeProps } from "@base-ui/react/merge-props"
2
2
  import { useRender } from "@base-ui/react/use-render"
3
3
  import { cva, type VariantProps } from "class-variance-authority"
4
- import { motion, type HTMLMotionProps } from "framer-motion"
4
+ import { motion, type HTMLMotionProps } from "motion/react"
5
5
 
6
6
  import { cn } from "@/lib/utils"
7
7
  import { Separator } from "@/components/ui/separator"