@olwiba/ui 0.2.12 → 0.2.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@olwiba/ui",
3
- "version": "0.2.12",
3
+ "version": "0.2.14",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -25,7 +25,27 @@ const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) =>
25
25
 
26
26
  // ─── Centered layout ──────────────────────────────────────────────────────────
27
27
 
28
- function CenteredAuth({ children, brand, className }: { children: React.ReactNode; brand?: React.ReactNode; className?: string }) {
28
+ function CenteredAuth({ children, brand, framed, className }: { children: React.ReactNode; brand?: React.ReactNode; framed?: boolean; className?: string }) {
29
+ if (framed) {
30
+ return (
31
+ // Framed: a page frame is already supplying the background, the page
32
+ // padding, and — with a navbar and footer around it — the height. All
33
+ // three have to come off here or they are applied twice: padding inside
34
+ // padding, and a full-viewport section that pushes the footer below the
35
+ // fold on every auth screen.
36
+ //
37
+ // The card fills the content column on a phone, matching the contact
38
+ // form, and only takes its reading width once there is room for the
39
+ // page to centre it.
40
+ <section className={cn('flex flex-col py-6 sm:py-10', className)}>
41
+ <div className="mx-auto w-full max-w-none sm:my-auto sm:max-w-md">
42
+ {brand && <div className="mb-8 text-center">{brand}</div>}
43
+ {children}
44
+ </div>
45
+ </section>
46
+ );
47
+ }
48
+
29
49
  return (
30
50
  // `min-h-dvh`, not `min-h-screen`: on mobile `100vh` is the viewport with
31
51
  // the browser chrome *retracted*, so a screen-height box is always taller
@@ -325,6 +345,18 @@ export interface AuthSectionProps extends AuthFormProps {
325
345
  children?: React.ReactNode;
326
346
  /** (split layout only) Custom content for the left decorative panel */
327
347
  panel?: React.ReactNode;
348
+ /**
349
+ * Render inside an existing page frame — one already providing the
350
+ * background, the horizontal padding, and a navbar and footer.
351
+ *
352
+ * Standalone (the default) the section owns the whole viewport, which is
353
+ * right for an auth screen that is the only thing on the page. It is wrong
354
+ * the moment there is chrome around it: the padding lands on top of the
355
+ * frame's own, and `min-h-dvh` guarantees the footer starts below the fold.
356
+ *
357
+ * (centered layout only)
358
+ */
359
+ framed?: boolean;
328
360
  className?: string;
329
361
  }
330
362
 
@@ -332,6 +364,7 @@ export function AuthSection({
332
364
  layout = 'centered',
333
365
  children,
334
366
  panel,
367
+ framed,
335
368
  className,
336
369
  ...formProps
337
370
  }: AuthSectionProps) {
@@ -348,7 +381,7 @@ export function AuthSection({
348
381
  const { brand, ...restFormProps } = formProps;
349
382
  const form = children ?? <DefaultForm {...restFormProps} />;
350
383
  return (
351
- <CenteredAuth brand={brand} className={className}>
384
+ <CenteredAuth brand={brand} framed={framed} className={className}>
352
385
  {form}
353
386
  </CenteredAuth>
354
387
  );
@@ -3,7 +3,7 @@
3
3
  import * as React from 'react';
4
4
  import { Check, Minus } from 'lucide-react';
5
5
  import { Badge, Button, cn, Separator, useUIVariant } from '@olwiba/cn';
6
- import { AnimatedSwap } from '../motion/AnimatedSwap';
6
+ import { AnimatedSwap, type AnimatedSwapEffect, type AnimatedSwapSpec } from '../motion/AnimatedSwap';
7
7
 
8
8
  export interface PricingFeature {
9
9
  label: string;
@@ -24,6 +24,15 @@ export interface PricingCardProps extends React.HTMLAttributes<HTMLDivElement> {
24
24
  badge?: React.ReactNode;
25
25
  /** Rendered directly below the CTA button (e.g. a "Get notified" link). */
26
26
  footer?: React.ReactNode;
27
+ /**
28
+ * How the price transitions when a cadence toggle swaps it. Omit and the
29
+ * current UI mode decides — `fade` in default, `roll` in playful, `slide` in
30
+ * smooth — which is the right answer for a product that has picked a mode
31
+ * and wants every swap on the page to agree with it. Set it when the price
32
+ * specifically should read as a mechanism (`'roll'`) without moving the
33
+ * whole app to playful.
34
+ */
35
+ priceEffect?: AnimatedSwapEffect | AnimatedSwapSpec;
27
36
  onSelect?: () => void;
28
37
  }
29
38
 
@@ -39,6 +48,7 @@ export function PricingCard({
39
48
  ctaDisabled = false,
40
49
  badge,
41
50
  footer,
51
+ priceEffect,
42
52
  onSelect,
43
53
  className,
44
54
  ...props
@@ -71,8 +81,13 @@ export function PricingCard({
71
81
  <div className="flex items-end gap-1">
72
82
  {/* Animates when a billing-cadence toggle swaps the price out. The
73
83
  price is its own swap key: a card whose price never changes never
74
- animates. */}
75
- <AnimatedSwap swapKey={price} className="text-4xl font-bold tracking-tight">
84
+ animates. `effect` undefined leaves AnimatedSwap on the mode
85
+ default. */}
86
+ <AnimatedSwap
87
+ swapKey={price}
88
+ effect={priceEffect}
89
+ className="text-4xl font-bold tracking-tight"
90
+ >
76
91
  {price}
77
92
  </AnimatedSwap>
78
93
  <span className="mb-1 text-sm text-muted-foreground">{period}</span>
@@ -2,7 +2,7 @@
2
2
 
3
3
  import * as React from 'react';
4
4
  import { Badge, Button, cn, useUIVariant } from '@olwiba/cn';
5
- import { PricingCard, type PricingFeature } from '../components/PricingCard';
5
+ import { PricingCard, type PricingCardProps, type PricingFeature } from '../components/PricingCard';
6
6
  import { StaggerChildren } from '../motion/StaggerChildren';
7
7
  import { CountdownTimer } from '../motion/CountdownTimer';
8
8
  import type { AppShellRenderLink } from '../app/AppShell';
@@ -140,6 +140,13 @@ export interface PricingSectionProps {
140
140
  onSelectPlan?: (plan: PricingPlan, cadence?: string) => void;
141
141
  /** Marks one plan as busy (e.g. its checkout is being created). */
142
142
  pendingPlanName?: string;
143
+ /**
144
+ * How each card's price transitions when the cadence toggle changes it.
145
+ * Omit and the current UI mode decides (see `PricingCard.priceEffect`) —
146
+ * pass `'roll'` for an odometer on a product that is otherwise in default
147
+ * mode.
148
+ */
149
+ priceEffect?: PricingCardProps['priceEffect'];
143
150
  }
144
151
 
145
152
  const defaultRenderLink: AppShellRenderLink = ({ href, children, className }) => (
@@ -164,6 +171,7 @@ export function PricingSection({
164
171
  defaultCadence,
165
172
  onSelectPlan,
166
173
  pendingPlanName,
174
+ priceEffect,
167
175
  }: PricingSectionProps) {
168
176
  const [annual, setAnnual] = React.useState(false);
169
177
  const isOneTime = mode === 'one-time';
@@ -314,6 +322,7 @@ export function PricingSection({
314
322
  ctaDisabled={plan.ctaDisabled || pendingPlanName === plan.name}
315
323
  badge={badge}
316
324
  footer={renderPlanFooter?.(plan)}
325
+ priceEffect={priceEffect}
317
326
  onSelect={
318
327
  onSelectPlan
319
328
  ? () => onSelectPlan(plan, useCadences ? activeCadence : undefined)