@marianmeres/stuic 3.9.0 → 3.9.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/AGENTS.md CHANGED
@@ -23,7 +23,7 @@
23
23
 
24
24
  ```
25
25
  src/lib/
26
- ├── components/ # 36 UI components
26
+ ├── components/ # 37 UI components
27
27
  ├── actions/ # 12 Svelte actions
28
28
  ├── utils/ # 42 utility functions
29
29
  ├── themes/ # 26 theme definitions (.ts) + generated CSS (css/)
@@ -72,7 +72,7 @@ src/lib/
72
72
  - [Tasks](./docs/tasks.md) — Common procedures
73
73
 
74
74
  ### Domain Docs
75
- - [Components](./docs/domains/components.md) — 36 components, Props pattern, snippets
75
+ - [Components](./docs/domains/components.md) — 37 components, Props pattern, snippets
76
76
  - [Theming](./docs/domains/theming.md) — CSS tokens, dark mode, themes
77
77
  - [Actions](./docs/domains/actions.md) — 12 Svelte directives
78
78
  - [Utils](./docs/domains/utils.md) — 42 utility functions
package/API.md CHANGED
@@ -323,6 +323,56 @@ Loading placeholder with animation.
323
323
 
324
324
  ---
325
325
 
326
+ ### E-commerce
327
+
328
+ #### `Cart`
329
+
330
+ Shopping cart component with quantity controls, pricing, and summary. Supports interactive (full cart), readonly (checkout summary), and compact (popover preview) modes.
331
+
332
+ | Prop | Type | Default | Description |
333
+ |------|------|---------|-------------|
334
+ | `items` | `CartComponentItem[]` | required | Cart items to display |
335
+ | `variant` | `"default" \| "compact"` | `"default"` | Layout variant. Compact is smaller, scrollable, implicitly readonly |
336
+ | `formatPrice` | `(value: number) => string` | `(v) => (v / 100).toFixed(2)` | Format numeric price for display |
337
+ | `onQuantityChange` | `(id: string, qty: number) => void` | — | Called when quantity changes |
338
+ | `onRemove` | `(id: string) => void` | — | Called when remove is clicked |
339
+ | `noThumbnails` | `boolean` | `false` | Hide all thumbnails |
340
+ | `readonly` | `boolean` | `false` | Hide interactive controls |
341
+ | `loading` | `boolean` | `false` | Show loading skeleton |
342
+ | `updatingItems` | `Set<string>` | `new Set()` | Item IDs currently being updated (reduced opacity) |
343
+ | `t` | `TranslateFn` | built-in | Translation function for i18n |
344
+
345
+ **Snippets:**
346
+
347
+ | Snippet | Params | Description |
348
+ |---------|--------|-------------|
349
+ | `thumbnail` | `{ item }` | Override thumbnail rendering |
350
+ | `itemRow` | `{ item, isUpdating, readonly, formatPrice }` | Override entire item row |
351
+ | `summary` | `{ items, total, itemCount, formatPrice }` | Override summary section |
352
+ | `empty` | — | Custom empty state |
353
+ | `footer` | `{ items, total, itemCount }` | Content after summary (CTAs) |
354
+
355
+ ```svelte
356
+ <Cart
357
+ {items}
358
+ formatPrice={(v) => `$${(v / 100).toFixed(2)}`}
359
+ onQuantityChange={handleQuantityChange}
360
+ onRemove={handleRemove}
361
+ />
362
+
363
+ <!-- Readonly mode (checkout summary) -->
364
+ <Cart {items} readonly formatPrice={(v) => `$${(v / 100).toFixed(2)}`} />
365
+
366
+ <!-- Compact variant (for popovers) -->
367
+ <Cart {items} variant="compact" formatPrice={(v) => `$${(v / 100).toFixed(2)}`}>
368
+ {#snippet footer({ total, itemCount })}
369
+ <a href="/cart">View Cart</a>
370
+ {/snippet}
371
+ </Cart>
372
+ ```
373
+
374
+ ---
375
+
326
376
  ### Display
327
377
 
328
378
  #### `Avatar`
@@ -356,6 +406,39 @@ Image/content slider with navigation.
356
406
 
357
407
  Animated loading dots ("...").
358
408
 
409
+ #### `DataTable`
410
+
411
+ Responsive data table with paging, row selection, batch actions, and mobile card view.
412
+
413
+ | Prop | Type | Default | Description |
414
+ |------|------|---------|-------------|
415
+ | `columns` | `DataTableColumn<T>[]` | required | Column definitions |
416
+ | `data` | `T[]` | required | Row data objects |
417
+ | `getRowId` | `(row: T, index: number) => string \| number` | index | Unique row ID extractor |
418
+ | `paging` | `PagingCalcResult` | — | Paging calculation from `@marianmeres/paging-store` |
419
+ | `onPageChange` | `(offset: number) => void` | — | Page navigation callback |
420
+ | `selectable` | `boolean` | `false` | Enable row selection checkboxes |
421
+ | `selected` | `Set<string \| number>` | — | Bindable set of selected row IDs |
422
+ | `selectOnRowClick` | `boolean` | `false` | Toggle selection on row click |
423
+ | `onRowClick` | `(row: T, index: number) => void` | — | Row click callback |
424
+ | `loading` | `boolean` | `false` | Show loading overlay |
425
+ | `t` | `TranslateFn` | built-in | Translation function for i18n |
426
+
427
+ **Snippets:** `cell`, `batchActions`, `empty`, `mobileRow`
428
+
429
+ ```svelte
430
+ <DataTable
431
+ columns={[
432
+ { key: "name", label: "Name" },
433
+ { key: "email", label: "Email" },
434
+ { key: "role", label: "Role", align: "center" },
435
+ ]}
436
+ data={users}
437
+ selectable
438
+ bind:selected={selectedIds}
439
+ />
440
+ ```
441
+
359
442
  #### `ThemePreview`
360
443
 
361
444
  Theme color swatch preview.
@@ -886,6 +969,8 @@ import type {
886
969
  Naming pattern: `{ComponentName}Props`
887
970
 
888
971
  Additional exported types include:
972
+ - `CartComponentItem`, `CartVariant` — Cart component types
973
+ - `DataTableColumn` — DataTable column definition type
889
974
  - `FieldAsset`, `FieldAssetUrlObj`, `FieldAssetWithBlobUrl` — Asset field types
890
975
  - `FieldOption` — Option type for FieldOptions
891
976
  - `KeyValueEntry` — Entry type for FieldKeyValues
@@ -969,6 +1054,7 @@ Each component defines customization tokens. Override globally in `:root {}` or
969
1054
  | Tooltip | `--stuic-tooltip-*` | `bg`, `text` |
970
1055
  | Popover | `--stuic-popover-*` | `bg`, `text`, `border` |
971
1056
  | Skeleton | `--stuic-skeleton-*` | `bg`, `bg-highlight`, `duration` |
1057
+ | Cart | `--stuic-cart-*` | `gap`, `item-padding`, `item-radius`, `item-border-color`, `item-bg`, `thumbnail-size`, `quantity-border-color`, `remove-color`, `summary-border-color`, `compact-max-height`, `transition` |
972
1058
 
973
1059
  ### CSS Variable Naming Convention
974
1060
 
package/README.md CHANGED
@@ -141,7 +141,10 @@ Notifications, AlertConfirmPrompt, DismissibleMessage, Progress, Spinner, Skelet
141
141
  CommandMenu, DropdownMenu, TabbedMenu, TypeaheadInput, KbdShortcut
142
142
 
143
143
  ### Display & Utility
144
- Avatar, Carousel, AnimatedElipsis, ThemePreview, ColorScheme, Thc, HoverExpandableWidth, AssetsPreview
144
+ Avatar, Carousel, AnimatedElipsis, ThemePreview, ColorScheme, Thc, HoverExpandableWidth, AssetsPreview, DataTable
145
+
146
+ ### E-commerce
147
+ Cart
145
148
 
146
149
  ## Actions
147
150
 
@@ -32,7 +32,7 @@ Layer 3: Internal Vars (--_bg, --_text, --_border)
32
32
 
33
33
  ```
34
34
  src/lib/
35
- ├── components/ # 36 UI components
35
+ ├── components/ # 37 UI components
36
36
  │ └── {Name}/
37
37
  │ ├── {Name}.svelte # Main component
38
38
  │ ├── index.ts # Exports
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Overview
4
4
 
5
- 36 Svelte 5 components with consistent API patterns. All use runes-based reactivity.
5
+ 37 Svelte 5 components with consistent API patterns. All use runes-based reactivity.
6
6
 
7
7
  ## Component Categories
8
8
 
@@ -57,6 +57,11 @@
57
57
  | DataTable | Responsive data table with paging, selection, batch actions |
58
58
  | ThemePreview | Theme color swatches |
59
59
 
60
+ ### E-commerce
61
+ | Component | Purpose |
62
+ |-----------|---------|
63
+ | Cart | Shopping cart with quantity controls, pricing, summary; default/compact/readonly variants |
64
+
60
65
  ---
61
66
 
62
67
  ## Props Pattern
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.9.0",
3
+ "version": "3.9.1",
4
4
  "files": [
5
5
  "dist",
6
6
  "!dist/**/*.test.*",