@svadmin/lite 0.17.0 → 0.22.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 +71 -2
- package/dist/components/LiteActivityFeed.svelte +24 -2
- package/dist/components/LiteActivityFeed.svelte.d.ts +6 -0
- package/dist/components/LiteAffix.svelte +29 -0
- package/dist/components/LiteAffix.svelte.d.ts +13 -0
- package/dist/components/LiteAnchor.svelte +38 -0
- package/dist/components/LiteAnchor.svelte.d.ts +14 -0
- package/dist/components/LiteApprovalActionCard.svelte +4 -1
- package/dist/components/LiteApprovalActionCard.svelte.d.ts +2 -0
- package/dist/components/LiteAutoComplete.svelte +41 -0
- package/dist/components/LiteAutoComplete.svelte.d.ts +13 -0
- package/dist/components/LiteBackTop.svelte +16 -0
- package/dist/components/LiteBackTop.svelte.d.ts +8 -0
- package/dist/components/LiteBreadcrumbs.svelte +4 -1
- package/dist/components/LiteBreadcrumbs.svelte.d.ts +2 -0
- package/dist/components/LiteCalendar.svelte +124 -0
- package/dist/components/LiteCalendar.svelte.d.ts +20 -0
- package/dist/components/LiteCarousel.svelte +72 -0
- package/dist/components/LiteCarousel.svelte.d.ts +14 -0
- package/dist/components/LiteCollapse.svelte +49 -0
- package/dist/components/LiteCollapse.svelte.d.ts +15 -0
- package/dist/components/LiteColumnHeaderFilter.svelte +4 -1
- package/dist/components/LiteColumnHeaderFilter.svelte.d.ts +2 -0
- package/dist/components/LiteColumnSettings.svelte +4 -1
- package/dist/components/LiteColumnSettings.svelte.d.ts +2 -0
- package/dist/components/LiteCommentThread.svelte +113 -0
- package/dist/components/LiteCommentThread.svelte.d.ts +26 -0
- package/dist/components/LiteCountdown.svelte +49 -0
- package/dist/components/LiteCountdown.svelte.d.ts +10 -0
- package/dist/components/LiteDetailDrawer.svelte +45 -0
- package/dist/components/LiteDetailDrawer.svelte.d.ts +14 -0
- package/dist/components/LiteDraggableRowTable.svelte +4 -1
- package/dist/components/LiteDraggableRowTable.svelte.d.ts +2 -0
- package/dist/components/LiteDrawerForm.svelte +4 -1
- package/dist/components/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/LiteEditableTable.svelte +4 -1
- package/dist/components/LiteEditableTable.svelte.d.ts +2 -0
- package/dist/components/LiteEmptyState.svelte +8 -1
- package/dist/components/LiteEmptyState.svelte.d.ts +3 -0
- package/dist/components/LiteFilterBuilder.svelte +4 -1
- package/dist/components/LiteFilterBuilder.svelte.d.ts +2 -0
- package/dist/components/LiteFloatButton.svelte +54 -0
- package/dist/components/LiteFloatButton.svelte.d.ts +15 -0
- package/dist/components/LiteGrid.svelte +34 -0
- package/dist/components/LiteGrid.svelte.d.ts +11 -0
- package/dist/components/LiteImage.svelte +54 -0
- package/dist/components/LiteImage.svelte.d.ts +14 -0
- package/dist/components/LiteImageCropper.svelte +4 -1
- package/dist/components/LiteImageCropper.svelte.d.ts +2 -0
- package/dist/components/LiteImagePreview.svelte +36 -0
- package/dist/components/LiteImagePreview.svelte.d.ts +13 -0
- package/dist/components/LiteItemList.svelte +50 -0
- package/dist/components/LiteItemList.svelte.d.ts +15 -0
- package/dist/components/LiteJsonSchemaForm.svelte +4 -1
- package/dist/components/LiteJsonSchemaForm.svelte.d.ts +2 -0
- package/dist/components/LiteLayout.svelte +16 -4
- package/dist/components/LiteLayout.svelte.d.ts +8 -0
- package/dist/components/LiteLink.svelte +32 -0
- package/dist/components/LiteLink.svelte.d.ts +11 -0
- package/dist/components/LiteLogin.svelte +9 -2
- package/dist/components/LiteLogin.svelte.d.ts +2 -0
- package/dist/components/LiteMasterDetailView.svelte +4 -1
- package/dist/components/LiteMasterDetailView.svelte.d.ts +2 -0
- package/dist/components/LiteMediaLibraryModal.svelte +4 -1
- package/dist/components/LiteMediaLibraryModal.svelte.d.ts +2 -0
- package/dist/components/LiteMenu.svelte +22 -0
- package/dist/components/LiteMenu.svelte.d.ts +12 -0
- package/dist/components/LiteMenuList.svelte +55 -0
- package/dist/components/LiteMenuList.svelte.d.ts +17 -0
- package/dist/components/LiteModalForm.svelte +4 -1
- package/dist/components/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/LiteNotificationCenter.svelte +85 -0
- package/dist/components/LiteNotificationCenter.svelte.d.ts +22 -0
- package/dist/components/LiteOtpInput.svelte +50 -0
- package/dist/components/LiteOtpInput.svelte.d.ts +15 -0
- package/dist/components/LitePageHeader.svelte +34 -0
- package/dist/components/LitePageHeader.svelte.d.ts +13 -0
- package/dist/components/LitePagination.svelte +10 -2
- package/dist/components/LitePagination.svelte.d.ts +2 -0
- package/dist/components/LitePopconfirm.svelte +49 -0
- package/dist/components/LitePopconfirm.svelte.d.ts +14 -0
- package/dist/components/LitePresenceAvatarGroup.svelte +4 -1
- package/dist/components/LitePresenceAvatarGroup.svelte.d.ts +2 -0
- package/dist/components/LitePrintableBill.svelte +4 -1
- package/dist/components/LitePrintableBill.svelte.d.ts +2 -0
- package/dist/components/LiteProgress.svelte +46 -0
- package/dist/components/LiteProgress.svelte.d.ts +12 -0
- package/dist/components/LiteQRCode.svelte +62 -0
- package/dist/components/LiteQRCode.svelte.d.ts +14 -0
- package/dist/components/LiteResizeBox.svelte +34 -0
- package/dist/components/LiteResizeBox.svelte.d.ts +12 -0
- package/dist/components/LiteResult.svelte +52 -0
- package/dist/components/LiteResult.svelte.d.ts +14 -0
- package/dist/components/LiteRowActions.svelte +36 -0
- package/dist/components/LiteRowActions.svelte.d.ts +17 -0
- package/dist/components/LiteSensitiveDataMask.svelte +4 -1
- package/dist/components/LiteSensitiveDataMask.svelte.d.ts +2 -0
- package/dist/components/LiteSkeleton.svelte +100 -0
- package/dist/components/LiteSkeleton.svelte.d.ts +19 -0
- package/dist/components/LiteSpace.svelte +31 -0
- package/dist/components/LiteSpace.svelte.d.ts +12 -0
- package/dist/components/LiteSpin.svelte +27 -0
- package/dist/components/LiteSpin.svelte.d.ts +10 -0
- package/dist/components/LiteSplitPaneLayout.svelte +16 -4
- package/dist/components/LiteSplitPaneLayout.svelte.d.ts +8 -0
- package/dist/components/LiteStatistic.svelte +63 -0
- package/dist/components/LiteStatistic.svelte.d.ts +15 -0
- package/dist/components/LiteStatsCard.svelte +5 -2
- package/dist/components/LiteStatsCard.svelte.d.ts +2 -0
- package/dist/components/LiteStatusBadge.svelte +33 -0
- package/dist/components/LiteStatusBadge.svelte.d.ts +12 -0
- package/dist/components/LiteStatusTabs.svelte +35 -0
- package/dist/components/LiteStatusTabs.svelte.d.ts +14 -0
- package/dist/components/LiteStepForm.svelte +4 -1
- package/dist/components/LiteStepForm.svelte.d.ts +2 -0
- package/dist/components/LiteSteps.svelte +64 -0
- package/dist/components/LiteSteps.svelte.d.ts +18 -0
- package/dist/components/LiteTable.svelte +4 -1
- package/dist/components/LiteTable.svelte.d.ts +2 -0
- package/dist/components/LiteTableSummary.svelte +4 -1
- package/dist/components/LiteTableSummary.svelte.d.ts +2 -0
- package/dist/components/LiteTabs.svelte +28 -18
- package/dist/components/LiteTabs.svelte.d.ts +11 -2
- package/dist/components/LiteTag.svelte +31 -0
- package/dist/components/LiteTag.svelte.d.ts +13 -0
- package/dist/components/LiteTimeline.svelte +48 -0
- package/dist/components/LiteTimeline.svelte.d.ts +17 -0
- package/dist/components/LiteTour.svelte +54 -0
- package/dist/components/LiteTour.svelte.d.ts +15 -0
- package/dist/components/LiteTransfer.svelte +4 -1
- package/dist/components/LiteTransfer.svelte.d.ts +2 -0
- package/dist/components/LiteTree.svelte +48 -0
- package/dist/components/LiteTree.svelte.d.ts +17 -0
- package/dist/components/LiteTwoFactorStepper.svelte +53 -0
- package/dist/components/LiteTwoFactorStepper.svelte.d.ts +16 -0
- package/dist/components/LiteVersionDiffViewer.svelte +4 -1
- package/dist/components/LiteVersionDiffViewer.svelte.d.ts +2 -0
- package/dist/components/LiteVideoPlayer.svelte +67 -0
- package/dist/components/LiteVideoPlayer.svelte.d.ts +22 -0
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte +42 -13
- package/dist/components/advanced/LiteAutoSaveIndicator.svelte.d.ts +10 -4
- package/dist/components/advanced/LiteDrawerForm.svelte +4 -1
- package/dist/components/advanced/LiteDrawerForm.svelte.d.ts +2 -0
- package/dist/components/advanced/LiteModalForm.svelte +4 -1
- package/dist/components/advanced/LiteModalForm.svelte.d.ts +2 -0
- package/dist/components/compatibility/LiteRealtimeStatus.svelte +41 -2
- package/dist/components/compatibility/LiteRealtimeStatus.svelte.d.ts +15 -0
- package/dist/components/fields/LiteBooleanField.svelte +4 -2
- package/dist/components/fields/LiteBooleanField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteCascader.svelte +5 -2
- package/dist/components/fields/LiteCascader.svelte.d.ts +2 -0
- package/dist/components/fields/LiteDateField.svelte +39 -9
- package/dist/components/fields/LiteDateField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteImageField.svelte +6 -2
- package/dist/components/fields/LiteImageField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteMarkdownField.svelte +49 -3
- package/dist/components/fields/LiteMarkdownField.svelte.d.ts +5 -0
- package/dist/components/fields/LiteNumberField.svelte +5 -3
- package/dist/components/fields/LiteNumberField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteRichTextField.svelte +45 -8
- package/dist/components/fields/LiteRichTextField.svelte.d.ts +3 -0
- package/dist/components/fields/LiteSelectField.svelte +5 -3
- package/dist/components/fields/LiteSelectField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTagField.svelte +38 -15
- package/dist/components/fields/LiteTagField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTextField.svelte +26 -5
- package/dist/components/fields/LiteTextField.svelte.d.ts +2 -0
- package/dist/components/fields/LiteTreeSelect.svelte +5 -2
- package/dist/components/fields/LiteTreeSelect.svelte.d.ts +2 -0
- package/dist/components/fields/LiteUrlField.svelte +5 -3
- package/dist/components/fields/LiteUrlField.svelte.d.ts +2 -0
- package/dist/components/layout/LiteSidebar.svelte +4 -1
- package/dist/components/layout/LiteSidebar.svelte.d.ts +2 -0
- package/dist/components/pages/LiteCreatePage.svelte +4 -1
- package/dist/components/pages/LiteCreatePage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteEditPage.svelte +4 -1
- package/dist/components/pages/LiteEditPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteListPage.svelte +4 -1
- package/dist/components/pages/LiteListPage.svelte.d.ts +2 -0
- package/dist/components/pages/LiteShowPage.svelte +4 -1
- package/dist/components/pages/LiteShowPage.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAnomalyBadge.svelte +5 -2
- package/dist/components/widgets/LiteAnomalyBadge.svelte.d.ts +2 -0
- package/dist/components/widgets/LiteAreaChart.svelte +20 -0
- package/dist/components/widgets/LiteAreaChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartSvg.svelte +102 -0
- package/dist/components/widgets/LiteChartSvg.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteChartTable.svelte +44 -0
- package/dist/components/widgets/LiteChartTable.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteDonutChart.svelte +20 -0
- package/dist/components/widgets/LiteDonutChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteFunnelChart.svelte +20 -0
- package/dist/components/widgets/LiteFunnelChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteGaugeChart.svelte +20 -0
- package/dist/components/widgets/LiteGaugeChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte +20 -0
- package/dist/components/widgets/LiteHeatmapChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteInsightCard.svelte +34 -12
- package/dist/components/widgets/LiteInsightCard.svelte.d.ts +7 -4
- package/dist/components/widgets/LiteLineChart.svelte +6 -3
- package/dist/components/widgets/LiteLineChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LitePieChart.svelte +5 -3
- package/dist/components/widgets/LitePieChart.svelte.d.ts +0 -5
- package/dist/components/widgets/LiteRadarChart.svelte +20 -0
- package/dist/components/widgets/LiteRadarChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteRoseChart.svelte +20 -0
- package/dist/components/widgets/LiteRoseChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteScatterChart.svelte +20 -0
- package/dist/components/widgets/LiteScatterChart.svelte.d.ts +10 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte +20 -0
- package/dist/components/widgets/LiteWaterfallChart.svelte.d.ts +10 -0
- package/dist/components/widgets/chart-geometry.d.ts +65 -0
- package/dist/components/widgets/chart-geometry.js +229 -0
- package/dist/components/widgets/index.d.ts +10 -0
- package/dist/components/widgets/index.js +10 -0
- package/dist/index.d.ts +40 -0
- package/dist/index.js +47 -0
- package/dist/lite-code-theme.css +139 -0
- package/dist/lite.css +108 -1
- package/dist/rich-content.d.ts +47 -0
- package/dist/rich-content.js +498 -0
- package/dist/schema-generator.js +3 -1
- package/dist/server-adapter.js +6 -11
- package/dist/value-normalization.d.ts +4 -0
- package/dist/value-normalization.js +13 -0
- package/package.json +18 -4
|
@@ -7,6 +7,8 @@ interface Props {
|
|
|
7
7
|
submitText?: string;
|
|
8
8
|
cancelText?: string;
|
|
9
9
|
children?: Snippet;
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
10
12
|
}
|
|
11
13
|
declare const LiteModalForm: import("svelte").Component<Props, {}, "">;
|
|
12
14
|
type LiteModalForm = ReturnType<typeof LiteModalForm>;
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { renderRichContent, type MarkdownRenderOptions } from '../rich-content.js';
|
|
3
|
+
|
|
4
|
+
interface NotificationItem {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
time?: string;
|
|
9
|
+
href?: string;
|
|
10
|
+
read?: boolean;
|
|
11
|
+
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface Props {
|
|
15
|
+
items: NotificationItem[];
|
|
16
|
+
title?: string;
|
|
17
|
+
emptyText?: string;
|
|
18
|
+
markAllHref?: string;
|
|
19
|
+
/** Render item descriptions as Markdown/allowlisted HTML. Defaults to plain text. */
|
|
20
|
+
richContent?: boolean;
|
|
21
|
+
richContentOptions?: MarkdownRenderOptions;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
let {
|
|
25
|
+
items,
|
|
26
|
+
title = 'Notifications',
|
|
27
|
+
emptyText = 'No notifications',
|
|
28
|
+
markAllHref,
|
|
29
|
+
richContent = false,
|
|
30
|
+
richContentOptions,
|
|
31
|
+
}: Props = $props();
|
|
32
|
+
|
|
33
|
+
function body(value: string): string {
|
|
34
|
+
return renderRichContent(value, richContentOptions);
|
|
35
|
+
}
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<section class="lite-notification-center lite-card" aria-label={title}>
|
|
39
|
+
<header>
|
|
40
|
+
<h2>{title}</h2>
|
|
41
|
+
{#if markAllHref}<a href={markAllHref}>Mark all read</a>{/if}
|
|
42
|
+
</header>
|
|
43
|
+
{#if items.length === 0}
|
|
44
|
+
<p class="lite-muted">{emptyText}</p>
|
|
45
|
+
{:else}
|
|
46
|
+
<ul>
|
|
47
|
+
{#each items as item (item.id)}
|
|
48
|
+
<li data-read={item.read || undefined} data-tone={item.tone ?? 'info'}>
|
|
49
|
+
<span class="lite-notification-center__dot" aria-hidden="true"></span>
|
|
50
|
+
{#if item.href}<a href={item.href}>{item.title}</a>{:else}<strong>{item.title}</strong>{/if}
|
|
51
|
+
{#if item.description}
|
|
52
|
+
{#if richContent}
|
|
53
|
+
<!-- eslint-disable-next-line svelte/no-at-html-tags -- 内容由 renderRichContent 转义或白名单过滤,高亮回调仅允许可信服务端实现。 -->
|
|
54
|
+
<div class="lite-notification-center__rich">{@html body(item.description)}</div>
|
|
55
|
+
{:else}
|
|
56
|
+
<p>{item.description}</p>
|
|
57
|
+
{/if}
|
|
58
|
+
{/if}
|
|
59
|
+
{#if item.time}<time>{item.time}</time>{/if}
|
|
60
|
+
</li>
|
|
61
|
+
{/each}
|
|
62
|
+
</ul>
|
|
63
|
+
{/if}
|
|
64
|
+
</section>
|
|
65
|
+
|
|
66
|
+
<style>
|
|
67
|
+
.lite-notification-center { padding: 0; overflow: hidden; }
|
|
68
|
+
.lite-notification-center header { display: flex; align-items: baseline; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid #E5E6EB; }
|
|
69
|
+
.lite-notification-center h2 { margin: 0; color: #1D2129; font-size: 14px; }
|
|
70
|
+
.lite-notification-center header a { color: #165DFF; font-size: 12px; }
|
|
71
|
+
.lite-notification-center ul { margin: 0; padding: 0; list-style: none; }
|
|
72
|
+
.lite-notification-center li { position: relative; display: block; padding: 12px 16px 12px 30px; border-bottom: 1px solid #F2F3F5; }
|
|
73
|
+
.lite-notification-center li:last-child { border-bottom: 0; }
|
|
74
|
+
.lite-notification-center li[data-read] { opacity: 0.65; }
|
|
75
|
+
.lite-notification-center__dot { position: absolute; top: 16px; left: 16px; width: 7px; height: 7px; border-radius: 999px; background: #165DFF; }
|
|
76
|
+
.lite-notification-center li[data-tone='success'] .lite-notification-center__dot { background: #00B42A; }
|
|
77
|
+
.lite-notification-center li[data-tone='warning'] .lite-notification-center__dot { background: #FF7D00; }
|
|
78
|
+
.lite-notification-center li[data-tone='danger'] .lite-notification-center__dot { background: #F53F3F; }
|
|
79
|
+
.lite-notification-center li a, .lite-notification-center li strong { color: #1D2129; font-size: 13px; }
|
|
80
|
+
.lite-notification-center li p { margin: 0; color: #4E5969; font-size: 12px; line-height: 1.5; }
|
|
81
|
+
.lite-notification-center li time { color: #86909C; font-size: 11px; }
|
|
82
|
+
.lite-notification-center__rich :global(p) { margin: 0; }
|
|
83
|
+
.lite-notification-center__rich :global(a) { color: #165DFF; }
|
|
84
|
+
.lite-notification-center__rich :global(code) { padding: 1px 4px; border-radius: 3px; background: #F2F3F5; font-family: monospace; font-size: 12px; }
|
|
85
|
+
</style>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type MarkdownRenderOptions } from '../rich-content.js';
|
|
2
|
+
interface NotificationItem {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
time?: string;
|
|
7
|
+
href?: string;
|
|
8
|
+
read?: boolean;
|
|
9
|
+
tone?: 'info' | 'success' | 'warning' | 'danger';
|
|
10
|
+
}
|
|
11
|
+
interface Props {
|
|
12
|
+
items: NotificationItem[];
|
|
13
|
+
title?: string;
|
|
14
|
+
emptyText?: string;
|
|
15
|
+
markAllHref?: string;
|
|
16
|
+
/** Render item descriptions as Markdown/allowlisted HTML. Defaults to plain text. */
|
|
17
|
+
richContent?: boolean;
|
|
18
|
+
richContentOptions?: MarkdownRenderOptions;
|
|
19
|
+
}
|
|
20
|
+
declare const LiteNotificationCenter: import("svelte").Component<Props, {}, "">;
|
|
21
|
+
type LiteNotificationCenter = ReturnType<typeof LiteNotificationCenter>;
|
|
22
|
+
export default LiteNotificationCenter;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
/** Caller class merged with the built-in class list. */
|
|
6
|
+
class?: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
length?: number;
|
|
10
|
+
value?: string;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
required?: boolean;
|
|
13
|
+
autocomplete?: HTMLInputAttributes['autocomplete'];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
name = 'code',
|
|
18
|
+
label = 'Verification code',
|
|
19
|
+
length = 6,
|
|
20
|
+
value = '',
|
|
21
|
+
disabled = false,
|
|
22
|
+
required = true,
|
|
23
|
+
autocomplete = 'one-time-code',
|
|
24
|
+
class: className = '',
|
|
25
|
+
}: Props = $props();
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<label class="lite-form-group lite-otp-input {className}">
|
|
29
|
+
<span>{label}</span>
|
|
30
|
+
<input
|
|
31
|
+
class="lite-input"
|
|
32
|
+
type="text"
|
|
33
|
+
{name}
|
|
34
|
+
{value}
|
|
35
|
+
{disabled}
|
|
36
|
+
{required}
|
|
37
|
+
{autocomplete}
|
|
38
|
+
inputmode="numeric"
|
|
39
|
+
pattern={`[0-9]{${length}}`}
|
|
40
|
+
maxlength={length}
|
|
41
|
+
placeholder={Array.from({ length }, () => '0').join('')}
|
|
42
|
+
aria-describedby={`${name}-hint`}
|
|
43
|
+
/>
|
|
44
|
+
<small id={`${name}-hint`}>{length}-digit code</small>
|
|
45
|
+
</label>
|
|
46
|
+
|
|
47
|
+
<style>
|
|
48
|
+
.lite-otp-input input { max-width: 14rem; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 18px; letter-spacing: 0.35em; }
|
|
49
|
+
.lite-otp-input small { color: #86909C; font-size: 12px; }
|
|
50
|
+
</style>
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { HTMLInputAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props {
|
|
3
|
+
/** Caller class merged with the built-in class list. */
|
|
4
|
+
class?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
length?: number;
|
|
8
|
+
value?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
autocomplete?: HTMLInputAttributes['autocomplete'];
|
|
12
|
+
}
|
|
13
|
+
declare const LiteOtpInput: import("svelte").Component<Props, {}, "">;
|
|
14
|
+
type LiteOtpInput = ReturnType<typeof LiteOtpInput>;
|
|
15
|
+
export default LiteOtpInput;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
title: string;
|
|
6
|
+
description?: string;
|
|
7
|
+
eyebrow?: string;
|
|
8
|
+
actions?: Snippet;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
/** Caller class merged with the built-in class list. */
|
|
11
|
+
class?: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let { title, description, eyebrow, actions, children, class: className = '' }: Props = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<header class="lite-page-header lite-page-header-rich {className}">
|
|
18
|
+
<div>
|
|
19
|
+
{#if eyebrow}<p class="lite-page-header__eyebrow">{eyebrow}</p>{/if}
|
|
20
|
+
<h1 class="lite-page-title">{title}</h1>
|
|
21
|
+
{#if description}<p class="lite-page-header__description">{description}</p>{/if}
|
|
22
|
+
{@render children?.()}
|
|
23
|
+
</div>
|
|
24
|
+
{#if actions}<div class="lite-page-header__actions">{@render actions()}</div>{/if}
|
|
25
|
+
</header>
|
|
26
|
+
|
|
27
|
+
<style>
|
|
28
|
+
.lite-page-header-rich { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; }
|
|
29
|
+
.lite-page-header__eyebrow { margin: 0 0 4px; color: #86909C; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
|
|
30
|
+
.lite-page-header__description { margin: 6px 0 0; color: #4E5969; font-size: 13px; line-height: 1.6; }
|
|
31
|
+
.lite-page-header__actions { display: flex; flex-wrap: wrap; align-items: center; }
|
|
32
|
+
|
|
33
|
+
.lite-page-header__actions > * + * { margin-left: 8px; }
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
description?: string;
|
|
5
|
+
eyebrow?: string;
|
|
6
|
+
actions?: Snippet;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
/** Caller class merged with the built-in class list. */
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
declare const LitePageHeader: import("svelte").Component<Props, {}, "">;
|
|
12
|
+
type LitePageHeader = ReturnType<typeof LitePageHeader>;
|
|
13
|
+
export default LitePageHeader;
|
|
@@ -12,9 +12,17 @@
|
|
|
12
12
|
baseUrl?: string;
|
|
13
13
|
/** Additional parameters to preserve (like sort, order, q) */
|
|
14
14
|
preserveParams?: Record<string, string>;
|
|
15
|
+
/** Caller class merged with the built-in class list. */
|
|
16
|
+
class?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
|
-
let {
|
|
19
|
+
let {
|
|
20
|
+
page,
|
|
21
|
+
totalPages,
|
|
22
|
+
baseUrl = '',
|
|
23
|
+
preserveParams = {},
|
|
24
|
+
class: className = '',
|
|
25
|
+
}: Props = $props();
|
|
18
26
|
|
|
19
27
|
// Show max 7 page links
|
|
20
28
|
const visiblePages = $derived.by(() => {
|
|
@@ -43,7 +51,7 @@
|
|
|
43
51
|
</script>
|
|
44
52
|
|
|
45
53
|
{#if totalPages > 1}
|
|
46
|
-
<nav class="lite-pagination">
|
|
54
|
+
<nav class="lite-pagination {className}">
|
|
47
55
|
{#if page > 1}
|
|
48
56
|
<a href={pageUrl(page - 1)}>← {t('common.prev') || 'Prev'}</a>
|
|
49
57
|
{:else}
|
|
@@ -5,6 +5,8 @@ interface Props {
|
|
|
5
5
|
baseUrl?: string;
|
|
6
6
|
/** Additional parameters to preserve (like sort, order, q) */
|
|
7
7
|
preserveParams?: Record<string, string>;
|
|
8
|
+
/** Caller class merged with the built-in class list. */
|
|
9
|
+
class?: string;
|
|
8
10
|
}
|
|
9
11
|
declare const LitePagination: import("svelte").Component<Props, {}, "">;
|
|
10
12
|
type LitePagination = ReturnType<typeof LitePagination>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
confirmLabel?: string;
|
|
9
|
+
cancelLabel?: string;
|
|
10
|
+
action?: string;
|
|
11
|
+
method?: HTMLFormAttributes['method'];
|
|
12
|
+
href?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
id,
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
confirmLabel = 'Confirm',
|
|
20
|
+
cancelLabel = 'Cancel',
|
|
21
|
+
action,
|
|
22
|
+
method = 'POST',
|
|
23
|
+
href,
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
</script>
|
|
26
|
+
|
|
27
|
+
<div class="lite-popconfirm">
|
|
28
|
+
<a class="lite-btn lite-btn-sm" href={`#${id}`}>{title}</a>
|
|
29
|
+
<div class="lite-popconfirm__panel" id={id} role="dialog" aria-label={title}>
|
|
30
|
+
{#if description}<p>{description}</p>{/if}
|
|
31
|
+
<div class="lite-inline-sm">
|
|
32
|
+
{#if action}
|
|
33
|
+
<form {method} {action}>
|
|
34
|
+
<button class="lite-btn lite-btn-primary lite-btn-sm" type="submit">{confirmLabel}</button>
|
|
35
|
+
</form>
|
|
36
|
+
{:else if href}
|
|
37
|
+
<a class="lite-btn lite-btn-primary lite-btn-sm" href={href}>{confirmLabel}</a>
|
|
38
|
+
{/if}
|
|
39
|
+
<a class="lite-btn lite-btn-sm" href="#">{cancelLabel}</a>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
42
|
+
</div>
|
|
43
|
+
|
|
44
|
+
<style>
|
|
45
|
+
.lite-popconfirm { display: inline-block; position: relative; }
|
|
46
|
+
.lite-popconfirm__panel { display: none; position: absolute; z-index: 30; top: 100%; left: 0; width: 18rem; max-width: calc(100vw - 2rem); margin-top: 6px; padding: 12px; border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; box-shadow: 0 10px 28px rgba(29, 33, 41, 0.16); }
|
|
47
|
+
.lite-popconfirm__panel:target { display: block; }
|
|
48
|
+
.lite-popconfirm__panel p { margin: 0 0 8px; color: #4E5969; font-size: 12px; line-height: 1.5; }
|
|
49
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
2
|
+
interface Props {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
confirmLabel?: string;
|
|
7
|
+
cancelLabel?: string;
|
|
8
|
+
action?: string;
|
|
9
|
+
method?: HTMLFormAttributes['method'];
|
|
10
|
+
href?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const LitePopconfirm: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LitePopconfirm = ReturnType<typeof LitePopconfirm>;
|
|
14
|
+
export default LitePopconfirm;
|
|
@@ -8,15 +8,18 @@
|
|
|
8
8
|
interface Props {
|
|
9
9
|
users?: LitePresenceUser[];
|
|
10
10
|
label?: string;
|
|
11
|
+
/** Caller class merged with the built-in class list. */
|
|
12
|
+
class?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
let {
|
|
14
16
|
users = [],
|
|
15
17
|
label = 'Viewing now',
|
|
18
|
+
class: className = ''
|
|
16
19
|
}: Props = $props();
|
|
17
20
|
</script>
|
|
18
21
|
|
|
19
|
-
<div class="lite-presence-container">
|
|
22
|
+
<div class="lite-presence-container {className}">
|
|
20
23
|
<span class="lite-presence-label">{label}:</span>
|
|
21
24
|
{#each users as user (user.id)}
|
|
22
25
|
<span class="lite-presence-badge" title="{user.name} ({user.status ?? 'online'})">
|
|
@@ -6,6 +6,8 @@ interface LitePresenceUser {
|
|
|
6
6
|
interface Props {
|
|
7
7
|
users?: LitePresenceUser[];
|
|
8
8
|
label?: string;
|
|
9
|
+
/** Caller class merged with the built-in class list. */
|
|
10
|
+
class?: string;
|
|
9
11
|
}
|
|
10
12
|
declare const LitePresenceAvatarGroup: import("svelte").Component<Props, {}, "">;
|
|
11
13
|
type LitePresenceAvatarGroup = ReturnType<typeof LitePresenceAvatarGroup>;
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
customerName: string;
|
|
16
16
|
items?: LiteBillItem[];
|
|
17
17
|
notes?: string;
|
|
18
|
+
/** Caller class merged with the built-in class list. */
|
|
19
|
+
class?: string;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
let {
|
|
@@ -25,6 +27,7 @@
|
|
|
25
27
|
customerName,
|
|
26
28
|
items = [],
|
|
27
29
|
notes,
|
|
30
|
+
class: className = '',
|
|
28
31
|
}: Props = $props();
|
|
29
32
|
|
|
30
33
|
const total = $derived(
|
|
@@ -32,7 +35,7 @@
|
|
|
32
35
|
);
|
|
33
36
|
</script>
|
|
34
37
|
|
|
35
|
-
<div class="lite-bill-card">
|
|
38
|
+
<div class="lite-bill-card {className}">
|
|
36
39
|
<div class="lite-bill-header">
|
|
37
40
|
<div style="float: left;">
|
|
38
41
|
<h3 style="margin: 0;">{title}</h3>
|
|
@@ -13,6 +13,8 @@ interface Props {
|
|
|
13
13
|
customerName: string;
|
|
14
14
|
items?: LiteBillItem[];
|
|
15
15
|
notes?: string;
|
|
16
|
+
/** Caller class merged with the built-in class list. */
|
|
17
|
+
class?: string;
|
|
16
18
|
}
|
|
17
19
|
declare const LitePrintableBill: import("svelte").Component<Props, {}, "">;
|
|
18
20
|
type LitePrintableBill = ReturnType<typeof LitePrintableBill>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
value: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
label?: string;
|
|
6
|
+
showValue?: boolean;
|
|
7
|
+
tone?: 'default' | 'success' | 'warning' | 'danger';
|
|
8
|
+
/** Caller class merged with the built-in class list. */
|
|
9
|
+
class?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let { value, max = 100, label, showValue = true, tone = 'default',
|
|
13
|
+
class: className = ''
|
|
14
|
+
}: Props = $props();
|
|
15
|
+
const safeMax = $derived(max > 0 ? max : 100);
|
|
16
|
+
const safeValue = $derived(Math.max(0, Math.min(value, safeMax)));
|
|
17
|
+
const percent = $derived(Math.round((safeValue / safeMax) * 100));
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div class="lite-progress {className}" data-tone={tone}>
|
|
21
|
+
{#if label || showValue}
|
|
22
|
+
<div class="lite-progress__meta">
|
|
23
|
+
{#if label}<span>{label}</span>{/if}
|
|
24
|
+
{#if showValue}<span>{percent}%</span>{/if}
|
|
25
|
+
</div>
|
|
26
|
+
{/if}
|
|
27
|
+
<progress max={safeMax} value={safeValue}>{percent}%</progress>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
.lite-progress { display: block; }
|
|
32
|
+
.lite-progress__meta { display: flex; justify-content: space-between; color: #4E5969; font-size: 12px; }
|
|
33
|
+
.lite-progress progress { width: 100%; height: 8px; border: 0; border-radius: 999px; background: #F2F3F5; }
|
|
34
|
+
.lite-progress progress::-webkit-progress-bar { border-radius: 999px; background: #F2F3F5; }
|
|
35
|
+
.lite-progress progress::-webkit-progress-value { border-radius: 999px; background: #165DFF; }
|
|
36
|
+
.lite-progress progress::-moz-progress-bar { border-radius: 999px; background: #165DFF; }
|
|
37
|
+
.lite-progress[data-tone='success'] progress::-webkit-progress-value { background: #00B42A; }
|
|
38
|
+
.lite-progress[data-tone='success'] progress::-moz-progress-bar { background: #00B42A; }
|
|
39
|
+
.lite-progress[data-tone='warning'] progress::-webkit-progress-value { background: #FF7D00; }
|
|
40
|
+
.lite-progress[data-tone='warning'] progress::-moz-progress-bar { background: #FF7D00; }
|
|
41
|
+
.lite-progress[data-tone='danger'] progress::-webkit-progress-value { background: #F53F3F; }
|
|
42
|
+
.lite-progress[data-tone='danger'] progress::-moz-progress-bar { background: #F53F3F; }
|
|
43
|
+
|
|
44
|
+
.lite-progress progress { margin-top: 4px; }
|
|
45
|
+
.lite-progress__meta > * + * { margin-left: 8px; }
|
|
46
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value: number;
|
|
3
|
+
max?: number;
|
|
4
|
+
label?: string;
|
|
5
|
+
showValue?: boolean;
|
|
6
|
+
tone?: 'default' | 'success' | 'warning' | 'danger';
|
|
7
|
+
/** Caller class merged with the built-in class list. */
|
|
8
|
+
class?: string;
|
|
9
|
+
}
|
|
10
|
+
declare const LiteProgress: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type LiteProgress = ReturnType<typeof LiteProgress>;
|
|
12
|
+
export default LiteProgress;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import QRCodeLib from 'qrcode';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
value: string;
|
|
6
|
+
size?: number;
|
|
7
|
+
margin?: number;
|
|
8
|
+
errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
9
|
+
color?: string;
|
|
10
|
+
background?: string;
|
|
11
|
+
ariaLabel?: string;
|
|
12
|
+
/** Caller class merged with the built-in class list. */
|
|
13
|
+
class?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let {
|
|
17
|
+
value,
|
|
18
|
+
size = 160,
|
|
19
|
+
margin = 4,
|
|
20
|
+
errorCorrectionLevel = 'M',
|
|
21
|
+
color = '#1D2129',
|
|
22
|
+
background = '#FFFFFF',
|
|
23
|
+
ariaLabel = 'QR code',
|
|
24
|
+
class: className = '',
|
|
25
|
+
}: Props = $props();
|
|
26
|
+
|
|
27
|
+
const matrix = $derived.by(() => {
|
|
28
|
+
if (!value) return null;
|
|
29
|
+
try {
|
|
30
|
+
const qr = QRCodeLib.create(value, { errorCorrectionLevel });
|
|
31
|
+
const moduleCount = qr.modules.size;
|
|
32
|
+
const data = qr.modules.data;
|
|
33
|
+
const total = moduleCount + margin * 2;
|
|
34
|
+
let path = '';
|
|
35
|
+
for (let y = 0; y < moduleCount; y += 1) {
|
|
36
|
+
for (let x = 0; x < moduleCount; x += 1) {
|
|
37
|
+
if (data[y * moduleCount + x]) path += `M${x + margin} ${y + margin}h1v1h-1z`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return { total, path };
|
|
41
|
+
} catch {
|
|
42
|
+
return null;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
46
|
+
|
|
47
|
+
<figure class="lite-qr-code {className}">
|
|
48
|
+
{#if matrix}
|
|
49
|
+
<svg width={size} height={size} viewBox={`0 0 ${matrix.total} ${matrix.total}`} role="img" aria-label={ariaLabel} shape-rendering="crispEdges">
|
|
50
|
+
<rect width={matrix.total} height={matrix.total} fill={background} />
|
|
51
|
+
<path d={matrix.path} fill={color} />
|
|
52
|
+
</svg>
|
|
53
|
+
{:else}
|
|
54
|
+
<p class="lite-muted" role="status">No QR content.</p>
|
|
55
|
+
{/if}
|
|
56
|
+
</figure>
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
.lite-qr-code { display: inline-flex; margin: 0; padding: 8px; border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; }
|
|
60
|
+
.lite-qr-code svg { display: block; max-width: 100%; height: auto; }
|
|
61
|
+
.lite-qr-code p { margin: 0; padding: 16px; color: #86909C; font-size: 13px; }
|
|
62
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
value: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
margin?: number;
|
|
5
|
+
errorCorrectionLevel?: 'L' | 'M' | 'Q' | 'H';
|
|
6
|
+
color?: string;
|
|
7
|
+
background?: string;
|
|
8
|
+
ariaLabel?: string;
|
|
9
|
+
/** Caller class merged with the built-in class list. */
|
|
10
|
+
class?: string;
|
|
11
|
+
}
|
|
12
|
+
declare const LiteQRCode: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LiteQRCode = ReturnType<typeof LiteQRCode>;
|
|
14
|
+
export default LiteQRCode;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
width?: string;
|
|
6
|
+
height?: string;
|
|
7
|
+
minWidth?: string;
|
|
8
|
+
minHeight?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
children: Snippet;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
let {
|
|
14
|
+
width = '100%',
|
|
15
|
+
height = '240px',
|
|
16
|
+
minWidth = '12rem',
|
|
17
|
+
minHeight = '8rem',
|
|
18
|
+
label = 'Resizable panel',
|
|
19
|
+
children,
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
class="lite-resize-box"
|
|
25
|
+
role="group"
|
|
26
|
+
aria-label={label}
|
|
27
|
+
style={`width:${width};height:${height};min-width:${minWidth};min-height:${minHeight}`}
|
|
28
|
+
>
|
|
29
|
+
{@render children()}
|
|
30
|
+
</div>
|
|
31
|
+
|
|
32
|
+
<style>
|
|
33
|
+
.lite-resize-box { overflow: auto; padding: 12px; border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; resize: both; }
|
|
34
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
width?: string;
|
|
4
|
+
height?: string;
|
|
5
|
+
minWidth?: string;
|
|
6
|
+
minHeight?: string;
|
|
7
|
+
label?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const LiteResizeBox: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type LiteResizeBox = ReturnType<typeof LiteResizeBox>;
|
|
12
|
+
export default LiteResizeBox;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
status?: 'success' | 'error' | 'warning' | 'info' | '404' | '403' | '500';
|
|
6
|
+
title: string;
|
|
7
|
+
description?: string;
|
|
8
|
+
actionHref?: string;
|
|
9
|
+
actionLabel?: string;
|
|
10
|
+
secondaryHref?: string;
|
|
11
|
+
secondaryLabel?: string;
|
|
12
|
+
children?: Snippet;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let {
|
|
16
|
+
status = 'info',
|
|
17
|
+
title,
|
|
18
|
+
description,
|
|
19
|
+
actionHref,
|
|
20
|
+
actionLabel,
|
|
21
|
+
secondaryHref,
|
|
22
|
+
secondaryLabel,
|
|
23
|
+
children,
|
|
24
|
+
}: Props = $props();
|
|
25
|
+
|
|
26
|
+
const icon = $derived(status === 'success' ? '✓' : status === 'error' || status === '500' ? '!' : status === 'warning' ? '!' : status === '404' ? '404' : status === '403' ? '403' : 'i');
|
|
27
|
+
</script>
|
|
28
|
+
|
|
29
|
+
<section class="lite-result" data-status={status} role="status">
|
|
30
|
+
<span class="lite-result__icon" aria-hidden="true">{icon}</span>
|
|
31
|
+
<h2>{title}</h2>
|
|
32
|
+
{#if description}<p>{description}</p>{/if}
|
|
33
|
+
{@render children?.()}
|
|
34
|
+
{#if actionHref || secondaryHref}
|
|
35
|
+
<div class="lite-inline-sm">
|
|
36
|
+
{#if actionHref}<a class="lite-btn lite-btn-primary" href={actionHref}>{actionLabel ?? 'Continue'}</a>{/if}
|
|
37
|
+
{#if secondaryHref}<a class="lite-btn" href={secondaryHref}>{secondaryLabel ?? 'Back'}</a>{/if}
|
|
38
|
+
</div>
|
|
39
|
+
{/if}
|
|
40
|
+
</section>
|
|
41
|
+
|
|
42
|
+
<style>
|
|
43
|
+
.lite-result { display: block; justify-items: center; padding: 48px 24px; border: 1px solid #E5E6EB; border-radius: 8px; background: #fff; text-align: center; }
|
|
44
|
+
.lite-result__icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 999px; background: #E8F3FF; color: #165DFF; font-size: 24px; font-weight: 700; }
|
|
45
|
+
.lite-result[data-status='success'] .lite-result__icon { background: #E8FFEA; color: #009A29; }
|
|
46
|
+
.lite-result[data-status='error'] .lite-result__icon, .lite-result[data-status='500'] .lite-result__icon { background: #FFECE8; color: #F53F3F; }
|
|
47
|
+
.lite-result[data-status='warning'] .lite-result__icon { background: #FFF7E8; color: #D25F00; }
|
|
48
|
+
.lite-result h2 { margin: 0; color: #1D2129; font-size: 20px; }
|
|
49
|
+
.lite-result p { max-width: 40rem; margin: 0; color: #4E5969; font-size: 14px; line-height: 1.6; }
|
|
50
|
+
|
|
51
|
+
.lite-result > * + * { margin-top: 10px; }
|
|
52
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
status?: 'success' | 'error' | 'warning' | 'info' | '404' | '403' | '500';
|
|
4
|
+
title: string;
|
|
5
|
+
description?: string;
|
|
6
|
+
actionHref?: string;
|
|
7
|
+
actionLabel?: string;
|
|
8
|
+
secondaryHref?: string;
|
|
9
|
+
secondaryLabel?: string;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const LiteResult: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type LiteResult = ReturnType<typeof LiteResult>;
|
|
14
|
+
export default LiteResult;
|