@maggioli-design-system/magma-react 2.1.0 → 2.2.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/AGENTS.md CHANGED
@@ -5,7 +5,7 @@
5
5
  -->
6
6
  # @maggioli-design-system/magma-react - agent install guide
7
7
 
8
- > Version 2.1.0. You (the agent) are installing Magma into THIS project. Do not
8
+ > Version 2.2.0. You (the agent) are installing Magma into THIS project. Do not
9
9
  > assume the setup - detect it from the project, then ask the user only for what you
10
10
  > cannot infer. The detailed steps live in [`agents/install.md`](agents/install.md)
11
11
  > (this target) and [`agents/assets.md`](agents/assets.md) (shared styles, fonts,
@@ -64,6 +64,7 @@ Once installed, do not guess component APIs or rules - read only the file you ne
64
64
  | Coloring your own UI | [`agents/color.md`](agents/color.md) |
65
65
  | Typography utilities | [`agents/typography.md`](agents/typography.md) |
66
66
  | Dark mode, preferences, named themes, surface levels and elevation, global design decisions, corner geometry | [`agents/theming.md`](agents/theming.md) |
67
+ | Reporting a problem that is Magma's, not this project's (bug, wrong guide, missing token), with this project's origin label | [`agents/reporting.md`](agents/reporting.md) |
67
68
 
68
69
  Tooling that needs structured data reads `documentation.json`: one per component beside
69
70
  its `AGENTS.md`, or `@maggioli-design-system/magma/dist/documentation.json` for all of them
package/agents/install.md CHANGED
@@ -168,6 +168,38 @@ SSR notes:
168
168
  server-only). It is imported lazily behind a `typeof window` check and must
169
169
  never end up in a client bundle.
170
170
 
171
+ ## 6. Client-side routing
172
+
173
+ The links of the components (`href` of `MdsButton`, `MdsTabItem`, ...) are real anchors
174
+ the browser follows, loading the page. Register the router once, in the client wrapper of
175
+ section 3, and every plain click on a component link is routed on the client instead; a
176
+ modifier or middle click, `target="blank"` and a link to another origin stay with the browser.
177
+
178
+ ```tsx
179
+ 'use client';
180
+ import { useEffect } from 'react';
181
+ import { useRouter } from 'next/navigation';
182
+ import { NavigationService } from '@maggioli-design-system/magma/services';
183
+
184
+ export default function ClientGlobalsWrapper({
185
+ children,
186
+ }: Readonly<{ children: React.ReactNode }>) {
187
+ const router = useRouter();
188
+
189
+ useEffect(() => {
190
+ sessionStorage.setItem('mdsIconSvgPath', '/svg/');
191
+ }, []);
192
+ // setHandler returns the function that removes the handler: the cleanup of the effect
193
+ useEffect(() => NavigationService.setHandler((href) => router.push(href)), [router]);
194
+
195
+ return <>{children}</>;
196
+ }
197
+ ```
198
+
199
+ With React Router the handler is `(href) => navigate(href)` from `useNavigate()`. Return
200
+ `false` from the handler for a link the browser is to load. Without a registered router, an
201
+ `onClick` on the component can still cancel the click with `preventDefault()` and route by hand.
202
+
171
203
  ## Gotchas
172
204
 
173
205
  - The icon path effect must run on the client. In Next.js App Router the wrapper that
@@ -0,0 +1,118 @@
1
+ <!--
2
+ GENERATED FILE - do not edit by hand.
3
+ Source of truth: docs/agents/ in the magma monorepo.
4
+ Regenerate with: npm run sync.agent-docs (from the stencil package).
5
+ -->
6
+ # Magma - reporting a problem
7
+
8
+ > Scope: you are working in a project that uses Magma and you hit a problem that is
9
+ > Magma's, not the project's: a component that misbehaves, a guide that is wrong, a
10
+ > missing token or utility, a packaging or install issue. This is how to report it to
11
+ > the Magma repository, `magma-design-system/magma`, labelled with the project it comes
12
+ > from, so the maintainers can tell which project reported what.
13
+
14
+ ## 1. Make sure it is Magma's
15
+
16
+ - Read the component's `AGENTS.md` and `antipattern.md`, and
17
+ [`anti-patterns.md`](anti-patterns.md): a documented mistake is the project's to fix,
18
+ not a Magma bug.
19
+ - Check that the installed `magma`, `styles` and `design-tokens` versions belong
20
+ together (the ones a `magma` release depends on): mismatched versions break tokens
21
+ and styles on their own.
22
+ - Reduce it to the smallest markup that still shows the problem, without the project's
23
+ own CSS or wrappers when you can.
24
+
25
+ ## 2. Look for an existing issue
26
+
27
+ ```bash
28
+ gh issue list --repo magma-design-system/magma --state all --search "<component or keywords>"
29
+ ```
30
+
31
+ If one already describes it, comment there with what is new (your versions, another
32
+ reproduction) and the project you hit it in, instead of opening a duplicate.
33
+
34
+ ## 3. Ask before you open it
35
+
36
+ The Magma repository is public: opening an issue publishes its text. Draft the issue,
37
+ show it to the user, and create it only once they agree. Leave out anything private to
38
+ the project: internal URLs, credentials, customer data, unreleased features.
39
+
40
+ ## 4. Pick the labels
41
+
42
+ Every issue carries three kinds of label:
43
+
44
+ | Label | Says | Values |
45
+ | ----- | ---- | ------ |
46
+ | type | what kind of issue | `bug`, `feature`, `docs` |
47
+ | `prg-*` | which Magma package is affected | `prg-stencil` (the components: `magma`, `magma-react`, `magma-angular`), `prg-styles`, `prg-design-tokens`, `prg-svg-icons`, `prg-icons`, `prg-identity` |
48
+ | `prd-*` | which project it was found in (its origin) | one per project, e.g. `prd-mindy` |
49
+
50
+ Find this project's origin label. Each one's description names the project and its
51
+ repository:
52
+
53
+ ```bash
54
+ gh label list --repo magma-design-system/magma --search prd-
55
+ ```
56
+
57
+ Match it against this project's repository name (the `origin` remote, or the `name` in
58
+ `package.json`). If none matches, do not create one: the Magma maintainers manage the
59
+ labels of their repository. Open the issue without it and say in the body which project
60
+ and repository it comes from, so they can add the label.
61
+
62
+ GitHub sets labels on a new issue only for users with write access to the repository,
63
+ and drops them for everyone else, often without an error. After creating the issue,
64
+ check what it got:
65
+
66
+ ```bash
67
+ gh issue view <number> --repo magma-design-system/magma --json labels
68
+ ```
69
+
70
+ If the labels were dropped, the `Found in` line of the body is what the maintainers
71
+ label it from.
72
+
73
+ ## 5. Write it
74
+
75
+ In English. Title: `<component or package>: <what is wrong>`, e.g.
76
+ `mds-modal: the window jumps on open`. Body:
77
+
78
+ ```markdown
79
+ ## Problem
80
+
81
+ What happens, and what should happen instead.
82
+
83
+ ## How to reproduce
84
+
85
+ The minimal markup or the steps, and the browser if it matters.
86
+
87
+ ## Versions
88
+
89
+ - @maggioli-design-system/magma (or magma-react / magma-angular): <installed version>
90
+ - @maggioli-design-system/styles: <installed version>
91
+ - @maggioli-design-system/design-tokens: <installed version>
92
+ - Framework: <e.g. Next 16 + React 19, Angular 20, none>
93
+
94
+ ## Workaround
95
+
96
+ What the project does meanwhile, if anything.
97
+
98
+ Found in <project> (<repository>): <where in the app>.
99
+ ```
100
+
101
+ Read the installed versions from the lockfile or `npm ls`, not from the ranges in
102
+ `package.json`.
103
+
104
+ ## 6. Create it
105
+
106
+ ```bash
107
+ gh issue create --repo magma-design-system/magma \
108
+ --title "mds-modal: the window jumps on open" \
109
+ --label bug --label prg-stencil --label prd-<project> \
110
+ --body-file magma-issue.md
111
+ ```
112
+
113
+ Pass only labels that exist: `gh` refuses an unknown one. Without `gh`, give the user
114
+ the title, the labels and the body to open it by hand at
115
+ `https://github.com/magma-design-system/magma/issues/new`.
116
+
117
+ Then give the user the issue URL, and leave a comment in the project next to the
118
+ workaround that links it, so the workaround can go once the fix ships.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maggioli-design-system/magma-react",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "main": "dist/components.js",
5
5
  "module": "dist/components.js",
6
6
  "types": "dist/types/components.d.ts",
@@ -32,7 +32,7 @@
32
32
  "access": "public"
33
33
  },
34
34
  "dependencies": {
35
- "@maggioli-design-system/magma": "2.1.0",
35
+ "@maggioli-design-system/magma": "2.2.0",
36
36
  "@stencil/react-output-target": "1.6.2"
37
37
  },
38
38
  "repository": {