@makolabs/ripple 0.0.1-dev.7 → 0.0.1-dev.8
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 +393 -53
- package/dist/button/Button.svelte +5 -3
- package/dist/button/Button.svelte.d.ts +1 -1
- package/dist/button/button.d.ts +40 -63
- package/dist/button/button.js +15 -14
- package/dist/charts/Chart.svelte +533 -0
- package/dist/charts/Chart.svelte.d.ts +4 -0
- package/dist/drawer/Drawer.svelte +13 -2
- package/dist/drawer/Drawer.svelte.d.ts +1 -1
- package/dist/drawer/drawer.d.ts +0 -17
- package/dist/elements/alert/Alert.svelte +53 -0
- package/dist/elements/alert/Alert.svelte.d.ts +4 -0
- package/dist/elements/badge/Badge.svelte +13 -5
- package/dist/elements/badge/Badge.svelte.d.ts +1 -1
- package/dist/elements/badge/badge.d.ts +0 -12
- package/dist/elements/dropdown/Dropdown.svelte +32 -37
- package/dist/elements/dropdown/Dropdown.svelte.d.ts +1 -1
- package/dist/elements/dropdown/Select.svelte +143 -59
- package/dist/elements/dropdown/Select.svelte.d.ts +1 -1
- package/dist/elements/dropdown/dropdown.d.ts +34 -57
- package/dist/elements/dropdown/dropdown.js +10 -4
- package/dist/elements/dropdown/select.d.ts +34 -54
- package/dist/elements/dropdown/select.js +22 -14
- package/dist/elements/file-upload/FileUpload.svelte +213 -0
- package/dist/elements/file-upload/FileUpload.svelte.d.ts +4 -0
- package/dist/elements/progress/Progress.svelte +87 -0
- package/dist/elements/progress/Progress.svelte.d.ts +4 -0
- package/dist/elements/timeline/Timeline.svelte +92 -0
- package/dist/elements/timeline/Timeline.svelte.d.ts +7 -0
- package/dist/forms/Checkbox.svelte +54 -0
- package/dist/forms/Checkbox.svelte.d.ts +4 -0
- package/dist/forms/DateRange.svelte +493 -0
- package/dist/forms/DateRange.svelte.d.ts +4 -0
- package/dist/forms/Form.svelte +39 -0
- package/dist/forms/Form.svelte.d.ts +4 -0
- package/dist/forms/Input.svelte +86 -0
- package/dist/forms/Input.svelte.d.ts +4 -0
- package/dist/forms/NumberInput.svelte +159 -0
- package/dist/forms/NumberInput.svelte.d.ts +4 -0
- package/dist/forms/RadioInputs.svelte +64 -0
- package/dist/forms/RadioInputs.svelte.d.ts +4 -0
- package/dist/forms/RadioPill.svelte +66 -0
- package/dist/forms/RadioPill.svelte.d.ts +4 -0
- package/dist/forms/Slider.svelte +342 -0
- package/dist/forms/Slider.svelte.d.ts +4 -0
- package/dist/forms/Tags.svelte +181 -0
- package/dist/forms/Tags.svelte.d.ts +4 -0
- package/dist/forms/Toggle.svelte +132 -0
- package/dist/forms/Toggle.svelte.d.ts +4 -0
- package/dist/forms/slider.d.ts +143 -0
- package/dist/forms/slider.js +62 -0
- package/dist/header/Breadcrumbs.svelte +2 -1
- package/dist/header/Breadcrumbs.svelte.d.ts +1 -1
- package/dist/header/PageHeader.svelte +2 -2
- package/dist/header/PageHeader.svelte.d.ts +1 -1
- package/dist/header/breadcrumbs.d.ts +20 -14
- package/dist/header/breadcrumbs.js +6 -0
- package/dist/header/pageheaders.d.ts +1 -1
- package/dist/helper/date.d.ts +7 -0
- package/dist/helper/date.js +15 -0
- package/dist/index.d.ts +742 -9
- package/dist/index.js +59 -16
- package/dist/layout/card/Card.svelte +5 -8
- package/dist/layout/card/Card.svelte.d.ts +1 -1
- package/dist/layout/card/StatsCard.svelte +116 -87
- package/dist/layout/card/card.d.ts +22 -33
- package/dist/layout/card/card.js +9 -8
- package/dist/layout/card/stats-card.d.ts +23 -25
- package/dist/layout/card/stats-card.js +13 -13
- package/dist/layout/navbar/navbar.d.ts +0 -23
- package/dist/layout/sidebar/NavGroup.svelte +20 -44
- package/dist/layout/sidebar/NavGroup.svelte.d.ts +1 -1
- package/dist/layout/sidebar/NavItem.svelte +1 -1
- package/dist/layout/sidebar/NavItem.svelte.d.ts +1 -1
- package/dist/layout/sidebar/Sidebar.svelte +19 -25
- package/dist/layout/sidebar/Sidebar.svelte.d.ts +1 -1
- package/dist/layout/table/table.d.ts +1 -1
- package/dist/layout/tabs/tabs.d.ts +1 -1
- package/dist/modal/Modal.svelte +2 -1
- package/dist/modal/Modal.svelte.d.ts +1 -1
- package/dist/modal/modal.d.ts +0 -23
- package/dist/sonner/sonner.svelte +13 -0
- package/dist/sonner/sonner.svelte.d.ts +4 -0
- package/dist/types/variants.d.ts +1 -21
- package/dist/types/variants.js +1 -19
- package/dist/variants.d.ts +20 -0
- package/dist/variants.js +19 -0
- package/package.json +6 -2
- package/dist/button/index.d.ts +0 -1
- package/dist/button/index.js +0 -1
- package/dist/drawer/index.d.ts +0 -2
- package/dist/drawer/index.js +0 -1
- package/dist/elements/badge/index.d.ts +0 -2
- package/dist/elements/badge/index.js +0 -2
- package/dist/elements/dropdown/index.d.ts +0 -3
- package/dist/elements/dropdown/index.js +0 -2
- package/dist/header/index.d.ts +0 -4
- package/dist/header/index.js +0 -2
- package/dist/layout/card/index.d.ts +0 -4
- package/dist/layout/card/index.js +0 -2
- package/dist/layout/index.d.ts +0 -5
- package/dist/layout/index.js +0 -5
- package/dist/layout/navbar/index.d.ts +0 -2
- package/dist/layout/navbar/index.js +0 -2
- package/dist/layout/sidebar/index.d.ts +0 -2
- package/dist/layout/sidebar/index.js +0 -1
- package/dist/layout/sidebar/sidebar.d.ts +0 -46
- package/dist/layout/sidebar/sidebar.js +0 -1
- package/dist/layout/table/index.d.ts +0 -3
- package/dist/layout/table/index.js +0 -2
- package/dist/layout/tabs/index.d.ts +0 -3
- package/dist/layout/tabs/index.js +0 -3
- package/dist/modal/index.d.ts +0 -1
- package/dist/modal/index.js +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Ripple UI
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A modern, standardized Svelte 5 component library designed for simplicity, consistency, and AI-friendly usage patterns.
|
|
4
|
+
|
|
5
|
+
## Key Features
|
|
6
|
+
|
|
7
|
+
- **Standardized API** with consistent prop naming and patterns across components
|
|
8
|
+
- **Enum-based properties** for predictable component customization
|
|
9
|
+
- **Strong TypeScript support** with comprehensive type definitions
|
|
10
|
+
- **Utility-first approach** built with TailwindCSS
|
|
11
|
+
- **Accessible components** adhering to modern web standards
|
|
12
|
+
- **Simplified component consumption** ideal for both human and AI developers
|
|
4
13
|
|
|
5
14
|
## Getting started
|
|
6
15
|
|
|
@@ -125,6 +134,43 @@ Paste the following CSS import code in `app.css`
|
|
|
125
134
|
}
|
|
126
135
|
```
|
|
127
136
|
|
|
137
|
+
## Design Philosophy
|
|
138
|
+
|
|
139
|
+
Ripple UI was built with a focus on consistency and standardization. Every component follows the same patterns for customization:
|
|
140
|
+
|
|
141
|
+
### Standardized Enums
|
|
142
|
+
|
|
143
|
+
Components use standardized enums for colors, sizes, and variants:
|
|
144
|
+
|
|
145
|
+
```typescript
|
|
146
|
+
// Colors available for most components
|
|
147
|
+
Color.DEFAULT // 'default'
|
|
148
|
+
Color.PRIMARY // 'primary'
|
|
149
|
+
Color.SECONDARY // 'secondary'
|
|
150
|
+
Color.INFO // 'info'
|
|
151
|
+
Color.SUCCESS // 'success'
|
|
152
|
+
Color.WARNING // 'warning'
|
|
153
|
+
Color.DANGER // 'danger'
|
|
154
|
+
|
|
155
|
+
// Sizes available for most components
|
|
156
|
+
Size.XS // 'xs'
|
|
157
|
+
Size.SM // 'sm'
|
|
158
|
+
Size.BASE // 'base'
|
|
159
|
+
Size.LG // 'lg'
|
|
160
|
+
Size.XL // 'xl'
|
|
161
|
+
Size.XXL // '2xl'
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Consistent Props Pattern
|
|
165
|
+
|
|
166
|
+
All components follow a consistent props pattern with predictable naming:
|
|
167
|
+
|
|
168
|
+
- `color`: Component color theme (using the Color enum)
|
|
169
|
+
- `size`: Component size (using the Size enum)
|
|
170
|
+
- `class`: Custom CSS classes for the component
|
|
171
|
+
- Event handlers with `on` prefix (e.g., `onclick`, `onchange`)
|
|
172
|
+
- Element-specific class props named with component + 'class' (e.g., `titleclass`, `bodyclass`)
|
|
173
|
+
|
|
128
174
|
## Component Variants
|
|
129
175
|
|
|
130
176
|
Most components in Ripple UI support variants to customize their appearance. Here are some examples:
|
|
@@ -135,53 +181,157 @@ Buttons come with different variants, colors, sizes, and shapes:
|
|
|
135
181
|
|
|
136
182
|
```svelte
|
|
137
183
|
<script lang="ts">
|
|
138
|
-
import { Button } from '@makolabs/ripple';
|
|
184
|
+
import { Button, Color, Size } from '@makolabs/ripple';
|
|
139
185
|
</script>
|
|
140
186
|
|
|
141
187
|
<!-- Different button variants -->
|
|
142
|
-
<Button variant="solid" color=
|
|
143
|
-
<Button variant="outline" color=
|
|
144
|
-
<Button variant="ghost" color=
|
|
145
|
-
<Button variant="link" color=
|
|
188
|
+
<Button variant="solid" color={Color.PRIMARY}>Solid Button</Button>
|
|
189
|
+
<Button variant="outline" color={Color.SECONDARY}>Outline Button</Button>
|
|
190
|
+
<Button variant="ghost" color={Color.DANGER}>Ghost Button</Button>
|
|
191
|
+
<Button variant="link" color={Color.INFO}>Link Button</Button>
|
|
192
|
+
|
|
193
|
+
<!-- Button with onclick handler -->
|
|
194
|
+
<Button
|
|
195
|
+
color={Color.SUCCESS}
|
|
196
|
+
onclick={() => console.log('Button clicked')}
|
|
197
|
+
>
|
|
198
|
+
Click Me
|
|
199
|
+
</Button>
|
|
200
|
+
|
|
201
|
+
<!-- Button as link -->
|
|
202
|
+
<Button
|
|
203
|
+
href="https://example.com"
|
|
204
|
+
target="_blank"
|
|
205
|
+
color={Color.PRIMARY}
|
|
206
|
+
>
|
|
207
|
+
Visit Website
|
|
208
|
+
</Button>
|
|
146
209
|
|
|
147
210
|
<!-- Button sizes -->
|
|
148
|
-
<Button size=
|
|
149
|
-
<Button size=
|
|
150
|
-
<Button size=
|
|
151
|
-
<Button size=
|
|
152
|
-
<Button size=
|
|
153
|
-
<Button size=
|
|
154
|
-
|
|
155
|
-
<!-- Button
|
|
156
|
-
<Button
|
|
157
|
-
<Button
|
|
158
|
-
<Button
|
|
159
|
-
<Button
|
|
160
|
-
|
|
161
|
-
<!-- Loading state -->
|
|
162
|
-
<Button isLoading={true} color="primary">Loading...</Button>
|
|
211
|
+
<Button size={Size.XS}>Extra Small</Button>
|
|
212
|
+
<Button size={Size.SM}>Small</Button>
|
|
213
|
+
<Button size={Size.BASE}>Base</Button>
|
|
214
|
+
<Button size={Size.LG}>Large</Button>
|
|
215
|
+
<Button size={Size.XL}>Extra Large</Button>
|
|
216
|
+
<Button size={Size.XXL}>2X Large</Button>
|
|
217
|
+
|
|
218
|
+
<!-- Button variants with different colors -->
|
|
219
|
+
<Button variant="solid" color={Color.PRIMARY}>Primary Solid</Button>
|
|
220
|
+
<Button variant="solid" color={Color.DANGER}>Danger Solid</Button>
|
|
221
|
+
<Button variant="outline" color={Color.SUCCESS}>Success Outline</Button>
|
|
222
|
+
<Button variant="ghost" color={Color.WARNING}>Warning Ghost</Button>
|
|
223
|
+
<Button variant="link" color={Color.INFO}>Info Link</Button>
|
|
163
224
|
```
|
|
164
225
|
|
|
165
226
|
### Modal Variants
|
|
166
227
|
|
|
167
|
-
Modals
|
|
228
|
+
Modals with different sizes and custom content:
|
|
168
229
|
|
|
169
230
|
```svelte
|
|
170
231
|
<script lang="ts">
|
|
171
|
-
import { Modal } from '@makolabs/ripple';
|
|
232
|
+
import { Modal, Button, Size } from '@makolabs/ripple';
|
|
172
233
|
let isOpen = false;
|
|
173
234
|
</script>
|
|
174
235
|
|
|
175
|
-
<Button
|
|
236
|
+
<Button onclick={() => isOpen = true}>Open Modal</Button>
|
|
176
237
|
|
|
238
|
+
<!-- Basic modal -->
|
|
177
239
|
<Modal
|
|
178
240
|
open={isOpen}
|
|
179
|
-
|
|
180
|
-
|
|
241
|
+
title="Basic Modal"
|
|
242
|
+
size={Size.BASE}
|
|
181
243
|
onClose={() => isOpen = false}
|
|
182
244
|
>
|
|
183
245
|
<p>Modal content goes here</p>
|
|
184
246
|
</Modal>
|
|
247
|
+
|
|
248
|
+
<!-- Modal with different size -->
|
|
249
|
+
<Modal
|
|
250
|
+
open={isOpen}
|
|
251
|
+
title="Large Modal"
|
|
252
|
+
size={Size.XL}
|
|
253
|
+
onClose={() => isOpen = false}
|
|
254
|
+
>
|
|
255
|
+
<p>This modal is larger and provides more content space</p>
|
|
256
|
+
</Modal>
|
|
257
|
+
|
|
258
|
+
<!-- Modal with custom header and footer -->
|
|
259
|
+
<Modal
|
|
260
|
+
open={isOpen}
|
|
261
|
+
onClose={() => isOpen = false}
|
|
262
|
+
size={Size.BASE}
|
|
263
|
+
>
|
|
264
|
+
<svelte:fragment slot="header">
|
|
265
|
+
<div class="flex items-center">
|
|
266
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16">
|
|
267
|
+
<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
268
|
+
</svg>
|
|
269
|
+
<h3 class="text-lg font-medium">Custom Header</h3>
|
|
270
|
+
</div>
|
|
271
|
+
</svelte:fragment>
|
|
272
|
+
|
|
273
|
+
<p>Modal with custom header and footer</p>
|
|
274
|
+
|
|
275
|
+
<svelte:fragment slot="footer">
|
|
276
|
+
<div class="flex justify-end space-x-2">
|
|
277
|
+
<Button variant="outline" onclick={() => isOpen = false}>Cancel</Button>
|
|
278
|
+
<Button color={Color.PRIMARY}>Save Changes</Button>
|
|
279
|
+
</div>
|
|
280
|
+
</svelte:fragment>
|
|
281
|
+
</Modal>
|
|
282
|
+
|
|
283
|
+
<!-- TODO: Remove position prop from Modal component in future versions -->
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
### Drawer Component
|
|
287
|
+
|
|
288
|
+
Drawers can slide in from different edges of the screen:
|
|
289
|
+
|
|
290
|
+
```svelte
|
|
291
|
+
<script lang="ts">
|
|
292
|
+
import { Drawer, Button } from '@makolabs/ripple';
|
|
293
|
+
let isDrawerOpen = false;
|
|
294
|
+
</script>
|
|
295
|
+
|
|
296
|
+
<Button onclick={() => isDrawerOpen = true}>Open Drawer</Button>
|
|
297
|
+
|
|
298
|
+
<Drawer
|
|
299
|
+
open={isDrawerOpen}
|
|
300
|
+
position="right"
|
|
301
|
+
onClose={() => isDrawerOpen = false}
|
|
302
|
+
>
|
|
303
|
+
<div class="p-4">
|
|
304
|
+
<h3 class="text-lg font-medium mb-4">Drawer Title</h3>
|
|
305
|
+
<p class="mb-4">This is a drawer that slides in from the side of the screen.</p>
|
|
306
|
+
<Button onclick={() => isDrawerOpen = false}>Close Drawer</Button>
|
|
307
|
+
</div>
|
|
308
|
+
</Drawer>
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
### PageHeader Component
|
|
312
|
+
|
|
313
|
+
A component for consistent page headers:
|
|
314
|
+
|
|
315
|
+
```svelte
|
|
316
|
+
<script lang="ts">
|
|
317
|
+
import { PageHeader, Button, Color } from '@makolabs/ripple';
|
|
318
|
+
|
|
319
|
+
const breadcrumbs = [
|
|
320
|
+
{ label: 'Dashboard', href: '#' },
|
|
321
|
+
{ label: 'Projects', href: '#' },
|
|
322
|
+
{ label: 'Current Project' }
|
|
323
|
+
];
|
|
324
|
+
</script>
|
|
325
|
+
|
|
326
|
+
<PageHeader
|
|
327
|
+
title="Project Dashboard"
|
|
328
|
+
description="View and manage your project details"
|
|
329
|
+
breadcrumbs={breadcrumbs}
|
|
330
|
+
>
|
|
331
|
+
<svelte:fragment slot="actions">
|
|
332
|
+
<Button color={Color.PRIMARY}>New Project</Button>
|
|
333
|
+
</svelte:fragment>
|
|
334
|
+
</PageHeader>
|
|
185
335
|
```
|
|
186
336
|
|
|
187
337
|
### Card Variants
|
|
@@ -190,47 +340,238 @@ Cards can be customized with different styles:
|
|
|
190
340
|
|
|
191
341
|
```svelte
|
|
192
342
|
<script lang="ts">
|
|
193
|
-
import { Card, StatsCard } from '@makolabs/ripple';
|
|
343
|
+
import { Card, StatsCard, Color } from '@makolabs/ripple';
|
|
194
344
|
</script>
|
|
195
345
|
|
|
196
|
-
<Card title="Basic Card" color=
|
|
346
|
+
<Card title="Basic Card" color={Color.PRIMARY}>
|
|
197
347
|
<p>Card content goes here</p>
|
|
198
348
|
</Card>
|
|
199
349
|
|
|
200
350
|
<StatsCard
|
|
201
|
-
|
|
202
|
-
value="
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
351
|
+
label="Monthly Sales"
|
|
352
|
+
value="$865,000"
|
|
353
|
+
previousValue="$750,000"
|
|
354
|
+
previousValuePrefix="vs"
|
|
355
|
+
trend={15.3}
|
|
356
|
+
color={Color.SUCCESS}
|
|
357
|
+
chartData={[20, 25, 30, 22, 35, 40, 38, 45, 50]}
|
|
358
|
+
icon={
|
|
359
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="currentColor" viewBox="0 0 16 16">
|
|
360
|
+
<path d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z" />
|
|
361
|
+
</svg>
|
|
362
|
+
}
|
|
206
363
|
/>
|
|
207
364
|
```
|
|
208
365
|
|
|
209
366
|
### Table Component
|
|
210
367
|
|
|
211
|
-
Tables for displaying structured data:
|
|
368
|
+
Tables for displaying structured data with pagination and sorting:
|
|
212
369
|
|
|
213
370
|
```svelte
|
|
214
371
|
<script lang="ts">
|
|
215
|
-
import { Table,
|
|
372
|
+
import { Table, Color, Size } from '@makolabs/ripple';
|
|
373
|
+
|
|
374
|
+
let data = [
|
|
375
|
+
{ id: 1, name: 'John Doe', email: 'john@example.com', status: 'Active' },
|
|
376
|
+
{ id: 2, name: 'Jane Smith', email: 'jane@example.com', status: 'Inactive' },
|
|
377
|
+
{ id: 3, name: 'Robert Johnson', email: 'robert@example.com', status: 'Active' }
|
|
378
|
+
];
|
|
379
|
+
|
|
380
|
+
const columns = [
|
|
381
|
+
{ key: 'name', label: 'Name', sortable: true },
|
|
382
|
+
{ key: 'email', label: 'Email', sortable: true },
|
|
383
|
+
{ key: 'status', label: 'Status' }
|
|
384
|
+
];
|
|
385
|
+
|
|
386
|
+
let selected = [];
|
|
387
|
+
let sort = { column: 'name', direction: 'asc' };
|
|
216
388
|
</script>
|
|
217
389
|
|
|
218
|
-
<Table
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
390
|
+
<Table
|
|
391
|
+
data={data}
|
|
392
|
+
{columns}
|
|
393
|
+
color={Color.PRIMARY}
|
|
394
|
+
size={Size.BASE}
|
|
395
|
+
pageSize={10}
|
|
396
|
+
selectable={true}
|
|
397
|
+
bind:selected={selected}
|
|
398
|
+
bind:sort={sort}
|
|
399
|
+
striped={true}
|
|
400
|
+
/>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Tab Component
|
|
404
|
+
|
|
405
|
+
Tabs for organizing content into different views:
|
|
406
|
+
|
|
407
|
+
```svelte
|
|
408
|
+
<script lang="ts">
|
|
409
|
+
import { TabGroup, TabContent, Color, Size } from '@makolabs/ripple';
|
|
410
|
+
|
|
411
|
+
const tabs = [
|
|
412
|
+
{ value: 'overview', label: 'Overview' },
|
|
413
|
+
{ value: 'details', label: 'Details' },
|
|
414
|
+
{ value: 'settings', label: 'Settings' }
|
|
415
|
+
];
|
|
416
|
+
|
|
417
|
+
let activeTab = 'overview';
|
|
418
|
+
|
|
419
|
+
function handleTabChange(value) {
|
|
420
|
+
console.log(`Tab changed to ${value}`);
|
|
421
|
+
}
|
|
422
|
+
</script>
|
|
423
|
+
|
|
424
|
+
<TabGroup
|
|
425
|
+
tabs={tabs}
|
|
426
|
+
bind:selected={activeTab}
|
|
427
|
+
onchange={handleTabChange}
|
|
428
|
+
color={Color.PRIMARY}
|
|
429
|
+
size={Size.BASE}
|
|
430
|
+
>
|
|
431
|
+
<TabContent value="overview" persisted>
|
|
432
|
+
<p>Overview content here</p>
|
|
433
|
+
</TabContent>
|
|
434
|
+
|
|
435
|
+
<TabContent value="details" persisted>
|
|
436
|
+
<p>Details content here</p>
|
|
437
|
+
</TabContent>
|
|
438
|
+
|
|
439
|
+
<TabContent value="settings" persisted>
|
|
440
|
+
<p>Settings content here</p>
|
|
441
|
+
</TabContent>
|
|
442
|
+
</TabGroup>
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Badge Component
|
|
446
|
+
|
|
447
|
+
Badges for displaying statuses and counts:
|
|
448
|
+
|
|
449
|
+
```svelte
|
|
450
|
+
<script lang="ts">
|
|
451
|
+
import { Badge, Color, Size } from '@makolabs/ripple';
|
|
452
|
+
</script>
|
|
453
|
+
|
|
454
|
+
<Badge color={Color.PRIMARY} size={Size.BASE}>New</Badge>
|
|
455
|
+
<Badge color={Color.SUCCESS}>Success</Badge>
|
|
456
|
+
<Badge color={Color.WARNING}>Warning</Badge>
|
|
457
|
+
<Badge color={Color.DANGER}>43</Badge>
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
### Select Component
|
|
461
|
+
|
|
462
|
+
Dropdown selector for choosing from a list of options:
|
|
463
|
+
|
|
464
|
+
```svelte
|
|
465
|
+
<script lang="ts">
|
|
466
|
+
import { Select, Size } from '@makolabs/ripple';
|
|
467
|
+
|
|
468
|
+
const items = [
|
|
469
|
+
{ label: 'Option 1', value: 'option1' },
|
|
470
|
+
{ label: 'Option 2', value: 'option2' },
|
|
471
|
+
{ label: 'Option 3', value: 'option3', disabled: true },
|
|
472
|
+
{ label: 'Option 4', value: 'option4' }
|
|
473
|
+
];
|
|
474
|
+
|
|
475
|
+
let selected = 'option1';
|
|
476
|
+
|
|
477
|
+
function handleSelect(event) {
|
|
478
|
+
console.log('Selected:', event.value);
|
|
479
|
+
}
|
|
480
|
+
</script>
|
|
481
|
+
|
|
482
|
+
<Select
|
|
483
|
+
{items}
|
|
484
|
+
bind:value={selected}
|
|
485
|
+
class="w-64"
|
|
486
|
+
size={Size.BASE}
|
|
487
|
+
onselect={handleSelect}
|
|
488
|
+
/>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
### Dropdown Component
|
|
492
|
+
|
|
493
|
+
Menu dropdown for actions and navigation:
|
|
494
|
+
|
|
495
|
+
```svelte
|
|
496
|
+
<script lang="ts">
|
|
497
|
+
import { Dropdown, Size } from '@makolabs/ripple';
|
|
498
|
+
import FluentChevronDown16Filled from '$icons/FluentChevronDown16Filled.svelte';
|
|
499
|
+
|
|
500
|
+
const sections = [
|
|
501
|
+
{
|
|
502
|
+
items: [
|
|
503
|
+
{
|
|
504
|
+
label: 'Edit',
|
|
505
|
+
icon: FluentPen16Filled,
|
|
506
|
+
onclick: () => console.log('Edit clicked')
|
|
507
|
+
},
|
|
508
|
+
{
|
|
509
|
+
label: 'Duplicate',
|
|
510
|
+
icon: FluentPenSparkle24Filled,
|
|
511
|
+
onclick: () => console.log('Duplicate clicked')
|
|
512
|
+
}
|
|
513
|
+
]
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
items: [
|
|
517
|
+
{
|
|
518
|
+
label: 'Delete',
|
|
519
|
+
icon: FluentDelete24Filled,
|
|
520
|
+
onclick: () => console.log('Delete clicked')
|
|
521
|
+
}
|
|
522
|
+
]
|
|
523
|
+
}
|
|
524
|
+
];
|
|
525
|
+
</script>
|
|
526
|
+
|
|
527
|
+
<Dropdown
|
|
528
|
+
sections={sections}
|
|
529
|
+
label="Actions"
|
|
530
|
+
size={Size.BASE}
|
|
531
|
+
icon={FluentChevronDown16Filled}
|
|
532
|
+
/>
|
|
533
|
+
```
|
|
534
|
+
|
|
535
|
+
## Component Composition
|
|
536
|
+
|
|
537
|
+
Ripple UI components are designed to work together seamlessly:
|
|
538
|
+
|
|
539
|
+
```svelte
|
|
540
|
+
<script lang="ts">
|
|
541
|
+
import { Card, TabGroup, TabContent, Button, Color, Size } from '@makolabs/ripple';
|
|
542
|
+
|
|
543
|
+
const tabs = [
|
|
544
|
+
{ value: 'overview', label: 'Overview' },
|
|
545
|
+
{ value: 'details', label: 'Details' },
|
|
546
|
+
{ value: 'settings', label: 'Settings' }
|
|
547
|
+
];
|
|
548
|
+
|
|
549
|
+
let activeTab = 'overview';
|
|
550
|
+
</script>
|
|
551
|
+
|
|
552
|
+
<Card title="Project Information" color={Color.PRIMARY}>
|
|
553
|
+
<TabGroup
|
|
554
|
+
tabs={tabs}
|
|
555
|
+
bind:selected={activeTab}
|
|
556
|
+
color={Color.INFO}
|
|
557
|
+
size={Size.BASE}
|
|
558
|
+
>
|
|
559
|
+
<TabContent value="overview">
|
|
560
|
+
<p>Project overview content here...</p>
|
|
561
|
+
<Button variant="solid" color={Color.SUCCESS} size={Size.SM}>
|
|
562
|
+
Take Action
|
|
563
|
+
</Button>
|
|
564
|
+
</TabContent>
|
|
565
|
+
|
|
566
|
+
<TabContent value="details">
|
|
567
|
+
<p>Project details content here...</p>
|
|
568
|
+
</TabContent>
|
|
569
|
+
|
|
570
|
+
<TabContent value="settings">
|
|
571
|
+
<p>Project settings content here...</p>
|
|
572
|
+
</TabContent>
|
|
573
|
+
</TabGroup>
|
|
574
|
+
</Card>
|
|
234
575
|
```
|
|
235
576
|
|
|
236
577
|
## Latest Updates
|
|
@@ -259,4 +600,3 @@ You can still import specific component types when needed:
|
|
|
259
600
|
</script>
|
|
260
601
|
|
|
261
602
|
<Button {...myButton}>Custom Button</Button>
|
|
262
|
-
```
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { cn } from '../helper/cls.js';
|
|
3
|
-
import {
|
|
3
|
+
import { buttonVariants } from './button.js';
|
|
4
|
+
import type { ButtonProps } from '../index.js';
|
|
5
|
+
import { Color, Size } from '../variants.js';
|
|
4
6
|
|
|
5
7
|
let {
|
|
6
8
|
variant = 'solid',
|
|
7
|
-
color =
|
|
8
|
-
size =
|
|
9
|
+
color = Color.DEFAULT,
|
|
10
|
+
size = Size.BASE,
|
|
9
11
|
rounded = 'base',
|
|
10
12
|
disabled = false,
|
|
11
13
|
isLoading = false,
|
package/dist/button/button.d.ts
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { ClassValue } from 'tailwind-variants';
|
|
3
|
-
import type { Snippet } from 'svelte';
|
|
1
|
+
import { Color, Size } from '../variants.js';
|
|
4
2
|
export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
5
3
|
variant: {
|
|
6
4
|
solid: string;
|
|
@@ -9,21 +7,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
9
7
|
link: string;
|
|
10
8
|
};
|
|
11
9
|
color: {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
10
|
+
[Color.DEFAULT]: string;
|
|
11
|
+
[Color.PRIMARY]: string;
|
|
12
|
+
[Color.SECONDARY]: string;
|
|
13
|
+
[Color.INFO]: string;
|
|
14
|
+
[Color.SUCCESS]: string;
|
|
15
|
+
[Color.WARNING]: string;
|
|
16
|
+
[Color.DANGER]: string;
|
|
19
17
|
};
|
|
20
18
|
size: {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
[Size.XS]: string;
|
|
20
|
+
[Size.SM]: string;
|
|
21
|
+
[Size.BASE]: string;
|
|
22
|
+
[Size.LG]: string;
|
|
23
|
+
[Size.XL]: string;
|
|
24
|
+
[Size.XXL]: string;
|
|
27
25
|
};
|
|
28
26
|
rounded: {
|
|
29
27
|
none: string;
|
|
@@ -46,21 +44,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
46
44
|
link: string;
|
|
47
45
|
};
|
|
48
46
|
color: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
47
|
+
[Color.DEFAULT]: string;
|
|
48
|
+
[Color.PRIMARY]: string;
|
|
49
|
+
[Color.SECONDARY]: string;
|
|
50
|
+
[Color.INFO]: string;
|
|
51
|
+
[Color.SUCCESS]: string;
|
|
52
|
+
[Color.WARNING]: string;
|
|
53
|
+
[Color.DANGER]: string;
|
|
56
54
|
};
|
|
57
55
|
size: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
56
|
+
[Size.XS]: string;
|
|
57
|
+
[Size.SM]: string;
|
|
58
|
+
[Size.BASE]: string;
|
|
59
|
+
[Size.LG]: string;
|
|
60
|
+
[Size.XL]: string;
|
|
61
|
+
[Size.XXL]: string;
|
|
64
62
|
};
|
|
65
63
|
rounded: {
|
|
66
64
|
none: string;
|
|
@@ -83,21 +81,21 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
83
81
|
link: string;
|
|
84
82
|
};
|
|
85
83
|
color: {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
[Color.DEFAULT]: string;
|
|
85
|
+
[Color.PRIMARY]: string;
|
|
86
|
+
[Color.SECONDARY]: string;
|
|
87
|
+
[Color.INFO]: string;
|
|
88
|
+
[Color.SUCCESS]: string;
|
|
89
|
+
[Color.WARNING]: string;
|
|
90
|
+
[Color.DANGER]: string;
|
|
93
91
|
};
|
|
94
92
|
size: {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
93
|
+
[Size.XS]: string;
|
|
94
|
+
[Size.SM]: string;
|
|
95
|
+
[Size.BASE]: string;
|
|
96
|
+
[Size.LG]: string;
|
|
97
|
+
[Size.XL]: string;
|
|
98
|
+
[Size.XXL]: string;
|
|
101
99
|
};
|
|
102
100
|
rounded: {
|
|
103
101
|
none: string;
|
|
@@ -113,24 +111,3 @@ export declare const buttonVariants: import("tailwind-variants").TVReturnType<{
|
|
|
113
111
|
true: string;
|
|
114
112
|
};
|
|
115
113
|
}, undefined, "\n\t\tinline-flex items-center justify-center font-medium transition-colors focus-visible:outline-none\n\t\tfocus-visible:ring-2 focus-visible:ring-offset-2 cursor-pointer\n\t\t", unknown, unknown, undefined>>;
|
|
116
|
-
type ButtonHTMLProps = {
|
|
117
|
-
href?: never;
|
|
118
|
-
} & HTMLButtonAttributes;
|
|
119
|
-
type AnchorHTMLProps = {
|
|
120
|
-
rel?: string | undefined | null;
|
|
121
|
-
target?: HTMLAttributeAnchorTarget | undefined | null;
|
|
122
|
-
referrerpolicy?: ReferrerPolicy | undefined | null;
|
|
123
|
-
href: string;
|
|
124
|
-
} & Record<string, unknown>;
|
|
125
|
-
export type BaseButtonProps = {
|
|
126
|
-
class?: ClassValue;
|
|
127
|
-
variant?: 'solid' | 'outline' | 'ghost' | 'link';
|
|
128
|
-
color?: keyof typeof buttonVariants.variants.color;
|
|
129
|
-
size?: keyof typeof buttonVariants.variants.size;
|
|
130
|
-
rounded?: keyof typeof buttonVariants.variants.rounded;
|
|
131
|
-
disabled?: boolean | undefined | null;
|
|
132
|
-
isLoading?: boolean;
|
|
133
|
-
children?: Snippet;
|
|
134
|
-
};
|
|
135
|
-
export type ButtonProps = BaseButtonProps & (ButtonHTMLProps | AnchorHTMLProps);
|
|
136
|
-
export {};
|