@travel-match/ui 0.3.0 → 0.5.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 (161) hide show
  1. package/dist/components/AccountMenu/AccountMenu.cjs +1 -1
  2. package/dist/components/AccountMenu/AccountMenu.cjs.map +1 -1
  3. package/dist/components/AccountMenu/AccountMenu.js +1 -1
  4. package/dist/components/AccountMenu/AccountMenu.js.map +1 -1
  5. package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs +1 -1
  6. package/dist/components/ConfirmationDialog/ConfirmationDialog.cjs.map +1 -1
  7. package/dist/components/ConfirmationDialog/ConfirmationDialog.js +1 -0
  8. package/dist/components/ConfirmationDialog/ConfirmationDialog.js.map +1 -1
  9. package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs +1 -1
  10. package/dist/components/CtaRequestFlow/CtaRequestFlow.cjs.map +1 -1
  11. package/dist/components/CtaRequestFlow/CtaRequestFlow.js +72 -37
  12. package/dist/components/CtaRequestFlow/CtaRequestFlow.js.map +1 -1
  13. package/dist/components/ExampleRequests/ExampleRequests.cjs +1 -1
  14. package/dist/components/ExampleRequests/ExampleRequests.cjs.map +1 -1
  15. package/dist/components/ExampleRequests/ExampleRequests.js +18 -17
  16. package/dist/components/ExampleRequests/ExampleRequests.js.map +1 -1
  17. package/dist/components/FaqItem/FaqItem.cjs +1 -1
  18. package/dist/components/FaqItem/FaqItem.cjs.map +1 -1
  19. package/dist/components/FaqItem/FaqItem.js +79 -34
  20. package/dist/components/FaqItem/FaqItem.js.map +1 -1
  21. package/dist/components/Field/Field.cjs +1 -1
  22. package/dist/components/Field/Field.cjs.map +1 -1
  23. package/dist/components/Field/Field.js +10 -8
  24. package/dist/components/Field/Field.js.map +1 -1
  25. package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs +1 -1
  26. package/dist/components/HowItWorksSteps/HowItWorksSteps.cjs.map +1 -1
  27. package/dist/components/HowItWorksSteps/HowItWorksSteps.js +1 -1
  28. package/dist/components/HowItWorksSteps/HowItWorksSteps.js.map +1 -1
  29. package/dist/components/InlineAlert/InlineAlert.cjs +1 -1
  30. package/dist/components/InlineAlert/InlineAlert.cjs.map +1 -1
  31. package/dist/components/InlineAlert/InlineAlert.js +9 -8
  32. package/dist/components/InlineAlert/InlineAlert.js.map +1 -1
  33. package/dist/components/LogoAnimation/LogoAnimation.cjs +2 -0
  34. package/dist/components/LogoAnimation/LogoAnimation.cjs.map +1 -0
  35. package/dist/components/LogoAnimation/LogoAnimation.js +202 -0
  36. package/dist/components/LogoAnimation/LogoAnimation.js.map +1 -0
  37. package/dist/components/LogoAnimation/LogoAnimationArtwork.cjs +2 -0
  38. package/dist/components/LogoAnimation/LogoAnimationArtwork.cjs.map +1 -0
  39. package/dist/components/LogoAnimation/LogoAnimationArtwork.js +57 -0
  40. package/dist/components/LogoAnimation/LogoAnimationArtwork.js.map +1 -0
  41. package/dist/components/LogoAnimation/motion.cjs +2 -0
  42. package/dist/components/LogoAnimation/motion.cjs.map +1 -0
  43. package/dist/components/LogoAnimation/motion.js +180 -0
  44. package/dist/components/LogoAnimation/motion.js.map +1 -0
  45. package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs +1 -1
  46. package/dist/components/NewRequestOverlay/NewRequestOverlay.cjs.map +1 -1
  47. package/dist/components/NewRequestOverlay/NewRequestOverlay.js +67 -48
  48. package/dist/components/NewRequestOverlay/NewRequestOverlay.js.map +1 -1
  49. package/dist/components/NotificationsDropdown/NotificationsMenu.cjs +1 -1
  50. package/dist/components/NotificationsDropdown/NotificationsMenu.cjs.map +1 -1
  51. package/dist/components/NotificationsDropdown/NotificationsMenu.js +1 -1
  52. package/dist/components/NotificationsDropdown/NotificationsMenu.js.map +1 -1
  53. package/dist/components/PackageAnimation/PackageAnimation.cjs +1 -1
  54. package/dist/components/PackageAnimation/PackageAnimation.cjs.map +1 -1
  55. package/dist/components/PackageAnimation/PackageAnimation.js +1 -1
  56. package/dist/components/PackageAnimation/PackageAnimation.js.map +1 -1
  57. package/dist/components/PartnerCarousel/PartnerCarousel.cjs.map +1 -1
  58. package/dist/components/PartnerCarousel/PartnerCarousel.js.map +1 -1
  59. package/dist/components/PhoneInput/PhoneInput.cjs +1 -1
  60. package/dist/components/PhoneInput/PhoneInput.cjs.map +1 -1
  61. package/dist/components/PhoneInput/PhoneInput.js +8 -5
  62. package/dist/components/PhoneInput/PhoneInput.js.map +1 -1
  63. package/dist/components/PopularQuestions/PopularQuestions.cjs +1 -1
  64. package/dist/components/PopularQuestions/PopularQuestions.cjs.map +1 -1
  65. package/dist/components/PopularQuestions/PopularQuestions.js +22 -21
  66. package/dist/components/PopularQuestions/PopularQuestions.js.map +1 -1
  67. package/dist/components/RegionMap/RegionMap.cjs +2 -0
  68. package/dist/components/RegionMap/RegionMap.cjs.map +1 -0
  69. package/dist/components/RegionMap/RegionMap.js +55 -0
  70. package/dist/components/RegionMap/RegionMap.js.map +1 -0
  71. package/dist/components/RegionMap/mapPaths.cjs +2 -0
  72. package/dist/components/RegionMap/mapPaths.cjs.map +1 -0
  73. package/dist/components/RegionMap/mapPaths.js +86 -0
  74. package/dist/components/RegionMap/mapPaths.js.map +1 -0
  75. package/dist/components/RequestSearch/RequestSearch.cjs +2 -0
  76. package/dist/components/RequestSearch/RequestSearch.cjs.map +1 -0
  77. package/dist/components/RequestSearch/RequestSearch.js +36 -0
  78. package/dist/components/RequestSearch/RequestSearch.js.map +1 -0
  79. package/dist/components/RequestSummary/RequestSummary.cjs +1 -1
  80. package/dist/components/RequestSummary/RequestSummary.cjs.map +1 -1
  81. package/dist/components/RequestSummary/RequestSummary.js +31 -32
  82. package/dist/components/RequestSummary/RequestSummary.js.map +1 -1
  83. package/dist/components/RequestTypeOption/RequestTypeOption.cjs +2 -0
  84. package/dist/components/RequestTypeOption/RequestTypeOption.cjs.map +1 -0
  85. package/dist/components/RequestTypeOption/RequestTypeOption.js +52 -0
  86. package/dist/components/RequestTypeOption/RequestTypeOption.js.map +1 -0
  87. package/dist/components/Select/Select.cjs +1 -1
  88. package/dist/components/Select/Select.cjs.map +1 -1
  89. package/dist/components/Select/Select.js +127 -121
  90. package/dist/components/Select/Select.js.map +1 -1
  91. package/dist/components/ShowMore/ShowMore.cjs +2 -0
  92. package/dist/components/ShowMore/ShowMore.cjs.map +1 -0
  93. package/dist/components/ShowMore/ShowMore.js +34 -0
  94. package/dist/components/ShowMore/ShowMore.js.map +1 -0
  95. package/dist/components/SiteHeader/SiteHeader.cjs.map +1 -1
  96. package/dist/components/SiteHeader/SiteHeader.js.map +1 -1
  97. package/dist/components/SortSelect/SortSelect.cjs +2 -0
  98. package/dist/components/SortSelect/SortSelect.cjs.map +1 -0
  99. package/dist/components/SortSelect/SortSelect.js +18 -0
  100. package/dist/components/SortSelect/SortSelect.js.map +1 -0
  101. package/dist/components/StatusFilter/StatusFilter.cjs +2 -0
  102. package/dist/components/StatusFilter/StatusFilter.cjs.map +1 -0
  103. package/dist/components/StatusFilter/StatusFilter.js +37 -0
  104. package/dist/components/StatusFilter/StatusFilter.js.map +1 -0
  105. package/dist/components/StatusTag/StatusTag.cjs.map +1 -1
  106. package/dist/components/StatusTag/StatusTag.js.map +1 -1
  107. package/dist/components/StepCard/StepCard.cjs +1 -1
  108. package/dist/components/StepCard/StepCard.cjs.map +1 -1
  109. package/dist/components/StepCard/StepCard.js +9 -6
  110. package/dist/components/StepCard/StepCard.js.map +1 -1
  111. package/dist/components/StepProgress/StepProgress.cjs +2 -0
  112. package/dist/components/StepProgress/StepProgress.cjs.map +1 -0
  113. package/dist/components/StepProgress/StepProgress.js +43 -0
  114. package/dist/components/StepProgress/StepProgress.js.map +1 -0
  115. package/dist/components/TelegramConnect/TelegramConnect.cjs +2 -0
  116. package/dist/components/TelegramConnect/TelegramConnect.cjs.map +1 -0
  117. package/dist/components/TelegramConnect/TelegramConnect.js +57 -0
  118. package/dist/components/TelegramConnect/TelegramConnect.js.map +1 -0
  119. package/dist/components/TextInput/TextInput.cjs +1 -1
  120. package/dist/components/TextInput/TextInput.cjs.map +1 -1
  121. package/dist/components/TextInput/TextInput.js +21 -19
  122. package/dist/components/TextInput/TextInput.js.map +1 -1
  123. package/dist/components/Textarea/Textarea.cjs +1 -1
  124. package/dist/components/Textarea/Textarea.cjs.map +1 -1
  125. package/dist/components/Textarea/Textarea.js +18 -16
  126. package/dist/components/Textarea/Textarea.js.map +1 -1
  127. package/dist/components/Toast/Toast.cjs +2 -0
  128. package/dist/components/Toast/Toast.cjs.map +1 -0
  129. package/dist/components/Toast/Toast.js +57 -0
  130. package/dist/components/Toast/Toast.js.map +1 -0
  131. package/dist/icons/generated/CheckmarkIcon.cjs +1 -1
  132. package/dist/icons/generated/CheckmarkIcon.cjs.map +1 -1
  133. package/dist/icons/generated/CheckmarkIcon.js +19 -2
  134. package/dist/icons/generated/CheckmarkIcon.js.map +1 -1
  135. package/dist/icons/generated/InfoIcon.cjs +2 -0
  136. package/dist/icons/generated/InfoIcon.cjs.map +1 -0
  137. package/dist/icons/generated/InfoIcon.js +35 -0
  138. package/dist/icons/generated/InfoIcon.js.map +1 -0
  139. package/dist/icons/generated/SendIcon.cjs +2 -0
  140. package/dist/icons/generated/SendIcon.cjs.map +1 -0
  141. package/dist/icons/generated/SendIcon.js +23 -0
  142. package/dist/icons/generated/SendIcon.js.map +1 -0
  143. package/dist/icons/generated/index.cjs +1 -1
  144. package/dist/icons/generated/index.cjs.map +1 -1
  145. package/dist/icons/generated/index.js +71 -67
  146. package/dist/icons/generated/index.js.map +1 -1
  147. package/dist/index.cjs +1 -1
  148. package/dist/index.d.cts +649 -34
  149. package/dist/index.d.ts +649 -34
  150. package/dist/index.js +146 -134
  151. package/dist/styles.css +1 -1
  152. package/dist/tailwind.css +0 -6
  153. package/dist/tokens/generated.cjs +1 -1
  154. package/dist/tokens/generated.cjs.map +1 -1
  155. package/dist/tokens/generated.js +1 -7
  156. package/dist/tokens/generated.js.map +1 -1
  157. package/dist/tokens.css +0 -12
  158. package/dist/tokens.d.cts +2 -26
  159. package/dist/tokens.d.ts +2 -26
  160. package/dist/tokens.json +1 -7
  161. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"motion.js","names":["cl","b","a","v","seg","t","lerp","io","out","sstep","DRAW","N","M","HOLD","OFF","BACK","REST","cached","canMeasure","el","headAt","f","s","RL","i","H","measure","r","rm","l","els","RX","LL","turnL","best","q","dd","ang","prev","W","S","c","j","k","head","endAng","finalTheta","near","P","x","y","kap","vel","jL","TT","topL","nearL","l0","l1","showFinal","createLogoMotion","g","d","p","fin","rh","lh","A","ANCHOR","T0","mode","fly","lo","hi","m","planeAt","pt","th","sc","vis","landed","on","cap","path","len","setRoute","setLeg","tLs","L","tLe","legLen","legT","LOOP_T","fpos","dist","render","delay","dotR","ft","emerge","trail","t1","back","rot","D","rs"],"sources":["../../../src/components/LogoAnimation/motion.ts"],"sourcesContent":["import { ANCHOR, HEAD0 } from './LogoAnimationArtwork';\n\n/*\n * Frame engine of LogoAnimation — a line-for-line port of the approved animation demo (\"TMLogo\"). Internal, not\n * exported from the package. It writes SVG attributes and inline styles directly (one call per animation frame), so\n * React renders the markup once and never re-renders while the plane flies.\n */\n\n/** 'once' draws the logo and holds it (intro); 'loop' flies out, rewinds and starts again (loader). */\nexport type LogoMotionMode = 'once' | 'loop';\n\n/** Parts of the rendered SVG the engine moves. */\nexport interface LogoMotionElements {\n /** Unpainted route centreline: position and heading of the plane. */\n route: SVGGeometryElement;\n /** Mask stroke that reveals the main line. */\n routeMask: SVGGeometryElement;\n /** Mask stroke that reveals the lower-left branch. */\n leg: SVGGeometryElement;\n /** Round cap on the moving tip of the main line. */\n routeCap: SVGCircleElement;\n /** Round cap on the moving tip of the branch. */\n legCap: SVGCircleElement;\n /** The dot the plane takes off from. */\n dot: SVGCircleElement;\n /** Pin parts revealed by the masks (shown while drawing). */\n parts: SVGGElement;\n /** The exact logo (shown once landed). */\n final: SVGGElement;\n /** Puffs left behind when the loop flies out. */\n trail: SVGCircleElement[];\n /** The plane. */\n plane: SVGGElement;\n}\n\nexport interface LogoMotion {\n /** Draws the frame at `t` seconds since mount (the `delay` is applied inside). */\n render: (t: number) => void;\n /** `once`: time after which the logo holds still, so frames can stop. `loop`: never ends (Infinity). */\n end: number;\n}\n\nconst cl = (v: number, a = 0, b = 1) => Math.min(b, Math.max(a, v));\nconst seg = (t: number, a: number, b: number) => cl((t - a) / (b - a));\nconst lerp = (a: number, b: number, t: number) => a + (b - a) * t;\nconst io = (t: number) => (t < 0.5 ? 4 * t * t * t : 1 - Math.pow(-2 * t + 2, 3) / 2);\nconst out = (t: number) => 1 - Math.pow(1 - t, 3);\nconst sstep = (t: number) => t * t * (3 - 2 * t);\n\n/** Length of the draw, from lift-off to landing (s). */\nconst DRAW = 2.8;\n/** Samples of the heading table and of the time-along-route table. */\nconst N = 400;\nconst M = 600;\n/** Loop tail: hold on the logo, fly out, rewind, rest (s). */\nconst HOLD = 0.45;\nconst OFF = 1.05;\nconst BACK = 1.1;\nconst REST = 0.1;\n\n/** Mode-independent measurements of the route and branch. The paths are constants, so every instance shares them. */\ninterface Geometry {\n RL: number;\n RX: number;\n LL: number;\n turnL: number;\n H: number[];\n finalTheta: number;\n TT: number[];\n jL: number;\n topL: number;\n l0: number;\n l1: number;\n}\n\nlet cached: Geometry | null = null;\n\nconst canMeasure = (el: SVGElement) =>\n typeof (el as SVGGeometryElement).getTotalLength === 'function' && typeof (el as SVGGeometryElement).getPointAtLength === 'function';\n\nfunction headAt(H: number[], RL: number, s: number): number {\n const f = cl(s / RL) * N;\n const i = Math.min(N - 1, Math.floor(f));\n return lerp(H[i], H[i + 1], f - i);\n}\n\nfunction measure(els: LogoMotionElements): Geometry | null {\n const { route: r, routeMask: rm, leg: l } = els;\n if (!canMeasure(r) || !canMeasure(rm) || !canMeasure(l)) return null;\n if (cached) return cached;\n const RL = r.getTotalLength();\n const RX = rm.getTotalLength();\n const LL = l.getTotalLength();\n if (!(RL > 0) || !(LL > 0)) return null;\n\n // route length where the plane starts its right turn (≈ lowest point of the left side)\n let turnL = 0;\n {\n let best = 1e9;\n for (let s = RL * 0.7; s < RL; s += 0.2) {\n const q = r.getPointAtLength(s);\n const dd = Math.hypot(q.x - 5.8, q.y - 29);\n if (dd < best) {\n best = dd;\n turnL = s;\n }\n }\n }\n const ang = (s: number) => {\n const a = r.getPointAtLength(Math.max(0, s - 0.35));\n const b = r.getPointAtLength(Math.min(RL, s + 0.35));\n return (Math.atan2(b.y - a.y, b.x - a.x) * 180) / Math.PI;\n };\n // unwrapped heading table so rotation never jumps\n const H: number[] = [];\n {\n let prev: number | null = null;\n for (let i = 0; i <= N; i++) {\n let a = ang((RL * i) / N);\n if (prev !== null) {\n while (a - prev > 180) a -= 360;\n while (a - prev < -180) a += 360;\n }\n H.push(a);\n prev = a;\n }\n }\n // smooth heading through tight curves\n {\n const W = Math.round(2.2 / (RL / N));\n const S = H.slice();\n for (let i = 0; i <= N; i++) {\n let a = 0;\n let c = 0;\n for (let j = -W; j <= W; j++) {\n const k = Math.min(N, Math.max(0, i + j));\n a += S[k];\n c++;\n }\n H[i] = a / c;\n }\n }\n const head = (s: number) => headAt(H, RL, s);\n const endAng = head(RL);\n let finalTheta = HEAD0;\n while (finalTheta - endAng > 180) finalTheta -= 360;\n while (finalTheta - endAng < -180) finalTheta += 360;\n\n // speed profile along the route: lift-off from the dot, ease through the tight bottom curve, glide down, soft landing\n const near = (x: number, y: number) => {\n let best = 1e9;\n let b = 0;\n for (let q = 0; q < RL; q += 0.2) {\n const P = r.getPointAtLength(q);\n const dd = Math.hypot(P.x - x, P.y - y);\n if (dd < best) {\n best = dd;\n b = q;\n }\n }\n return b;\n };\n // turn rate, deg per unit\n const kap = (q: number) => {\n const a = Math.max(0, q - 1);\n const b = Math.min(RL, q + 1);\n return Math.abs(head(b) - head(a)) / (b - a);\n };\n const vel = (q: number) => ((0.22 + 0.78 * sstep(cl(q / 16))) / (1 + kap(q) / 20)) * Math.max(0.05, Math.sqrt(cl((RL - q) / 15)));\n const jL = near(18.9, 46.6); // where the branch joins the line\n const TT = [0];\n for (let i = 1; i <= M; i++) {\n const a = (RL * (i - 1)) / M;\n const b = (RL * i) / M;\n TT.push(TT[i - 1] + (b - a) / vel((a + b) / 2));\n }\n const topL = near(30, 6.2); // the branch starts growing as the plane crosses the top\n const nearL = (x: number, y: number) => {\n let best = 1e9;\n let b = 0;\n for (let q = 0; q < LL; q += 0.1) {\n const P = l.getPointAtLength(q);\n const dd = Math.hypot(P.x - x, P.y - y);\n if (dd < best) {\n best = dd;\n b = q;\n }\n }\n return b;\n };\n // visible part of the branch: junction → rounded tip\n const l0 = nearL(18.6, 47.2);\n const l1 = nearL(7.4, 33.0) + 0.4;\n\n cached = { RL, RX, LL, turnL, H, finalTheta, TT, jL, topL, l0, l1 };\n return cached;\n}\n\n/** Shows the exact logo and hides everything that moves (reduced motion, or no SVG geometry API). */\nexport function showFinal(els: Pick<LogoMotionElements, 'final' | 'parts' | 'plane' | 'trail'>): void {\n els.final.style.display = '';\n els.parts.style.display = 'none';\n els.plane.style.display = 'none';\n els.trail.forEach((c) => (c.style.opacity = '0'));\n}\n\n/** Builds the frame renderer, or returns `null` when the browser cannot measure SVG paths. Call from an effect only. */\nexport function createLogoMotion(els: LogoMotionElements, mode: LogoMotionMode, delay: number): LogoMotion | null {\n const g = measure(els);\n if (!g) return null;\n const { RL, RX, LL, turnL, H, finalTheta, TT, jL, topL, l0, l1 } = g;\n const { route: r, routeMask: rm, leg: l, dot: d, plane: p, parts, final: fin, trail, routeCap: rh, legCap: lh } = els;\n const A = ANCHOR;\n const T0 = mode === 'loop' ? 0.3 : 0.4; // start offset (dot appears first)\n const head = (s: number) => headAt(H, RL, s);\n\n // flight progress → route length fraction, through the time-along-route table\n const fly = (x: number) => {\n x = cl(x) * TT[M];\n let lo = 0;\n let hi = M;\n while (hi - lo > 1) {\n const m = (lo + hi) >> 1;\n if (TT[m] < x) lo = m;\n else hi = m;\n }\n const f = (x - TT[lo]) / (TT[hi] - TT[lo] || 1);\n return (lo + f) / M;\n };\n\n // s = route length drawn; vis = plane scale factor 0..1 (emerge / vanish)\n function planeAt(s: number, vis: number) {\n const pt = r.getPointAtLength(s);\n const k = sstep(seg(s, turnL - 7, RL));\n const th = lerp(head(s), finalTheta, k) - HEAD0;\n const sc = lerp(0.42, 1, s / RL) * vis; // grows steadily along the whole flight\n if (k >= 1 && vis >= 1) p.removeAttribute('transform');\n else p.setAttribute('transform', `translate(${pt.x.toFixed(3)} ${pt.y.toFixed(3)}) rotate(${th.toFixed(2)}) scale(${sc.toFixed(4)}) translate(${-A[0]} ${-A[1]})`);\n p.style.opacity = vis > 0 ? '1' : '0';\n }\n function landed(on: boolean) {\n fin.style.display = on ? '' : 'none';\n parts.style.display = on ? 'none' : '';\n p.style.display = on ? 'none' : '';\n }\n // round end on the moving tip of each line (the mask only reveals the logo shape, so the cap follows its real edges)\n function cap(c: SVGCircleElement, path: SVGGeometryElement, len: number, on: boolean) {\n if (!on) {\n c.setAttribute('r', '0');\n return;\n }\n const P = path.getPointAtLength(len);\n c.setAttribute('cx', P.x.toFixed(3));\n c.setAttribute('cy', P.y.toFixed(3));\n c.setAttribute('r', '1.75');\n }\n function setRoute(s: number) {\n const m = s + (RX - RL) * sstep(seg(s, RL - 1.5, RL));\n rm.style.strokeDasharray = `${Math.max(m, 0.001)} ${RX + 10}`;\n rm.style.opacity = s > 0.05 ? '1' : '0';\n cap(rh, rm, m, s > 0.05);\n }\n function setLeg(s: number) {\n l.style.strokeDasharray = `${Math.max(s, 0.001)} ${LL + 10}`;\n l.style.opacity = s > 0.05 ? '1' : '0';\n cap(lh, l, s, s > 0.05);\n }\n\n // branch grows on its own clock: starts as the plane crosses the top, ends just before the plane turns right\n const tAt = (L: number) => T0 + (DRAW * TT[Math.round(cl(L / RL) * M)]) / TT[M];\n const tLs = tAt(topL);\n const tLe = T0 + DRAW - 0.06;\n const legLen = (x: number) => (x <= 0 ? 0 : x >= 1 ? LL : lerp(l0, l1, x));\n const legT = (t: number) => {\n const x = seg(t, tLs, tLe);\n return legLen(x <= 0 ? 0 : x >= 1 ? 1 : (x < 0.5 ? 2 * x * x : 1 - Math.pow(-2 * x + 2, 2) / 2) * 0.999 + 0.001);\n };\n const LOOP_T = T0 + DRAW + HOLD + BACK + 0.05 + REST;\n // flight path out of the logo: accelerate along the heading, climbing slightly, growing as it comes closer\n const fpos = (f: number): [number, number, number] => {\n const q = 0.18 * f + 0.82 * f * f * f;\n const dist = 62 * q;\n const a = ((HEAD0 - 7 * q) * Math.PI) / 180;\n return [A[0] + Math.cos(a) * dist, A[1] + Math.sin(a) * dist, q];\n };\n\n function render(t: number) {\n t -= delay;\n // dot\n let dotR: number;\n if (mode === 'once') {\n const q = seg(t, 0, 0.32);\n dotR = 3.7 * (q < 1 ? 1 + 0.18 * Math.sin(Math.PI * q) : 1) * out(q);\n } else {\n dotR = 3.7;\n // The demo wraps a negative time (inside `delay`) into the rewind tail; holding the first frame reads better.\n t = t < 0 ? 0 : t % LOOP_T;\n }\n d.setAttribute('r', Math.max(0, dotR + (dotR > 0 ? 0.6 : 0)).toFixed(3));\n const ft = seg(t, T0, T0 + DRAW);\n const s = RL * fly(ft);\n const emerge = out(seg(t, T0 - 0.1, T0 + 0.22));\n if (mode === 'once' || t < T0 + DRAW + HOLD) {\n setRoute(s);\n setLeg(legT(t));\n planeAt(s, t < T0 - 0.1 ? 0 : emerge);\n landed(ft >= 1);\n trail.forEach((c) => (c.style.opacity = '0'));\n return;\n }\n // loop tail: the plane takes off and flies away while the line and branch rewind together into the dot\n landed(false);\n const t1 = T0 + DRAW + HOLD;\n const f = seg(t, t1, t1 + OFF);\n const back = seg(t, t1 + 0.05, t1 + 0.05 + BACK);\n if (f < 1) {\n const [x, y, q] = fpos(f);\n const sc = 1 + 0.4 * q;\n const rot = -7 * q;\n p.style.display = '';\n p.style.opacity = (1 - sstep(seg(f, 0.72, 1))).toFixed(3);\n p.setAttribute('transform', `translate(${x.toFixed(3)} ${y.toFixed(3)}) rotate(${rot.toFixed(2)}) scale(${sc.toFixed(4)}) translate(${-A[0]} ${-A[1]})`);\n } else p.style.opacity = '0';\n // small puffs left behind the tail\n trail.forEach((c, i) => {\n const D = [0.14, 0.28, 0.42][i];\n if (f < D || f >= 1) {\n c.style.opacity = '0';\n return;\n }\n const [x, y] = fpos(D);\n const k = seg(f, D, D + 0.45);\n c.setAttribute('cx', x.toFixed(2));\n c.setAttribute('cy', y.toFixed(2));\n c.setAttribute('r', (0.7 + 0.7 * k).toFixed(2));\n c.style.opacity = (0.5 * (1 - sstep(k))).toFixed(3);\n });\n const rs = RL * (1 - io(back));\n setRoute(rs);\n setLeg(legLen(cl((rs - jL) / (RL - jL))));\n }\n\n return { render, end: mode === 'loop' ? Infinity : delay + T0 + DRAW + 0.1 };\n}\n\n/** Test hook: forgets the shared measurements (they are cached for the page's lifetime). */\nexport function resetLogoMotionCache(): void {\n cached = null;\n}\n"],"mappings":";;;AA0CA,IAAMA,KAAM,GAAW,IAAI,GAAG,IAAI,MAAM,KAAK,IAAIC,GAAG,KAAK,IAAIC,GAAGC,CAAC,CAAC,GAC5DC,KAAO,GAAW,GAAW,MAAcJ,GAAIK,IAAIH,MAAMD,IAAIC,EAAE,GAC/DI,KAAQ,GAAW,GAAW,MAAcJ,KAAKD,IAAIC,KAAKG,GAC1DE,KAAM,MAAeF,IAAI,KAAM,IAAIA,IAAIA,IAAIA,IAAI,KAAa,KAAKA,IAAI,MAAG,IAAK,GAC7EG,KAAO,MAAc,KAAa,IAAIH,MAAG,GACzCI,KAAS,MAAcJ,IAAIA,KAAK,IAAI,IAAIA,IAGxCK,IAAO,KAEPC,IAAI,KACJC,IAAI,KAEJC,IAAO,KACPC,IAAM,MACNC,IAAO,KACPC,IAAO,IAiBTC,IAA0B,MAExBC,KAAc,MAClB,OAAQC,EAA0B,kBAAmB,cAAc,OAAQA,EAA0B,oBAAqB;AAE5H,SAASC,EAAO,GAAa,GAAY,GAAmB;CAC1D,IAAMC,IAAIrB,EAAGsB,IAAIC,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,EAAE,aAAa,MAAMS,EAAE,QAAQ,CAAC,CAAC,GACjCT,EAAE,aAAa,MAAM,KAAM,KAAME,EAAA,CAAG,QAAQ,CAAC,CAAC,GAC9C,EAAE,MAAM,WAAW,MAAO,IAAIlC,EAAMkC,CAAC,GAAA,CAAI,QAAQ,CAAC;EACpD,CAAC;EACD,IAAM8D,IAAKlF,KAAM,IAAIhB,EAAG+F,CAAI;EAE5B,AADAjB,EAASoB,CAAE,GACXnB,EAAOI,EAAO1F,GAAIyG,IAAKpD,MAAO9B,IAAK8B,EAAG,CAAC,CAAC;CAC1C;CAEA,OAAO;EAAE;EAAQ,KAAKiB,MAAS,SAAS,WAAW0B,IAAQ3B,IAAK3D,IAAO;CAAI;AAC7E"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../icons/generated/CheckmarkIcon.cjs"),t=require("../../icons/generated/NextArrowIcon.cjs"),n=require("../../utils/cn.cjs"),r=require("../Dialog/Dialog.cjs");;/* empty css */let i=require("react"),a=require("react/jsx-runtime"),o=require("@radix-ui/react-slot");var s=(0,i.forwardRef)(function({title:r,description:s,icon:c,imageSrc:l,imageAlt:u=``,image:d,features:f,cta:p,href:m,asChild:h=!1,disabled:g,className:_,children:v,...y},b){let x=(0,i.useId)(),S=`${x}-title`,C=`${x}-description`,w=`${x}-features`,T=!!(f&&f.length>0),E=d??(l?(0,a.jsx)(`img`,{src:l,alt:u,loading:`lazy`,decoding:`async`}):null),D=(0,a.jsxs)(a.Fragment,{children:[E?(0,a.jsx)(`span`,{className:`tm-new-request-option__media`,children:E}):null,(0,a.jsxs)(`span`,{className:`tm-new-request-option__content`,children:[c?(0,a.jsx)(`span`,{className:`tm-new-request-option__icon`,"data-tm-icon-size":`md`,"aria-hidden":`true`,children:c}):null,(0,a.jsxs)(`span`,{className:`tm-new-request-option__text`,children:[(0,a.jsx)(`span`,{id:S,className:`tm-new-request-option__title`,children:r}),s?(0,a.jsx)(`span`,{id:C,className:`tm-new-request-option__description`,children:s}):null]}),T?(0,a.jsx)(`span`,{id:w,className:`tm-new-request-option__features`,children:f.map((t,n)=>(0,a.jsxs)(`span`,{className:`tm-new-request-option__feature`,children:[(0,a.jsx)(e.CheckmarkIcon,{size:`sm`}),(0,a.jsx)(`span`,{children:t})]},n))}):null,p?(0,a.jsxs)(`span`,{className:`tm-new-request-option__cta`,children:[p,(0,a.jsx)(t.NextArrowIcon,{size:`sm`})]}):null]})]}),O={ref:b,className:n.cn(`tm-new-request-option`,_),"aria-labelledby":s?`${S} ${C}`:S,"aria-describedby":T?w:void 0,...y};return h?(0,a.jsx)(o.Slot,{"aria-disabled":g||void 0,...O,children:(0,i.isValidElement)(v)?(0,i.cloneElement)(v,void 0,D):v}):m===void 0?(0,a.jsx)(`button`,{type:`button`,disabled:g,...O,children:D}):(0,a.jsx)(`a`,{href:g?void 0:m,"aria-disabled":g||void 0,...O,children:D})}),c=(0,i.forwardRef)(function({options:e=[],onSelect:t,closeOnSelect:o=!0,footer:c,children:l,open:u,defaultOpen:d=!1,onOpenChange:f,mobilePlacement:p=`fullscreen`,className:m,...h},g){let[_,v]=(0,i.useState)(d),y=u??_,b=e=>{u===void 0&&v(e),f?.(e)},x=e=>n=>{t?.(e),o&&b(!1)};return(0,a.jsx)(r.Dialog,{ref:g,size:`lg`,className:n.cn(`tm-new-request-overlay`,m),open:y,onOpenChange:b,mobilePlacement:p,...h,children:(0,a.jsxs)(`div`,{className:`tm-new-request-overlay__content`,children:[l??(e.length>0?(0,a.jsx)(`ul`,{className:`tm-new-request-overlay__options`,role:`list`,children:e.map(({id:e,...t})=>(0,a.jsx)(`li`,{className:`tm-new-request-overlay__option`,children:(0,a.jsx)(s,{...t,"data-option":e,onClick:x(e)})},e))}):null),c?(0,a.jsx)(`div`,{className:`tm-new-request-overlay__footer`,children:c}):null]})})});exports.NewRequestOptionCard=s,exports.NewRequestOverlay=c;
1
+ "use client";const e=require("../../icons/generated/CheckmarkIcon.cjs"),t=require("../../icons/generated/NextArrowIcon.cjs"),n=require("../../utils/cn.cjs"),r=require("../Dialog/Dialog.cjs"),i=require("../RequestTypeOption/RequestTypeOption.cjs");;/* empty css */let a=require("react"),o=require("react/jsx-runtime"),s=require("@radix-ui/react-slot");var c=(0,a.forwardRef)(function({title:r,description:i,icon:c,imageSrc:l,imageAlt:u=``,image:d,features:f,cta:p,href:m,asChild:h=!1,disabled:g,className:_,children:v,...y},b){let x=(0,a.useId)(),S=`${x}-title`,C=`${x}-description`,w=`${x}-features`,T=!!(f&&f.length>0),E=d??(l?(0,o.jsx)(`img`,{src:l,alt:u,loading:`lazy`,decoding:`async`}):null),D=(0,o.jsxs)(o.Fragment,{children:[E?(0,o.jsx)(`span`,{className:`tm-new-request-option__media`,children:E}):null,(0,o.jsxs)(`span`,{className:`tm-new-request-option__content`,children:[c?(0,o.jsx)(`span`,{className:`tm-new-request-option__icon`,"data-tm-icon-size":`md`,"aria-hidden":`true`,children:c}):null,(0,o.jsxs)(`span`,{className:`tm-new-request-option__text`,children:[(0,o.jsx)(`span`,{id:S,className:`tm-new-request-option__title`,children:r}),i?(0,o.jsx)(`span`,{id:C,className:`tm-new-request-option__description`,children:i}):null]}),T?(0,o.jsx)(`span`,{id:w,className:`tm-new-request-option__features`,children:f.map((t,n)=>(0,o.jsxs)(`span`,{className:`tm-new-request-option__feature`,children:[(0,o.jsx)(e.CheckmarkIcon,{size:`sm`}),(0,o.jsx)(`span`,{children:t})]},n))}):null,p?(0,o.jsxs)(`span`,{className:`tm-new-request-option__cta`,children:[p,(0,o.jsx)(t.NextArrowIcon,{size:`sm`})]}):null]})]}),O={ref:b,className:n.cn(`tm-new-request-option`,_),"aria-labelledby":i?`${S} ${C}`:S,"aria-describedby":T?w:void 0,...y};return h?(0,o.jsx)(s.Slot,{"aria-disabled":g||void 0,...O,children:(0,a.isValidElement)(v)?(0,a.cloneElement)(v,void 0,D):v}):m===void 0?(0,o.jsx)(`button`,{type:`button`,disabled:g,...O,children:D}):(0,o.jsx)(`a`,{href:g?void 0:m,"aria-disabled":g||void 0,...O,children:D})}),l=(0,a.forwardRef)(function({variant:e=`list`,options:t=[],onSelect:s,closeOnSelect:l=!0,footer:u,children:d,open:f,defaultOpen:p=!1,onOpenChange:m,mobilePlacement:h=`fullscreen`,className:g,..._},v){let[y,b]=(0,a.useState)(p),x=f??y,S=e=>{f===void 0&&b(e),m?.(e)},C=e=>t=>{s?.(e),l&&S(!1)};return(0,o.jsx)(r.Dialog,{ref:v,size:e===`cards`?`lg`:`md`,className:n.cn(`tm-new-request-overlay`,g),"data-variant":e,open:x,onOpenChange:S,mobilePlacement:h,..._,children:(0,o.jsxs)(`div`,{className:`tm-new-request-overlay__content`,children:[d??(t.length>0?(0,o.jsx)(`ul`,{className:`tm-new-request-overlay__options`,role:`list`,children:t.map(({id:t,title:n,description:r,icon:a,href:s,disabled:l,imageSrc:u,imageAlt:d,image:f,features:p,cta:m})=>(0,o.jsx)(`li`,{className:`tm-new-request-overlay__option`,children:e===`cards`?(0,o.jsx)(c,{title:n,description:r,icon:a,href:s,disabled:l,imageSrc:u,imageAlt:d,image:f,features:p,cta:m,"data-option":t,onClick:C(t)}):(0,o.jsx)(i.RequestTypeOption,{title:n,description:r,icon:a,href:s,disabled:l,"data-option":t,onClick:C(t)})},t))}):null),u?(0,o.jsx)(`div`,{className:`tm-new-request-overlay__footer`,children:u}):null]})})});exports.NewRequestOptionCard=c,exports.NewRequestOverlay=l;
2
2
  //# sourceMappingURL=NewRequestOverlay.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewRequestOverlay.cjs","names":["useId","_Fragment","CheckmarkIcon","NextArrowIcon","cn","Slot","isValidElement","cloneElement","useState","Dialog","require_CheckmarkIcon","require_NextArrowIcon","require_cn","require_Dialog","react","react_jsx_runtime","_radix_ui_react_slot","NewRequestOptionCard","props","id","titleId","descriptionId","featuresId","hasFeatures","features","media","image","imageSrc","imageAlt","content","icon","title","description","feature","index","cta","shared","className","asChild","disabled","children","href","NewRequestOverlay","openProp","uncontrolledOpen","setUncontrolledOpen","defaultOpen","open","setOpen","next","onOpenChange","select","onSelect","closeOnSelect","options","option","footer"],"sources":["../../../src/components/NewRequestOverlay/NewRequestOverlay.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useId,\n useState,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { CheckmarkIcon, NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { Dialog, type DialogProps } from '../Dialog';\nimport './NewRequestOverlay.css';\n\ninterface NewRequestOptionContent {\n /** Name of the request type (Figma \"Travel Package\"). With the description it forms the card's accessible name. */\n title: ReactNode;\n /** One line under the title (Figma \"Plan a trip in Armenia or abroad.\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** Photo at the top of the card; it is cropped to fill a 220px band (140px in narrow layouts). */\n imageSrc?: string;\n /** Alternative text of the photo. The photos are decorative by default. */\n imageAlt?: string;\n /** Custom image element used instead of `imageSrc`, e.g. `next/image`. */\n image?: ReactNode;\n /** What the request type covers (Figma \"Capabilities\"); each entry gets a check mark. */\n features?: ReactNode[];\n /** Call to action at the bottom of the card (Figma \"Start a Travel Package\"); an arrow is added after it. */\n cta?: ReactNode;\n /** Renders the card as a link to this URL instead of a button. */\n href?: string;\n}\n\nexport interface NewRequestOptionCardProps extends NewRequestOptionContent, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Renders the single child element (e.g. a router `<Link href=\"…\" />`) as the card instead of a `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * One choice of the New Request Overlay (Figma \"Option / Travel Package\"): the whole card is one button or link,\n * named by its title and description; the feature list is its description for assistive technology.\n */\nexport const NewRequestOptionCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, NewRequestOptionCardProps>(function NewRequestOptionCard(\n { title, description, icon, imageSrc, imageAlt = '', image, features, cta, href, asChild = false, disabled, className, children, ...props },\n ref,\n) {\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n const featuresId = `${id}-features`;\n const hasFeatures = Boolean(features && features.length > 0);\n const media = image ?? (imageSrc ? <img src={imageSrc} alt={imageAlt} loading=\"lazy\" decoding=\"async\" /> : null);\n\n // Only phrasing content inside: the card is a <button> or an <a>.\n const content = (\n <>\n {media ? <span className=\"tm-new-request-option__media\">{media}</span> : null}\n <span className=\"tm-new-request-option__content\">\n {icon ? (\n <span className=\"tm-new-request-option__icon\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"tm-new-request-option__text\">\n <span id={titleId} className=\"tm-new-request-option__title\">\n {title}\n </span>\n {description ? (\n <span id={descriptionId} className=\"tm-new-request-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {hasFeatures ? (\n <span id={featuresId} className=\"tm-new-request-option__features\">\n {features!.map((feature, index) => (\n <span key={index} className=\"tm-new-request-option__feature\">\n <CheckmarkIcon size=\"sm\" />\n <span>{feature}</span>\n </span>\n ))}\n </span>\n ) : null}\n {cta ? (\n <span className=\"tm-new-request-option__cta\">\n {cta}\n <NextArrowIcon size=\"sm\" />\n </span>\n ) : null}\n </span>\n </>\n );\n\n const shared = {\n ref,\n className: cn('tm-new-request-option', className),\n 'aria-labelledby': description ? `${titleId} ${descriptionId}` : titleId,\n 'aria-describedby': hasFeatures ? featuresId : undefined,\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot aria-disabled={disabled || undefined} {...shared}>\n {isValidElement(children) ? cloneElement(children as ReactElement<{ children?: ReactNode }>, undefined, content) : children}\n </Slot>\n );\n }\n if (href !== undefined) {\n const Anchor = 'a' as ElementType;\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n return (\n <Anchor href={disabled ? undefined : href} aria-disabled={disabled || undefined} {...shared}>\n {content}\n </Anchor>\n );\n }\n return (\n <button type=\"button\" disabled={disabled} {...shared}>\n {content}\n </button>\n );\n});\n\nexport interface NewRequestOverlayOption extends NewRequestOptionContent {\n /** Identifies the option in `onSelect`. */\n id: string;\n /** Disables the card (buttons only). */\n disabled?: boolean;\n}\n\nexport interface NewRequestOverlayProps extends Omit<DialogProps, 'size' | 'role' | 'footer' | 'children' | 'onSelect'> {\n /** The request types to choose from (Figma \"Options\"): any number, laid out in equal columns that wrap. */\n options?: NewRequestOverlayOption[];\n /** Called with the option's `id` when a card is activated. */\n onSelect?: (id: string) => void;\n /** `false` keeps the overlay open after a choice (close it yourself through `open`). */\n closeOnSelect?: boolean;\n /** Line under the options (Figma \"Not sure which one? See how TravelMatch works\"); links inside it are styled. */\n footer?: ReactNode;\n /**\n * Replaces the option cards: compose `NewRequestOptionCard` yourself (e.g. `asChild` with router links)\n * or render the next step of the flow here.\n */\n children?: ReactNode;\n}\n\n/**\n * The overlay that starts a new request by choosing its type (Figma component set \"New Request Overlay\").\n * A large centered dialog; below 768px it covers the screen and the cards stack.\n */\nexport const NewRequestOverlay = /* @__PURE__ */ forwardRef<HTMLDivElement, NewRequestOverlayProps>(function NewRequestOverlay(\n { options = [], onSelect, closeOnSelect = true, footer, children, open: openProp, defaultOpen = false, onOpenChange, mobilePlacement = 'fullscreen', className, ...props },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n const select = (id: string) => (_event: MouseEvent) => {\n onSelect?.(id);\n if (closeOnSelect) setOpen(false);\n };\n\n return (\n <Dialog ref={ref} size=\"lg\" className={cn('tm-new-request-overlay', className)} open={open} onOpenChange={setOpen} mobilePlacement={mobilePlacement} {...props}>\n <div className=\"tm-new-request-overlay__content\">\n {children ??\n (options.length > 0 ? (\n <ul className=\"tm-new-request-overlay__options\" role=\"list\">\n {options.map(({ id, ...option }) => (\n <li key={id} className=\"tm-new-request-overlay__option\">\n <NewRequestOptionCard {...option} data-option={id} onClick={select(id)} />\n </li>\n ))}\n </ul>\n ) : null)}\n {footer ? <div className=\"tm-new-request-overlay__footer\">{footer}</div> : null}\n </div>\n </Dialog>\n );\n});\n"],"mappings":"A,8TAgDA,IAAaiB,GAAuC,EAAAH,EAAA,WAAA,CAAyD,SAC3G,CAAE,QAAO,cAAa,OAAM,WAAU,WAAW,GAAI,QAAO,WAAU,MAAK,OAAM,UAAU,GAAO,WAAU,YAAW,WAAU,GAAGI,GACpI,EACA,CACA,IAAMC,GAAA,EAAKnB,EAAAA,MAAAA,CAAM,EACXoB,EAAU,GAAGD,EAAG,QAChBE,EAAgB,GAAGF,EAAG,cACtBG,EAAa,GAAGH,EAAG,WACnBI,EAAc,GAAQC,GAAYA,EAAS,OAAS,GACpDC,EAAQC,IAAUC,GAAW,EAAAZ,EAAA,IAAA,CAAC,MAAD,CAAK,IAAKY,EAAU,IAAKC,EAAU,QAAQ,OAAO,SAAS,OAAS,CAAA,EAAI,MAGrGC,GACJ,EAAAd,EAAA,KAAA,CAAAd,EAAAA,SAAA,CAAA,SAAA,CACGwB,GAAQ,EAAAV,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,+BAAgC,SAAAU,CAAY,CAAA,EAAI,MACzE,EAAAV,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,iCAAhB,SAAA,CACGe,GACC,EAAAf,EAAA,IAAA,CAAC,OAAD,CAAM,UAAU,8BAA8B,oBAAkB,KAAK,cAAY,OAC9E,SAAAe,CACG,CAAA,EACJ,MACJ,EAAAf,EAAA,KAAA,CAAC,OAAD,CAAM,UAAU,8BAAhB,SAAA,EACE,EAAAA,EAAA,IAAA,CAAC,OAAD,CAAM,GAAIK,EAAS,UAAU,+BAC1B,SAAAW,CACG,CAAA,EACLC,GACC,EAAAjB,EAAA,IAAA,CAAC,OAAD,CAAM,GAAIM,EAAe,UAAU,qCAChC,SAAAW,CACG,C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Element","cloneElement","useState","Dialog","RequestTypeOption","require_CheckmarkIcon","require_NextArrowIcon","require_cn","require_Dialog","require_RequestTypeOption","react","react_jsx_runtime","_radix_ui_react_slot","NewRequestOptionCard","props","id","titleId","descriptionId","featuresId","hasFeatures","features","media","image","imageSrc","imageAlt","content","icon","title","description","feature","index","cta","shared","className","asChild","disabled","children","href","NewRequestOverlay","openProp","uncontrolledOpen","setUncontrolledOpen","defaultOpen","open","setOpen","next","onOpenChange","select","onSelect","closeOnSelect","variant","options","footer"],"sources":["../../../src/components/NewRequestOverlay/NewRequestOverlay.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useId,\n useState,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { CheckmarkIcon, NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { Dialog, type DialogProps } from '../Dialog';\nimport { RequestTypeOption } from '../RequestTypeOption';\nimport './NewRequestOverlay.css';\n\ninterface NewRequestOptionContent {\n /** Name of the request type (Figma \"Travel Package\"). With the description it forms the card's accessible name. */\n title: ReactNode;\n /** One line under the title (Figma \"Plan a trip in Armenia or abroad.\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** `variant=\"cards\"` only. Photo at the top of the card; it is cropped to fill a 220px band (140px in narrow layouts). */\n imageSrc?: string;\n /** `variant=\"cards\"` only. Alternative text of the photo. The photos are decorative by default. */\n imageAlt?: string;\n /** `variant=\"cards\"` only. Custom image element used instead of `imageSrc`, e.g. `next/image`. */\n image?: ReactNode;\n /** `variant=\"cards\"` only. What the request type covers (Figma \"Capabilities\"); each entry gets a check mark. */\n features?: ReactNode[];\n /** `variant=\"cards\"` only. Call to action at the bottom of the card (Figma \"Start a Travel Package\"); an arrow is added after it. */\n cta?: ReactNode;\n /** Renders the card as a link to this URL instead of a button. */\n href?: string;\n}\n\nexport interface NewRequestOptionCardProps extends NewRequestOptionContent, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Renders the single child element (e.g. a router `<Link href=\"…\" />`) as the card instead of a `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * The large photo card of the earlier New Request Overlay design (`variant=\"cards\"`): the whole card is one button or\n * link, named by its title and description; the feature list is its description for assistive technology.\n * The current Figma overlay uses the compact `RequestTypeOption` rows instead.\n */\nexport const NewRequestOptionCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, NewRequestOptionCardProps>(function NewRequestOptionCard(\n { title, description, icon, imageSrc, imageAlt = '', image, features, cta, href, asChild = false, disabled, className, children, ...props },\n ref,\n) {\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n const featuresId = `${id}-features`;\n const hasFeatures = Boolean(features && features.length > 0);\n const media = image ?? (imageSrc ? <img src={imageSrc} alt={imageAlt} loading=\"lazy\" decoding=\"async\" /> : null);\n\n // Only phrasing content inside: the card is a <button> or an <a>.\n const content = (\n <>\n {media ? <span className=\"tm-new-request-option__media\">{media}</span> : null}\n <span className=\"tm-new-request-option__content\">\n {icon ? (\n <span className=\"tm-new-request-option__icon\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"tm-new-request-option__text\">\n <span id={titleId} className=\"tm-new-request-option__title\">\n {title}\n </span>\n {description ? (\n <span id={descriptionId} className=\"tm-new-request-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {hasFeatures ? (\n <span id={featuresId} className=\"tm-new-request-option__features\">\n {features!.map((feature, index) => (\n <span key={index} className=\"tm-new-request-option__feature\">\n <CheckmarkIcon size=\"sm\" />\n <span>{feature}</span>\n </span>\n ))}\n </span>\n ) : null}\n {cta ? (\n <span className=\"tm-new-request-option__cta\">\n {cta}\n <NextArrowIcon size=\"sm\" />\n </span>\n ) : null}\n </span>\n </>\n );\n\n const shared = {\n ref,\n className: cn('tm-new-request-option', className),\n 'aria-labelledby': description ? `${titleId} ${descriptionId}` : titleId,\n 'aria-describedby': hasFeatures ? featuresId : undefined,\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot aria-disabled={disabled || undefined} {...shared}>\n {isValidElement(children) ? cloneElement(children as ReactElement<{ children?: ReactNode }>, undefined, content) : children}\n </Slot>\n );\n }\n if (href !== undefined) {\n const Anchor = 'a' as ElementType;\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n return (\n <Anchor href={disabled ? undefined : href} aria-disabled={disabled || undefined} {...shared}>\n {content}\n </Anchor>\n );\n }\n return (\n <button type=\"button\" disabled={disabled} {...shared}>\n {content}\n </button>\n );\n});\n\nexport interface NewRequestOverlayOption extends NewRequestOptionContent {\n /** Identifies the option in `onSelect`. */\n id: string;\n /** Disables the card (buttons only). */\n disabled?: boolean;\n}\n\n/** `list` — the current Figma design: a 560px dialog with one `RequestTypeOption` row per type · `cards` — the earlier design: a 1120px dialog with photo cards side by side. */\nexport type NewRequestOverlayVariant = 'list' | 'cards';\n\nexport interface NewRequestOverlayProps extends Omit<DialogProps, 'size' | 'role' | 'footer' | 'children' | 'onSelect'> {\n /** `list` (default, Figma \"New Request Overlay\"): compact rows in a 560px dialog · `cards`: the earlier large photo cards. */\n variant?: NewRequestOverlayVariant;\n /** The request types to choose from (Figma \"Options\"): any number — stacked rows (`list`) or equal columns that wrap (`cards`). */\n options?: NewRequestOverlayOption[];\n /** Called with the option's `id` when a card is activated. */\n onSelect?: (id: string) => void;\n /** `false` keeps the overlay open after a choice (close it yourself through `open`). */\n closeOnSelect?: boolean;\n /** Line under the options (Figma \"Not sure which one? See how TravelMatch works\"); links inside it are styled. */\n footer?: ReactNode;\n /**\n * Replaces the options: compose `RequestTypeOption` (or `NewRequestOptionCard`) yourself (e.g. `asChild` with router links)\n * or render the next step of the flow here.\n */\n children?: ReactNode;\n}\n\n/**\n * The overlay that starts a new request by choosing its type (Figma component set \"New Request Overlay\").\n * A centered dialog listing one `RequestTypeOption` per type; below 768px it covers the screen.\n */\nexport const NewRequestOverlay = /* @__PURE__ */ forwardRef<HTMLDivElement, NewRequestOverlayProps>(function NewRequestOverlay(\n {\n variant = 'list',\n options = [],\n onSelect,\n closeOnSelect = true,\n footer,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n mobilePlacement = 'fullscreen',\n className,\n ...props\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n const select = (id: string) => (_event: MouseEvent) => {\n onSelect?.(id);\n if (closeOnSelect) setOpen(false);\n };\n\n return (\n <Dialog\n ref={ref}\n size={variant === 'cards' ? 'lg' : 'md'}\n className={cn('tm-new-request-overlay', className)}\n data-variant={variant}\n open={open}\n onOpenChange={setOpen}\n mobilePlacement={mobilePlacement}\n {...props}\n >\n <div className=\"tm-new-request-overlay__content\">\n {children ??\n (options.length > 0 ? (\n <ul className=\"tm-new-request-overlay__options\" role=\"list\">\n {options.map(({ id, title, description, icon, href, disabled, imageSrc, imageAlt, image, features, cta }) => (\n <li key={id} className=\"tm-new-request-overlay__option\">\n {variant === 'cards' ? (\n <NewRequestOptionCard\n {...{ title, description, icon, href, disabled, imageSrc, imageAlt, image, features, cta }}\n data-option={id}\n onClick={select(id)}\n />\n ) : (\n <RequestTypeOption title={title} description={description} icon={icon} href={href} disabled={disabled} data-option={id} onClick={select(id)} />\n )}\n </li>\n ))}\n </ul>\n ) : null)}\n {footer ? <div className=\"tm-new-request-overlay__footer\">{footer}</div> : null}\n </div>\n </Dialog>\n );\n});\n"],"mappings":"A,sXAkDA,IAAamB,GAAuC,EAAAH,EAAA,WAAA,CAAyD,SAC3G,CAAE,QAAO,cAAa,OAAM,WAAU,WAAW,GAAI,QAAO,WAAU,MAAK,OAAM,UAAU,GAAO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IAAWE,EAAoBI,CAAI,EACpDC,IAAeD,CAAI,CACrB,EAEME,EAAU,GAAgB,GAAuB,CACrDC,IAAWjC,CAAE,EACTkC,GAAeL,EAAQ,EAAK,CAClC,EAEA,OACE,EAAAjC,EAAA,IAAA,CAACR,EAAAA,OAAD,CACO,MACL,KAAM+C,IAAY,QAAU,KAAO,KACnC,UAAWpD,EAAAA,GAAG,yBAA0BmC,CAAS,EACjD,eAAciB,EACR,OACN,aAAcN,EACG,kBACjB,GAAI9B,EAEJ,UAAA,EAAAH,EAAA,KAAA,CAAC,MAAD,CAAK,UAAU,kCAAf,SAAA,CACGyB,IACEe,EAAQ,OAAS,GAChB,EAAAxC,EAAA,IAAA,CAAC,KAAD,CAAI,UAAU,kCAAkC,KAAK,OAClD,SAAAwC,EAAQ,KAAK,CAAE,KAAI,QAAO,cAAa,OAAM,OAAM,WAAU,WAAU,WAAU,QAAO,WAAU,UACjG,EAAAxC,EAAA,IAAA,CAAC,KAAD,CAAa,UAAU,iCACpB,SAAAuC,IAAY,SACX,EAAAvC,EAAA,IAAA,CAACE,EAAD,CACQ,QAAO,cAAa,OAAM,OAAM,WAAU,WAAU,WAAU,QAAO,WAAU,MACrF,cAAaE,EACb,QAASgC,EAAOhC,CAAE,CACnB,CAAA,GAED,EAAAJ,EAAA,IAAA,CAACP,EAAAA,kBAAD,CAA0B,QAAoB,cAAmB,OAAY,OAAgB,WAAU,cAAaW,EAAI,QAASgC,EAAOhC,CAAE,CAAI,CAAA,CAE9I,EAVKA,CAUL,CACL,CACC,CAAA,EACF,MACLqC,GAAS,EAAAzC,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,iCAAkC,SAAAyC,CAAY,CAAA,EAAI,IACxE,C,EACC,CAAA,CAEZ,CAAC,E"}
@@ -3,110 +3,129 @@ import { CheckmarkIcon as e } from "../../icons/generated/CheckmarkIcon.js";
3
3
  import { NextArrowIcon as t } from "../../icons/generated/NextArrowIcon.js";
4
4
  import { cn as n } from "../../utils/cn.js";
5
5
  import { Dialog as r } from "../Dialog/Dialog.js";
6
+ import { RequestTypeOption as i } from "../RequestTypeOption/RequestTypeOption.js";
6
7
  /* empty css */
7
- import { cloneElement as i, forwardRef as a, isValidElement as o, useId as s, useState as c } from "react";
8
- import { Fragment as l, jsx as u, jsxs as d } from "react/jsx-runtime";
9
- import { Slot as f } from "@radix-ui/react-slot";
8
+ import { cloneElement as a, forwardRef as o, isValidElement as s, useId as c, useState as l } from "react";
9
+ import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
10
+ import { Slot as p } from "@radix-ui/react-slot";
10
11
  // src/components/NewRequestOverlay/NewRequestOverlay.tsx
11
- var p = /* @__PURE__ */ a(function({ title: r, description: a, icon: c, imageSrc: p, imageAlt: m = "", image: h, features: g, cta: _, href: v, asChild: y = !1, disabled: b, className: x, children: S, ...C }, w) {
12
- let T = s(), E = `${T}-title`, D = `${T}-description`, O = `${T}-features`, k = !!(g && g.length > 0), A = h ?? (p ? /* @__PURE__ */ u("img", {
13
- src: p,
12
+ var m = /* @__PURE__ */ o(function({ title: r, description: i, icon: o, imageSrc: l, imageAlt: m = "", image: h, features: g, cta: _, href: v, asChild: y = !1, disabled: b, className: x, children: S, ...C }, w) {
13
+ let T = c(), E = `${T}-title`, D = `${T}-description`, O = `${T}-features`, k = !!(g && g.length > 0), A = h ?? (l ? /* @__PURE__ */ d("img", {
14
+ src: l,
14
15
  alt: m,
15
16
  loading: "lazy",
16
17
  decoding: "async"
17
- }) : null), j = /* @__PURE__ */ d(l, { children: [A ? /* @__PURE__ */ u("span", {
18
+ }) : null), j = /* @__PURE__ */ f(u, { children: [A ? /* @__PURE__ */ d("span", {
18
19
  className: "tm-new-request-option__media",
19
20
  children: A
20
- }) : null, /* @__PURE__ */ d("span", {
21
+ }) : null, /* @__PURE__ */ f("span", {
21
22
  className: "tm-new-request-option__content",
22
23
  children: [
23
- c ? /* @__PURE__ */ u("span", {
24
+ o ? /* @__PURE__ */ d("span", {
24
25
  className: "tm-new-request-option__icon",
25
26
  "data-tm-icon-size": "md",
26
27
  "aria-hidden": "true",
27
- children: c
28
+ children: o
28
29
  }) : null,
29
- /* @__PURE__ */ d("span", {
30
+ /* @__PURE__ */ f("span", {
30
31
  className: "tm-new-request-option__text",
31
- children: [/* @__PURE__ */ u("span", {
32
+ children: [/* @__PURE__ */ d("span", {
32
33
  id: E,
33
34
  className: "tm-new-request-option__title",
34
35
  children: r
35
- }), a ? /* @__PURE__ */ u("span", {
36
+ }), i ? /* @__PURE__ */ d("span", {
36
37
  id: D,
37
38
  className: "tm-new-request-option__description",
38
- children: a
39
+ children: i
39
40
  }) : null]
40
41
  }),
41
- k ? /* @__PURE__ */ u("span", {
42
+ k ? /* @__PURE__ */ d("span", {
42
43
  id: O,
43
44
  className: "tm-new-request-option__features",
44
- children: g.map((t, n) => /* @__PURE__ */ d("span", {
45
+ children: g.map((t, n) => /* @__PURE__ */ f("span", {
45
46
  className: "tm-new-request-option__feature",
46
- children: [/* @__PURE__ */ u(e, { size: "sm" }), /* @__PURE__ */ u("span", { children: t })]
47
+ children: [/* @__PURE__ */ d(e, { size: "sm" }), /* @__PURE__ */ d("span", { children: t })]
47
48
  }, n))
48
49
  }) : null,
49
- _ ? /* @__PURE__ */ d("span", {
50
+ _ ? /* @__PURE__ */ f("span", {
50
51
  className: "tm-new-request-option__cta",
51
- children: [_, /* @__PURE__ */ u(t, { size: "sm" })]
52
+ children: [_, /* @__PURE__ */ d(t, { size: "sm" })]
52
53
  }) : null
53
54
  ]
54
55
  })] }), M = {
55
56
  ref: w,
56
57
  className: n("tm-new-request-option", x),
57
- "aria-labelledby": a ? `${E} ${D}` : E,
58
+ "aria-labelledby": i ? `${E} ${D}` : E,
58
59
  "aria-describedby": k ? O : void 0,
59
60
  ...C
60
61
  };
61
- return y ? /* @__PURE__ */ u(f, {
62
+ return y ? /* @__PURE__ */ d(p, {
62
63
  "aria-disabled": b || void 0,
63
64
  ...M,
64
- children: o(S) ? i(S, void 0, j) : S
65
- }) : v === void 0 ? /* @__PURE__ */ u("button", {
65
+ children: s(S) ? a(S, void 0, j) : S
66
+ }) : v === void 0 ? /* @__PURE__ */ d("button", {
66
67
  type: "button",
67
68
  disabled: b,
68
69
  ...M,
69
70
  children: j
70
- }) : /* @__PURE__ */ u("a", {
71
+ }) : /* @__PURE__ */ d("a", {
71
72
  href: b ? void 0 : v,
72
73
  "aria-disabled": b || void 0,
73
74
  ...M,
74
75
  children: j
75
76
  });
76
- }), m = /* @__PURE__ */ a(function({ options: e = [], onSelect: t, closeOnSelect: i = !0, footer: a, children: o, open: s, defaultOpen: l = !1, onOpenChange: f, mobilePlacement: m = "fullscreen", className: h, ...g }, _) {
77
- let [v, y] = c(l), b = s ?? v, x = (e) => {
78
- s === void 0 && y(e), f?.(e);
79
- }, S = (e) => (n) => {
80
- t?.(e), i && x(!1);
77
+ }), h = /* @__PURE__ */ o(function({ variant: e = "list", options: t = [], onSelect: a, closeOnSelect: o = !0, footer: s, children: c, open: u, defaultOpen: p = !1, onOpenChange: h, mobilePlacement: g = "fullscreen", className: _, ...v }, y) {
78
+ let [b, x] = l(p), S = u ?? b, C = (e) => {
79
+ u === void 0 && x(e), h?.(e);
80
+ }, w = (e) => (t) => {
81
+ a?.(e), o && C(!1);
81
82
  };
82
- return /* @__PURE__ */ u(r, {
83
- ref: _,
84
- size: "lg",
85
- className: n("tm-new-request-overlay", h),
86
- open: b,
87
- onOpenChange: x,
88
- mobilePlacement: m,
89
- ...g,
90
- children: /* @__PURE__ */ d("div", {
83
+ return /* @__PURE__ */ d(r, {
84
+ ref: y,
85
+ size: e === "cards" ? "lg" : "md",
86
+ className: n("tm-new-request-overlay", _),
87
+ "data-variant": e,
88
+ open: S,
89
+ onOpenChange: C,
90
+ mobilePlacement: g,
91
+ ...v,
92
+ children: /* @__PURE__ */ f("div", {
91
93
  className: "tm-new-request-overlay__content",
92
- children: [o ?? (e.length > 0 ? /* @__PURE__ */ u("ul", {
94
+ children: [c ?? (t.length > 0 ? /* @__PURE__ */ d("ul", {
93
95
  className: "tm-new-request-overlay__options",
94
96
  role: "list",
95
- children: e.map(({ id: e, ...t }) => /* @__PURE__ */ u("li", {
97
+ children: t.map(({ id: t, title: n, description: r, icon: a, href: o, disabled: s, imageSrc: c, imageAlt: l, image: u, features: f, cta: p }) => /* @__PURE__ */ d("li", {
96
98
  className: "tm-new-request-overlay__option",
97
- children: /* @__PURE__ */ u(p, {
98
- ...t,
99
- "data-option": e,
100
- onClick: S(e)
99
+ children: e === "cards" ? /* @__PURE__ */ d(m, {
100
+ title: n,
101
+ description: r,
102
+ icon: a,
103
+ href: o,
104
+ disabled: s,
105
+ imageSrc: c,
106
+ imageAlt: l,
107
+ image: u,
108
+ features: f,
109
+ cta: p,
110
+ "data-option": t,
111
+ onClick: w(t)
112
+ }) : /* @__PURE__ */ d(i, {
113
+ title: n,
114
+ description: r,
115
+ icon: a,
116
+ href: o,
117
+ disabled: s,
118
+ "data-option": t,
119
+ onClick: w(t)
101
120
  })
102
- }, e))
103
- }) : null), a ? /* @__PURE__ */ u("div", {
121
+ }, t))
122
+ }) : null), s ? /* @__PURE__ */ d("div", {
104
123
  className: "tm-new-request-overlay__footer",
105
- children: a
124
+ children: s
106
125
  }) : null]
107
126
  })
108
127
  });
109
128
  });
110
- export { p as NewRequestOptionCard, m as NewRequestOverlay };
129
+ export { m as NewRequestOptionCard, h as NewRequestOverlay };
111
130
 
112
131
  //# sourceMappingURL=NewRequestOverlay.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewRequestOverlay.js","names":["_Fragment","Fragment$1","NewRequestOptionCard","props","id","useId","titleId","descriptionId","featuresId","hasFeatures","features","media","image","imageSrc","imageAlt","content","icon","title","description","CheckmarkIcon","feature","index","cta","NextArrowIcon","shared","cn","className","asChild","Slot","disabled","isValidElement","children","cloneElement","href","NewRequestOverlay","openProp","uncontrolledOpen","setUncontrolledOpen","useState","defaultOpen","open","setOpen","next","onOpenChange","select","onSelect","closeOnSelect","Dialog","options","option","footer"],"sources":["../../../src/components/NewRequestOverlay/NewRequestOverlay.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useId,\n useState,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { CheckmarkIcon, NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { Dialog, type DialogProps } from '../Dialog';\nimport './NewRequestOverlay.css';\n\ninterface NewRequestOptionContent {\n /** Name of the request type (Figma \"Travel Package\"). With the description it forms the card's accessible name. */\n title: ReactNode;\n /** One line under the title (Figma \"Plan a trip in Armenia or abroad.\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** Photo at the top of the card; it is cropped to fill a 220px band (140px in narrow layouts). */\n imageSrc?: string;\n /** Alternative text of the photo. The photos are decorative by default. */\n imageAlt?: string;\n /** Custom image element used instead of `imageSrc`, e.g. `next/image`. */\n image?: ReactNode;\n /** What the request type covers (Figma \"Capabilities\"); each entry gets a check mark. */\n features?: ReactNode[];\n /** Call to action at the bottom of the card (Figma \"Start a Travel Package\"); an arrow is added after it. */\n cta?: ReactNode;\n /** Renders the card as a link to this URL instead of a button. */\n href?: string;\n}\n\nexport interface NewRequestOptionCardProps extends NewRequestOptionContent, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Renders the single child element (e.g. a router `<Link href=\"…\" />`) as the card instead of a `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * One choice of the New Request Overlay (Figma \"Option / Travel Package\"): the whole card is one button or link,\n * named by its title and description; the feature list is its description for assistive technology.\n */\nexport const NewRequestOptionCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, NewRequestOptionCardProps>(function NewRequestOptionCard(\n { title, description, icon, imageSrc, imageAlt = '', image, features, cta, href, asChild = false, disabled, className, children, ...props },\n ref,\n) {\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n const featuresId = `${id}-features`;\n const hasFeatures = Boolean(features && features.length > 0);\n const media = image ?? (imageSrc ? <img src={imageSrc} alt={imageAlt} loading=\"lazy\" decoding=\"async\" /> : null);\n\n // Only phrasing content inside: the card is a <button> or an <a>.\n const content = (\n <>\n {media ? <span className=\"tm-new-request-option__media\">{media}</span> : null}\n <span className=\"tm-new-request-option__content\">\n {icon ? (\n <span className=\"tm-new-request-option__icon\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"tm-new-request-option__text\">\n <span id={titleId} className=\"tm-new-request-option__title\">\n {title}\n </span>\n {description ? (\n <span id={descriptionId} className=\"tm-new-request-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {hasFeatures ? (\n <span id={featuresId} className=\"tm-new-request-option__features\">\n {features!.map((feature, index) => (\n <span key={index} className=\"tm-new-request-option__feature\">\n <CheckmarkIcon size=\"sm\" />\n <span>{feature}</span>\n </span>\n ))}\n </span>\n ) : null}\n {cta ? (\n <span className=\"tm-new-request-option__cta\">\n {cta}\n <NextArrowIcon size=\"sm\" />\n </span>\n ) : null}\n </span>\n </>\n );\n\n const shared = {\n ref,\n className: cn('tm-new-request-option', className),\n 'aria-labelledby': description ? `${titleId} ${descriptionId}` : titleId,\n 'aria-describedby': hasFeatures ? featuresId : undefined,\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot aria-disabled={disabled || undefined} {...shared}>\n {isValidElement(children) ? cloneElement(children as ReactElement<{ children?: ReactNode }>, undefined, content) : children}\n </Slot>\n );\n }\n if (href !== undefined) {\n const Anchor = 'a' as ElementType;\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n return (\n <Anchor href={disabled ? undefined : href} aria-disabled={disabled || undefined} {...shared}>\n {content}\n </Anchor>\n );\n }\n return (\n <button type=\"button\" disabled={disabled} {...shared}>\n {content}\n </button>\n );\n});\n\nexport interface NewRequestOverlayOption extends NewRequestOptionContent {\n /** Identifies the option in `onSelect`. */\n id: string;\n /** Disables the card (buttons only). */\n disabled?: boolean;\n}\n\nexport interface NewRequestOverlayProps extends Omit<DialogProps, 'size' | 'role' | 'footer' | 'children' | 'onSelect'> {\n /** The request types to choose from (Figma \"Options\"): any number, laid out in equal columns that wrap. */\n options?: NewRequestOverlayOption[];\n /** Called with the option's `id` when a card is activated. */\n onSelect?: (id: string) => void;\n /** `false` keeps the overlay open after a choice (close it yourself through `open`). */\n closeOnSelect?: boolean;\n /** Line under the options (Figma \"Not sure which one? See how TravelMatch works\"); links inside it are styled. */\n footer?: ReactNode;\n /**\n * Replaces the option cards: compose `NewRequestOptionCard` yourself (e.g. `asChild` with router links)\n * or render the next step of the flow here.\n */\n children?: ReactNode;\n}\n\n/**\n * The overlay that starts a new request by choosing its type (Figma component set \"New Request Overlay\").\n * A large centered dialog; below 768px it covers the screen and the cards stack.\n */\nexport const NewRequestOverlay = /* @__PURE__ */ forwardRef<HTMLDivElement, NewRequestOverlayProps>(function NewRequestOverlay(\n { options = [], onSelect, closeOnSelect = true, footer, children, open: openProp, defaultOpen = false, onOpenChange, mobilePlacement = 'fullscreen', className, ...props },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n const select = (id: string) => (_event: MouseEvent) => {\n onSelect?.(id);\n if (closeOnSelect) setOpen(false);\n };\n\n return (\n <Dialog ref={ref} size=\"lg\" className={cn('tm-new-request-overlay', className)} open={open} onOpenChange={setOpen} mobilePlacement={mobilePlacement} {...props}>\n <div className=\"tm-new-request-overlay__content\">\n {children ??\n (options.length > 0 ? (\n <ul className=\"tm-new-request-overlay__options\" role=\"list\">\n {options.map(({ id, ...option }) => (\n <li key={id} className=\"tm-new-request-overlay__option\">\n <NewRequestOptionCard {...option} data-option={id} onClick={select(id)} />\n </li>\n ))}\n </ul>\n ) : null)}\n {footer ? <div className=\"tm-new-request-overlay__footer\">{footer}</div> : null}\n </div>\n </Dialog>\n );\n});\n"],"mappings":";;;;;;;;;;AAgDA,IAAaE,IAAuC,kBAAyD,SAC3G,EAAE,UAAO,gBAAa,SAAM,aAAU,cAAW,IAAI,UAAO,aAAU,QAAK,SAAM,aAAU,IAAO,aAAU,cAAW,aAAU,GAAGC,KACpI,GACA;CACA,IAAMC,IAAKC,EAAM,GACXC,IAAU,GAAGF,EAAG,SAChBG,IAAgB,GAAGH,EAAG,eACtBI,IAAa,GAAGJ,EAAG,YACnBK,IAAc,GAAQC,KAAYA,EAAS,SAAS,IACpDC,IAAQC,MAAUC,IAAW,kBAAC,OAAD;EAAK,KAAKA;EAAU,KAAKC;EAAU,SAAQ;EAAO,UAAS;CAAS,CAAA,IAAI,OAGrGC,IACJ,kBAAAf,GAAA,EAAA,UAAA,CACGW,IAAQ,kBAAC,QAAD;EAAM,WAAU;EAAgC,UAAAA;CAAY,CAAA,IAAI,MACzE,kBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA;GACGK,IACC,kBAAC,QAAD;IAAM,WAAU;IAA8B,qBAAkB;IAAK,eAAY;IAC9E,UAAAA;GACG,CAAA,IACJ;GACJ,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAAC,QAAD;KAAM,IAAIV;KAAS,WAAU;KAC1B,UAAAW;IACG,CAAA,GACLC,IACC,kBAAC,QAAD;KAAM,IAAIX;KAAe,WAAU;KAChC,UAAAW;IACG,CAAA,IACJ,IACA;;GACLT,IACC,kBAAC,QAAD;IAAM,IAAID;IAAY,WAAU;IAC7B,UAAAE,EAAU,KAAK,GAAS,MACvB,kBAAC,QAAD;KAAkB,WAAU;KAA5B,UAAA,CACE,kBAACS,GAAD,EAAe,MAAK,KAAM,CAAA,GAC1B,kBAAC,QAAD,EAAA,UAAOC,EAAc,CAAA,CACjB;IAHK,GAAAC,CAGL,C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cAAce;EAA0B;EAAiB,GAAItC;EACvJ,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG4B,MACEiB,EAAQ,SAAS,IAChB,kBAAC,MAAD;IAAI,WAAU;IAAkC,MAAK;IAClD,UAAAA,EAAQ,KAAK,EAAE,OAAI,GAAGC,QACrB,kBAAC,MAAD;KAAa,WAAU;KACrB,UAAA,kBAAC/C,GAAD;MAAsB,GAAI+C;MAAQ,eAAa7C;MAAI,SAASwC,EAAOxC,CAAE;KAAI,CAAA;IACvE,GAFKA,CAEL,CACL;GACC,CAAA,IACF,OACL8C,IAAS,kBAAC,OAAD;IAAK,WAAU;IAAkC,UAAAA;GAAY,CAAA,IAAI,IACxE;;CACC,CAAA;AAEZ,CAAC"}
1
+ {"version":3,"file":"NewRequestOverlay.js","names":["_Fragment","Fragment$1","NewRequestOptionCard","props","id","useId","titleId","descriptionId","featuresId","hasFeatures","features","media","image","imageSrc","imageAlt","content","icon","title","description","CheckmarkIcon","feature","index","cta","NextArrowIcon","shared","cn","className","asChild","Slot","disabled","isValidElement","children","cloneElement","href","NewRequestOverlay","openProp","uncontrolledOpen","setUncontrolledOpen","useState","defaultOpen","open","setOpen","next","onOpenChange","select","onSelect","closeOnSelect","Dialog","variant","options","RequestTypeOption","footer"],"sources":["../../../src/components/NewRequestOverlay/NewRequestOverlay.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport {\n cloneElement,\n forwardRef,\n isValidElement,\n useId,\n useState,\n type ButtonHTMLAttributes,\n type ElementType,\n type MouseEvent,\n type ReactElement,\n type ReactNode,\n} from 'react';\nimport { CheckmarkIcon, NextArrowIcon } from '../../icons';\nimport { cn } from '../../utils/cn';\nimport { Dialog, type DialogProps } from '../Dialog';\nimport { RequestTypeOption } from '../RequestTypeOption';\nimport './NewRequestOverlay.css';\n\ninterface NewRequestOptionContent {\n /** Name of the request type (Figma \"Travel Package\"). With the description it forms the card's accessible name. */\n title: ReactNode;\n /** One line under the title (Figma \"Plan a trip in Armenia or abroad.\"). */\n description?: ReactNode;\n /** One icon from `@travel-match/ui` for the 44px tile (Figma `roadmap`, `plane`). */\n icon?: ReactNode;\n /** `variant=\"cards\"` only. Photo at the top of the card; it is cropped to fill a 220px band (140px in narrow layouts). */\n imageSrc?: string;\n /** `variant=\"cards\"` only. Alternative text of the photo. The photos are decorative by default. */\n imageAlt?: string;\n /** `variant=\"cards\"` only. Custom image element used instead of `imageSrc`, e.g. `next/image`. */\n image?: ReactNode;\n /** `variant=\"cards\"` only. What the request type covers (Figma \"Capabilities\"); each entry gets a check mark. */\n features?: ReactNode[];\n /** `variant=\"cards\"` only. Call to action at the bottom of the card (Figma \"Start a Travel Package\"); an arrow is added after it. */\n cta?: ReactNode;\n /** Renders the card as a link to this URL instead of a button. */\n href?: string;\n}\n\nexport interface NewRequestOptionCardProps extends NewRequestOptionContent, Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'title'> {\n /** Renders the single child element (e.g. a router `<Link href=\"…\" />`) as the card instead of a `<button>`. */\n asChild?: boolean;\n}\n\n/**\n * The large photo card of the earlier New Request Overlay design (`variant=\"cards\"`): the whole card is one button or\n * link, named by its title and description; the feature list is its description for assistive technology.\n * The current Figma overlay uses the compact `RequestTypeOption` rows instead.\n */\nexport const NewRequestOptionCard = /* @__PURE__ */ forwardRef<HTMLButtonElement, NewRequestOptionCardProps>(function NewRequestOptionCard(\n { title, description, icon, imageSrc, imageAlt = '', image, features, cta, href, asChild = false, disabled, className, children, ...props },\n ref,\n) {\n const id = useId();\n const titleId = `${id}-title`;\n const descriptionId = `${id}-description`;\n const featuresId = `${id}-features`;\n const hasFeatures = Boolean(features && features.length > 0);\n const media = image ?? (imageSrc ? <img src={imageSrc} alt={imageAlt} loading=\"lazy\" decoding=\"async\" /> : null);\n\n // Only phrasing content inside: the card is a <button> or an <a>.\n const content = (\n <>\n {media ? <span className=\"tm-new-request-option__media\">{media}</span> : null}\n <span className=\"tm-new-request-option__content\">\n {icon ? (\n <span className=\"tm-new-request-option__icon\" data-tm-icon-size=\"md\" aria-hidden=\"true\">\n {icon}\n </span>\n ) : null}\n <span className=\"tm-new-request-option__text\">\n <span id={titleId} className=\"tm-new-request-option__title\">\n {title}\n </span>\n {description ? (\n <span id={descriptionId} className=\"tm-new-request-option__description\">\n {description}\n </span>\n ) : null}\n </span>\n {hasFeatures ? (\n <span id={featuresId} className=\"tm-new-request-option__features\">\n {features!.map((feature, index) => (\n <span key={index} className=\"tm-new-request-option__feature\">\n <CheckmarkIcon size=\"sm\" />\n <span>{feature}</span>\n </span>\n ))}\n </span>\n ) : null}\n {cta ? (\n <span className=\"tm-new-request-option__cta\">\n {cta}\n <NextArrowIcon size=\"sm\" />\n </span>\n ) : null}\n </span>\n </>\n );\n\n const shared = {\n ref,\n className: cn('tm-new-request-option', className),\n 'aria-labelledby': description ? `${titleId} ${descriptionId}` : titleId,\n 'aria-describedby': hasFeatures ? featuresId : undefined,\n ...props,\n };\n\n if (asChild) {\n return (\n <Slot aria-disabled={disabled || undefined} {...shared}>\n {isValidElement(children) ? cloneElement(children as ReactElement<{ children?: ReactNode }>, undefined, content) : children}\n </Slot>\n );\n }\n if (href !== undefined) {\n const Anchor = 'a' as ElementType;\n // A link cannot be `disabled`: without `href` it is not focusable or clickable, and says so to assistive technology.\n return (\n <Anchor href={disabled ? undefined : href} aria-disabled={disabled || undefined} {...shared}>\n {content}\n </Anchor>\n );\n }\n return (\n <button type=\"button\" disabled={disabled} {...shared}>\n {content}\n </button>\n );\n});\n\nexport interface NewRequestOverlayOption extends NewRequestOptionContent {\n /** Identifies the option in `onSelect`. */\n id: string;\n /** Disables the card (buttons only). */\n disabled?: boolean;\n}\n\n/** `list` — the current Figma design: a 560px dialog with one `RequestTypeOption` row per type · `cards` — the earlier design: a 1120px dialog with photo cards side by side. */\nexport type NewRequestOverlayVariant = 'list' | 'cards';\n\nexport interface NewRequestOverlayProps extends Omit<DialogProps, 'size' | 'role' | 'footer' | 'children' | 'onSelect'> {\n /** `list` (default, Figma \"New Request Overlay\"): compact rows in a 560px dialog · `cards`: the earlier large photo cards. */\n variant?: NewRequestOverlayVariant;\n /** The request types to choose from (Figma \"Options\"): any number — stacked rows (`list`) or equal columns that wrap (`cards`). */\n options?: NewRequestOverlayOption[];\n /** Called with the option's `id` when a card is activated. */\n onSelect?: (id: string) => void;\n /** `false` keeps the overlay open after a choice (close it yourself through `open`). */\n closeOnSelect?: boolean;\n /** Line under the options (Figma \"Not sure which one? See how TravelMatch works\"); links inside it are styled. */\n footer?: ReactNode;\n /**\n * Replaces the options: compose `RequestTypeOption` (or `NewRequestOptionCard`) yourself (e.g. `asChild` with router links)\n * or render the next step of the flow here.\n */\n children?: ReactNode;\n}\n\n/**\n * The overlay that starts a new request by choosing its type (Figma component set \"New Request Overlay\").\n * A centered dialog listing one `RequestTypeOption` per type; below 768px it covers the screen.\n */\nexport const NewRequestOverlay = /* @__PURE__ */ forwardRef<HTMLDivElement, NewRequestOverlayProps>(function NewRequestOverlay(\n {\n variant = 'list',\n options = [],\n onSelect,\n closeOnSelect = true,\n footer,\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n mobilePlacement = 'fullscreen',\n className,\n ...props\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const open = openProp ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (openProp === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n const select = (id: string) => (_event: MouseEvent) => {\n onSelect?.(id);\n if (closeOnSelect) setOpen(false);\n };\n\n return (\n <Dialog\n ref={ref}\n size={variant === 'cards' ? 'lg' : 'md'}\n className={cn('tm-new-request-overlay', className)}\n data-variant={variant}\n open={open}\n onOpenChange={setOpen}\n mobilePlacement={mobilePlacement}\n {...props}\n >\n <div className=\"tm-new-request-overlay__content\">\n {children ??\n (options.length > 0 ? (\n <ul className=\"tm-new-request-overlay__options\" role=\"list\">\n {options.map(({ id, title, description, icon, href, disabled, imageSrc, imageAlt, image, features, cta }) => (\n <li key={id} className=\"tm-new-request-overlay__option\">\n {variant === 'cards' ? (\n <NewRequestOptionCard\n {...{ title, description, icon, href, disabled, imageSrc, imageAlt, image, features, cta }}\n data-option={id}\n onClick={select(id)}\n />\n ) : (\n <RequestTypeOption title={title} description={description} icon={icon} href={href} disabled={disabled} data-option={id} onClick={select(id)} />\n )}\n </li>\n ))}\n </ul>\n ) : null)}\n {footer ? <div className=\"tm-new-request-overlay__footer\">{footer}</div> : null}\n </div>\n </Dialog>\n );\n});\n"],"mappings":";;;;;;;;;;;AAkDA,IAAaE,IAAuC,kBAAyD,SAC3G,EAAE,UAAO,gBAAa,SAAM,aAAU,cAAW,IAAI,UAAO,aAAU,QAAK,SAAM,aAAU,IAAO,aAAU,cAAW,aAAU,GAAGC,KACpI,GACA;CACA,IAAMC,IAAKC,EAAM,GACXC,IAAU,GAAGF,EAAG,SAChBG,IAAgB,GAAGH,EAAG,eACtBI,IAAa,GAAGJ,EAAG,YACnBK,IAAc,GAAQC,KAAYA,EAAS,SAAS,IACpDC,IAAQC,MAAUC,IAAW,kBAAC,OAAD;EAAK,KAAKA;EAAU,KAAKC;EAAU,SAAQ;EAAO,UAAS;CAAS,CAAA,IAAI,OAGrGC,IACJ,kBAAAf,GAAA,EAAA,UAAA,CACGW,IAAQ,kBAAC,QAAD;EAAM,WAAU;EAAgC,UAAAA;CAAY,CAAA,IAAI,MACzE,kBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA;GACGK,IACC,kBAAC,QAAD;IAAM,WAAU;IAA8B,qBAAkB;IAAK,eAAY;IAC9E,UAAAA;GACG,CAAA,IACJ;GACJ,kBAAC,QAAD;IAAM,WAAU;IAAhB,UAAA,CACE,kBAAC,QAAD;KAAM,IAAIV;KAAS,WAAU;KAC1B,UAAAW;IACG,CAAA,GACLC,IACC,kBAAC,QAAD;KAAM,IAAIX;KAAe,WAAU;KAChC,UAAAW;IACG,CAAA,IACJ,IACA;;GACLT,IACC,kBAAC,QAA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EAAoBK,CAAI,GACpDC,IAAeD,CAAI;CACrB,GAEME,KAAU,OAAgB,MAAuB;EAErD,AADAC,IAAWzC,CAAE,GACT0C,KAAeL,EAAQ,EAAK;CAClC;CAEA,OACE,kBAACM,GAAD;EACO;EACL,MAAMC,MAAY,UAAU,OAAO;EACnC,WAAWvB,EAAG,0BAA0BC,CAAS;EACjD,gBAAcsB;EACR;EACN,cAAcP;EACG;EACjB,GAAItC;EAEJ,UAAA,kBAAC,OAAD;GAAK,WAAU;GAAf,UAAA,CACG4B,MACEkB,EAAQ,SAAS,IAChB,kBAAC,MAAD;IAAI,WAAU;IAAkC,MAAK;IAClD,UAAAA,EAAQ,KAAK,EAAE,OAAI,UAAO,gBAAa,SAAM,SAAM,aAAU,aAAU,aAAU,UAAO,aAAU,aACjG,kBAAC,MAAD;KAAa,WAAU;KACpB,UAAAD,MAAY,UACX,kBAAC9C,GAAD;MACQ;MAAO;MAAa;MAAM;MAAM;MAAU;MAAU;MAAU;MAAO;MAAU;MACrF,eAAaE;MACb,SAASwC,EAAOxC,CAAE;KACnB,CAAA,IAED,kBAAC8C,GAAD;MAA0B;MAAoB;MAAmB;MAAY;MAAgB;MAAU,eAAa9C;MAAI,SAASwC,EAAOxC,CAAE;KAAI,CAAA;IAE9I,GAVKA,CAUL,CACL;GACC,CAAA,IACF,OACL+C,IAAS,kBAAC,OAAD;IAAK,WAAU;IAAkC,UAAAA;GAAY,CAAA,IAAI,IACxE;;CACC,CAAA;AAEZ,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/cn.cjs"),n=require("../NotificationsButton/NotificationsButton.cjs"),r=require("./NotificationsDropdown.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@radix-ui/react-popover");o=e.__toESM(o,1);var s=(0,i.forwardRef)(function({title:e,headingLevel:s,headerAction:c,children:l,footer:u,emptyTitle:d,emptyMessage:f,empty:p,error:m,retryLabel:h,onRetry:g,open:_,defaultOpen:v=!1,onOpenChange:y,align:b=`end`,portalContainer:x,panelClassName:S,...C},w){let[T,E]=(0,i.useState)(v),D=_??T,O=e=>{_===void 0&&E(e),y?.(e)},k=e=>{!e.defaultPrevented&&e.target.closest(`a[href]`)&&O(!1)};return(0,a.jsxs)(o.Root,{open:D,onOpenChange:O,children:[(0,a.jsx)(o.Trigger,{asChild:!0,children:(0,a.jsx)(n.NotificationsButton,{ref:w,...C})}),(0,a.jsx)(o.Portal,{container:x,children:(0,a.jsx)(o.Content,{asChild:!0,align:b,sideOffset:8,collisionPadding:8,children:(0,a.jsx)(r.NotificationsDropdown,{className:t.cn(`tm-notifications-menu__panel`,S),title:e,headingLevel:s,headerAction:c,footer:u,emptyTitle:d,emptyMessage:f,empty:p,error:m,retryLabel:h,onRetry:g,onClick:k,children:l})})})]})});exports.NotificationsMenu=s;
1
+ "use client";const e=require("../../_virtual/_rolldown/runtime.cjs"),t=require("../../utils/cn.cjs"),n=require("../NotificationsButton/NotificationsButton.cjs"),r=require("./NotificationsDropdown.cjs");let i=require("react"),a=require("react/jsx-runtime"),o=require("@radix-ui/react-popover");o=e.__toESM(o,1);var s=(0,i.forwardRef)(function({title:e,headingLevel:s,headerAction:c,children:l,footer:u,emptyTitle:d,emptyMessage:f,empty:p,error:m,retryLabel:h,onRetry:g,open:_,defaultOpen:v=!1,onOpenChange:y,align:b=`center`,portalContainer:x,panelClassName:S,...C},w){let[T,E]=(0,i.useState)(v),D=_??T,O=e=>{_===void 0&&E(e),y?.(e)},k=e=>{!e.defaultPrevented&&e.target.closest(`a[href]`)&&O(!1)};return(0,a.jsxs)(o.Root,{open:D,onOpenChange:O,children:[(0,a.jsx)(o.Trigger,{asChild:!0,children:(0,a.jsx)(n.NotificationsButton,{ref:w,...C})}),(0,a.jsx)(o.Portal,{container:x,children:(0,a.jsx)(o.Content,{asChild:!0,align:b,sideOffset:8,collisionPadding:8,children:(0,a.jsx)(r.NotificationsDropdown,{className:t.cn(`tm-notifications-menu__panel`,S),title:e,headingLevel:s,headerAction:c,footer:u,emptyTitle:d,emptyMessage:f,empty:p,error:m,retryLabel:h,onRetry:g,onClick:k,children:l})})})]})});exports.NotificationsMenu=s;
2
2
  //# sourceMappingURL=NotificationsMenu.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsMenu.cjs","names":["useState","Popover","NotificationsButton","NotificationsDropdown","cn","require_runtime","require_cn","require_NotificationsButton","require_NotificationsDropdown","react","react_jsx_runtime","_radix_ui_react_popover","NotificationsMenu","buttonProps","uncontrolledOpen","setUncontrolledOpen","defaultOpen","isOpen","open","setOpen","next","onOpenChange","closeOnLink","event","portalContainer","panelClassName"],"sources":["../../../src/components/NotificationsDropdown/NotificationsMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { forwardRef, useState, type MouseEvent } from 'react';\nimport { cn } from '../../utils/cn';\nimport { NotificationsButton, type NotificationsButtonProps } from '../NotificationsButton';\nimport { NotificationsDropdown, type NotificationsDropdownProps } from './NotificationsDropdown';\n\ntype PanelProps = Pick<\n NotificationsDropdownProps,\n 'title' | 'headingLevel' | 'headerAction' | 'children' | 'footer' | 'emptyTitle' | 'emptyMessage' | 'empty' | 'error' | 'retryLabel' | 'onRetry'\n>;\n\nexport interface NotificationsMenuProps extends Omit<NotificationsButtonProps, 'title'>, PanelProps {\n /** Whether the panel is open (controlled). */\n open?: boolean;\n /** Opens the panel initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** How the panel lines up with the button. Figma aligns their right edges (`end`). */\n align?: 'start' | 'center' | 'end';\n /** Element the panel is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Class for the panel, which is rendered in a portal outside the button. */\n panelClassName?: string;\n}\n\n/**\n * The bell button with its dropdown (Figma \"Notifications / State=Open\"): `NotificationsButton` opening a\n * `NotificationsDropdown` in a popover. Escape and a click outside close it, and so does following a link inside it.\n * The ref and the remaining props go to the button.\n */\nexport const NotificationsMenu = /* @__PURE__ */ forwardRef<HTMLButtonElement, NotificationsMenuProps>(function NotificationsMenu(\n {\n title,\n headingLevel,\n headerAction,\n children,\n footer,\n emptyTitle,\n emptyMessage,\n empty,\n error,\n retryLabel,\n onRetry,\n open,\n defaultOpen = false,\n onOpenChange,\n align = 'end',\n portalContainer,\n panelClassName,\n ...buttonProps\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const isOpen = open ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n // A notification that is a link takes the user to another page: the panel should not stay open over it.\n const closeOnLink = (event: MouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented && (event.target as Element).closest('a[href]')) setOpen(false);\n };\n\n return (\n <Popover.Root open={isOpen} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <NotificationsButton ref={ref} {...buttonProps} />\n </Popover.Trigger>\n <Popover.Portal container={portalContainer}>\n <Popover.Content asChild align={align} sideOffset={8} collisionPadding={8}>\n <NotificationsDropdown\n className={cn('tm-notifications-menu__panel', panelClassName)}\n title={title}\n headingLevel={headingLevel}\n headerAction={headerAction}\n footer={footer}\n emptyTitle={emptyTitle}\n emptyMessage={emptyMessage}\n empty={empty}\n error={error}\n retryLabel={retryLabel}\n onRetry={onRetry}\n onClick={closeOnLink}\n >\n {children}\n </NotificationsDropdown>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":"A,sTA+BA,IAAaY,GAAoC,EAAAH,EAAA,WAAA,CAAsD,SACrG,CACE,QACA,eACA,eACA,WACA,SACA,aACA,eACA,QACA,QACA,aACA,UACA,OACA,cAAc,GACd,eACA,QAAQ,MACR,kBACA,iBACA,GAAGI,GAEL,EACA,CACA,GAAM,CAACC,EAAkBC,IAAA,EAAuBf,EAAAA,SAAAA,CAASgB,CAAW,EAC9DC,EAASC,GAAQJ,EACjBK,EAAW,GAAkB,CAC7BD,IAAS,IAAA,IAAWH,EAAoBK,CAAI,EAChDC,IAAeD,CAAI,CACrB,EAGME,EAAe,GAAmC,CAClD,CAACC,EAAM,kBAAqBA,EAAM,OAAmB,QAAQ,SAAS,GAAGJ,EAAQ,EAAK,CAC5F,EAEA,OACE,EAAAT,EAAA,KAAA,CAACT,EAAQ,KAAT,CAAc,KAAMgB,EAAQ,aAAcE,EAA1C,SAAA,EACE,EAAAT,EAAA,IAAA,CAACT,EAAQ,QAAT,CAAiB,QAAA,GACf,UAAA,EAAAS,EAAA,IAAA,CAACR,EAAAA,oBAAD,CAA0B,MAAK,GAAIW,CAAc,CAAA,CAClC,CAAA,GACjB,EAAAH,EAAA,IAAA,CAACT,EAAQ,OAAT,CAAgB,UAAWuB,EACzB,UAAA,EAAAd,EAAA,IAAA,CAACT,EAAQ,QAAT,CAAiB,QAAA,GAAe,QAAO,WAAY,EAAG,iBAAkB,EACtE,UAAA,EAAAS,EAAA,IAAA,CAACP,EAAAA,sBAAD,CACE,UAAWC,EAAAA,GAAG,+BAAgCqB,CAAc,EACrD,QACO,eACA,eACN,SACI,aACE,eACP,QACA,QACK,aACH,UACT,QAASH,EAER,UACoB,CAAA,CACR,CAAA,CACH,CAAA,CACJ,C,EAElB,CAAC,E"}
1
+ {"version":3,"file":"NotificationsMenu.cjs","names":["useState","Popover","NotificationsButton","NotificationsDropdown","cn","require_runtime","require_cn","require_NotificationsButton","require_NotificationsDropdown","react","react_jsx_runtime","_radix_ui_react_popover","NotificationsMenu","buttonProps","uncontrolledOpen","setUncontrolledOpen","defaultOpen","isOpen","open","setOpen","next","onOpenChange","closeOnLink","event","portalContainer","panelClassName"],"sources":["../../../src/components/NotificationsDropdown/NotificationsMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { forwardRef, useState, type MouseEvent } from 'react';\nimport { cn } from '../../utils/cn';\nimport { NotificationsButton, type NotificationsButtonProps } from '../NotificationsButton';\nimport { NotificationsDropdown, type NotificationsDropdownProps } from './NotificationsDropdown';\n\ntype PanelProps = Pick<\n NotificationsDropdownProps,\n 'title' | 'headingLevel' | 'headerAction' | 'children' | 'footer' | 'emptyTitle' | 'emptyMessage' | 'empty' | 'error' | 'retryLabel' | 'onRetry'\n>;\n\nexport interface NotificationsMenuProps extends Omit<NotificationsButtonProps, 'title'>, PanelProps {\n /** Whether the panel is open (controlled). */\n open?: boolean;\n /** Opens the panel initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * How the panel lines up with the button. Figma centres it under the button (`center`, the default); near the edge of\n * the screen it shifts to stay 8px inside the viewport.\n */\n align?: 'start' | 'center' | 'end';\n /** Element the panel is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Class for the panel, which is rendered in a portal outside the button. */\n panelClassName?: string;\n}\n\n/**\n * The bell button with its dropdown (Figma \"Notifications / State=Open\"): `NotificationsButton` opening a\n * `NotificationsDropdown` in a popover. Escape and a click outside close it, and so does following a link inside it.\n * The ref and the remaining props go to the button.\n */\nexport const NotificationsMenu = /* @__PURE__ */ forwardRef<HTMLButtonElement, NotificationsMenuProps>(function NotificationsMenu(\n {\n title,\n headingLevel,\n headerAction,\n children,\n footer,\n emptyTitle,\n emptyMessage,\n empty,\n error,\n retryLabel,\n onRetry,\n open,\n defaultOpen = false,\n onOpenChange,\n align = 'center',\n portalContainer,\n panelClassName,\n ...buttonProps\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const isOpen = open ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n // A notification that is a link takes the user to another page: the panel should not stay open over it.\n const closeOnLink = (event: MouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented && (event.target as Element).closest('a[href]')) setOpen(false);\n };\n\n return (\n <Popover.Root open={isOpen} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <NotificationsButton ref={ref} {...buttonProps} />\n </Popover.Trigger>\n <Popover.Portal container={portalContainer}>\n <Popover.Content asChild align={align} sideOffset={8} collisionPadding={8}>\n <NotificationsDropdown\n className={cn('tm-notifications-menu__panel', panelClassName)}\n title={title}\n headingLevel={headingLevel}\n headerAction={headerAction}\n footer={footer}\n emptyTitle={emptyTitle}\n emptyMessage={emptyMessage}\n empty={empty}\n error={error}\n retryLabel={retryLabel}\n onRetry={onRetry}\n onClick={closeOnLink}\n >\n {children}\n </NotificationsDropdown>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":"A,sTAkCA,IAAaY,GAAoC,EAAAH,EAAA,WAAA,CAAsD,SACrG,CACE,QACA,eACA,eACA,WACA,SACA,aACA,eACA,QACA,QACA,aACA,UACA,OACA,cAAc,GACd,eACA,QAAQ,SACR,kBACA,iBACA,GAAGI,GAEL,EACA,CACA,GAAM,CAACC,EAAkBC,IAAA,EAAuBf,EAAAA,SAAAA,CAASgB,CAAW,EAC9DC,EAASC,GAAQJ,EACjBK,EAAW,GAAkB,CAC7BD,IAAS,IAAA,IAAWH,EAAoBK,CAAI,EAChDC,IAAeD,CAAI,CACrB,EAGME,EAAe,GAAmC,CAClD,CAACC,EAAM,kBAAqBA,EAAM,OAAmB,QAAQ,SAAS,GAAGJ,EAAQ,EAAK,CAC5F,EAEA,OACE,EAAAT,EAAA,KAAA,CAACT,EAAQ,KAAT,CAAc,KAAMgB,EAAQ,aAAcE,EAA1C,SAAA,EACE,EAAAT,EAAA,IAAA,CAACT,EAAQ,QAAT,CAAiB,QAAA,GACf,UAAA,EAAAS,EAAA,IAAA,CAACR,EAAAA,oBAAD,CAA0B,MAAK,GAAIW,CAAc,CAAA,CAClC,CAAA,GACjB,EAAAH,EAAA,IAAA,CAACT,EAAQ,OAAT,CAAgB,UAAWuB,EACzB,UAAA,EAAAd,EAAA,IAAA,CAACT,EAAQ,QAAT,CAAiB,QAAA,GAAe,QAAO,WAAY,EAAG,iBAAkB,EACtE,UAAA,EAAAS,EAAA,IAAA,CAACP,EAAAA,sBAAD,CACE,UAAWC,EAAAA,GAAG,+BAAgCqB,CAAc,EACrD,QACO,eACA,eACN,SACI,aACE,eACP,QACA,QACK,aACH,UACT,QAASH,EAER,UACoB,CAAA,CACR,CAAA,CACH,CAAA,CACJ,C,EAElB,CAAC,E"}
@@ -6,7 +6,7 @@ import { forwardRef as r, useState as i } from "react";
6
6
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  import * as s from "@radix-ui/react-popover";
8
8
  // src/components/NotificationsDropdown/NotificationsMenu.tsx
9
- var c = /* @__PURE__ */ r(function({ title: r, headingLevel: c, headerAction: l, children: u, footer: d, emptyTitle: f, emptyMessage: p, empty: m, error: h, retryLabel: g, onRetry: _, open: v, defaultOpen: y = !1, onOpenChange: b, align: x = "end", portalContainer: S, panelClassName: C, ...w }, T) {
9
+ var c = /* @__PURE__ */ r(function({ title: r, headingLevel: c, headerAction: l, children: u, footer: d, emptyTitle: f, emptyMessage: p, empty: m, error: h, retryLabel: g, onRetry: _, open: v, defaultOpen: y = !1, onOpenChange: b, align: x = "center", portalContainer: S, panelClassName: C, ...w }, T) {
10
10
  let [E, D] = i(y), O = v ?? E, k = (e) => {
11
11
  v === void 0 && D(e), b?.(e);
12
12
  }, A = (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"NotificationsMenu.js","names":["Popover","NotificationsMenu","buttonProps","uncontrolledOpen","setUncontrolledOpen","useState","defaultOpen","isOpen","open","setOpen","next","onOpenChange","closeOnLink","event","NotificationsButton","portalContainer","NotificationsDropdown","cn","panelClassName"],"sources":["../../../src/components/NotificationsDropdown/NotificationsMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { forwardRef, useState, type MouseEvent } from 'react';\nimport { cn } from '../../utils/cn';\nimport { NotificationsButton, type NotificationsButtonProps } from '../NotificationsButton';\nimport { NotificationsDropdown, type NotificationsDropdownProps } from './NotificationsDropdown';\n\ntype PanelProps = Pick<\n NotificationsDropdownProps,\n 'title' | 'headingLevel' | 'headerAction' | 'children' | 'footer' | 'emptyTitle' | 'emptyMessage' | 'empty' | 'error' | 'retryLabel' | 'onRetry'\n>;\n\nexport interface NotificationsMenuProps extends Omit<NotificationsButtonProps, 'title'>, PanelProps {\n /** Whether the panel is open (controlled). */\n open?: boolean;\n /** Opens the panel initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /** How the panel lines up with the button. Figma aligns their right edges (`end`). */\n align?: 'start' | 'center' | 'end';\n /** Element the panel is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Class for the panel, which is rendered in a portal outside the button. */\n panelClassName?: string;\n}\n\n/**\n * The bell button with its dropdown (Figma \"Notifications / State=Open\"): `NotificationsButton` opening a\n * `NotificationsDropdown` in a popover. Escape and a click outside close it, and so does following a link inside it.\n * The ref and the remaining props go to the button.\n */\nexport const NotificationsMenu = /* @__PURE__ */ forwardRef<HTMLButtonElement, NotificationsMenuProps>(function NotificationsMenu(\n {\n title,\n headingLevel,\n headerAction,\n children,\n footer,\n emptyTitle,\n emptyMessage,\n empty,\n error,\n retryLabel,\n onRetry,\n open,\n defaultOpen = false,\n onOpenChange,\n align = 'end',\n portalContainer,\n panelClassName,\n ...buttonProps\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const isOpen = open ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n // A notification that is a link takes the user to another page: the panel should not stay open over it.\n const closeOnLink = (event: MouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented && (event.target as Element).closest('a[href]')) setOpen(false);\n };\n\n return (\n <Popover.Root open={isOpen} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <NotificationsButton ref={ref} {...buttonProps} />\n </Popover.Trigger>\n <Popover.Portal container={portalContainer}>\n <Popover.Content asChild align={align} sideOffset={8} collisionPadding={8}>\n <NotificationsDropdown\n className={cn('tm-notifications-menu__panel', panelClassName)}\n title={title}\n headingLevel={headingLevel}\n headerAction={headerAction}\n footer={footer}\n emptyTitle={emptyTitle}\n emptyMessage={emptyMessage}\n empty={empty}\n error={error}\n retryLabel={retryLabel}\n onRetry={onRetry}\n onClick={closeOnLink}\n >\n {children}\n </NotificationsDropdown>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;AA+BA,IAAaC,IAAoC,kBAAsD,SACrG,EACE,UACA,iBACA,iBACA,aACA,WACA,eACA,iBACA,UACA,UACA,eACA,YACA,SACA,iBAAc,IACd,iBACA,WAAQ,OACR,oBACA,mBACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAkBC,KAAuBC,EAASC,CAAW,GAC9DC,IAASC,KAAQL,GACjBM,KAAW,MAAkB;EAEjC,AADID,MAAS,KAAA,KAAWJ,EAAoBM,CAAI,GAChDC,IAAeD,CAAI;CACrB,GAGME,KAAe,MAAmC;EACtD,AAAI,CAACC,EAAM,oBAAqBA,EAAM,OAAmB,QAAQ,SAAS,KAAGJ,EAAQ,EAAK;CAC5F;CAEA,OACE,kBAACT,EAAQ,MAAT;EAAc,MAAMO;EAAQ,cAAcE;EAA1C,UAAA,CACE,kBAACT,EAAQ,SAAT;GAAiB,SAAA;GACf,UAAA,kBAACc,GAAD;IAA0B;IAAK,GAAIZ;GAAc,CAAA;EAClC,CAAA,GACjB,kBAACF,EAAQ,QAAT;GAAgB,WAAWe;GACzB,UAAA,kBAACf,EAAQ,SAAT;IAAiB,SAAA;IAAe;IAAO,YAAY;IAAG,kBAAkB;IACtE,UAAA,kBAACgB,GAAD;KACE,WAAWC,EAAG,gCAAgCC,CAAc;KACrD;KACO;KACA;KACN;KACI;KACE;KACP;KACA;KACK;KACH;KACT,SAASN;KAER;IACoB,CAAA;GACR,CAAA;EACH,CAAA,CACJ;;AAElB,CAAC"}
1
+ {"version":3,"file":"NotificationsMenu.js","names":["Popover","NotificationsMenu","buttonProps","uncontrolledOpen","setUncontrolledOpen","useState","defaultOpen","isOpen","open","setOpen","next","onOpenChange","closeOnLink","event","NotificationsButton","portalContainer","NotificationsDropdown","cn","panelClassName"],"sources":["../../../src/components/NotificationsDropdown/NotificationsMenu.tsx"],"sourcesContent":["import * as Popover from '@radix-ui/react-popover';\nimport { forwardRef, useState, type MouseEvent } from 'react';\nimport { cn } from '../../utils/cn';\nimport { NotificationsButton, type NotificationsButtonProps } from '../NotificationsButton';\nimport { NotificationsDropdown, type NotificationsDropdownProps } from './NotificationsDropdown';\n\ntype PanelProps = Pick<\n NotificationsDropdownProps,\n 'title' | 'headingLevel' | 'headerAction' | 'children' | 'footer' | 'emptyTitle' | 'emptyMessage' | 'empty' | 'error' | 'retryLabel' | 'onRetry'\n>;\n\nexport interface NotificationsMenuProps extends Omit<NotificationsButtonProps, 'title'>, PanelProps {\n /** Whether the panel is open (controlled). */\n open?: boolean;\n /** Opens the panel initially (uncontrolled). */\n defaultOpen?: boolean;\n /** Called when the panel opens or closes. */\n onOpenChange?: (open: boolean) => void;\n /**\n * How the panel lines up with the button. Figma centres it under the button (`center`, the default); near the edge of\n * the screen it shifts to stay 8px inside the viewport.\n */\n align?: 'start' | 'center' | 'end';\n /** Element the panel is rendered into (default `document.body`). Set it when the theme is scoped to a container. */\n portalContainer?: HTMLElement | null;\n /** Class for the panel, which is rendered in a portal outside the button. */\n panelClassName?: string;\n}\n\n/**\n * The bell button with its dropdown (Figma \"Notifications / State=Open\"): `NotificationsButton` opening a\n * `NotificationsDropdown` in a popover. Escape and a click outside close it, and so does following a link inside it.\n * The ref and the remaining props go to the button.\n */\nexport const NotificationsMenu = /* @__PURE__ */ forwardRef<HTMLButtonElement, NotificationsMenuProps>(function NotificationsMenu(\n {\n title,\n headingLevel,\n headerAction,\n children,\n footer,\n emptyTitle,\n emptyMessage,\n empty,\n error,\n retryLabel,\n onRetry,\n open,\n defaultOpen = false,\n onOpenChange,\n align = 'center',\n portalContainer,\n panelClassName,\n ...buttonProps\n },\n ref,\n) {\n const [uncontrolledOpen, setUncontrolledOpen] = useState(defaultOpen);\n const isOpen = open ?? uncontrolledOpen;\n const setOpen = (next: boolean) => {\n if (open === undefined) setUncontrolledOpen(next);\n onOpenChange?.(next);\n };\n\n // A notification that is a link takes the user to another page: the panel should not stay open over it.\n const closeOnLink = (event: MouseEvent<HTMLElement>) => {\n if (!event.defaultPrevented && (event.target as Element).closest('a[href]')) setOpen(false);\n };\n\n return (\n <Popover.Root open={isOpen} onOpenChange={setOpen}>\n <Popover.Trigger asChild>\n <NotificationsButton ref={ref} {...buttonProps} />\n </Popover.Trigger>\n <Popover.Portal container={portalContainer}>\n <Popover.Content asChild align={align} sideOffset={8} collisionPadding={8}>\n <NotificationsDropdown\n className={cn('tm-notifications-menu__panel', panelClassName)}\n title={title}\n headingLevel={headingLevel}\n headerAction={headerAction}\n footer={footer}\n emptyTitle={emptyTitle}\n emptyMessage={emptyMessage}\n empty={empty}\n error={error}\n retryLabel={retryLabel}\n onRetry={onRetry}\n onClick={closeOnLink}\n >\n {children}\n </NotificationsDropdown>\n </Popover.Content>\n </Popover.Portal>\n </Popover.Root>\n );\n});\n"],"mappings":";;;;;;;;AAkCA,IAAaC,IAAoC,kBAAsD,SACrG,EACE,UACA,iBACA,iBACA,aACA,WACA,eACA,iBACA,UACA,UACA,eACA,YACA,SACA,iBAAc,IACd,iBACA,WAAQ,UACR,oBACA,mBACA,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAkBC,KAAuBC,EAASC,CAAW,GAC9DC,IAASC,KAAQL,GACjBM,KAAW,MAAkB;EAEjC,AADID,MAAS,KAAA,KAAWJ,EAAoBM,CAAI,GAChDC,IAAeD,CAAI;CACrB,GAGME,KAAe,MAAmC;EACtD,AAAI,CAACC,EAAM,oBAAqBA,EAAM,OAAmB,QAAQ,SAAS,KAAGJ,EAAQ,EAAK;CAC5F;CAEA,OACE,kBAACT,EAAQ,MAAT;EAAc,MAAMO;EAAQ,cAAcE;EAA1C,UAAA,CACE,kBAACT,EAAQ,SAAT;GAAiB,SAAA;GACf,UAAA,kBAACc,GAAD;IAA0B;IAAK,GAAIZ;GAAc,CAAA;EAClC,CAAA,GACjB,kBAACF,EAAQ,QAAT;GAAgB,WAAWe;GACzB,UAAA,kBAACf,EAAQ,SAAT;IAAiB,SAAA;IAAe;IAAO,YAAY;IAAG,kBAAkB;IACtE,UAAA,kBAACgB,GAAD;KACE,WAAWC,EAAG,gCAAgCC,CAAc;KACrD;KACO;KACA;KACN;KACI;KACE;KACP;KACA;KACK;KACH;KACT,SAASN;KAER;IACoB,CAAA;GACR,CAAA;EACH,CAAA,CACJ;;AAElB,CAAC"}
@@ -1,2 +1,2 @@
1
- "use client";const e=require("../../utils/cn.cjs"),t=require("../PartnerCarousel/autoplay.cjs");;/* empty css */let n=require("react"),r=require("react/jsx-runtime");var i=300,a=(0,n.forwardRef)(function({children:a,value:o,defaultValue:s=0,onValueChange:c,autoPlay:l=!1,interval:u=4e3,paused:d=!1,className:f,...p},m){let h=n.Children.toArray(a),g=h.length,_=(0,n.useRef)(null),[v,y]=t.useIndexState(o,s,c,g),{running:b,interactionProps:x}=t.useAutoplay({enabled:l&&g>1,paused:d,delay:u+i,onTick:()=>y((v+1)%g),rootRef:_,resetKey:v}),{onPointerEnter:S,onPointerLeave:C,onFocus:w,onBlur:T}=x,E=e=>{e!==v&&y(e)},D=e=>t=>{let n=!0;try{n=t.target.matches(`:focus-visible`)}catch{}n&&E(e)};return(0,r.jsx)(`div`,{ref:e=>{_.current=e,typeof m==`function`?m(e):m&&(m.current=e)},className:e.cn(`tm-package-animation`,f),"data-autoplay":b?`running`:l?`paused`:void 0,...p,onPointerEnter:e=>{p.onPointerEnter?.(e),S(e)},onPointerLeave:e=>{p.onPointerLeave?.(e),C()},onFocus:e=>{p.onFocus?.(e),w(e)},onBlur:e=>{p.onBlur?.(e),T(e)},children:(0,r.jsx)(`div`,{className:`tm-package-animation__stage`,children:h.map((e,t)=>(0,r.jsx)(`div`,{className:`tm-package-animation__card`,"data-position":t===v?`front`:`back`,onClick:()=>E(t),onFocus:D(t),children:e},t))})})});exports.PackageAnimation=a;
1
+ "use client";const e=require("../../utils/cn.cjs"),t=require("../PartnerCarousel/autoplay.cjs");;/* empty css */let n=require("react"),r=require("react/jsx-runtime");var i=300,a=(0,n.forwardRef)(function({children:a,value:o,defaultValue:s=0,onValueChange:c,autoPlay:l=!0,interval:u=4e3,paused:d=!1,className:f,...p},m){let h=n.Children.toArray(a),g=h.length,_=(0,n.useRef)(null),[v,y]=t.useIndexState(o,s,c,g),{running:b,interactionProps:x}=t.useAutoplay({enabled:l&&g>1,paused:d,delay:u+i,onTick:()=>y((v+1)%g),rootRef:_,resetKey:v}),{onPointerEnter:S,onPointerLeave:C,onFocus:w,onBlur:T}=x,E=e=>{e!==v&&y(e)},D=e=>t=>{let n=!0;try{n=t.target.matches(`:focus-visible`)}catch{}n&&E(e)};return(0,r.jsx)(`div`,{ref:e=>{_.current=e,typeof m==`function`?m(e):m&&(m.current=e)},className:e.cn(`tm-package-animation`,f),"data-autoplay":b?`running`:l?`paused`:void 0,...p,onPointerEnter:e=>{p.onPointerEnter?.(e),S(e)},onPointerLeave:e=>{p.onPointerLeave?.(e),C()},onFocus:e=>{p.onFocus?.(e),w(e)},onBlur:e=>{p.onBlur?.(e),T(e)},children:(0,r.jsx)(`div`,{className:`tm-package-animation__stage`,children:h.map((e,t)=>(0,r.jsx)(`div`,{className:`tm-package-animation__card`,"data-position":t===v?`front`:`back`,onClick:()=>E(t),onFocus:D(t),children:e},t))})})});exports.PackageAnimation=a;
2
2
  //# sourceMappingURL=PackageAnimation.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"PackageAnimation.cjs","names":["Children","useRef","useIndexState","useAutoplay","cn","require_cn","require_autoplay","react","react_jsx_runtime","SWAP_DURATION","PackageAnimation","props","cards","children","count","rootRef","index","setIndex","value","defaultValue","onValueChange","autoPlay","interval","interactionProps","bringToFront","i","handleFocus","keyboard","event","node","ref","className","running","onPointerEnter","onPointerLeave","onFocus","onBlur","card"],"sources":["../../../src/components/PackageAnimation/PackageAnimation.tsx"],"sourcesContent":["import { Children, forwardRef, useRef, type FocusEvent, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { useAutoplay, useIndexState } from '../PartnerCarousel/autoplay';\nimport './PackageAnimation.css';\n\n/** Figma prototype: Smart animate, ease out, 300ms. Keep in sync with `--_duration` in the stylesheet. */\nconst SWAP_DURATION = 300;\n\nexport interface PackageAnimationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The cards of the stack — two `PackageCard`s in Figma. The one at `value` lies in front, the others behind it. */\n children?: ReactNode;\n /** Index (0-based) of the card in front — Figma \"Property 1\": Default is the first swap state, Variant2 the other. Makes the component controlled. */\n value?: number;\n /** Card in front at first when uncontrolled. */\n defaultValue?: number;\n /** Called with the index of the card that comes to the front (click, keyboard focus or autoplay). */\n onValueChange?: (value: number) => void;\n /** Swaps the cards by itself, in an endless loop (the Figma prototype swaps on click only). Holds for hover, keyboard focus, a hidden tab, an off-screen stack and reduced motion. */\n autoPlay?: boolean;\n /** Time a card stays in front before the next swap, in ms. */\n interval?: number;\n /** Holds the autoplay from outside; it carries on once this is `false` again. */\n paused?: boolean;\n}\n\n/**\n * Two overlapping, tilted package cards that swap places (Figma component set \"Package animation\").\n * Clicking the card behind — or moving keyboard focus into it — brings it to the front. Both cards stay in the page for\n * assistive technology. Below 661px of container width the cards are upright and stacked, like \"Mobile / Package animation\".\n */\nexport const PackageAnimation = /* @__PURE__ */ forwardRef<HTMLDivElement, PackageAnimationProps>(function PackageAnimation(\n {\n children,\n value,\n defaultValue = 0,\n onValueChange,\n autoPlay = false,\n interval = 4000,\n paused = false,\n className,\n ...props\n },\n ref,\n) {\n const cards = Children.toArray(children);\n const count = cards.length;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [index, setIndex] = useIndexState(value, defaultValue, onValueChange, count);\n\n const { running, interactionProps } = useAutoplay({\n enabled: autoPlay && count > 1,\n paused,\n delay: interval + SWAP_DURATION,\n onTick: () => setIndex((index + 1) % count),\n rootRef,\n resetKey: index,\n });\n const { onPointerEnter, onPointerLeave, onFocus, onBlur } = interactionProps;\n\n const bringToFront = (i: number) => {\n if (i !== index) setIndex(i);\n };\n // Keyboard focus must not land on a covered control (WCAG 2.4.11). A pointer press is left alone here: moving the card\n // under the pointer would lose the click; the click handler brings the card forward afterwards.\n const handleFocus = (i: number) => (event: FocusEvent<HTMLDivElement>) => {\n let keyboard = true;\n try {\n keyboard = event.target.matches(':focus-visible');\n } catch {\n /* :focus-visible unsupported — treat every focus as keyboard focus */\n }\n if (keyboard) bringToFront(i);\n };\n\n return (\n <div\n ref={(node) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n className={cn('tm-package-animation', className)}\n data-autoplay={running ? 'running' : autoPlay ? 'paused' : undefined}\n {...props}\n onPointerEnter={(event) => {\n props.onPointerEnter?.(event);\n onPointerEnter(event);\n }}\n onPointerLeave={(event) => {\n props.onPointerLeave?.(event);\n onPointerLeave();\n }}\n onFocus={(event) => {\n props.onFocus?.(event);\n onFocus(event);\n }}\n onBlur={(event) => {\n props.onBlur?.(event);\n onBlur(event);\n }}\n >\n <div className=\"tm-package-animation__stage\">\n {cards.map((card, i) => (\n <div key={i} className=\"tm-package-animation__card\" data-position={i === index ? 'front' : 'back'} onClick={() => bringToFront(i)} onFocus={handleFocus(i)}>\n {card}\n </div>\n ))}\n </div>\n </div>\n );\n});\n"],"mappings":"A,4LAMA,IAAMS,EAAgB,IAwBTC,GAAmC,EAAAH,EAAA,WAAA,CAAkD,SAChG,CACE,WACA,QACA,e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A,UAAA,EAAApB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,8BACZ,SAAAI,EAAM,KAAK,EAAM,KAChB,EAAAJ,EAAA,IAAA,CAAC,MAAD,CAAa,UAAU,6BAA6B,gBAAeiB,IAAMT,EAAQ,QAAU,OAAQ,YAAeQ,EAAaC,CAAC,EAAG,QAASC,EAAYD,CAAC,EACtJ,SAAAY,CACE,EAFKZ,CAEL,CACN,CACE,CAAA,CACF,CAAA,CAET,CAAC,E"}
1
+ {"version":3,"file":"PackageAnimation.cjs","names":["Children","useRef","useIndexState","useAutoplay","cn","require_cn","require_autoplay","react","react_jsx_runtime","SWAP_DURATION","PackageAnimation","props","cards","children","count","rootRef","index","setIndex","value","defaultValue","onValueChange","autoPlay","interval","interactionProps","bringToFront","i","handleFocus","keyboard","event","node","ref","className","running","onPointerEnter","onPointerLeave","onFocus","onBlur","card"],"sources":["../../../src/components/PackageAnimation/PackageAnimation.tsx"],"sourcesContent":["import { Children, forwardRef, useRef, type FocusEvent, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { useAutoplay, useIndexState } from '../PartnerCarousel/autoplay';\nimport './PackageAnimation.css';\n\n/** Figma prototype: Smart animate, ease out, 300ms. Keep in sync with `--_duration` in the stylesheet. */\nconst SWAP_DURATION = 300;\n\nexport interface PackageAnimationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The cards of the stack — two `PackageCard`s in Figma. The one at `value` lies in front, the others behind it. */\n children?: ReactNode;\n /** Index (0-based) of the card in front — Figma \"Property 1\": Default is the first swap state, Variant2 the other. Makes the component controlled. */\n value?: number;\n /** Card in front at first when uncontrolled. */\n defaultValue?: number;\n /** Called with the index of the card that comes to the front (click, keyboard focus or autoplay). */\n onValueChange?: (value: number) => void;\n /** Swaps the cards by itself, in an endless loop (on by default; the Figma prototype swaps on click only). Holds for hover, keyboard focus, a hidden tab, an off-screen stack and reduced motion. */\n autoPlay?: boolean;\n /** Time a card stays in front before the next swap, in ms. */\n interval?: number;\n /** Holds the autoplay from outside; it carries on once this is `false` again. */\n paused?: boolean;\n}\n\n/**\n * Two overlapping, tilted package cards that swap places (Figma component set \"Package animation\").\n * Clicking the card behind — or moving keyboard focus into it — brings it to the front. Both cards stay in the page for\n * assistive technology. Below 661px of container width the cards are upright and stacked, like \"Mobile / Package animation\".\n */\nexport const PackageAnimation = /* @__PURE__ */ forwardRef<HTMLDivElement, PackageAnimationProps>(function PackageAnimation(\n {\n children,\n value,\n defaultValue = 0,\n onValueChange,\n autoPlay = true,\n interval = 4000,\n paused = false,\n className,\n ...props\n },\n ref,\n) {\n const cards = Children.toArray(children);\n const count = cards.length;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [index, setIndex] = useIndexState(value, defaultValue, onValueChange, count);\n\n const { running, interactionProps } = useAutoplay({\n enabled: autoPlay && count > 1,\n paused,\n delay: interval + SWAP_DURATION,\n onTick: () => setIndex((index + 1) % count),\n rootRef,\n resetKey: index,\n });\n const { onPointerEnter, onPointerLeave, onFocus, onBlur } = interactionProps;\n\n const bringToFront = (i: number) => {\n if (i !== index) setIndex(i);\n };\n // Keyboard focus must not land on a covered control (WCAG 2.4.11). A pointer press is left alone here: moving the card\n // under the pointer would lose the click; the click handler brings the card forward afterwards.\n const handleFocus = (i: number) => (event: FocusEvent<HTMLDivElement>) => {\n let keyboard = true;\n try {\n keyboard = event.target.matches(':focus-visible');\n } catch {\n /* :focus-visible unsupported — treat every focus as keyboard focus */\n }\n if (keyboard) bringToFront(i);\n };\n\n return (\n <div\n ref={(node) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n className={cn('tm-package-animation', className)}\n data-autoplay={running ? 'running' : autoPlay ? 'paused' : undefined}\n {...props}\n onPointerEnter={(event) => {\n props.onPointerEnter?.(event);\n onPointerEnter(event);\n }}\n onPointerLeave={(event) => {\n props.onPointerLeave?.(event);\n onPointerLeave();\n }}\n onFocus={(event) => {\n props.onFocus?.(event);\n onFocus(event);\n }}\n onBlur={(event) => {\n props.onBlur?.(event);\n onBlur(event);\n }}\n >\n <div className=\"tm-package-animation__stage\">\n {cards.map((card, i) => (\n <div key={i} className=\"tm-package-animation__card\" data-position={i === index ? 'front' : 'back'} onClick={() => bringToFront(i)} onFocus={handleFocus(i)}>\n {card}\n </div>\n ))}\n </div>\n </div>\n );\n});\n"],"mappings":"A,4LAMA,IAAMS,EAAgB,IAwBTC,GAAmC,EAAAH,EAAA,WAAA,CAAkD,SAChG,CACE,WACA,QACA,eAAe,EACf,gBACA,WAAW,GACX,WAAW,IACX,SAAS,GACT,YACA,GAAGI,GAEL,EACA,CACA,IAAMC,EAAQZ,EAAAA,SAAS,QAAQa,CAAQ,EACjCC,EAAQF,EAAM,OACdG,GAAA,EAAUd,EAAAA,OAAAA,CAA8B,IAAI,EAC5C,CAACe,EAAOC,GAAYf,EAAAA,cAAcgB,EAAOC,EAAcC,EAAeN,CAAK,EAE3E,CAAE,UAAS,oBAAqBX,EAAAA,YAAY,CAChD,QAASkB,GAAYP,EAAQ,EAC7B,SACA,MAAOQ,EAAWb,EAClB,WAAcQ,GAAUD,EAAQ,GAAKF,CAAK,EAC1C,UACA,SAAUE,CACZ,CAAC,EACK,CAAE,iBAAgB,iBAAgB,UAAS,UAAWO,EAEtDC,EAAgB,GAAc,CAC9BC,IAAMT,GAAOC,EAASQ,CAAC,CAC7B,EAGMC,EAAe,GAAe,GAAsC,CACxE,IAAIC,EAAW,GACf,GAAI,CACF,EAAWC,EAAM,OAAO,QAAQ,gBAAgB,CAClD,MAAQ,CAER,CACID,GAAUH,EAAaC,CAAC,CAC9B,EAEA,OACE,EAAAjB,EAAA,IAAA,CAAC,MAAD,CACE,IAAM,GAAS,CACb,EAAQ,QAAUqB,EACd,OAAOC,GAAQ,WAAYA,EAAID,CAAI,EAC9BC,IAAK,EAAI,QAAUD,EAC9B,EACA,UAAWzB,EAAAA,GAAG,uBAAwB2B,CAAS,EAC/C,gBAAeC,EAAU,UAAYX,EAAW,SAAW,IAAA,GAC3D,GAAIV,EACJ,eAAiB,GAAU,CACzBA,EAAM,iBAAiBiB,CAAK,EAC5BK,EAAeL,CAAK,CACtB,EACA,eAAiB,GAAU,CACzBjB,EAAM,iBAAiBiB,CAAK,EAC5BM,EAAe,CACjB,EACA,QAAU,GAAU,CAClBvB,EAAM,UAAUiB,CAAK,EACrBO,EAAQP,CAAK,CACf,EACA,OAAS,GAAU,CACjBjB,EAAM,SAASiB,CAAK,EACpBQ,EAAOR,CAAK,CACd,EAEA,UAAA,EAAApB,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,8BACZ,SAAAI,EAAM,KAAK,EAAM,KAChB,EAAAJ,EAAA,IAAA,CAAC,MAAD,CAAa,UAAU,6BAA6B,gBAAeiB,IAAMT,EAAQ,QAAU,OAAQ,YAAeQ,EAAaC,CAAC,EAAG,QAASC,EAAYD,CAAC,EACtJ,SAAAY,CACE,EAFKZ,CAEL,CACN,CACE,CAAA,CACF,CAAA,CAET,CAAC,E"}
@@ -5,7 +5,7 @@ import { useAutoplay as t, useIndexState as n } from "../PartnerCarousel/autopla
5
5
  import { Children as r, forwardRef as i, useRef as a } from "react";
6
6
  import { jsx as o } from "react/jsx-runtime";
7
7
  // src/components/PackageAnimation/PackageAnimation.tsx
8
- var s = 300, c = /* @__PURE__ */ i(function({ children: i, value: c, defaultValue: l = 0, onValueChange: u, autoPlay: d = !1, interval: f = 4e3, paused: p = !1, className: m, ...h }, g) {
8
+ var s = 300, c = /* @__PURE__ */ i(function({ children: i, value: c, defaultValue: l = 0, onValueChange: u, autoPlay: d = !0, interval: f = 4e3, paused: p = !1, className: m, ...h }, g) {
9
9
  let _ = r.toArray(i), v = _.length, y = a(null), [b, x] = n(c, l, u, v), { running: S, interactionProps: C } = t({
10
10
  enabled: d && v > 1,
11
11
  paused: p,
@@ -1 +1 @@
1
- {"version":3,"file":"PackageAnimation.js","names":["SWAP_DURATION","PackageAnimation","props","cards","Children","children","count","rootRef","useRef","index","setIndex","useIndexState","value","defaultValue","onValueChange","useAutoplay","autoPlay","interval","interactionProps","bringToFront","i","handleFocus","keyboard","event","node","ref","cn","className","running","onPointerEnter","onPointerLeave","onFocus","onBlur","card"],"sources":["../../../src/components/PackageAnimation/PackageAnimation.tsx"],"sourcesContent":["import { Children, forwardRef, useRef, type FocusEvent, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { useAutoplay, useIndexState } from '../PartnerCarousel/autoplay';\nimport './PackageAnimation.css';\n\n/** Figma prototype: Smart animate, ease out, 300ms. Keep in sync with `--_duration` in the stylesheet. */\nconst SWAP_DURATION = 300;\n\nexport interface PackageAnimationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The cards of the stack — two `PackageCard`s in Figma. The one at `value` lies in front, the others behind it. */\n children?: ReactNode;\n /** Index (0-based) of the card in front — Figma \"Property 1\": Default is the first swap state, Variant2 the other. Makes the component controlled. */\n value?: number;\n /** Card in front at first when uncontrolled. */\n defaultValue?: number;\n /** Called with the index of the card that comes to the front (click, keyboard focus or autoplay). */\n onValueChange?: (value: number) => void;\n /** Swaps the cards by itself, in an endless loop (the Figma prototype swaps on click only). Holds for hover, keyboard focus, a hidden tab, an off-screen stack and reduced motion. */\n autoPlay?: boolean;\n /** Time a card stays in front before the next swap, in ms. */\n interval?: number;\n /** Holds the autoplay from outside; it carries on once this is `false` again. */\n paused?: boolean;\n}\n\n/**\n * Two overlapping, tilted package cards that swap places (Figma component set \"Package animation\").\n * Clicking the card behind — or moving keyboard focus into it — brings it to the front. Both cards stay in the page for\n * assistive technology. Below 661px of container width the cards are upright and stacked, like \"Mobile / Package animation\".\n */\nexport const PackageAnimation = /* @__PURE__ */ forwardRef<HTMLDivElement, PackageAnimationProps>(function PackageAnimation(\n {\n children,\n value,\n defaultValue = 0,\n onValueChange,\n autoPlay = false,\n interval = 4000,\n paused = false,\n className,\n ...props\n },\n ref,\n) {\n const cards = Children.toArray(children);\n const count = cards.length;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [index, setIndex] = useIndexState(value, defaultValue, onValueChange, count);\n\n const { running, interactionProps } = useAutoplay({\n enabled: autoPlay && count > 1,\n paused,\n delay: interval + SWAP_DURATION,\n onTick: () => setIndex((index + 1) % count),\n rootRef,\n resetKey: index,\n });\n const { onPointerEnter, onPointerLeave, onFocus, onBlur } = interactionProps;\n\n const bringToFront = (i: number) => {\n if (i !== index) setIndex(i);\n };\n // Keyboard focus must not land on a covered control (WCAG 2.4.11). A pointer press is left alone here: moving the card\n // under the pointer would lose the click; the click handler brings the card forward afterwards.\n const handleFocus = (i: number) => (event: FocusEvent<HTMLDivElement>) => {\n let keyboard = true;\n try {\n keyboard = event.target.matches(':focus-visible');\n } catch {\n /* :focus-visible unsupported — treat every focus as keyboard focus */\n }\n if (keyboard) bringToFront(i);\n };\n\n return (\n <div\n ref={(node) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n className={cn('tm-package-animation', className)}\n data-autoplay={running ? 'running' : autoPlay ? 'paused' : undefined}\n {...props}\n onPointerEnter={(event) => {\n props.onPointerEnter?.(event);\n onPointerEnter(event);\n }}\n onPointerLeave={(event) => {\n props.onPointerLeave?.(event);\n onPointerLeave();\n }}\n onFocus={(event) => {\n props.onFocus?.(event);\n onFocus(event);\n }}\n onBlur={(event) => {\n props.onBlur?.(event);\n onBlur(event);\n }}\n >\n <div className=\"tm-package-animation__stage\">\n {cards.map((card, i) => (\n <div key={i} className=\"tm-package-animation__card\" data-position={i === index ? 'front' : 'back'} onClick={() => bringToFront(i)} onFocus={handleFocus(i)}>\n {card}\n </div>\n ))}\n </div>\n </div>\n );\n});\n"],"mappings":";;;;;;;AAMA,IAAMA,IAAgB,KAwBTC,IAAmC,kBAAkD,SAChG,EACE,aACA,UACA,kBAAe,GACf,kBACA,cAAW,IACX,cAAW,KACX,YAAS,IACT,cACA,GAAGC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AA6B,iBAAeiB,MAAMX,IAAQ,UAAU;IAAQ,eAAeU,EAAaC,CAAC;IAAG,SAASC,EAAYD,CAAC;IACtJ,UAAAa;GACE,GAFKb,CAEL,CACN;EACE,CAAA;CACF,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"PackageAnimation.js","names":["SWAP_DURATION","PackageAnimation","props","cards","Children","children","count","rootRef","useRef","index","setIndex","useIndexState","value","defaultValue","onValueChange","useAutoplay","autoPlay","interval","interactionProps","bringToFront","i","handleFocus","keyboard","event","node","ref","cn","className","running","onPointerEnter","onPointerLeave","onFocus","onBlur","card"],"sources":["../../../src/components/PackageAnimation/PackageAnimation.tsx"],"sourcesContent":["import { Children, forwardRef, useRef, type FocusEvent, type HTMLAttributes, type ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport { useAutoplay, useIndexState } from '../PartnerCarousel/autoplay';\nimport './PackageAnimation.css';\n\n/** Figma prototype: Smart animate, ease out, 300ms. Keep in sync with `--_duration` in the stylesheet. */\nconst SWAP_DURATION = 300;\n\nexport interface PackageAnimationProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange' | 'defaultValue'> {\n /** The cards of the stack — two `PackageCard`s in Figma. The one at `value` lies in front, the others behind it. */\n children?: ReactNode;\n /** Index (0-based) of the card in front — Figma \"Property 1\": Default is the first swap state, Variant2 the other. Makes the component controlled. */\n value?: number;\n /** Card in front at first when uncontrolled. */\n defaultValue?: number;\n /** Called with the index of the card that comes to the front (click, keyboard focus or autoplay). */\n onValueChange?: (value: number) => void;\n /** Swaps the cards by itself, in an endless loop (on by default; the Figma prototype swaps on click only). Holds for hover, keyboard focus, a hidden tab, an off-screen stack and reduced motion. */\n autoPlay?: boolean;\n /** Time a card stays in front before the next swap, in ms. */\n interval?: number;\n /** Holds the autoplay from outside; it carries on once this is `false` again. */\n paused?: boolean;\n}\n\n/**\n * Two overlapping, tilted package cards that swap places (Figma component set \"Package animation\").\n * Clicking the card behind — or moving keyboard focus into it — brings it to the front. Both cards stay in the page for\n * assistive technology. Below 661px of container width the cards are upright and stacked, like \"Mobile / Package animation\".\n */\nexport const PackageAnimation = /* @__PURE__ */ forwardRef<HTMLDivElement, PackageAnimationProps>(function PackageAnimation(\n {\n children,\n value,\n defaultValue = 0,\n onValueChange,\n autoPlay = true,\n interval = 4000,\n paused = false,\n className,\n ...props\n },\n ref,\n) {\n const cards = Children.toArray(children);\n const count = cards.length;\n const rootRef = useRef<HTMLDivElement | null>(null);\n const [index, setIndex] = useIndexState(value, defaultValue, onValueChange, count);\n\n const { running, interactionProps } = useAutoplay({\n enabled: autoPlay && count > 1,\n paused,\n delay: interval + SWAP_DURATION,\n onTick: () => setIndex((index + 1) % count),\n rootRef,\n resetKey: index,\n });\n const { onPointerEnter, onPointerLeave, onFocus, onBlur } = interactionProps;\n\n const bringToFront = (i: number) => {\n if (i !== index) setIndex(i);\n };\n // Keyboard focus must not land on a covered control (WCAG 2.4.11). A pointer press is left alone here: moving the card\n // under the pointer would lose the click; the click handler brings the card forward afterwards.\n const handleFocus = (i: number) => (event: FocusEvent<HTMLDivElement>) => {\n let keyboard = true;\n try {\n keyboard = event.target.matches(':focus-visible');\n } catch {\n /* :focus-visible unsupported — treat every focus as keyboard focus */\n }\n if (keyboard) bringToFront(i);\n };\n\n return (\n <div\n ref={(node) => {\n rootRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n className={cn('tm-package-animation', className)}\n data-autoplay={running ? 'running' : autoPlay ? 'paused' : undefined}\n {...props}\n onPointerEnter={(event) => {\n props.onPointerEnter?.(event);\n onPointerEnter(event);\n }}\n onPointerLeave={(event) => {\n props.onPointerLeave?.(event);\n onPointerLeave();\n }}\n onFocus={(event) => {\n props.onFocus?.(event);\n onFocus(event);\n }}\n onBlur={(event) => {\n props.onBlur?.(event);\n onBlur(event);\n }}\n >\n <div className=\"tm-package-animation__stage\">\n {cards.map((card, i) => (\n <div key={i} className=\"tm-package-animation__card\" data-position={i === index ? 'front' : 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