@lab-anssi/ui-kit 1.20.0 → 1.21.0

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.
@@ -6,6 +6,7 @@
6
6
  couleurTexte: { reflect: false, type: "String", attribute: "couleur-texte" },
7
7
  label: { reflect: false, type: "String", attribute: "label" },
8
8
  taille: { reflect: false, type: "String", attribute: "taille" },
9
+ type: { reflect: false, type: "String", attribute: "type" },
9
10
  },
10
11
  }}
11
12
  />
@@ -14,11 +15,29 @@
14
15
  export let couleurTexte;
15
16
  export let couleurFond;
16
17
  export let taille = "sm";
18
+ export let type = "defaut";
19
+ let selectionne = false;
20
+ const bascule = () => {
21
+ selectionne = !selectionne;
22
+ };
17
23
  </script>
18
24
 
19
- <span class="tag {taille}" style:background={couleurFond} style:color={couleurTexte}>
20
- {label}
21
- </span>
25
+ {#if type === "defaut"}
26
+ <span class="tag {taille}" style:background={couleurFond} style:color={couleurTexte}>
27
+ {label}
28
+ </span>
29
+ {:else}
30
+ <button
31
+ class="tag {taille}"
32
+ aria-pressed={selectionne}
33
+ style:background={couleurFond}
34
+ style:color={couleurTexte}
35
+ on:click={bascule}
36
+ on:click
37
+ >
38
+ {label}
39
+ </button>
40
+ {/if}
22
41
 
23
42
  <style>.tag {
24
43
  color: var(--tag-couleur-texte);
@@ -44,4 +63,52 @@ export let taille = "sm";
44
63
  line-height: 1.5rem;
45
64
  padding: 4px 12px;
46
65
  border-radius: 16px;
66
+ }
67
+ .tag:focus {
68
+ outline: 2px solid #0a76f6;
69
+ outline-offset: 2px;
70
+ }
71
+
72
+ button.tag {
73
+ color: var(--tag-selectionnable-couleur-texte);
74
+ background-color: var(--tag-selectionnable-couleur-fond);
75
+ border: none;
76
+ display: inline-flex;
77
+ position: relative;
78
+ overflow: visible;
79
+ }
80
+ button.tag:hover {
81
+ background-color: var(--tag-selectionnable-couleur-fond-survol);
82
+ }
83
+ button.tag:active {
84
+ background-color: var(--tag-selectionnable-couleur-fond-clique);
85
+ }
86
+ button.tag[aria-pressed=true] {
87
+ color: var(--tag-selectionne-couleur-texte);
88
+ background-color: transparent;
89
+ background-image: radial-gradient(circle at 100% 0.25rem, transparent 0.578125rem, var(--tag-selectionne-couleur-fond) 0.625rem);
90
+ }
91
+ button.tag[aria-pressed=true]:hover {
92
+ background-image: radial-gradient(circle at 100% 0.25rem, transparent 0.578125rem, var(--tag-selectionne-couleur-fond-survol) 0.625rem);
93
+ }
94
+ button.tag[aria-pressed=true]:active {
95
+ background-image: radial-gradient(circle at 100% 0.25rem, transparent 0.578125rem, var(--tag-selectionne-couleur-fond-clique) 0.625rem);
96
+ }
97
+ button.tag[aria-pressed=true]::after {
98
+ -webkit-mask-image: url("https://lab-anssi-ui-kit-prod-s3-assets.cellar-c2.services.clever-cloud.com/icones/dsfr/system/checkbox-circle-line.svg");
99
+ mask-image: url("https://lab-anssi-ui-kit-prod-s3-assets.cellar-c2.services.clever-cloud.com/icones/dsfr/system/checkbox-circle-line.svg");
100
+ background-color: var(--tag-selectionnable-couleur-texte);
101
+ --icon-size: 1rem;
102
+ content: "";
103
+ display: inline-block;
104
+ flex: 0 0 auto;
105
+ height: var(--icon-size);
106
+ margin: -0.5rem;
107
+ -webkit-mask-size: 100% 100%;
108
+ mask-size: 100% 100%;
109
+ position: absolute;
110
+ right: 0;
111
+ top: 4px;
112
+ vertical-align: calc((0.75em - var(--icon-size)) * 0.5);
113
+ width: var(--icon-size);
47
114
  }</style>
@@ -5,8 +5,11 @@ declare const __propDef: {
5
5
  couleurTexte: string | undefined;
6
6
  couleurFond: string | undefined;
7
7
  taille?: "sm" | "md";
8
+ type?: "defaut" | "selectionnable";
8
9
  };
9
10
  events: {
11
+ click: MouseEvent;
12
+ } & {
10
13
  [evt: string]: CustomEvent<any>;
11
14
  };
12
15
  slots: {};