bloko-ui 0.0.1
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 +58 -0
- package/dist/components/Accordion.svelte +107 -0
- package/dist/components/Accordion.svelte.d.ts +14 -0
- package/dist/components/Alert.svelte +136 -0
- package/dist/components/Alert.svelte.d.ts +11 -0
- package/dist/components/Avatar.svelte +82 -0
- package/dist/components/Avatar.svelte.d.ts +9 -0
- package/dist/components/Badge.svelte +61 -0
- package/dist/components/Badge.svelte.d.ts +8 -0
- package/dist/components/Breadcrumb.svelte +74 -0
- package/dist/components/Breadcrumb.svelte.d.ts +10 -0
- package/dist/components/Button.svelte +114 -0
- package/dist/components/Button.svelte.d.ts +12 -0
- package/dist/components/Card.svelte +49 -0
- package/dist/components/Card.svelte.d.ts +9 -0
- package/dist/components/Checkbox.svelte +108 -0
- package/dist/components/Checkbox.svelte.d.ts +10 -0
- package/dist/components/ContextMenu.svelte +132 -0
- package/dist/components/ContextMenu.svelte.d.ts +17 -0
- package/dist/components/Divider.svelte +55 -0
- package/dist/components/Divider.svelte.d.ts +7 -0
- package/dist/components/Dropdown.svelte +156 -0
- package/dist/components/Dropdown.svelte.d.ts +17 -0
- package/dist/components/EmptyState.svelte +79 -0
- package/dist/components/EmptyState.svelte.d.ts +10 -0
- package/dist/components/IconButton.svelte +88 -0
- package/dist/components/IconButton.svelte.d.ts +12 -0
- package/dist/components/Input.svelte +87 -0
- package/dist/components/Input.svelte.d.ts +15 -0
- package/dist/components/LangValue.svelte +124 -0
- package/dist/components/LangValue.svelte.d.ts +8 -0
- package/dist/components/Modal.svelte +136 -0
- package/dist/components/Modal.svelte.d.ts +10 -0
- package/dist/components/NumberInput.svelte +143 -0
- package/dist/components/NumberInput.svelte.d.ts +12 -0
- package/dist/components/Pagination.svelte +83 -0
- package/dist/components/Pagination.svelte.d.ts +9 -0
- package/dist/components/Popover.svelte +95 -0
- package/dist/components/Popover.svelte.d.ts +9 -0
- package/dist/components/Progress.svelte +55 -0
- package/dist/components/Progress.svelte.d.ts +9 -0
- package/dist/components/RadioGroup.svelte +111 -0
- package/dist/components/RadioGroup.svelte.d.ts +15 -0
- package/dist/components/SearchInput.svelte +121 -0
- package/dist/components/SearchInput.svelte.d.ts +10 -0
- package/dist/components/Select.svelte +82 -0
- package/dist/components/Select.svelte.d.ts +15 -0
- package/dist/components/Sidebar.svelte +97 -0
- package/dist/components/Sidebar.svelte.d.ts +13 -0
- package/dist/components/Skeleton.svelte +47 -0
- package/dist/components/Skeleton.svelte.d.ts +9 -0
- package/dist/components/Spinner.svelte +58 -0
- package/dist/components/Spinner.svelte.d.ts +7 -0
- package/dist/components/Switch.svelte +102 -0
- package/dist/components/Switch.svelte.d.ts +9 -0
- package/dist/components/Table.svelte +78 -0
- package/dist/components/Table.svelte.d.ts +6 -0
- package/dist/components/Tabs.svelte +74 -0
- package/dist/components/Tabs.svelte.d.ts +12 -0
- package/dist/components/Tag.svelte +75 -0
- package/dist/components/Tag.svelte.d.ts +9 -0
- package/dist/components/Textarea.svelte +63 -0
- package/dist/components/Textarea.svelte.d.ts +11 -0
- package/dist/components/Toast.svelte +103 -0
- package/dist/components/Toast.svelte.d.ts +10 -0
- package/dist/components/Tooltip.svelte +75 -0
- package/dist/components/Tooltip.svelte.d.ts +9 -0
- package/dist/components/TopNav.svelte +72 -0
- package/dist/components/TopNav.svelte.d.ts +12 -0
- package/dist/components/TruncatedText.svelte +46 -0
- package/dist/components/TruncatedText.svelte.d.ts +9 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +36 -0
- package/package.json +63 -0
package/README.md
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Svelte library
|
|
2
|
+
|
|
3
|
+
Everything you need to build a Svelte library, powered by [`sv`](https://npmjs.com/package/sv).
|
|
4
|
+
|
|
5
|
+
Read more about creating a library [in the docs](https://svelte.dev/docs/kit/packaging).
|
|
6
|
+
|
|
7
|
+
## Creating a project
|
|
8
|
+
|
|
9
|
+
If you're seeing this, you've probably already done this step. Congrats!
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
# create a new project in the current directory
|
|
13
|
+
npx sv create
|
|
14
|
+
|
|
15
|
+
# create a new project in my-app
|
|
16
|
+
npx sv create my-app
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Developing
|
|
20
|
+
|
|
21
|
+
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
npm run dev
|
|
25
|
+
|
|
26
|
+
# or start the server and open the app in a new browser tab
|
|
27
|
+
npm run dev -- --open
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Everything inside `src/lib` is part of your library, everything inside `src/routes` can be used as a showcase or preview app.
|
|
31
|
+
|
|
32
|
+
## Building
|
|
33
|
+
|
|
34
|
+
To build your library:
|
|
35
|
+
|
|
36
|
+
```sh
|
|
37
|
+
npm pack
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
To create a production version of your showcase app:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
npm run build
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
You can preview the production build with `npm run preview`.
|
|
47
|
+
|
|
48
|
+
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
|
|
49
|
+
|
|
50
|
+
## Publishing
|
|
51
|
+
|
|
52
|
+
Go into the `package.json` and give your package the desired name through the `"name"` option. Also consider adding a `"license"` field and point it to a `LICENSE` file which you can create from a template (one popular option is the [MIT license](https://opensource.org/license/mit/)).
|
|
53
|
+
|
|
54
|
+
To publish your library to [npm](https://www.npmjs.com):
|
|
55
|
+
|
|
56
|
+
```sh
|
|
57
|
+
npm publish
|
|
58
|
+
```
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Item {
|
|
5
|
+
id: string;
|
|
6
|
+
title: string;
|
|
7
|
+
content: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
items?: Item[];
|
|
12
|
+
multiple?: boolean;
|
|
13
|
+
children?: Snippet;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
let { items = [], multiple = false, children }: Props = $props();
|
|
17
|
+
|
|
18
|
+
let openItems: Set<string> = $state(new Set());
|
|
19
|
+
|
|
20
|
+
function toggle(id: string) {
|
|
21
|
+
if (openItems.has(id)) {
|
|
22
|
+
openItems.delete(id);
|
|
23
|
+
openItems = new Set(openItems);
|
|
24
|
+
} else {
|
|
25
|
+
if (!multiple) {
|
|
26
|
+
openItems = new Set([id]);
|
|
27
|
+
} else {
|
|
28
|
+
openItems.add(id);
|
|
29
|
+
openItems = new Set(openItems);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<div class="accordion">
|
|
36
|
+
{#if children}
|
|
37
|
+
{@render children()}
|
|
38
|
+
{:else}
|
|
39
|
+
{#each items as item}
|
|
40
|
+
<div class="accordion-item" class:open={openItems.has(item.id)}>
|
|
41
|
+
<button class="accordion-header" onclick={() => toggle(item.id)}>
|
|
42
|
+
<span>{item.title}</span>
|
|
43
|
+
<svg class="chevron" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
44
|
+
<path d="M6 9l6 6 6-6" />
|
|
45
|
+
</svg>
|
|
46
|
+
</button>
|
|
47
|
+
{#if openItems.has(item.id)}
|
|
48
|
+
<div class="accordion-content">
|
|
49
|
+
{item.content}
|
|
50
|
+
</div>
|
|
51
|
+
{/if}
|
|
52
|
+
</div>
|
|
53
|
+
{/each}
|
|
54
|
+
{/if}
|
|
55
|
+
</div>
|
|
56
|
+
|
|
57
|
+
<style>
|
|
58
|
+
.accordion {
|
|
59
|
+
border: 1px solid #e4e4e7;
|
|
60
|
+
border-radius: 6px;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.accordion-item {
|
|
65
|
+
border-bottom: 1px solid #e4e4e7;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.accordion-item:last-child {
|
|
69
|
+
border-bottom: none;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.accordion-header {
|
|
73
|
+
display: flex;
|
|
74
|
+
align-items: center;
|
|
75
|
+
justify-content: space-between;
|
|
76
|
+
width: 100%;
|
|
77
|
+
padding: 12px 14px;
|
|
78
|
+
font-size: 13px;
|
|
79
|
+
font-weight: 500;
|
|
80
|
+
color: #18181b;
|
|
81
|
+
text-align: left;
|
|
82
|
+
background: white;
|
|
83
|
+
border: none;
|
|
84
|
+
cursor: pointer;
|
|
85
|
+
transition: background-color 0.15s ease;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
.accordion-header:hover {
|
|
89
|
+
background: #fafafa;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.chevron {
|
|
93
|
+
color: #71717a;
|
|
94
|
+
transition: transform 0.2s ease;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.accordion-item.open .chevron {
|
|
98
|
+
transform: rotate(180deg);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.accordion-content {
|
|
102
|
+
padding: 0 14px 14px;
|
|
103
|
+
font-size: 12px;
|
|
104
|
+
color: #52525b;
|
|
105
|
+
line-height: 1.5;
|
|
106
|
+
}
|
|
107
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Item {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
interface Props {
|
|
8
|
+
items?: Item[];
|
|
9
|
+
multiple?: boolean;
|
|
10
|
+
children?: Snippet;
|
|
11
|
+
}
|
|
12
|
+
declare const Accordion: import("svelte").Component<Props, {}, "">;
|
|
13
|
+
type Accordion = ReturnType<typeof Accordion>;
|
|
14
|
+
export default Accordion;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
6
|
+
title?: string;
|
|
7
|
+
dismissible?: boolean;
|
|
8
|
+
ondismiss?: () => void;
|
|
9
|
+
children?: Snippet;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
variant = 'info',
|
|
14
|
+
title,
|
|
15
|
+
dismissible = false,
|
|
16
|
+
ondismiss,
|
|
17
|
+
children
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
|
|
20
|
+
let visible = $state(true);
|
|
21
|
+
|
|
22
|
+
function dismiss() {
|
|
23
|
+
visible = false;
|
|
24
|
+
ondismiss?.();
|
|
25
|
+
}
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
{#if visible}
|
|
29
|
+
<div class="alert {variant}" role="alert">
|
|
30
|
+
<div class="icon">
|
|
31
|
+
{#if variant === 'info'}
|
|
32
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
33
|
+
<circle cx="12" cy="12" r="10" />
|
|
34
|
+
<path d="M12 16v-4m0-4h.01" />
|
|
35
|
+
</svg>
|
|
36
|
+
{:else if variant === 'success'}
|
|
37
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
38
|
+
<path d="M22 11.08V12a10 10 0 1 1-5.93-9.14" />
|
|
39
|
+
<path d="M22 4L12 14.01l-3-3" />
|
|
40
|
+
</svg>
|
|
41
|
+
{:else if variant === 'warning'}
|
|
42
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
43
|
+
<path d="M10.29 3.86L1.82 18a2 2 0 0 0 1.71 3h16.94a2 2 0 0 0 1.71-3L13.71 3.86a2 2 0 0 0-3.42 0z" />
|
|
44
|
+
<path d="M12 9v4m0 4h.01" />
|
|
45
|
+
</svg>
|
|
46
|
+
{:else if variant === 'error'}
|
|
47
|
+
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
48
|
+
<circle cx="12" cy="12" r="10" />
|
|
49
|
+
<path d="M15 9l-6 6m0-6l6 6" />
|
|
50
|
+
</svg>
|
|
51
|
+
{/if}
|
|
52
|
+
</div>
|
|
53
|
+
<div class="content">
|
|
54
|
+
{#if title}
|
|
55
|
+
<div class="title">{title}</div>
|
|
56
|
+
{/if}
|
|
57
|
+
{#if children}
|
|
58
|
+
<div class="message">{@render children()}</div>
|
|
59
|
+
{/if}
|
|
60
|
+
</div>
|
|
61
|
+
{#if dismissible}
|
|
62
|
+
<button class="dismiss" onclick={dismiss} aria-label="Dismiss">
|
|
63
|
+
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
64
|
+
<path d="M18 6L6 18M6 6l12 12" />
|
|
65
|
+
</svg>
|
|
66
|
+
</button>
|
|
67
|
+
{/if}
|
|
68
|
+
</div>
|
|
69
|
+
{/if}
|
|
70
|
+
|
|
71
|
+
<style>
|
|
72
|
+
.alert {
|
|
73
|
+
display: flex;
|
|
74
|
+
gap: 10px;
|
|
75
|
+
padding: 12px;
|
|
76
|
+
border-radius: 6px;
|
|
77
|
+
font-size: 12px;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.alert.info {
|
|
81
|
+
background: #eff6ff;
|
|
82
|
+
border: 1px solid #bfdbfe;
|
|
83
|
+
color: #1e40af;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.alert.success {
|
|
87
|
+
background: #f0fdf4;
|
|
88
|
+
border: 1px solid #bbf7d0;
|
|
89
|
+
color: #166534;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.alert.warning {
|
|
93
|
+
background: #fffbeb;
|
|
94
|
+
border: 1px solid #fde68a;
|
|
95
|
+
color: #92400e;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.alert.error {
|
|
99
|
+
background: #fef2f2;
|
|
100
|
+
border: 1px solid #fecaca;
|
|
101
|
+
color: #991b1b;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.icon {
|
|
105
|
+
flex-shrink: 0;
|
|
106
|
+
margin-top: 1px;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.content {
|
|
110
|
+
flex: 1;
|
|
111
|
+
min-width: 0;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
.title {
|
|
115
|
+
font-weight: 600;
|
|
116
|
+
margin-bottom: 2px;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
.message {
|
|
120
|
+
opacity: 0.9;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
.dismiss {
|
|
124
|
+
flex-shrink: 0;
|
|
125
|
+
padding: 2px;
|
|
126
|
+
background: none;
|
|
127
|
+
border: none;
|
|
128
|
+
cursor: pointer;
|
|
129
|
+
opacity: 0.6;
|
|
130
|
+
transition: opacity 0.15s;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.dismiss:hover {
|
|
134
|
+
opacity: 1;
|
|
135
|
+
}
|
|
136
|
+
</style>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Snippet } from 'svelte';
|
|
2
|
+
interface Props {
|
|
3
|
+
variant?: 'info' | 'success' | 'warning' | 'error';
|
|
4
|
+
title?: string;
|
|
5
|
+
dismissible?: boolean;
|
|
6
|
+
ondismiss?: () => void;
|
|
7
|
+
children?: Snippet;
|
|
8
|
+
}
|
|
9
|
+
declare const Alert: import("svelte").Component<Props, {}, "">;
|
|
10
|
+
type Alert = ReturnType<typeof Alert>;
|
|
11
|
+
export default Alert;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
src?: string;
|
|
4
|
+
alt?: string;
|
|
5
|
+
name?: string;
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { src, alt = '', name, size = 'md' }: Props = $props();
|
|
10
|
+
|
|
11
|
+
let initials = $derived(
|
|
12
|
+
name
|
|
13
|
+
? name
|
|
14
|
+
.split(' ')
|
|
15
|
+
.map((n) => n[0])
|
|
16
|
+
.slice(0, 2)
|
|
17
|
+
.join('')
|
|
18
|
+
.toUpperCase()
|
|
19
|
+
: ''
|
|
20
|
+
);
|
|
21
|
+
|
|
22
|
+
let imageError = $state(false);
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<div class="avatar {size}">
|
|
26
|
+
{#if src && !imageError}
|
|
27
|
+
<img {src} {alt} onerror={() => (imageError = true)} />
|
|
28
|
+
{:else if initials}
|
|
29
|
+
<span class="initials">{initials}</span>
|
|
30
|
+
{:else}
|
|
31
|
+
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
|
|
32
|
+
<path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2" />
|
|
33
|
+
<circle cx="12" cy="7" r="4" />
|
|
34
|
+
</svg>
|
|
35
|
+
{/if}
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
<style>
|
|
39
|
+
.avatar {
|
|
40
|
+
display: inline-flex;
|
|
41
|
+
align-items: center;
|
|
42
|
+
justify-content: center;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
background: #e4e4e7;
|
|
45
|
+
color: #71717a;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
flex-shrink: 0;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.avatar.sm {
|
|
51
|
+
width: 24px;
|
|
52
|
+
height: 24px;
|
|
53
|
+
font-size: 10px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.avatar.md {
|
|
57
|
+
width: 32px;
|
|
58
|
+
height: 32px;
|
|
59
|
+
font-size: 12px;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.avatar.lg {
|
|
63
|
+
width: 40px;
|
|
64
|
+
height: 40px;
|
|
65
|
+
font-size: 14px;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.avatar img {
|
|
69
|
+
width: 100%;
|
|
70
|
+
height: 100%;
|
|
71
|
+
object-fit: cover;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.initials {
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.avatar svg {
|
|
79
|
+
width: 60%;
|
|
80
|
+
height: 60%;
|
|
81
|
+
}
|
|
82
|
+
</style>
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
variant?: 'default' | 'muted' | 'success' | 'warning' | 'error';
|
|
4
|
+
label?: string;
|
|
5
|
+
children?: import('svelte').Snippet;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
let {
|
|
9
|
+
variant = 'default',
|
|
10
|
+
label,
|
|
11
|
+
children
|
|
12
|
+
}: Props = $props();
|
|
13
|
+
</script>
|
|
14
|
+
|
|
15
|
+
<span class="badge badge-{variant}">
|
|
16
|
+
{#if children}
|
|
17
|
+
{@render children()}
|
|
18
|
+
{:else if label}
|
|
19
|
+
{label}
|
|
20
|
+
{/if}
|
|
21
|
+
</span>
|
|
22
|
+
|
|
23
|
+
<style>
|
|
24
|
+
.badge {
|
|
25
|
+
display: inline-flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
height: 18px;
|
|
28
|
+
padding: 0 6px;
|
|
29
|
+
border-radius: 3px;
|
|
30
|
+
font-size: 10px;
|
|
31
|
+
font-weight: 500;
|
|
32
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
33
|
+
text-transform: uppercase;
|
|
34
|
+
letter-spacing: 0.02em;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.badge-default {
|
|
38
|
+
background: #f4f4f5;
|
|
39
|
+
color: #52525b;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.badge-muted {
|
|
43
|
+
background: #e4e4e7;
|
|
44
|
+
color: #71717a;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.badge-success {
|
|
48
|
+
background: #dcfce7;
|
|
49
|
+
color: #166534;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.badge-warning {
|
|
53
|
+
background: #fef9c3;
|
|
54
|
+
color: #854d0e;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.badge-error {
|
|
58
|
+
background: #fee2e2;
|
|
59
|
+
color: #991b1b;
|
|
60
|
+
}
|
|
61
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
variant?: 'default' | 'muted' | 'success' | 'warning' | 'error';
|
|
3
|
+
label?: string;
|
|
4
|
+
children?: import('svelte').Snippet;
|
|
5
|
+
}
|
|
6
|
+
declare const Badge: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type Badge = ReturnType<typeof Badge>;
|
|
8
|
+
export default Badge;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Crumb {
|
|
3
|
+
label: string;
|
|
4
|
+
href?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
items: Crumb[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { items }: Props = $props();
|
|
12
|
+
</script>
|
|
13
|
+
|
|
14
|
+
<nav class="breadcrumb" aria-label="Breadcrumb">
|
|
15
|
+
<ol>
|
|
16
|
+
{#each items as item, i}
|
|
17
|
+
<li>
|
|
18
|
+
{#if item.href && i < items.length - 1}
|
|
19
|
+
<a href={item.href}>{item.label}</a>
|
|
20
|
+
{:else}
|
|
21
|
+
<span class:current={i === items.length - 1}>{item.label}</span>
|
|
22
|
+
{/if}
|
|
23
|
+
{#if i < items.length - 1}
|
|
24
|
+
<span class="separator">/</span>
|
|
25
|
+
{/if}
|
|
26
|
+
</li>
|
|
27
|
+
{/each}
|
|
28
|
+
</ol>
|
|
29
|
+
</nav>
|
|
30
|
+
|
|
31
|
+
<style>
|
|
32
|
+
.breadcrumb {
|
|
33
|
+
font-size: 12px;
|
|
34
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ol {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
gap: 0;
|
|
41
|
+
list-style: none;
|
|
42
|
+
margin: 0;
|
|
43
|
+
padding: 0;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
li {
|
|
47
|
+
display: flex;
|
|
48
|
+
align-items: center;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
a {
|
|
52
|
+
color: #71717a;
|
|
53
|
+
text-decoration: none;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
a:hover {
|
|
57
|
+
color: #18181b;
|
|
58
|
+
text-decoration: underline;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
span {
|
|
62
|
+
color: #71717a;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
span.current {
|
|
66
|
+
color: #18181b;
|
|
67
|
+
font-weight: 500;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
.separator {
|
|
71
|
+
margin: 0 6px;
|
|
72
|
+
color: #d4d4d8;
|
|
73
|
+
}
|
|
74
|
+
</style>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface Props {
|
|
3
|
+
variant?: 'default' | 'primary' | 'ghost' | 'destructive';
|
|
4
|
+
size?: 'sm' | 'md';
|
|
5
|
+
label?: string;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
type?: 'button' | 'submit' | 'reset';
|
|
8
|
+
onclick?: (e: MouseEvent) => void;
|
|
9
|
+
children?: import('svelte').Snippet;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
let {
|
|
13
|
+
variant = 'default',
|
|
14
|
+
size = 'sm',
|
|
15
|
+
label,
|
|
16
|
+
disabled = false,
|
|
17
|
+
type = 'button',
|
|
18
|
+
onclick,
|
|
19
|
+
children
|
|
20
|
+
}: Props = $props();
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<button
|
|
24
|
+
class="btn btn-{variant} btn-{size}"
|
|
25
|
+
{disabled}
|
|
26
|
+
{type}
|
|
27
|
+
{onclick}
|
|
28
|
+
>
|
|
29
|
+
{#if children}
|
|
30
|
+
{@render children()}
|
|
31
|
+
{:else if label}
|
|
32
|
+
{label}
|
|
33
|
+
{/if}
|
|
34
|
+
</button>
|
|
35
|
+
|
|
36
|
+
<style>
|
|
37
|
+
.btn {
|
|
38
|
+
display: inline-flex;
|
|
39
|
+
align-items: center;
|
|
40
|
+
justify-content: center;
|
|
41
|
+
gap: 0.25rem;
|
|
42
|
+
border-radius: 4px;
|
|
43
|
+
font-size: 12px;
|
|
44
|
+
font-weight: 500;
|
|
45
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
transition: background 0.1s, border-color 0.1s;
|
|
48
|
+
white-space: nowrap;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.btn:disabled {
|
|
52
|
+
opacity: 0.5;
|
|
53
|
+
cursor: not-allowed;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.btn:focus-visible {
|
|
57
|
+
outline: 2px solid #6366f1;
|
|
58
|
+
outline-offset: 1px;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/* Sizes - compact */
|
|
62
|
+
.btn-sm {
|
|
63
|
+
height: 24px;
|
|
64
|
+
padding: 0 8px;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.btn-md {
|
|
68
|
+
height: 28px;
|
|
69
|
+
padding: 0 12px;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/* Variants */
|
|
73
|
+
.btn-default {
|
|
74
|
+
background: white;
|
|
75
|
+
border: 1px solid #e2e2e2;
|
|
76
|
+
color: #333;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
.btn-default:hover:not(:disabled) {
|
|
80
|
+
background: #fafafa;
|
|
81
|
+
border-color: #d0d0d0;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.btn-primary {
|
|
85
|
+
background: #18181b;
|
|
86
|
+
border: 1px solid #18181b;
|
|
87
|
+
color: white;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.btn-primary:hover:not(:disabled) {
|
|
91
|
+
background: #27272a;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.btn-ghost {
|
|
95
|
+
background: transparent;
|
|
96
|
+
border: 1px solid transparent;
|
|
97
|
+
color: #666;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.btn-ghost:hover:not(:disabled) {
|
|
101
|
+
background: #f4f4f5;
|
|
102
|
+
color: #333;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.btn-destructive {
|
|
106
|
+
background: #ef4444;
|
|
107
|
+
border: 1px solid #ef4444;
|
|
108
|
+
color: white;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.btn-destructive:hover:not(:disabled) {
|
|
112
|
+
background: #dc2626;
|
|
113
|
+
}
|
|
114
|
+
</style>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface Props {
|
|
2
|
+
variant?: 'default' | 'primary' | 'ghost' | 'destructive';
|
|
3
|
+
size?: 'sm' | 'md';
|
|
4
|
+
label?: string;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
type?: 'button' | 'submit' | 'reset';
|
|
7
|
+
onclick?: (e: MouseEvent) => void;
|
|
8
|
+
children?: import('svelte').Snippet;
|
|
9
|
+
}
|
|
10
|
+
declare const Button: import("svelte").Component<Props, {}, "">;
|
|
11
|
+
type Button = ReturnType<typeof Button>;
|
|
12
|
+
export default Button;
|