@italia/radio 0.1.0-alpha.2

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/AUTHORS ADDED
@@ -0,0 +1,3 @@
1
+ Copyright (c) 2025 Dipartimento per la trasformazione digitale - Presidenza del Consiglio dei Ministri
2
+
3
+ The version control system provides attribution for specific lines of code.
package/LICENSE ADDED
@@ -0,0 +1,11 @@
1
+ Copyright (c) 2025, the respective contributors, as shown by the AUTHORS file.
2
+
3
+ Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
4
+
5
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
6
+
7
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
8
+
9
+ 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
10
+
11
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
package/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # \<it-radio> & \<it-radio-group>
2
+
3
+ ## Installation
4
+
5
+ ```bash
6
+ npm i @italia/radio
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ### Utilizzo Base
12
+
13
+ ```html
14
+ <script type="module">
15
+ import '@italia/radio';
16
+ </script>
17
+
18
+ <it-radio-group name="gruppo">
19
+ <span slot="legend">Seleziona un'opzione</span>
20
+ <it-radio value="opzione1" checked>
21
+ <span slot="label">Opzione 1</span>
22
+ </it-radio>
23
+ <it-radio value="opzione2">
24
+ <span slot="label">Opzione 2</span>
25
+ </it-radio>
26
+ <it-radio value="opzione3">
27
+ <span slot="label">Opzione 3</span>
28
+ </it-radio>
29
+ </it-radio-group>
30
+ ```
31
+
32
+ ### Con testo di supporto
33
+
34
+ ```html
35
+ <it-radio-group name="gruppo">
36
+ <span slot="legend">Gruppo di radio</span>
37
+ <it-radio value="opt1" support-text="Testo di aiuto per questa opzione">
38
+ <span slot="label">Radio con supporto</span>
39
+ </it-radio>
40
+ <it-radio value="opt2">
41
+ <span slot="label">Radio semplice</span>
42
+ </it-radio>
43
+ </it-radio-group>
44
+ ```
45
+
46
+ ### Radio inline
47
+
48
+ ```html
49
+ <it-radio-group name="gruppo-inline">
50
+ <span slot="legend">Gruppo inline</span>
51
+ <it-radio value="opt1" inline>
52
+ <span slot="label">Opzione 1</span>
53
+ </it-radio>
54
+ <it-radio value="opt2" inline>
55
+ <span slot="label">Opzione 2</span>
56
+ </it-radio>
57
+ <it-radio value="opt3" inline>
58
+ <span slot="label">Opzione 3</span>
59
+ </it-radio>
60
+ </it-radio-group>
61
+ ```
62
+
63
+ ### Radio raggruppati visivamente
64
+
65
+ ```html
66
+ <it-radio-group name="gruppo">
67
+ <span slot="legend">Gruppo visivamente evidenziato</span>
68
+ <it-radio value="opt1" group>
69
+ <span slot="label">Opzione 1</span>
70
+ </it-radio>
71
+ <it-radio value="opt2" group>
72
+ <span slot="label">Opzione 2</span>
73
+ </it-radio>
74
+ </it-radio-group>
75
+ ```
76
+
77
+ ### Con validazione (required)
78
+
79
+ ```html
80
+ <form>
81
+ <it-radio-group name="scelta" required>
82
+ <span slot="legend">Seleziona un'opzione *</span>
83
+ <it-radio value="si">
84
+ <span slot="label">Sì, accetto</span>
85
+ </it-radio>
86
+ <it-radio value="no">
87
+ <span slot="label">No, non accetto</span>
88
+ </it-radio>
89
+ </it-radio-group>
90
+ <button type="submit">Invia</button>
91
+ </form>
92
+ ```
93
+
94
+ ### Stato disabilitato
95
+
96
+ ```html
97
+ <it-radio-group name="gruppo" disabled>
98
+ <span slot="legend">Gruppo disabilitato</span>
99
+ <it-radio value="opt1" checked>
100
+ <span slot="label">Opzione 1</span>
101
+ </it-radio>
102
+ <it-radio value="opt2">
103
+ <span slot="label">Opzione 2</span>
104
+ </it-radio>
105
+ </it-radio-group>
106
+ ```