@makolabs/ripple 3.0.7 → 3.0.9

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.
@@ -1,8 +1,6 @@
1
1
  export declare const activityList: import("tailwind-variants").TVReturnType<{
2
2
  size: {
3
3
  md: {
4
- header: string;
5
- title: string;
6
4
  item: string;
7
5
  timelineLine: string;
8
6
  iconWrapper: string;
@@ -14,8 +12,6 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
14
12
  itemTimestamp: string;
15
13
  };
16
14
  sm: {
17
- header: string;
18
- title: string;
19
15
  item: string;
20
16
  timelineLine: string;
21
17
  iconWrapper: string;
@@ -27,47 +23,7 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
27
23
  itemTimestamp: string;
28
24
  };
29
25
  };
30
- color: {
31
- default: {
32
- base: string;
33
- header: string;
34
- title: string;
35
- };
36
- primary: {
37
- base: string;
38
- header: string;
39
- title: string;
40
- };
41
- secondary: {
42
- base: string;
43
- header: string;
44
- title: string;
45
- };
46
- info: {
47
- base: string;
48
- header: string;
49
- title: string;
50
- };
51
- success: {
52
- base: string;
53
- header: string;
54
- title: string;
55
- };
56
- warning: {
57
- base: string;
58
- header: string;
59
- title: string;
60
- };
61
- danger: {
62
- base: string;
63
- header: string;
64
- title: string;
65
- };
66
- };
67
26
  }, {
68
- base: string;
69
- header: string;
70
- title: string;
71
27
  content: string;
72
28
  item: string;
73
29
  accentBar: string;
@@ -85,8 +41,6 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
85
41
  }, undefined, {
86
42
  size: {
87
43
  md: {
88
- header: string;
89
- title: string;
90
44
  item: string;
91
45
  timelineLine: string;
92
46
  iconWrapper: string;
@@ -98,8 +52,6 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
98
52
  itemTimestamp: string;
99
53
  };
100
54
  sm: {
101
- header: string;
102
- title: string;
103
55
  item: string;
104
56
  timelineLine: string;
105
57
  iconWrapper: string;
@@ -111,47 +63,7 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
111
63
  itemTimestamp: string;
112
64
  };
113
65
  };
114
- color: {
115
- default: {
116
- base: string;
117
- header: string;
118
- title: string;
119
- };
120
- primary: {
121
- base: string;
122
- header: string;
123
- title: string;
124
- };
125
- secondary: {
126
- base: string;
127
- header: string;
128
- title: string;
129
- };
130
- info: {
131
- base: string;
132
- header: string;
133
- title: string;
134
- };
135
- success: {
136
- base: string;
137
- header: string;
138
- title: string;
139
- };
140
- warning: {
141
- base: string;
142
- header: string;
143
- title: string;
144
- };
145
- danger: {
146
- base: string;
147
- header: string;
148
- title: string;
149
- };
150
- };
151
66
  }, {
152
- base: string;
153
- header: string;
154
- title: string;
155
67
  content: string;
156
68
  item: string;
157
69
  accentBar: string;
@@ -169,8 +81,6 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
169
81
  }, import("tailwind-variants").TVReturnType<{
170
82
  size: {
171
83
  md: {
172
- header: string;
173
- title: string;
174
84
  item: string;
175
85
  timelineLine: string;
176
86
  iconWrapper: string;
@@ -182,8 +92,6 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
182
92
  itemTimestamp: string;
183
93
  };
184
94
  sm: {
185
- header: string;
186
- title: string;
187
95
  item: string;
188
96
  timelineLine: string;
189
97
  iconWrapper: string;
@@ -195,47 +103,7 @@ export declare const activityList: import("tailwind-variants").TVReturnType<{
195
103
  itemTimestamp: string;
196
104
  };
197
105
  };
198
- color: {
199
- default: {
200
- base: string;
201
- header: string;
202
- title: string;
203
- };
204
- primary: {
205
- base: string;
206
- header: string;
207
- title: string;
208
- };
209
- secondary: {
210
- base: string;
211
- header: string;
212
- title: string;
213
- };
214
- info: {
215
- base: string;
216
- header: string;
217
- title: string;
218
- };
219
- success: {
220
- base: string;
221
- header: string;
222
- title: string;
223
- };
224
- warning: {
225
- base: string;
226
- header: string;
227
- title: string;
228
- };
229
- danger: {
230
- base: string;
231
- header: string;
232
- title: string;
233
- };
234
- };
235
106
  }, {
236
- base: string;
237
- header: string;
238
- title: string;
239
107
  content: string;
240
108
  item: string;
241
109
  accentBar: string;
@@ -1,10 +1,9 @@
1
1
  import { tv } from 'tailwind-variants';
2
- import { Color } from '../../variants.js';
2
+ // Chrome (border, radius, shadow, header bg, title styling) is delegated to
3
+ // <Card>. This file only owns item-level slots — the per-row layout, icons,
4
+ // timeline connectors, badges, etc.
3
5
  export const activityList = tv({
4
6
  slots: {
5
- base: 'rounded-lg bg-white shadow-sm',
6
- header: '',
7
- title: 'font-medium text-default-900',
8
7
  content: 'divide-y divide-default-200',
9
8
  item: 'relative flex items-center hover:bg-default-50 transition-colors',
10
9
  accentBar: 'absolute inset-y-0 left-0 w-[3px]',
@@ -23,8 +22,6 @@ export const activityList = tv({
23
22
  variants: {
24
23
  size: {
25
24
  md: {
26
- header: 'border-b border-default-200 px-6 py-4',
27
- title: 'text-lg',
28
25
  item: 'gap-3 px-6 py-4',
29
26
  timelineLine: 'left-[calc(1.5rem+1rem-1px)]',
30
27
  iconWrapper: 'size-8 mt-0.5',
@@ -36,8 +33,6 @@ export const activityList = tv({
36
33
  itemTimestamp: 'text-xs'
37
34
  },
38
35
  sm: {
39
- header: 'border-b border-default-200 px-4 py-2.5',
40
- title: 'text-base',
41
36
  item: 'gap-2 px-4 py-2.5',
42
37
  timelineLine: 'left-[calc(1rem+0.75rem-1px)]',
43
38
  iconWrapper: 'size-6 mt-0',
@@ -48,48 +43,10 @@ export const activityList = tv({
48
43
  itemSubtitle: 'mt-0.5 text-[11px]',
49
44
  itemTimestamp: 'text-[11px]'
50
45
  }
51
- },
52
- color: {
53
- [Color.DEFAULT]: {
54
- base: 'bg-white border-default-200',
55
- header: 'border-default-200',
56
- title: 'text-default-900'
57
- },
58
- [Color.PRIMARY]: {
59
- base: 'bg-primary-50 border-primary-200',
60
- header: 'border-primary-200',
61
- title: 'text-primary-900'
62
- },
63
- [Color.SECONDARY]: {
64
- base: 'bg-secondary-50 border-secondary-200',
65
- header: 'border-secondary-200',
66
- title: 'text-secondary-900'
67
- },
68
- [Color.INFO]: {
69
- base: 'bg-info-50 border-info-200',
70
- header: 'border-info-200',
71
- title: 'text-info-900'
72
- },
73
- [Color.SUCCESS]: {
74
- base: 'bg-success-50 border-success-200',
75
- header: 'border-success-200',
76
- title: 'text-success-900'
77
- },
78
- [Color.WARNING]: {
79
- base: 'bg-warning-50 border-warning-200',
80
- header: 'border-warning-200',
81
- title: 'text-warning-900'
82
- },
83
- [Color.DANGER]: {
84
- base: 'bg-danger-50 border-danger-200',
85
- header: 'border-danger-200',
86
- title: 'text-danger-900'
87
- }
88
46
  }
89
47
  },
90
48
  defaultVariants: {
91
- size: 'md',
92
- color: Color.DEFAULT
49
+ size: 'md'
93
50
  }
94
51
  });
95
52
  /**
@@ -4,40 +4,72 @@
4
4
  import { card } from './card.js';
5
5
  import Skeleton from '../../elements/skeleton/Skeleton.svelte';
6
6
  import type { CardProps } from '../../index.js';
7
- import { Color } from '../../variants.js';
7
+ import { Color, Size } from '../../variants.js';
8
8
 
9
9
  let {
10
10
  children,
11
11
  custom,
12
12
  title,
13
+ subtitle,
14
+ headerEnd,
13
15
  color = Color.DEFAULT,
16
+ size = Size.MD,
17
+ headerStyle = 'tinted',
14
18
  class: className = '',
15
19
  titleClass = '',
20
+ subtitleClass = '',
16
21
  bodyClass = '',
17
22
  loading = false,
18
23
  testId
19
24
  }: CardProps = $props();
20
25
 
21
- const { base, title: titleSlot, body: bodySlot } = $derived(card({ color }));
26
+ const slots = $derived(card({ color, size, headerStyle }));
27
+ const baseClass = $derived(cn(slots.base(), className));
28
+ const headerClass = $derived(slots.header());
29
+ const headerLeftClass = $derived(slots.headerLeft());
30
+ const headerEndClass = $derived(slots.headerEnd());
31
+ const titleClasses = $derived(cn(slots.title(), titleClass));
32
+ const subtitleClasses = $derived(cn(slots.subtitle(), subtitleClass));
33
+ const bodyClasses = $derived(cn(slots.body(), bodyClass));
22
34
 
23
- const baseClass = $derived(cn(base(), className));
24
- const titleClasses = $derived(cn(titleSlot(), titleClass));
25
- const bodyClasses = $derived(cn(bodySlot(), bodyClass));
35
+ const hasHeader = $derived(
36
+ !loading && !custom && (title !== undefined || headerEnd !== undefined)
37
+ );
26
38
  </script>
27
39
 
28
40
  <div class={baseClass} data-testid={buildTestId('card', undefined, testId)}>
29
41
  {#if loading}
30
- <Skeleton class="mb-3 h-5 w-1/2" />
31
- <div class="space-y-2">
32
- <Skeleton class="h-3 w-full" />
33
- <Skeleton class="h-3 w-5/6" />
34
- <Skeleton class="h-3 w-3/4" />
42
+ <div class={bodyClasses}>
43
+ <Skeleton class="mb-3 h-5 w-1/2" />
44
+ <div class="space-y-2">
45
+ <Skeleton class="h-3 w-full" />
46
+ <Skeleton class="h-3 w-5/6" />
47
+ <Skeleton class="h-3 w-3/4" />
48
+ </div>
35
49
  </div>
36
50
  {:else if custom}
37
51
  {@render custom()}
38
52
  {:else}
39
- {#if title}
40
- <h3 class={titleClasses} data-testid={buildTestId('card', 'title', testId)}>{title}</h3>
53
+ {#if hasHeader}
54
+ <div class={headerClass} data-testid={buildTestId('card', 'header', testId)}>
55
+ <div class={headerLeftClass}>
56
+ {#if title}
57
+ <h3 class={titleClasses} data-testid={buildTestId('card', 'title', testId)}>
58
+ {#if typeof title === 'string'}{title}{:else}{@render title()}{/if}
59
+ </h3>
60
+ {/if}
61
+ {#if subtitle}
62
+ <p class={subtitleClasses} data-testid={buildTestId('card', 'subtitle', testId)}>
63
+ {#if typeof subtitle === 'string'}{subtitle}{:else}{@render subtitle()}{/if}
64
+ </p>
65
+ {/if}
66
+ </div>
67
+ {#if headerEnd}
68
+ <div class={headerEndClass} data-testid={buildTestId('card', 'header-end', testId)}>
69
+ {@render headerEnd()}
70
+ </div>
71
+ {/if}
72
+ </div>
41
73
  {/if}
42
74
  {#if children}
43
75
  <div class={bodyClasses} data-testid={buildTestId('card', 'body', testId)}>
@@ -1,7 +1,7 @@
1
1
  import type { ClassValue } from 'tailwind-variants';
2
2
  import type { Snippet } from 'svelte';
3
3
  import type { Component } from 'svelte';
4
- import type { VariantColors } from '../../index.js';
4
+ import type { VariantColors, VariantSizes } from '../../index.js';
5
5
  import type { ProgressSegment } from '../../elements/progress/progress-types.js';
6
6
  /**
7
7
  * Props for `<Card>` — a generic bordered container with optional
@@ -9,7 +9,6 @@ import type { ProgressSegment } from '../../elements/progress/progress-types.js'
9
9
  * a skeleton placeholder while loading.
10
10
  *
11
11
  * For number-focused cards (KPIs, metrics), use `<MetricCard>` instead.
12
- * For ranked lists (leaderboards), use `<RankedCard>`.
13
12
  *
14
13
  * @example
15
14
  * ```svelte
@@ -31,13 +30,32 @@ import type { ProgressSegment } from '../../elements/progress/progress-types.js'
31
30
  * ```
32
31
  */
33
32
  export type CardProps = {
34
- /** Background tint. @default 'default' */
33
+ /** Color tint. Affects title text and (subtly) body background. @default 'default' */
35
34
  color?: VariantColors;
36
- /** Heading shown at the top. */
37
- title?: string;
35
+ /** Size variant scales padding, radius, shadow, and typography together. @default 'md' */
36
+ size?: VariantSizes;
37
+ /**
38
+ * Header treatment. `'tinted'` (default) renders a subtle bg + separator above
39
+ * the body — the dashboard-panel look. `'plain'` matches pre-v3.1 Card with
40
+ * title flowing into body, no separator or tint. Use 'plain' for inline
41
+ * grouping cards (alerts, callouts) where the header chrome would be heavy.
42
+ * @default 'tinted'
43
+ */
44
+ headerStyle?: 'tinted' | 'plain';
45
+ /** Heading shown at the top. Accepts a string or a Snippet for icons/badges in the title. */
46
+ title?: string | Snippet;
47
+ /** Smaller muted line directly below the title. */
48
+ subtitle?: string | Snippet;
49
+ /**
50
+ * Right-aligned content in the header (e.g. KPI summary, action buttons,
51
+ * status pill). Only renders when a header exists.
52
+ */
53
+ headerEnd?: Snippet;
38
54
  class?: ClassValue;
39
55
  /** Classes for the title element only. */
40
56
  titleClass?: ClassValue;
57
+ /** Classes for the subtitle element only. */
58
+ subtitleClass?: ClassValue;
41
59
  /** Classes for the body container only. */
42
60
  bodyClass?: ClassValue;
43
61
  /** Default body content. */
@@ -36,9 +36,53 @@ export declare const card: import("tailwind-variants").TVReturnType<{
36
36
  body: string;
37
37
  };
38
38
  };
39
+ size: {
40
+ xs: {
41
+ title: string;
42
+ subtitle: string;
43
+ body: string;
44
+ };
45
+ sm: {
46
+ title: string;
47
+ subtitle: string;
48
+ body: string;
49
+ };
50
+ md: {
51
+ title: string;
52
+ subtitle: string;
53
+ body: string;
54
+ };
55
+ lg: {
56
+ title: string;
57
+ subtitle: string;
58
+ body: string;
59
+ };
60
+ xl: {
61
+ title: string;
62
+ subtitle: string;
63
+ body: string;
64
+ };
65
+ "2xl": {
66
+ title: string;
67
+ subtitle: string;
68
+ body: string;
69
+ };
70
+ };
71
+ headerStyle: {
72
+ tinted: {
73
+ header: string;
74
+ };
75
+ plain: {
76
+ header: string;
77
+ };
78
+ };
39
79
  }, {
40
80
  base: string;
81
+ header: string;
82
+ headerLeft: string;
83
+ headerEnd: string;
41
84
  title: string;
85
+ subtitle: string;
42
86
  body: string;
43
87
  }, undefined, {
44
88
  color: {
@@ -78,9 +122,53 @@ export declare const card: import("tailwind-variants").TVReturnType<{
78
122
  body: string;
79
123
  };
80
124
  };
125
+ size: {
126
+ xs: {
127
+ title: string;
128
+ subtitle: string;
129
+ body: string;
130
+ };
131
+ sm: {
132
+ title: string;
133
+ subtitle: string;
134
+ body: string;
135
+ };
136
+ md: {
137
+ title: string;
138
+ subtitle: string;
139
+ body: string;
140
+ };
141
+ lg: {
142
+ title: string;
143
+ subtitle: string;
144
+ body: string;
145
+ };
146
+ xl: {
147
+ title: string;
148
+ subtitle: string;
149
+ body: string;
150
+ };
151
+ "2xl": {
152
+ title: string;
153
+ subtitle: string;
154
+ body: string;
155
+ };
156
+ };
157
+ headerStyle: {
158
+ tinted: {
159
+ header: string;
160
+ };
161
+ plain: {
162
+ header: string;
163
+ };
164
+ };
81
165
  }, {
82
166
  base: string;
167
+ header: string;
168
+ headerLeft: string;
169
+ headerEnd: string;
83
170
  title: string;
171
+ subtitle: string;
84
172
  body: string;
85
173
  }, import("tailwind-variants").TVReturnType<{
86
174
  color: {
@@ -120,8 +208,52 @@ export declare const card: import("tailwind-variants").TVReturnType<{
120
208
  body: string;
121
209
  };
122
210
  };
211
+ size: {
212
+ xs: {
213
+ title: string;
214
+ subtitle: string;
215
+ body: string;
216
+ };
217
+ sm: {
218
+ title: string;
219
+ subtitle: string;
220
+ body: string;
221
+ };
222
+ md: {
223
+ title: string;
224
+ subtitle: string;
225
+ body: string;
226
+ };
227
+ lg: {
228
+ title: string;
229
+ subtitle: string;
230
+ body: string;
231
+ };
232
+ xl: {
233
+ title: string;
234
+ subtitle: string;
235
+ body: string;
236
+ };
237
+ "2xl": {
238
+ title: string;
239
+ subtitle: string;
240
+ body: string;
241
+ };
242
+ };
243
+ headerStyle: {
244
+ tinted: {
245
+ header: string;
246
+ };
247
+ plain: {
248
+ header: string;
249
+ };
250
+ };
123
251
  }, {
124
252
  base: string;
253
+ header: string;
254
+ headerLeft: string;
255
+ headerEnd: string;
125
256
  title: string;
257
+ subtitle: string;
126
258
  body: string;
127
259
  }, undefined, unknown, unknown, undefined>>;