@brightlocal/ui-components 2.24.0 → 2.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.
Files changed (150) hide show
  1. package/README.md +2 -1
  2. package/component-meta.json +93 -79
  3. package/dist/accordion.cjs +1 -1
  4. package/dist/accordion.js +2 -2
  5. package/dist/alert-dialog.cjs +1 -1
  6. package/dist/alert-dialog.js +17 -17
  7. package/dist/badge.cjs +1 -1
  8. package/dist/badge.js +9 -9
  9. package/dist/blocks/input-list.cjs +2 -2
  10. package/dist/blocks/input-list.d.ts.map +1 -1
  11. package/dist/blocks/input-list.js +43 -46
  12. package/dist/blocks/sidebar.cjs +1 -1
  13. package/dist/blocks/sidebar.js +14 -14
  14. package/dist/brand-illustration-motif.cjs +1 -1
  15. package/dist/brand-illustration-motif.js +11 -11
  16. package/dist/breadcrumb.cjs +1 -1
  17. package/dist/breadcrumb.js +1 -1
  18. package/dist/button.cjs +1 -1
  19. package/dist/button.js +10 -10
  20. package/dist/card.cjs +1 -1
  21. package/dist/card.js +1 -1
  22. package/dist/carousel.cjs +1 -1
  23. package/dist/carousel.js +12 -12
  24. package/dist/checkbox.cjs +1 -1
  25. package/dist/checkbox.js +7 -7
  26. package/dist/chip.cjs +1 -1
  27. package/dist/chip.js +7 -7
  28. package/dist/combobox.cjs +1 -1
  29. package/dist/combobox.js +1 -1
  30. package/dist/data-table.d.ts +29 -0
  31. package/dist/data-table.d.ts.map +1 -1
  32. package/dist/dialog.cjs +1 -1
  33. package/dist/dialog.js +61 -61
  34. package/dist/field.cjs +1 -1
  35. package/dist/field.js +1 -1
  36. package/dist/height-transition.cjs +1 -0
  37. package/dist/height-transition.d.ts +44 -0
  38. package/dist/height-transition.d.ts.map +1 -0
  39. package/dist/height-transition.js +63 -0
  40. package/dist/index.cjs +1 -1
  41. package/dist/index.d.ts +1 -0
  42. package/dist/index.d.ts.map +1 -1
  43. package/dist/index.js +326 -324
  44. package/dist/input-chip.cjs +1 -1
  45. package/dist/input-chip.js +2 -2
  46. package/dist/input-group.cjs +1 -1
  47. package/dist/input-group.js +15 -15
  48. package/dist/input-otp.cjs +1 -1
  49. package/dist/input-otp.js +1 -1
  50. package/dist/input.cjs +1 -1
  51. package/dist/input.js +1 -1
  52. package/dist/lib/motion.cjs +1 -0
  53. package/dist/lib/motion.d.ts +70 -0
  54. package/dist/lib/motion.d.ts.map +1 -0
  55. package/dist/lib/motion.js +25 -0
  56. package/dist/lib/utils.cjs +1 -1
  57. package/dist/lib/utils.d.ts +1 -1
  58. package/dist/lib/utils.d.ts.map +1 -1
  59. package/dist/lib/utils.js +12 -4
  60. package/dist/link.cjs +1 -1
  61. package/dist/link.d.ts.map +1 -1
  62. package/dist/link.js +17 -16
  63. package/dist/list.cjs +1 -1
  64. package/dist/list.js +10 -10
  65. package/dist/loading.cjs +1 -1
  66. package/dist/loading.d.ts.map +1 -1
  67. package/dist/loading.js +45 -47
  68. package/dist/map.cjs +1 -1
  69. package/dist/map.d.ts.map +1 -1
  70. package/dist/map.js +2 -2
  71. package/dist/menubar.cjs +1 -1
  72. package/dist/menubar.js +5 -5
  73. package/dist/navigation-menu.cjs +1 -1
  74. package/dist/navigation-menu.js +13 -13
  75. package/dist/pagination.cjs +1 -1
  76. package/dist/pagination.js +1 -1
  77. package/dist/progress.cjs +1 -1
  78. package/dist/progress.d.ts.map +1 -1
  79. package/dist/progress.js +21 -25
  80. package/dist/radio-group.cjs +1 -1
  81. package/dist/radio-group.js +12 -12
  82. package/dist/scroll-area.cjs +1 -1
  83. package/dist/scroll-area.js +11 -11
  84. package/dist/select.cjs +1 -1
  85. package/dist/select.js +12 -12
  86. package/dist/sheet.cjs +1 -1
  87. package/dist/sheet.d.ts.map +1 -1
  88. package/dist/sheet.js +54 -50
  89. package/dist/slider.cjs +1 -1
  90. package/dist/slider.js +13 -13
  91. package/dist/stepper.cjs +1 -1
  92. package/dist/stepper.js +4 -4
  93. package/dist/switch.cjs +1 -1
  94. package/dist/switch.js +5 -5
  95. package/dist/table.cjs +1 -1
  96. package/dist/table.js +2 -2
  97. package/dist/tabs.cjs +1 -1
  98. package/dist/tabs.js +1 -1
  99. package/dist/text-reveal-motion.cjs +1 -1
  100. package/dist/text-reveal-motion.d.ts.map +1 -1
  101. package/dist/text-reveal-motion.js +77 -79
  102. package/dist/textarea.cjs +1 -1
  103. package/dist/textarea.js +11 -11
  104. package/dist/toggle.cjs +1 -1
  105. package/dist/toggle.js +5 -5
  106. package/package.json +10 -13
  107. package/src/blocks/input-list.tsx +3 -6
  108. package/src/blocks/sidebar.tsx +14 -14
  109. package/src/components/accordion.tsx +2 -2
  110. package/src/components/alert-dialog.tsx +2 -2
  111. package/src/components/badge.tsx +1 -1
  112. package/src/components/brand-illustration-motif.tsx +1 -1
  113. package/src/components/breadcrumb.tsx +1 -1
  114. package/src/components/button.tsx +2 -2
  115. package/src/components/card.tsx +1 -1
  116. package/src/components/carousel.tsx +1 -1
  117. package/src/components/checkbox.tsx +1 -1
  118. package/src/components/chip.tsx +2 -2
  119. package/src/components/combobox.tsx +1 -1
  120. package/src/components/data-table.tsx +29 -0
  121. package/src/components/dialog.tsx +3 -3
  122. package/src/components/field.tsx +1 -1
  123. package/src/components/height-transition.tsx +164 -0
  124. package/src/components/input-chip.tsx +2 -2
  125. package/src/components/input-group.tsx +2 -2
  126. package/src/components/input-otp.tsx +1 -1
  127. package/src/components/input.tsx +1 -1
  128. package/src/components/link.tsx +4 -3
  129. package/src/components/list.tsx +1 -1
  130. package/src/components/loading.tsx +2 -15
  131. package/src/components/map.tsx +3 -2
  132. package/src/components/menubar.tsx +5 -5
  133. package/src/components/navigation-menu.tsx +6 -6
  134. package/src/components/pagination.tsx +1 -1
  135. package/src/components/progress.tsx +2 -10
  136. package/src/components/radio-group.tsx +1 -1
  137. package/src/components/scroll-area.tsx +2 -2
  138. package/src/components/select.tsx +1 -1
  139. package/src/components/sheet.tsx +9 -5
  140. package/src/components/slider.tsx +1 -1
  141. package/src/components/stepper.tsx +4 -4
  142. package/src/components/switch.tsx +2 -2
  143. package/src/components/table.tsx +2 -2
  144. package/src/components/tabs.tsx +1 -1
  145. package/src/components/text-reveal-motion.tsx +3 -8
  146. package/src/components/textarea.tsx +1 -1
  147. package/src/components/toggle.tsx +1 -1
  148. package/src/index.ts +1 -0
  149. package/src/lib/motion.ts +75 -0
  150. package/src/lib/utils.ts +14 -2
@@ -289,7 +289,7 @@ const mapGridPinColorMap: Record<ResolvedVariant, string> = Object.fromEntries(
289
289
  ) as Record<ResolvedVariant, string>;
290
290
 
291
291
  const mapGridPinVariants = cva(
292
- "inline-flex items-center justify-center rounded-full font-sans text-sm font-semibold text-foreground dark:text-neutral-900 border-2 border-white shadow-sm transition-shadow duration-200 ease-out hover:shadow-md",
292
+ "inline-flex items-center justify-center rounded-full font-sans text-sm font-semibold text-foreground dark:text-neutral-900 border-2 border-white shadow-sm transition-shadow duration-fast ease-out hover:shadow-md",
293
293
  {
294
294
  variants: {
295
295
  variant: {
@@ -827,7 +827,8 @@ const MapLocationPin = React.forwardRef<HTMLDivElement, MapLocationPinProps>(
827
827
  aria-hidden="true"
828
828
  className={cn(
829
829
  "relative flex size-full",
830
- animateIn && "animate-pop-in origin-bottom will-change-transform"
830
+ animateIn &&
831
+ "animate-emphasis-pop origin-bottom will-change-transform"
831
832
  )}
832
833
  >
833
834
  <svg
@@ -85,7 +85,7 @@ function MenubarTrigger({
85
85
  return (
86
86
  <MenubarPrimitive.Trigger
87
87
  className={cn(
88
- "text-foreground flex cursor-pointer items-center justify-center gap-2 rounded-xs px-3 py-1 text-sm font-normal transition-colors",
88
+ "text-foreground duration-fast flex cursor-pointer items-center justify-center gap-2 rounded-xs px-3 py-1 text-sm font-normal transition-colors ease-out",
89
89
  "hover:bg-accent hover:text-accent-foreground",
90
90
  "focus:bg-accent focus:text-accent-foreground focus:outline-none",
91
91
  "data-[state=open]:bg-accent data-[state=open]:text-accent-foreground",
@@ -147,7 +147,7 @@ function MenubarItem({
147
147
  return (
148
148
  <MenubarPrimitive.Item
149
149
  className={cn(
150
- "text-foreground relative flex cursor-pointer items-center justify-between rounded-sm px-2 py-1.5 text-sm font-normal transition-colors outline-none",
150
+ "text-foreground duration-fast relative flex cursor-pointer items-center justify-between rounded-sm px-2 py-1.5 text-sm font-normal transition-colors ease-out outline-none",
151
151
  "hover:bg-accent hover:text-foreground",
152
152
  "focus:bg-accent focus:text-foreground",
153
153
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -191,7 +191,7 @@ function MenubarCheckboxItem({
191
191
  <MenubarPrimitive.CheckboxItem
192
192
  checked={checked}
193
193
  className={cn(
194
- "text-foreground relative flex cursor-pointer items-center justify-between rounded-sm py-1.5 pr-2 pl-8 text-sm font-normal transition-colors outline-none",
194
+ "text-foreground duration-fast relative flex cursor-pointer items-center justify-between rounded-sm py-1.5 pr-2 pl-8 text-sm font-normal transition-colors ease-out outline-none",
195
195
  "hover:bg-accent hover:text-foreground",
196
196
  "focus:bg-accent focus:text-foreground",
197
197
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -268,7 +268,7 @@ function MenubarRadioItem({
268
268
  return (
269
269
  <MenubarPrimitive.RadioItem
270
270
  className={cn(
271
- "text-foreground relative flex cursor-pointer items-center justify-between rounded-sm py-1.5 pr-2 pl-8 text-sm font-normal transition-colors outline-none",
271
+ "text-foreground duration-fast relative flex cursor-pointer items-center justify-between rounded-sm py-1.5 pr-2 pl-8 text-sm font-normal transition-colors ease-out outline-none",
272
272
  "hover:bg-accent hover:text-foreground",
273
273
  "focus:bg-accent focus:text-foreground",
274
274
  "data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
@@ -381,7 +381,7 @@ function MenubarSubTrigger({
381
381
  return (
382
382
  <MenubarPrimitive.SubTrigger
383
383
  className={cn(
384
- "text-foreground flex cursor-pointer items-center justify-between rounded-xs px-2 py-1.5 text-sm font-normal transition-colors outline-none",
384
+ "text-foreground duration-fast flex cursor-pointer items-center justify-between rounded-xs px-2 py-1.5 text-sm font-normal transition-colors ease-out outline-none",
385
385
  "hover:bg-accent hover:text-foreground",
386
386
  "focus:bg-accent focus:text-foreground",
387
387
  "data-[state=open]:bg-accent data-[state=open]:text-foreground",
@@ -141,7 +141,7 @@ const NavigationMenuTrigger = React.forwardRef<
141
141
  "rounded-md px-4 py-2",
142
142
  "text-sm font-medium",
143
143
  "text-foreground",
144
- "transition-colors",
144
+ "duration-fast transition-colors ease-out",
145
145
  "hover:bg-accent hover:text-accent-foreground",
146
146
  "focus:bg-accent focus:text-accent-foreground",
147
147
  "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
@@ -182,7 +182,7 @@ const NavigationMenuTrigger = React.forwardRef<
182
182
  {children}
183
183
  <ChevronDown
184
184
  aria-hidden="true"
185
- className="relative top-[1px] ml-1 transition duration-300 group-data-[state=open]:rotate-180"
185
+ className="duration-base relative top-[1px] ml-1 transition-transform ease-in-out group-data-[state=open]:rotate-180"
186
186
  size={12}
187
187
  />
188
188
  </NavigationMenuPrimitive.Trigger>
@@ -218,7 +218,7 @@ const NavigationMenuContent = React.forwardRef<
218
218
  // Match the viewport's easeOutQuint timing so the directional slide and
219
219
  // the container morph feel like one motion (kept snappy so content
220
220
  // appears without a perceptible fade-in delay).
221
- "duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]",
221
+ "duration-base ease-emphasized",
222
222
  "md:absolute md:w-auto",
223
223
  ],
224
224
  className
@@ -251,7 +251,7 @@ const NavigationMenuLink = React.forwardRef<
251
251
  className={cn(
252
252
  [
253
253
  "block rounded-md p-3 leading-none no-underline select-none",
254
- "transition-colors outline-none",
254
+ "duration-fast transition-colors ease-out outline-none",
255
255
  "hover:bg-accent hover:text-accent-foreground",
256
256
  "focus:bg-accent focus:text-accent-foreground",
257
257
  "focus-visible:bg-accent focus-visible:ring-ring focus-visible:shadow-[0_0_0_4px_rgba(163,163,163,0.1)] focus-visible:ring-1 focus-visible:outline-none",
@@ -285,9 +285,9 @@ const NavigationMenuViewport = React.forwardRef<
285
285
  // 150ms out) so the panel and its content appear immediately rather
286
286
  // than fading in slowly. Reduced motion is neutralised globally by the
287
287
  // token preset, so no per-element motion-reduce guard is needed.
288
- "transition-[width,height] duration-200 ease-[cubic-bezier(0.22,1,0.36,1)]",
288
+ "duration-base ease-emphasized transition-[width,height]",
289
289
  "data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95",
290
- "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:duration-150",
290
+ "data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=closed]:duration-fast data-[state=closed]:ease-in",
291
291
  "md:w-[var(--radix-navigation-menu-viewport-width)]",
292
292
  ],
293
293
  className
@@ -100,7 +100,7 @@ const paginationItemVariants = cva(
100
100
  "h-9 w-9",
101
101
  "rounded-full",
102
102
  "text-sm font-medium",
103
- "transition-colors duration-200 ease-out",
103
+ "transition-colors duration-fast ease-out",
104
104
  "focus-visible:outline-none focus-visible:shadow-default",
105
105
  ],
106
106
  {
@@ -6,6 +6,7 @@ import { motion } from "framer-motion";
6
6
 
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
  import { usePrefersReducedMotion } from "@brightlocal/ui-components/hooks/use-prefers-reduced-motion";
9
+ import { SPRING_GENTLE } from "../lib/motion";
9
10
 
10
11
  /**
11
12
  * Brand color for the progress indicator, drawn from the shared brand palette.
@@ -195,16 +196,7 @@ const Progress = React.forwardRef<
195
196
  )}
196
197
  data-slot="progress-indicator"
197
198
  initial={false}
198
- transition={
199
- prefersReducedMotion
200
- ? { duration: 0 }
201
- : {
202
- type: "spring",
203
- stiffness: 80,
204
- damping: 20,
205
- mass: 1,
206
- }
207
- }
199
+ transition={prefersReducedMotion ? { duration: 0 } : SPRING_GENTLE}
208
200
  />
209
201
  </ProgressPrimitive.Indicator>
210
202
  </ProgressPrimitive.Root>
@@ -41,7 +41,7 @@ const radioGroupItemVariants = cva(
41
41
  );
42
42
 
43
43
  const radioCircleVariants = cva(
44
- "relative aspect-square size-4 shrink-0 rounded-full border transition-[border-color,border-width,box-shadow,background-color]",
44
+ "relative aspect-square size-4 shrink-0 rounded-full border transition-[border-color,border-width,box-shadow,background-color] duration-fast ease-out",
45
45
  {
46
46
  variants: {
47
47
  variant: {
@@ -60,7 +60,7 @@ const ScrollArea = React.forwardRef<
60
60
  {...props}
61
61
  >
62
62
  <ScrollAreaPrimitive.Viewport
63
- className="focus-visible:shadow-default size-full rounded-[inherit] p-1 transition-[color,box-shadow] outline-none"
63
+ className="focus-visible:shadow-default duration-fast size-full rounded-[inherit] p-1 transition-[color,box-shadow] ease-out outline-none"
64
64
  data-slot="scroll-area-viewport"
65
65
  tabIndex={0}
66
66
  >
@@ -123,7 +123,7 @@ const ScrollBar = React.forwardRef<
123
123
  <ScrollAreaPrimitive.ScrollAreaScrollbar
124
124
  ref={ref}
125
125
  className={cn(
126
- "flex touch-none p-px transition-colors select-none",
126
+ "duration-fast flex touch-none p-px transition-colors ease-out select-none",
127
127
  orientation === "vertical" &&
128
128
  "h-full w-2.5 border-l border-l-transparent",
129
129
  orientation === "horizontal" &&
@@ -180,7 +180,7 @@ const selectTriggerVariants = cva([
180
180
  "px-3 py-2",
181
181
 
182
182
  // Base appearance
183
- "border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color]",
183
+ "border border-border rounded-sm outline-none transition-[border-color,box-shadow,background-color] duration-fast ease-out",
184
184
  "bg-neutral-50 border-neutral-300",
185
185
  "dark:bg-white/5 dark:border-white/15",
186
186
 
@@ -29,10 +29,14 @@ const sheetContentVariants = cva(
29
29
  "gap-4",
30
30
  "p-6",
31
31
  "shadow-lg",
32
- "transition",
33
- "ease-in-out",
34
- "data-[state=closed]:duration-300",
35
- "data-[state=open]:duration-500",
32
+ // Large-surface timing (DS-806): enter at duration-slow (300ms), exit ~20%
33
+ // faster — users asked for the thing to go away. Enter decelerates
34
+ // (ease-out), exit accelerates away (ease-in); these time the tw-animate
35
+ // enter/exit keyframes via --tw-duration/--tw-ease.
36
+ "ease-out",
37
+ "data-[state=closed]:ease-in",
38
+ "data-[state=open]:duration-slow",
39
+ "data-[state=closed]:duration-250",
36
40
  ],
37
41
  {
38
42
  variants: {
@@ -230,7 +234,7 @@ const SheetContent = React.forwardRef<
230
234
  {...props}
231
235
  >
232
236
  {children}
233
- <SheetPrimitive.Close className="ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
237
+ <SheetPrimitive.Close className="ring-offset-background focus-visible:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground duration-fast absolute top-4 right-4 rounded-xs opacity-70 outline-hidden transition-opacity ease-out hover:opacity-100 focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0">
234
238
  <X />
235
239
  <span className="sr-only">{closeLabel ?? "Close"}</span>
236
240
  </SheetPrimitive.Close>
@@ -169,7 +169,7 @@ const Slider = React.forwardRef<
169
169
  <SliderPrimitive.Thumb
170
170
  key={index}
171
171
  aria-label={getThumbLabel(index)}
172
- className="border-primary bg-background ring-ring/50 block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
172
+ className="border-primary bg-background ring-ring/50 duration-fast block size-4 shrink-0 rounded-full border shadow-sm transition-[color,box-shadow] ease-out hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
173
173
  data-slot="slider-thumb"
174
174
  />
175
175
  ))}
@@ -446,9 +446,9 @@ StepperTrigger.displayName = "StepperTrigger";
446
446
  const stepperIndicatorStyles = cva(
447
447
  [
448
448
  "relative flex size-8 shrink-0 items-center justify-center rounded-full text-xs font-medium",
449
- "transition-colors duration-200 ease-out",
449
+ "transition-colors duration-fast ease-out",
450
450
  // Hover overlay (only visible when wrapped by an interactive trigger).
451
- "after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-200 after:ease-out",
451
+ "after:pointer-events-none after:absolute after:inset-0 after:rounded-full after:bg-white/10 after:opacity-0 after:transition-opacity after:duration-fast after:ease-out",
452
452
  "group-hover/trigger:after:opacity-100",
453
453
  // Focus ring is rendered here (around the circle) when the trigger is
454
454
  // keyboard-focused, rather than around the whole trigger.
@@ -552,7 +552,7 @@ const StepperIndicator = React.forwardRef<
552
552
  <>
553
553
  <span
554
554
  className={cn(
555
- "transition-opacity duration-200 ease-out",
555
+ "duration-fast transition-opacity ease-out",
556
556
  (state === "completed" || state === "error" || isLoading) &&
557
557
  "opacity-0"
558
558
  )}
@@ -608,7 +608,7 @@ const StepperSeparator = React.forwardRef<
608
608
  ref={ref}
609
609
  aria-hidden="true"
610
610
  className={cn(
611
- "bg-border shrink-0 rounded-full transition-colors duration-200",
611
+ "bg-border duration-fast shrink-0 rounded-full transition-colors ease-out",
612
612
  "group-data-[state=completed]/step:bg-primary",
613
613
  "group-data-[disabled=true]/step:opacity-50",
614
614
  // Horizontal + labels below: absolute connector spanning this indicator
@@ -26,7 +26,7 @@ const Switch = React.forwardRef<
26
26
  ref={ref}
27
27
  className={cn(
28
28
  "peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring dark:data-[state=unchecked]:bg-input/80 dark:focus-visible:border-neutral-500",
29
- "focus-visible:shadow-default inline-flex h-5 w-9 shrink-0 items-center rounded-full border-1 border-transparent shadow-xs transition-[background-color,border-color,box-shadow] outline-none",
29
+ "focus-visible:shadow-default duration-fast inline-flex h-5 w-9 shrink-0 items-center rounded-full border-1 border-transparent shadow-xs transition-[background-color,border-color,box-shadow] ease-out outline-none",
30
30
  "disabled:cursor-not-allowed disabled:opacity-50",
31
31
  "pl-[1px]",
32
32
  className
@@ -40,7 +40,7 @@ const Switch = React.forwardRef<
40
40
  <SwitchPrimitive.Thumb
41
41
  className={cn(
42
42
  "bg-background",
43
- "pointer-events-none block size-4 rounded-full ring-0 transition-transform",
43
+ "duration-base pointer-events-none block size-4 rounded-full ring-0 transition-transform ease-in-out",
44
44
  "data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0"
45
45
  )}
46
46
  data-slot="switch-thumb"
@@ -32,7 +32,7 @@ const tableCellVariants = cva(
32
32
  );
33
33
 
34
34
  const tableHeadVariants = cva(
35
- "h-12 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-150 ease-in-out",
35
+ "h-12 p-2 align-middle text-muted-foreground text-sm font-medium leading-normal break-words outline-none focus-visible:shadow-default transition-[background-color,box-shadow] duration-fast ease-out",
36
36
  {
37
37
  variants: {
38
38
  align: {
@@ -233,7 +233,7 @@ const TableRow = React.forwardRef<HTMLTableRowElement, TableRowProps>(
233
233
  <tr
234
234
  ref={ref}
235
235
  className={cn(
236
- "data-[state=selected]:bg-muted transition-colors duration-150 ease-in-out",
236
+ "data-[state=selected]:bg-muted duration-fast transition-colors ease-out",
237
237
  className
238
238
  )}
239
239
  data-hook={dataHook}
@@ -207,7 +207,7 @@ function TabsTriggerInner<T extends string = string>(
207
207
  // Text color
208
208
  "text-foreground",
209
209
  // Transition with explicit duration and easing
210
- "transition-[color,box-shadow] duration-150 ease-in-out",
210
+ "duration-fast transition-[color,box-shadow] ease-out",
211
211
  // Active state
212
212
  "data-[state=active]:bg-background data-[state=active]:shadow-sm",
213
213
  // Focus state - use compound selector for active+focused to override shadow-sm with shadow-default
@@ -13,7 +13,7 @@ import { animate } from "framer-motion";
13
13
 
14
14
  import { cn } from "@brightlocal/ui-components/lib/utils";
15
15
  import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion";
16
- import { SETTLE_REST_DELTA } from "../lib/spring-settle";
16
+ import { SETTLE_REST_DELTA, SPRING_SETTLE, SPRING_SMOOTH } from "../lib/motion";
17
17
 
18
18
  // ---------------------------------------------------------------------------
19
19
  // Shape paths (500×500 viewBox)
@@ -229,9 +229,7 @@ const TextRevealMotion = React.forwardRef<
229
229
  // Internal animation defaults matching the Loading story tuning
230
230
  const shapes = DEFAULT_SHAPES;
231
231
  const rollSpeed = 0.8;
232
- const stiffness = 180;
233
- const damping = 24;
234
- const mass = 1;
232
+ const { stiffness, damping, mass } = SPRING_SMOOTH;
235
233
 
236
234
  const reducedMotion = usePrefersReducedMotion();
237
235
  const rawId = useId();
@@ -531,10 +529,7 @@ const TextRevealMotion = React.forwardRef<
531
529
  return;
532
530
  }
533
531
  const controls = animate(0, 1 + SETTLE_REST_DELTA, {
534
- type: "spring",
535
- stiffness: 30,
536
- damping: 9,
537
- mass: 0.5,
532
+ ...SPRING_SETTLE,
538
533
  restDelta: SETTLE_REST_DELTA,
539
534
  onUpdate: (v: number) => {
540
535
  if (signal.cancelled) {
@@ -8,7 +8,7 @@ const textareaVariants = cva([
8
8
  "flex w-full",
9
9
  // Appearance - Explicit background with isolation for contrast calculation
10
10
  "border border-input bg-background rounded-md",
11
- "outline-none transition-[border-color,background-color,box-shadow]",
11
+ "outline-none transition-[border-color,background-color,box-shadow] duration-fast ease-out",
12
12
  // Typography
13
13
  "text-base leading-normal font-sans",
14
14
  "text-foreground",
@@ -7,7 +7,7 @@ import { cva, type VariantProps } from "class-variance-authority";
7
7
  import { cn } from "@brightlocal/ui-components/lib/utils";
8
8
 
9
9
  const toggleVariants = cva(
10
- "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-150 ease-in-out whitespace-nowrap",
10
+ "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 focus-visible:border-ring focus-visible:shadow-default outline-none transition-[color,box-shadow] duration-fast ease-out whitespace-nowrap",
11
11
  {
12
12
  variants: {
13
13
  variant: {
package/src/index.ts CHANGED
@@ -29,6 +29,7 @@ export * from "./components/dropdown-menu";
29
29
  export * from "./components/field";
30
30
  export * from "./components/global-layout";
31
31
  export * from "./components/header";
32
+ export * from "./components/height-transition";
32
33
  export * from "./components/hover-card";
33
34
  export * from "./components/input";
34
35
  export * from "./components/input-chip";
@@ -0,0 +1,75 @@
1
+ /**
2
+ * Shared motion values for JS-driven (framer-motion) animation — the JS-side
3
+ * counterpart of the CSS motion token scale (`--ds-motion-*` in
4
+ * `@brightlocal/tokens`).
5
+ *
6
+ * Engine policy (DS-806): CSS is the default for predetermined state
7
+ * transitions and preset keyframes. framer-motion is allowed when animation
8
+ * behaviour requires runtime orchestration — progress-driven or
9
+ * gesture-interruptible motion, spring physics, layout measurement, or
10
+ * sequencing tied to React state — and every framer component must consume
11
+ * `usePrefersReducedMotion()` (the global CSS kill-switch cannot see
12
+ * JS-driven values).
13
+ *
14
+ * New framer code must use one of these presets. Introducing a new spring
15
+ * config means adding it here, which keeps drift reviewable.
16
+ */
17
+
18
+ export { SETTLE_REST_DELTA } from "./spring-settle";
19
+
20
+ /**
21
+ * Duration scale in milliseconds — mirrors --ds-motion-duration-fast/base/slow.
22
+ * fast: state changes (hover/focus color, shadow, opacity) + exits;
23
+ * press feedback is faster still (instant or ≤100ms)
24
+ * base: standard reveals + on-screen movement
25
+ * slow: large surfaces; the productive-motion ceiling
26
+ */
27
+ export const MOTION_DURATION_FAST_MS = 150;
28
+ export const MOTION_DURATION_BASE_MS = 200;
29
+ export const MOTION_DURATION_SLOW_MS = 300;
30
+
31
+ /**
32
+ * Quick and controlled, no overshoot — list reorders and other
33
+ * small-element layout moves.
34
+ *
35
+ * Damping 45 keeps it at/above critical damping (2 × √500 ≈ 44.7, mass 1),
36
+ * so the "no overshoot" description physically holds — at the previous 35
37
+ * the spring was underdamped (ζ ≈ 0.78) and could overshoot.
38
+ */
39
+ export const SPRING_SNAPPY = {
40
+ type: "spring",
41
+ stiffness: 500,
42
+ damping: 45,
43
+ } as const;
44
+
45
+ /** Balanced — text and content reveals. */
46
+ export const SPRING_SMOOTH = {
47
+ type: "spring",
48
+ stiffness: 180,
49
+ damping: 24,
50
+ mass: 1,
51
+ } as const;
52
+
53
+ /** Soft and value-tracking — progress bars and gauges. */
54
+ export const SPRING_GENTLE = {
55
+ type: "spring",
56
+ stiffness: 80,
57
+ damping: 20,
58
+ mass: 1,
59
+ } as const;
60
+
61
+ /**
62
+ * Slow, non-overshooting morph driver for shape-progress springs (Loading,
63
+ * TextRevealMotion). Always pair with `SETTLE_REST_DELTA` (aim the spring at
64
+ * `1 + SETTLE_REST_DELTA` with `restDelta: SETTLE_REST_DELTA`) so the
65
+ * terminal snap lands off-screen.
66
+ *
67
+ * Precondition for the settle trick: damping ≥ 2 × √(stiffness × mass)
68
+ * (9 ≥ 2 × √(30 × 0.5) ≈ 7.75) — the spring must never overshoot.
69
+ */
70
+ export const SPRING_SETTLE = {
71
+ type: "spring",
72
+ stiffness: 30,
73
+ damping: 9,
74
+ mass: 0.5,
75
+ } as const;
package/src/lib/utils.ts CHANGED
@@ -1,9 +1,21 @@
1
1
  import { clsx, type ClassValue } from "clsx";
2
- import { twMerge } from "tailwind-merge";
2
+ import { extendTailwindMerge } from "tailwind-merge";
3
+
4
+ // The motion scale adds named duration/ease utilities (tailwind-preset.css)
5
+ // that stock twMerge does not recognize — without registering them, a
6
+ // consumer's `duration-300` would not replace a baked-in `duration-fast`.
7
+ const twMerge = extendTailwindMerge({
8
+ extend: {
9
+ classGroups: {
10
+ duration: [{ duration: ["fast", "base", "slow"] }],
11
+ ease: [{ ease: ["emphasized", "overshoot"] }],
12
+ },
13
+ },
14
+ });
3
15
 
4
16
  export function cn(...inputs: ClassValue[]) {
5
17
  return twMerge(clsx(inputs));
6
18
  }
7
19
 
8
20
  export const FLOATING_CONTENT_ANIMATION =
9
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2";
21
+ "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 duration-base ease-out data-[state=closed]:duration-fast data-[state=closed]:ease-in";