@marwes-ui/svelte 1.3.0 → 1.4.0
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/CHANGELOG.md +30 -0
- package/README.md +43 -11
- package/dist/components/README.md +31 -0
- package/dist/components/accordion/AccordionField.svelte +20 -6
- package/dist/components/accordion/index.d.ts +5 -2
- package/dist/components/accordion/index.js +7 -1
- package/dist/components/accordion/types.d.ts +3 -0
- package/dist/components/avatar/AvatarGroup.svelte +5 -2
- package/dist/components/avatar/AvatarGroup.svelte.d.ts +1 -0
- package/dist/components/avatar/TeamAvatarGroup.svelte +1 -0
- package/dist/components/avatar/TeamAvatarGroup.svelte.d.ts +1 -0
- package/dist/components/avatar/index.d.ts +7 -1
- package/dist/components/avatar/index.js +6 -0
- package/dist/components/avatar/types.d.ts +28 -0
- package/dist/components/badge/BadgeGroup.svelte +2 -1
- package/dist/components/badge/index.d.ts +5 -1
- package/dist/components/badge/index.js +4 -0
- package/dist/components/badge/types.d.ts +3 -0
- package/dist/components/banner/Banner.svelte +67 -0
- package/dist/components/banner/Banner.svelte.d.ts +4 -0
- package/dist/components/banner/ErrorBanner.svelte +9 -0
- package/dist/components/banner/ErrorBanner.svelte.d.ts +4 -0
- package/dist/components/banner/InfoBanner.svelte +9 -0
- package/dist/components/banner/InfoBanner.svelte.d.ts +4 -0
- package/dist/components/banner/SuccessBanner.svelte +9 -0
- package/dist/components/banner/SuccessBanner.svelte.d.ts +4 -0
- package/dist/components/banner/WarningBanner.svelte +9 -0
- package/dist/components/banner/WarningBanner.svelte.d.ts +4 -0
- package/dist/components/banner/index.d.ts +7 -0
- package/dist/components/banner/index.js +6 -0
- package/dist/components/banner/types.d.ts +14 -0
- package/dist/components/banner/types.js +1 -0
- package/dist/components/breadcrumb/Breadcrumb.svelte +115 -0
- package/dist/components/breadcrumb/Breadcrumb.svelte.d.ts +4 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +1 -0
- package/dist/components/breadcrumb/types.d.ts +8 -0
- package/dist/components/breadcrumb/types.js +1 -0
- package/dist/components/button/Button.svelte +8 -4
- package/dist/components/button/DestructiveButton.svelte +1 -1
- package/dist/components/button/IconButton.svelte +9 -0
- package/dist/components/button/IconButton.svelte.d.ts +4 -0
- package/dist/components/button/index.d.ts +24 -1
- package/dist/components/button/index.js +23 -0
- package/dist/components/button/types.d.ts +30 -1
- package/dist/components/card/Card.svelte +2 -1
- package/dist/components/card/index.d.ts +4 -1
- package/dist/components/card/index.js +3 -0
- package/dist/components/card/types.d.ts +4 -0
- package/dist/components/checkbox/CheckboxField.svelte +4 -3
- package/dist/components/checkbox/CheckboxGroupField.svelte +21 -9
- package/dist/components/checkbox/index.d.ts +2 -2
- package/dist/components/checkbox/index.js +4 -1
- package/dist/components/checkbox/types.d.ts +7 -0
- package/dist/components/context-menu/ContextMenu.svelte +56 -0
- package/dist/components/context-menu/ContextMenu.svelte.d.ts +4 -0
- package/dist/components/context-menu/index.d.ts +2 -0
- package/dist/components/context-menu/index.js +1 -0
- package/dist/components/context-menu/types.d.ts +7 -0
- package/dist/components/context-menu/types.js +1 -0
- package/dist/components/date-picker/DatePicker.svelte +14 -2
- package/dist/components/date-picker/DatePickerField.svelte +72 -0
- package/dist/components/date-picker/DatePickerField.svelte.d.ts +4 -0
- package/dist/components/date-picker/index.d.ts +2 -2
- package/dist/components/date-picker/index.js +3 -1
- package/dist/components/date-picker/types.d.ts +15 -0
- package/dist/components/dialog/Dialog.svelte +1 -0
- package/dist/components/dialog/DialogModal.svelte +12 -0
- package/dist/components/dialog/index.d.ts +1 -1
- package/dist/components/dialog/types.d.ts +7 -3
- package/dist/components/drawer/Drawer.svelte +132 -0
- package/dist/components/drawer/Drawer.svelte.d.ts +4 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +1 -0
- package/dist/components/drawer/types.d.ts +16 -0
- package/dist/components/drawer/types.js +1 -0
- package/dist/components/heading/H1.svelte +10 -0
- package/dist/components/heading/H2.svelte +6 -0
- package/dist/components/heading/H3.svelte +7 -0
- package/dist/components/input/CurrencyField.svelte +1 -1
- package/dist/components/input/Input.svelte +1 -0
- package/dist/components/input/InputField.svelte +4 -3
- package/dist/components/input/InputOtp.svelte +21 -44
- package/dist/components/input/InputOtpField.svelte +81 -0
- package/dist/components/input/InputOtpField.svelte.d.ts +4 -0
- package/dist/components/input/RichText.svelte +7 -6
- package/dist/components/input/RichTextField.svelte +4 -3
- package/dist/components/input/Select.svelte +7 -31
- package/dist/components/input/SelectField.svelte +6 -3
- package/dist/components/input/Textarea.svelte +1 -0
- package/dist/components/input/TextareaField.svelte +20 -5
- package/dist/components/input/index.d.ts +12 -4
- package/dist/components/input/index.js +19 -3
- package/dist/components/input/types.d.ts +59 -5
- package/dist/components/pagination/Pagination.svelte +399 -0
- package/dist/components/pagination/Pagination.svelte.d.ts +4 -0
- package/dist/components/pagination/PaginationField.svelte +72 -0
- package/dist/components/pagination/PaginationField.svelte.d.ts +4 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +2 -0
- package/dist/components/pagination/types.d.ts +40 -0
- package/dist/components/pagination/types.js +1 -0
- package/dist/components/progress-bar/ProgressBar.svelte +50 -0
- package/dist/components/progress-bar/ProgressBar.svelte.d.ts +4 -0
- package/dist/components/progress-bar/index.d.ts +2 -0
- package/dist/components/progress-bar/index.js +1 -0
- package/dist/components/progress-bar/types.d.ts +6 -0
- package/dist/components/progress-bar/types.js +1 -0
- package/dist/components/radio/OptionRadioGroup.svelte +39 -5
- package/dist/components/radio/OptionRadioGroup.svelte.d.ts +2 -5
- package/dist/components/radio/Radio.svelte +1 -0
- package/dist/components/radio/RadioGroupField.svelte +4 -3
- package/dist/components/radio/RatingRadioGroup.svelte +18 -3
- package/dist/components/radio/YesNoRadioGroup.svelte +18 -3
- package/dist/components/radio/index.d.ts +4 -2
- package/dist/components/radio/index.js +6 -1
- package/dist/components/radio/types.d.ts +47 -0
- package/dist/components/segmented-control/SegmentedControl.svelte +125 -0
- package/dist/components/segmented-control/SegmentedControl.svelte.d.ts +25 -0
- package/dist/components/segmented-control/SegmentedControlField.svelte +76 -0
- package/dist/components/segmented-control/SegmentedControlField.svelte.d.ts +25 -0
- package/dist/components/segmented-control/index.d.ts +2 -0
- package/dist/components/segmented-control/index.js +2 -0
- package/dist/components/segmented-control/types.d.ts +41 -0
- package/dist/components/segmented-control/types.js +1 -0
- package/dist/components/skip-link/SkipLink.svelte +12 -0
- package/dist/components/skip-link/SkipLink.svelte.d.ts +4 -0
- package/dist/components/skip-link/index.d.ts +2 -0
- package/dist/components/skip-link/index.js +1 -0
- package/dist/components/skip-link/types.d.ts +7 -0
- package/dist/components/skip-link/types.js +1 -0
- package/dist/components/slider/SliderField.svelte +9 -8
- package/dist/components/slider/index.d.ts +5 -2
- package/dist/components/slider/index.js +7 -1
- package/dist/components/slider/types.d.ts +21 -0
- package/dist/components/spinner/EmptyStateSpinner.svelte +2 -3
- package/dist/components/spinner/EmptyStateSpinner.svelte.d.ts +1 -2
- package/dist/components/spinner/Spinner.svelte +2 -0
- package/dist/components/spinner/index.d.ts +2 -1
- package/dist/components/spinner/index.js +1 -0
- package/dist/components/spinner/types.d.ts +1 -0
- package/dist/components/switch/Switch.svelte +1 -1
- package/dist/components/switch/SwitchField.svelte +6 -4
- package/dist/components/switch/index.d.ts +4 -2
- package/dist/components/switch/index.js +6 -1
- package/dist/components/switch/types.d.ts +3 -0
- package/dist/components/tab/TabGroup.svelte +7 -4
- package/dist/components/text/Text.svelte +23 -0
- package/dist/components/text/Text.svelte.d.ts +4 -0
- package/dist/components/text/index.d.ts +4 -0
- package/dist/components/text/index.js +2 -0
- package/dist/components/text/types.d.ts +15 -0
- package/dist/components/text/types.js +1 -0
- package/dist/components/tooltip/TooltipGroup.svelte +10 -2
- package/dist/index.d.ts +47 -29
- package/dist/index.js +51 -13
- package/dist/provider/MarwesProvider.svelte +26 -14
- package/dist/provider/types.d.ts +5 -2
- package/package.json +6 -5
- package/dist/components/accordion/README.md +0 -19
- package/dist/components/avatar/README.md +0 -19
- package/dist/components/badge/README.md +0 -16
- package/dist/components/button/README.md +0 -21
- package/dist/components/card/README.md +0 -15
- package/dist/components/checkbox/README.md +0 -17
- package/dist/components/date-picker/README.md +0 -17
- package/dist/components/dialog/README.md +0 -23
- package/dist/components/divider/README.md +0 -15
- package/dist/components/heading/README.md +0 -13
- package/dist/components/icon/README.md +0 -18
- package/dist/components/input/README.md +0 -24
- package/dist/components/paragraph/README.md +0 -13
- package/dist/components/radio/README.md +0 -16
- package/dist/components/skeleton/README.md +0 -16
- package/dist/components/slider/README.md +0 -20
- package/dist/components/spacing/README.md +0 -15
- package/dist/components/spinner/README.md +0 -19
- package/dist/components/stat-tile/README.md +0 -15
- package/dist/components/switch/README.md +0 -17
- package/dist/components/tab/README.md +0 -26
- package/dist/components/toast/README.md +0 -35
- package/dist/components/tooltip/README.md +0 -22
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @marwes-ui/svelte
|
|
2
2
|
|
|
3
|
+
## 1.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#39](https://github.com/niklas-westman/marwes/pull/39) [`965a3af`](https://github.com/niklas-westman/marwes/commit/965a3af4fd05bf5342a687c55d52188c7c22ae62) Thanks [@niklas-westman](https://github.com/niklas-westman)! - Add the next Marwes component family wave and finish release-blocking component polish.
|
|
8
|
+
|
|
9
|
+
Adds `Banner`, `Breadcrumb`, `ContextMenu`, `Drawer`, `Pagination`, `ProgressBar`, `SegmentedControl`, and `Text` across the shared core recipes, firstEdition preset CSS, React, Vue, and Svelte packages.
|
|
10
|
+
|
|
11
|
+
Each new family includes Storybook stories and `Introduction.mdx` documentation aligned with the existing component documentation pattern, plus registry artifacts, taxonomy/docs checks, and framework adapter coverage for a release-ready public package surface.
|
|
12
|
+
|
|
13
|
+
Adds `IconButton`, the `danger` button variant, the `sp-12` spacing token, native select chevron parity, wrapper-adaptive field widths, TabGroup overflow containment, and DialogModal surface controls across React, Vue, Svelte, presets, Storybook documentation, and registry artifacts.
|
|
14
|
+
|
|
15
|
+
Adds `label` as a consumer-friendly accessible-name alias for standalone controls that previously required `ariaLabel`, and cleans up Storybook consistency auditing so grouped React/Vue variant exports are compared against Svelte one-file component exports without false parity failures.
|
|
16
|
+
|
|
17
|
+
Cleans up Svelte adapter diagnostics by removing stale state-capture warnings, preserving shared ARIA contracts with explicit Svelte annotations, and aligning purpose radio groups with controlled/uncontrolled behavior.
|
|
18
|
+
|
|
19
|
+
Aligns Svelte package styling behavior with React and Vue by loading firstEdition CSS from the public package entry, preserving the CSS side effect in package metadata, and adding shared contract enrollment for the remaining cross-framework Svelte surfaces.
|
|
20
|
+
|
|
21
|
+
Adds a cross-framework adapter architecture map and `pnpm check:adapter-architecture` guardrail so React, Vue, and Svelte package structure, Storybook introductions, root exports, shared contracts, and package CSS policy cannot drift silently.
|
|
22
|
+
|
|
23
|
+
- [#40](https://github.com/niklas-westman/marwes/pull/40) [`5bb997c`](https://github.com/niklas-westman/marwes/commit/5bb997cb03c037233afc3e42288f6ed037d1b1c5) Thanks [@niklas-westman](https://github.com/niklas-westman)! - Complete the `label` accessible-name alias rollout across standalone controls.
|
|
24
|
+
|
|
25
|
+
`Radio` and `InputOtp` now accept `label` alongside `ariaLabel`, matching the pattern already used by `Checkbox`, `Switch`, `Slider`, `Input`, `Select`, `Textarea`, and `RichText`. `IconButton` prop types now surface `label` explicitly for IDE discoverability (the underlying `Button` recipe already resolved it). Consumers can now use `label="…"` uniformly across every standalone control; `ariaLabel` continues to work.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- Updated dependencies [[`965a3af`](https://github.com/niklas-westman/marwes/commit/965a3af4fd05bf5342a687c55d52188c7c22ae62), [`5bb997c`](https://github.com/niklas-westman/marwes/commit/5bb997cb03c037233afc3e42288f6ed037d1b1c5)]:
|
|
30
|
+
- @marwes-ui/core@1.4.0
|
|
31
|
+
- @marwes-ui/presets@1.4.0
|
|
32
|
+
|
|
3
33
|
## 1.3.0
|
|
4
34
|
|
|
5
35
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -13,7 +13,8 @@ Svelte 5 components for the Marwes design system with default styling, typed the
|
|
|
13
13
|
|
|
14
14
|
Svelte 5 • TypeScript-first • Default CSS included • ThemeInput • Google Fonts DX • Purpose components
|
|
15
15
|
|
|
16
|
-
[
|
|
16
|
+
[**marwes.io**](https://marwes.io) — official site, theme builder, and install guides
|
|
17
|
+
[Svelte Storybook](https://storybook-svelte.marwes.io/latest/) • [Documentation](https://github.com/niklas-westman/marwes/tree/main/docs) • [GitHub](https://github.com/niklas-westman/marwes)
|
|
17
18
|
|
|
18
19
|
</div>
|
|
19
20
|
|
|
@@ -28,7 +29,7 @@ Marwes gives Svelte apps a ready design-system base without requiring custom CSS
|
|
|
28
29
|
- **Runes-first**: built entirely on Svelte 5 runes (`$props`, `$state`, `$derived`, `$effect`, `$bindable`) — no legacy stores or lifecycle hooks.
|
|
29
30
|
- **Consequential theming**: a `ThemeInput` object changes colors, fonts, radius, density, typography, and component visuals through shared CSS variables.
|
|
30
31
|
- **Purpose components**: `SubmitButton`, `CancelButton`, and `DestructiveButton` make intent machine-readable so tests, audits, and AI agents can handle actions safely.
|
|
31
|
-
- **Shared core contracts**: every Svelte component is backed by the same framework-agnostic recipes, a11y mapping, and theme shape used
|
|
32
|
+
- **Shared core contracts**: every Svelte component is backed by the same framework-agnostic recipes, a11y mapping, and theme shape used across adapters.
|
|
32
33
|
|
|
33
34
|
## Package Map
|
|
34
35
|
|
|
@@ -46,11 +47,37 @@ This split keeps installation simple for app teams while giving humans and AI ag
|
|
|
46
47
|
|
|
47
48
|
## Install
|
|
48
49
|
|
|
50
|
+
The Marwes CLI is the official installation path. It installs `@marwes-ui/svelte` (with `svelte` as a peer), wraps your app root with `MarwesProvider`, and leaves you ready to render components with default Marwes styling — no separate CSS setup.
|
|
51
|
+
|
|
52
|
+
For full setup guides, theme customization, and the theme builder, visit [marwes.io](https://marwes.io).
|
|
53
|
+
|
|
54
|
+
### Existing Svelte app
|
|
55
|
+
|
|
56
|
+
Run at the root of your project:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm dlx @marwes-ui/cli init --adapter svelte
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Also works with `npx @marwes-ui/cli`, `yarn dlx @marwes-ui/cli`, and `bunx @marwes-ui/cli`.
|
|
63
|
+
|
|
64
|
+
### New Vite app
|
|
65
|
+
|
|
66
|
+
Scaffold a fresh Vite starter with Marwes preinstalled:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
pnpm create marwes@latest my-app --template svelte-ts
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### AI-assisted setup
|
|
73
|
+
|
|
74
|
+
Add `--agentic` to hand setup to an AI coding agent (Claude Code, Cursor, etc.). The CLI runs the normal install, then runs `doctor` and prints the guardrails the agent should follow:
|
|
75
|
+
|
|
49
76
|
```bash
|
|
50
|
-
pnpm
|
|
77
|
+
pnpm dlx @marwes-ui/cli init --adapter svelte --agentic
|
|
51
78
|
```
|
|
52
79
|
|
|
53
|
-
|
|
80
|
+
After install, jump to the [Quick Start](#quick-start) below.
|
|
54
81
|
|
|
55
82
|
## Quick Start
|
|
56
83
|
|
|
@@ -70,8 +97,8 @@ No preset CSS import is needed. `@marwes-ui/svelte` depends on `@marwes-ui/prese
|
|
|
70
97
|
</script>
|
|
71
98
|
|
|
72
99
|
<MarwesProvider>
|
|
73
|
-
<Input bind:value={email} placeholder="Email"
|
|
74
|
-
<Checkbox bind:checked={subscribed}
|
|
100
|
+
<Input bind:value={email} placeholder="Email" label="Email" />
|
|
101
|
+
<Checkbox bind:checked={subscribed} label="Subscribe" />
|
|
75
102
|
<Button variant={ButtonVariant.secondary}>Preview</Button>
|
|
76
103
|
<SubmitButton>Save</SubmitButton>
|
|
77
104
|
</MarwesProvider>
|
|
@@ -170,7 +197,7 @@ Provider and hooks:
|
|
|
170
197
|
- `useToast`
|
|
171
198
|
|
|
172
199
|
Actions and buttons:
|
|
173
|
-
- `Button`
|
|
200
|
+
- `Button`, `IconButton`
|
|
174
201
|
- `PrimaryButton`, `SecondaryButton`, `TextButton`, `SuccessButton`
|
|
175
202
|
- `SubmitButton`, `CancelButton`, `CreateButton`, `DestructiveButton`
|
|
176
203
|
- `LinkButton`, `SaveButton`, `ConfirmButton`, `VerifyButton`
|
|
@@ -187,21 +214,26 @@ Forms and inputs:
|
|
|
187
214
|
- `Radio`, `RadioGroupField`, `YesNoRadioGroup`, `RatingRadioGroup`, `OptionRadioGroup`
|
|
188
215
|
- `Switch`, `SwitchField`, `FeatureToggle`, `PreferenceSwitch`, `PermissionSwitch`
|
|
189
216
|
- `Slider`, `SliderField`, `VolumeSlider`, `BrightnessSlider`, `RadiusSlider`
|
|
217
|
+
- `SegmentedControlField`, `PaginationField`
|
|
190
218
|
|
|
191
219
|
Content and layout:
|
|
192
220
|
- `Card`, `ProductCard`, `ProfileCard`, `StatCard`
|
|
193
|
-
- `H1`, `H2`, `H3`, `Paragraph`
|
|
221
|
+
- `H1`, `H2`, `H3`, `Paragraph`, `Text`, `TypographyText`
|
|
194
222
|
- `Spacer`, `Spacing`, `Divider`
|
|
223
|
+
- `Breadcrumb`
|
|
195
224
|
- `Icon`
|
|
196
225
|
- `Avatar`, `AvatarBadge`, `AvatarGroup`, `ProfileAvatar`, `PresenceAvatar`, `TeamAvatarGroup`
|
|
226
|
+
- `StatTile`, `Skeleton`
|
|
197
227
|
|
|
198
228
|
Feedback and overlays:
|
|
199
229
|
- `Badge`, `BadgeGroup`, `StatusBadge`, `PriorityBadge`, `NotificationBadge`
|
|
230
|
+
- `Banner`, `InfoBanner`, `SuccessBanner`, `WarningBanner`, `ErrorBanner`
|
|
231
|
+
- `ProgressBar`
|
|
200
232
|
- `Spinner`, `ButtonSpinner`, `EmptyStateSpinner`
|
|
201
233
|
- `Toast`, `ToastContainer`, `ToastProvider`
|
|
202
234
|
- `SuccessToast`, `ErrorToast`, `WarningToast`, `InfoToast`
|
|
203
|
-
- `Tooltip`, `TooltipGroup`
|
|
204
|
-
- `Dialog`, `DialogModal`, `ConfirmDialog`, `DestructiveDialog`, `InfoDialog`
|
|
235
|
+
- `Tooltip`, `TooltipGroup`, `ContextMenu`
|
|
236
|
+
- `Dialog`, `DialogModal`, `Drawer`, `ConfirmDialog`, `DestructiveDialog`, `InfoDialog`
|
|
205
237
|
- `Accordion`, `AccordionField`, `FAQAccordion`, `SettingsAccordion`, `SectionsAccordion`
|
|
206
238
|
- `Tab`, `TabGroup`, `TabPanel`, `NavigationTabs`, `ContentTabs`, `SettingsTabs`
|
|
207
239
|
|
|
@@ -463,7 +495,7 @@ Marwes Svelte components are accessible because the adapter renders a shared cor
|
|
|
463
495
|
- Svelte components prefer native DOM controls first: `button`, `input`, `select`, `textarea`, `hr`, and standard form wiring.
|
|
464
496
|
- Field components connect visible labels, helper text, and errors through `id`, `for`, `aria-describedby`, `aria-invalid`, and polite error announcements.
|
|
465
497
|
- Coordinated widgets carry explicit contracts: tabs wire `tablist`/`tab`/`tabpanel`, dialogs own dialog semantics, toasts expose live-region behavior, and purpose buttons expose risk metadata.
|
|
466
|
-
- Storybook accessibility smoke checks run through the Storybook a11y addon for the promoted Svelte families, and shared contract tests keep Svelte aligned
|
|
498
|
+
- Storybook accessibility smoke checks run through the Storybook a11y addon for the promoted Svelte families, and shared contract tests keep Svelte aligned across adapters.
|
|
467
499
|
|
|
468
500
|
Example:
|
|
469
501
|
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# Svelte Components
|
|
2
|
+
|
|
3
|
+
## Cross-Framework Contract
|
|
4
|
+
|
|
5
|
+
Svelte component families follow the role-identical adapter architecture in
|
|
6
|
+
`docs/reference/adapter-architecture.md`.
|
|
7
|
+
|
|
8
|
+
- Each shipped family keeps `.svelte` components, `types.ts`, and a family
|
|
9
|
+
`index.ts` barrel.
|
|
10
|
+
- Public value and type exports are surfaced through
|
|
11
|
+
`packages/svelte/src/lib/index.ts`.
|
|
12
|
+
- Components call the shared core recipes and consume preset CSS through the
|
|
13
|
+
package entry import.
|
|
14
|
+
- Storybook coverage lives in `apps/storybook-svelte/src/stories/<family>/`
|
|
15
|
+
with `Introduction.mdx` and matching stories.
|
|
16
|
+
- Shared contracts live in `packages/svelte/src/tests/` when React, Vue, and
|
|
17
|
+
Svelte can all exercise the same behavior.
|
|
18
|
+
|
|
19
|
+
## Svelte Syntax Notes
|
|
20
|
+
|
|
21
|
+
Svelte-specific differences should stay syntax-level:
|
|
22
|
+
|
|
23
|
+
- use `bind:value` and `bind:checked` for supported form state
|
|
24
|
+
- use lowercase event props such as `onclick`, `onvaluechange`, and
|
|
25
|
+
`oncheckedchange`
|
|
26
|
+
- use snippets/content projection for component content
|
|
27
|
+
- use Svelte context helpers for provider-backed theme access
|
|
28
|
+
|
|
29
|
+
Do not add component-local parity notes that say a family is missing or behind.
|
|
30
|
+
Use Storybook, shared contracts, and the adapter architecture check as the
|
|
31
|
+
current source of truth.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { buildAccordionFieldA11yIds } from "@marwes-ui/core";
|
|
3
3
|
import { mergeClass } from "../../internal/merge-class.js";
|
|
4
|
+
import Text from "../text/Text.svelte";
|
|
4
5
|
import Accordion from "./Accordion.svelte";
|
|
5
6
|
import type { AccordionFieldItem, AccordionFieldProps } from "./types.js";
|
|
6
7
|
|
|
@@ -15,6 +16,7 @@
|
|
|
15
16
|
onopenitemschange,
|
|
16
17
|
multiple = true,
|
|
17
18
|
ariaDescribedBy,
|
|
19
|
+
disabled,
|
|
18
20
|
class: className,
|
|
19
21
|
}: AccordionFieldProps = $props();
|
|
20
22
|
|
|
@@ -32,7 +34,11 @@
|
|
|
32
34
|
buildAccordionFieldA11yIds({ id: fieldId, hasDescription, hasError, externalDescribedBy: ariaDescribedBy })
|
|
33
35
|
);
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
function getInitialOpenItems(): string[] {
|
|
38
|
+
return defaultOpenItems ?? [];
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
let internalOpen = $state<string[]>(getInitialOpenItems());
|
|
36
42
|
const activeOpen = $derived(controlledOpen ?? internalOpen);
|
|
37
43
|
|
|
38
44
|
function toggleItem(value: string): void {
|
|
@@ -48,9 +54,17 @@
|
|
|
48
54
|
onopenitemschange?.(next);
|
|
49
55
|
}
|
|
50
56
|
|
|
51
|
-
const wrapperClass = $derived(
|
|
57
|
+
const wrapperClass = $derived(
|
|
58
|
+
mergeClass(
|
|
59
|
+
"mw-accordion-field",
|
|
60
|
+
disabled && "mw-accordion-field--disabled",
|
|
61
|
+
hasError && "mw-accordion-field--invalid",
|
|
62
|
+
className
|
|
63
|
+
)
|
|
64
|
+
);
|
|
52
65
|
</script>
|
|
53
66
|
|
|
67
|
+
<!-- svelte-ignore a11y_role_supports_aria_props -->
|
|
54
68
|
<div
|
|
55
69
|
class={wrapperClass}
|
|
56
70
|
role="group"
|
|
@@ -59,12 +73,12 @@
|
|
|
59
73
|
aria-invalid={hasError ? true : undefined}
|
|
60
74
|
>
|
|
61
75
|
<div class="mw-accordion-field__label" id={a11yIds.labelId}>
|
|
62
|
-
<
|
|
76
|
+
<Text variant="label">{label}</Text>
|
|
63
77
|
</div>
|
|
64
78
|
|
|
65
79
|
{#if hasDescription && !hasError}
|
|
66
80
|
<div class="mw-accordion-field__description" id={a11yIds.descriptionId}>
|
|
67
|
-
<
|
|
81
|
+
<Text variant="caption">{description}</Text>
|
|
68
82
|
</div>
|
|
69
83
|
{/if}
|
|
70
84
|
|
|
@@ -74,7 +88,7 @@
|
|
|
74
88
|
id={`${fieldId}-${item.value}`}
|
|
75
89
|
title={item.title}
|
|
76
90
|
open={activeOpen.includes(item.value)}
|
|
77
|
-
disabled={item.disabled
|
|
91
|
+
disabled={disabled || item.disabled || false}
|
|
78
92
|
ontoggle={() => toggleItem(item.value)}
|
|
79
93
|
>
|
|
80
94
|
{item.content}
|
|
@@ -84,7 +98,7 @@
|
|
|
84
98
|
|
|
85
99
|
{#if hasError}
|
|
86
100
|
<div class="mw-accordion-field__error" id={a11yIds.errorId} aria-live="polite">
|
|
87
|
-
<
|
|
101
|
+
<Text variant="caption">{error}</Text>
|
|
88
102
|
</div>
|
|
89
103
|
{/if}
|
|
90
104
|
</div>
|
|
@@ -1,2 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export
|
|
1
|
+
export { default as AccordionField } from "./AccordionField.svelte";
|
|
2
|
+
export { default as FAQAccordion } from "./FAQAccordion.svelte";
|
|
3
|
+
export { default as SettingsAccordion } from "./SettingsAccordion.svelte";
|
|
4
|
+
export { default as SectionsAccordion } from "./SectionsAccordion.svelte";
|
|
5
|
+
export type { AccordionFieldItem, AccordionFieldProps, FAQAccordionProps, SettingsAccordionProps, SectionsAccordionProps, } from "./types.js";
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
// `Accordion` (the atom — a single collapsible panel) is intentionally NOT
|
|
2
|
+
// re-exported here. Use `AccordionField` (for groups) or a purpose variant
|
|
3
|
+
// instead. Internal consumers can deep-import "./Accordion.svelte" directly.
|
|
4
|
+
export { default as AccordionField } from "./AccordionField.svelte";
|
|
5
|
+
export { default as FAQAccordion } from "./FAQAccordion.svelte";
|
|
6
|
+
export { default as SettingsAccordion } from "./SettingsAccordion.svelte";
|
|
7
|
+
export { default as SectionsAccordion } from "./SectionsAccordion.svelte";
|
|
@@ -26,3 +26,6 @@ export interface AccordionFieldProps {
|
|
|
26
26
|
class?: string;
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
}
|
|
29
|
+
export type FAQAccordionProps = Omit<AccordionFieldProps, "multiple" | "disabled">;
|
|
30
|
+
export type SettingsAccordionProps = Omit<AccordionFieldProps, "multiple" | "disabled">;
|
|
31
|
+
export type SectionsAccordionProps = Omit<AccordionFieldProps, "disabled">;
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
overflowCount?: number;
|
|
13
13
|
overflowLabel?: string;
|
|
14
14
|
ariaLabel?: string;
|
|
15
|
+
label?: string;
|
|
15
16
|
dataAttributes?: Record<string, string>;
|
|
16
17
|
class?: string;
|
|
17
18
|
}
|
|
@@ -20,12 +21,14 @@
|
|
|
20
21
|
items,
|
|
21
22
|
overflowCount,
|
|
22
23
|
overflowLabel,
|
|
23
|
-
ariaLabel
|
|
24
|
+
ariaLabel,
|
|
25
|
+
label,
|
|
24
26
|
dataAttributes,
|
|
25
27
|
class: className,
|
|
26
28
|
}: AvatarGroupProps = $props();
|
|
27
29
|
|
|
28
30
|
const mergedClass = $derived(mergeClass("mw-avatar-group", className));
|
|
31
|
+
const groupLabel = $derived(ariaLabel ?? label ?? "Avatar group");
|
|
29
32
|
const shouldRenderOverflow = $derived(overflowCount !== undefined && overflowCount > 0);
|
|
30
33
|
const resolvedOverflowLabel = $derived(overflowLabel ?? `${overflowCount} more people`);
|
|
31
34
|
</script>
|
|
@@ -33,7 +36,7 @@
|
|
|
33
36
|
<fieldset
|
|
34
37
|
class={mergedClass}
|
|
35
38
|
data-component="avatar-group"
|
|
36
|
-
aria-label={
|
|
39
|
+
aria-label={groupLabel}
|
|
37
40
|
{...dataAttributes}
|
|
38
41
|
>
|
|
39
42
|
{#each items as item, i}
|
|
@@ -1,2 +1,8 @@
|
|
|
1
|
+
export { AvatarSize, AvatarType } from "@marwes-ui/core";
|
|
1
2
|
export { default as Avatar } from "./Avatar.svelte";
|
|
2
|
-
export
|
|
3
|
+
export { default as AvatarBadge } from "./AvatarBadge.svelte";
|
|
4
|
+
export { default as AvatarGroup } from "./AvatarGroup.svelte";
|
|
5
|
+
export { default as ProfileAvatar } from "./ProfileAvatar.svelte";
|
|
6
|
+
export { default as PresenceAvatar } from "./PresenceAvatar.svelte";
|
|
7
|
+
export { default as TeamAvatarGroup } from "./TeamAvatarGroup.svelte";
|
|
8
|
+
export type { AvatarProps, AvatarBadgeProps, AvatarGroupItem, AvatarGroupProps, ProfileAvatarProps, PresenceAvatarProps, TeamAvatarGroupProps, } from "./types.js";
|
|
@@ -1 +1,7 @@
|
|
|
1
|
+
export { AvatarSize, AvatarType } from "@marwes-ui/core";
|
|
1
2
|
export { default as Avatar } from "./Avatar.svelte";
|
|
3
|
+
export { default as AvatarBadge } from "./AvatarBadge.svelte";
|
|
4
|
+
export { default as AvatarGroup } from "./AvatarGroup.svelte";
|
|
5
|
+
export { default as ProfileAvatar } from "./ProfileAvatar.svelte";
|
|
6
|
+
export { default as PresenceAvatar } from "./PresenceAvatar.svelte";
|
|
7
|
+
export { default as TeamAvatarGroup } from "./TeamAvatarGroup.svelte";
|
|
@@ -4,3 +4,31 @@ export interface AvatarProps extends AvatarOptions {
|
|
|
4
4
|
style?: string | undefined;
|
|
5
5
|
dataAttributes?: Record<string, string>;
|
|
6
6
|
}
|
|
7
|
+
export interface AvatarBadgeProps extends AvatarProps {
|
|
8
|
+
statusLabel?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface AvatarGroupItem extends Omit<AvatarProps, "size" | "class" | "style"> {
|
|
11
|
+
id?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface AvatarGroupProps {
|
|
14
|
+
items: AvatarGroupItem[];
|
|
15
|
+
overflowCount?: number;
|
|
16
|
+
overflowLabel?: string;
|
|
17
|
+
ariaLabel?: string;
|
|
18
|
+
label?: string;
|
|
19
|
+
dataAttributes?: Record<string, string>;
|
|
20
|
+
class?: string;
|
|
21
|
+
}
|
|
22
|
+
export type ProfileAvatarProps = AvatarProps;
|
|
23
|
+
export interface PresenceAvatarProps extends AvatarProps {
|
|
24
|
+
statusLabel?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface TeamAvatarGroupProps {
|
|
27
|
+
items: AvatarGroupItem[];
|
|
28
|
+
overflowCount?: number;
|
|
29
|
+
overflowLabel?: string;
|
|
30
|
+
ariaLabel?: string;
|
|
31
|
+
label?: string;
|
|
32
|
+
dataAttributes?: Record<string, string>;
|
|
33
|
+
class?: string;
|
|
34
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { mergeClass } from "../../internal/merge-class.js";
|
|
3
|
+
import Text from "../text/Text.svelte";
|
|
3
4
|
import type { BadgeGroupProps } from "./types.js";
|
|
4
5
|
|
|
5
6
|
let {
|
|
@@ -17,7 +18,7 @@
|
|
|
17
18
|
|
|
18
19
|
<fieldset class={mergedClass} aria-labelledby={labelId}>
|
|
19
20
|
<legend class="mw-badge-group__label" id={labelId}>
|
|
20
|
-
<
|
|
21
|
+
<Text variant="caption">{label}</Text>
|
|
21
22
|
</legend>
|
|
22
23
|
<div class="mw-badge-group__items">
|
|
23
24
|
{@render children?.()}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { BadgeVariant } from "@marwes-ui/core";
|
|
1
2
|
export { default as Badge } from "./Badge.svelte";
|
|
2
3
|
export { default as BadgeGroup } from "./BadgeGroup.svelte";
|
|
3
|
-
export
|
|
4
|
+
export { default as StatusBadge } from "./StatusBadge.svelte";
|
|
5
|
+
export { default as PriorityBadge } from "./PriorityBadge.svelte";
|
|
6
|
+
export { default as NotificationBadge } from "./NotificationBadge.svelte";
|
|
7
|
+
export type { BadgeProps, BadgeGroupProps, StatusBadgeProps, PriorityBadgeProps, NotificationBadgeProps, } from "./types.js";
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export { BadgeVariant } from "@marwes-ui/core";
|
|
1
2
|
export { default as Badge } from "./Badge.svelte";
|
|
2
3
|
export { default as BadgeGroup } from "./BadgeGroup.svelte";
|
|
4
|
+
export { default as StatusBadge } from "./StatusBadge.svelte";
|
|
5
|
+
export { default as PriorityBadge } from "./PriorityBadge.svelte";
|
|
6
|
+
export { default as NotificationBadge } from "./NotificationBadge.svelte";
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createBannerRecipe } from "@marwes-ui/core";
|
|
3
|
+
import { mergeClass } from "../../internal/merge-class.js";
|
|
4
|
+
import type { BannerProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
let {
|
|
7
|
+
children,
|
|
8
|
+
icon,
|
|
9
|
+
action,
|
|
10
|
+
ondismiss,
|
|
11
|
+
class: className,
|
|
12
|
+
id,
|
|
13
|
+
...coreProps
|
|
14
|
+
}: BannerProps = $props();
|
|
15
|
+
|
|
16
|
+
const kit = $derived(createBannerRecipe({
|
|
17
|
+
...coreProps,
|
|
18
|
+
showAction: coreProps.showAction ?? Boolean(action),
|
|
19
|
+
}));
|
|
20
|
+
const mergedClass = $derived(mergeClass(kit.root.className, className));
|
|
21
|
+
</script>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
{id}
|
|
25
|
+
class={mergedClass}
|
|
26
|
+
role={kit.root.a11y.role}
|
|
27
|
+
aria-label={kit.root.a11y.ariaLabel}
|
|
28
|
+
aria-live={kit.root.a11y.ariaLive}
|
|
29
|
+
{...kit.root.dataAttributes}
|
|
30
|
+
>
|
|
31
|
+
<div class={kit.content.className}>
|
|
32
|
+
{#if kit.icon.visible}
|
|
33
|
+
<span class={kit.icon.className}>
|
|
34
|
+
{#if icon}
|
|
35
|
+
{@render icon()}
|
|
36
|
+
{:else}
|
|
37
|
+
<svg
|
|
38
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
39
|
+
width="12"
|
|
40
|
+
height="12"
|
|
41
|
+
viewBox="0 0 24 24"
|
|
42
|
+
fill="currentColor"
|
|
43
|
+
aria-hidden="true"
|
|
44
|
+
>
|
|
45
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z"/>
|
|
46
|
+
</svg>
|
|
47
|
+
{/if}
|
|
48
|
+
</span>
|
|
49
|
+
{/if}
|
|
50
|
+
<span class={kit.message.className}>
|
|
51
|
+
{@render children?.()}
|
|
52
|
+
</span>
|
|
53
|
+
</div>
|
|
54
|
+
{#if kit.action.visible && action}
|
|
55
|
+
<div class={kit.action.className}>
|
|
56
|
+
{@render action()}
|
|
57
|
+
</div>
|
|
58
|
+
{/if}
|
|
59
|
+
{#if kit.dismiss.visible}
|
|
60
|
+
<button
|
|
61
|
+
type="button"
|
|
62
|
+
class={kit.dismiss.className}
|
|
63
|
+
aria-label={kit.dismiss.ariaLabel}
|
|
64
|
+
onclick={ondismiss}
|
|
65
|
+
></button>
|
|
66
|
+
{/if}
|
|
67
|
+
</div>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createPurposeSemanticAttributes } from "@marwes-ui/core";
|
|
3
|
+
import Banner from "./Banner.svelte";
|
|
4
|
+
import type { BannerProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
let { variant: _variant, ...props }: BannerProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Banner {...props} variant="error" />
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createPurposeSemanticAttributes } from "@marwes-ui/core";
|
|
3
|
+
import Banner from "./Banner.svelte";
|
|
4
|
+
import type { BannerProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
let { variant: _variant, ...props }: BannerProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Banner {...props} variant="info" />
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createPurposeSemanticAttributes } from "@marwes-ui/core";
|
|
3
|
+
import Banner from "./Banner.svelte";
|
|
4
|
+
import type { BannerProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
let { variant: _variant, ...props }: BannerProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Banner {...props} variant="success" />
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { createPurposeSemanticAttributes } from "@marwes-ui/core";
|
|
3
|
+
import Banner from "./Banner.svelte";
|
|
4
|
+
import type { BannerProps } from "./types.js";
|
|
5
|
+
|
|
6
|
+
let { variant: _variant, ...props }: BannerProps = $props();
|
|
7
|
+
</script>
|
|
8
|
+
|
|
9
|
+
<Banner {...props} variant="warning" />
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { BannerVariant } from "@marwes-ui/core";
|
|
2
|
+
export { default as Banner } from "./Banner.svelte";
|
|
3
|
+
export { default as InfoBanner } from "./InfoBanner.svelte";
|
|
4
|
+
export { default as SuccessBanner } from "./SuccessBanner.svelte";
|
|
5
|
+
export { default as WarningBanner } from "./WarningBanner.svelte";
|
|
6
|
+
export { default as ErrorBanner } from "./ErrorBanner.svelte";
|
|
7
|
+
export type { BannerProps, InfoBannerProps, SuccessBannerProps, WarningBannerProps, ErrorBannerProps, } from "./types.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BannerVariant } from "@marwes-ui/core";
|
|
2
|
+
export { default as Banner } from "./Banner.svelte";
|
|
3
|
+
export { default as InfoBanner } from "./InfoBanner.svelte";
|
|
4
|
+
export { default as SuccessBanner } from "./SuccessBanner.svelte";
|
|
5
|
+
export { default as WarningBanner } from "./WarningBanner.svelte";
|
|
6
|
+
export { default as ErrorBanner } from "./ErrorBanner.svelte";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { BannerOptions } from "@marwes-ui/core";
|
|
2
|
+
import type { Snippet } from "svelte";
|
|
3
|
+
export interface BannerProps extends BannerOptions {
|
|
4
|
+
children?: Snippet;
|
|
5
|
+
icon?: Snippet;
|
|
6
|
+
action?: Snippet;
|
|
7
|
+
ondismiss?: () => void;
|
|
8
|
+
class?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
}
|
|
11
|
+
export type InfoBannerProps = Omit<BannerProps, "variant">;
|
|
12
|
+
export type SuccessBannerProps = Omit<BannerProps, "variant">;
|
|
13
|
+
export type WarningBannerProps = Omit<BannerProps, "variant">;
|
|
14
|
+
export type ErrorBannerProps = Omit<BannerProps, "variant">;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|