takibi-design-system 0.1.0 → 0.2.1

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 (62) hide show
  1. package/LICENSES/CC-BY-SA-4.0.txt +428 -0
  2. package/README.md +13 -1
  3. package/dist/tokens.css +94 -52
  4. package/dist/tokens.json +269 -120
  5. package/package.json +17 -4
  6. package/src/components/accordion.tsx +1 -1
  7. package/src/components/alert-dialog.tsx +1 -1
  8. package/src/components/animated-number.tsx +4 -4
  9. package/src/components/avatar.tsx +1 -1
  10. package/src/components/banner.tsx +1 -1
  11. package/src/components/button.tsx +8 -31
  12. package/src/components/calendar.tsx +4 -4
  13. package/src/components/collapsible.tsx +1 -1
  14. package/src/components/combobox.tsx +3 -3
  15. package/src/components/command.tsx +1 -1
  16. package/src/components/dialog.tsx +1 -1
  17. package/src/components/drawer.tsx +4 -4
  18. package/src/components/empty-state.tsx +1 -1
  19. package/src/components/file-drop.tsx +2 -2
  20. package/src/components/interactive-card.tsx +21 -8
  21. package/src/components/link.tsx +1 -1
  22. package/src/components/list.tsx +3 -3
  23. package/src/components/meter.tsx +3 -1
  24. package/src/components/nav-list.tsx +1 -1
  25. package/src/components/navigation-menu.tsx +5 -5
  26. package/src/components/number-field.tsx +31 -5
  27. package/src/components/otp-field.tsx +1 -1
  28. package/src/components/preview-card.tsx +1 -1
  29. package/src/components/progress.tsx +1 -1
  30. package/src/components/radio-group.tsx +1 -1
  31. package/src/components/rating.tsx +3 -3
  32. package/src/components/scroll-area.tsx +1 -1
  33. package/src/components/select.tsx +1 -1
  34. package/src/components/skip-link.tsx +2 -2
  35. package/src/components/slider.tsx +7 -7
  36. package/src/components/sparks.tsx +110 -0
  37. package/src/components/steps.tsx +1 -1
  38. package/src/components/table.tsx +1 -1
  39. package/src/components/tag.tsx +3 -3
  40. package/src/components/theme-toggle.tsx +43 -15
  41. package/src/components/tree-view.tsx +2 -2
  42. package/src/embers.d.ts +3 -5
  43. package/src/embers.js +138 -247
  44. package/src/fire/base-day.webp +0 -0
  45. package/src/fire/base-night.webp +0 -0
  46. package/src/fire/engine.js +1067 -0
  47. package/src/fire/flame-still.webp +0 -0
  48. package/src/fire/flame.mp4 +0 -0
  49. package/src/fire/lit.webp +0 -0
  50. package/src/fire.d.ts +108 -0
  51. package/src/fire.js +618 -0
  52. package/src/index.ts +13 -1
  53. package/src/lib/daylight.ts +80 -0
  54. package/src/lib/glide.tsx +1 -1
  55. package/src/lib/motion.ts +21 -14
  56. package/src/lib/theme.ts +11 -4
  57. package/src/lib/warmth.ts +12 -0
  58. package/src/motion.css +370 -58
  59. package/src/stars-data.js +14 -0
  60. package/src/stars.d.ts +21 -0
  61. package/src/stars.js +181 -0
  62. package/src/tokens.css +275 -135
@@ -70,12 +70,12 @@ const Digit = React.forwardRef<HTMLSpanElement, { digit: number; reduce: boolean
70
70
  initial={reduce ? false : enter}
71
71
  animate={rest}
72
72
  exit={reduce ? undefined : exit}
73
- transition={springs.soft}
73
+ transition={springs.ignite}
74
74
  data-glow={glowing || undefined}
75
75
  className={cn(
76
76
  "relative inline-block h-[1lh] overflow-x-visible overflow-y-clip",
77
77
  "transition-[color,text-shadow] duration-[900ms] ease-standard",
78
- "data-glow:text-brand data-glow:duration-(--duration-fast) data-glow:[text-shadow:0_0_12px_rgb(244_125_58/0.65)]",
78
+ "data-glow:text-brand data-glow:duration-(--duration-fast) data-glow:[text-shadow:0_0_12px_color-mix(in_oklab,var(--color-heat-ember)_65%,transparent)]",
79
79
  )}
80
80
  >
81
81
  {/* 幅を決めるための見えない数字 */}
@@ -84,7 +84,7 @@ const Digit = React.forwardRef<HTMLSpanElement, { digit: number; reduce: boolean
84
84
  className="absolute inset-x-0 top-0 flex flex-col items-center"
85
85
  initial={false}
86
86
  animate={{ y: `${digit * -10}%` }}
87
- transition={reduce ? { duration: 0 } : springs.soft}
87
+ transition={reduce ? { duration: 0 } : springs.ignite}
88
88
  >
89
89
  {digits.map((n) => (
90
90
  <span key={n} className="h-[1lh]">
@@ -107,7 +107,7 @@ const Glyph = React.forwardRef<HTMLSpanElement, { char: string; reduce: boolean
107
107
  initial={reduce ? false : enter}
108
108
  animate={rest}
109
109
  exit={reduce ? undefined : exit}
110
- transition={springs.soft}
110
+ transition={springs.ignite}
111
111
  className="inline-block whitespace-pre"
112
112
  >
113
113
  {char}
@@ -36,7 +36,7 @@ export function Avatar({ className, size, ...props }: AvatarProps) {
36
36
  className={cn(
37
37
  avatarVariants({ size: size ?? group.size }),
38
38
  group.grouped &&
39
- "ring-2 ring-surface transition-[translate] duration-(--duration-spring-press) ease-spring-press hover:z-10 hover:-translate-y-0.5",
39
+ "ring-2 ring-surface transition-[translate] duration-(--duration-land) ease-land hover:z-10 hover:-translate-y-0.5",
40
40
  className,
41
41
  )}
42
42
  {...props}
@@ -72,7 +72,7 @@ export function Banner({
72
72
  data-slot="banner-fold"
73
73
  className={cn(
74
74
  "overflow-hidden",
75
- "h-(--collapsible-panel-height) transition-[height] duration-(--duration-spring-glide) ease-spring-glide",
75
+ "h-(--collapsible-panel-height) transition-[height] duration-(--duration-sway) ease-sway",
76
76
  "data-starting-style:h-0 data-ending-style:h-0",
77
77
  // 閉じるときは開くときと同じ形のまま、少しだけ速くたたむ
78
78
  "data-ending-style:duration-[260ms]",
@@ -4,12 +4,14 @@ import { AnimatePresence, motion, useReducedMotion } from "motion/react";
4
4
  import * as React from "react";
5
5
  import { cn } from "../lib/cn";
6
6
  import { amplitude, springs, swap } from "../lib/motion";
7
+ import { Sparks } from "./sparks";
7
8
  import { Spinner } from "./spinner";
8
9
 
9
10
  export const buttonVariants = cva(
10
11
  [
11
12
  "relative inline-flex shrink-0 items-center justify-center gap-2 whitespace-nowrap rounded-md font-medium select-none",
12
- "transition-[color,background-color,border-color,box-shadow] duration-(--duration-fast) ease-standard",
13
+ // 余熱: hover の光は 120ms で出て、離れると 560ms かけて消える
14
+ "motion-afterglow",
13
15
  "outline-none focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
14
16
  "disabled:cursor-not-allowed disabled:opacity-50 data-disabled:cursor-not-allowed data-disabled:opacity-50",
15
17
  "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
@@ -109,7 +111,7 @@ export function Button({
109
111
  render={
110
112
  <motion.button
111
113
  animate={width === undefined ? undefined : { width }}
112
- transition={reduce ? { duration: 0 } : { scale: springs.press, width: springs.glide }}
114
+ transition={reduce ? { duration: 0 } : { scale: springs.land, width: springs.sway }}
113
115
  whileHover={moves ? { scale: amplitude.hover } : undefined}
114
116
  whileTap={moves ? { scale: pressScale, transition: pressIn } : undefined}
115
117
  />
@@ -137,7 +139,8 @@ export function Button({
137
139
  </motion.span>
138
140
  </AnimatePresence>
139
141
  </span>
140
- {status === "success" && <Embers key="embers" />}
142
+ {/* はぜる: 完了の瞬間に、右上の角の 1 点から火の粉が 6 つ飛ぶ */}
143
+ {status === "success" && <Sparks key="sparks" count={6} from="corner" />}
141
144
  <span className="sr-only" aria-live="polite">
142
145
  {status === "success" ? successLabel : ""}
143
146
  </span>
@@ -150,7 +153,7 @@ export function Button({
150
153
  }
151
154
 
152
155
  /**
153
- * 中身の幅を測り、ボタンの幅をばねで追わせる。中身が入れ替わっても形が切れずに伸び縮みする。
156
+ * 中身の幅を測り、ボタンの幅を揺れる曲線で追わせる。中身が入れ替わっても形が切れずに伸び縮みする。
154
157
  * ボタンの左右の余白と枠線は、測った値に足して返す。
155
158
  */
156
159
  function useMorphWidth(
@@ -216,31 +219,5 @@ function DrawnCheck() {
216
219
  );
217
220
  }
218
221
 
219
- /** 押し込むときは速く沈める。離したときは transition の press のばねで弾んで戻る */
222
+ /** 押し込むときは速く沈める。離したときは transition の載る曲線(springs.land)で跳ね返ってから戻る */
220
223
  const pressIn = { duration: 0.15, ease: [0.16, 1, 0.3, 1] } as const;
221
-
222
- /** はぜる: 完了の瞬間に、ボタンの上の縁から火の粉が 6 つだけ舞い上がる */
223
- const sparks = [
224
- { left: "18%", x: "-6px", y: "-18px", d: "0ms" },
225
- { left: "32%", x: "3px", y: "-26px", d: "60ms" },
226
- { left: "46%", x: "-3px", y: "-20px", d: "20ms" },
227
- { left: "58%", x: "5px", y: "-30px", d: "90ms" },
228
- { left: "71%", x: "-4px", y: "-22px", d: "40ms" },
229
- { left: "84%", x: "6px", y: "-16px", d: "110ms" },
230
- ];
231
-
232
- function Embers() {
233
- return (
234
- <span aria-hidden className="motion-flare pointer-events-none absolute inset-0 rounded-[inherit]">
235
- {sparks.map((s) => (
236
- <span
237
- key={s.left}
238
- className="motion-spark absolute top-0 size-[3px] rounded-full bg-(--ember-300)"
239
- style={
240
- { left: s.left, "--spark-x": s.x, "--spark-y": s.y, "--spark-delay": s.d } as React.CSSProperties
241
- }
242
- />
243
- ))}
244
- </span>
245
- );
246
- }
@@ -163,7 +163,7 @@ function CaptionLabel({ children, className, ...props }: React.HTMLAttributes<HT
163
163
 
164
164
  const captionVariants: Variants = {
165
165
  enter: (d: number) => ({ opacity: 0, x: d * 12, filter: "blur(2px)" }),
166
- center: { opacity: 1, x: 0, filter: "blur(0px)", transition: springs.soft },
166
+ center: { opacity: 1, x: 0, filter: "blur(0px)", transition: springs.ignite },
167
167
  exit: (d: number) => ({
168
168
  opacity: 0,
169
169
  x: d * -12,
@@ -181,7 +181,7 @@ function Weeks(props: WeeksProps) {
181
181
  key={monthKey}
182
182
  initial={still ? false : { opacity: 0, x: direction * 16 }}
183
183
  animate={{ opacity: 1, x: 0 }}
184
- transition={{ x: springs.soft, opacity: { duration: 0.2, ease: [0.2, 0.8, 0.2, 1] } }}
184
+ transition={{ x: springs.ignite, opacity: { duration: 0.2, ease: [0.2, 0.8, 0.2, 1] } }}
185
185
  {...(props as React.ComponentProps<typeof motion.tbody>)}
186
186
  />
187
187
  );
@@ -251,9 +251,9 @@ function DayButton({ day, modifiers, className, children, ...props }: DayButtonP
251
251
  layoutId={reduce ? undefined : layoutId}
252
252
  initial={layoutId || reduce ? false : { opacity: 0, scale: 0.6 }}
253
253
  animate={{ opacity: 1, scale: 1 }}
254
- transition={layoutId ? springs.glide : springs.snappy}
254
+ transition={layoutId ? springs.sway : springs.pop}
255
255
  className={cn(
256
- "absolute inset-0 -z-10 rounded-md bg-brand shadow-[0_2px_10px_rgb(244_125_58/0.25)]",
256
+ "absolute inset-0 -z-10 rounded-md bg-brand shadow-[0_2px_10px_color-mix(in_oklab,var(--color-heat-ember)_25%,transparent)]",
257
257
  day.outside && "opacity-60",
258
258
  )}
259
259
  />
@@ -44,7 +44,7 @@ export function CollapsibleTrigger({
44
44
  {showIcon && (
45
45
  <ChevronDown
46
46
  aria-hidden
47
- className="size-4 shrink-0 text-fg-muted transition-[rotate,color] duration-(--duration-spring-press) ease-spring-press group-hover:text-fg group-data-panel-open:rotate-180"
47
+ className="size-4 shrink-0 text-fg-muted [transition:rotate_var(--duration-sway)_var(--ease-sway),color_var(--duration-fast)_var(--ease-standard)] group-hover:text-fg group-data-panel-open:rotate-180"
48
48
  />
49
49
  )}
50
50
  </BaseCollapsible.Trigger>
@@ -84,7 +84,7 @@ export function ComboboxInput({
84
84
  aria-label="候補を開く"
85
85
  className={cn(trailingButtonClass)}
86
86
  >
87
- <ChevronDown className="size-4 transition-[rotate] duration-(--duration-spring-press) ease-spring-press [[data-popup-open]>&]:rotate-180" />
87
+ <ChevronDown className="size-4 transition-[rotate] duration-(--duration-sway) ease-sway [[data-popup-open]>&]:rotate-180" />
88
88
  </BaseCombobox.Trigger>
89
89
  </span>
90
90
  </BaseCombobox.InputGroup>
@@ -175,7 +175,7 @@ export function ComboboxChips({
175
175
  aria-label="候補を開く"
176
176
  className={cn(trailingButtonClass, "self-start")}
177
177
  >
178
- <ChevronDown className="size-4 transition-[rotate] duration-(--duration-spring-press) ease-spring-press [[data-popup-open]>&]:rotate-180" />
178
+ <ChevronDown className="size-4 transition-[rotate] duration-(--duration-sway) ease-sway [[data-popup-open]>&]:rotate-180" />
179
179
  </BaseCombobox.Trigger>
180
180
  </BaseCombobox.InputGroup>
181
181
  );
@@ -208,7 +208,7 @@ export function ComboboxChip({ className, children, removeLabel, ...props }: Com
208
208
  ? { opacity: 0, transition: { duration: 0 } }
209
209
  : { opacity: 0, scale: 0.8, transition: { duration: 0.12, ease: [0.16, 1, 0.3, 1] } }
210
210
  }
211
- transition={springs.snappy}
211
+ transition={springs.pop}
212
212
  />
213
213
  }
214
214
  {...props}
@@ -20,7 +20,7 @@ export function CommandDialog({ label = "コマンド", className, children, ...
20
20
  return (
21
21
  <BaseDialog.Root {...props}>
22
22
  <BaseDialog.Portal>
23
- <BaseDialog.Backdrop className="motion-backdrop fixed inset-0 z-50 bg-[rgb(10_9_7/0.6)] backdrop-blur-[2px]" />
23
+ <BaseDialog.Backdrop className="motion-backdrop fixed inset-0 z-50 bg-backdrop backdrop-blur-[2px]" />
24
24
  <BaseDialog.Viewport className="fixed inset-0 z-50 flex items-start justify-center px-4 pt-[min(18vh,9rem)]">
25
25
  <BaseDialog.Popup
26
26
  data-slot="command-dialog"
@@ -18,7 +18,7 @@ export function DialogBackdrop({ className, ...props }: React.ComponentProps<typ
18
18
  return (
19
19
  <BaseDialog.Backdrop
20
20
  data-slot="dialog-backdrop"
21
- className={cn("motion-backdrop fixed inset-0 z-50 bg-[rgb(10_9_7/0.6)] backdrop-blur-[2px]", className)}
21
+ className={cn("motion-backdrop fixed inset-0 z-50 bg-backdrop backdrop-blur-[2px]", className)}
22
22
  {...props}
23
23
  />
24
24
  );
@@ -43,7 +43,7 @@ export function DrawerBackdrop({ className, ...props }: React.ComponentProps<typ
43
43
  <BaseDrawer.Backdrop
44
44
  data-slot="drawer-backdrop"
45
45
  className={cn(
46
- "fixed inset-0 z-50 min-h-dvh bg-[rgb(10_9_7)] backdrop-blur-[2px]",
46
+ "fixed inset-0 z-50 min-h-dvh bg-backdrop-solid backdrop-blur-[2px]",
47
47
  "opacity-[calc(0.6*(1-var(--drawer-swipe-progress,0)))]",
48
48
  "transition-opacity duration-(--duration-slow) ease-standard",
49
49
  "data-starting-style:opacity-0 data-ending-style:opacity-0",
@@ -57,7 +57,7 @@ export function DrawerBackdrop({ className, ...props }: React.ComponentProps<typ
57
57
  }
58
58
 
59
59
  /*
60
- * 面の動き。開くときは soft のばねで端から滑り込み、少し行き過ぎて止まる。
60
+ * 面の動き。開くときは着火の曲線で端から滑り込み、8% 行き過ぎて止まる。
61
61
  * 行き過ぎた分で端に隙間が見えないよう、::after で面の外側に同じ色の帯(--bleed)を足す。
62
62
  * 閉じるときは、はじいた勢い(--drawer-swipe-strength)で速さを変え、速い減速で引っ込む。
63
63
  * 指で引いている間(data-swiping)は transition を切り、指にそのまま付いてくる。
@@ -65,7 +65,7 @@ export function DrawerBackdrop({ className, ...props }: React.ComponentProps<typ
65
65
  const popupBase = [
66
66
  "group/drawer fixed z-50 flex flex-col bg-surface-overlay text-fg shadow-pop outline-none [--bleed:3rem]",
67
67
  "after:pointer-events-none after:absolute after:bg-inherit after:content-['']",
68
- "transition-[transform,box-shadow] duration-(--duration-spring-soft) ease-spring-soft",
68
+ "transition-[transform,box-shadow] duration-(--duration-ignite) ease-ignite",
69
69
  "data-ending-style:duration-[calc(var(--drawer-swipe-strength,1)*320ms)] data-ending-style:ease-out-expo",
70
70
  "data-swiping:duration-0 data-swiping:select-none",
71
71
  "data-starting-style:shadow-none data-ending-style:shadow-none",
@@ -142,7 +142,7 @@ function DrawerHandle() {
142
142
  <span
143
143
  className={cn(
144
144
  "h-1 w-10 rounded-full bg-line-strong",
145
- "transition-[width,background-color] duration-(--duration-spring-press) ease-spring-press",
145
+ "transition-[width,background-color] duration-(--duration-land) ease-land",
146
146
  "group-data-swiping/drawer:w-12 group-data-swiping/drawer:bg-fg-muted",
147
147
  )}
148
148
  />
@@ -52,7 +52,7 @@ export function EmptyStateIcon({ className, ...props }: EmptyStateIconProps) {
52
52
  data-slot="empty-state-icon"
53
53
  initial={reduce ? false : { opacity: 0, y: 8, scale: 0.92, filter: "blur(4px)" }}
54
54
  animate={{ opacity: 1, y: 0, scale: 1, filter: "blur(0px)" }}
55
- transition={springs.soft}
55
+ transition={springs.ignite}
56
56
  className={cn(
57
57
  "relative flex items-center justify-center rounded-full border border-line-subtle bg-surface-raised text-fg-muted",
58
58
  "shadow-[var(--shadow-rim),var(--shadow-glow-soft)]",
@@ -173,7 +173,7 @@ export function FileDrop({
173
173
  size === "md" ? "size-11 [&_svg]:size-5" : "size-8 [&_svg]:size-4",
174
174
  )}
175
175
  animate={dragging && !reduce ? { y: -4, scale: 1.08 } : { y: 0, scale: 1 }}
176
- transition={springs.press}
176
+ transition={springs.land}
177
177
  >
178
178
  <Upload />
179
179
  </motion.span>
@@ -241,7 +241,7 @@ function FileDropItem({
241
241
  ? { opacity: 0, transition: { duration: 0 } }
242
242
  : { opacity: 0, y: -8, filter: "blur(2px)", transition: { duration: 0.2, ease: [0.16, 1, 0.3, 1] } }
243
243
  }
244
- transition={springs.soft}
244
+ transition={springs.ignite}
245
245
  className="flex items-center gap-3 rounded-md border border-line bg-surface-raised py-1.5 pr-1.5 pl-1.5 shadow-rim"
246
246
  >
247
247
  <span className="flex size-9 shrink-0 items-center justify-center overflow-hidden rounded-sm bg-surface-sunken text-fg-muted">
@@ -2,20 +2,22 @@ import { useRender } from "@base-ui/react/use-render";
2
2
  import { ArrowRight } from "lucide-react";
3
3
  import type * as React from "react";
4
4
  import { cn } from "../lib/cn";
5
+ import { trackWarmth } from "../lib/warmth";
5
6
 
6
7
  /*
7
- * 持ち上がり: hover で 2px 上がり、枠線にブランドカラーが混ざって、外側に薄い光の影が付く。押すと 0.98 倍に沈み、離すとばねで戻る。
8
+ * 持ち上がり: hover で 2px 上がり、枠線にブランドカラーが混ざって、外側に薄い光の影が付く。押すと 0.98 倍に沈み、離すと載る曲線で戻る。
8
9
  * 動きは translate と scale に分けて持つので、持ち上がったまま押し込める。
9
- * 持ち上げと戻りは soft のばね、押し込みだけは速い減速にする。
10
+ * 持ち上げと戻りは着火の曲線、押し込みから戻る大きさは載る曲線、押し込みだけは速い減速にする。
11
+ * 手元の光: hover の間、ポインターの位置を中心に半径 220px の淡い光が面に乗る。離れると 560ms かけて消える。
10
12
  */
11
13
  const lift = [
12
14
  "group/card relative flex flex-col gap-2 rounded-lg border border-line-subtle bg-surface-raised p-5 text-left text-fg shadow-[var(--shadow-card)]",
13
- "cursor-pointer outline-none select-none",
15
+ "cursor-pointer outline-none select-none motion-warmth",
14
16
  "[--card-rim:color-mix(in_oklab,var(--color-brand)_32%,var(--color-line-subtle))]",
15
17
  "[--card-glow:0_0_0_1px_color-mix(in_oklab,var(--color-brand)_14%,transparent),0_10px_32px_-6px_color-mix(in_oklab,var(--color-brand)_24%,transparent)]",
16
- "[transition:translate_var(--duration-spring-soft)_var(--ease-spring-soft),scale_var(--duration-spring-press)_var(--ease-spring-press),box-shadow_var(--duration-base)_var(--ease-ember),border-color_var(--duration-base)_var(--ease-ember),background-color_var(--duration-fast)_var(--ease-standard)]",
18
+ "[transition:translate_var(--duration-ignite)_var(--ease-ignite),scale_var(--duration-land)_var(--ease-land),box-shadow_var(--duration-base)_var(--ease-ember),border-color_var(--duration-base)_var(--ease-ember),background-color_var(--duration-fast)_var(--ease-standard)]",
17
19
  "hover:-translate-y-0.5 hover:border-(--card-rim) hover:shadow-[var(--shadow-card),var(--card-glow)]",
18
- "active:scale-(--press-scale-surface) active:[transition:translate_var(--duration-spring-soft)_var(--ease-spring-soft),scale_150ms_var(--ease-out-expo),box-shadow_var(--duration-base)_var(--ease-ember),border-color_var(--duration-base)_var(--ease-ember)]",
20
+ "active:scale-(--press-scale-surface) active:[transition:translate_var(--duration-ignite)_var(--ease-ignite),scale_150ms_var(--ease-out-expo),box-shadow_var(--duration-base)_var(--ease-ember),border-color_var(--duration-base)_var(--ease-ember)]",
19
21
  "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
20
22
  "aria-disabled:pointer-events-none aria-disabled:opacity-50",
21
23
  ];
@@ -29,7 +31,14 @@ export type InteractiveCardProps = useRender.ComponentProps<"button"> & {
29
31
  * カード全体を押せるようにする。記事や記録の一覧から、詳しいページへ移るときに使う。
30
32
  * 中にほかのボタンやリンクは置かない(押せる場所が重なるため)。中に操作が要るなら Card を使う。
31
33
  */
32
- export function InteractiveCard({ href, className, render, ref, ...props }: InteractiveCardProps) {
34
+ export function InteractiveCard({
35
+ href,
36
+ className,
37
+ render,
38
+ ref,
39
+ onPointerMove,
40
+ ...props
41
+ }: InteractiveCardProps) {
33
42
  return useRender({
34
43
  defaultTagName: href ? "a" : "button",
35
44
  render,
@@ -38,6 +47,10 @@ export function InteractiveCard({ href, className, render, ref, ...props }: Inte
38
47
  "data-slot": "interactive-card",
39
48
  ...(href ? { href } : { type: "button" }),
40
49
  ...props,
50
+ onPointerMove: (event: React.PointerEvent<HTMLButtonElement>) => {
51
+ trackWarmth(event);
52
+ onPointerMove?.(event);
53
+ },
41
54
  className: cn(lift, className),
42
55
  },
43
56
  });
@@ -67,7 +80,7 @@ export function InteractiveCardDescription({ className, ...props }: React.Compon
67
80
  }
68
81
 
69
82
  /**
70
- * 進む向きを示す矢印。カードに hover すると、ばねで 3px 前へ寄り、ブランドカラーになる。
83
+ * 進む向きを示す矢印。カードに hover すると、はぜる曲線で 3px 前へ寄り、ブランドカラーになる。
71
84
  * 押している間は、もう 1px 先へ出る。
72
85
  */
73
86
  export function InteractiveCardArrow({ className, ...props }: React.ComponentProps<typeof ArrowRight>) {
@@ -77,7 +90,7 @@ export function InteractiveCardArrow({ className, ...props }: React.ComponentPro
77
90
  aria-hidden
78
91
  className={cn(
79
92
  "size-4 shrink-0 text-fg-subtle",
80
- "transition-[translate,color] duration-(--duration-spring-snappy) ease-spring-snappy",
93
+ "transition-[translate,color] duration-(--duration-pop) ease-pop",
81
94
  "group-hover/card:translate-x-[3px] group-hover/card:text-brand group-active/card:translate-x-1",
82
95
  className,
83
96
  )}
@@ -86,7 +86,7 @@ export function Link({
86
86
  "ml-0.5 inline-block size-[0.9em] align-[-0.1em]",
87
87
  "transition-[translate] duration-150 ease-out-expo",
88
88
  "group-hover/link:translate-x-0.5 group-hover/link:-translate-y-0.5",
89
- "group-hover/link:duration-(--duration-spring-snappy) group-hover/link:ease-spring-snappy",
89
+ "group-hover/link:duration-(--duration-pop) group-hover/link:ease-pop",
90
90
  )}
91
91
  />
92
92
  <span className="sr-only">(新しいタブで開く)</span>
@@ -57,7 +57,7 @@ export function InteractiveList({ className, ...props }: React.ComponentProps<"u
57
57
  }
58
58
 
59
59
  /**
60
- * 1 行。hover で背景の色が付き、押すと行全体が 0.98 倍に縮み、離すとばねで戻る。
60
+ * 1 行。hover で背景の色が付き、押すと行全体が 0.98 倍に縮み、離すと載る曲線で戻る。
61
61
  * 右端の操作(ListItemTrailing の中のボタン)を押したときは、行は縮まない。
62
62
  */
63
63
  export function InteractiveListItem({ className, ...props }: React.ComponentProps<"li">) {
@@ -66,7 +66,7 @@ export function InteractiveListItem({ className, ...props }: React.ComponentProp
66
66
  data-slot="interactive-list-item"
67
67
  className={cn(
68
68
  "group/row relative isolate flex items-center gap-3 rounded-md px-3 py-2.5",
69
- "[transition:background-color_var(--duration-fast)_var(--ease-standard),scale_var(--duration-spring-press)_var(--ease-spring-press)]",
69
+ "[transition:background-color_var(--duration-fast)_var(--ease-standard),scale_var(--duration-land)_var(--ease-land)]",
70
70
  "has-[[data-slot=list-item-button]:hover]:bg-surface-hover",
71
71
  "has-[[data-slot=list-item-button]:active]:scale-(--press-scale-surface)",
72
72
  "has-[[data-slot=list-item-button]:active]:[transition:background-color_var(--duration-fast)_var(--ease-standard),scale_150ms_var(--ease-out-expo)]",
@@ -167,7 +167,7 @@ export function ListItemChevron({ className, ...props }: React.ComponentProps<ty
167
167
  aria-hidden
168
168
  className={cn(
169
169
  "pointer-events-none ml-auto size-4 shrink-0 text-fg-subtle",
170
- "transition-[translate,color] duration-(--duration-spring-snappy) ease-spring-snappy",
170
+ "transition-[translate,color] duration-(--duration-pop) ease-pop",
171
171
  "group-has-[[data-slot=list-item-button]:hover]/row:translate-x-0.5 group-has-[[data-slot=list-item-button]:hover]/row:text-fg-muted",
172
172
  className,
173
173
  )}
@@ -77,7 +77,9 @@ export function Meter({
77
77
  "h-1.5 flex-1 rounded-full bg-surface-sunken shadow-[inset_0_0_0_1px_var(--color-line-subtle)]",
78
78
  "transition-[background-color,box-shadow] duration-(--duration-slow) ease-standard",
79
79
  "data-lit:shadow-none",
80
- lit && level === segments && "shadow-[0_0_10px_rgb(244_125_58/0.35)]!",
80
+ lit &&
81
+ level === segments &&
82
+ "shadow-[0_0_10px_color-mix(in_oklab,var(--color-heat-ember)_35%,transparent)]!",
81
83
  )}
82
84
  style={{
83
85
  backgroundColor: lit ? color : undefined,
@@ -94,7 +94,7 @@ export function NavListItem({
94
94
  ...props,
95
95
  className: cn(
96
96
  "group/nav relative isolate flex h-9 items-center gap-2.5 rounded-md px-3 text-sm text-fg-muted outline-none select-none",
97
- // 押すと少し沈み、離すとばねで戻る。行は大きな面なので、沈み方は浅くする
97
+ // 押すと少し沈み、離すと載る曲線で戻る。行は大きな面なので、沈み方は浅くする
98
98
  "motion-press-surface",
99
99
  "hover:bg-surface-hover hover:text-fg",
100
100
  "data-active:font-medium data-active:text-fg-strong data-active:hover:bg-transparent",
@@ -81,7 +81,7 @@ export function NavigationMenuTrigger({
81
81
  "inline-flex text-fg-subtle",
82
82
  "transition-[rotate,color] duration-150 ease-out-expo",
83
83
  "data-popup-open:rotate-180 data-popup-open:text-fg-muted",
84
- "data-popup-open:duration-(--duration-spring-snappy) data-popup-open:ease-spring-snappy",
84
+ "data-popup-open:duration-(--duration-pop) data-popup-open:ease-pop",
85
85
  )}
86
86
  >
87
87
  <ChevronDown className="size-3.5" />
@@ -100,7 +100,7 @@ export function NavigationMenuContent({
100
100
  data-slot="navigation-menu-content"
101
101
  className={cn(
102
102
  "h-full w-[calc(100vw-2rem)] p-2 sm:w-max",
103
- "transition-[opacity,translate,filter] duration-(--duration-spring-glide) ease-spring-glide",
103
+ "transition-[opacity,translate,filter] duration-(--duration-sway) ease-sway",
104
104
  "data-starting-style:opacity-0 data-ending-style:opacity-0",
105
105
  "data-ending-style:blur-[2px] data-ending-style:duration-150 data-ending-style:ease-out-expo",
106
106
  "data-starting-style:data-[activation-direction=left]:-translate-x-1/4",
@@ -177,7 +177,7 @@ export function NavigationMenuCard({
177
177
 
178
178
  /**
179
179
  * パネルの入れ物。NavigationMenu が中に 1 つ置くので、アプリ側で置く必要はない。
180
- * パネルの幅と高さ、位置は、Base UI が出す大きさの変数をばねで追う。
180
+ * パネルの幅と高さ、位置は、Base UI が出す大きさの変数を揺れる曲線で追う。
181
181
  */
182
182
  function NavigationMenuViewport() {
183
183
  return (
@@ -189,7 +189,7 @@ function NavigationMenuViewport() {
189
189
  collisionAvoidance={{ side: "none" }}
190
190
  className={cn(
191
191
  "z-50 h-(--positioner-height) w-(--positioner-width) max-w-(--available-width)",
192
- "transition-[top,left,right,bottom] duration-(--duration-spring-glide) ease-spring-glide data-instant:transition-none",
192
+ "transition-[top,left,right,bottom] duration-(--duration-sway) ease-sway data-instant:transition-none",
193
193
  // パネルとの隙間でも hover が切れないよう、透明の帯を足す
194
194
  "before:absolute before:inset-x-0 before:-top-2 before:h-2 before:content-['']",
195
195
  )}
@@ -199,7 +199,7 @@ function NavigationMenuViewport() {
199
199
  className={cn(
200
200
  "relative h-(--popup-height) w-(--popup-width) origin-(--transform-origin) overflow-hidden",
201
201
  "rounded-lg border border-line bg-surface-overlay text-fg shadow-pop outline-none",
202
- "transition-[opacity,scale,width,height] duration-(--duration-spring-glide) ease-spring-glide",
202
+ "transition-[opacity,scale,width,height] duration-(--duration-sway) ease-sway",
203
203
  "data-starting-style:scale-[0.96] data-starting-style:opacity-0",
204
204
  "data-ending-style:scale-[0.96] data-ending-style:opacity-0 data-ending-style:duration-150 data-ending-style:ease-out-expo",
205
205
  )}
@@ -177,7 +177,7 @@ function RollingNumber({ text, direction, active }: { text: string; direction: 1
177
177
  animate="center"
178
178
  exit="exit"
179
179
  transition={{
180
- y: springs.soft,
180
+ y: springs.ignite,
181
181
  opacity: { duration: 0.12 },
182
182
  color: { duration: 0.5, delay: 0.12, ease: [0.2, 0.8, 0.2, 1] },
183
183
  textShadow: { duration: 0.5, delay: 0.12, ease: [0.2, 0.8, 0.2, 1] },
@@ -193,11 +193,29 @@ function RollingNumber({ text, direction, active }: { text: string; direction: 1
193
193
  );
194
194
  }
195
195
 
196
+ /**
197
+ * 色を rgb の 3 つの数に直す。空の色は、ブラウザが oklab() で返すので、そのままでは Motion が補間できない。
198
+ * 1px の canvas に塗って、塗られた色を読む
199
+ */
200
+ function toRgb(color: string) {
201
+ if (!color) return null;
202
+ const canvas = document.createElement("canvas");
203
+ canvas.width = 1;
204
+ canvas.height = 1;
205
+ const ctx = canvas.getContext("2d");
206
+ if (!ctx) return null;
207
+ ctx.fillStyle = color;
208
+ ctx.fillRect(0, 0, 1, 1);
209
+ const [r, g, b] = ctx.getImageData(0, 0, 1, 1).data;
210
+ return `${r}, ${g}, ${b}`;
211
+ }
212
+
196
213
  /** 桁に付ける色を、今のテーマのトークンから読む。Motion は var() のままでは色を補間できない */
197
214
  function useEmberColors(ref: React.RefObject<HTMLElement | null>, active: boolean) {
215
+ // トークンを読むまでの初期値。夜のテーマの brand と fg に合わせてある
198
216
  const [colors, setColors] = React.useState({
199
217
  brand: "rgb(244, 125, 58)",
200
- fg: "rgb(235, 229, 216)",
218
+ fg: "rgb(225, 230, 236)",
201
219
  glow: "rgba(244, 125, 58, 0.6)",
202
220
  clear: "rgba(244, 125, 58, 0)",
203
221
  });
@@ -207,9 +225,17 @@ function useEmberColors(ref: React.RefObject<HTMLElement | null>, active: boolea
207
225
  const el = ref.current;
208
226
  if (!el) return;
209
227
  const style = getComputedStyle(el);
210
- const brand = style.getPropertyValue("--color-brand").trim();
211
- const fg = style.color;
212
- if (brand) setColors((c) => (c.brand === brand && c.fg === fg ? c : { ...c, brand, fg }));
228
+ const brand = toRgb(style.getPropertyValue("--color-brand").trim());
229
+ const fg = toRgb(style.color);
230
+ if (!brand || !fg) return;
231
+ // 光の色もブランドカラーから作る。昼のテーマでは、夜より暗いブランドカラーに合わせる
232
+ const next = {
233
+ brand: `rgb(${brand})`,
234
+ fg: `rgb(${fg})`,
235
+ glow: `rgba(${brand}, 0.6)`,
236
+ clear: `rgba(${brand}, 0)`,
237
+ };
238
+ setColors((c) => (c.brand === next.brand && c.fg === next.fg ? c : next));
213
239
  }, [ref, active]);
214
240
  return colors;
215
241
  }
@@ -132,7 +132,7 @@ export function OTPFieldInput({ className, ...props }: React.ComponentProps<type
132
132
  ? { opacity: 0, transition: { duration: 0 } }
133
133
  : { opacity: 0, scale: 0.6, transition: { duration: 0.1, ease: [0.16, 1, 0.3, 1] } }
134
134
  }
135
- transition={springs.snappy}
135
+ transition={springs.pop}
136
136
  >
137
137
  {inputProps.type === "password" ? (
138
138
  <span className="block size-2.5 rounded-full bg-current" />
@@ -40,7 +40,7 @@ export type PreviewCardContentProps = React.ComponentProps<typeof BasePreviewCar
40
40
  /**
41
41
  * リンク先の中身を、移動する前に見せる。人の紹介やページの要約に使う。
42
42
  * 中身にはスクリーンリーダーでもキーボードでも届かないので、リンク先にない情報や操作は置かない。
43
- * リンクの側からばねで大きくなって現れ、離れると速く縮んで消える。
43
+ * リンクの側から着火の曲線で大きくなって現れ、離れると速く縮んで消える。
44
44
  */
45
45
  export function PreviewCardContent({
46
46
  className,
@@ -76,7 +76,7 @@ export function Progress({ className, value, label, showValue, size = "md", ...p
76
76
  aria-hidden
77
77
  className={cn(
78
78
  "absolute top-1/2 right-0 h-[calc(100%+4px)] w-4 -translate-y-1/2 rounded-full",
79
- "bg-linear-to-r from-transparent to-(--ember-100) blur-[2px] motion-fuse",
79
+ "bg-linear-to-r from-transparent to-heat-core blur-[2px] motion-fuse",
80
80
  )}
81
81
  />
82
82
  </BaseProgress.Indicator>
@@ -32,7 +32,7 @@ export function Radio({ className, ...props }: React.ComponentProps<typeof BaseR
32
32
  data-slot="radio-indicator"
33
33
  className={cn(
34
34
  "size-2 rounded-full bg-brand",
35
- "transition-[scale,opacity] duration-(--duration-spring-snappy) ease-spring-snappy",
35
+ "transition-[scale,opacity] duration-(--duration-pop) ease-pop",
36
36
  "data-starting-style:scale-0 data-starting-style:opacity-0",
37
37
  "data-ending-style:scale-0 data-ending-style:opacity-0 data-ending-style:duration-(--duration-fast) data-ending-style:ease-out-expo",
38
38
  )}
@@ -99,19 +99,19 @@ export function Rating({
99
99
  )}
100
100
  >
101
101
  <motion.span
102
- // 選んだ瞬間に作り直し、大きめの状態からばねで元に戻す(弾む)
102
+ // 選んだ瞬間に作り直し、大きめの状態からはぜる曲線で元に戻す
103
103
  key={popping ? `pop-${pop.count}` : "idle"}
104
104
  className="flex"
105
105
  initial={popping && !reduce ? { scale: 1.4, rotate: -8 } : false}
106
106
  animate={{ scale: 1, rotate: 0 }}
107
- transition={springs.snappy}
107
+ transition={springs.pop}
108
108
  >
109
109
  <Star
110
110
  aria-hidden
111
111
  strokeWidth={1.75}
112
112
  className={cn(
113
113
  starSizes[size],
114
- "[transition:color_var(--duration-fast)_var(--ease-standard),fill_var(--duration-fast)_var(--ease-standard),scale_var(--duration-spring-press)_var(--ease-spring-press)]",
114
+ "[transition:color_var(--duration-fast)_var(--ease-standard),fill_var(--duration-fast)_var(--ease-standard),scale_var(--duration-land)_var(--ease-land)]",
115
115
  "group-hover/star:not-group-data-disabled/star:scale-115",
116
116
  "group-active/star:not-group-data-disabled/star:scale-85",
117
117
  filled
@@ -93,7 +93,7 @@ export function ScrollBar({
93
93
  data-slot="scroll-area-thumb"
94
94
  className={cn(
95
95
  "relative rounded-full bg-line-strong",
96
- "transition-[width,height,background-color] duration-(--duration-spring-press) ease-spring-press",
96
+ "transition-[width,height,background-color] duration-(--duration-land) ease-land",
97
97
  "group-hover/scrollbar:bg-fg-subtle active:bg-fg-muted",
98
98
  "data-[orientation=vertical]:w-1 group-hover/scrollbar:data-[orientation=vertical]:w-1.5",
99
99
  "data-[orientation=horizontal]:h-1 group-hover/scrollbar:data-[orientation=horizontal]:h-1.5",
@@ -49,7 +49,7 @@ export function SelectTrigger({ className, size = "md", children, ...props }: Se
49
49
  {children}
50
50
  <BaseSelect.Icon
51
51
  data-slot="select-icon"
52
- className="flex text-fg-muted transition-[rotate] duration-(--duration-spring-press) ease-spring-press [[data-popup-open]>&]:rotate-180"
52
+ className="flex text-fg-muted transition-[rotate] duration-(--duration-sway) ease-sway [[data-popup-open]>&]:rotate-180"
53
53
  >
54
54
  <ChevronDown className="size-4" />
55
55
  </BaseSelect.Icon>
@@ -21,11 +21,11 @@ export function SkipLink({ className, render, ref, href = "#main", children, ...
21
21
  className: cn(
22
22
  "fixed top-3 left-3 z-[100] inline-flex h-10 items-center gap-2 rounded-md border border-line bg-surface-overlay px-4",
23
23
  "text-sm font-medium text-fg-strong shadow-pop outline-none",
24
- // 隠れている間は左上の外に置く。出るときはばねで、消えるときは 150ms で速く
24
+ // 隠れている間は左上の外に置く。出るときは着火の曲線で、消えるときは 150ms で速く
25
25
  "pointer-events-none -translate-x-3 -translate-y-[calc(100%+1.5rem)] opacity-0",
26
26
  "transition-[translate,opacity] duration-150 ease-out-expo",
27
27
  "focus:pointer-events-auto focus:translate-x-0 focus:translate-y-0 focus:opacity-100",
28
- "focus:duration-(--duration-spring-soft) focus:ease-spring-soft",
28
+ "focus:duration-(--duration-ignite) focus:ease-ignite",
29
29
  "focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-focus",
30
30
  className,
31
31
  ),