@olwiba/ui 0.2.11 → 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
@@ -473,10 +473,16 @@ function AppShell({
473
473
  }
474
474
  var defaultRenderLink2 = ({ href, children, className }) => /* @__PURE__ */ jsx("a", { href, className, children });
475
475
  function CenteredAuth({ children, brand, className }) {
476
- return /* @__PURE__ */ jsxs("section", { className: cn$1("flex min-h-screen flex-col justify-center bg-background py-12 px-4 sm:px-6 lg:px-8", className), children: [
477
- brand && /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md text-center mb-8", children: brand }),
478
- /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-md", children })
479
- ] });
476
+ return (
477
+ // `min-h-dvh`, not `min-h-screen`: on mobile `100vh` is the viewport with
478
+ // the browser chrome *retracted*, so a screen-height box is always taller
479
+ // than what you can actually see, and it resizes under you as the URL bar
480
+ // hides and shows.
481
+ /* @__PURE__ */ jsx("section", { className: cn$1("flex min-h-dvh flex-col bg-background px-4 py-10 sm:px-6 sm:py-12 lg:px-8", className), children: /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-md sm:my-auto", children: [
482
+ brand && /* @__PURE__ */ jsx("div", { className: "mb-8 text-center", children: brand }),
483
+ children
484
+ ] }) })
485
+ );
480
486
  }
481
487
  function SplitAuth({ children, panel }) {
482
488
  const defaultPanel = /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-6", children: [
@@ -2285,6 +2291,7 @@ function PricingCard({
2285
2291
  ctaDisabled = false,
2286
2292
  badge,
2287
2293
  footer,
2294
+ priceEffect,
2288
2295
  onSelect,
2289
2296
  className,
2290
2297
  ...props
@@ -2306,7 +2313,15 @@ function PricingCard({
2306
2313
  /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
2307
2314
  /* @__PURE__ */ jsx("div", { className: "text-sm font-medium text-muted-foreground", children: name }),
2308
2315
  /* @__PURE__ */ jsxs("div", { className: "flex items-end gap-1", children: [
2309
- /* @__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
+ ),
2310
2325
  /* @__PURE__ */ jsx("span", { className: "mb-1 text-sm text-muted-foreground", children: period })
2311
2326
  ] }),
2312
2327
  /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: description })
@@ -2446,7 +2461,8 @@ function PricingSection({
2446
2461
  cadences,
2447
2462
  defaultCadence,
2448
2463
  onSelectPlan,
2449
- pendingPlanName
2464
+ pendingPlanName,
2465
+ priceEffect
2450
2466
  }) {
2451
2467
  const [annual, setAnnual] = React20.useState(false);
2452
2468
  const isOneTime = mode === "one-time";
@@ -2543,6 +2559,7 @@ function PricingSection({
2543
2559
  ctaDisabled: plan.ctaDisabled || pendingPlanName === plan.name,
2544
2560
  badge: badge2,
2545
2561
  footer: renderPlanFooter?.(plan),
2562
+ priceEffect,
2546
2563
  onSelect: onSelectPlan ? () => onSelectPlan(plan, useCadences ? activeCadence : void 0) : void 0
2547
2564
  },
2548
2565
  plan.name