@lab-anssi/ui-kit 1.23.1 → 1.24.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.
package/README.md CHANGED
@@ -15,10 +15,7 @@
15
15
 
16
16
  ## Storybook des composants
17
17
 
18
- > Nous parlons de _Storybook_ car c'est le terme généralement employé, mais nous utilisons [Histoire](https://histoire.dev/).
19
- > Nous avons fait ce choix car au moment de la création de notre repo, Storybook n'était pas compatible Svelte.
20
-
21
- Lors de la release d'une nouvelle version de l'UI Kit, le Storybook des composants [est déployé sur Github Pages : https://betagouv.github.io/lab-anssi-ui-kit/](https://betagouv.github.io/lab-anssi-ui-kit/).
18
+ Le Storybook des composants [est déployé sur Github Pages : https://betagouv.github.io/lab-anssi-ui-kit/](https://betagouv.github.io/lab-anssi-ui-kit/).
22
19
 
23
20
  ## Architecture de build
24
21
 
@@ -29,26 +26,26 @@ C'est ce qui explique les nombreux fichiers de configuration Svelte (Prettier, V
29
26
 
30
27
  Pour rajouter le build des WebComponents, on rajoute manuellement un fichier de configuration [`vite.webcomponents.config.ts`](./vite.webcomponents.config.ts) et des appels à la commande `vite -c vite.webcomponents.config.ts build` lors des étapes de build du package.
31
28
 
32
- Résultat : dans le repertoire `dist/` on retrouvera les composants Svelte et leurs équivalents Webcomponents.
29
+ Résultat : dans le repertoire `dist/` on retrouvera les composants Svelte et leurs équivalents Webcomponents.
33
30
  Tout le contenu de `dist/` est publié via `npm publish`.
34
31
 
35
32
  ## Développement en local
36
33
 
37
- La commande principale pour le développement en local est `npm run story:dev`.
34
+ La commande principale pour le développement en local est `npm run storybook:dev`.
38
35
  La sortie devrait ressembler à :
39
36
 
40
37
  ```shell
38
+ $ npm run storybook:dev
39
+
40
+ > @lab-anssi/ui-kit@1.23.2 storybook:dev
41
+ > STORYBOOK_ENV=development storybook dev -p 6006
41
42
 
42
- $ npm run story:dev
43
+ @storybook/core v8.3.7
43
44
 
44
- @lab-anssi/ui-kit@1.19.0 story:dev
45
- HISTOIRE_ENV=development histoire dev
46
- Re-optimizing dependencies because lockfile has changed
47
- Using 5 threads for story collection
48
- Collect stories start all
49
- ➜ Local: http://localhost:6006/
50
- ➜ Network: use --host to expose
45
+ info => Starting manager..
46
+ WARN No story files found for the specified pattern: stories/**/*.mdx
47
+ info => Starting preview..
51
48
  ```
52
49
 
53
- Après cette commande, le Storybook local est disponible sur http://localhost:6006/.
50
+ Après cette commande, le Storybook local est disponible sur http://localhost:6006/.
54
51
  Il devrait ressembler [au Storybook disponible en ligne](https://betagouv.github.io/lab-anssi-ui-kit/).
@@ -8,6 +8,7 @@
8
8
  icone: { reflect: false, type: "String", attribute: "icone" },
9
9
  positionIcone: { reflect: false, type: "String", attribute: "position-icone" },
10
10
  actif: { reflect: false, type: "Boolean", attribute: "actif" },
11
+ largeurMaximale: { reflect: false, type: "Boolean", attribute: "largeur-maximale" },
11
12
  },
12
13
  }}
13
14
  />
@@ -19,10 +20,12 @@ export let taille;
19
20
  export let icone = void 0;
20
21
  export let positionIcone = "sans";
21
22
  export let actif = true;
23
+ export let largeurMaximale = false;
22
24
  </script>
23
25
 
24
26
  <button
25
27
  class={`bouton ${variante} ${taille} icone-${positionIcone}`}
28
+ class:largeur-maximale={largeurMaximale}
26
29
  title={positionIcone === "seule" ? titre : ""}
27
30
  disabled={!actif}
28
31
  >
@@ -44,9 +47,14 @@ export let actif = true;
44
47
  font-family: Marianne, arial, sans-serif;
45
48
  cursor: pointer;
46
49
  justify-content: center;
50
+ text-align: center;
47
51
  font-style: normal;
48
52
  font-weight: 500;
49
53
  }
54
+ .bouton.largeur-maximale {
55
+ width: 100%;
56
+ box-sizing: border-box;
57
+ }
50
58
  .bouton:focus-visible {
51
59
  outline: 2px solid #0a76f6;
52
60
  outline-offset: 2px;
@@ -112,9 +120,24 @@ export let actif = true;
112
120
  background: #e5e5e5;
113
121
  color: #929292;
114
122
  }
123
+ .bouton.secondaire {
124
+ color: var(--bouton-secondaire-tertiaire-couleur-texte);
125
+ background: white;
126
+ border: 1px solid var(--bouton-secondaire-couleur-bordure);
127
+ border-radius: var(--bouton-arrondi);
128
+ }
129
+ .bouton.secondaire:hover {
130
+ background: rgba(0, 0, 0, 0.04);
131
+ }
132
+ .bouton.secondaire:active {
133
+ background: rgba(0, 0, 0, 0.08);
134
+ }
135
+ .bouton.secondaire:disabled, .bouton.secondaire[aria-disabled=true] {
136
+ background: transparent;
137
+ color: #929292;
138
+ }
115
139
  .bouton.tertiaire, .bouton.tertiaire-sans-bordure {
116
140
  color: var(--bouton-secondaire-tertiaire-couleur-texte);
117
- text-align: center;
118
141
  background: white;
119
142
  border-radius: var(--bouton-arrondi);
120
143
  }
@@ -2,11 +2,12 @@ import { SvelteComponent } from "svelte";
2
2
  declare const __propDef: {
3
3
  props: {
4
4
  titre: string;
5
- variante: "primaire" | "tertiaire" | "tertiaire-sans-bordure";
5
+ variante: "primaire" | "secondaire" | "tertiaire" | "tertiaire-sans-bordure";
6
6
  taille: "sm" | "md" | "lg";
7
7
  icone?: string | undefined;
8
8
  positionIcone?: "sans" | "seule" | "droite" | "gauche";
9
9
  actif?: boolean;
10
+ largeurMaximale?: boolean;
10
11
  };
11
12
  events: {
12
13
  [evt: string]: CustomEvent<any>;
@@ -11,6 +11,7 @@
11
11
  cible: { reflect: false, type: "String", attribute: "cible" },
12
12
  positionIcone: { reflect: false, type: "String", attribute: "position-icone" },
13
13
  actif: { reflect: false, type: "Boolean", attribute: "actif" },
14
+ largeurMaximale: { reflect: false, type: "Boolean", attribute: "largeur-maximale" },
14
15
  },
15
16
  }}
16
17
  />
@@ -25,10 +26,12 @@ export let apparence = "lien";
25
26
  export let cible = void 0;
26
27
  export let positionIcone = "sans";
27
28
  export let actif = true;
29
+ export let largeurMaximale = false;
28
30
  </script>
29
31
 
30
32
  <a
31
33
  class={`${variante} ${taille} icone-${positionIcone} ${apparence}`}
34
+ class:largeur-maximale={largeurMaximale}
32
35
  {href}
33
36
  target={cible}
34
37
  title={positionIcone === "seule" ? titre : ""}
@@ -135,10 +138,16 @@ export let actif = true;
135
138
  font-family: Marianne, arial, sans-serif;
136
139
  cursor: pointer;
137
140
  justify-content: center;
141
+ text-align: center;
138
142
  font-style: normal;
139
143
  font-weight: 500;
140
144
  }
141
145
 
146
+ .bouton.largeur-maximale {
147
+ width: 100%;
148
+ box-sizing: border-box;
149
+ }
150
+
142
151
  .bouton:focus-visible {
143
152
  outline: 2px solid #0a76f6;
144
153
  outline-offset: 2px;
@@ -222,9 +231,28 @@ export let actif = true;
222
231
  color: #929292;
223
232
  }
224
233
 
234
+ .bouton.secondaire {
235
+ color: var(--bouton-secondaire-tertiaire-couleur-texte);
236
+ background: white;
237
+ border: 1px solid var(--bouton-secondaire-couleur-bordure);
238
+ border-radius: var(--bouton-arrondi);
239
+ }
240
+
241
+ .bouton.secondaire:hover {
242
+ background: rgba(0, 0, 0, 0.04);
243
+ }
244
+
245
+ .bouton.secondaire:active {
246
+ background: rgba(0, 0, 0, 0.08);
247
+ }
248
+
249
+ .bouton.secondaire:disabled, .bouton.secondaire[aria-disabled=true] {
250
+ background: transparent;
251
+ color: #929292;
252
+ }
253
+
225
254
  .bouton.tertiaire, .bouton.tertiaire-sans-bordure {
226
255
  color: var(--bouton-secondaire-tertiaire-couleur-texte);
227
- text-align: center;
228
256
  background: white;
229
257
  border-radius: var(--bouton-arrondi);
230
258
  }
@@ -3,13 +3,14 @@ declare const __propDef: {
3
3
  props: {
4
4
  titre: string;
5
5
  href: string;
6
- variante: "primaire" | "tertiaire" | "tertiaire-sans-bordure";
6
+ variante: "primaire" | "secondaire" | "tertiaire" | "tertiaire-sans-bordure";
7
7
  taille: "sm" | "md" | "lg";
8
8
  icone?: string | undefined;
9
9
  apparence?: "lien" | "bouton" | "lien-texte";
10
10
  cible?: string | undefined;
11
11
  positionIcone?: "sans" | "seule" | "droite" | "gauche";
12
12
  actif?: boolean;
13
+ largeurMaximale?: boolean;
13
14
  };
14
15
  events: {
15
16
  [evt: string]: CustomEvent<any>;
@@ -77,6 +77,8 @@ button.tag {
77
77
  display: inline-flex;
78
78
  position: relative;
79
79
  overflow: visible;
80
+ text-wrap: auto;
81
+ text-align: left;
80
82
  cursor: pointer;
81
83
  }
82
84
  button.tag:hover {
@@ -5,10 +5,16 @@
5
5
  font-family: Marianne, arial, sans-serif;
6
6
  cursor: pointer;
7
7
  justify-content: center;
8
+ text-align: center;
8
9
 
9
10
  font-style: normal;
10
11
  font-weight: 500;
11
12
 
13
+ &.largeur-maximale {
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ }
17
+
12
18
  &:focus-visible {
13
19
  outline: 2px solid #0a76f6;
14
20
  outline-offset: 2px;
@@ -94,10 +100,30 @@
94
100
  }
95
101
  }
96
102
 
103
+ &.secondaire {
104
+ color: $bouton-secondaire-tertiaire-couleur-texte;
105
+ background: white;
106
+ border: 1px solid $bouton-secondaire-couleur-bordure;
107
+ border-radius: $bouton-arrondi;
108
+
109
+ &:hover {
110
+ background: rgb(0, 0, 0, 4%);
111
+ }
112
+
113
+ &:active {
114
+ background: rgb(0, 0, 0, 8%);
115
+ }
116
+
117
+ &:disabled,
118
+ &[aria-disabled="true"] {
119
+ background: transparent;
120
+ color: #929292;
121
+ }
122
+ }
123
+
97
124
  &.tertiaire,
98
125
  &.tertiaire-sans-bordure {
99
126
  color: $bouton-secondaire-tertiaire-couleur-texte;
100
- text-align: center;
101
127
  background: white;
102
128
  border-radius: $bouton-arrondi;
103
129
 
@@ -35,6 +35,7 @@ let icone = versExterne ? "lien-externe" : "lien-interne";
35
35
  <style>.racine {
36
36
  position: relative;
37
37
  display: block;
38
+ font-family: Marianne, sans-serif;
38
39
  }
39
40
  .racine .lien-diagnostic-cyber {
40
41
  font-size: 1rem;