@makolabs/ripple 0.4.1-0 → 0.5.0
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/README.md +165 -205
- package/dist/adapters/ai/OpenAIAdapter.d.ts +115 -0
- package/dist/adapters/ai/OpenAIAdapter.js +568 -0
- package/dist/adapters/ai/index.d.ts +3 -0
- package/dist/adapters/ai/index.js +3 -0
- package/dist/adapters/ai/types.d.ts +108 -0
- package/dist/adapters/ai/types.js +31 -0
- package/dist/adapters/storage/BaseAdapter.js +31 -31
- package/dist/ai/AIChatInterface.svelte +435 -0
- package/dist/ai/AIChatInterface.svelte.d.ts +18 -0
- package/dist/ai/ChatInput.svelte +211 -0
- package/dist/ai/ChatInput.svelte.d.ts +18 -0
- package/dist/ai/CodeRenderer.svelte +174 -0
- package/dist/ai/CodeRenderer.svelte.d.ts +8 -0
- package/dist/ai/ComposeDropdown.svelte +171 -0
- package/dist/ai/ComposeDropdown.svelte.d.ts +9 -0
- package/dist/ai/MermaidRenderer.svelte +89 -0
- package/dist/ai/MermaidRenderer.svelte.d.ts +7 -0
- package/dist/ai/MessageBox.svelte +403 -0
- package/dist/ai/MessageBox.svelte.d.ts +12 -0
- package/dist/ai/ThinkingDisplay.svelte +275 -0
- package/dist/ai/ThinkingDisplay.svelte.d.ts +9 -0
- package/dist/ai/ai-chat-interface.d.ts +161 -0
- package/dist/ai/ai-chat-interface.js +63 -0
- package/dist/ai/content-detector.d.ts +41 -0
- package/dist/ai/content-detector.js +153 -0
- package/dist/config/ai.d.ts +13 -0
- package/dist/config/ai.js +43 -0
- package/dist/elements/accordion/accordion.js +1 -1
- package/dist/elements/badge/Badge.svelte +14 -3
- package/dist/elements/dropdown/Dropdown.svelte +2 -2
- package/dist/elements/dropdown/Select.svelte +1 -1
- package/dist/elements/progress/Progress.svelte +7 -10
- package/dist/file-browser/FileBrowser.svelte +1 -1
- package/dist/forms/DateRange.svelte +18 -16
- package/dist/forms/NumberInput.svelte +1 -1
- package/dist/forms/RadioInputs.svelte +1 -1
- package/dist/forms/RadioPill.svelte +1 -1
- package/dist/forms/Tags.svelte +2 -2
- package/dist/helper/date.d.ts +1 -0
- package/dist/helper/date.js +6 -0
- package/dist/index.d.ts +65 -1
- package/dist/index.js +11 -0
- package/dist/layout/activity-list/ActivityList.svelte +94 -0
- package/dist/layout/activity-list/ActivityList.svelte.d.ts +4 -0
- package/dist/layout/activity-list/activity-list.d.ts +152 -0
- package/dist/layout/activity-list/activity-list.js +59 -0
- package/dist/layout/card/Card.svelte +1 -5
- package/dist/layout/card/metric-card.d.ts +18 -18
- package/dist/layout/table/Cells.svelte +1 -7
- package/dist/layout/table/Cells.svelte.d.ts +1 -1
- package/dist/modal/Modal.svelte +4 -2
- package/dist/modal/Modal.svelte.d.ts +1 -1
- package/dist/modal/modal.d.ts +19 -18
- package/dist/modal/modal.js +7 -6
- package/dist/sonner/sonner.svelte +1 -7
- package/dist/types/markdown.d.ts +14 -0
- package/dist/utils/Portal.svelte +1 -1
- package/package.json +128 -121
|
@@ -245,9 +245,9 @@
|
|
|
245
245
|
{id}
|
|
246
246
|
type="button"
|
|
247
247
|
class={cn(
|
|
248
|
-
'flex w-full items-center justify-between rounded-md border
|
|
248
|
+
'border-default-300 flex w-full items-center justify-between rounded-md border bg-white px-3 py-2 text-sm shadow-sm',
|
|
249
249
|
disabled
|
|
250
|
-
? '
|
|
250
|
+
? 'bg-default-100 text-default-400 cursor-not-allowed'
|
|
251
251
|
: 'focus:border-primary-500 focus:ring-primary-500 hover:border-default-400 focus:ring-2'
|
|
252
252
|
)}
|
|
253
253
|
onclick={toggleDatepicker}
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
? `${formatDate(startDate)} - Select end date`
|
|
263
263
|
: placeholder}
|
|
264
264
|
</span>
|
|
265
|
-
<svg class="h-5 w-5
|
|
265
|
+
<svg class="text-default-400 h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
266
266
|
<path
|
|
267
267
|
fill-rule="evenodd"
|
|
268
268
|
d="M6 2a1 1 0 00-1 1v1H4a2 2 0 00-2 2v10a2 2 0 002 2h12a2 2 0 002-2V6a2 2 0 00-2-2h-1V3a1 1 0 10-2 0v1H7V3a1 1 0 00-1-1zm0 5a1 1 0 000 2h8a1 1 0 100-2H6z"
|
|
@@ -274,7 +274,7 @@
|
|
|
274
274
|
{#if startDate || endDate}
|
|
275
275
|
<button
|
|
276
276
|
type="button"
|
|
277
|
-
class="absolute top-1/2 right-10 -translate-y-1/2
|
|
277
|
+
class="text-default-400 hover:text-default-500 absolute top-1/2 right-10 -translate-y-1/2"
|
|
278
278
|
onclick={clearDates}
|
|
279
279
|
aria-label="Clear dates"
|
|
280
280
|
>
|
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
<button
|
|
299
299
|
type="button"
|
|
300
300
|
aria-label="Previous month"
|
|
301
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
301
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
302
302
|
onclick={prevMonth}
|
|
303
303
|
>
|
|
304
304
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -311,7 +311,7 @@
|
|
|
311
311
|
</button>
|
|
312
312
|
<button
|
|
313
313
|
type="button"
|
|
314
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium
|
|
314
|
+
class="text-default-700 hover:bg-default-100 inline-flex items-center rounded-md px-2 py-1 text-sm font-medium"
|
|
315
315
|
onclick={showMonths}
|
|
316
316
|
>
|
|
317
317
|
{getMonthName(viewDate.getMonth())}
|
|
@@ -320,7 +320,7 @@
|
|
|
320
320
|
<button
|
|
321
321
|
type="button"
|
|
322
322
|
aria-label="Next month"
|
|
323
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
323
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
324
324
|
onclick={nextMonth}
|
|
325
325
|
>
|
|
326
326
|
<svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
|
|
@@ -335,7 +335,7 @@
|
|
|
335
335
|
<button
|
|
336
336
|
type="button"
|
|
337
337
|
aria-label="Previous year"
|
|
338
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
338
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
339
339
|
onclick={() =>
|
|
340
340
|
(viewDate = new Date(viewDate.getFullYear() - 1, viewDate.getMonth(), 1))}
|
|
341
341
|
>
|
|
@@ -350,7 +350,7 @@
|
|
|
350
350
|
<button
|
|
351
351
|
type="button"
|
|
352
352
|
aria-label="Current year"
|
|
353
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium
|
|
353
|
+
class="text-default-700 inline-flex items-center rounded-md px-2 py-1 text-sm font-medium"
|
|
354
354
|
onclick={showYears}
|
|
355
355
|
>
|
|
356
356
|
{viewDate.getFullYear()}
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
<button
|
|
359
359
|
type="button"
|
|
360
360
|
aria-label="Next year"
|
|
361
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
361
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
362
362
|
onclick={() =>
|
|
363
363
|
(viewDate = new Date(viewDate.getFullYear() + 1, viewDate.getMonth(), 1))}
|
|
364
364
|
>
|
|
@@ -374,7 +374,7 @@
|
|
|
374
374
|
<button
|
|
375
375
|
type="button"
|
|
376
376
|
aria-label="Previous year"
|
|
377
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
377
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
378
378
|
onclick={() =>
|
|
379
379
|
(viewDate = new Date(viewDate.getFullYear() - 12, viewDate.getMonth(), 1))}
|
|
380
380
|
>
|
|
@@ -389,14 +389,14 @@
|
|
|
389
389
|
<button
|
|
390
390
|
type="button"
|
|
391
391
|
aria-label="Current year range"
|
|
392
|
-
class="inline-flex items-center rounded-md px-2 py-1 text-sm font-medium
|
|
392
|
+
class="text-default-700 inline-flex items-center rounded-md px-2 py-1 text-sm font-medium"
|
|
393
393
|
>
|
|
394
394
|
{viewDate.getFullYear() - 6} - {viewDate.getFullYear() + 5}
|
|
395
395
|
</button>
|
|
396
396
|
<button
|
|
397
397
|
type="button"
|
|
398
398
|
aria-label="Next year"
|
|
399
|
-
class="inline-flex items-center rounded-md p-1 text-sm
|
|
399
|
+
class="text-default-500 hover:bg-default-100 inline-flex items-center rounded-md p-1 text-sm"
|
|
400
400
|
onclick={() =>
|
|
401
401
|
(viewDate = new Date(viewDate.getFullYear() + 12, viewDate.getMonth(), 1))}
|
|
402
402
|
>
|
|
@@ -412,7 +412,7 @@
|
|
|
412
412
|
</div>
|
|
413
413
|
|
|
414
414
|
{#if viewMode === 'days'}
|
|
415
|
-
<div class="mb-1 grid grid-cols-7 gap-1 text-center text-xs font-medium
|
|
415
|
+
<div class="text-default-500 mb-1 grid grid-cols-7 gap-1 text-center text-xs font-medium">
|
|
416
416
|
<div>Su</div>
|
|
417
417
|
<div>Mo</div>
|
|
418
418
|
<div>Tu</div>
|
|
@@ -427,7 +427,7 @@
|
|
|
427
427
|
type="button"
|
|
428
428
|
class={cn(
|
|
429
429
|
'flex h-8 w-8 items-center justify-center rounded-full text-sm font-medium',
|
|
430
|
-
isDisabled ? 'cursor-not-allowed
|
|
430
|
+
isDisabled ? 'text-default-300 cursor-not-allowed' : 'hover:bg-default-100',
|
|
431
431
|
isSelected ? 'bg-primary-500 hover:bg-primary-600 text-white' : '',
|
|
432
432
|
isInRange && !isSelected ? 'bg-primary-100 text-primary-800' : '',
|
|
433
433
|
!isCurrentMonth && !isSelected && !isInRange ? 'text-default-400' : '',
|
|
@@ -479,7 +479,9 @@
|
|
|
479
479
|
{/if}
|
|
480
480
|
|
|
481
481
|
{#if startDate || endDate}
|
|
482
|
-
<div
|
|
482
|
+
<div
|
|
483
|
+
class="border-default-200 text-default-500 mt-4 flex justify-between border-t pt-3 text-xs"
|
|
484
|
+
>
|
|
483
485
|
<div>
|
|
484
486
|
{startDate ? `${startLabel}: ${formatDate(startDate)}` : ''}
|
|
485
487
|
</div>
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
|
|
80
80
|
<div class="space-y-1">
|
|
81
81
|
{#if label}
|
|
82
|
-
<label for={name} class="block text-sm font-medium
|
|
82
|
+
<label for={name} class="text-default-700 block text-sm font-medium">{label}</label>
|
|
83
83
|
{/if}
|
|
84
84
|
<div class={containerClass} bind:this={containerRef}>
|
|
85
85
|
<svg
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
{required}
|
|
49
49
|
aria-describedby={errors.length ? `${name}-errors` : undefined}
|
|
50
50
|
/>
|
|
51
|
-
<label for={`${name}-${option.value}`} class="text-
|
|
51
|
+
<label for={`${name}-${option.value}`} class="text-default-700 text-sm">
|
|
52
52
|
{option.label}
|
|
53
53
|
</label>
|
|
54
54
|
</div>
|
package/dist/forms/Tags.svelte
CHANGED
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
|
|
131
131
|
<div class="space-y-1">
|
|
132
132
|
{#if label}
|
|
133
|
-
<label for={name} class="block text-sm font-medium
|
|
133
|
+
<label for={name} class="text-default-700 block text-sm font-medium">{label}</label>
|
|
134
134
|
{/if}
|
|
135
135
|
<div class={containerClass} onfocusout={handleFocusOut}>
|
|
136
136
|
{#each value as tag}
|
|
@@ -144,7 +144,7 @@
|
|
|
144
144
|
{name}
|
|
145
145
|
id={name}
|
|
146
146
|
{placeholder}
|
|
147
|
-
class={cn('min-w-[120px] flex-1 bg-transparent outline-none
|
|
147
|
+
class={cn('placeholder:text-default-400 min-w-[120px] flex-1 bg-transparent outline-none', {
|
|
148
148
|
'text-sm': size === Size.SM,
|
|
149
149
|
'text-base': size === Size.BASE,
|
|
150
150
|
'text-lg': size === Size.LG
|
package/dist/helper/date.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare const DATE_FORMAT: {
|
|
|
5
5
|
};
|
|
6
6
|
export declare function formatDateTime(time: Date | string, format?: string): string;
|
|
7
7
|
export declare function getRelativeTime(time: Date | string): string;
|
|
8
|
+
export declare function formatTime(time: string | number | Date): string;
|
package/dist/helper/date.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -57,6 +57,7 @@ export type MakeModalProps = {
|
|
|
57
57
|
closeOnBackdropClick?: boolean;
|
|
58
58
|
closeOnEsc?: boolean;
|
|
59
59
|
position?: 'top' | 'center' | 'bottom';
|
|
60
|
+
size?: VariantSizes;
|
|
60
61
|
class?: string;
|
|
61
62
|
backdropclass?: string;
|
|
62
63
|
contentclass?: string;
|
|
@@ -384,6 +385,7 @@ export { default as Navbar } from './layout/navbar/Navbar.svelte';
|
|
|
384
385
|
export { default as Sidebar } from './layout/sidebar/Sidebar.svelte';
|
|
385
386
|
export { default as NavItem } from './layout/sidebar/NavItem.svelte';
|
|
386
387
|
export { default as NavGroup } from './layout/sidebar/NavGroup.svelte';
|
|
388
|
+
export { default as ActivityList } from './layout/activity-list/ActivityList.svelte';
|
|
387
389
|
export { dropdownMenu } from './elements/dropdown/dropdown.js';
|
|
388
390
|
export { badge } from './elements/badge/badge.js';
|
|
389
391
|
export { buttonVariants } from './button/button.js';
|
|
@@ -392,6 +394,7 @@ export { drawer } from './drawer/drawer.js';
|
|
|
392
394
|
export { selectTV } from './elements/dropdown/select.js';
|
|
393
395
|
export { breadcrumbs } from './header/breadcrumbs.js';
|
|
394
396
|
export { metricCard } from './layout/card/metric-card.js';
|
|
397
|
+
export { activityList } from './layout/activity-list/activity-list.js';
|
|
395
398
|
export type ChartColorKey = keyof typeof ChartColor;
|
|
396
399
|
export type ChartColorValue = (typeof ChartColor)[ChartColorKey];
|
|
397
400
|
export type ChartColors = {
|
|
@@ -593,6 +596,10 @@ export interface UploadedFile {
|
|
|
593
596
|
export { default as FileUpload } from './elements/file-upload/FileUpload.svelte';
|
|
594
597
|
export { default as FilesPreview } from './elements/file-upload/FilesPreview.svelte';
|
|
595
598
|
export { default as Toaster } from './sonner/sonner.svelte';
|
|
599
|
+
export { default as AIChatInterface } from './ai/AIChatInterface.svelte';
|
|
600
|
+
export { default as MermaidRenderer } from './ai/MermaidRenderer.svelte';
|
|
601
|
+
export { default as CodeRenderer } from './ai/CodeRenderer.svelte';
|
|
602
|
+
export * from './ai/content-detector.js';
|
|
596
603
|
export interface FormProps<T extends Record<string, unknown>> {
|
|
597
604
|
form: SuperForm<any>;
|
|
598
605
|
class?: string;
|
|
@@ -613,7 +620,6 @@ export type InputProps = {
|
|
|
613
620
|
disabled?: boolean;
|
|
614
621
|
class?: string;
|
|
615
622
|
size?: VariantSizes;
|
|
616
|
-
color?: VariantColors;
|
|
617
623
|
id?: string;
|
|
618
624
|
errors?: string[];
|
|
619
625
|
} & DOMAttributes<HTMLInputElement>;
|
|
@@ -827,9 +833,67 @@ export type CompactFiltersProps = {
|
|
|
827
833
|
expandedClass?: ClassValue;
|
|
828
834
|
FilterIcon?: Component;
|
|
829
835
|
};
|
|
836
|
+
export type ActivityItemBadge = {
|
|
837
|
+
text: string;
|
|
838
|
+
class: string;
|
|
839
|
+
};
|
|
840
|
+
export type ActivityItemAction = {
|
|
841
|
+
label: string;
|
|
842
|
+
onClick?: () => void;
|
|
843
|
+
};
|
|
844
|
+
export type ActivityItem = {
|
|
845
|
+
title: string;
|
|
846
|
+
subtitle?: string;
|
|
847
|
+
badges?: ActivityItemBadge[];
|
|
848
|
+
actions?: ActivityItemAction[];
|
|
849
|
+
};
|
|
850
|
+
export type ActivityListProps = {
|
|
851
|
+
title?: string;
|
|
852
|
+
items?: ActivityItem[];
|
|
853
|
+
color?: VariantColors;
|
|
854
|
+
class?: ClassValue;
|
|
855
|
+
headerClass?: ClassValue;
|
|
856
|
+
titleClass?: ClassValue;
|
|
857
|
+
contentClass?: ClassValue;
|
|
858
|
+
itemClass?: ClassValue;
|
|
859
|
+
onItemClick?: (item: ActivityItem, index: number) => void;
|
|
860
|
+
children?: Snippet;
|
|
861
|
+
};
|
|
830
862
|
export { CompactFilters } from './filters/index.js';
|
|
831
863
|
export * from './file-browser/index.js';
|
|
832
864
|
export * from './adapters/storage/index.js';
|
|
865
|
+
export * from './adapters/ai/index.js';
|
|
866
|
+
export type ChatMessageType = 'chat' | 'action' | 'thinking';
|
|
867
|
+
export type StreamingCallback = (response: ChatResponse) => void;
|
|
868
|
+
export interface ChatAction {
|
|
869
|
+
type: string;
|
|
870
|
+
data: any;
|
|
871
|
+
metadata?: Record<string, any>;
|
|
872
|
+
}
|
|
873
|
+
export interface ChatMessage {
|
|
874
|
+
id: string;
|
|
875
|
+
type: ChatMessageType;
|
|
876
|
+
content: string;
|
|
877
|
+
timestamp: Date;
|
|
878
|
+
action?: ChatAction;
|
|
879
|
+
thinkingContent?: string;
|
|
880
|
+
isThinkingComplete?: boolean;
|
|
881
|
+
}
|
|
882
|
+
export interface ChatResponse {
|
|
883
|
+
type: ChatMessageType;
|
|
884
|
+
content: string;
|
|
885
|
+
action?: ChatAction;
|
|
886
|
+
messageId?: string;
|
|
887
|
+
isStreaming?: boolean;
|
|
888
|
+
isStreamEnd?: boolean;
|
|
889
|
+
thinkingContent?: string;
|
|
890
|
+
isThinkingComplete?: boolean;
|
|
891
|
+
}
|
|
892
|
+
export interface QuickAction {
|
|
893
|
+
label: string;
|
|
894
|
+
prompt: string;
|
|
895
|
+
icon?: Component;
|
|
896
|
+
}
|
|
833
897
|
export interface FileBrowserProps {
|
|
834
898
|
adapter: StorageAdapter;
|
|
835
899
|
startPath?: string;
|
package/dist/index.js
CHANGED
|
@@ -42,6 +42,8 @@ export { default as Navbar } from './layout/navbar/Navbar.svelte';
|
|
|
42
42
|
export { default as Sidebar } from './layout/sidebar/Sidebar.svelte';
|
|
43
43
|
export { default as NavItem } from './layout/sidebar/NavItem.svelte';
|
|
44
44
|
export { default as NavGroup } from './layout/sidebar/NavGroup.svelte';
|
|
45
|
+
// Elements - ActivityList
|
|
46
|
+
export { default as ActivityList } from './layout/activity-list/ActivityList.svelte';
|
|
45
47
|
// Component Variant Utilities
|
|
46
48
|
export { dropdownMenu } from './elements/dropdown/dropdown.js';
|
|
47
49
|
export { badge } from './elements/badge/badge.js';
|
|
@@ -51,11 +53,18 @@ export { drawer } from './drawer/drawer.js';
|
|
|
51
53
|
export { selectTV } from './elements/dropdown/select.js';
|
|
52
54
|
export { breadcrumbs } from './header/breadcrumbs.js';
|
|
53
55
|
export { metricCard } from './layout/card/metric-card.js';
|
|
56
|
+
export { activityList } from './layout/activity-list/activity-list.js';
|
|
54
57
|
export { default as Chart } from './charts/Chart.svelte';
|
|
55
58
|
export { default as FileUpload } from './elements/file-upload/FileUpload.svelte';
|
|
56
59
|
export { default as FilesPreview } from './elements/file-upload/FilesPreview.svelte';
|
|
57
60
|
// Toaster: Should be registered in +layout.svelte
|
|
58
61
|
export { default as Toaster } from './sonner/sonner.svelte';
|
|
62
|
+
// AI Components
|
|
63
|
+
export { default as AIChatInterface } from './ai/AIChatInterface.svelte';
|
|
64
|
+
export { default as MermaidRenderer } from './ai/MermaidRenderer.svelte';
|
|
65
|
+
export { default as CodeRenderer } from './ai/CodeRenderer.svelte';
|
|
66
|
+
// AI Content Detection Utilities
|
|
67
|
+
export * from './ai/content-detector.js';
|
|
59
68
|
// Form Component Exports
|
|
60
69
|
export { default as Form } from './forms/Form.svelte';
|
|
61
70
|
export { default as Input } from './forms/Input.svelte';
|
|
@@ -75,3 +84,5 @@ export { CompactFilters } from './filters/index.js';
|
|
|
75
84
|
// File Browser and Storage Adapters
|
|
76
85
|
export * from './file-browser/index.js';
|
|
77
86
|
export * from './adapters/storage/index.js';
|
|
87
|
+
// AI Adapters
|
|
88
|
+
export * from './adapters/ai/index.js';
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { cn } from '../../helper/cls.js';
|
|
3
|
+
import { activityList } from './activity-list.js';
|
|
4
|
+
import type { ActivityListProps } from '../../index.js';
|
|
5
|
+
import { Color } from '../../variants.js';
|
|
6
|
+
|
|
7
|
+
let {
|
|
8
|
+
title,
|
|
9
|
+
items = [],
|
|
10
|
+
color = Color.DEFAULT,
|
|
11
|
+
class: className = '',
|
|
12
|
+
headerClass = '',
|
|
13
|
+
titleClass = '',
|
|
14
|
+
contentClass = '',
|
|
15
|
+
itemClass = '',
|
|
16
|
+
onItemClick,
|
|
17
|
+
children
|
|
18
|
+
}: ActivityListProps = $props();
|
|
19
|
+
|
|
20
|
+
const {
|
|
21
|
+
base,
|
|
22
|
+
header,
|
|
23
|
+
title: titleSlot,
|
|
24
|
+
content,
|
|
25
|
+
item,
|
|
26
|
+
itemContent,
|
|
27
|
+
itemMain,
|
|
28
|
+
itemHeader,
|
|
29
|
+
itemTitle,
|
|
30
|
+
itemSubtitle,
|
|
31
|
+
itemActions
|
|
32
|
+
} = $derived(activityList({ color }));
|
|
33
|
+
|
|
34
|
+
const baseClass = $derived(cn(base(), className));
|
|
35
|
+
const headerClasses = $derived(cn(header(), headerClass));
|
|
36
|
+
const titleClasses = $derived(cn(titleSlot(), titleClass));
|
|
37
|
+
const contentClasses = $derived(cn(content(), contentClass));
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
<div class={baseClass}>
|
|
41
|
+
{#if title}
|
|
42
|
+
<div class={headerClasses}>
|
|
43
|
+
<h2 class={titleClasses}>{title}</h2>
|
|
44
|
+
</div>
|
|
45
|
+
{/if}
|
|
46
|
+
|
|
47
|
+
<div class={contentClasses}>
|
|
48
|
+
{#if children}
|
|
49
|
+
{@render children()}
|
|
50
|
+
{:else}
|
|
51
|
+
{#each items as activityItem, index}
|
|
52
|
+
<div class={cn(item(), itemClass)} role="button" tabindex="0">
|
|
53
|
+
<div class={itemContent()}>
|
|
54
|
+
<div class={itemMain()}>
|
|
55
|
+
<div class={itemHeader()}>
|
|
56
|
+
<button
|
|
57
|
+
class={itemTitle()}
|
|
58
|
+
onclick={() => onItemClick?.(activityItem, index)}
|
|
59
|
+
>
|
|
60
|
+
{activityItem.title}
|
|
61
|
+
</button>
|
|
62
|
+
{#if activityItem.badges}
|
|
63
|
+
{#each activityItem.badges as badge}
|
|
64
|
+
<span class="ml-3 inline-flex rounded-full px-2 py-1 text-xs font-medium {badge.class}">
|
|
65
|
+
{badge.text}
|
|
66
|
+
</span>
|
|
67
|
+
{/each}
|
|
68
|
+
{/if}
|
|
69
|
+
</div>
|
|
70
|
+
{#if activityItem.subtitle}
|
|
71
|
+
<div class={itemSubtitle()}>
|
|
72
|
+
{activityItem.subtitle}
|
|
73
|
+
</div>
|
|
74
|
+
{/if}
|
|
75
|
+
</div>
|
|
76
|
+
{#if activityItem.actions}
|
|
77
|
+
<div class={itemActions()}>
|
|
78
|
+
{#each activityItem.actions as action}
|
|
79
|
+
<button
|
|
80
|
+
class="inline-flex items-center rounded-md border border-gray-300 bg-white px-3 py-1.5 text-xs font-medium text-gray-700 shadow-sm hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2"
|
|
81
|
+
onclick={() => action.onClick?.()}
|
|
82
|
+
>
|
|
83
|
+
{action.label}
|
|
84
|
+
</button>
|
|
85
|
+
{/each}
|
|
86
|
+
</div>
|
|
87
|
+
{/if}
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
{/each}
|
|
91
|
+
{/if}
|
|
92
|
+
</div>
|
|
93
|
+
</div>
|
|
94
|
+
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { Color } from '../../variants.js';
|
|
2
|
+
export declare const activityList: import("tailwind-variants").TVReturnType<{
|
|
3
|
+
color: {
|
|
4
|
+
[Color.DEFAULT]: {
|
|
5
|
+
base: string;
|
|
6
|
+
header: string;
|
|
7
|
+
title: string;
|
|
8
|
+
};
|
|
9
|
+
[Color.PRIMARY]: {
|
|
10
|
+
base: string;
|
|
11
|
+
header: string;
|
|
12
|
+
title: string;
|
|
13
|
+
};
|
|
14
|
+
[Color.SECONDARY]: {
|
|
15
|
+
base: string;
|
|
16
|
+
header: string;
|
|
17
|
+
title: string;
|
|
18
|
+
};
|
|
19
|
+
[Color.INFO]: {
|
|
20
|
+
base: string;
|
|
21
|
+
header: string;
|
|
22
|
+
title: string;
|
|
23
|
+
};
|
|
24
|
+
[Color.SUCCESS]: {
|
|
25
|
+
base: string;
|
|
26
|
+
header: string;
|
|
27
|
+
title: string;
|
|
28
|
+
};
|
|
29
|
+
[Color.WARNING]: {
|
|
30
|
+
base: string;
|
|
31
|
+
header: string;
|
|
32
|
+
title: string;
|
|
33
|
+
};
|
|
34
|
+
[Color.DANGER]: {
|
|
35
|
+
base: string;
|
|
36
|
+
header: string;
|
|
37
|
+
title: string;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}, {
|
|
41
|
+
base: string;
|
|
42
|
+
header: string;
|
|
43
|
+
title: string;
|
|
44
|
+
content: string;
|
|
45
|
+
item: string;
|
|
46
|
+
itemContent: string;
|
|
47
|
+
itemMain: string;
|
|
48
|
+
itemHeader: string;
|
|
49
|
+
itemTitle: string;
|
|
50
|
+
itemSubtitle: string;
|
|
51
|
+
itemActions: string;
|
|
52
|
+
}, undefined, {
|
|
53
|
+
color: {
|
|
54
|
+
[Color.DEFAULT]: {
|
|
55
|
+
base: string;
|
|
56
|
+
header: string;
|
|
57
|
+
title: string;
|
|
58
|
+
};
|
|
59
|
+
[Color.PRIMARY]: {
|
|
60
|
+
base: string;
|
|
61
|
+
header: string;
|
|
62
|
+
title: string;
|
|
63
|
+
};
|
|
64
|
+
[Color.SECONDARY]: {
|
|
65
|
+
base: string;
|
|
66
|
+
header: string;
|
|
67
|
+
title: string;
|
|
68
|
+
};
|
|
69
|
+
[Color.INFO]: {
|
|
70
|
+
base: string;
|
|
71
|
+
header: string;
|
|
72
|
+
title: string;
|
|
73
|
+
};
|
|
74
|
+
[Color.SUCCESS]: {
|
|
75
|
+
base: string;
|
|
76
|
+
header: string;
|
|
77
|
+
title: string;
|
|
78
|
+
};
|
|
79
|
+
[Color.WARNING]: {
|
|
80
|
+
base: string;
|
|
81
|
+
header: string;
|
|
82
|
+
title: string;
|
|
83
|
+
};
|
|
84
|
+
[Color.DANGER]: {
|
|
85
|
+
base: string;
|
|
86
|
+
header: string;
|
|
87
|
+
title: string;
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}, {
|
|
91
|
+
base: string;
|
|
92
|
+
header: string;
|
|
93
|
+
title: string;
|
|
94
|
+
content: string;
|
|
95
|
+
item: string;
|
|
96
|
+
itemContent: string;
|
|
97
|
+
itemMain: string;
|
|
98
|
+
itemHeader: string;
|
|
99
|
+
itemTitle: string;
|
|
100
|
+
itemSubtitle: string;
|
|
101
|
+
itemActions: string;
|
|
102
|
+
}, import("tailwind-variants").TVReturnType<{
|
|
103
|
+
color: {
|
|
104
|
+
[Color.DEFAULT]: {
|
|
105
|
+
base: string;
|
|
106
|
+
header: string;
|
|
107
|
+
title: string;
|
|
108
|
+
};
|
|
109
|
+
[Color.PRIMARY]: {
|
|
110
|
+
base: string;
|
|
111
|
+
header: string;
|
|
112
|
+
title: string;
|
|
113
|
+
};
|
|
114
|
+
[Color.SECONDARY]: {
|
|
115
|
+
base: string;
|
|
116
|
+
header: string;
|
|
117
|
+
title: string;
|
|
118
|
+
};
|
|
119
|
+
[Color.INFO]: {
|
|
120
|
+
base: string;
|
|
121
|
+
header: string;
|
|
122
|
+
title: string;
|
|
123
|
+
};
|
|
124
|
+
[Color.SUCCESS]: {
|
|
125
|
+
base: string;
|
|
126
|
+
header: string;
|
|
127
|
+
title: string;
|
|
128
|
+
};
|
|
129
|
+
[Color.WARNING]: {
|
|
130
|
+
base: string;
|
|
131
|
+
header: string;
|
|
132
|
+
title: string;
|
|
133
|
+
};
|
|
134
|
+
[Color.DANGER]: {
|
|
135
|
+
base: string;
|
|
136
|
+
header: string;
|
|
137
|
+
title: string;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
}, {
|
|
141
|
+
base: string;
|
|
142
|
+
header: string;
|
|
143
|
+
title: string;
|
|
144
|
+
content: string;
|
|
145
|
+
item: string;
|
|
146
|
+
itemContent: string;
|
|
147
|
+
itemMain: string;
|
|
148
|
+
itemHeader: string;
|
|
149
|
+
itemTitle: string;
|
|
150
|
+
itemSubtitle: string;
|
|
151
|
+
itemActions: string;
|
|
152
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { tv } from 'tailwind-variants';
|
|
2
|
+
import { Color } from '../../variants.js';
|
|
3
|
+
export const activityList = tv({
|
|
4
|
+
slots: {
|
|
5
|
+
base: 'rounded-lg bg-white shadow-sm',
|
|
6
|
+
header: 'border-b border-gray-200 px-6 py-4',
|
|
7
|
+
title: 'text-lg font-medium text-gray-900',
|
|
8
|
+
content: 'divide-y divide-gray-200',
|
|
9
|
+
item: 'px-6 py-4 hover:bg-gray-50 transition-colors',
|
|
10
|
+
itemContent: 'flex items-center justify-between',
|
|
11
|
+
itemMain: 'flex-1',
|
|
12
|
+
itemHeader: 'flex items-center',
|
|
13
|
+
itemTitle: 'text-sm font-medium text-gray-900 hover:text-blue-600 focus:outline-none focus:text-blue-600 cursor-pointer',
|
|
14
|
+
itemSubtitle: 'mt-1 text-xs text-gray-500',
|
|
15
|
+
itemActions: 'flex items-center space-x-2'
|
|
16
|
+
},
|
|
17
|
+
variants: {
|
|
18
|
+
color: {
|
|
19
|
+
[Color.DEFAULT]: {
|
|
20
|
+
base: 'bg-white border-gray-200',
|
|
21
|
+
header: 'border-gray-200',
|
|
22
|
+
title: 'text-gray-900'
|
|
23
|
+
},
|
|
24
|
+
[Color.PRIMARY]: {
|
|
25
|
+
base: 'bg-primary-50 border-primary-200',
|
|
26
|
+
header: 'border-primary-200',
|
|
27
|
+
title: 'text-primary-900'
|
|
28
|
+
},
|
|
29
|
+
[Color.SECONDARY]: {
|
|
30
|
+
base: 'bg-secondary-50 border-secondary-200',
|
|
31
|
+
header: 'border-secondary-200',
|
|
32
|
+
title: 'text-secondary-900'
|
|
33
|
+
},
|
|
34
|
+
[Color.INFO]: {
|
|
35
|
+
base: 'bg-info-50 border-info-200',
|
|
36
|
+
header: 'border-info-200',
|
|
37
|
+
title: 'text-info-900'
|
|
38
|
+
},
|
|
39
|
+
[Color.SUCCESS]: {
|
|
40
|
+
base: 'bg-success-50 border-success-200',
|
|
41
|
+
header: 'border-success-200',
|
|
42
|
+
title: 'text-success-900'
|
|
43
|
+
},
|
|
44
|
+
[Color.WARNING]: {
|
|
45
|
+
base: 'bg-warning-50 border-warning-200',
|
|
46
|
+
header: 'border-warning-200',
|
|
47
|
+
title: 'text-warning-900'
|
|
48
|
+
},
|
|
49
|
+
[Color.DANGER]: {
|
|
50
|
+
base: 'bg-danger-50 border-danger-200',
|
|
51
|
+
header: 'border-danger-200',
|
|
52
|
+
title: 'text-danger-900'
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
defaultVariants: {
|
|
57
|
+
color: Color.DEFAULT
|
|
58
|
+
}
|
|
59
|
+
});
|
|
@@ -14,11 +14,7 @@
|
|
|
14
14
|
bodyclass: bodyClass = ''
|
|
15
15
|
}: CardProps = $props();
|
|
16
16
|
|
|
17
|
-
const {
|
|
18
|
-
base,
|
|
19
|
-
title: titleSlot,
|
|
20
|
-
body: bodySlot
|
|
21
|
-
} = $derived(card({ color }));
|
|
17
|
+
const { base, title: titleSlot, body: bodySlot } = $derived(card({ color }));
|
|
22
18
|
|
|
23
19
|
const baseClass = $derived(cn(base(), className));
|
|
24
20
|
const titleClasses = $derived(cn(titleSlot(), titleClass));
|