@ptlm-azulejo/loader 1.1.0 → 1.1.1-alpha.77

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 ADDED
@@ -0,0 +1,54 @@
1
+ # Change Log
2
+
3
+ ## 1.1.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.1.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
+ All notable changes to this project will be documented in this file.
54
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
package/README.md CHANGED
@@ -4,30 +4,83 @@ A loader is a visual indicator used to inform users that a process is in progres
4
4
 
5
5
  ## Installation
6
6
 
7
+ Install the loader, the theme package, and **the font package matching your
8
+ project's brand**:
9
+
10
+ **Leroy Merlin projects**
11
+
12
+ ```bash
13
+ npm install @ptlm-azulejo/loader @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
14
+ # or
15
+ yarn add @ptlm-azulejo/loader @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
16
+ ```
17
+
18
+ **Adeo projects**
19
+
7
20
  ```bash
8
- npm install @ptlm-azulejo/loader @ptlm-azulejo/themes
21
+ npm install @ptlm-azulejo/loader @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
9
22
  # or
10
- yarn add @ptlm-azulejo/loader @ptlm-azulejo/themes
23
+ yarn add @ptlm-azulejo/loader @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
11
24
  ```
12
25
 
13
26
  ## Styles & theming
14
27
 
15
- The component reads theme CSS variables, so it needs `@ptlm-azulejo/themes`. Import a
16
- brand preset (it bundles the base tokens) and the component styles, then set the
17
- brand class on the root element:
28
+ The component ships no colors or typeface of its own — it reads design tokens from
29
+ CSS variables at runtime. Those tokens come from `@ptlm-azulejo/themes`, and **the
30
+ brand is selected by a class on your app's `<html>` element**, so switching brand
31
+ never touches component code.
32
+
33
+ | Project | Preset stylesheet | Root class | Typeface | Font package |
34
+ | --- | --- | --- | --- | --- |
35
+ | Leroy Merlin | `@ptlm-azulejo/themes/presets/leroy-merlin.css` | `preset-lm` | LeroyMerlinSans | `@ptlm-azulejo/fonts-leroy-merlin` |
36
+ | Adeo | `@ptlm-azulejo/themes/presets/adeo.css` | `preset-adeo` | Roboto | `@ptlm-azulejo/fonts-adeo` |
37
+
38
+ **Leroy Merlin projects**
39
+
40
+ ```js
41
+ import '@ptlm-azulejo/themes/presets/leroy-merlin.css'
42
+ import '@ptlm-azulejo/fonts-leroy-merlin'
43
+ import '@ptlm-azulejo/loader/style.css'
44
+ ```
45
+
46
+ ```html
47
+ <html lang="pt" class="preset-lm">
48
+ ```
49
+
50
+ **Adeo projects**
18
51
 
19
52
  ```js
20
- import '@ptlm-azulejo/themes/presets/leroy-merlin.css' // or /presets/adeo.css
53
+ import '@ptlm-azulejo/themes/presets/adeo.css'
54
+ import '@ptlm-azulejo/fonts-adeo'
21
55
  import '@ptlm-azulejo/loader/style.css'
22
56
  ```
23
57
 
24
58
  ```html
25
- <html class="preset-lm" data-theme="dark">
59
+ <html lang="pt" class="preset-adeo">
60
+ ```
61
+
62
+ > The preset class is what resolves the brand at runtime. Without it — even with
63
+ > the stylesheets imported — the component renders uncolored and in a fallback
64
+ > typeface. See the [themes package](../themes/README.md) for brand switching,
65
+ > dark mode, and custom brands.
66
+
67
+ ### Light and dark mode
68
+
69
+ Add `data-theme` alongside the brand class to pin the color scheme. Leave it off
70
+ and the preset follows the OS `prefers-color-scheme`:
71
+
72
+ ```html
73
+ <html lang="pt" class="preset-lm" data-theme="dark">
26
74
  ```
27
75
 
28
- > Without a preset **and** the `.preset-*` class, the component renders uncolored.
29
- > See the [themes package](../themes/README.md) for brand switching, dark mode,
30
- > and custom brands.
76
+ ### Why the font package is separate
77
+
78
+ The preset only *names* its typeface in `--font-family` and ships no font files.
79
+ [Loading them is your app's job](../themes/README.md#fonts), as with upstream
80
+ Mozaic, so you keep control of hosting, subsetting and preload. Without the
81
+ matching font package, `font-sans` falls back to a generic sans-serif. A
82
+ multi-brand app can install both and switch by swapping the `.preset-*` class:
83
+ only the active brand's file is ever downloaded.
31
84
 
32
85
  ## Props
33
86
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.stories.d.ts","sourceRoot":"","sources":["../../src/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CA6E7B,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAAU,CAAC;AAElC,eAAO,MAAM,MAAM,EAAE,KAEpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAyBnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC"}
1
+ {"version":3,"file":"index.stories.d.ts","sourceRoot":"","sources":["../../src/index.stories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,MAAM,MAAM,aAAa,CAAC;AAEjC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,MAAM,CAiI7B,CAAC;AACF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,QAAQ,EAAE,KAAU,CAAC;AAElC,eAAO,MAAM,MAAM,EAAE,KAEpB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,KAWrB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAyBnB,CAAC;AAEF,eAAO,MAAM,QAAQ,EAAE,KAEtB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptlm-azulejo/loader",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-alpha.77",
4
4
  "type": "module",
5
5
  "main": "./dist/index.umd.cjs",
6
6
  "module": "./dist/index.js",