@karbonjs/ui-svelte 0.3.1 → 0.3.3
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 +175 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
# @karbonjs/ui-svelte
|
|
2
|
+
|
|
3
|
+
32 ready-to-use Svelte 5 components for Karbon applications. Styled with Tailwind CSS and `@karbonjs/ui-core` design tokens. Ships as source — no build step needed.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @karbonjs/ui-svelte
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Peer dependency: `svelte ^5.0.0`
|
|
12
|
+
|
|
13
|
+
## Setup
|
|
14
|
+
|
|
15
|
+
Import the design tokens CSS in your app entry point:
|
|
16
|
+
|
|
17
|
+
```css
|
|
18
|
+
@import '@karbonjs/ui-core/css';
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Components
|
|
22
|
+
|
|
23
|
+
### Button
|
|
24
|
+
|
|
25
|
+
```svelte
|
|
26
|
+
<script>
|
|
27
|
+
import { Button, ButtonBrand } from '@karbonjs/ui-svelte'
|
|
28
|
+
</script>
|
|
29
|
+
|
|
30
|
+
<Button variant="primary" size="md" onclick={handleClick}>Save</Button>
|
|
31
|
+
<Button variant="outline" loading>Loading...</Button>
|
|
32
|
+
<ButtonBrand brand="github" href="https://github.com" />
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
### Form
|
|
36
|
+
|
|
37
|
+
```svelte
|
|
38
|
+
<script>
|
|
39
|
+
import { Input, Select, Checkbox, Toggle, Textarea, Radio, Slider, DatePicker, ColorPicker } from '@karbonjs/ui-svelte'
|
|
40
|
+
</script>
|
|
41
|
+
|
|
42
|
+
<Input label="Email" type="email" bind:value={email} error="Invalid email" />
|
|
43
|
+
<Select label="Country" options={countries} bind:value={country} />
|
|
44
|
+
<Checkbox label="Accept terms" bind:checked={accepted} />
|
|
45
|
+
<Toggle label="Dark mode" bind:checked={dark} />
|
|
46
|
+
<Textarea label="Bio" bind:value={bio} maxlength={500} />
|
|
47
|
+
<Radio name="plan" options={plans} bind:value={plan} />
|
|
48
|
+
<Slider min={0} max={100} bind:value={volume} />
|
|
49
|
+
<DatePicker label="Date" bind:value={date} />
|
|
50
|
+
<ColorPicker label="Color" bind:value={color} />
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Data
|
|
54
|
+
|
|
55
|
+
```svelte
|
|
56
|
+
<script>
|
|
57
|
+
import { DataTable, Pagination } from '@karbonjs/ui-svelte'
|
|
58
|
+
</script>
|
|
59
|
+
|
|
60
|
+
<DataTable columns={cols} rows={data} sortable striped />
|
|
61
|
+
<Pagination total={100} perPage={10} page={1} onchange={handlePage} />
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Layout
|
|
65
|
+
|
|
66
|
+
```svelte
|
|
67
|
+
<script>
|
|
68
|
+
import { Card, PageHeader, EmptyState } from '@karbonjs/ui-svelte'
|
|
69
|
+
</script>
|
|
70
|
+
|
|
71
|
+
<PageHeader title="Articles" subtitle="Manage your content" />
|
|
72
|
+
<Card title="Stats" variant="elevated">{children}</Card>
|
|
73
|
+
<EmptyState icon="inbox" title="No results" description="Try another search" />
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Overlay
|
|
77
|
+
|
|
78
|
+
```svelte
|
|
79
|
+
<script>
|
|
80
|
+
import { Modal, Dialog, Toast, ImgBox } from '@karbonjs/ui-svelte'
|
|
81
|
+
</script>
|
|
82
|
+
|
|
83
|
+
<Modal open={showModal} onclose={() => showModal = false} title="Confirm">
|
|
84
|
+
<p>Are you sure?</p>
|
|
85
|
+
</Modal>
|
|
86
|
+
|
|
87
|
+
<Dialog open={showDialog} title="Delete?" confirmLabel="Delete" variant="danger"
|
|
88
|
+
onconfirm={handleDelete} oncancel={() => showDialog = false} />
|
|
89
|
+
|
|
90
|
+
<Toast message="Saved!" type="success" />
|
|
91
|
+
|
|
92
|
+
<ImgBox images={gallery} open={showLightbox} startIndex={0}
|
|
93
|
+
onclose={() => showLightbox = false} />
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Image
|
|
97
|
+
|
|
98
|
+
```svelte
|
|
99
|
+
<script>
|
|
100
|
+
import { Image, ImgZoom, ImageCompare } from '@karbonjs/ui-svelte'
|
|
101
|
+
</script>
|
|
102
|
+
|
|
103
|
+
<Image src="/photo.jpg" alt="Photo" lazy rounded />
|
|
104
|
+
<ImgZoom src="/detail.jpg" alt="Zoom on hover" />
|
|
105
|
+
<ImageCompare before="/before.jpg" after="/after.jpg" />
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
### Navigation & Feedback
|
|
109
|
+
|
|
110
|
+
```svelte
|
|
111
|
+
<script>
|
|
112
|
+
import { Tabs, Breadcrumb, Dropdown, Accordion } from '@karbonjs/ui-svelte'
|
|
113
|
+
import { Badge, AlertMessage, Progress, Tooltip, Avatar } from '@karbonjs/ui-svelte'
|
|
114
|
+
import { Skeleton, Divider, Kbd, Carousel, CodeBlock } from '@karbonjs/ui-svelte'
|
|
115
|
+
</script>
|
|
116
|
+
|
|
117
|
+
<Tabs items={[{ label: 'Tab 1', value: 'tab1' }]} active="tab1" onchange={handleTab} />
|
|
118
|
+
<Breadcrumb items={[{ label: 'Home', href: '/' }, { label: 'Articles' }]} />
|
|
119
|
+
<Dropdown items={menuItems} label="Actions" />
|
|
120
|
+
<Accordion items={[{ title: 'FAQ 1', content: 'Answer...' }]} />
|
|
121
|
+
|
|
122
|
+
<Badge variant="success">Published</Badge>
|
|
123
|
+
<AlertMessage type="warning" message="Check your input" />
|
|
124
|
+
<Progress value={75} max={100} />
|
|
125
|
+
<Tooltip content="More info"><span>Hover me</span></Tooltip>
|
|
126
|
+
<Avatar src="/avatar.jpg" alt="John" size="md" />
|
|
127
|
+
|
|
128
|
+
<Skeleton width="100%" height="1rem" />
|
|
129
|
+
<Divider label="or" />
|
|
130
|
+
<Kbd keys={['Ctrl', 'S']} />
|
|
131
|
+
<Carousel images={slides} autoplay interval={5000} />
|
|
132
|
+
<CodeBlock code={snippet} language="typescript" />
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Rich Text Editor
|
|
136
|
+
|
|
137
|
+
```svelte
|
|
138
|
+
<script>
|
|
139
|
+
import { RichTextEditor } from '@karbonjs/ui-svelte'
|
|
140
|
+
</script>
|
|
141
|
+
|
|
142
|
+
<RichTextEditor bind:value={content} placeholder="Write something..." />
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
WYSIWYG editor with toolbar (bold, italic, links, lists, images, headings), media support, and XSS sanitization.
|
|
146
|
+
|
|
147
|
+
## Full Component List
|
|
148
|
+
|
|
149
|
+
| Category | Components |
|
|
150
|
+
|----------|-----------|
|
|
151
|
+
| **Button** | `Button`, `ButtonBrand` |
|
|
152
|
+
| **Form** | `Input`, `Select`, `Checkbox`, `Toggle`, `Textarea`, `Radio`, `Slider`, `DatePicker`, `ColorPicker` |
|
|
153
|
+
| **Data** | `DataTable`, `Pagination` |
|
|
154
|
+
| **Layout** | `Card`, `PageHeader`, `EmptyState` |
|
|
155
|
+
| **Overlay** | `Modal`, `Dialog`, `Toast`, `ImgBox` |
|
|
156
|
+
| **Image** | `Image`, `ImgZoom`, `ImageCompare` |
|
|
157
|
+
| **Navigation** | `Tabs`, `Breadcrumb`, `Dropdown`, `Accordion` |
|
|
158
|
+
| **Feedback** | `Badge`, `AlertMessage`, `Progress`, `Tooltip`, `Avatar` |
|
|
159
|
+
| **Misc** | `Skeleton`, `Divider`, `Kbd`, `Carousel`, `CodeBlock` |
|
|
160
|
+
| **Editor** | `RichTextEditor` |
|
|
161
|
+
|
|
162
|
+
## Theming
|
|
163
|
+
|
|
164
|
+
All components use `--karbon-*` CSS variables from `@karbonjs/ui-core`. Import a built-in theme or create your own:
|
|
165
|
+
|
|
166
|
+
```css
|
|
167
|
+
@import '@karbonjs/ui-core/css';
|
|
168
|
+
@import '@karbonjs/ui-core/themes/ocean.css';
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Available themes: `default`, `ocean`, `forest`, `sunset`, `midnight`, `aurora`, `neon`, `rose`, `corporate`, `minimal`.
|
|
172
|
+
|
|
173
|
+
## License
|
|
174
|
+
|
|
175
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@karbonjs/ui-svelte",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"description": "Karbon UI components for Svelte 5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"svelte": "src/index.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"simple-icons": "^16.12.0",
|
|
19
|
-
"@karbonjs/ui-core": "0.3.
|
|
19
|
+
"@karbonjs/ui-core": "0.3.3"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"svelte": "^5.0.0"
|