@stasho/ds 0.10.0 → 0.11.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": "@stasho/ds",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "stasho design system",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -45,6 +45,7 @@ const AccordionTrigger = forwardRef<
45
45
  "size-4 shrink-0 text-accent-500 dark:text-accent",
46
46
  "transition-transform duration-200",
47
47
  "group-data-[state=open]:rotate-180",
48
+ "group-data-[state=closed]:group-hover:translate-y-[3px]",
48
49
  "motion-reduce:transition-none",
49
50
  )}
50
51
  />
@@ -57,10 +58,21 @@ const AccordionContent = forwardRef<
57
58
  HTMLDivElement,
58
59
  ComponentPropsWithoutRef<typeof AccordionPrimitive.Content>
59
60
  >(({ className, children, ...rest }, ref) => (
60
- <AccordionPrimitive.Content ref={ref} {...rest}>
61
+ <AccordionPrimitive.Content
62
+ ref={ref}
63
+ className={cn(
64
+ "group overflow-hidden",
65
+ "motion-safe:data-[state=open]:animate-accordion-down",
66
+ "motion-safe:data-[state=closed]:animate-accordion-up",
67
+ )}
68
+ {...rest}
69
+ >
61
70
  <div
62
71
  className={cn(
63
72
  "pb-4 text-sm leading-relaxed text-muted-foreground",
73
+ "opacity-0 -translate-y-1 transition-[opacity,transform] duration-200 ease-out",
74
+ "group-data-[state=open]:opacity-100 group-data-[state=open]:translate-y-0",
75
+ "motion-reduce:transition-none motion-reduce:opacity-100 motion-reduce:translate-y-0",
64
76
  className,
65
77
  )}
66
78
  >
@@ -375,4 +375,27 @@
375
375
  animation: none;
376
376
  opacity: 1;
377
377
  }
378
+ }
379
+
380
+ /* ── Accordion open/close (height) ───────────── */
381
+
382
+ /* Registered as real Tailwind utilities so the `data-[state=...]:` variant can
383
+ compose (a plain `.animate-accordion-*` CSS class can't carry a Tailwind
384
+ variant). Applied in the component as `motion-safe:data-[state=open]:…` — the
385
+ `data-[state]` attribute selector out-specifies `motion-reduce:animate-none`,
386
+ so reduced motion is honored by gating the animation INTO motion-safe rather
387
+ than disabling it OUT, which sidesteps the specificity conflict entirely. */
388
+ @theme {
389
+ --animate-accordion-down: accordion-down 200ms ease-out;
390
+ --animate-accordion-up: accordion-up 200ms ease-out;
391
+ }
392
+
393
+ @keyframes accordion-down {
394
+ from { height: 0; }
395
+ to { height: var(--radix-accordion-content-height); }
396
+ }
397
+
398
+ @keyframes accordion-up {
399
+ from { height: var(--radix-accordion-content-height); }
400
+ to { height: 0; }
378
401
  }