@italia/button 0.1.0-alpha.2 → 1.0.0-alpha.10

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 CHANGED
@@ -5,14 +5,14 @@ This webcomponent follows the [open-wc](https://github.com/open-wc/open-wc) reco
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm i it-button
8
+ npm i @italia/button
9
9
  ```
10
10
 
11
11
  ## Usage
12
12
 
13
13
  ```html
14
14
  <script type="module">
15
- import '@italia/it-button';
15
+ import '@italia/button';
16
16
  </script>
17
17
 
18
18
  <it-button></it-button>
@@ -14,6 +14,14 @@
14
14
  "name": "ItButton",
15
15
  "module": "./it-button.js"
16
16
  }
17
+ },
18
+ {
19
+ "kind": "js",
20
+ "name": "*",
21
+ "declaration": {
22
+ "name": "*",
23
+ "module": "src/types.js"
24
+ }
17
25
  }
18
26
  ]
19
27
  },
@@ -44,7 +52,7 @@
44
52
  "kind": "field",
45
53
  "name": "type",
46
54
  "type": {
47
- "text": "string"
55
+ "text": "HTMLButtonElement['type']"
48
56
  },
49
57
  "default": "'button'",
50
58
  "attribute": "type",
@@ -92,22 +100,22 @@
92
100
  },
93
101
  {
94
102
  "kind": "field",
95
- "name": "icon",
103
+ "name": "value",
96
104
  "type": {
97
- "text": "boolean"
105
+ "text": "string"
98
106
  },
99
- "default": "false",
100
- "attribute": "icon",
101
- "reflects": true
107
+ "default": "''",
108
+ "attribute": "value"
102
109
  },
103
110
  {
104
111
  "kind": "field",
105
- "name": "value",
112
+ "name": "itInert",
106
113
  "type": {
107
- "text": "string"
114
+ "text": "boolean"
108
115
  },
109
- "default": "''",
110
- "attribute": "value"
116
+ "default": "false",
117
+ "attribute": "it-inert",
118
+ "reflects": true
111
119
  },
112
120
  {
113
121
  "kind": "field",
@@ -120,7 +128,7 @@
120
128
  "type": {
121
129
  "text": "boolean | undefined"
122
130
  },
123
- "attribute": "it-aria-disabled",
131
+ "attribute": "disabled",
124
132
  "reflects": true
125
133
  },
126
134
  {
@@ -132,6 +140,24 @@
132
140
  "attribute": "it-aria-expanded",
133
141
  "reflects": true
134
142
  },
143
+ {
144
+ "kind": "field",
145
+ "name": "_hasIcon",
146
+ "type": {
147
+ "text": "boolean"
148
+ },
149
+ "privacy": "private",
150
+ "default": "false"
151
+ },
152
+ {
153
+ "kind": "field",
154
+ "name": "_hasProgress",
155
+ "type": {
156
+ "text": "boolean"
157
+ },
158
+ "privacy": "private",
159
+ "default": "false"
160
+ },
135
161
  {
136
162
  "kind": "method",
137
163
  "name": "surfaceSubmitEvent",
@@ -154,17 +180,70 @@
154
180
  "name": "focus",
155
181
  "privacy": "public"
156
182
  },
183
+ {
184
+ "kind": "method",
185
+ "name": "setDescribedBy",
186
+ "privacy": "public",
187
+ "return": {
188
+ "type": {
189
+ "text": "void"
190
+ }
191
+ },
192
+ "parameters": [
193
+ {
194
+ "name": "element",
195
+ "type": {
196
+ "text": "Element | null"
197
+ }
198
+ }
199
+ ]
200
+ },
157
201
  {
158
202
  "kind": "field",
159
203
  "name": "_onKeyDown",
160
204
  "privacy": "private"
205
+ },
206
+ {
207
+ "kind": "method",
208
+ "name": "hasMatchingElement",
209
+ "privacy": "private",
210
+ "static": true,
211
+ "return": {
212
+ "type": {
213
+ "text": "boolean"
214
+ }
215
+ },
216
+ "parameters": [
217
+ {
218
+ "name": "elements",
219
+ "type": {
220
+ "text": "Element[]"
221
+ }
222
+ },
223
+ {
224
+ "name": "selector",
225
+ "type": {
226
+ "text": "string"
227
+ }
228
+ }
229
+ ]
230
+ },
231
+ {
232
+ "kind": "field",
233
+ "name": "_updateSlottedStates",
234
+ "privacy": "private"
235
+ },
236
+ {
237
+ "kind": "field",
238
+ "name": "_onSlotChange",
239
+ "privacy": "private"
161
240
  }
162
241
  ],
163
242
  "attributes": [
164
243
  {
165
244
  "name": "type",
166
245
  "type": {
167
- "text": "string"
246
+ "text": "HTMLButtonElement['type']"
168
247
  },
169
248
  "default": "'button'",
170
249
  "fieldName": "type"
@@ -201,14 +280,6 @@
201
280
  "default": "false",
202
281
  "fieldName": "block"
203
282
  },
204
- {
205
- "name": "icon",
206
- "type": {
207
- "text": "boolean"
208
- },
209
- "default": "false",
210
- "fieldName": "icon"
211
- },
212
283
  {
213
284
  "name": "value",
214
285
  "type": {
@@ -217,12 +288,20 @@
217
288
  "default": "''",
218
289
  "fieldName": "value"
219
290
  },
291
+ {
292
+ "name": "it-inert",
293
+ "type": {
294
+ "text": "boolean"
295
+ },
296
+ "default": "false",
297
+ "fieldName": "itInert"
298
+ },
220
299
  {
221
300
  "name": "internals",
222
301
  "fieldName": "internals"
223
302
  },
224
303
  {
225
- "name": "it-aria-disabled",
304
+ "name": "disabled",
226
305
  "type": {
227
306
  "text": "boolean | undefined"
228
307
  },
@@ -310,7 +389,7 @@
310
389
  {
311
390
  "kind": "variable",
312
391
  "name": "meta",
313
- "default": "{ title: 'Componenti/Button', tags: ['autodocs'], component: 'it-button', args: { slot: 'Testo del pulsante', variant: 'primary', size: undefined, block: false, outline: false, disabled: false, icon: false, type: 'button', value: '', 'aria-label': 'Aria label', }, argTypes: { variant: { control: 'select', description: 'Varianti di colore', options: BUTTON_VARIANTS, }, size: { control: 'select', description: 'Dimensione del pulsante', options: BUTTON_SIZES, }, block: { control: 'boolean', type: 'boolean', description: 'Quando abilitato, estende il componente Button fino a prendere tutta la larghezza disponibile', table: { defaultValue: { summary: 'false' } }, }, disabled: { control: 'boolean', type: 'boolean', name: 'it-aria-disabled', table: { defaultValue: { summary: 'false' } }, }, outline: { control: 'boolean', type: 'boolean', description: 'Applica il colore solamente al bordo, usando il colore di sfondo come colore interno del pulsante.', table: { defaultValue: { summary: 'false' } }, }, icon: { control: 'boolean', type: 'boolean', description: \"Se il pulsante mostra un'icona, è necessario aggiungere questo attributo.\", table: { defaultValue: { summary: 'false' } }, }, slot: { control: 'text', description: 'Testo del pulsante', }, 'aria-label': { control: 'text', description: 'Testo aria-label del pulsante', }, type: { control: 'select', description: 'Tipologia di pulsante', options: ['button', 'submit', 'reset'], table: { defaultValue: { summary: 'button' } }, }, value: { control: 'text', }, }, parameters: { docs: { description: { component: ` <Description>Pulsante con etichetta di testo o icona che al click inizia un'azione o un evento.</Description> Per indicazioni su \"Come e Quando usarlo\" si fa riferimento alla [guida del design-system](https://designers.italia.it/design-system/componenti/buttons/). `, }, }, }, } satisfies Meta<ButtonProps>"
392
+ "default": "{ title: 'Componenti/Button', tags: ['a11y-ok', 'web-component'], component: 'it-button', args: { slot: 'Testo del pulsante', variant: 'primary', size: undefined, block: false, outline: false, disabled: false, type: 'button', value: '', }, argTypes: { variant: { control: 'select', description: 'Varianti di colore', options: BUTTON_VARIANTS, }, size: { control: 'select', description: 'Dimensione del pulsante', options: BUTTON_SIZES, }, block: { control: 'boolean', type: 'boolean', description: 'Quando abilitato, estende il componente Button fino a prendere tutta la larghezza disponibile', table: { defaultValue: { summary: 'false' } }, }, disabled: { control: 'boolean', type: 'boolean', table: { defaultValue: { summary: 'false' } }, }, outline: { control: 'boolean', type: 'boolean', description: 'Applica il colore solamente al bordo, usando il colore di sfondo come colore interno del pulsante.', table: { defaultValue: { summary: 'false' } }, }, slot: { control: 'text', description: 'Testo del pulsante', }, type: { control: 'select', description: 'Tipologia di pulsante', options: ['button', 'submit', 'reset'], table: { defaultValue: { summary: 'button' } }, }, value: { control: 'text', }, }, } satisfies Meta<ButtonProps>"
314
393
  },
315
394
  {
316
395
  "kind": "variable",
@@ -318,15 +397,15 @@
318
397
  "type": {
319
398
  "text": "Story"
320
399
  },
321
- "default": "{ ...meta, name: 'Esempio interattivo', args: { variant: 'primary', }, tags: ['!autodocs', '!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (params) => html` ${renderComponent({ ...params, })}`, }"
400
+ "default": "{ ...meta, name: 'Esempio interattivo', args: { variant: 'primary', }, tags: ['!dev'], parameters: { docs: { canvas: { sourceState: 'shown', }, }, }, render: (params) => html` ${renderComponent({ ...params, })}`, }"
322
401
  },
323
402
  {
324
403
  "kind": "variable",
325
- "name": "PersonalizzazioneDegliStili",
404
+ "name": "Disabilitato",
326
405
  "type": {
327
406
  "text": "Story"
328
407
  },
329
- "default": "{ name: 'Personalizzazione degli stili', tags: ['!dev'], parameters: { viewMode: 'docs', // assicura che si apra la tab Docs anziché Canvas docs: { canvas: { hidden: true, sourceState: 'none' }, // nasconde solo il canvas nella docs page description: { story: ` Per la personalizzazione degli stili si può usare il selettore \\`::part\\` passando il valore \\`button\\`. [Vedi qui la guida dettagliata](/docs/personalizzazione-degli-stili--documentazione#selettore-part). `, }, }, }, render: () => html`<div class=\"hide-preview\"></div>`, }"
408
+ "default": "{ name: 'Stato disabilitato', args: { slot: '', disabled: true }, argTypes: { variant: { table: { disable: true, }, }, outline: { table: { disable: true, }, }, disabled: { table: { disable: true, }, }, }, render: (args) => html` ${renderComponent({ ...args, variant: 'primary' }, 'Primary')} ${renderComponent({ ...args, variant: 'secondary' }, 'Secondary')} ${renderComponent({ ...args, variant: 'success' }, 'Success')} ${renderComponent({ ...args, variant: 'danger' }, 'Danger')} ${renderComponent({ ...args, variant: 'warning' }, 'Warning')} ${renderComponent({ ...args, variant: 'link' }, 'Pulsante link')} `, }"
330
409
  },
331
410
  {
332
411
  "kind": "variable",
@@ -334,7 +413,7 @@
334
413
  "type": {
335
414
  "text": "Story"
336
415
  },
337
- "default": "{ name: 'Varianti di colore', args: { slot: '' }, argTypes: { variant: { table: { disable: true, }, }, outline: { table: { disable: true, }, }, disabled: { table: { disable: true, }, }, }, parameters: { docs: { description: { story: ` Gli stili definiti da Bootstrap Italia utilizzano un naming consistente con Bootstrap, con alcune personalizzazioni. <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p> Le classi \\`.btn\\` e \\`.btn-\\` conferiscono agli elementi html l’aspetto visivo di un pulsante. Anche elementi \\`<a>\\` o \\`<span>\\` possono subire questa trasformazione provocando discrepanza tra ciò che si rappresenta e la funzione semantica dell’elemento. <br/> Questo può provocare complesse problematiche di accessibilità. <br/><br/> Dove il click sul pulsante non genera un cambio di pagina utilizzare esclusivamente il componente \\`<it-button>\\`. <br/><br/> Qualora non fosse possibile, è necessario applicare in modo appropriato l’attributo \\`role=\"button\"\\` per trasmetterne lo scopo alle tecnologie assistive.</p></div></div> #### Note sullo stato disabilitato I pulsanti disabilitati dovranno avere l'attributo \\`aria-disabled=\"true\"\\` per indicare lo stato dell’elemento alle tecnologie assistive. Quando si utilizza l'attributo \\`aria-disabled\\` è consigliato usare anche l'attributo \\`aria-describedby\\` (o un elemento all'interno del bottone con classe \\`.sr-only\\`) per informare tramite gli screen-reader il motivo per il quale il pulsante è disabilitato. <br/> È sconsigliato l'uso dell'attributo \\`disabled\\`. `, }, }, }, render: (args) => html` ${renderVariant({ ...args, variant: 'primary' }, 'Primary')} ${renderVariant({ ...args, variant: 'secondary' }, 'Secondary')} ${renderVariant({ ...args, variant: 'success' }, 'Success')} ${renderVariant({ ...args, variant: 'danger' }, 'Danger')} ${renderVariant({ ...args, variant: 'warning' }, 'Warning')} ${renderVariant({ ...args, variant: 'link' }, 'Pulsante link')} `, }"
416
+ "default": "{ name: 'Varianti di colore', args: { slot: '' }, argTypes: { variant: { table: { disable: true, }, }, outline: { table: { disable: true, }, }, disabled: { table: { disable: true, }, }, }, render: (args) => html` ${renderVariant({ ...args, variant: 'primary' }, 'Primary')} ${renderVariant({ ...args, variant: 'secondary' }, 'Secondary')} ${renderVariant({ ...args, variant: 'success' }, 'Success')} ${renderVariant({ ...args, variant: 'danger' }, 'Danger')} ${renderVariant({ ...args, variant: 'warning' }, 'Warning')} ${renderVariant({ ...args, variant: 'link' }, 'Pulsante link')} `, }"
338
417
  },
339
418
  {
340
419
  "kind": "variable",
@@ -342,7 +421,7 @@
342
421
  "type": {
343
422
  "text": "Story"
344
423
  },
345
- "default": "{ name: 'Varianti di dimensione', args: { slot: '' }, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, block: { table: { disable: true, }, }, }, parameters: { docs: { description: { story: ` Per ottenere pulsanti di dimensione più grande o più piccola, è sufficiente utilizzare l'attributo \\`size\\` con i valori \\`lg\\` o \\`xs\\`. Utilizzando invece l'attributo \\`block\\` si ottengono pulsanti che prendono tutta l’ampiezza a loro disposizione, a seconda delle dimensioni del loro contenitore. `, }, }, }, render: (args) => html` ${renderSizeVariant({ ...args, size: 'lg' }, 'Large')} ${renderSizeVariant({ ...args }, 'Default')} ${renderSizeVariant({ ...args, size: 'xs' }, 'Extra Small')} <div class=\"flex\"> ${renderComponent( { ...args, block: true, variant: 'primary', }, 'Primary Block', )} </div> <div class=\"flex\"> ${renderComponent( { ...args, block: true, variant: 'secondary', }, 'Secondary Block', )} </div> `, }"
424
+ "default": "{ name: 'Varianti di dimensione', args: { slot: '' }, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, block: { table: { disable: true, }, }, }, render: (args) => html` ${renderSizeVariant({ ...args, size: 'lg' }, 'Large')} ${renderSizeVariant({ ...args }, 'Default')} ${renderSizeVariant({ ...args, size: 'xs' }, 'Extra Small')} <div class=\"flex\"> ${renderComponent( { ...args, block: true, variant: 'primary', }, 'Primary Block', )} </div> <div class=\"flex\"> ${renderComponent( { ...args, block: true, variant: 'secondary', }, 'Secondary Block', )} </div> `, }"
346
425
  },
347
426
  {
348
427
  "kind": "variable",
@@ -366,7 +445,7 @@
366
445
  "type": {
367
446
  "text": "Story"
368
447
  },
369
- "default": "{ ...meta, name: 'Con icona', args: {}, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, }, parameters: { docs: { description: { story: ` È necessario passare l'attributo \\`icon=\"true\"\\` (o \\`icon=\"\"\\`, o semplicemente \\`icon\\`) a \\`<it-button>\\` per applicargli gli stili corretti. L’icona può essere posizionata a sinistra o a destra del testo, a seconda della posizione in cui viene inserita all’interno del pulsante. <br/><br/> #### Dimensione dell'icona - Nei pulsanti di dimensione \\`lg\\` o default (\\`sm\\`), è necessario passare l'attributo \\`size=\"sm\"\\` all'icona. - Nei pulsanti di dimensione \\`xs\\`, è necessario passare l'attributo \\`size=\"xs\"\\` all'icona . #### Allineamento e spaziatura dell’icona Nel caso si utilizzi un’icona all’interno di un elemento \\`<it-button>\\` è necessario inserire il testo del pulsante all’interno di un tag \\`<span/>\\` al fine di garantire un perfetto allineamento ed una corretta spaziatura tra l’icona e lo stesso testo. <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p> Le icone sono di default puramente decorative. Nel caso in cui l'icona non debba essere un elemento decorativo, è necessario utilizzare correttamente gli attributi \\`label\\`, \\`role\\` e \\`aria-hidden\\` sul componente \\`<it-icon>\\`. Per maggiori dettagli visita la [guida dedicata](?path=/docs/componenti-icon--documentazione) al componente \\`<it-icon>\\`.</p></div></div> `, }, }, }, render: (params) => { const slot = params.slot?.length > 0 ? params.slot : null; return html` <div class=\"flex\"> <it-button variant=\"success\" size=\"lg\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"white\" size=\"sm\"></it-icon> <span>${slot ?? 'Pulsante Large con icona'}</span> </it-button> <it-button variant=\"primary\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"white\" size=\"sm\"></it-icon> <span>${slot ?? 'Pulsante con icona'}</span> </it-button> <it-button variant=\"danger\" size=\"xs\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"white\" size=\"xs\"></it-icon> <span>${slot ?? 'Pulsante Extra Small con icona'}</span> </it-button> <it-button variant=\"link\" size=\"xs\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"primary\" size=\"xs\"></it-icon> <span>${slot ?? 'Pulsante Link Extra Small con icona'}</span> </it-button> </div>`; }, }"
448
+ "default": "{ ...meta, name: 'Con icona', args: {}, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, }, parameters: { docs: { description: { story: ` <div class=\"callout callout-success\"><div class=\"callout-inner\"><div class=\"callout-title\"><span class=\"text\">Accessibilità</span></div> <p> Le icone sono di default puramente decorative. Nel caso in cui l'icona non debba essere un elemento decorativo, è necessario utilizzare correttamente gli attributi \\`label\\`, \\`role\\` e \\`aria-hidden\\` sul componente \\`<it-icon>\\`. Per maggiori dettagli visita la [guida dedicata](?path=/docs/componenti-icon--documentazione) al componente \\`<it-icon>\\`.</p></div></div> `, }, }, }, render: (params) => { const slot = params.slot?.length > 0 ? params.slot : null; return html` <div class=\"flex align-items-center\"> <it-button variant=\"success\" size=\"lg\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"inverse\" size=\"sm\"></it-icon> <span>${slot ?? 'Pulsante Large con icona'}</span> </it-button> <it-button variant=\"primary\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"inverse\" size=\"sm\"></it-icon> <span>${slot ?? 'Pulsante con icona'}</span> </it-button> <it-button variant=\"danger\" size=\"xs\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"inverse\" size=\"xs\"></it-icon> <span>${slot ?? 'Pulsante Extra Small con icona'}</span> </it-button> <it-button variant=\"link\" size=\"xs\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <it-icon name=\"it-star-full\" color=\"primary\" size=\"xs\"></it-icon> <span>${slot ?? 'Pulsante Link Extra Small con icona'}</span> </it-button> </div>`; }, }"
370
449
  },
371
450
  {
372
451
  "kind": "variable",
@@ -374,7 +453,7 @@
374
453
  "type": {
375
454
  "text": "Story"
376
455
  },
377
- "default": "{ ...meta, name: 'Con icona cerchiata', args: {}, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, }, parameters: { docs: { description: { story: ` È necessario passare l'attributo \\`icon=\"true\"\\` (o \\`icon=\"\"\\`, o semplicemente \\`icon\\`) a \\`<it-button>\\` per applicargli gli stili corretti. L’icona può essere posizionata a sinistra o a destra del testo, a seconda della posizione in cui viene inserita all’interno del pulsante. <br/>Deve essere contenuta all'interno di uno elemento con classe\\`.rounded-icon\\` per poter avere il contorno circolare. <br/><br/> #### Dimensione dell'icona La dimensione dell'icona deve sempre essere \\`xs\\`, quindi \\`<it-icon>\\` deve avere sempre l'attributo \\`size=\"xs\"\\`. `, }, }, }, render: (params) => { const slot = params.slot?.length > 0 ? params.slot : null; return html` <it-button class=\"me-2\" variant=\"success\" size=\"lg\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"success\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Large con icona'}</span> </it-button> <it-button class=\"me-2\" variant=\"primary\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\" size=\"sm\"> <it-icon name=\"it-user\" color=\"primary\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante con icona'}</span> </it-button> <it-button class=\"me-2\" variant=\"danger\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"danger\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Small con icona'}</span> </it-button> <it-button class=\"me-2\" variant=\"secondary\" size=\"xs\" icon ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?it-aria-disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"secondary\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Link Extra Small con icona'}</span> </it-button> `; }, }"
456
+ "default": "{ ...meta, name: 'Con icona cerchiata', args: {}, argTypes: { variant: { table: { disable: true, }, }, size: { table: { disable: true, }, }, }, render: (params) => { const slot = params.slot?.length > 0 ? params.slot : null; return html` <div class=\"flex align-items-center\"> <it-button variant=\"success\" size=\"lg\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"success\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Large con icona'}</span> </it-button> <it-button variant=\"primary\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\" size=\"sm\"> <it-icon name=\"it-user\" color=\"primary\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante con icona'}</span> </it-button> <it-button variant=\"danger\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"danger\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Small con icona'}</span> </it-button> <it-button variant=\"secondary\" size=\"xs\" ?outline=\"${params.outline}\" ?block=\"${params.block}\" ?disabled=\"${params.disabled}\" type=\"${params.type}\" > <span class=\"rounded-icon\"> <it-icon name=\"it-user\" color=\"secondary\" size=\"xs\"></it-icon> </span> <span>${slot ?? 'Pulsante Link Extra Small con icona'}</span> </it-button> </div>`; }, }"
378
457
  }
379
458
  ],
380
459
  "exports": [
@@ -396,9 +475,9 @@
396
475
  },
397
476
  {
398
477
  "kind": "js",
399
- "name": "PersonalizzazioneDegliStili",
478
+ "name": "Disabilitato",
400
479
  "declaration": {
401
- "name": "PersonalizzazioneDegliStili",
480
+ "name": "Disabilitato",
402
481
  "module": "stories/it-button.stories.ts"
403
482
  }
404
483
  },
@@ -1,2 +1,3 @@
1
1
  export { ItButton } from './it-button.js';
2
+ export * from './types.js';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,cAAc,YAAY,CAAC"}
package/dist/src/index.js CHANGED
@@ -3,4 +3,9 @@ import 'lit/directive.js';
3
3
  import 'lit';
4
4
  import 'lit/decorators.js';
5
5
  import 'lit/directives/if-defined.js';
6
+
7
+ const BUTTON_SIZES = ['lg', 'sm', 'xs'];
8
+ const BUTTON_VARIANTS = ['primary', 'secondary', 'success', 'danger', 'warning', 'link'];
9
+
10
+ export { BUTTON_SIZES, BUTTON_VARIANTS };
6
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/types.ts"],"sourcesContent":["export const BUTTON_SIZES = ['lg', 'sm', 'xs'];\nexport const BUTTON_VARIANTS = ['primary', 'secondary', 'success', 'danger', 'warning', 'link'];\n\nexport type Sizes = (typeof BUTTON_SIZES)[number];\nexport type Variants = (typeof BUTTON_VARIANTS)[number] | string;\n"],"names":[],"mappings":";;;;;;AAAO,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI;AACtC,MAAM,eAAe,GAAG,CAAC,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM;;;;"}
@@ -1,25 +1,33 @@
1
1
  import { BaseComponent } from '@italia/globals';
2
+ import { type PropertyValues } from 'lit';
2
3
  import { type Sizes, type Variants } from './types.js';
3
4
  export declare class ItButton extends BaseComponent {
4
5
  static styles: import("lit").CSSResultGroup;
5
6
  static get formAssociated(): boolean;
6
7
  private _nativeButton;
7
- type: string;
8
+ type: HTMLButtonElement['type'];
8
9
  variant: Variants;
9
10
  size: Sizes;
10
11
  outline: boolean;
11
12
  block: boolean;
12
- icon: boolean;
13
13
  value: string;
14
+ itInert: boolean;
14
15
  internals: ElementInternals;
15
16
  disabled?: boolean;
16
17
  expanded?: boolean;
18
+ private _hasIcon;
19
+ private _hasProgress;
17
20
  surfaceSubmitEvent(event: any): void;
18
21
  get form(): HTMLFormElement | null;
19
22
  focus(): void;
23
+ setDescribedBy(element: Element | null): void;
20
24
  private _onKeyDown;
21
25
  connectedCallback(): void;
22
26
  disconnectedCallback(): void;
27
+ private static hasMatchingElement;
28
+ firstUpdated(changedProperties: PropertyValues<this>): void;
29
+ private _updateSlottedStates;
30
+ private _onSlotChange;
23
31
  render(): import("lit").TemplateResult<1>;
24
32
  }
25
33
  declare global {
@@ -1 +1 @@
1
- {"version":3,"file":"it-button.d.ts","sourceRoot":"","sources":["../../src/it-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAI/D,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGvD,qBACa,QAAS,SAAQ,aAAa;IACzC,MAAM,CAAC,MAAM,+BAAU;IAEvB,MAAM,KAAK,cAAc,YAExB;IAEgB,OAAO,CAAC,aAAa,CAAqB;IAEhB,IAAI,SAAY;IAEhB,OAAO,EAAE,QAAQ,CAAM;IAEvB,IAAI,EAAE,KAAK,CAAM;IAEhB,OAAO,UAAS;IAEhB,KAAK,UAAS;IAEd,IAAI,UAAS;IAE7B,KAAK,SAAM;IAE3B,SAAS,mBAA0B;IAE4B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAE9F,kBAAkB,CAAC,KAAK,EAAE,GAAG;IAmC7B,IAAI,IAAI,2BAEP;IAEe,KAAK;IAIrB,OAAO,CAAC,UAAU,CAKhB;IAEF,iBAAiB,IAAI,IAAI;IAUzB,oBAAoB,IAAI,IAAI;IAMnB,MAAM;CA6BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}
1
+ {"version":3,"file":"it-button.d.ts","sourceRoot":"","sources":["../../src/it-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAiB,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAQ,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAGhD,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGvD,qBACa,QAAS,SAAQ,aAAa;IACzC,MAAM,CAAC,MAAM,+BAAU;IAEvB,MAAM,KAAK,cAAc,YAExB;IAEgB,OAAO,CAAC,aAAa,CAAqB;IAEhB,IAAI,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAY;IAE3C,OAAO,EAAE,QAAQ,CAAM;IAEvB,IAAI,EAAE,KAAK,CAAM;IAEhB,OAAO,UAAS;IAEhB,KAAK,UAAS;IAE9B,KAAK,SAAM;IAE4B,OAAO,UAAS;IAEvE,SAAS,mBAA0B;IAEH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEY,QAAQ,CAAC,EAAE,OAAO,CAAC;IAErF,OAAO,CAAC,QAAQ,CAAS;IAEzB,OAAO,CAAC,YAAY,CAAS;IAEtC,kBAAkB,CAAC,KAAK,EAAE,GAAG;IAmC7B,IAAI,IAAI,2BAEP;IAEe,KAAK;IAId,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI;IAYpD,OAAO,CAAC,UAAU,CAShB;IAEF,iBAAiB,IAAI,IAAI;IAUzB,oBAAoB,IAAI,IAAI;IAK5B,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAIxB,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAKpE,OAAO,CAAC,oBAAoB,CAG1B;IAEF,OAAO,CAAC,aAAa,CAKnB;IAGO,MAAM;CA+BhB;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,QAAQ,CAAC;KACvB;CACF"}