@r2digisolutions/components 0.19.8 → 0.19.10

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.
@@ -178,6 +178,7 @@
178
178
  };
179
179
  check();
180
180
  });
181
+ // Do not preventDefault — Kit remote attachment owns progressive enhancement.
181
182
  return;
182
183
  }
183
184
  e.preventDefault();
@@ -5,7 +5,7 @@
5
5
 
6
6
  export type SelectCardLayout = 'media' | 'row';
7
7
  export type SelectCardCheck = 'box' | 'badge' | 'none';
8
- export type SelectCardTone = 'brand' | 'success' | 'error' | 'warning' | 'info';
8
+ export type SelectCardTone = 'brand' | 'neutral' | 'success' | 'error' | 'warning' | 'info';
9
9
 
10
10
  interface SelectCardProps {
11
11
  title?: string;
@@ -50,6 +50,7 @@
50
50
 
51
51
  const selectedTone: Record<SelectCardTone, string> = {
52
52
  brand: 'border-brand-500 bg-brand-50/50 ring-2 ring-brand-500/20 dark:bg-brand-950/30',
53
+ neutral: 'border-border-strong bg-surface-overlay ring-2 ring-border dark:bg-surface-overlay/80',
53
54
  success:
54
55
  'border-emerald-500 bg-emerald-50/70 ring-2 ring-emerald-500/20 dark:border-emerald-400 dark:bg-emerald-950/35',
55
56
  error: 'border-red-500 bg-red-50/70 ring-2 ring-red-500/20 dark:border-red-400 dark:bg-red-950/35',
@@ -60,6 +61,7 @@
60
61
 
61
62
  const hoverTone: Record<SelectCardTone, string> = {
62
63
  brand: 'hover:border-brand-300 dark:hover:border-brand-700',
64
+ neutral: 'hover:border-border-strong',
63
65
  success: 'hover:border-emerald-300 dark:hover:border-emerald-700',
64
66
  error: 'hover:border-red-300 dark:hover:border-red-700',
65
67
  warning: 'hover:border-amber-300 dark:hover:border-amber-700',
@@ -68,6 +70,7 @@
68
70
 
69
71
  const badgeTone: Record<SelectCardTone, string> = {
70
72
  brand: 'border-brand-500 bg-brand-500 text-white',
73
+ neutral: 'border-border-strong bg-surface-overlay text-primary',
71
74
  success: 'border-emerald-500 bg-emerald-500 text-white',
72
75
  error: 'border-red-500 bg-red-500 text-white',
73
76
  warning: 'border-amber-500 bg-amber-500 text-white',
@@ -76,6 +79,7 @@
76
79
 
77
80
  const focusTone: Record<SelectCardTone, string> = {
78
81
  brand: 'focus-visible:ring-brand-500/30',
82
+ neutral: 'focus-visible:ring-border',
79
83
  success: 'focus-visible:ring-emerald-500/30',
80
84
  error: 'focus-visible:ring-red-500/30',
81
85
  warning: 'focus-visible:ring-amber-500/30',
@@ -1,7 +1,7 @@
1
1
  import type { Snippet } from 'svelte';
2
2
  export type SelectCardLayout = 'media' | 'row';
3
3
  export type SelectCardCheck = 'box' | 'badge' | 'none';
4
- export type SelectCardTone = 'brand' | 'success' | 'error' | 'warning' | 'info';
4
+ export type SelectCardTone = 'brand' | 'neutral' | 'success' | 'error' | 'warning' | 'info';
5
5
  interface SelectCardProps {
6
6
  title?: string;
7
7
  description?: string;
@@ -279,8 +279,13 @@
279
279
  {#if children}
280
280
  <div
281
281
  class={[
282
- 'px-5 py-2 text-sm text-primary',
283
- scrollable && 'max-h-[min(60vh,28rem)] overflow-y-auto'
282
+ 'min-h-0 flex-1 px-5 py-2 text-sm text-primary',
283
+ scrollable &&
284
+ (size === 'full'
285
+ ? 'max-h-[calc(100vh-11rem)] overflow-y-auto'
286
+ : size === 'xl'
287
+ ? 'max-h-[min(70vh,36rem)] overflow-y-auto'
288
+ : 'max-h-[min(60vh,28rem)] overflow-y-auto')
284
289
  ]}
285
290
  >
286
291
  {@render children()}
@@ -62,6 +62,7 @@ export declare const Bento: Story;
62
62
  export declare const Compact: Story;
63
63
  export declare const Split: Story;
64
64
  export declare const Table: Story;
65
+ export declare const ListCompare: Story;
65
66
  export declare const CardsPlusComparison: Story;
66
67
  export declare const TwoPlans: Story;
67
68
  export declare const FourPlans: Story;
@@ -9,7 +9,17 @@ const meta = {
9
9
  argTypes: {
10
10
  layout: {
11
11
  control: 'select',
12
- options: ['grid', 'horizontal', 'vertical', 'bento', 'compact', 'split', 'table']
12
+ options: [
13
+ 'grid',
14
+ 'horizontal',
15
+ 'vertical',
16
+ 'bento',
17
+ 'compact',
18
+ 'split',
19
+ 'table',
20
+ 'list',
21
+ 'compare'
22
+ ]
13
23
  },
14
24
  columns: { control: 'select', options: [2, 3, 4] },
15
25
  planSet: {
@@ -39,6 +49,7 @@ export const Bento = { args: { layout: 'bento', planSet: 'bento' } };
39
49
  export const Compact = { args: { layout: 'compact', planSet: 'four', columns: 4 } };
40
50
  export const Split = { args: { layout: 'split' } };
41
51
  export const Table = { args: { layout: 'table', planSet: 'comparison' } };
52
+ export const ListCompare = { args: { layout: 'list', planSet: 'comparison' } };
42
53
  export const CardsPlusComparison = {
43
54
  args: { layout: 'grid', showComparison: true, planSet: 'comparison' }
44
55
  };
@@ -6,7 +6,9 @@
6
6
  | 'bento'
7
7
  | 'compact'
8
8
  | 'split'
9
- | 'table';
9
+ | 'table'
10
+ | 'list'
11
+ | 'compare';
10
12
 
11
13
  export type PricingFeature =
12
14
  | string
@@ -22,8 +24,12 @@
22
24
  price: string;
23
25
  /** Yearly price when billing toggle is yearly */
24
26
  priceYearly?: string;
27
+ /** Struck-through list price (optional) */
28
+ compareAtPrice?: string;
25
29
  period?: string;
26
30
  periodYearly?: string;
31
+ /** Small hint under the price (e.g. savings) */
32
+ priceNote?: string;
27
33
  description?: string;
28
34
  features: PricingFeature[];
29
35
  cta?: string;
@@ -45,6 +51,8 @@
45
51
 
46
52
  <script lang="ts">
47
53
  import type { Snippet } from 'svelte';
54
+ import Check from '@lucide/svelte/icons/check';
55
+ import X from '@lucide/svelte/icons/x';
48
56
  import Button from '../../atoms/Button/Button.svelte';
49
57
  import Badge from '../../atoms/Badge/Badge.svelte';
50
58
  import SegmentedControl from '../../molecules/SegmentedControl/SegmentedControl.svelte';
@@ -61,7 +69,8 @@
61
69
  /** Show monthly/yearly toggle when plans have priceYearly */
62
70
  showBillingToggle?: boolean;
63
71
  billingPeriod?: 'monthly' | 'yearly';
64
- /** Explicit feature matrix for `layout="table"` (auto-built when omitted) */
72
+ billingLabels?: { monthly?: string; yearly?: string };
73
+ /** Explicit feature matrix for compare/list/table (auto-built when omitted) */
65
74
  comparisonRows?: PricingComparisonRow[];
66
75
  /** Append comparison matrix below card layouts */
67
76
  showComparison?: boolean;
@@ -81,6 +90,7 @@
81
90
  maxFeatures,
82
91
  showBillingToggle = false,
83
92
  billingPeriod = $bindable<'monthly' | 'yearly'>('monthly'),
93
+ billingLabels,
84
94
  comparisonRows,
85
95
  showComparison = false,
86
96
  class: className = '',
@@ -89,6 +99,10 @@
89
99
  onbillingperiodchange
90
100
  }: PricingTableProps = $props();
91
101
 
102
+ const isCompareLayout = $derived(
103
+ layout === 'table' || layout === 'list' || layout === 'compare'
104
+ );
105
+
92
106
  const resolvedColumns = $derived.by(() => {
93
107
  if (columns) return columns;
94
108
  const n = plans.length;
@@ -138,12 +152,16 @@
138
152
  }
139
153
 
140
154
  function displayPeriod(plan: PricingPlan) {
141
- if (billingPeriod === 'yearly') {
155
+ if (billingPeriod === 'yearly' && plan.priceYearly) {
142
156
  return normalizePeriod(plan.periodYearly ?? 'yr');
143
157
  }
144
158
  return normalizePeriod(plan.period);
145
159
  }
146
160
 
161
+ const canToggleBilling = $derived(
162
+ showBillingToggle && plans.some((p) => Boolean(p.priceYearly))
163
+ );
164
+
147
165
  function featureList(plan: PricingPlan) {
148
166
  const list = plan.features.map((f) =>
149
167
  typeof f === 'string' ? { label: f, included: true as boolean | undefined } : f
@@ -189,7 +207,7 @@
189
207
  }));
190
208
  });
191
209
 
192
- const showMatrix = $derived(layout === 'table' || showComparison);
210
+ const showMatrix = $derived(isCompareLayout || showComparison);
193
211
 
194
212
  function select(id: string, disabled?: boolean) {
195
213
  if (disabled) return;
@@ -221,8 +239,53 @@
221
239
  billingPeriod = id as 'monthly' | 'yearly';
222
240
  onbillingperiodchange?.(billingPeriod);
223
241
  }
242
+
243
+ /** Selection chrome only on the plan header — never paint feature rows. */
244
+ function planHeaderClass(plan: PricingPlan) {
245
+ const selected = selectedId === plan.id;
246
+ return [
247
+ plan.featured && !selected && 'bg-brand-50/40 dark:bg-brand-950/15',
248
+ selected && 'bg-surface-elevated'
249
+ ];
250
+ }
224
251
  </script>
225
252
 
253
+ {#snippet priceBlock(plan: PricingPlan, opts?: { large?: boolean; dense?: boolean; align?: 'left' | 'center' | 'right' })}
254
+ {@const large = opts?.large ?? false}
255
+ {@const dense = opts?.dense ?? false}
256
+ {@const align = opts?.align ?? 'left'}
257
+ <div
258
+ class={[
259
+ align === 'center' && 'text-center',
260
+ align === 'right' && 'text-right'
261
+ ]}
262
+ >
263
+ {#if plan.compareAtPrice}
264
+ <p class={['text-muted line-through', dense ? 'text-[11px]' : 'text-xs']}>
265
+ {plan.compareAtPrice}
266
+ </p>
267
+ {/if}
268
+ <p>
269
+ <span
270
+ class={[
271
+ 'font-semibold text-primary',
272
+ large ? 'text-4xl' : dense ? 'text-2xl' : 'text-3xl'
273
+ ]}
274
+ >
275
+ {displayPrice(plan)}
276
+ </span>
277
+ {#if displayPeriod(plan)}
278
+ <span class="text-sm text-muted">{displayPeriod(plan)}</span>
279
+ {/if}
280
+ </p>
281
+ {#if plan.priceNote}
282
+ <p class={['mt-1 font-medium text-brand-600 dark:text-brand-400', dense ? 'text-[11px]' : 'text-xs']}>
283
+ {plan.priceNote}
284
+ </p>
285
+ {/if}
286
+ </div>
287
+ {/snippet}
288
+
226
289
  {#snippet featureRows(plan: PricingPlan, dense = false)}
227
290
  {@const { visible, more } = featureList(plan)}
228
291
  {#if showFeatures && visible.length}
@@ -288,15 +351,8 @@
288
351
  </div>
289
352
  {/if}
290
353
  </div>
291
- <div class="flex shrink-0 flex-col items-stretch gap-3 sm:w-40 sm:items-stretch">
292
- <p class="sm:text-right">
293
- <span class={['font-semibold text-primary', large ? 'text-4xl' : 'text-2xl']}>
294
- {displayPrice(plan)}
295
- </span>
296
- {#if displayPeriod(plan)}
297
- <span class="text-sm text-muted">{displayPeriod(plan)}</span>
298
- {/if}
299
- </p>
354
+ <div class="flex shrink-0 flex-col items-stretch gap-3 sm:w-44 sm:items-stretch">
355
+ {@render priceBlock(plan, { large, dense: true, align: 'right' })}
300
356
  <Button
301
357
  variant={plan.featured || selectedId === plan.id ? 'primary' : 'secondary'}
302
358
  size="sm"
@@ -328,19 +384,9 @@
328
384
  {/if}
329
385
  </div>
330
386
 
331
- <p class={dense ? 'mb-3' : 'mb-4'}>
332
- <span
333
- class={[
334
- 'font-semibold text-primary',
335
- large ? 'text-4xl' : dense ? 'text-2xl' : 'text-3xl'
336
- ]}
337
- >
338
- {displayPrice(plan)}
339
- </span>
340
- {#if displayPeriod(plan)}
341
- <span class="text-sm text-muted">{displayPeriod(plan)}</span>
342
- {/if}
343
- </p>
387
+ <div class={dense ? 'mb-3' : 'mb-4'}>
388
+ {@render priceBlock(plan, { large, dense })}
389
+ </div>
344
390
 
345
391
  <div class="mb-auto flex-1">
346
392
  {@render featureRows(plan, dense)}
@@ -364,13 +410,16 @@
364
410
  {#snippet matrixCell(value: boolean | string)}
365
411
  {#if typeof value === 'boolean'}
366
412
  {#if value}
367
- <span class="inline-flex text-brand-600 dark:text-brand-400" aria-label="Included">
368
- <svg class="mx-auto h-4 w-4" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" aria-hidden="true">
369
- <path stroke-linecap="round" stroke-linejoin="round" d="M5 13l4 4L19 7" />
370
- </svg>
413
+ <span
414
+ class="inline-flex text-brand-600 dark:text-brand-400"
415
+ aria-label="Included"
416
+ >
417
+ <Check class="mx-auto h-4 w-4" strokeWidth={2.75} aria-hidden="true" />
371
418
  </span>
372
419
  {:else}
373
- <span class="text-muted" aria-label="Not included">—</span>
420
+ <span class="inline-flex text-muted" aria-label="Not included">
421
+ <X class="mx-auto h-4 w-4" strokeWidth={2.25} aria-hidden="true" />
422
+ </span>
374
423
  {/if}
375
424
  {:else}
376
425
  <span class="text-sm font-medium text-primary">{value}</span>
@@ -378,124 +427,158 @@
378
427
  {/snippet}
379
428
 
380
429
  {#snippet comparisonTable(withPricingHeader: boolean)}
381
- {@const colCount = Math.max(plans.length, 1)}
382
- {@const labelCol = 'minmax(10rem, 13rem)'}
383
- {@const planCols = `repeat(${colCount}, minmax(9rem, 1fr))`}
384
- {@const matrixCols = `${labelCol} ${planCols}`}
385
- <div class="w-full overflow-x-auto rounded-2xl border border-border bg-surface-elevated shadow-sm">
386
- {#if withPricingHeader}
387
- <!-- Same column template as matrix rows so cards line up with values -->
388
- <div
389
- class="grid min-w-160 divide-x divide-border border-b border-border"
390
- style:grid-template-columns={matrixCols}
391
- >
392
- <div class="bg-surface-overlay/30" aria-hidden="true"></div>
393
- {#each plans as plan (plan.id)}
394
- {@const badgeText = plan.badge ?? (plan.featured ? featuredBadgeLabel : undefined)}
395
- <div
396
- class={[
397
- 'flex flex-col items-center px-4 py-6 text-center',
398
- plan.featured && 'bg-brand-50/70 dark:bg-brand-950/25'
399
- ]}
400
- >
401
- <div class="flex min-h-6 flex-wrap items-center justify-center gap-1.5">
402
- <span class="text-sm font-semibold text-primary">{plan.name}</span>
403
- {#if badgeText}
404
- <Badge size="sm" variant="primary" class="whitespace-nowrap">{badgeText}</Badge>
405
- {/if}
406
- </div>
407
- <p class="mt-1 min-h-8 max-w-44 text-xs leading-snug text-secondary">
408
- {plan.description ?? '\u00a0'}
409
- </p>
410
- <p class="mt-3">
411
- <span class="text-3xl font-semibold tracking-tight text-primary">
412
- {displayPrice(plan)}
413
- </span>
414
- {#if displayPeriod(plan)}
415
- <span class="text-xs text-muted">{displayPeriod(plan)}</span>
416
- {/if}
417
- </p>
418
- <Button
419
- variant={plan.featured || selectedId === plan.id ? 'primary' : 'secondary'}
420
- size="sm"
421
- class="mt-4 w-full max-w-40"
422
- disabled={plan.disabled}
423
- onclick={() => select(plan.id, plan.disabled)}
430
+ <div class="w-full overflow-x-auto rounded-xl border border-border bg-surface-elevated">
431
+ <table class="w-full min-w-160 border-collapse text-sm" aria-label="Plan feature comparison">
432
+ <thead class="sticky top-0 z-30">
433
+ {#if withPricingHeader}
434
+ <tr class="border-b border-border bg-surface-elevated shadow-sm">
435
+ <th
436
+ scope="col"
437
+ class="sticky left-0 z-40 bg-surface-elevated px-4 py-4 text-left align-bottom"
424
438
  >
425
- {plan.cta ?? 'Get started'}
426
- </Button>
427
- </div>
428
- {/each}
429
- </div>
430
- {/if}
431
-
432
- <div
433
- class="border-b border-border bg-surface-overlay/60 px-4 py-2.5 text-[11px] font-semibold uppercase tracking-wider text-muted"
434
- >
435
- What's included
436
- </div>
437
-
438
- <div class="min-w-160" role="table" aria-label="Plan feature comparison">
439
- <div
440
- class="grid divide-x divide-border border-b border-border bg-surface/80"
441
- style:grid-template-columns={matrixCols}
442
- role="row"
443
- >
444
- <div class="px-4 py-2.5" role="columnheader"></div>
445
- {#each plans as plan (plan.id)}
446
- <div
439
+ <span class="text-muted text-[11px] font-semibold tracking-wide uppercase">
440
+ Incluye
441
+ </span>
442
+ </th>
443
+ {#each plans as plan (plan.id)}
444
+ {@const badgeText =
445
+ plan.badge ?? (plan.featured ? featuredBadgeLabel : undefined)}
446
+ {@const selected = selectedId === plan.id}
447
+ <th
448
+ scope="col"
449
+ class={[
450
+ 'min-w-40 px-3 py-4 text-center align-top font-normal',
451
+ planHeaderClass(plan)
452
+ ]}
453
+ >
454
+ <button
455
+ type="button"
456
+ class={[
457
+ 'flex w-full flex-col items-center gap-2 rounded-xl border px-2 py-2 text-center transition-colors',
458
+ selected
459
+ ? 'border-border-strong bg-surface-overlay ring-2 ring-border'
460
+ : 'border-transparent',
461
+ !plan.disabled && !selected && 'hover:border-border hover:bg-surface-overlay/40',
462
+ plan.disabled && 'cursor-not-allowed opacity-50'
463
+ ]}
464
+ disabled={plan.disabled}
465
+ aria-pressed={selected}
466
+ onclick={() => select(plan.id, plan.disabled)}
467
+ >
468
+ <div class="flex min-h-6 flex-wrap items-center justify-center gap-1.5">
469
+ <span class="text-sm font-semibold text-primary">{plan.name}</span>
470
+ {#if badgeText}
471
+ <Badge
472
+ size="sm"
473
+ variant={selected ? 'default' : 'primary'}
474
+ class="whitespace-nowrap"
475
+ >
476
+ {badgeText}
477
+ </Badge>
478
+ {/if}
479
+ </div>
480
+ {#if plan.description}
481
+ <p class="line-clamp-2 max-w-44 text-xs leading-snug text-secondary">
482
+ {plan.description}
483
+ </p>
484
+ {/if}
485
+ {@render priceBlock(plan, { dense: true, align: 'center' })}
486
+ <span
487
+ class={[
488
+ 'inline-flex h-8 w-full max-w-40 items-center justify-center rounded-lg px-3 text-xs font-medium',
489
+ selected
490
+ ? 'bg-surface-overlay text-primary ring-2 ring-border-strong'
491
+ : plan.featured
492
+ ? 'bg-brand-600 text-white'
493
+ : 'bg-surface-overlay text-primary ring-1 ring-border'
494
+ ]}
495
+ >
496
+ {plan.cta ?? 'Select'}
497
+ </span>
498
+ </button>
499
+ </th>
500
+ {/each}
501
+ </tr>
502
+ {:else}
503
+ <tr class="border-b border-border bg-surface/80">
504
+ <th
505
+ scope="col"
506
+ class="sticky left-0 z-40 bg-surface px-4 py-2.5 text-left"
507
+ ></th>
508
+ {#each plans as plan (plan.id)}
509
+ {@const selected = selectedId === plan.id}
510
+ <th
511
+ scope="col"
512
+ class={[
513
+ 'px-3 py-2.5 text-center text-xs font-semibold text-secondary',
514
+ planHeaderClass(plan)
515
+ ]}
516
+ >
517
+ <button
518
+ type="button"
519
+ class={[
520
+ 'w-full rounded-lg border px-2 py-1 transition-colors',
521
+ selected
522
+ ? 'border-border-strong bg-surface-overlay text-primary ring-2 ring-border'
523
+ : 'border-transparent hover:bg-surface-overlay/60'
524
+ ]}
525
+ disabled={plan.disabled}
526
+ aria-pressed={selected}
527
+ onclick={() => select(plan.id, plan.disabled)}
528
+ >
529
+ {plan.name}
530
+ </button>
531
+ </th>
532
+ {/each}
533
+ </tr>
534
+ {/if}
535
+ </thead>
536
+ <tbody>
537
+ {#each resolvedComparisonRows as row, ri (row.id)}
538
+ <tr
447
539
  class={[
448
- 'px-4 py-2.5 text-center text-xs font-semibold text-secondary',
449
- plan.featured && 'bg-brand-50/40 text-brand-700 dark:bg-brand-950/15 dark:text-brand-300'
540
+ 'border-b border-border last:border-b-0',
541
+ ri % 2 === 1 && 'bg-surface-overlay/25'
450
542
  ]}
451
- role="columnheader"
452
543
  >
453
- {plan.name}
454
- </div>
455
- {/each}
456
- </div>
457
-
458
- {#each resolvedComparisonRows as row, ri (row.id)}
459
- <div
460
- class={[
461
- 'grid divide-x divide-border border-b border-border last:border-b-0',
462
- ri % 2 === 1 && 'bg-surface-overlay/20'
463
- ]}
464
- style:grid-template-columns={matrixCols}
465
- role="row"
466
- >
467
- <div
468
- class="flex items-center px-4 py-3.5 text-sm font-medium text-primary"
469
- role="rowheader"
470
- >
471
- {row.label}
472
- </div>
473
- {#each row.values as value, vi}
474
- {@const plan = plans[vi]}
475
- <div
544
+ <th
545
+ scope="row"
476
546
  class={[
477
- 'flex items-center justify-center px-4 py-3.5 text-center',
478
- plan?.featured && 'bg-brand-50/30 dark:bg-brand-950/10'
547
+ 'sticky left-0 z-10 border-r border-border px-4 py-3 text-left text-sm font-medium text-primary',
548
+ ri % 2 === 1 ? 'bg-surface-overlay/40' : 'bg-surface-elevated'
479
549
  ]}
480
- role="cell"
481
550
  >
482
- {@render matrixCell(value)}
483
- </div>
484
- {/each}
485
- </div>
486
- {/each}
487
- </div>
551
+ {row.label}
552
+ </th>
553
+ {#each row.values as value, vi (`${row.id}-${plans[vi]?.id ?? vi}`)}
554
+ <td class="px-3 py-3 text-center">
555
+ {@render matrixCell(value)}
556
+ </td>
557
+ {/each}
558
+ </tr>
559
+ {:else}
560
+ <tr>
561
+ <td
562
+ class="text-muted px-4 py-8 text-center text-sm"
563
+ colspan={Math.max(plans.length, 1) + 1}
564
+ >
565
+ Sin características para comparar.
566
+ </td>
567
+ </tr>
568
+ {/each}
569
+ </tbody>
570
+ </table>
488
571
  </div>
489
572
  {/snippet}
490
573
 
491
574
  <div class={['w-full space-y-4', className]}>
492
- {#if showBillingToggle}
575
+ {#if canToggleBilling}
493
576
  <div class="flex justify-center">
494
577
  <SegmentedControl
495
578
  size="sm"
496
579
  items={[
497
- { id: 'monthly', label: 'Monthly' },
498
- { id: 'yearly', label: 'Yearly' }
580
+ { id: 'monthly', label: billingLabels?.monthly ?? 'Monthly' },
581
+ { id: 'yearly', label: billingLabels?.yearly ?? 'Yearly' }
499
582
  ]}
500
583
  bind:value={billingPeriod}
501
584
  onchange={onBillingChange}
@@ -503,7 +586,11 @@
503
586
  </div>
504
587
  {/if}
505
588
 
506
- {#if layout === 'table'}
589
+ {#if plans.length === 0}
590
+ <p class="text-muted rounded-xl border border-border bg-surface-elevated px-4 py-8 text-center text-sm">
591
+ No hay tarifas disponibles para este periodo.
592
+ </p>
593
+ {:else if isCompareLayout}
507
594
  {@render comparisonTable(true)}
508
595
  {:else if layout === 'split' && featuredPlan}
509
596
  <div class={containerClass} role="list">
@@ -553,7 +640,7 @@
553
640
  </div>
554
641
  {/if}
555
642
 
556
- {#if showMatrix && layout !== 'table'}
643
+ {#if showMatrix && !isCompareLayout}
557
644
  <div class="pt-2">
558
645
  {@render comparisonTable(false)}
559
646
  </div>
@@ -1,4 +1,4 @@
1
- export type PricingLayout = 'grid' | 'horizontal' | 'vertical' | 'bento' | 'compact' | 'split' | 'table';
1
+ export type PricingLayout = 'grid' | 'horizontal' | 'vertical' | 'bento' | 'compact' | 'split' | 'table' | 'list' | 'compare';
2
2
  export type PricingFeature = string | {
3
3
  label: string;
4
4
  included?: boolean;
@@ -10,8 +10,12 @@ export interface PricingPlan {
10
10
  price: string;
11
11
  /** Yearly price when billing toggle is yearly */
12
12
  priceYearly?: string;
13
+ /** Struck-through list price (optional) */
14
+ compareAtPrice?: string;
13
15
  period?: string;
14
16
  periodYearly?: string;
17
+ /** Small hint under the price (e.g. savings) */
18
+ priceNote?: string;
15
19
  description?: string;
16
20
  features: PricingFeature[];
17
21
  cta?: string;
@@ -41,7 +45,11 @@ interface PricingTableProps {
41
45
  /** Show monthly/yearly toggle when plans have priceYearly */
42
46
  showBillingToggle?: boolean;
43
47
  billingPeriod?: 'monthly' | 'yearly';
44
- /** Explicit feature matrix for `layout="table"` (auto-built when omitted) */
48
+ billingLabels?: {
49
+ monthly?: string;
50
+ yearly?: string;
51
+ };
52
+ /** Explicit feature matrix for compare/list/table (auto-built when omitted) */
45
53
  comparisonRows?: PricingComparisonRow[];
46
54
  /** Append comparison matrix below card layouts */
47
55
  showComparison?: boolean;
@@ -190,7 +190,9 @@
190
190
  const widthClass = $derived.by(() => {
191
191
  const layout = props.layout ?? 'grid';
192
192
  if (layout === 'vertical') return 'w-112 max-w-full';
193
- if (layout === 'table' || props.showComparison) return 'w-208 max-w-full';
193
+ if (layout === 'table' || layout === 'list' || layout === 'compare' || props.showComparison) {
194
+ return 'w-208 max-w-full';
195
+ }
194
196
  if (layout === 'horizontal') return 'w-192 max-w-full';
195
197
  if (layout === 'bento' || layout === 'split') return 'w-208 max-w-full';
196
198
  if ((props.columns ?? 3) >= 4 || planSet === 'four') return 'w-224 max-w-full';
@@ -209,7 +211,12 @@
209
211
  showFeatures={props.showFeatures ?? true}
210
212
  showComparison={props.showComparison ?? false}
211
213
  maxFeatures={props.maxFeatures}
212
- comparisonRows={planSet === 'comparison' || props.layout === 'table' ? comparisonRows : undefined}
214
+ comparisonRows={planSet === 'comparison' ||
215
+ props.layout === 'table' ||
216
+ props.layout === 'list' ||
217
+ props.layout === 'compare'
218
+ ? comparisonRows
219
+ : undefined}
213
220
  onselect={(id) => (selectedId = id)}
214
221
  >
215
222
  {#snippet footer()}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@r2digisolutions/components",
3
- "version": "0.19.8",
3
+ "version": "0.19.10",
4
4
  "private": false,
5
5
  "description": "R2DigiSolutions Svelte 5 component library — Atomic Design, Tailwind 4, Light/Dark mode",
6
6
  "license": "MIT",