Skip to content

Commit 6997c2f

Browse files
committed
Story #XXXXX: Checkbox & radio buttons
RAF : - styler les radio buttons - remplacer tous les checkbox/radio natifs dans les apps
1 parent bb5c431 commit 6997c2f

File tree

9 files changed

+140
-17
lines changed

9 files changed

+140
-17
lines changed

ui/ui-frontend/projects/design-system/src/app/app-routing.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import { UploadComponent } from './components/upload/upload.component';
6565
import { DialogComponent } from './components/organisms/dialog/dialog.component';
6666
import { SnackbarComponent } from './components/organisms/snackbar/snackbar.component';
6767
import { SlideToggleComponent } from './components/atoms/slide-toggle/slide-toggle.component';
68+
import { DesignSystemRadioComponent } from './components/molecules/inputs/radio/design-system-radio.component';
6869

6970
export interface RouteData {
7071
// Alternative search terms
@@ -112,6 +113,7 @@ const routes: Routes = [
112113
{ path: 'select', component: DesignSystemSelectComponent },
113114
{ path: 'select-with-tree', component: DesignSystemSelectWithTreeComponent },
114115
{ path: 'checkboxes', component: DesignSystemCheckboxComponent },
116+
{ path: 'radios', component: DesignSystemRadioComponent },
115117
{ path: 'datepicker', component: DesignSystemDatepickerComponent },
116118
{ path: 'search-with-type-selector', component: DesignSystemSearchWithTypeSelectorComponent },
117119
{ path: 'old-input', component: DesignSystemOldInputsComponent },

ui/ui-frontend/projects/design-system/src/app/components/molecules/inputs/checkbox/design-system-checkbox.component.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,30 @@
11
<h2>Checkboxes</h2>
22

33
<h3>mat-checkbox</h3>
4-
@for (disabled of [false, true]; track disabled) {
5-
<div class="row">
6-
@for (state of [{}, { checked: true }, { indeterminate: true }]; track state) {
7-
<mat-checkbox class="col" [checked]="state.checked" [indeterminate]="state.indeterminate" [disabled]="disabled">
8-
Text form option label
9-
</mat-checkbox>
10-
}
11-
</div>
12-
}
4+
<div class="gap-4">
5+
@for (
6+
type of [
7+
{ disabled: false, hover: false },
8+
{ disabled: false, hover: true },
9+
{ disabled: true, hover: false },
10+
];
11+
track type
12+
) {
13+
<div class="row">
14+
@for (state of [{}, { checked: true }, { indeterminate: true }]; track state) {
15+
<mat-checkbox
16+
class="col"
17+
[checked]="state.checked"
18+
[indeterminate]="state.indeterminate"
19+
[disabled]="type.disabled"
20+
[class.hover]="type.hover"
21+
>
22+
Text form option label
23+
</mat-checkbox>
24+
}
25+
</div>
26+
}
27+
</div>
1328

1429
<h3>input type="checkbox"</h3>
1530
<div class="row m-0">

ui/ui-frontend/projects/design-system/src/app/components/molecules/inputs/checkbox/design-system-checkbox.component.scss

Whitespace-only changes.

ui/ui-frontend/projects/design-system/src/app/components/molecules/inputs/checkbox/design-system-checkbox.component.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,5 @@ import { MatCheckboxModule } from '@angular/material/checkbox';
4141
selector: 'design-system-checkbox',
4242
imports: [MatCheckboxModule],
4343
templateUrl: './design-system-checkbox.component.html',
44-
styleUrl: './design-system-checkbox.component.scss',
4544
})
4645
export class DesignSystemCheckboxComponent {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<h2>Radio buttons</h2>
2+
3+
<h3>mat-radio-button</h3>
4+
<div class="gap-4">
5+
@for (
6+
type of [
7+
{ disabled: false, hover: false },
8+
{ disabled: false, hover: true },
9+
{ disabled: true, hover: false },
10+
];
11+
track type
12+
) {
13+
<div class="row">
14+
<mat-radio-group class="hgap-4">
15+
@for (state of [{}, { checked: true }]; track state) {
16+
<mat-radio-button class="col" [checked]="state.checked" [disabled]="type.disabled" [class.hover]="type.hover">
17+
Text form option label
18+
</mat-radio-button>
19+
}
20+
</mat-radio-group>
21+
</div>
22+
}
23+
</div>
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright French Prime minister Office/SGMAP/DINSIC/Vitam Program (2019-2022)
3+
* and the signatories of the "VITAM - Accord du Contributeur" agreement.
4+
*
5+
* contact@programmevitam.fr
6+
*
7+
* This software is a computer program whose purpose is to implement
8+
* implement a digital archiving front-office system for the secure and
9+
* efficient high volumetry VITAM solution.
10+
*
11+
* This software is governed by the CeCILL-C license under French law and
12+
* abiding by the rules of distribution of free software. You can use,
13+
* modify and/ or redistribute the software under the terms of the CeCILL-C
14+
* license as circulated by CEA, CNRS and INRIA at the following URL
15+
* "http://www.cecill.info".
16+
*
17+
* As a counterpart to the access to the source code and rights to copy,
18+
* modify and redistribute granted by the license, users are provided only
19+
* with a limited warranty and the software's author, the holder of the
20+
* economic rights, and the successive licensors have only limited
21+
* liability.
22+
*
23+
* In this respect, the user's attention is drawn to the risks associated
24+
* with loading, using, modifying and/or developing or reproducing the
25+
* software by the user in light of its specific status of free software,
26+
* that may mean that it is complicated to manipulate, and that also
27+
* therefore means that it is reserved for developers and experienced
28+
* professionals having in-depth computer knowledge. Users are therefore
29+
* encouraged to load and test the software's suitability as regards their
30+
* requirements in conditions enabling the security of their systems and/or
31+
* data to be ensured and, more generally, to use and operate it in the
32+
* same conditions as regards security.
33+
*
34+
* The fact that you are presently reading this means that you have had
35+
* knowledge of the CeCILL-C license and that you accept its terms.
36+
*/
37+
import { Component } from '@angular/core';
38+
import { MatCheckboxModule } from '@angular/material/checkbox';
39+
import { MatRadioButton, MatRadioGroup } from '@angular/material/radio';
40+
41+
@Component({
42+
selector: 'design-system-radio',
43+
imports: [MatCheckboxModule, MatRadioButton, MatRadioGroup],
44+
templateUrl: './design-system-radio.component.html',
45+
})
46+
export class DesignSystemRadioComponent {}

ui/ui-frontend/projects/design-system/src/assets/i18n/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"select.TITLE": "Select",
3535
"select-with-tree.TITLE": "Select with tree",
3636
"checkboxes.TITLE": "Checkboxes",
37+
"radios.TITLE": "Radio buttons",
3738
"datepicker.TITLE": "Datepicker",
3839
"old-input.TITLE": "OLD input",
3940
"input.TITLE": "Input",

ui/ui-frontend/projects/design-system/src/assets/i18n/fr.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"select.TITLE": "Select",
3535
"select-with-tree.TITLE": "Select avec arborescence",
3636
"checkboxes.TITLE": "Checkboxes",
37+
"radios.TITLE": "Radio buttons",
3738
"datepicker.TITLE": "Datepicker",
3839
"old-input.TITLE": "OLD input",
3940
"input.TITLE": "Input",

ui/ui-frontend/projects/vitamui-library/src/sass/_checkbox.scss

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
&.mat-primary {
1111
--mdc-checkbox-selected-checkmark-color: var(--vitamui-white);
1212

13-
--mdc-checkbox-unselected-hover-state-layer-opacity: 1;
14-
--mdc-checkbox-unselected-hover-state-layer-color: transparent;
1513
--mdc-checkbox-unselected-icon-color: var(--vitamui-grey-700);
1614

17-
--mdc-checkbox-selected-hover-state-layer-opacity: 1;
18-
--mdc-checkbox-selected-hover-state-layer-color: var(--vitamui-primary-50);
15+
--mat-checkbox-label-text-color: var(--vitamui-grey-900);
16+
17+
--mat-checkbox-disabled-label-color: var(--vitamui-grey-700);
18+
--mdc-checkbox-disabled-selected-checkmark-color: var(--vitamui-grey-700);
1919
}
2020
}
2121
.mat-mdc-checkbox-touch-target {
@@ -32,12 +32,48 @@
3232
width: $boxSize;
3333
height: $boxSize;
3434
border-width: 1px;
35+
border-radius: 3px;
36+
37+
border-color: var(--vitamui-grey-700) !important;
3538
}
36-
.mdc-checkbox__ripple {
37-
border-radius: 2px;
39+
input:checked:not(:disabled),
40+
input:indeterminate:not(:disabled) {
41+
~ .mdc-checkbox__background {
42+
border-color: var(--vitamui-primary) !important;
43+
}
44+
}
45+
.mat-mdc-checkbox {
46+
label {
47+
padding-left: 10px;
48+
}
49+
.mdc-checkbox__ripple {
50+
border-radius: 50%;
51+
width: 30px;
52+
height: 30px;
53+
position: absolute;
54+
top: calc(50% - 15px);
55+
left: calc(50% - 15px);
56+
background-color: var(--vitamui-primary-50) !important;
57+
opacity: 0 !important;
58+
}
59+
&:hover,
60+
&.hover {
61+
.mdc-checkbox__ripple {
62+
opacity: 1 !important;
63+
}
64+
}
3865
}
3966
.mdc-checkbox__checkmark {
40-
padding: 1px;
67+
padding: 2px;
68+
}
69+
.mdc-checkbox__checkmark-path {
70+
stroke-width: 6px;
71+
}
72+
.mdc-checkbox__mixedmark {
73+
width: 8px;
74+
}
75+
.mdc-checkbox--disabled .mdc-checkbox__background {
76+
background-color: var(--vitamui-grey-200) !important;
4177
}
4278
}
4379

0 commit comments

Comments
 (0)