Skip to content

Commit 185e234

Browse files
authored
feat(dropdown): support readonly variant
The read-only checkbox still changed their cursor on hover confusing the user one could still change it. While doing it i added support for read-only to the dropdown component as well Removed cursor changes for read-only checkbox Added "read-only" variant to dropdown similar to the existing variant for checkbox
1 parent 48c4716 commit 185e234

File tree

3 files changed

+22
-8
lines changed

3 files changed

+22
-8
lines changed

src/definitions/modules/checkbox.less

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,16 @@
349349
color: @checkboxActiveFocusCheckColor;
350350
}
351351

352+
& when (@variationCheckboxReadonly) {
353+
/*--------------
354+
Read-Only
355+
---------------*/
352356

353-
/*--------------
354-
Read-Only
355-
---------------*/
356-
357-
.ui.read-only.checkbox,
358-
.ui.read-only.checkbox label {
359-
cursor: default;
357+
.ui.read-only.checkbox,
358+
.ui.read-only.checkbox label {
359+
cursor: default;
360+
pointer-events: none;
361+
}
360362
}
361363

362364
& when (@variationCheckboxDisabled) {
@@ -366,7 +368,7 @@
366368

367369
.ui.disabled.checkbox label,
368370
.ui.checkbox input[disabled] ~ label {
369-
cursor: default !important;
371+
cursor: default;
370372
opacity: @disabledCheckboxOpacity;
371373
color: @disabledCheckboxLabelColor;
372374
pointer-events: none;

src/definitions/modules/dropdown.less

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,6 +1135,16 @@ select.ui.dropdown {
11351135
}
11361136
}
11371137

1138+
& when (@variationDropdownReadonly) {
1139+
/*--------------------
1140+
Read-Only
1141+
----------------------*/
1142+
1143+
.ui.read-only.dropdown {
1144+
cursor: default;
1145+
pointer-events: none;
1146+
}
1147+
}
11381148

11391149
/*******************************
11401150
Variations

src/themes/default/globals/variation.variables

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
/* Checkbox */
379379
@variationCheckboxBox: false; //.box (instead of label) is an ancient fragment of sui v1 and not even documented in v2.x anymore
380380
@variationCheckboxDisabled: true;
381+
@variationCheckboxReadonly: true;
381382
@variationCheckboxInverted: true;
382383
@variationCheckboxRadio: true;
383384
@variationCheckboxSlider: true;
@@ -401,6 +402,7 @@
401402
/* Dropdown */
402403
@variationDropdownInverted: true;
403404
@variationDropdownDisabled: true;
405+
@variationDropdownReadonly: true;
404406
@variationDropdownLabel: true;
405407
@variationDropdownButton: true;
406408
@variationDropdownSelection: true;

0 commit comments

Comments
 (0)