@ptlm-azulejo/datepicker 0.1.0 → 0.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 +54 -0
- package/README.md +63 -10
- package/dist/src/index.stories.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Change Log
|
|
2
|
+
|
|
3
|
+
## 0.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
|
+
## 0.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
|
@@ -6,30 +6,83 @@ To put a label, requirement text, help text or to apply a valid or invalid messa
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
+
Install the datepicker, the theme package, and **the font package matching your
|
|
10
|
+
project's brand**:
|
|
11
|
+
|
|
12
|
+
**Leroy Merlin projects**
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @ptlm-azulejo/datepicker @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
16
|
+
# or
|
|
17
|
+
yarn add @ptlm-azulejo/datepicker @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Adeo projects**
|
|
21
|
+
|
|
9
22
|
```bash
|
|
10
|
-
npm install @ptlm-azulejo/datepicker @ptlm-azulejo/themes
|
|
23
|
+
npm install @ptlm-azulejo/datepicker @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
|
|
11
24
|
# or
|
|
12
|
-
yarn add @ptlm-azulejo/datepicker @ptlm-azulejo/themes
|
|
25
|
+
yarn add @ptlm-azulejo/datepicker @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
|
|
13
26
|
```
|
|
14
27
|
|
|
15
28
|
## Styles & theming
|
|
16
29
|
|
|
17
|
-
The component
|
|
18
|
-
|
|
19
|
-
brand class on
|
|
30
|
+
The component ships no colors or typeface of its own — it reads design tokens from
|
|
31
|
+
CSS variables at runtime. Those tokens come from `@ptlm-azulejo/themes`, and **the
|
|
32
|
+
brand is selected by a class on your app's `<html>` element**, so switching brand
|
|
33
|
+
never touches component code.
|
|
34
|
+
|
|
35
|
+
| Project | Preset stylesheet | Root class | Typeface | Font package |
|
|
36
|
+
| --- | --- | --- | --- | --- |
|
|
37
|
+
| Leroy Merlin | `@ptlm-azulejo/themes/presets/leroy-merlin.css` | `preset-lm` | LeroyMerlinSans | `@ptlm-azulejo/fonts-leroy-merlin` |
|
|
38
|
+
| Adeo | `@ptlm-azulejo/themes/presets/adeo.css` | `preset-adeo` | Roboto | `@ptlm-azulejo/fonts-adeo` |
|
|
39
|
+
|
|
40
|
+
**Leroy Merlin projects**
|
|
41
|
+
|
|
42
|
+
```js
|
|
43
|
+
import '@ptlm-azulejo/themes/presets/leroy-merlin.css'
|
|
44
|
+
import '@ptlm-azulejo/fonts-leroy-merlin'
|
|
45
|
+
import '@ptlm-azulejo/datepicker/style.css'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
```html
|
|
49
|
+
<html lang="pt" class="preset-lm">
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Adeo projects**
|
|
20
53
|
|
|
21
54
|
```js
|
|
22
|
-
import '@ptlm-azulejo/themes/presets/
|
|
55
|
+
import '@ptlm-azulejo/themes/presets/adeo.css'
|
|
56
|
+
import '@ptlm-azulejo/fonts-adeo'
|
|
23
57
|
import '@ptlm-azulejo/datepicker/style.css'
|
|
24
58
|
```
|
|
25
59
|
|
|
26
60
|
```html
|
|
27
|
-
<html
|
|
61
|
+
<html lang="pt" class="preset-adeo">
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> The preset class is what resolves the brand at runtime. Without it — even with
|
|
65
|
+
> the stylesheets imported — the component renders uncolored and in a fallback
|
|
66
|
+
> typeface. See the [themes package](../themes/README.md) for brand switching,
|
|
67
|
+
> dark mode, and custom brands.
|
|
68
|
+
|
|
69
|
+
### Light and dark mode
|
|
70
|
+
|
|
71
|
+
Add `data-theme` alongside the brand class to pin the color scheme. Leave it off
|
|
72
|
+
and the preset follows the OS `prefers-color-scheme`:
|
|
73
|
+
|
|
74
|
+
```html
|
|
75
|
+
<html lang="pt" class="preset-lm" data-theme="dark">
|
|
28
76
|
```
|
|
29
77
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
78
|
+
### Why the font package is separate
|
|
79
|
+
|
|
80
|
+
The preset only *names* its typeface in `--font-family` and ships no font files.
|
|
81
|
+
[Loading them is your app's job](../themes/README.md#fonts), as with upstream
|
|
82
|
+
Mozaic, so you keep control of hosting, subsetting and preload. Without the
|
|
83
|
+
matching font package, `font-sans` falls back to a generic sans-serif. A
|
|
84
|
+
multi-brand app can install both and switch by swapping the `.preset-*` class:
|
|
85
|
+
only the active brand's file is ever downloaded.
|
|
33
86
|
|
|
34
87
|
## Props
|
|
35
88
|
|
|
@@ -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,CAAA;AACrD,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,
|
|
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,CAAA;AACrD,OAAO,UAAU,MAAM,aAAa,CAAA;AAEpC,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAsLjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAA;AAElC,eAAO,MAAM,OAAO,EAAE,KAIrB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAKvB,CAAA;AAED,eAAO,MAAM,OAAO,EAAE,KAKrB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAA;AAED,eAAO,MAAM,QAAQ,EAAE,KAKtB,CAAA;AAED,eAAO,MAAM,SAAS,EAAE,KAMvB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAKnB,CAAA;AAED,eAAO,MAAM,cAAc,EAAE,KAO5B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAOxB,CAAA;AAED,eAAO,MAAM,iBAAiB,EAAE,KAM/B,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,KAM9B,CAAA"}
|