@deriv-web-design/ui 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1935,153 +1935,240 @@ var SPRING = { stiffness: 80, damping: 30, restDelta: 1e-3 };
1935
1935
  var LOCK_AT = 0.5;
1936
1936
  var PLACEHOLDER_URL = "https://cdn.prod.website-files.com/68da5c86c91c54f39c86c28a/68da5c86c91c54f39c86ce1a_footer-member-5.webp";
1937
1937
  var AVATAR_DATA = [
1938
- /* ── Rank 0 — bottom-centre-ish (dist 285) ─── */
1938
+ /* ── Rank 0 — top-centre (col 6, row 1) ─────── */
1939
1939
  {
1940
- id: 11,
1940
+ id: 12,
1941
1941
  staggerRank: 0,
1942
1942
  imageUrl: PLACEHOLDER_URL,
1943
- desktopPos: { left: "45.7%", top: "84.9%" },
1944
- mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "81.8%" },
1943
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 6)", top: "calc(var(--ctab-grid-cell) * 1)" },
1944
+ mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "calc(var(--ctab-grid-cell) * 1)" },
1945
1945
  mobileVisible: true
1946
1946
  },
1947
- /* ── Rank 1 — top-centre (dist 293) ────────── */
1947
+ /* ── Rank 1 — bot-centre (col 6, row 7) ─────── */
1948
1948
  {
1949
- id: 12,
1949
+ id: 11,
1950
1950
  staggerRank: 1,
1951
1951
  imageUrl: PLACEHOLDER_URL,
1952
- desktopPos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "0%" },
1953
- mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "9.2%" },
1954
- mobileVisible: true
1952
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 6)", top: "calc(var(--ctab-grid-cell) * 7)" },
1953
+ mobilePos: null,
1954
+ mobileVisible: false
1955
1955
  },
1956
- /* ── Rank 2 — right mid-lower (dist 341) ───── */
1956
+ /* ── Rank 2 — upper-inner-left (col 3, row 2) ── */
1957
1957
  {
1958
- id: 10,
1958
+ id: 3,
1959
1959
  staggerRank: 2,
1960
1960
  imageUrl: PLACEHOLDER_URL,
1961
- desktopPos: { left: "68.5%", top: "70.7%" },
1962
- mobilePos: null,
1963
- mobileVisible: false
1961
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 3)", top: "calc(var(--ctab-grid-cell) * 2)" },
1962
+ mobilePos: { left: "0", top: "calc(var(--ctab-grid-cell) * 2)" },
1963
+ mobileVisible: true
1964
1964
  },
1965
- /* ── Rank 3 — left mid-lower (dist 342) ────── */
1965
+ /* ── Rank 3 — upper-inner-right (col 9, row 2) ── */
1966
1966
  {
1967
- id: 1,
1967
+ id: 6,
1968
1968
  staggerRank: 3,
1969
1969
  imageUrl: PLACEHOLDER_URL,
1970
- desktopPos: { left: "24.0%", top: "70.7%" },
1971
- mobilePos: null,
1972
- mobileVisible: false
1970
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 9)", top: "calc(var(--ctab-grid-cell) * 2)" },
1971
+ mobilePos: { right: "0", top: "calc(var(--ctab-grid-cell) * 2)" },
1972
+ mobileVisible: true
1973
1973
  },
1974
- /* ── Rank 4 — left upper (dist 345) ────────── */
1974
+ /* ── Rank 4 — lower-inner-left (col 3, row 6) ── */
1975
1975
  {
1976
- id: 3,
1976
+ id: 1,
1977
1977
  staggerRank: 4,
1978
1978
  imageUrl: PLACEHOLDER_URL,
1979
- desktopPos: { left: "24.0%", top: "14.4%" },
1980
- mobilePos: { left: "8.3%", top: "18.2%" },
1979
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 3)", top: "calc(var(--ctab-grid-cell) * 6)" },
1980
+ mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "calc(var(--ctab-grid-cell) * 9)" },
1981
1981
  mobileVisible: true
1982
1982
  },
1983
- /* ── Rank 5 — right upper (dist 345) ───────── */
1983
+ /* ── Rank 5 — lower-inner-right (col 9, row 6) ── */
1984
1984
  {
1985
- id: 6,
1985
+ id: 10,
1986
1986
  staggerRank: 5,
1987
1987
  imageUrl: PLACEHOLDER_URL,
1988
- desktopPos: { left: "68.5%", top: "14.4%" },
1989
- mobilePos: { right: "7.8%", top: "18.3%" },
1990
- mobileVisible: true
1988
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 9)", top: "calc(var(--ctab-grid-cell) * 6)" },
1989
+ mobilePos: null,
1990
+ mobileVisible: false
1991
1991
  },
1992
- /* ── Rank 6 — far-right middle (dist 572) ──── */
1992
+ /* ── Rank 6 — mid-left (col 0, row 4) ──────── */
1993
1993
  {
1994
- id: 8,
1994
+ id: 5,
1995
1995
  staggerRank: 6,
1996
1996
  imageUrl: PLACEHOLDER_URL,
1997
- desktopPos: { left: "91.0%", top: "43.0%" },
1998
- mobilePos: { right: "7.8%", top: "77.2%" },
1997
+ desktopPos: { left: "0", top: "calc(var(--ctab-grid-cell) * 4)" },
1998
+ mobilePos: { left: "0", top: "calc(var(--ctab-grid-cell) * 8)" },
1999
1999
  mobileVisible: true
2000
2000
  },
2001
- /* ── Rank 7 — far-left middle (dist 577) ───── */
2001
+ /* ── Rank 7 — mid-right (col 12, row 4) ────── */
2002
2002
  {
2003
- id: 5,
2003
+ id: 8,
2004
2004
  staggerRank: 7,
2005
2005
  imageUrl: PLACEHOLDER_URL,
2006
- desktopPos: { left: "1.25%", top: "43.0%" },
2007
- mobilePos: { left: "8.6%", top: "72.8%" },
2006
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 12)", top: "calc(var(--ctab-grid-cell) * 4)" },
2007
+ mobilePos: { right: "0", top: "calc(var(--ctab-grid-cell) * 8)" },
2008
2008
  mobileVisible: true
2009
2009
  },
2010
- /* ── Rank 8 — far-right bottom (dist 639) ──── */
2010
+ /* ── Rank 8 — top-left corner (col 0, row 1) ── */
2011
2011
  {
2012
- id: 9,
2012
+ id: 4,
2013
2013
  staggerRank: 8,
2014
2014
  imageUrl: PLACEHOLDER_URL,
2015
- desktopPos: { left: "91.0%", top: "84.9%" },
2015
+ desktopPos: { left: "0", top: "calc(var(--ctab-grid-cell) * 1)" },
2016
2016
  mobilePos: null,
2017
2017
  mobileVisible: false
2018
2018
  },
2019
- /* ── Rank 9 — far-right top (dist 642) ─────── */
2019
+ /* ── Rank 9 — top-right corner (col 12, row 1) ── */
2020
2020
  {
2021
2021
  id: 7,
2022
2022
  staggerRank: 9,
2023
2023
  imageUrl: PLACEHOLDER_URL,
2024
- desktopPos: { left: "91.0%", top: "0%" },
2024
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 12)", top: "calc(var(--ctab-grid-cell) * 1)" },
2025
2025
  mobilePos: null,
2026
2026
  mobileVisible: false
2027
2027
  },
2028
- /* ── Rank 10 — far-left bottom (dist 643) ──── */
2028
+ /* ── Rank 10 — bot-left corner (col 0, row 7) ── */
2029
2029
  {
2030
2030
  id: 2,
2031
2031
  staggerRank: 10,
2032
2032
  imageUrl: PLACEHOLDER_URL,
2033
- desktopPos: { left: "1.25%", top: "84.9%" },
2033
+ desktopPos: { left: "0", top: "calc(var(--ctab-grid-cell) * 7)" },
2034
2034
  mobilePos: null,
2035
2035
  mobileVisible: false
2036
2036
  },
2037
- /* ── Rank 11 — far-left top (dist 647) ─────── */
2037
+ /* ── Rank 11 — bot-right corner (col 12, row 7) ── */
2038
2038
  {
2039
- id: 4,
2039
+ id: 9,
2040
2040
  staggerRank: 11,
2041
2041
  imageUrl: PLACEHOLDER_URL,
2042
- desktopPos: { left: "1.25%", top: "0%" },
2042
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 12)", top: "calc(var(--ctab-grid-cell) * 7)" },
2043
+ mobilePos: null,
2044
+ mobileVisible: false
2045
+ }
2046
+ ];
2047
+ var COMPACT_AVATAR_DATA = [
2048
+ /* ── Rank 0 — top-centre (col ~6, row 1) ── */
2049
+ {
2050
+ id: 12,
2051
+ staggerRank: 0,
2052
+ imageUrl: PLACEHOLDER_URL,
2053
+ desktopPos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "calc(var(--ctab-grid-cell) * 1)" },
2054
+ mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "calc(var(--ctab-grid-cell) * 1)" },
2055
+ mobileVisible: true
2056
+ },
2057
+ /* ── Rank 1 — top-left (col 2, row 1) ───── */
2058
+ {
2059
+ id: 3,
2060
+ staggerRank: 1,
2061
+ imageUrl: PLACEHOLDER_URL,
2062
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 2)", top: "calc(var(--ctab-grid-cell) * 1)" },
2063
+ mobilePos: { left: "0", top: "calc(var(--ctab-grid-cell) * 2)" },
2064
+ mobileVisible: true
2065
+ },
2066
+ /* ── Rank 2 — top-right (col 10, row 1) ─── */
2067
+ {
2068
+ id: 6,
2069
+ staggerRank: 2,
2070
+ imageUrl: PLACEHOLDER_URL,
2071
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 10)", top: "calc(var(--ctab-grid-cell) * 1)" },
2072
+ mobilePos: { right: "0", top: "calc(var(--ctab-grid-cell) * 2)" },
2073
+ mobileVisible: true
2074
+ },
2075
+ /* ── Rank 3 — mid-left (col 0, row 3) ────── */
2076
+ {
2077
+ id: 5,
2078
+ staggerRank: 3,
2079
+ imageUrl: PLACEHOLDER_URL,
2080
+ desktopPos: { left: "0", top: "calc(var(--ctab-grid-cell) * 3)" },
2081
+ mobilePos: { left: "0", top: "calc(var(--ctab-grid-cell) * 8)" },
2082
+ mobileVisible: true
2083
+ },
2084
+ /* ── Rank 4 — mid-right (col 12, row 3) ──── */
2085
+ {
2086
+ id: 8,
2087
+ staggerRank: 4,
2088
+ imageUrl: PLACEHOLDER_URL,
2089
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 12)", top: "calc(var(--ctab-grid-cell) * 3)" },
2090
+ mobilePos: { right: "0", top: "calc(var(--ctab-grid-cell) * 8)" },
2091
+ mobileVisible: true
2092
+ },
2093
+ /* ── Rank 5 — bot-left (col 2, row 5) ────── */
2094
+ {
2095
+ id: 1,
2096
+ staggerRank: 5,
2097
+ imageUrl: PLACEHOLDER_URL,
2098
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 2)", top: "calc(var(--ctab-grid-cell) * 5)" },
2099
+ mobilePos: { left: "calc(50% - var(--ctab-avatar-size) / 2)", top: "calc(var(--ctab-grid-cell) * 9)" },
2100
+ mobileVisible: true
2101
+ },
2102
+ /* ── Rank 6 — bot-right (col 10, row 5) — desktop only ─── */
2103
+ {
2104
+ id: 11,
2105
+ staggerRank: 6,
2106
+ imageUrl: PLACEHOLDER_URL,
2107
+ desktopPos: { left: "calc(var(--ctab-grid-cell) * 10)", top: "calc(var(--ctab-grid-cell) * 5)" },
2043
2108
  mobilePos: null,
2044
2109
  mobileVisible: false
2045
2110
  }
2046
2111
  ];
2047
2112
  function useAvatarYValues(smooth) {
2048
- const y0 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.near, 0]);
2049
- const y1 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.near, 0]);
2050
- const y2 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2051
- const y3 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2052
- const y4 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2053
- const y5 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2113
+ const y0 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.near, 0]);
2114
+ const y1 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.near, 0]);
2115
+ const y2 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2116
+ const y3 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2117
+ const y4 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2118
+ const y5 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2054
2119
  const y6 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2055
2120
  const y7 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2056
- const y8 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.far, 0]);
2121
+ const y8 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2057
2122
  const y9 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2058
2123
  const y10 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.edge, 0]);
2059
- const y11 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2124
+ const y11 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.edge, 0]);
2060
2125
  return [y0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11];
2061
2126
  }
2062
2127
  function useAvatarXValues(smooth) {
2063
2128
  const x0 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2064
2129
  const x1 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2065
- const x2 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2066
- const x3 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2130
+ const x2 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2131
+ const x3 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2067
2132
  const x4 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2068
2133
  const x5 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2069
- const x6 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.far, 0]);
2070
- const x7 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.far, 0]);
2071
- const x8 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.far, 0]);
2134
+ const x6 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.far, 0]);
2135
+ const x7 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.far, 0]);
2136
+ const x8 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2072
2137
  const x9 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.edge, 0]);
2073
2138
  const x10 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2074
- const x11 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.edge, 0]);
2139
+ const x11 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.edge, 0]);
2075
2140
  return [x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11];
2076
2141
  }
2142
+ function useCompactAvatarYValues(smooth) {
2143
+ const y0 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.near, 0]);
2144
+ const y1 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2145
+ const y2 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2146
+ const y3 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2147
+ const y4 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2148
+ const y5 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2149
+ const y6 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2150
+ return [y0, y1, y2, y3, y4, y5, y6];
2151
+ }
2152
+ function useCompactAvatarXValues(smooth) {
2153
+ const x0 = useTransform(smooth, [0, LOCK_AT], [0, 0]);
2154
+ const x1 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2155
+ const x2 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2156
+ const x3 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.far, 0]);
2157
+ const x4 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.far, 0]);
2158
+ const x5 = useTransform(smooth, [0, LOCK_AT], [-ENTRANCE.mid, 0]);
2159
+ const x6 = useTransform(smooth, [0, LOCK_AT], [ENTRANCE.mid, 0]);
2160
+ return [x0, x1, x2, x3, x4, x5, x6];
2161
+ }
2077
2162
  var CTABanner = ({
2078
- headline = "Join 3M+ global traders",
2163
+ headline = "Short section title goes here",
2079
2164
  ctaLabel = "Open account",
2080
2165
  ctaHref = "#",
2081
- avatars = AVATAR_DATA,
2166
+ avatars,
2167
+ variant = "standard",
2082
2168
  className,
2083
2169
  ...props
2084
2170
  }) => {
2171
+ const resolvedAvatars = avatars ?? (variant === "compact" ? COMPACT_AVATAR_DATA : AVATAR_DATA);
2085
2172
  const sectionRef = useRef6(null);
2086
2173
  const { scrollYProgress } = useScroll({
2087
2174
  target: sectionRef,
@@ -2094,13 +2181,17 @@ var CTABanner = ({
2094
2181
  const avatarOpacity = useTransform(smooth, [0, 0.25], [0, 1]);
2095
2182
  const blurPx = useTransform(smooth, [0, 0.3, 0.7, 1], [ENTRANCE.blurStart, 0, 0, ENTRANCE.blurStart]);
2096
2183
  const avatarFilter = useMotionTemplate`blur(${blurPx}px)`;
2097
- const avatarYValues = useAvatarYValues(smooth);
2098
- const avatarXValues = useAvatarXValues(smooth);
2184
+ const standardYValues = useAvatarYValues(smooth);
2185
+ const standardXValues = useAvatarXValues(smooth);
2186
+ const compactYValues = useCompactAvatarYValues(smooth);
2187
+ const compactXValues = useCompactAvatarXValues(smooth);
2188
+ const avatarYValues = variant === "compact" ? compactYValues : standardYValues;
2189
+ const avatarXValues = variant === "compact" ? compactXValues : standardXValues;
2099
2190
  return /* @__PURE__ */ jsxs21(
2100
2191
  "section",
2101
2192
  {
2102
2193
  ref: sectionRef,
2103
- className: ["ctab", className].filter(Boolean).join(" "),
2194
+ className: ["ctab", variant === "compact" ? "ctab--compact" : "", className].filter(Boolean).join(" "),
2104
2195
  ...props,
2105
2196
  children: [
2106
2197
  /* @__PURE__ */ jsx22(
@@ -2112,7 +2203,7 @@ var CTABanner = ({
2112
2203
  }
2113
2204
  ),
2114
2205
  /* @__PURE__ */ jsx22("div", { className: "ctab__inner", children: /* @__PURE__ */ jsxs21("div", { className: "ctab__stage", children: [
2115
- avatars.map((avatar, index) => {
2206
+ resolvedAvatars.map((avatar, index) => {
2116
2207
  const posStyle = {};
2117
2208
  if (avatar.desktopPos.left) posStyle["--av-d-left"] = avatar.desktopPos.left;
2118
2209
  if (avatar.desktopPos.right) posStyle["--av-d-right"] = avatar.desktopPos.right;
@@ -2154,7 +2245,7 @@ var CTABanner = ({
2154
2245
  style: { y: heroY, opacity: heroOpacity },
2155
2246
  children: [
2156
2247
  /* @__PURE__ */ jsx22("h2", { className: "ctab__headline", children: headline }),
2157
- /* @__PURE__ */ jsx22("a", { href: ctaHref, className: "ctab__btn", children: ctaLabel })
2248
+ /* @__PURE__ */ jsx22("a", { href: ctaHref, className: "ctab__cta", children: ctaLabel })
2158
2249
  ]
2159
2250
  }
2160
2251
  )