@ptlm-azulejo/tag 0.0.1-alpha.108

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,4 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
package/README.md ADDED
@@ -0,0 +1,135 @@
1
+ # Tag
2
+
3
+ A Tag is a UI element used to filter data, categorize, select or deselect an
4
+ option. It can appear standalone, in a group, or embedded within other
5
+ components. Depending on its use, a tag can be interactive (clickable,
6
+ removable, selectable) or static (serving as a visual indicator).
7
+
8
+ Also known as **chip**, **pill**, or **filter chip**.
9
+
10
+ ## Installation
11
+
12
+ Install the component, the theme package, and **the font package matching your
13
+ project's brand**:
14
+
15
+ **Leroy Merlin projects**
16
+
17
+ ```bash
18
+ npm install @ptlm-azulejo/tag @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
19
+ # or
20
+ yarn add @ptlm-azulejo/tag @ptlm-azulejo/themes @ptlm-azulejo/fonts-leroy-merlin
21
+ ```
22
+
23
+ **Adeo projects**
24
+
25
+ ```bash
26
+ npm install @ptlm-azulejo/tag @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
27
+ # or
28
+ yarn add @ptlm-azulejo/tag @ptlm-azulejo/themes @ptlm-azulejo/fonts-adeo
29
+ ```
30
+
31
+ `@ptlm-azulejo/icons` installs transitively for the removable and selectable
32
+ glyphs — you do not need to add it yourself.
33
+
34
+ ## Styles & theming
35
+
36
+ The component ships no colors or typeface of its own — it reads design tokens from
37
+ CSS variables at runtime. Those tokens come from `@ptlm-azulejo/themes`, and **the
38
+ brand is selected by a class on your app's `<html>` element**, so switching brand
39
+ never touches component code.
40
+
41
+ | Project | Preset stylesheet | Root class | Typeface | Font package |
42
+ | --- | --- | --- | --- | --- |
43
+ | Leroy Merlin | `@ptlm-azulejo/themes/presets/leroy-merlin.css` | `preset-lm` | LeroyMerlinSans | `@ptlm-azulejo/fonts-leroy-merlin` |
44
+ | Adeo | `@ptlm-azulejo/themes/presets/adeo.css` | `preset-adeo` | Roboto | `@ptlm-azulejo/fonts-adeo` |
45
+
46
+ **Leroy Merlin projects**
47
+
48
+ ```js
49
+ import '@ptlm-azulejo/themes/presets/leroy-merlin.css'
50
+ import '@ptlm-azulejo/fonts-leroy-merlin'
51
+ import '@ptlm-azulejo/tag/style.css'
52
+ ```
53
+
54
+ ```html
55
+ <html lang="pt" class="preset-lm">
56
+ ```
57
+
58
+ **Adeo projects**
59
+
60
+ ```js
61
+ import '@ptlm-azulejo/themes/presets/adeo.css'
62
+ import '@ptlm-azulejo/fonts-adeo'
63
+ import '@ptlm-azulejo/tag/style.css'
64
+ ```
65
+
66
+ ```html
67
+ <html lang="pt" class="preset-adeo">
68
+ ```
69
+
70
+ > The preset class is what resolves the brand at runtime. Without it — even with
71
+ > the stylesheets imported — the component renders uncolored and in a fallback
72
+ > typeface. See the [themes package](../themes/README.md) for brand switching,
73
+ > dark mode, and custom brands.
74
+
75
+ ### Light and dark mode
76
+
77
+ Add `data-theme` alongside the brand class to pin the color scheme. Leave it off
78
+ and the preset follows the OS `prefers-color-scheme`:
79
+
80
+ ```html
81
+ <html lang="pt" class="preset-lm" data-theme="dark">
82
+ ```
83
+
84
+ ### Why the font package is separate
85
+
86
+ The preset only *names* its typeface in `--font-family` and ships no font files.
87
+ [Loading them is your app's job](../themes/README.md#fonts), as with upstream
88
+ Mozaic, so you keep control of hosting, subsetting and preload. Without the
89
+ matching font package, `font-sans` falls back to a generic sans-serif. A
90
+ multi-brand app can install both and switch by swapping the `.preset-*` class:
91
+ only the active brand's file is ever downloaded.
92
+
93
+ ## Props
94
+
95
+ | Name | Type | Default | Description |
96
+ | --- | --- | --- | --- |
97
+ | `label` | `string` | — | The text label displayed in the tag. **Required.** |
98
+ | `type` | `'informative' \| 'interactive' \| 'contextualised' \| 'removable' \| 'selectable'` | `'informative'` | Behavior and layout of the tag. |
99
+ | `size` | `'s' \| 'm' \| 'l'` | `'m'` | Size of the tag. |
100
+ | `id` | `string` | — | Unique id. Required for `selectable` / `removable`. |
101
+ | `name` | `string` | — | Form `name` (selectable only). |
102
+ | `modelValue` | `boolean` | — | Checked state (`v-model`) for selectable tags. |
103
+ | `disabled` | `boolean` | — | Disables interactive / selectable / contextualised tags. |
104
+ | `contextualisedNumber` | `number` | `99` | Badge number for contextualised tags. |
105
+ | `removableLabel` | `string` | `'Remove'` | Accessible label for the remove button. |
106
+ | `ui` | `TagUi` | `{}` | Tailwind class overrides per structural part. |
107
+
108
+ ## Events
109
+
110
+ | Name | Payload | Description |
111
+ | --- | --- | --- |
112
+ | `update:modelValue` | `boolean` | Selectable tag checked state changed. |
113
+ | `remove-tag` | `string` | Removable tag remove button clicked (payload is `id`). |
114
+
115
+ ## Slots
116
+
117
+ | Name | Description |
118
+ | --- | --- |
119
+ | `icon` | Insert an icon in the tag (hidden when a selectable tag is checked). |
120
+
121
+ ## Basic Usage
122
+
123
+ ```vue
124
+ <script lang="ts" setup>
125
+ import { ref } from 'vue'
126
+ import { AzTag } from '@ptlm-azulejo/tag'
127
+
128
+ const selected = ref(true)
129
+ </script>
130
+
131
+ <template>
132
+ <AzTag label="Tag label" />
133
+ <AzTag id="filters-wood" v-model="selected" label="Wood" type="selectable" />
134
+ </template>
135
+ ```