@lab-anssi/ui-kit 1.23.2 → 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
  >
@@ -48,6 +51,10 @@ export let actif = true;
48
51
  font-style: normal;
49
52
  font-weight: 500;
50
53
  }
54
+ .bouton.largeur-maximale {
55
+ width: 100%;
56
+ box-sizing: border-box;
57
+ }
51
58
  .bouton:focus-visible {
52
59
  outline: 2px solid #0a76f6;
53
60
  outline-offset: 2px;
@@ -113,6 +120,22 @@ export let actif = true;
113
120
  background: #e5e5e5;
114
121
  color: #929292;
115
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
+ }
116
139
  .bouton.tertiaire, .bouton.tertiaire-sans-bordure {
117
140
  color: var(--bouton-secondaire-tertiaire-couleur-texte);
118
141
  background: white;
@@ -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 : ""}
@@ -140,6 +143,11 @@ export let actif = true;
140
143
  font-weight: 500;
141
144
  }
142
145
 
146
+ .bouton.largeur-maximale {
147
+ width: 100%;
148
+ box-sizing: border-box;
149
+ }
150
+
143
151
  .bouton:focus-visible {
144
152
  outline: 2px solid #0a76f6;
145
153
  outline-offset: 2px;
@@ -223,6 +231,26 @@ export let actif = true;
223
231
  color: #929292;
224
232
  }
225
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
+
226
254
  .bouton.tertiaire, .bouton.tertiaire-sans-bordure {
227
255
  color: var(--bouton-secondaire-tertiaire-couleur-texte);
228
256
  background: white;
@@ -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 {
@@ -10,6 +10,11 @@
10
10
  font-style: normal;
11
11
  font-weight: 500;
12
12
 
13
+ &.largeur-maximale {
14
+ width: 100%;
15
+ box-sizing: border-box;
16
+ }
17
+
13
18
  &:focus-visible {
14
19
  outline: 2px solid #0a76f6;
15
20
  outline-offset: 2px;
@@ -95,6 +100,27 @@
95
100
  }
96
101
  }
97
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
+
98
124
  &.tertiaire,
99
125
  &.tertiaire-sans-bordure {
100
126
  color: $bouton-secondaire-tertiaire-couleur-texte;
@@ -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;