@ptlm-azulejo/themes 1.2.1 → 1.3.0-alpha.84
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 +80 -0
- package/README.md +37 -29
- package/package.json +2 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# @ptlm-azulejo/themes
|
|
2
|
+
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- dda8cdb: Add a scoped UA preflight to themes (bundled with every preset) so Azulejo
|
|
8
|
+
controls don't depend on the host running Tailwind Preflight. Drop the
|
|
9
|
+
per-segment button-reset utilities from SegmentedControl. Re-export
|
|
10
|
+
`SegmentedControlItem`, `SegmentedControlSize`, and `SegmentedControlUi`
|
|
11
|
+
from the package entry so consumers can import the types again.
|
|
12
|
+
|
|
13
|
+
## 1.2.1
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- e5341cd: Documentation. Every package README now spells out both brands end to end instead
|
|
18
|
+
of showing one snippet with an "or" comment: which preset stylesheet to import,
|
|
19
|
+
which `.preset-*` class goes on `<html>` to select the theme at runtime,
|
|
20
|
+
`data-theme` for light/dark, and which font package the project needs (Leroy
|
|
21
|
+
Merlin → `@ptlm-azulejo/fonts-leroy-merlin`, Adeo → `@ptlm-azulejo/fonts-adeo`).
|
|
22
|
+
|
|
23
|
+
No component behaviour, prop or token changed. The patch bump exists because npm
|
|
24
|
+
ships `README.md` inside the tarball and renders it as the package page, so the
|
|
25
|
+
corrected instructions only reach consumers on a release.
|
|
26
|
+
|
|
27
|
+
## 1.2.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- eb0b0f8: Make components follow the brand typeface, add the medium (500) font weight, and
|
|
32
|
+
expose stable `data-testid` hooks.
|
|
33
|
+
|
|
34
|
+
- Each preset now names its brand's typeface in `--font-family`
|
|
35
|
+
(`presets/leroy-merlin.css` → LeroyMerlin, `presets/adeo.css` → Roboto), with
|
|
36
|
+
`Arial, sans-serif` as the fallback stack.
|
|
37
|
+
- Components apply that typeface on their root, so they follow the active brand
|
|
38
|
+
instead of inheriting the host page's font. Opt out per component by setting
|
|
39
|
+
`--font-family: inherit` on it.
|
|
40
|
+
- `base.css` adds `--font-weight-medium: 500`, alongside the existing regular
|
|
41
|
+
(400), semi-bold (600) and bold (700) weights.
|
|
42
|
+
- Every component now exposes `data-testid` on its root and on meaningful
|
|
43
|
+
sub-parts (`button` / `button-spinner`, `loader` / `loader-text`,
|
|
44
|
+
`datepicker` / `datepicker-clear`, `segmented-control` /
|
|
45
|
+
`segmented-control-segment`), so tests can target them without depending on
|
|
46
|
+
CSS class names.
|
|
47
|
+
|
|
48
|
+
As with upstream Mozaic, the presets **name** the typeface but ship no
|
|
49
|
+
`@font-face` and no font binaries — loading the files stays the app's job, so you
|
|
50
|
+
keep control of hosting, subsetting and preload. Until you load them the fallback
|
|
51
|
+
stack renders and nothing breaks. Install the font package matching your brand
|
|
52
|
+
alongside the preset:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Leroy Merlin
|
|
56
|
+
yarn add @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
57
|
+
# Adeo
|
|
58
|
+
yarn add @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
See the Fonts section of `packages/themes/README.md` for the full recipe.
|
|
62
|
+
|
|
63
|
+
## 1.1.0
|
|
64
|
+
|
|
65
|
+
### Minor Changes
|
|
66
|
+
|
|
67
|
+
- 53000f7: Add Mozaic-aligned multi-brand theming support.
|
|
68
|
+
|
|
69
|
+
- New `@ptlm-azulejo/themes` package with structural/status tokens in `base.css`
|
|
70
|
+
and brand presets selected by a root class (`presets/leroy-merlin.css`,
|
|
71
|
+
`presets/adeo.css`), via `.preset-lm` / `.preset-adeo` and `data-theme` for
|
|
72
|
+
light/dark.
|
|
73
|
+
- `AzButton` now consumes theme tokens through utilities mapped in
|
|
74
|
+
`@theme inline`, working across both brands and in light/dark.
|
|
75
|
+
|
|
76
|
+
**BREAKING:** components no longer bake brand colors. The consumer must now
|
|
77
|
+
import `@ptlm-azulejo/themes/base.css` + a preset and apply the
|
|
78
|
+
`.preset-lm`/`.preset-adeo` class (and optional `data-theme="dark"`) on the root
|
|
79
|
+
element; otherwise components render uncolored. See the migration notes in
|
|
80
|
+
`packages/themes/README.md`.
|
package/README.md
CHANGED
|
@@ -9,10 +9,11 @@ runtime via CSS variables — the equivalent of `@mozaic-ds/tokens`.
|
|
|
9
9
|
|
|
10
10
|
The theme has two parts:
|
|
11
11
|
|
|
12
|
-
| File
|
|
13
|
-
|
|
14
|
-
| `base.css`
|
|
15
|
-
| `
|
|
12
|
+
| File | Contents | Brand-specific? |
|
|
13
|
+
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | --------------- |
|
|
14
|
+
| `base.css` | **Structural + status** tokens + imports `preflight.css` | No |
|
|
15
|
+
| `preflight.css` | **UA wipe** for form controls (`button`, `input`, …), scoped to `.preset-*` | No |
|
|
16
|
+
| `presets/<brand>.css` | **Brand** tokens — typeface (`--font-family`) and functional colors (`--color-brand`, `--color-text-*`, `--color-background-*`, `--color-border-*`) | Yes |
|
|
16
17
|
|
|
17
18
|
The brand is selected with a **class on the root element** (`.preset-lm`,
|
|
18
19
|
`.preset-adeo`) and light/dark mode with the **`data-theme`** attribute.
|
|
@@ -44,33 +45,38 @@ styles**:
|
|
|
44
45
|
**Leroy Merlin projects**
|
|
45
46
|
|
|
46
47
|
```js
|
|
47
|
-
import
|
|
48
|
-
import
|
|
48
|
+
import "@ptlm-azulejo/themes/presets/leroy-merlin.css"; // includes base.css
|
|
49
|
+
import "@ptlm-azulejo/button/style.css";
|
|
49
50
|
```
|
|
50
51
|
|
|
51
52
|
**Adeo projects**
|
|
52
53
|
|
|
53
54
|
```js
|
|
54
|
-
import
|
|
55
|
-
import
|
|
55
|
+
import "@ptlm-azulejo/themes/presets/adeo.css"; // includes base.css
|
|
56
|
+
import "@ptlm-azulejo/button/style.css";
|
|
56
57
|
```
|
|
57
58
|
|
|
58
|
-
> Each preset `@import`s `base.css` (the structural + status tokens
|
|
59
|
-
> preset import gives you everything. You can
|
|
60
|
-
> (`@ptlm-azulejo/themes/base.css`) if you
|
|
61
|
-
> it carries **no `--font-family`**,
|
|
62
|
-
>
|
|
63
|
-
> sans-serif (the font weights still apply).
|
|
64
|
-
> go this route.
|
|
59
|
+
> Each preset `@import`s `base.css` (the structural + status tokens **and** a
|
|
60
|
+
> scoped UA preflight), so a single preset import gives you everything. You can
|
|
61
|
+
> still import `base.css` on its own (`@ptlm-azulejo/themes/base.css`) if you
|
|
62
|
+
> ever need it without a brand — but note it carries **no `--font-family`**,
|
|
63
|
+
> since the typeface belongs to the brand. Without a preset, components render
|
|
64
|
+
> uncolored and fall back to a generic sans-serif (the font weights still apply).
|
|
65
|
+
> Define `--font-family` yourself if you go this route.
|
|
66
|
+
>
|
|
67
|
+
> The preflight only runs under `.preset-lm` / `.preset-adeo` (via `:where(…)` so
|
|
68
|
+
> component utilities still win). It clears browser defaults on `button`,
|
|
69
|
+
> `input`, `select`, and `textarea` so Azulejo controls look the same whether or
|
|
70
|
+
> not the host app runs Tailwind Preflight.
|
|
65
71
|
|
|
66
72
|
Then apply the brand class on `<html>` (or any container):
|
|
67
73
|
|
|
68
74
|
```html
|
|
69
75
|
<!-- Leroy Merlin, light (default) -->
|
|
70
76
|
<html class="preset-lm">
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
77
|
+
<!-- Adeo, dark -->
|
|
78
|
+
<html class="preset-adeo" data-theme="dark"></html>
|
|
79
|
+
</html>
|
|
74
80
|
```
|
|
75
81
|
|
|
76
82
|
> **Important:** without importing a preset (which bundles `base.css`) **and**
|
|
@@ -91,18 +97,18 @@ files is the app's job.
|
|
|
91
97
|
|
|
92
98
|
There is a package per brand that does exactly that job:
|
|
93
99
|
|
|
94
|
-
| Brand
|
|
95
|
-
|
|
96
|
-
| `.preset-lm`
|
|
97
|
-
| `.preset-adeo` | `"Roboto", Arial, sans-serif`
|
|
100
|
+
| Brand | `--font-family` | Font package |
|
|
101
|
+
| -------------- | ----------------------------------- | ------------------------------------------------------------------- |
|
|
102
|
+
| `.preset-lm` | `"LeroyMerlin", Arial, sans-serif` | [`@ptlm-azulejo/fonts-leroy-merlin`](../FontsLeroyMerlin/README.md) |
|
|
103
|
+
| `.preset-adeo` | `"Roboto", Arial, sans-serif` | [`@ptlm-azulejo/fonts-adeo`](../FontsAdeo/README.md) |
|
|
98
104
|
|
|
99
105
|
```bash
|
|
100
106
|
yarn add @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
101
107
|
```
|
|
102
108
|
|
|
103
109
|
```js
|
|
104
|
-
import
|
|
105
|
-
import
|
|
110
|
+
import "@ptlm-azulejo/themes/presets/leroy-merlin.css";
|
|
111
|
+
import "@ptlm-azulejo/fonts-leroy-merlin";
|
|
106
112
|
```
|
|
107
113
|
|
|
108
114
|
Until you load a typeface the fallback stack renders, so nothing breaks — it just
|
|
@@ -129,7 +135,7 @@ The two font packages differ, for licensing reasons:
|
|
|
129
135
|
### Only the active brand's font is downloaded
|
|
130
136
|
|
|
131
137
|
You can declare **both** brands' faces and switch freely — the other brand's file
|
|
132
|
-
is never fetched. `@font-face` is a
|
|
138
|
+
is never fetched. `@font-face` is a _declaration_, not a fetch: a browser only
|
|
133
139
|
requests a font file when text it is actually rendering computes a `font-family`
|
|
134
140
|
naming it. With `.preset-lm` on the root, nothing ever computes `Roboto`.
|
|
135
141
|
|
|
@@ -143,7 +149,9 @@ Components apply the brand typeface themselves, so they follow the brand rather
|
|
|
143
149
|
than inheriting your page's font. To hand a component back to the page font:
|
|
144
150
|
|
|
145
151
|
```css
|
|
146
|
-
.preset-lm .btn {
|
|
152
|
+
.preset-lm .btn {
|
|
153
|
+
font-family: inherit;
|
|
154
|
+
}
|
|
147
155
|
```
|
|
148
156
|
|
|
149
157
|
### Switching brand at runtime
|
|
@@ -151,8 +159,8 @@ than inheriting your page's font. To hand a component back to the page font:
|
|
|
151
159
|
Just swap the root class (both presets can be imported at the same time):
|
|
152
160
|
|
|
153
161
|
```js
|
|
154
|
-
document.documentElement.classList.remove(
|
|
155
|
-
document.documentElement.classList.add(
|
|
162
|
+
document.documentElement.classList.remove("preset-lm", "preset-adeo");
|
|
163
|
+
document.documentElement.classList.add("preset-adeo");
|
|
156
164
|
```
|
|
157
165
|
|
|
158
166
|
## Creating a custom brand
|
|
@@ -163,7 +171,7 @@ Define the same brand tokens of the contract under your brand class:
|
|
|
163
171
|
.preset-my-brand {
|
|
164
172
|
/* Typeface. The 400/500/600/700 weights come from base.css; override them here
|
|
165
173
|
only if your typeface lacks those cuts. */
|
|
166
|
-
--font-family: "Inter",
|
|
174
|
+
--font-family: "Inter", Arial, sans-serif;
|
|
167
175
|
|
|
168
176
|
--color-brand: #6c2bd9;
|
|
169
177
|
--color-brand-dark: #531fb0;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ptlm-azulejo/themes",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0-alpha.84",
|
|
4
4
|
"description": "Multi-brand theme tokens (Leroy Merlin, Adeo) for the @ptlm-azulejo components, aligned with the Mozaic Design System.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"base.css",
|
|
18
|
+
"preflight.css",
|
|
18
19
|
"presets/*.css"
|
|
19
20
|
]
|
|
20
21
|
}
|