@olwiba/ui 0.2.12 → 0.2.13

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.d.ts CHANGED
@@ -681,6 +681,58 @@ interface CtaSectionProps {
681
681
  }
682
682
  declare function CtaSection(props: CtaSectionProps): react_jsx_runtime.JSX.Element;
683
683
 
684
+ /**
685
+ * A transition is pure data: two layers, each with a start and an end style.
686
+ * Adding an effect means adding an entry to {@link EFFECTS} — the component
687
+ * itself never learns what "roll" means. Consumers can pass a spec object
688
+ * directly for anything not in the set.
689
+ */
690
+ interface AnimatedSwapSpec {
691
+ /** Hide overflow on the container. Required by effects that travel further than they fade. */
692
+ clip: boolean;
693
+ duration: number;
694
+ easing: string;
695
+ /** The incoming layer: where it starts, where it lands. */
696
+ enter: {
697
+ from: React.CSSProperties;
698
+ to: React.CSSProperties;
699
+ };
700
+ /** The outgoing layer: where it starts, where it leaves. */
701
+ exit: {
702
+ from: React.CSSProperties;
703
+ to: React.CSSProperties;
704
+ };
705
+ }
706
+ type AnimatedSwapEffect = 'roll' | 'fade' | 'slide' | 'none';
707
+ interface AnimatedSwapProps extends React.HTMLAttributes<HTMLSpanElement> {
708
+ /**
709
+ * Changing this is the swap. Nothing else triggers one — the component
710
+ * can't see inside `children`, so re-rendering with different content under
711
+ * the same key updates in place with no animation.
712
+ */
713
+ swapKey: React.Key;
714
+ /** Named effect, or a spec of your own. Defaults from the current UI mode. */
715
+ effect?: AnimatedSwapEffect | AnimatedSwapSpec;
716
+ /** Override the effect's duration, in ms. */
717
+ duration?: number;
718
+ children: React.ReactNode;
719
+ }
720
+ /**
721
+ * Animates the replacement of arbitrary content when `swapKey` changes: a
722
+ * price when the billing cadence toggles, a chart when the range changes, a
723
+ * status pill when a job finishes.
724
+ *
725
+ * Both versions are mounted for the length of the transition. The incoming
726
+ * one stays in normal flow so the container sizes to it immediately; the
727
+ * outgoing one is lifted out of flow and overlaid, so content below settles
728
+ * once, at the start, under cover of the animation — rather than snapping
729
+ * when the old copy unmounts.
730
+ *
731
+ * CSS transitions only: no keyframes to register in a consumer's Tailwind
732
+ * config, and no motion library.
733
+ */
734
+ declare function AnimatedSwap({ swapKey, effect, duration, children, className, style, ...props }: AnimatedSwapProps): react_jsx_runtime.JSX.Element;
735
+
684
736
  interface PricingFeature {
685
737
  label: string;
686
738
  included: boolean;
@@ -699,9 +751,18 @@ interface PricingCardProps extends React.HTMLAttributes<HTMLDivElement> {
699
751
  badge?: React.ReactNode;
700
752
  /** Rendered directly below the CTA button (e.g. a "Get notified" link). */
701
753
  footer?: React.ReactNode;
754
+ /**
755
+ * How the price transitions when a cadence toggle swaps it. Omit and the
756
+ * current UI mode decides — `fade` in default, `roll` in playful, `slide` in
757
+ * smooth — which is the right answer for a product that has picked a mode
758
+ * and wants every swap on the page to agree with it. Set it when the price
759
+ * specifically should read as a mechanism (`'roll'`) without moving the
760
+ * whole app to playful.
761
+ */
762
+ priceEffect?: AnimatedSwapEffect | AnimatedSwapSpec;
702
763
  onSelect?: () => void;
703
764
  }
704
- declare function PricingCard({ name, price, period, description, features, cta, highlighted, disabled, ctaDisabled, badge, footer, onSelect, className, ...props }: PricingCardProps): react_jsx_runtime.JSX.Element;
765
+ declare function PricingCard({ name, price, period, description, features, cta, highlighted, disabled, ctaDisabled, badge, footer, priceEffect, onSelect, className, ...props }: PricingCardProps): react_jsx_runtime.JSX.Element;
705
766
 
706
767
  /**
707
768
  * One billing period a plan can be bought at.
@@ -779,8 +840,15 @@ interface PricingSectionProps {
779
840
  onSelectPlan?: (plan: PricingPlan, cadence?: string) => void;
780
841
  /** Marks one plan as busy (e.g. its checkout is being created). */
781
842
  pendingPlanName?: string;
843
+ /**
844
+ * How each card's price transitions when the cadence toggle changes it.
845
+ * Omit and the current UI mode decides (see `PricingCard.priceEffect`) —
846
+ * pass `'roll'` for an odometer on a product that is otherwise in default
847
+ * mode.
848
+ */
849
+ priceEffect?: PricingCardProps['priceEffect'];
782
850
  }
783
- declare function PricingSection({ title, description, badge, plans, saveBadge, isAuthenticated, renderLink, footnote, mode, foundingDeadline, currency, highlightedBadgeLabel, renderPlanFooter, cadences, defaultCadence, onSelectPlan, pendingPlanName, }: PricingSectionProps): react_jsx_runtime.JSX.Element;
851
+ declare function PricingSection({ title, description, badge, plans, saveBadge, isAuthenticated, renderLink, footnote, mode, foundingDeadline, currency, highlightedBadgeLabel, renderPlanFooter, cadences, defaultCadence, onSelectPlan, pendingPlanName, priceEffect, }: PricingSectionProps): react_jsx_runtime.JSX.Element;
784
852
 
785
853
  interface TestimonialsSectionProps {
786
854
  title?: string;
@@ -1039,58 +1107,6 @@ interface CountUpProps extends React.HTMLAttributes<HTMLSpanElement> {
1039
1107
  }
1040
1108
  declare function CountUp({ from, to, duration, decimals, prefix, suffix, once, className, ...props }: CountUpProps): react_jsx_runtime.JSX.Element;
1041
1109
 
1042
- /**
1043
- * A transition is pure data: two layers, each with a start and an end style.
1044
- * Adding an effect means adding an entry to {@link EFFECTS} — the component
1045
- * itself never learns what "roll" means. Consumers can pass a spec object
1046
- * directly for anything not in the set.
1047
- */
1048
- interface AnimatedSwapSpec {
1049
- /** Hide overflow on the container. Required by effects that travel further than they fade. */
1050
- clip: boolean;
1051
- duration: number;
1052
- easing: string;
1053
- /** The incoming layer: where it starts, where it lands. */
1054
- enter: {
1055
- from: React.CSSProperties;
1056
- to: React.CSSProperties;
1057
- };
1058
- /** The outgoing layer: where it starts, where it leaves. */
1059
- exit: {
1060
- from: React.CSSProperties;
1061
- to: React.CSSProperties;
1062
- };
1063
- }
1064
- type AnimatedSwapEffect = 'roll' | 'fade' | 'slide' | 'none';
1065
- interface AnimatedSwapProps extends React.HTMLAttributes<HTMLSpanElement> {
1066
- /**
1067
- * Changing this is the swap. Nothing else triggers one — the component
1068
- * can't see inside `children`, so re-rendering with different content under
1069
- * the same key updates in place with no animation.
1070
- */
1071
- swapKey: React.Key;
1072
- /** Named effect, or a spec of your own. Defaults from the current UI mode. */
1073
- effect?: AnimatedSwapEffect | AnimatedSwapSpec;
1074
- /** Override the effect's duration, in ms. */
1075
- duration?: number;
1076
- children: React.ReactNode;
1077
- }
1078
- /**
1079
- * Animates the replacement of arbitrary content when `swapKey` changes: a
1080
- * price when the billing cadence toggles, a chart when the range changes, a
1081
- * status pill when a job finishes.
1082
- *
1083
- * Both versions are mounted for the length of the transition. The incoming
1084
- * one stays in normal flow so the container sizes to it immediately; the
1085
- * outgoing one is lifted out of flow and overlaid, so content below settles
1086
- * once, at the start, under cover of the animation — rather than snapping
1087
- * when the old copy unmounts.
1088
- *
1089
- * CSS transitions only: no keyframes to register in a consumer's Tailwind
1090
- * config, and no motion library.
1091
- */
1092
- declare function AnimatedSwap({ swapKey, effect, duration, children, className, style, ...props }: AnimatedSwapProps): react_jsx_runtime.JSX.Element;
1093
-
1094
1110
  interface CountdownTimerProps {
1095
1111
  deadline: string;
1096
1112
  label?: string;
package/dist/index.js CHANGED
@@ -2291,6 +2291,7 @@ function PricingCard({
2291
2291
  ctaDisabled = false,
2292
2292
  badge,
2293
2293
  footer,
2294
+ priceEffect,
2294
2295
  onSelect,
2295
2296
  className,
2296
2297
  ...props
@@ -2312,7 +2313,15 @@ function PricingCard({
2312
2313
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
2313
2314
  /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-muted-foreground", children: name }),
2314
2315
  /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1", children: [
2315
- /* @__PURE__ */ jsx(AnimatedSwap, { swapKey: price, className: "text-4xl font-bold tracking-tight", children: price }),
2316
+ /* @__PURE__ */ jsx(
2317
+ AnimatedSwap,
2318
+ {
2319
+ swapKey: price,
2320
+ effect: priceEffect,
2321
+ className: "text-4xl font-bold tracking-tight",
2322
+ children: price
2323
+ }
2324
+ ),
2316
2325
  /* @__PURE__ */ jsx("span", { className: "mb-1 text-sm text-muted-foreground", children: period })
2317
2326
  ] }),
2318
2327
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
@@ -2452,7 +2461,8 @@ function PricingSection({
2452
2461
  cadences,
2453
2462
  defaultCadence,
2454
2463
  onSelectPlan,
2455
- pendingPlanName
2464
+ pendingPlanName,
2465
+ priceEffect
2456
2466
  }) {
2457
2467
  const [annual, setAnnual] = React20.useState(false);
2458
2468
  const isOneTime = mode === "one-time";
@@ -2549,6 +2559,7 @@ function PricingSection({
2549
2559
  ctaDisabled: plan.ctaDisabled || pendingPlanName === plan.name,
2550
2560
  badge: badge2,
2551
2561
  footer: renderPlanFooter?.(plan),
2562
+ priceEffect,
2552
2563
  onSelect: onSelectPlan ? () => onSelectPlan(plan, useCadences ? activeCadence : void 0) : void 0
2553
2564
  },
2554
2565
  plan.name