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