@r2digisolutions/components 0.19.9 → 0.19.11
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/components/molecules/ConfirmDialog/ConfirmDialog.svelte +4 -0
- package/dist/components/molecules/ConfirmDialog/ConfirmDialog.svelte.d.ts +2 -0
- package/dist/components/molecules/SelectCard/SelectCard.svelte +5 -1
- package/dist/components/molecules/SelectCard/SelectCard.svelte.d.ts +1 -1
- package/dist/components/organisms/PricingTable/PricingTable.svelte +30 -21
- package/package.json +1 -1
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
cancelLabel?: string;
|
|
11
11
|
confirmLoading?: boolean;
|
|
12
12
|
confirmDisabled?: boolean;
|
|
13
|
+
/** Keep open while an async confirm runs (e.g. remote form). Default true. */
|
|
14
|
+
closeOnConfirm?: boolean;
|
|
13
15
|
children?: Snippet;
|
|
14
16
|
onconfirm?: () => void;
|
|
15
17
|
oncancel?: () => void;
|
|
@@ -24,6 +26,7 @@
|
|
|
24
26
|
cancelLabel = 'Cancel',
|
|
25
27
|
confirmLoading = false,
|
|
26
28
|
confirmDisabled = false,
|
|
29
|
+
closeOnConfirm = true,
|
|
27
30
|
children,
|
|
28
31
|
onconfirm,
|
|
29
32
|
oncancel,
|
|
@@ -39,6 +42,7 @@
|
|
|
39
42
|
{cancelLabel}
|
|
40
43
|
{confirmLoading}
|
|
41
44
|
{confirmDisabled}
|
|
45
|
+
{closeOnConfirm}
|
|
42
46
|
tone="danger"
|
|
43
47
|
confirmVariant="destructive"
|
|
44
48
|
size="sm"
|
|
@@ -7,6 +7,8 @@ interface ConfirmDialogProps {
|
|
|
7
7
|
cancelLabel?: string;
|
|
8
8
|
confirmLoading?: boolean;
|
|
9
9
|
confirmDisabled?: boolean;
|
|
10
|
+
/** Keep open while an async confirm runs (e.g. remote form). Default true. */
|
|
11
|
+
closeOnConfirm?: boolean;
|
|
10
12
|
children?: Snippet;
|
|
11
13
|
onconfirm?: () => void;
|
|
12
14
|
oncancel?: () => void;
|
|
@@ -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;
|
|
@@ -240,11 +240,12 @@
|
|
|
240
240
|
onbillingperiodchange?.(billingPeriod);
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
|
|
243
|
+
/** Selection chrome only on the plan header — never paint feature rows. */
|
|
244
|
+
function planHeaderClass(plan: PricingPlan) {
|
|
244
245
|
const selected = selectedId === plan.id;
|
|
245
246
|
return [
|
|
246
|
-
plan.featured && 'bg-brand-50/
|
|
247
|
-
selected && 'bg-
|
|
247
|
+
plan.featured && !selected && 'bg-brand-50/40 dark:bg-brand-950/15',
|
|
248
|
+
selected && 'bg-surface-elevated'
|
|
248
249
|
];
|
|
249
250
|
}
|
|
250
251
|
</script>
|
|
@@ -447,15 +448,17 @@
|
|
|
447
448
|
scope="col"
|
|
448
449
|
class={[
|
|
449
450
|
'min-w-40 px-3 py-4 text-center align-top font-normal',
|
|
450
|
-
|
|
451
|
+
planHeaderClass(plan)
|
|
451
452
|
]}
|
|
452
453
|
>
|
|
453
454
|
<button
|
|
454
455
|
type="button"
|
|
455
456
|
class={[
|
|
456
|
-
'flex w-full flex-col items-center gap-2 rounded-xl px-2 py-2 text-center transition-colors',
|
|
457
|
-
selected
|
|
458
|
-
|
|
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',
|
|
459
462
|
plan.disabled && 'cursor-not-allowed opacity-50'
|
|
460
463
|
]}
|
|
461
464
|
disabled={plan.disabled}
|
|
@@ -465,7 +468,11 @@
|
|
|
465
468
|
<div class="flex min-h-6 flex-wrap items-center justify-center gap-1.5">
|
|
466
469
|
<span class="text-sm font-semibold text-primary">{plan.name}</span>
|
|
467
470
|
{#if badgeText}
|
|
468
|
-
<Badge
|
|
471
|
+
<Badge
|
|
472
|
+
size="sm"
|
|
473
|
+
variant={selected ? 'default' : 'primary'}
|
|
474
|
+
class="whitespace-nowrap"
|
|
475
|
+
>
|
|
469
476
|
{badgeText}
|
|
470
477
|
</Badge>
|
|
471
478
|
{/if}
|
|
@@ -479,9 +486,11 @@
|
|
|
479
486
|
<span
|
|
480
487
|
class={[
|
|
481
488
|
'inline-flex h-8 w-full max-w-40 items-center justify-center rounded-lg px-3 text-xs font-medium',
|
|
482
|
-
selected
|
|
483
|
-
? 'bg-
|
|
484
|
-
:
|
|
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'
|
|
485
494
|
]}
|
|
486
495
|
>
|
|
487
496
|
{plan.cta ?? 'Select'}
|
|
@@ -497,18 +506,24 @@
|
|
|
497
506
|
class="sticky left-0 z-40 bg-surface px-4 py-2.5 text-left"
|
|
498
507
|
></th>
|
|
499
508
|
{#each plans as plan (plan.id)}
|
|
509
|
+
{@const selected = selectedId === plan.id}
|
|
500
510
|
<th
|
|
501
511
|
scope="col"
|
|
502
512
|
class={[
|
|
503
513
|
'px-3 py-2.5 text-center text-xs font-semibold text-secondary',
|
|
504
|
-
|
|
514
|
+
planHeaderClass(plan)
|
|
505
515
|
]}
|
|
506
516
|
>
|
|
507
517
|
<button
|
|
508
518
|
type="button"
|
|
509
|
-
class=
|
|
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
|
+
]}
|
|
510
525
|
disabled={plan.disabled}
|
|
511
|
-
aria-pressed={
|
|
526
|
+
aria-pressed={selected}
|
|
512
527
|
onclick={() => select(plan.id, plan.disabled)}
|
|
513
528
|
>
|
|
514
529
|
{plan.name}
|
|
@@ -536,13 +551,7 @@
|
|
|
536
551
|
{row.label}
|
|
537
552
|
</th>
|
|
538
553
|
{#each row.values as value, vi (`${row.id}-${plans[vi]?.id ?? vi}`)}
|
|
539
|
-
|
|
540
|
-
<td
|
|
541
|
-
class={[
|
|
542
|
-
'px-3 py-3 text-center',
|
|
543
|
-
plan && planColClass(plan)
|
|
544
|
-
]}
|
|
545
|
-
>
|
|
554
|
+
<td class="px-3 py-3 text-center">
|
|
546
555
|
{@render matrixCell(value)}
|
|
547
556
|
</td>
|
|
548
557
|
{/each}
|