@tabelhadev/tabelhawebui 0.28.4
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/LICENSE +661 -0
- package/README.md +222 -0
- package/README.pt-BR.md +217 -0
- package/dist/actions/click-outside.d.ts +3 -0
- package/dist/actions/click-outside.js +12 -0
- package/dist/actions/combobox-keyboard-nav.d.ts +9 -0
- package/dist/actions/combobox-keyboard-nav.js +28 -0
- package/dist/actions/focus-trap.d.ts +1 -0
- package/dist/actions/focus-trap.js +34 -0
- package/dist/actions/scroll-lock.d.ts +1 -0
- package/dist/actions/scroll-lock.js +17 -0
- package/dist/components/actions/Button.svelte +169 -0
- package/dist/components/actions/Button.svelte.d.ts +19 -0
- package/dist/components/appshell/AppShell.svelte +50 -0
- package/dist/components/appshell/AppShell.svelte.d.ts +19 -0
- package/dist/components/appshell/AppShellBottomNav.svelte +67 -0
- package/dist/components/appshell/AppShellBottomNav.svelte.d.ts +9 -0
- package/dist/components/appshell/AppShellContent.svelte +38 -0
- package/dist/components/appshell/AppShellContent.svelte.d.ts +10 -0
- package/dist/components/appshell/AppShellSidebar.svelte +196 -0
- package/dist/components/appshell/AppShellSidebar.svelte.d.ts +15 -0
- package/dist/components/appshell/types.d.ts +6 -0
- package/dist/components/appshell/types.js +1 -0
- package/dist/components/appshell/utils.d.ts +1 -0
- package/dist/components/appshell/utils.js +3 -0
- package/dist/components/card/Card.svelte +31 -0
- package/dist/components/card/Card.svelte.d.ts +9 -0
- package/dist/components/card/CardAction.svelte +57 -0
- package/dist/components/card/CardAction.svelte.d.ts +10 -0
- package/dist/components/card/CardContent.svelte +25 -0
- package/dist/components/card/CardContent.svelte.d.ts +8 -0
- package/dist/components/card/CardDescription.svelte +24 -0
- package/dist/components/card/CardDescription.svelte.d.ts +8 -0
- package/dist/components/card/CardFooter.svelte +25 -0
- package/dist/components/card/CardFooter.svelte.d.ts +8 -0
- package/dist/components/card/CardHeader.svelte +54 -0
- package/dist/components/card/CardHeader.svelte.d.ts +10 -0
- package/dist/components/card/CardTitle.svelte +25 -0
- package/dist/components/card/CardTitle.svelte.d.ts +8 -0
- package/dist/components/chat/ChatMessage.svelte +104 -0
- package/dist/components/chat/ChatMessage.svelte.d.ts +10 -0
- package/dist/components/choice/Listbox.svelte +183 -0
- package/dist/components/choice/Listbox.svelte.d.ts +15 -0
- package/dist/components/choice/MultiSelect.svelte +278 -0
- package/dist/components/choice/MultiSelect.svelte.d.ts +18 -0
- package/dist/components/choice/Rating.svelte +91 -0
- package/dist/components/choice/Rating.svelte.d.ts +12 -0
- package/dist/components/choice/Toggle.svelte +112 -0
- package/dist/components/choice/Toggle.svelte.d.ts +12 -0
- package/dist/components/feedback/Badge.svelte +66 -0
- package/dist/components/feedback/Badge.svelte.d.ts +9 -0
- package/dist/components/feedback/ErrorPage.svelte +99 -0
- package/dist/components/feedback/ErrorPage.svelte.d.ts +13 -0
- package/dist/components/feedback/Message.svelte +130 -0
- package/dist/components/feedback/Message.svelte.d.ts +14 -0
- package/dist/components/feedback/ProgressBar.svelte +69 -0
- package/dist/components/feedback/ProgressBar.svelte.d.ts +8 -0
- package/dist/components/feedback/Skeleton.svelte +47 -0
- package/dist/components/feedback/Skeleton.svelte.d.ts +9 -0
- package/dist/components/feedback/Status.svelte +75 -0
- package/dist/components/feedback/Status.svelte.d.ts +10 -0
- package/dist/components/feedback/StatusPill.svelte +94 -0
- package/dist/components/feedback/StatusPill.svelte.d.ts +13 -0
- package/dist/components/feedback/Toaster.svelte +122 -0
- package/dist/components/feedback/Toaster.svelte.d.ts +7 -0
- package/dist/components/feedback/Tooltip.svelte +126 -0
- package/dist/components/feedback/Tooltip.svelte.d.ts +10 -0
- package/dist/components/feedback/toast.svelte.d.ts +27 -0
- package/dist/components/feedback/toast.svelte.js +23 -0
- package/dist/components/forms/Checkbox.svelte +96 -0
- package/dist/components/forms/Checkbox.svelte.d.ts +11 -0
- package/dist/components/forms/DatePicker.svelte +372 -0
- package/dist/components/forms/DatePicker.svelte.d.ts +21 -0
- package/dist/components/forms/Field.svelte +47 -0
- package/dist/components/forms/Field.svelte.d.ts +11 -0
- package/dist/components/forms/FileUpload.svelte +504 -0
- package/dist/components/forms/FileUpload.svelte.d.ts +43 -0
- package/dist/components/forms/Input.svelte +93 -0
- package/dist/components/forms/Input.svelte.d.ts +9 -0
- package/dist/components/forms/Label.svelte +30 -0
- package/dist/components/forms/Label.svelte.d.ts +10 -0
- package/dist/components/forms/Radio.svelte +80 -0
- package/dist/components/forms/Radio.svelte.d.ts +11 -0
- package/dist/components/forms/Select.svelte +322 -0
- package/dist/components/forms/Select.svelte.d.ts +22 -0
- package/dist/components/forms/TagInput.svelte +336 -0
- package/dist/components/forms/TagInput.svelte.d.ts +16 -0
- package/dist/components/forms/Textarea.svelte +64 -0
- package/dist/components/forms/Textarea.svelte.d.ts +9 -0
- package/dist/components/landing/Landing.svelte +47 -0
- package/dist/components/landing/Landing.svelte.d.ts +8 -0
- package/dist/components/landing/LandingFeatures.svelte +92 -0
- package/dist/components/landing/LandingFeatures.svelte.d.ts +15 -0
- package/dist/components/landing/LandingHero.svelte +92 -0
- package/dist/components/landing/LandingHero.svelte.d.ts +13 -0
- package/dist/components/landing/LandingRoadmap.svelte +42 -0
- package/dist/components/landing/LandingRoadmap.svelte.d.ts +11 -0
- package/dist/components/landing/LandingSection.svelte +25 -0
- package/dist/components/landing/LandingSection.svelte.d.ts +9 -0
- package/dist/components/landing/LandingSectionHeading.svelte +19 -0
- package/dist/components/landing/LandingSectionHeading.svelte.d.ts +10 -0
- package/dist/components/landing/LandingSteps.svelte +100 -0
- package/dist/components/landing/LandingSteps.svelte.d.ts +13 -0
- package/dist/components/layout/BracketLink.svelte +41 -0
- package/dist/components/layout/BracketLink.svelte.d.ts +9 -0
- package/dist/components/layout/Divider.svelte +70 -0
- package/dist/components/layout/Divider.svelte.d.ts +9 -0
- package/dist/components/layout/Eyebrow.svelte +24 -0
- package/dist/components/layout/Eyebrow.svelte.d.ts +8 -0
- package/dist/components/layout/PageHeader.svelte +106 -0
- package/dist/components/layout/PageHeader.svelte.d.ts +15 -0
- package/dist/components/layout/PageSeo.svelte +34 -0
- package/dist/components/layout/PageSeo.svelte.d.ts +10 -0
- package/dist/components/layout/PageShell.svelte +25 -0
- package/dist/components/layout/PageShell.svelte.d.ts +8 -0
- package/dist/components/layout/Panel.svelte +105 -0
- package/dist/components/layout/Panel.svelte.d.ts +12 -0
- package/dist/components/layout/Prose.svelte +101 -0
- package/dist/components/layout/Prose.svelte.d.ts +7 -0
- package/dist/components/layout/RuleCard.svelte +63 -0
- package/dist/components/layout/RuleCard.svelte.d.ts +13 -0
- package/dist/components/layout/SectionHeading.svelte +57 -0
- package/dist/components/layout/SectionHeading.svelte.d.ts +10 -0
- package/dist/components/layout/StatTile.svelte +76 -0
- package/dist/components/layout/StatTile.svelte.d.ts +12 -0
- package/dist/components/layout/TerminalWindow.svelte +81 -0
- package/dist/components/layout/TerminalWindow.svelte.d.ts +9 -0
- package/dist/components/layout/Wordmark.svelte +26 -0
- package/dist/components/layout/Wordmark.svelte.d.ts +8 -0
- package/dist/components/list/List.svelte +40 -0
- package/dist/components/list/List.svelte.d.ts +13 -0
- package/dist/components/list/ListItem.svelte +81 -0
- package/dist/components/list/ListItem.svelte.d.ts +13 -0
- package/dist/components/marketing/MarketingShell.svelte +170 -0
- package/dist/components/marketing/MarketingShell.svelte.d.ts +23 -0
- package/dist/components/marketing/MarketingShellFooter.svelte +92 -0
- package/dist/components/marketing/MarketingShellFooter.svelte.d.ts +14 -0
- package/dist/components/navigation/Accordion.svelte +110 -0
- package/dist/components/navigation/Accordion.svelte.d.ts +15 -0
- package/dist/components/navigation/Carousel.svelte +115 -0
- package/dist/components/navigation/Carousel.svelte.d.ts +12 -0
- package/dist/components/navigation/InstructionStep.svelte +115 -0
- package/dist/components/navigation/InstructionStep.svelte.d.ts +10 -0
- package/dist/components/navigation/InstructionSteps.svelte +39 -0
- package/dist/components/navigation/InstructionSteps.svelte.d.ts +8 -0
- package/dist/components/navigation/Nav.svelte +102 -0
- package/dist/components/navigation/Nav.svelte.d.ts +14 -0
- package/dist/components/navigation/Stepper.svelte +112 -0
- package/dist/components/navigation/Stepper.svelte.d.ts +12 -0
- package/dist/components/navigation/TabCard.svelte +62 -0
- package/dist/components/navigation/TabCard.svelte.d.ts +10 -0
- package/dist/components/navigation/Tabs.svelte +83 -0
- package/dist/components/navigation/Tabs.svelte.d.ts +12 -0
- package/dist/components/navigation/ThemeToggle.svelte +118 -0
- package/dist/components/navigation/ThemeToggle.svelte.d.ts +20 -0
- package/dist/components/overlay/Dialog.svelte +200 -0
- package/dist/components/overlay/Dialog.svelte.d.ts +19 -0
- package/dist/components/overlay/DialogActions.svelte +50 -0
- package/dist/components/overlay/DialogActions.svelte.d.ts +9 -0
- package/dist/components/overlay/Dropdown.svelte +110 -0
- package/dist/components/overlay/Dropdown.svelte.d.ts +10 -0
- package/dist/components/overlay/FloatingActionPill.svelte +96 -0
- package/dist/components/overlay/FloatingActionPill.svelte.d.ts +14 -0
- package/dist/components/overlay/Sidebar.svelte +258 -0
- package/dist/components/overlay/Sidebar.svelte.d.ts +18 -0
- package/dist/components/table/Table.svelte +550 -0
- package/dist/components/table/Table.svelte.d.ts +42 -0
- package/dist/components/timeline/Timeline.svelte +25 -0
- package/dist/components/timeline/Timeline.svelte.d.ts +8 -0
- package/dist/components/timeline/TimelineItem.svelte +220 -0
- package/dist/components/timeline/TimelineItem.svelte.d.ts +18 -0
- package/dist/index.d.ts +156 -0
- package/dist/index.js +149 -0
- package/dist/theme/theme.css +348 -0
- package/package.json +52 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
severity = 'info',
|
|
6
|
+
variant = 'simple',
|
|
7
|
+
size,
|
|
8
|
+
closable = false,
|
|
9
|
+
life,
|
|
10
|
+
closeLabel = 'Fechar',
|
|
11
|
+
children,
|
|
12
|
+
class: className = ''
|
|
13
|
+
}: {
|
|
14
|
+
severity?: 'info' | 'success' | 'warn' | 'error';
|
|
15
|
+
variant?: 'simple' | 'outlined';
|
|
16
|
+
size?: 'small';
|
|
17
|
+
closable?: boolean;
|
|
18
|
+
life?: number;
|
|
19
|
+
closeLabel?: string;
|
|
20
|
+
children: Snippet;
|
|
21
|
+
class?: string;
|
|
22
|
+
} = $props();
|
|
23
|
+
|
|
24
|
+
let visible = $state(true);
|
|
25
|
+
|
|
26
|
+
$effect(() => {
|
|
27
|
+
if (!visible || !life) return;
|
|
28
|
+
const id = setTimeout(() => (visible = false), life);
|
|
29
|
+
return () => clearTimeout(id);
|
|
30
|
+
});
|
|
31
|
+
</script>
|
|
32
|
+
|
|
33
|
+
{#if visible}
|
|
34
|
+
<div
|
|
35
|
+
class="twui-message twui-message-{severity} twui-message-{variant} {size ? `twui-message-${size}` : ''} {className}"
|
|
36
|
+
role="alert"
|
|
37
|
+
>
|
|
38
|
+
<span class="twui-message-ind" aria-hidden="true"></span>
|
|
39
|
+
<div class="twui-message-content">
|
|
40
|
+
{@render children()}
|
|
41
|
+
</div>
|
|
42
|
+
{#if closable}
|
|
43
|
+
<button
|
|
44
|
+
type="button"
|
|
45
|
+
class="twui-message-close"
|
|
46
|
+
aria-label={closeLabel}
|
|
47
|
+
onclick={() => (visible = false)}
|
|
48
|
+
>×</button>
|
|
49
|
+
{/if}
|
|
50
|
+
</div>
|
|
51
|
+
{/if}
|
|
52
|
+
|
|
53
|
+
<style>
|
|
54
|
+
.twui-message {
|
|
55
|
+
display: flex;
|
|
56
|
+
align-items: flex-start;
|
|
57
|
+
gap: 8px;
|
|
58
|
+
padding: 10px 12px;
|
|
59
|
+
border: 1px solid var(--twui-rule);
|
|
60
|
+
border-left-width: 3px;
|
|
61
|
+
background: var(--twui-paper-raised);
|
|
62
|
+
font-family: var(--twui-font-mono);
|
|
63
|
+
font-size: 13px;
|
|
64
|
+
color: var(--twui-ink);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.twui-message-small {
|
|
68
|
+
padding: 6px 10px;
|
|
69
|
+
font-size: 12px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.twui-message-outlined {
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.twui-message-ind {
|
|
77
|
+
flex-shrink: 0;
|
|
78
|
+
width: 8px;
|
|
79
|
+
height: 8px;
|
|
80
|
+
margin-top: 3px;
|
|
81
|
+
border-radius: 9999px;
|
|
82
|
+
background: var(--twui-ink-soft);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.twui-message-info {
|
|
86
|
+
border-left-color: var(--twui-info, var(--twui-latte-sky, #04a5e5));
|
|
87
|
+
}
|
|
88
|
+
.twui-message-info .twui-message-ind {
|
|
89
|
+
background: var(--twui-info, var(--twui-latte-sky, #04a5e5));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.twui-message-success {
|
|
93
|
+
border-left-color: var(--twui-signal);
|
|
94
|
+
}
|
|
95
|
+
.twui-message-success .twui-message-ind {
|
|
96
|
+
background: var(--twui-signal);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.twui-message-warn {
|
|
100
|
+
border-left-color: var(--twui-yellow);
|
|
101
|
+
}
|
|
102
|
+
.twui-message-warn .twui-message-ind {
|
|
103
|
+
background: var(--twui-yellow);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.twui-message-error {
|
|
107
|
+
border-left-color: var(--twui-danger);
|
|
108
|
+
}
|
|
109
|
+
.twui-message-error .twui-message-ind {
|
|
110
|
+
background: var(--twui-danger);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.twui-message-content {
|
|
114
|
+
flex: 1;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.twui-message-close {
|
|
118
|
+
flex-shrink: 0;
|
|
119
|
+
border: none;
|
|
120
|
+
background: transparent;
|
|
121
|
+
font-size: 15px;
|
|
122
|
+
line-height: 1;
|
|
123
|
+
color: var(--twui-ink-faint);
|
|
124
|
+
cursor: pointer;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.twui-message-close:hover {
|
|
128
|
+
color: var(--twui-ink);
|
|
129
|
+
}
|
|
130
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
severity?: 'info' | 'success' | 'warn' | 'error';
|
|
4
|
+
variant?: 'simple' | 'outlined';
|
|
5
|
+
size?: 'small';
|
|
6
|
+
closable?: boolean;
|
|
7
|
+
life?: number;
|
|
8
|
+
closeLabel?: string;
|
|
9
|
+
children: Snippet;
|
|
10
|
+
class?: string;
|
|
11
|
+
};
|
|
12
|
+
declare const Message: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
13
|
+
type Message = ReturnType<typeof Message>;
|
|
14
|
+
export default Message;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
value,
|
|
4
|
+
label = true,
|
|
5
|
+
class: className = ''
|
|
6
|
+
}: {
|
|
7
|
+
value?: number;
|
|
8
|
+
label?: boolean;
|
|
9
|
+
class?: string;
|
|
10
|
+
} = $props();
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<div
|
|
14
|
+
class="twui-progress {className}"
|
|
15
|
+
role="progressbar"
|
|
16
|
+
aria-valuenow={value}
|
|
17
|
+
aria-valuemin={0}
|
|
18
|
+
aria-valuemax={100}
|
|
19
|
+
>
|
|
20
|
+
<div
|
|
21
|
+
class="twui-progress-fill {value === undefined ? 'twui-progress-indeterminate' : ''}"
|
|
22
|
+
style={value !== undefined ? `width: ${Math.min(100, Math.max(0, value))}%` : undefined}
|
|
23
|
+
>
|
|
24
|
+
{#if label && value !== undefined}
|
|
25
|
+
<span class="twui-progress-label">{Math.round(value)}%</span>
|
|
26
|
+
{/if}
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<style>
|
|
31
|
+
.twui-progress {
|
|
32
|
+
position: relative;
|
|
33
|
+
height: 14px;
|
|
34
|
+
border: 1px solid var(--twui-rule);
|
|
35
|
+
background: var(--twui-paper);
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.twui-progress-fill {
|
|
40
|
+
display: flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: flex-end;
|
|
43
|
+
height: 100%;
|
|
44
|
+
background: var(--twui-accent);
|
|
45
|
+
transition: width 0.2s ease;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.twui-progress-label {
|
|
49
|
+
padding: 0 6px;
|
|
50
|
+
font-family: var(--twui-font-mono);
|
|
51
|
+
font-size: 10px;
|
|
52
|
+
line-height: 1;
|
|
53
|
+
color: var(--twui-paper);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.twui-progress-indeterminate {
|
|
57
|
+
width: 40%;
|
|
58
|
+
animation: twui-progress-slide 1.2s ease-in-out infinite;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@keyframes twui-progress-slide {
|
|
62
|
+
0% {
|
|
63
|
+
margin-left: -40%;
|
|
64
|
+
}
|
|
65
|
+
100% {
|
|
66
|
+
margin-left: 100%;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
</style>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
let {
|
|
3
|
+
width = '100%',
|
|
4
|
+
height = '16px',
|
|
5
|
+
rounded = false,
|
|
6
|
+
class: className = ''
|
|
7
|
+
}: {
|
|
8
|
+
width?: string;
|
|
9
|
+
height?: string;
|
|
10
|
+
rounded?: boolean;
|
|
11
|
+
class?: string;
|
|
12
|
+
} = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
class="twui-skeleton {rounded ? 'twui-skeleton-rounded' : ''} {className}"
|
|
17
|
+
style={`width: ${width}; height: ${height}`}
|
|
18
|
+
aria-hidden="true"
|
|
19
|
+
></div>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
.twui-skeleton {
|
|
23
|
+
border-radius: 2px;
|
|
24
|
+
background: var(--twui-paper-raised);
|
|
25
|
+
background-image: linear-gradient(
|
|
26
|
+
90deg,
|
|
27
|
+
var(--twui-paper-raised) 0%,
|
|
28
|
+
var(--twui-rule) 50%,
|
|
29
|
+
var(--twui-paper-raised) 100%
|
|
30
|
+
);
|
|
31
|
+
background-size: 200% 100%;
|
|
32
|
+
animation: twui-skeleton-shimmer 1.2s ease-in-out infinite;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.twui-skeleton-rounded {
|
|
36
|
+
border-radius: 9999px;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
@keyframes twui-skeleton-shimmer {
|
|
40
|
+
from {
|
|
41
|
+
background-position: 200% 0;
|
|
42
|
+
}
|
|
43
|
+
to {
|
|
44
|
+
background-position: -200% 0;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
</style>
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
kind = 'info',
|
|
6
|
+
icon,
|
|
7
|
+
children,
|
|
8
|
+
class: className = ''
|
|
9
|
+
}: {
|
|
10
|
+
kind?: 'success' | 'warning' | 'error' | 'info';
|
|
11
|
+
icon?: Snippet;
|
|
12
|
+
children: Snippet;
|
|
13
|
+
class?: string;
|
|
14
|
+
} = $props();
|
|
15
|
+
</script>
|
|
16
|
+
|
|
17
|
+
<span class="twui-status twui-status-{kind} {icon ? 'twui-status-icon' : ''} {className}">
|
|
18
|
+
{#if icon}
|
|
19
|
+
{@render icon()}
|
|
20
|
+
{/if}
|
|
21
|
+
{@render children()}
|
|
22
|
+
</span>
|
|
23
|
+
|
|
24
|
+
<style>
|
|
25
|
+
.twui-status {
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
align-items: center;
|
|
28
|
+
font-family: var(--twui-font-mono);
|
|
29
|
+
font-size: 12px;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.twui-status::before {
|
|
33
|
+
content: '●';
|
|
34
|
+
margin-right: 6px;
|
|
35
|
+
font-size: 8px;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.twui-status-icon::before {
|
|
39
|
+
content: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.twui-status > :global(svg) {
|
|
43
|
+
width: 12px;
|
|
44
|
+
height: 12px;
|
|
45
|
+
margin-right: 6px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.twui-status-success {
|
|
49
|
+
color: var(--twui-signal);
|
|
50
|
+
}
|
|
51
|
+
.twui-status-success::before {
|
|
52
|
+
color: var(--twui-signal);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.twui-status-warning {
|
|
56
|
+
color: var(--twui-yellow);
|
|
57
|
+
}
|
|
58
|
+
.twui-status-warning::before {
|
|
59
|
+
color: var(--twui-yellow);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.twui-status-error {
|
|
63
|
+
color: var(--twui-danger);
|
|
64
|
+
}
|
|
65
|
+
.twui-status-error::before {
|
|
66
|
+
color: var(--twui-danger);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.twui-status-info {
|
|
70
|
+
color: var(--twui-ink-soft);
|
|
71
|
+
}
|
|
72
|
+
.twui-status-info::before {
|
|
73
|
+
color: var(--twui-ink-soft);
|
|
74
|
+
}
|
|
75
|
+
</style>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
kind?: 'success' | 'warning' | 'error' | 'info';
|
|
4
|
+
icon?: Snippet;
|
|
5
|
+
children: Snippet;
|
|
6
|
+
class?: string;
|
|
7
|
+
};
|
|
8
|
+
declare const Status: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
9
|
+
type Status = ReturnType<typeof Status>;
|
|
10
|
+
export default Status;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
position = 'bottom-right',
|
|
6
|
+
closable = false,
|
|
7
|
+
visible = $bindable(true),
|
|
8
|
+
dismissLabel = 'Fechar status',
|
|
9
|
+
style,
|
|
10
|
+
children,
|
|
11
|
+
class: className = ''
|
|
12
|
+
}: {
|
|
13
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
visible?: boolean;
|
|
16
|
+
dismissLabel?: string;
|
|
17
|
+
style?: string;
|
|
18
|
+
children: Snippet;
|
|
19
|
+
class?: string;
|
|
20
|
+
} = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
{#if visible}
|
|
24
|
+
<div
|
|
25
|
+
class="twui-status-pill twui-status-pill-{position} {closable ? 'twui-status-pill-closable' : ''} {className}"
|
|
26
|
+
style={style}
|
|
27
|
+
role="status"
|
|
28
|
+
>
|
|
29
|
+
{@render children()}
|
|
30
|
+
{#if closable}
|
|
31
|
+
<button
|
|
32
|
+
type="button"
|
|
33
|
+
class="twui-status-pill-close"
|
|
34
|
+
aria-label={dismissLabel}
|
|
35
|
+
onclick={() => (visible = false)}
|
|
36
|
+
>×</button>
|
|
37
|
+
{/if}
|
|
38
|
+
</div>
|
|
39
|
+
{/if}
|
|
40
|
+
|
|
41
|
+
<style>
|
|
42
|
+
.twui-status-pill {
|
|
43
|
+
position: fixed;
|
|
44
|
+
z-index: 40;
|
|
45
|
+
display: flex;
|
|
46
|
+
flex-wrap: wrap;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 8px;
|
|
49
|
+
padding: 6px 12px;
|
|
50
|
+
border: 1px solid var(--twui-rule);
|
|
51
|
+
background: var(--twui-paper-raised);
|
|
52
|
+
font-family: var(--twui-font-mono);
|
|
53
|
+
font-size: 12px;
|
|
54
|
+
color: var(--twui-ink);
|
|
55
|
+
box-shadow: var(--twui-shadow-offset, 3px 3px 0 0 var(--twui-rule));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.twui-status-pill-bottom-right {
|
|
59
|
+
right: 1rem;
|
|
60
|
+
bottom: 1.5rem;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.twui-status-pill-bottom-left {
|
|
64
|
+
left: 1rem;
|
|
65
|
+
bottom: 1.5rem;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.twui-status-pill-top-right {
|
|
69
|
+
right: 1rem;
|
|
70
|
+
top: 1rem;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.twui-status-pill-top-left {
|
|
74
|
+
left: 1rem;
|
|
75
|
+
top: 1rem;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.twui-status-pill-close {
|
|
79
|
+
margin-left: 2px;
|
|
80
|
+
padding-left: 8px;
|
|
81
|
+
border: none;
|
|
82
|
+
border-left: 1px solid var(--twui-rule);
|
|
83
|
+
background: transparent;
|
|
84
|
+
font-size: 14px;
|
|
85
|
+
line-height: 1;
|
|
86
|
+
color: var(--twui-ink-faint);
|
|
87
|
+
cursor: pointer;
|
|
88
|
+
transition: color 0.15s ease;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.twui-status-pill-close:hover {
|
|
92
|
+
color: var(--twui-accent);
|
|
93
|
+
}
|
|
94
|
+
</style>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
type $$ComponentProps = {
|
|
3
|
+
position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left';
|
|
4
|
+
closable?: boolean;
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
dismissLabel?: string;
|
|
7
|
+
style?: string;
|
|
8
|
+
children: Snippet;
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
declare const StatusPill: import("svelte").Component<$$ComponentProps, {}, "visible">;
|
|
12
|
+
type StatusPill = ReturnType<typeof StatusPill>;
|
|
13
|
+
export default StatusPill;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { toasts, dismiss, type ToastKind } from './toast.svelte.js';
|
|
3
|
+
|
|
4
|
+
let {
|
|
5
|
+
closeLabel = 'Fechar',
|
|
6
|
+
position = 'top-right'
|
|
7
|
+
}: {
|
|
8
|
+
closeLabel?: string;
|
|
9
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
10
|
+
} = $props();
|
|
11
|
+
|
|
12
|
+
function kindColor(kind: ToastKind): string {
|
|
13
|
+
switch (kind) {
|
|
14
|
+
case 'success':
|
|
15
|
+
return 'var(--twui-signal)';
|
|
16
|
+
case 'error':
|
|
17
|
+
return 'var(--twui-danger)';
|
|
18
|
+
case 'warning':
|
|
19
|
+
return 'var(--twui-yellow)';
|
|
20
|
+
case 'info':
|
|
21
|
+
return 'var(--twui-ink-soft)';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
</script>
|
|
25
|
+
|
|
26
|
+
{#if toasts.current.length > 0}
|
|
27
|
+
<div class="twui-toaster twui-toaster-{position}">
|
|
28
|
+
{#each toasts.current as t (t.id)}
|
|
29
|
+
<div
|
|
30
|
+
class="twui-toast"
|
|
31
|
+
role="status"
|
|
32
|
+
style="border-left: 2px solid {kindColor(t.kind)}"
|
|
33
|
+
>
|
|
34
|
+
<span class="twui-toast-message">{t.message}</span>
|
|
35
|
+
{#if t.action}
|
|
36
|
+
<button class="twui-toast-action" onclick={() => { t.action!.onClick(); dismiss(t.id); }}>
|
|
37
|
+
{t.action.label}
|
|
38
|
+
</button>
|
|
39
|
+
{/if}
|
|
40
|
+
<button class="twui-toast-close" aria-label={closeLabel} onclick={() => dismiss(t.id)}>×</button>
|
|
41
|
+
</div>
|
|
42
|
+
{/each}
|
|
43
|
+
</div>
|
|
44
|
+
{/if}
|
|
45
|
+
|
|
46
|
+
<style>
|
|
47
|
+
.twui-toaster {
|
|
48
|
+
position: fixed;
|
|
49
|
+
z-index: 100;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
gap: 8px;
|
|
53
|
+
max-width: 360px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.twui-toaster-top-right {
|
|
57
|
+
top: 16px;
|
|
58
|
+
right: 16px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.twui-toaster-top-left {
|
|
62
|
+
top: 16px;
|
|
63
|
+
left: 16px;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.twui-toaster-bottom-right {
|
|
67
|
+
bottom: 16px;
|
|
68
|
+
right: 16px;
|
|
69
|
+
flex-direction: column-reverse;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.twui-toaster-bottom-left {
|
|
73
|
+
bottom: 16px;
|
|
74
|
+
left: 16px;
|
|
75
|
+
flex-direction: column-reverse;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.twui-toast {
|
|
79
|
+
display: flex;
|
|
80
|
+
align-items: center;
|
|
81
|
+
gap: 12px;
|
|
82
|
+
padding: 10px 12px;
|
|
83
|
+
border: 1px solid var(--twui-rule);
|
|
84
|
+
background: var(--twui-paper-raised);
|
|
85
|
+
box-shadow: var(--twui-shadow-offset, 3px 3px 0 0 var(--twui-rule));
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.twui-toast-message {
|
|
89
|
+
flex: 1;
|
|
90
|
+
font-family: var(--twui-font-mono);
|
|
91
|
+
font-size: 13px;
|
|
92
|
+
color: var(--twui-ink);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.twui-toast-action {
|
|
96
|
+
border: 1px solid var(--twui-accent);
|
|
97
|
+
background: var(--twui-accent-soft);
|
|
98
|
+
padding: 4px 8px;
|
|
99
|
+
font-family: var(--twui-font-mono);
|
|
100
|
+
font-size: 12px;
|
|
101
|
+
color: var(--twui-accent);
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.twui-toast-action:hover {
|
|
106
|
+
background: var(--twui-accent);
|
|
107
|
+
color: var(--twui-paper);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.twui-toast-close {
|
|
111
|
+
border: none;
|
|
112
|
+
background: transparent;
|
|
113
|
+
font-size: 16px;
|
|
114
|
+
line-height: 1;
|
|
115
|
+
color: var(--twui-ink-faint);
|
|
116
|
+
cursor: pointer;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.twui-toast-close:hover {
|
|
120
|
+
color: var(--twui-ink);
|
|
121
|
+
}
|
|
122
|
+
</style>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
type $$ComponentProps = {
|
|
2
|
+
closeLabel?: string;
|
|
3
|
+
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left';
|
|
4
|
+
};
|
|
5
|
+
declare const Toaster: import("svelte").Component<$$ComponentProps, {}, "">;
|
|
6
|
+
type Toaster = ReturnType<typeof Toaster>;
|
|
7
|
+
export default Toaster;
|