@walco-ai/claude-plugin-design-system 0.3.2 → 0.4.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.
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  import { type IconGlyph } from "../Icon/icons";
3
3
  export type BannerVariant = "info" | "status";
4
4
  export type BannerTone = "neutral" | "info" | "waiting" | "success" | "danger";
@@ -1,4 +1,4 @@
1
- import type { ReactElement, ReactNode } from "react";
1
+ import { type ReactElement, type ReactNode } from "react";
2
2
  /** What a labelled field receives from its frame: its id and the ids of the texts that describe it. */
3
3
  export interface FieldControl {
4
4
  id: string;
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from "react";
1
+ import { type ReactNode } from "react";
2
2
  export interface SwitchOption<T extends string> {
3
3
  id: T;
4
4
  label: ReactNode;
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
2
2
  import { ArrowLeft, ArrowRight, Check, ChevronDown, ChevronRight, CircleAlert, CircleCheck, Clock, Copy, ExternalLink, History, Info, LoaderCircle, MessageSquareText, Network, NotepadText, Pencil, Plus, RefreshCw, Search, Send, TriangleAlert, X } from "lucide-react";
3
- import { useId, useRef, useState } from "react";
3
+ import { useId, useLayoutEffect, useRef, useState } from "react";
4
4
  //#region package/src/internal/cx.ts
5
5
  /** Joins the class names that are set. */
6
6
  function cx(...names) {
@@ -117,6 +117,19 @@ function Link({ variant = "accent", className, children, ...rest }) {
117
117
  //#region package/src/components/Field/Field.tsx
118
118
  /** The frame shared by the text fields: a label above, the control, then a hint or an error below. */
119
119
  function Field({ id, label, hint, error, className, children }) {
120
+ const [previous, setPrevious] = useState(error);
121
+ const [leaving, setLeaving] = useState(void 0);
122
+ if (error !== previous) {
123
+ setPrevious(error);
124
+ setLeaving(error === void 0 ? previous : void 0);
125
+ }
126
+ const isLeaving = error === void 0 && leaving !== void 0;
127
+ const message = isLeaving ? leaving : error;
128
+ const errorBox = useRef(null);
129
+ useLayoutEffect(() => {
130
+ const box = errorBox.current;
131
+ if (isLeaving && (box === null || getComputedStyle(box).animationName === "none")) setLeaving(void 0);
132
+ }, [isLeaving]);
120
133
  const hintId = hint === void 0 ? void 0 : `${id}-hint`;
121
134
  const errorId = error === void 0 ? void 0 : `${id}-error`;
122
135
  const describedBy = [errorId, hintId].filter((value) => value !== void 0).join(" ") || void 0;
@@ -133,13 +146,18 @@ function Field({ id, label, hint, error, className, children }) {
133
146
  describedBy,
134
147
  invalid: error !== void 0
135
148
  }),
136
- error !== void 0 && /* @__PURE__ */ jsxs("p", {
137
- className: "cpds-field__error",
149
+ message !== void 0 && /* @__PURE__ */ jsxs("p", {
150
+ ref: errorBox,
151
+ className: cx("cpds-field__error", isLeaving && "cpds-field__error--leaving"),
138
152
  id: errorId,
153
+ "aria-hidden": isLeaving || void 0,
154
+ onAnimationEnd: (event) => {
155
+ if (isLeaving && event.animationName === "cpds-field-error-out") setLeaving(void 0);
156
+ },
139
157
  children: [/* @__PURE__ */ jsx(Icon, {
140
158
  icon: iconCircleAlert,
141
159
  size: "sm"
142
- }), /* @__PURE__ */ jsx("span", { children: error })]
160
+ }), /* @__PURE__ */ jsx("span", { children: message })]
143
161
  }),
144
162
  hint !== void 0 && /* @__PURE__ */ jsx("p", {
145
163
  className: "cpds-field__hint",
@@ -237,11 +255,30 @@ function Card({ variant = "default", inset = "lg", as: Tag = "div", className, c
237
255
  });
238
256
  }
239
257
  //#endregion
258
+ //#region package/src/internal/useTonePulse.ts
259
+ /**
260
+ * The class that restarts a one-off pulse each time `tone` changes, none before the first change.
261
+ * Two identical keyframes alternate, so that the pulse restarts without remounting the element.
262
+ */
263
+ function useTonePulse(tone) {
264
+ const [seen, setSeen] = useState({
265
+ tone,
266
+ changes: 0
267
+ });
268
+ if (seen.tone !== tone) setSeen({
269
+ tone,
270
+ changes: seen.changes + 1
271
+ });
272
+ if (seen.changes === 0) return void 0;
273
+ return seen.changes % 2 === 1 ? "cpds-pulse-a" : "cpds-pulse-b";
274
+ }
275
+ //#endregion
240
276
  //#region package/src/components/Badge/Badge.tsx
241
277
  /** A small label attached to an item, such as "Recommended" or "Revised". */
242
278
  function Badge({ tone = "neutral", className, children, ...rest }) {
279
+ const pulse = useTonePulse(tone);
243
280
  return /* @__PURE__ */ jsx("span", {
244
- className: cx("cpds-badge", `cpds-tone--${tone}`, className),
281
+ className: cx("cpds-badge", `cpds-tone--${tone}`, pulse, className),
245
282
  ...rest,
246
283
  children
247
284
  });
@@ -250,8 +287,9 @@ function Badge({ tone = "neutral", className, children, ...rest }) {
250
287
  //#region package/src/components/StatusBadge/StatusBadge.tsx
251
288
  /** The status of an item or of a view, such as "Waiting for you" or "Confirmed". */
252
289
  function StatusBadge({ tone, className, children, ...rest }) {
290
+ const pulse = useTonePulse(tone);
253
291
  return /* @__PURE__ */ jsx("span", {
254
- className: cx("cpds-status-badge", `cpds-tone--${tone}`, className),
292
+ className: cx("cpds-status-badge", `cpds-tone--${tone}`, pulse, className),
255
293
  ...rest,
256
294
  children
257
295
  });
@@ -383,6 +421,12 @@ var toneIcons = {
383
421
  };
384
422
  /** A message about the state of a view or an item, announced politely to assistive technologies. */
385
423
  function Banner({ variant = "info", tone = "info", icon, title, actions, onDismiss, dismissLabel = "Dismiss", className, children }) {
424
+ const [leaving, setLeaving] = useState(false);
425
+ const root = useRef(null);
426
+ useLayoutEffect(() => {
427
+ if (!leaving || root.current === null) return;
428
+ if (getComputedStyle(root.current).animationName === "none") onDismiss?.();
429
+ }, [leaving, onDismiss]);
386
430
  const controls = variant === "info" && (actions !== void 0 || onDismiss !== void 0);
387
431
  const message = /* @__PURE__ */ jsxs(Fragment, { children: [
388
432
  title !== void 0 && /* @__PURE__ */ jsx("strong", {
@@ -393,6 +437,11 @@ function Banner({ variant = "info", tone = "info", icon, title, actions, onDismi
393
437
  children
394
438
  ] });
395
439
  return /* @__PURE__ */ jsxs("div", {
440
+ ref: root,
441
+ "data-leaving": leaving ? "" : void 0,
442
+ onAnimationEnd: (event) => {
443
+ if (leaving && event.target === event.currentTarget && event.animationName === "cpds-banner-collapse") onDismiss?.();
444
+ },
396
445
  role: controls ? void 0 : "status",
397
446
  className: cx("cpds-banner", `cpds-banner--${variant}`, `cpds-banner-tone--${tone}`, variant === "info" && `cpds-tone--${tone}`, controls && "cpds-banner--with-controls", className),
398
447
  children: [
@@ -411,7 +460,9 @@ function Banner({ variant = "info", tone = "info", icon, title, actions, onDismi
411
460
  icon: iconX,
412
461
  label: dismissLabel,
413
462
  variant: "ghost",
414
- onClick: onDismiss
463
+ onClick: () => {
464
+ setLeaving(true);
465
+ }
415
466
  })]
416
467
  })
417
468
  ]
@@ -458,8 +509,9 @@ function VisuallyHidden({ className, children }) {
458
509
  //#region package/src/components/StatusDot/StatusDot.tsx
459
510
  /** A small dot in the tone of a state, filled for an active state, outlined for one that has not started. */
460
511
  function StatusDot({ status, label, className }) {
512
+ const pulse = useTonePulse(status);
461
513
  return /* @__PURE__ */ jsx("span", {
462
- className: cx("cpds-status-dot", `cpds-status-dot--${status}`, className),
514
+ className: cx("cpds-status-dot", `cpds-status-dot--${status}`, pulse, className),
463
515
  "aria-hidden": label === void 0 ? true : void 0,
464
516
  children: label !== void 0 && /* @__PURE__ */ jsx(VisuallyHidden, { children: label })
465
517
  });
@@ -507,10 +559,53 @@ function FilterChip({ pressed, onPressedChange, tone = "accent", count, type = "
507
559
  });
508
560
  }
509
561
  //#endregion
562
+ //#region package/src/internal/useIndicator.ts
563
+ /**
564
+ * Measures the element of `container` that matches `selector` and writes its box on the container as the custom
565
+ * properties --cpds-indicator-x, -y, -w and -h, so that one block drawn by the container can sit behind it.
566
+ * The container must be the offset parent of the element. It gets `data-indicator-ready` one frame after its first
567
+ * measure, so that the block is placed at once on the first render and slides only afterwards. A change of width
568
+ * measures again.
569
+ */
570
+ function useIndicator(container, selector, dependency) {
571
+ const ready = useRef(false);
572
+ useLayoutEffect(() => {
573
+ const host = container.current;
574
+ if (host === null) return;
575
+ let frame = 0;
576
+ const measure = () => {
577
+ const target = host.querySelector(selector);
578
+ if (target === null) return;
579
+ host.style.setProperty("--cpds-indicator-x", `${String(target.offsetLeft)}px`);
580
+ host.style.setProperty("--cpds-indicator-y", `${String(target.offsetTop)}px`);
581
+ host.style.setProperty("--cpds-indicator-w", `${String(target.offsetWidth)}px`);
582
+ host.style.setProperty("--cpds-indicator-h", `${String(target.offsetHeight)}px`);
583
+ if (!ready.current && frame === 0) frame = requestAnimationFrame(() => {
584
+ ready.current = true;
585
+ host.dataset["indicatorReady"] = "";
586
+ });
587
+ };
588
+ measure();
589
+ const observer = new ResizeObserver(measure);
590
+ observer.observe(host);
591
+ return () => {
592
+ cancelAnimationFrame(frame);
593
+ observer.disconnect();
594
+ };
595
+ }, [
596
+ container,
597
+ selector,
598
+ dependency
599
+ ]);
600
+ }
601
+ //#endregion
510
602
  //#region package/src/components/SegmentedControl/SegmentedControl.tsx
511
603
  /** A choice between a few views, side by side in one track, the selected one filled; no option changes size. */
512
604
  function SegmentedControl({ options, value, onChange, label, fullWidth = false, className }) {
605
+ const group = useRef(null);
606
+ useIndicator(group, ".cpds-segmented__option[aria-pressed='true']", value);
513
607
  return /* @__PURE__ */ jsx("div", {
608
+ ref: group,
514
609
  role: "group",
515
610
  "aria-label": label,
516
611
  className: cx("cpds-segmented", fullWidth && "cpds-segmented--full-width", className),
@@ -534,6 +629,7 @@ function SegmentedControl({ options, value, onChange, label, fullWidth = false,
534
629
  function Tabs({ tabs, value, onChange, label, panels, className }) {
535
630
  const prefix = useId();
536
631
  const list = useRef(null);
632
+ useIndicator(list, ".cpds-tabs__tab[aria-selected=\"true\"]", value);
537
633
  const move = (event, index) => {
538
634
  const last = tabs.length - 1;
539
635
  const target = {
@@ -0,0 +1,9 @@
1
+ import { type RefObject } from "react";
2
+ /**
3
+ * Measures the element of `container` that matches `selector` and writes its box on the container as the custom
4
+ * properties --cpds-indicator-x, -y, -w and -h, so that one block drawn by the container can sit behind it.
5
+ * The container must be the offset parent of the element. It gets `data-indicator-ready` one frame after its first
6
+ * measure, so that the block is placed at once on the first render and slides only afterwards. A change of width
7
+ * measures again.
8
+ */
9
+ export declare function useIndicator(container: RefObject<HTMLElement | null>, selector: string, dependency: unknown): void;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * The class that restarts a one-off pulse each time `tone` changes, none before the first change.
3
+ * Two identical keyframes alternate, so that the pulse restarts without remounting the element.
4
+ */
5
+ export declare function useTonePulse(tone: string): string | undefined;
package/dist/styles.css CHANGED
@@ -238,7 +238,12 @@
238
238
 
239
239
  /* Motion */
240
240
  --duration-fast: 160ms;
241
+ --duration-moderate: 240ms;
242
+ --duration-slow: 320ms;
243
+ --duration-loop: 2s;
241
244
  --easing-standard: cubic-bezier(0.2, 0, 0, 1);
245
+ /* Starts gently: a height animated with the standard easing drops most of its change in its first frames. */
246
+ --easing-smooth: cubic-bezier(0.4, 0, 0.2, 1);
242
247
  }
243
248
 
244
249
  /* Base of every interface: the ground, the text color and the type of the page, and of any subtree forced to a theme. */
@@ -292,6 +297,34 @@
292
297
  color: var(--color-danger-text);
293
298
  }
294
299
 
300
+ /* Status dots, status badges and badges fade their colors to a new tone and pulse once in scale. */
301
+ :is(.cpds-status-dot, .cpds-status-badge, .cpds-badge) {
302
+ transition:
303
+ background-color var(--duration-moderate) var(--easing-standard),
304
+ border-color var(--duration-moderate) var(--easing-standard),
305
+ color var(--duration-moderate) var(--easing-standard);
306
+ }
307
+
308
+ .cpds-pulse-a {
309
+ animation: cpds-pulse-a var(--duration-moderate) var(--easing-standard);
310
+ }
311
+
312
+ .cpds-pulse-b {
313
+ animation: cpds-pulse-b var(--duration-moderate) var(--easing-standard);
314
+ }
315
+
316
+ @keyframes cpds-pulse-a {
317
+ 40% {
318
+ transform: scale(1.12);
319
+ }
320
+ }
321
+
322
+ @keyframes cpds-pulse-b {
323
+ 40% {
324
+ transform: scale(1.12);
325
+ }
326
+ }
327
+
295
328
  .cpds-icon {
296
329
  flex: none;
297
330
  display: inline-block;
@@ -332,6 +365,17 @@
332
365
  cursor: pointer;
333
366
  }
334
367
 
368
+ /* The outline stays out of the list: the focus ring appears at once. */
369
+ .cpds-button {
370
+ transition-property: background-color, border-color, color, filter, transform;
371
+ transition-duration: var(--duration-fast);
372
+ transition-timing-function: var(--easing-standard);
373
+ }
374
+
375
+ .cpds-button:active:not(:disabled) {
376
+ transform: scale(0.98);
377
+ }
378
+
335
379
  .cpds-button:focus-visible {
336
380
  outline: var(--focus-ring-width) solid var(--color-focus);
337
381
  outline-offset: var(--focus-ring-offset);
@@ -385,16 +429,6 @@
385
429
  }
386
430
  }
387
431
 
388
- @media (prefers-reduced-motion: reduce) {
389
- .cpds-button__lead {
390
- transition: none;
391
- }
392
-
393
- .cpds-button__spinner {
394
- animation: none;
395
- }
396
- }
397
-
398
432
  .cpds-button--primary {
399
433
  padding: 0 var(--space-5);
400
434
  background-color: var(--color-accent);
@@ -439,6 +473,17 @@
439
473
  cursor: pointer;
440
474
  }
441
475
 
476
+ /* The outline stays out of the list: the focus ring appears at once. */
477
+ .cpds-icon-button {
478
+ transition-property: background-color, border-color, color, filter, transform;
479
+ transition-duration: var(--duration-fast);
480
+ transition-timing-function: var(--easing-standard);
481
+ }
482
+
483
+ .cpds-icon-button:active:not(:disabled) {
484
+ transform: scale(0.98);
485
+ }
486
+
442
487
  .cpds-icon-button:focus-visible {
443
488
  outline: var(--focus-ring-width) solid var(--color-focus);
444
489
  outline-offset: var(--focus-ring-offset);
@@ -475,12 +520,17 @@
475
520
 
476
521
  .cpds-link {
477
522
  border-radius: var(--radius-control);
478
- text-decoration: none;
523
+ /* The underline is always there, transparent at rest, so that its color can fade with the text. */
524
+ text-decoration: underline;
525
+ text-decoration-color: transparent;
479
526
  text-underline-offset: 0.2em;
527
+ transition-property: color, text-decoration-color;
528
+ transition-duration: var(--duration-fast);
529
+ transition-timing-function: var(--easing-standard);
480
530
  }
481
531
 
482
532
  .cpds-link:hover {
483
- text-decoration: underline;
533
+ text-decoration-color: currentcolor;
484
534
  }
485
535
 
486
536
  .cpds-link:focus-visible {
@@ -531,7 +581,56 @@
531
581
  display: flex;
532
582
  align-items: center;
533
583
  gap: var(--space-1-5);
584
+ overflow: hidden;
585
+ /* Pulls the closed error over the frame's gap, so that a closed error takes no space at all. */
586
+ --cpds-field-error-pull: calc(var(--space-1-5) * -1);
534
587
  color: var(--color-danger-text);
588
+ interpolate-size: allow-keywords;
589
+ animation: cpds-field-error-in var(--duration-slow) var(--easing-smooth);
590
+ }
591
+
592
+ /* The error's space opens first, then the error fades in, in place, so that it never covers the input. */
593
+ @keyframes cpds-field-error-in {
594
+ from {
595
+ height: 0;
596
+ margin-top: var(--cpds-field-error-pull);
597
+ opacity: 0;
598
+ }
599
+
600
+ 40% {
601
+ opacity: 0;
602
+ }
603
+
604
+ to {
605
+ height: auto;
606
+ margin-top: 0;
607
+ opacity: 1;
608
+ }
609
+ }
610
+
611
+ /* A cleared error fades out in place, then its space closes. The frame keeps it mounted until this ends. */
612
+ .cpds-field__error--leaving {
613
+ animation: cpds-field-error-out var(--duration-slow) var(--easing-smooth) forwards;
614
+ }
615
+
616
+ @keyframes cpds-field-error-out {
617
+ from {
618
+ height: auto;
619
+ margin-top: 0;
620
+ opacity: 1;
621
+ }
622
+
623
+ 40% {
624
+ height: auto;
625
+ margin-top: 0;
626
+ opacity: 0;
627
+ }
628
+
629
+ to {
630
+ height: 0;
631
+ margin-top: var(--cpds-field-error-pull);
632
+ opacity: 0;
633
+ }
535
634
  }
536
635
 
537
636
  /* The text input and the text area share one look. */
@@ -543,11 +642,22 @@
543
642
  padding: var(--space-2-5) var(--space-3);
544
643
  border: var(--border-width) solid var(--color-border-control);
545
644
  border-radius: var(--radius-control);
546
- background-color: var(--color-surface);
645
+ background-color: var(--color-surface-subtle);
547
646
  color: var(--color-text);
548
647
  font-family: inherit;
549
648
  font-size: var(--font-size-base);
550
649
  line-height: var(--line-height-body);
650
+ transition:
651
+ border-color var(--duration-moderate) var(--easing-standard),
652
+ background-color var(--duration-moderate) var(--easing-standard);
653
+ }
654
+
655
+ .cpds-input:hover:not(:disabled) {
656
+ background-color: var(--color-surface);
657
+ }
658
+
659
+ .cpds-input:hover:not(:focus-visible, :disabled, [aria-invalid="true"]) {
660
+ border-color: var(--color-border-strong);
551
661
  }
552
662
 
553
663
  .cpds-input::placeholder {
@@ -556,6 +666,7 @@
556
666
 
557
667
  .cpds-input:focus-visible {
558
668
  border-color: var(--color-accent);
669
+ background-color: var(--color-surface);
559
670
  outline: var(--focus-ring-width) solid var(--color-focus);
560
671
  outline-offset: var(--focus-ring-offset);
561
672
  }
@@ -584,13 +695,117 @@ textarea.cpds-input {
584
695
  cursor: pointer;
585
696
  }
586
697
 
698
+ /*
699
+ * A native checkbox or radio draws its own mark, which CSS cannot animate. The input stays native for the keyboard,
700
+ * the form and assistive technologies, and draws itself with the same colors: accent fill, on-accent mark.
701
+ */
587
702
  .cpds-choice__input {
703
+ display: grid;
588
704
  flex: none;
705
+ place-content: center;
589
706
  width: var(--size-choice);
590
707
  height: var(--size-choice);
591
708
  margin: 0;
592
- accent-color: var(--color-accent);
709
+ box-sizing: border-box;
710
+ border: var(--border-width-strong) solid var(--color-border-control);
711
+ background-color: var(--color-surface);
593
712
  cursor: inherit;
713
+ appearance: none;
714
+ transition:
715
+ background-color var(--duration-moderate) var(--easing-standard),
716
+ border-color var(--duration-moderate) var(--easing-standard),
717
+ border-width var(--duration-moderate) var(--easing-standard);
718
+ }
719
+
720
+ /* The box pops once when it becomes checked. */
721
+ .cpds-choice__input:checked {
722
+ animation: cpds-choice-pop var(--duration-moderate) var(--easing-standard);
723
+ }
724
+
725
+ /* A checkbox's box is smaller than a control: half the control's radius keeps it square-ish. */
726
+ .cpds-choice__input[type="checkbox"] {
727
+ --cpds-choice-box-radius: calc(var(--radius-control) / 2);
728
+
729
+ border-radius: var(--cpds-choice-box-radius);
730
+ }
731
+
732
+ .cpds-choice__input[type="checkbox"]:checked {
733
+ border-color: var(--color-accent);
734
+ background-color: var(--color-accent);
735
+ }
736
+
737
+ /*
738
+ * The check mark: the icon set's check path, used as a mask over the on-accent color. It is wiped from the right, and
739
+ * hidden once the wipe ends; it is drawn from the left after half the fast duration, once the box has started to fill.
740
+ */
741
+ .cpds-choice__input[type="checkbox"]::before {
742
+ width: calc(var(--size-choice) - var(--space-1));
743
+ height: calc(var(--size-choice) - var(--space-1));
744
+ background-color: var(--color-on-accent);
745
+ content: "";
746
+ opacity: 0;
747
+ clip-path: inset(0 100% 0 0);
748
+ mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
749
+ transition:
750
+ clip-path var(--duration-slow) var(--easing-standard),
751
+ opacity 0s linear var(--duration-slow);
752
+ }
753
+
754
+ .cpds-choice__input[type="checkbox"]:checked::before {
755
+ opacity: 1;
756
+ clip-path: inset(0);
757
+ transition:
758
+ clip-path var(--duration-slow) var(--easing-standard) calc(var(--duration-fast) / 2),
759
+ opacity 0s;
760
+ }
761
+
762
+ .cpds-choice__input[type="radio"] {
763
+ border-radius: var(--radius-pill);
764
+ }
765
+
766
+ /* The checked radio's ring thickens. */
767
+ .cpds-choice__input[type="radio"]:checked {
768
+ border-width: calc(var(--border-width-strong) + var(--border-width));
769
+ border-color: var(--color-accent);
770
+ }
771
+
772
+ /*
773
+ * The dot grows past its size and settles when checked, and fades out when unchecked. At rest it keeps its size: a
774
+ * scale of zero there would hide it at once when the radio is unchecked, before its fade.
775
+ */
776
+ .cpds-choice__input[type="radio"]::before {
777
+ width: calc(var(--size-choice) / 2);
778
+ height: calc(var(--size-choice) / 2);
779
+ border-radius: var(--radius-pill);
780
+ background-color: var(--color-accent);
781
+ content: "";
782
+ opacity: 0;
783
+ transition: opacity var(--duration-fast) var(--easing-standard);
784
+ }
785
+
786
+ .cpds-choice__input[type="radio"]:checked::before {
787
+ opacity: 1;
788
+ animation: cpds-choice-dot var(--duration-slow) var(--easing-standard) forwards;
789
+ }
790
+
791
+ @keyframes cpds-choice-pop {
792
+ 40% {
793
+ transform: scale(0.88);
794
+ }
795
+ }
796
+
797
+ @keyframes cpds-choice-dot {
798
+ 0% {
799
+ transform: scale(0);
800
+ }
801
+
802
+ 60% {
803
+ transform: scale(1.25);
804
+ }
805
+
806
+ 100% {
807
+ transform: scale(1);
808
+ }
594
809
  }
595
810
 
596
811
  .cpds-choice__input:focus-visible {
@@ -793,7 +1008,7 @@ textarea.cpds-input {
793
1008
  .cpds-collapsible--row > .cpds-collapsible__content {
794
1009
  display: grid;
795
1010
  grid-template-rows: 0fr;
796
- transition: grid-template-rows var(--duration-fast) var(--easing-standard);
1011
+ transition: grid-template-rows var(--duration-slow) var(--easing-standard);
797
1012
  }
798
1013
 
799
1014
  .cpds-collapsible--row[data-expanded="true"] > .cpds-collapsible__content {
@@ -810,6 +1025,59 @@ textarea.cpds-input {
810
1025
  background-color: var(--color-surface-subtle);
811
1026
  }
812
1027
 
1028
+ /* The content fades and slides: out over the fast duration, in over the moderate one after half of it. */
1029
+ .cpds-collapsible--row > .cpds-collapsible__content > .cpds-collapsible__inner {
1030
+ opacity: 0;
1031
+ transition: opacity var(--duration-fast) var(--easing-standard);
1032
+ }
1033
+
1034
+ .cpds-collapsible--row[data-expanded="true"] > .cpds-collapsible__content > .cpds-collapsible__inner {
1035
+ opacity: 1;
1036
+ transition: opacity var(--duration-moderate) var(--easing-standard) calc(var(--duration-moderate) / 2);
1037
+ }
1038
+
1039
+ .cpds-collapsible--row > .cpds-collapsible__content > .cpds-collapsible__inner > * {
1040
+ transform: translateY(calc(var(--space-1) * -1));
1041
+ transition: transform var(--duration-fast) var(--easing-standard);
1042
+ }
1043
+
1044
+ .cpds-collapsible--row[data-expanded="true"] > .cpds-collapsible__content > .cpds-collapsible__inner > * {
1045
+ transform: none;
1046
+ transition: transform var(--duration-moderate) var(--easing-standard) calc(var(--duration-moderate) / 2);
1047
+ }
1048
+
1049
+ /*
1050
+ * Card: the content keeps the hidden attribute, yet opens and closes by its height. The display change is held
1051
+ * for the transition (allow-discrete) and the open state starts from a closed box (@starting-style).
1052
+ */
1053
+ .cpds-collapsible--card > .cpds-collapsible__content {
1054
+ overflow: hidden;
1055
+ height: auto;
1056
+ interpolate-size: allow-keywords;
1057
+ transition:
1058
+ height var(--duration-slow) var(--easing-standard),
1059
+ padding-block var(--duration-slow) var(--easing-standard),
1060
+ border-top-color var(--duration-slow) var(--easing-standard),
1061
+ opacity var(--duration-moderate) var(--easing-standard),
1062
+ display var(--duration-slow) allow-discrete;
1063
+ }
1064
+
1065
+ .cpds-collapsible--card > .cpds-collapsible__content[hidden] {
1066
+ height: 0;
1067
+ padding-block: 0;
1068
+ border-top-color: transparent;
1069
+ opacity: 0;
1070
+ }
1071
+
1072
+ @starting-style {
1073
+ .cpds-collapsible--card > .cpds-collapsible__content:not([hidden]) {
1074
+ height: 0;
1075
+ padding-block: 0;
1076
+ border-top-color: transparent;
1077
+ opacity: 0;
1078
+ }
1079
+ }
1080
+
813
1081
  /* The current row of its list: tinted in the accent, whatever its variant. */
814
1082
  .cpds-collapsible[data-selected] > .cpds-collapsible__trigger {
815
1083
  background-color: var(--color-accent-subtle);
@@ -819,13 +1087,6 @@ textarea.cpds-input {
819
1087
  border-color: var(--color-accent-border);
820
1088
  }
821
1089
 
822
- @media (prefers-reduced-motion: reduce) {
823
- .cpds-collapsible__chevron,
824
- .cpds-collapsible--row > .cpds-collapsible__content {
825
- transition: none;
826
- }
827
- }
828
-
829
1090
  .cpds-live {
830
1091
  display: inline-flex;
831
1092
  align-items: center;
@@ -851,6 +1112,25 @@ textarea.cpds-input {
851
1112
  background-color: transparent;
852
1113
  }
853
1114
 
1115
+ /* Only the live dot sends a halo; the offline ring stays still. */
1116
+ .cpds-live--live .cpds-live__dot {
1117
+ --halo-start: color-mix(in srgb, var(--color-success-indicator) 45%, transparent);
1118
+ --halo-end: color-mix(in srgb, var(--color-success-indicator) 0%, transparent);
1119
+
1120
+ animation: cpds-live-halo var(--duration-loop) var(--easing-standard) infinite;
1121
+ }
1122
+
1123
+ @keyframes cpds-live-halo {
1124
+ 0% {
1125
+ box-shadow: 0 0 0 0 var(--halo-start);
1126
+ }
1127
+
1128
+ 70%,
1129
+ 100% {
1130
+ box-shadow: 0 0 0 var(--space-1-5) var(--halo-end);
1131
+ }
1132
+ }
1133
+
854
1134
  .cpds-app-header {
855
1135
  display: flex;
856
1136
  flex-wrap: wrap;
@@ -909,6 +1189,45 @@ textarea.cpds-input {
909
1189
  display: flex;
910
1190
  align-items: center;
911
1191
  gap: var(--space-2-5);
1192
+ animation: cpds-banner-enter var(--duration-slow) var(--easing-standard);
1193
+ }
1194
+
1195
+ /* The exit fades the banner while it rises, then closes its height and the space below it. */
1196
+ .cpds-banner[data-leaving] {
1197
+ overflow: hidden;
1198
+ interpolate-size: allow-keywords;
1199
+ /* The stack's gap closes with the banner, so that nothing jumps when it leaves. */
1200
+ --cpds-banner-closed-gap: calc(var(--space-4) * -1);
1201
+ animation:
1202
+ cpds-banner-leave var(--duration-moderate) var(--easing-standard) forwards,
1203
+ cpds-banner-collapse var(--duration-moderate) var(--easing-smooth) var(--duration-moderate) forwards;
1204
+ }
1205
+
1206
+ @keyframes cpds-banner-enter {
1207
+ from {
1208
+ opacity: 0;
1209
+ transform: translateY(calc(var(--space-2) * -1));
1210
+ }
1211
+ }
1212
+
1213
+ @keyframes cpds-banner-leave {
1214
+ to {
1215
+ opacity: 0;
1216
+ transform: translateY(calc(var(--space-1) * -1));
1217
+ }
1218
+ }
1219
+
1220
+ @keyframes cpds-banner-collapse {
1221
+ from {
1222
+ height: auto;
1223
+ margin-bottom: 0;
1224
+ }
1225
+
1226
+ to {
1227
+ height: 0;
1228
+ padding-block: 0;
1229
+ margin-bottom: var(--cpds-banner-closed-gap);
1230
+ }
912
1231
  }
913
1232
 
914
1233
  .cpds-banner--info {
@@ -1204,10 +1523,27 @@ textarea.cpds-input {
1204
1523
  height: 100%;
1205
1524
  border-radius: var(--radius-pill);
1206
1525
  background-color: var(--color-info-indicator);
1526
+ transition:
1527
+ width var(--duration-slow) var(--easing-standard),
1528
+ background-color var(--duration-moderate) var(--easing-standard);
1207
1529
  }
1208
1530
 
1531
+ /* Reaching complete, the color waits for the fill to arrive; going back, it returns with the slide. */
1209
1532
  .cpds-progress[data-complete] .cpds-progress__fill {
1210
1533
  background-color: var(--color-success-indicator);
1534
+ transition:
1535
+ width var(--duration-slow) var(--easing-standard),
1536
+ background-color var(--duration-moderate) var(--easing-standard) var(--duration-slow);
1537
+ }
1538
+
1539
+ .cpds-progress[data-complete] .cpds-progress__track {
1540
+ animation: cpds-progress-glow calc(var(--duration-slow) * 2) var(--easing-standard) var(--duration-slow);
1541
+ }
1542
+
1543
+ @keyframes cpds-progress-glow {
1544
+ 40% {
1545
+ box-shadow: 0 0 0 var(--space-1) var(--color-success-bg);
1546
+ }
1211
1547
  }
1212
1548
 
1213
1549
  .cpds-filter-chip {
@@ -1223,6 +1559,9 @@ textarea.cpds-input {
1223
1559
  line-height: var(--line-height-control);
1224
1560
  white-space: nowrap;
1225
1561
  cursor: pointer;
1562
+ transition-property: color, background-color, border-color;
1563
+ transition-duration: var(--duration-fast);
1564
+ transition-timing-function: var(--easing-standard);
1226
1565
  }
1227
1566
 
1228
1567
  /* Off: outlined on the surface. On: the tone class gives the background and the text. */
@@ -1251,6 +1590,8 @@ textarea.cpds-input {
1251
1590
  }
1252
1591
 
1253
1592
  .cpds-segmented {
1593
+ position: relative;
1594
+ isolation: isolate;
1254
1595
  display: inline-flex;
1255
1596
  box-sizing: border-box;
1256
1597
  gap: var(--space-1);
@@ -1278,6 +1619,10 @@ textarea.cpds-input {
1278
1619
  line-height: var(--line-height-control);
1279
1620
  white-space: nowrap;
1280
1621
  cursor: pointer;
1622
+ position: relative;
1623
+ transition:
1624
+ color var(--duration-fast) var(--easing-standard),
1625
+ transform var(--duration-fast) var(--easing-standard);
1281
1626
  }
1282
1627
 
1283
1628
  .cpds-segmented--full-width > .cpds-segmented__option {
@@ -1298,11 +1643,35 @@ textarea.cpds-input {
1298
1643
  }
1299
1644
 
1300
1645
  .cpds-segmented__option[aria-pressed="true"] {
1301
- border-color: var(--color-accent);
1302
- background-color: var(--color-accent);
1646
+ border-color: transparent;
1647
+ background-color: transparent;
1303
1648
  color: var(--color-on-accent);
1304
1649
  }
1305
1650
 
1651
+ /* One accent block, drawn under the options, sits behind the selected one. */
1652
+ .cpds-segmented::before {
1653
+ position: absolute;
1654
+ top: 0;
1655
+ left: 0;
1656
+ z-index: -1;
1657
+ width: var(--cpds-indicator-w, 0);
1658
+ height: var(--cpds-indicator-h, 0);
1659
+ border-radius: var(--radius-control);
1660
+ background-color: var(--color-accent);
1661
+ content: "";
1662
+ transform: translate(var(--cpds-indicator-x, 0), var(--cpds-indicator-y, 0));
1663
+ }
1664
+
1665
+ .cpds-segmented[data-indicator-ready]::before {
1666
+ transition:
1667
+ transform var(--duration-slow) var(--easing-standard),
1668
+ width var(--duration-slow) var(--easing-standard);
1669
+ }
1670
+
1671
+ .cpds-segmented__option:active {
1672
+ transform: scale(0.96);
1673
+ }
1674
+
1306
1675
  .cpds-tabs {
1307
1676
  display: flex;
1308
1677
  flex-direction: column;
@@ -1312,6 +1681,7 @@ textarea.cpds-input {
1312
1681
  .cpds-tabs__list {
1313
1682
  display: flex;
1314
1683
  gap: var(--space-1);
1684
+ position: relative;
1315
1685
  overflow-x: auto;
1316
1686
  border-bottom: var(--border-width) solid var(--color-border-subtle);
1317
1687
  }
@@ -1334,6 +1704,7 @@ textarea.cpds-input {
1334
1704
  text-align: center;
1335
1705
  white-space: nowrap;
1336
1706
  cursor: pointer;
1707
+ transition: color var(--duration-fast) var(--easing-standard);
1337
1708
  }
1338
1709
 
1339
1710
  .cpds-tabs__tab:hover {
@@ -1345,8 +1716,8 @@ textarea.cpds-input {
1345
1716
  outline-offset: calc(var(--focus-ring-width) * -1);
1346
1717
  }
1347
1718
 
1719
+ /* The selected tab's own underline stays transparent: the list's one underline is drawn under it. */
1348
1720
  .cpds-tabs__tab[aria-selected="true"] {
1349
- border-bottom-color: var(--color-accent);
1350
1721
  color: var(--color-accent-text);
1351
1722
  }
1352
1723
 
@@ -1365,6 +1736,40 @@ textarea.cpds-input {
1365
1736
  .cpds-tabs__panel[data-active] {
1366
1737
  visibility: inherit;
1367
1738
  }
1739
+
1740
+ /* One underline, placed by useIndicator, slides to the selected tab; it sits there at once until the list is ready. */
1741
+ .cpds-tabs__list::after {
1742
+ position: absolute;
1743
+ bottom: 0;
1744
+ left: 0;
1745
+ width: var(--cpds-indicator-w, 0);
1746
+ height: var(--border-width-strong);
1747
+ background-color: var(--color-accent);
1748
+ content: "";
1749
+ transform: translateX(var(--cpds-indicator-x, 0));
1750
+ }
1751
+
1752
+ .cpds-tabs__list[data-indicator-ready]::after {
1753
+ transition:
1754
+ transform var(--duration-moderate) var(--easing-standard),
1755
+ width var(--duration-moderate) var(--easing-standard);
1756
+ }
1757
+
1758
+ /* The leaving panel fades out, then turns hidden; the coming one shows at once and fades in. */
1759
+ .cpds-tabs__panel {
1760
+ opacity: 0;
1761
+ transition:
1762
+ opacity var(--duration-fast) var(--easing-standard),
1763
+ visibility 0s linear var(--duration-fast);
1764
+ }
1765
+
1766
+ .cpds-tabs__panel[data-active] {
1767
+ opacity: 1;
1768
+ transition:
1769
+ opacity var(--duration-fast) var(--easing-standard),
1770
+ visibility 0s;
1771
+ }
1772
+
1368
1773
  /* Fills what its container gives it and scrolls beyond; in a flex or grid column, it takes the space left. */
1369
1774
  .cpds-scroll-area {
1370
1775
  flex: 1 1 auto;
@@ -1411,6 +1816,17 @@ textarea.cpds-input {
1411
1816
  cursor: pointer;
1412
1817
  }
1413
1818
 
1819
+ /* The outline stays out of the list: the focus ring appears at once. */
1820
+ .cpds-pill-button {
1821
+ transition-property: background-color, border-color, color, filter, transform;
1822
+ transition-duration: var(--duration-fast);
1823
+ transition-timing-function: var(--easing-standard);
1824
+ }
1825
+
1826
+ .cpds-pill-button:active:not(:disabled) {
1827
+ transform: scale(0.98);
1828
+ }
1829
+
1414
1830
  .cpds-pill-button:focus-visible {
1415
1831
  outline: var(--focus-ring-width) solid var(--color-focus);
1416
1832
  outline-offset: var(--focus-ring-offset);
@@ -1420,6 +1836,14 @@ textarea.cpds-input {
1420
1836
  background-color: var(--color-surface);
1421
1837
  }
1422
1838
 
1839
+ .cpds-pill-button--outline:hover {
1840
+ background-color: var(--color-surface-sunken);
1841
+ }
1842
+
1843
+ .cpds-pill-button--tinted:hover {
1844
+ filter: brightness(0.96);
1845
+ }
1846
+
1423
1847
  .cpds-pill-button-tone--neutral {
1424
1848
  border-color: var(--color-border-strong);
1425
1849
  }
@@ -1517,3 +1941,70 @@ textarea.cpds-input {
1517
1941
  font-weight: var(--font-weight-medium);
1518
1942
  text-overflow: ellipsis;
1519
1943
  }
1944
+
1945
+ /*
1946
+ * The one reduced-motion rule of the package: moves, size changes, opacity fades and loops stop; color changes keep
1947
+ * fading over their usual duration. What appears or disappears does so at once. Imported after every component, so
1948
+ * that it outranks their rules of the same weight.
1949
+ */
1950
+ @media (prefers-reduced-motion: reduce) {
1951
+ :is(.cpds-button, .cpds-icon-button, .cpds-pill-button) {
1952
+ transition-property: background-color, border-color, color, filter;
1953
+ }
1954
+
1955
+ :is(.cpds-button, .cpds-icon-button, .cpds-pill-button):active:not(:disabled),
1956
+ .cpds-segmented__option:active {
1957
+ transform: none;
1958
+ }
1959
+
1960
+ .cpds-segmented__option {
1961
+ transition-property: color;
1962
+ }
1963
+
1964
+ .cpds-choice__input {
1965
+ transition-property: background-color, border-color;
1966
+ }
1967
+
1968
+ .cpds-button__lead,
1969
+ .cpds-segmented[data-indicator-ready]::before,
1970
+ .cpds-tabs__list[data-indicator-ready]::after,
1971
+ .cpds-tabs__panel,
1972
+ .cpds-tabs__panel[data-active],
1973
+ .cpds-choice__input[type]::before,
1974
+ .cpds-choice__input[type]:checked::before,
1975
+ .cpds-collapsible__chevron,
1976
+ .cpds-collapsible--row > .cpds-collapsible__content,
1977
+ .cpds-collapsible--row > .cpds-collapsible__content > .cpds-collapsible__inner,
1978
+ .cpds-collapsible--row[data-expanded="true"] > .cpds-collapsible__content > .cpds-collapsible__inner {
1979
+ transition: none;
1980
+ }
1981
+
1982
+ .cpds-collapsible--row > .cpds-collapsible__content > .cpds-collapsible__inner > *,
1983
+ .cpds-collapsible--row[data-expanded="true"] > .cpds-collapsible__content > .cpds-collapsible__inner > * {
1984
+ transform: none;
1985
+ transition: none;
1986
+ }
1987
+
1988
+ .cpds-collapsible--card > .cpds-collapsible__content {
1989
+ transition: border-top-color var(--duration-slow) var(--easing-standard);
1990
+ }
1991
+
1992
+ .cpds-progress .cpds-progress__fill,
1993
+ .cpds-progress[data-complete] .cpds-progress__fill {
1994
+ transition: background-color var(--duration-moderate) var(--easing-standard);
1995
+ }
1996
+
1997
+ .cpds-button__spinner,
1998
+ .cpds-choice__input:checked,
1999
+ .cpds-choice__input[type]:checked::before,
2000
+ .cpds-progress[data-complete] .cpds-progress__track,
2001
+ .cpds-banner,
2002
+ .cpds-banner[data-leaving],
2003
+ .cpds-field__error,
2004
+ .cpds-field__error--leaving,
2005
+ .cpds-live--live .cpds-live__dot,
2006
+ .cpds-pulse-a,
2007
+ .cpds-pulse-b {
2008
+ animation: none;
2009
+ }
2010
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@walco-ai/claude-plugin-design-system",
3
- "version": "0.3.2",
3
+ "version": "0.4.0",
4
4
  "description": "Design tokens, base components and patterns for the web interfaces of Claude Code plugins.",
5
5
  "license": "MIT",
6
6
  "type": "module",