<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves https://fleetdm.slack.com/archives/C02A8BRABB5/p1784765147322239?thread_ts=1784727509.435919&cid=C02A8BRABB5 https://github.com/user-attachments/assets/e6bdeeb9-9ec3-4ba6-9669-6ea18ec8362d # Checklist for submitter If some of the following don't apply, delete the relevant line. - [ ] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. - [ ] Input data is properly validated, `SELECT *` is avoided, SQL injection is prevented (using placeholders for values in statements), JS inline code is prevented especially for url redirects, and untrusted data interpolated into shell scripts/commands is validated against shell metacharacters. - [ ] Timeouts are implemented and retries are limited to avoid infinite loops - [ ] If paths of existing endpoints are modified without backwards compatibility, checked the frontend/CLI for any necessary changes ## Testing - [ ] Added/updated automated tests - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added a danger variant for checkboxes, with red styling for default, hover, and active states. * Updated release and wipe confirmation checkboxes to clearly indicate destructive actions. * Added Storybook controls for checkbox values and variants. * **Bug Fixes** * Standardized checkbox values to use boolean states only. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
161 lines
3.3 KiB
SCSS
161 lines
3.3 KiB
SCSS
.fleet-checkbox {
|
|
@include clearfix;
|
|
position: relative;
|
|
// inline-flex would prevents clickable white space right of the checkbox,
|
|
// but we need that clickable in some "rows" using checkbox
|
|
display: flex;
|
|
align-items: center;
|
|
|
|
&:hover {
|
|
// Using selectors to avoid pointer cursor on clickable white space right of checkbox
|
|
.fleet-checkbox__label,
|
|
.fleet-checkbox__icon,
|
|
.fleet-checkbox__label-tooltip {
|
|
cursor: pointer;
|
|
}
|
|
}
|
|
|
|
&:hover:not(.fleet-checkbox__label--disabled) {
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $core-fleet-green-over;
|
|
fill: $core-fleet-green-over;
|
|
}
|
|
.checkbox-unchecked-state {
|
|
stroke: $core-fleet-green-over;
|
|
}
|
|
}
|
|
}
|
|
|
|
// During click only
|
|
&:active:not(.fleet-checkbox__label--disabled) {
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $core-fleet-green-down;
|
|
fill: $core-fleet-green-down;
|
|
}
|
|
.checkbox-unchecked-state {
|
|
stroke: $core-fleet-green-down;
|
|
}
|
|
}
|
|
}
|
|
|
|
&--danger {
|
|
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $core-vibrant-red;
|
|
fill: $core-vibrant-red;
|
|
}
|
|
}
|
|
|
|
&:hover:not(.fleet-checkbox__label--disabled) {
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $core-vibrant-red-over;
|
|
fill: $core-vibrant-red-over;
|
|
}
|
|
.checkbox-unchecked-state {
|
|
stroke: $core-vibrant-red-over;
|
|
}
|
|
}
|
|
}
|
|
|
|
// During click only
|
|
&:active:not(.fleet-checkbox__label--disabled) {
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $core-vibrant-red-down;
|
|
fill: $core-vibrant-red-down;
|
|
}
|
|
|
|
.checkbox-unchecked-state {
|
|
stroke: $core-vibrant-red-down;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// When tabbing
|
|
&:focus-visible:not(.fleet-checkbox__label--disabled) {
|
|
outline: none;
|
|
|
|
svg {
|
|
outline: 2px solid $ui-fleet-black-75;
|
|
outline-offset: -2px;
|
|
border-radius: $border-radius;
|
|
}
|
|
}
|
|
|
|
&--disabled {
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $ui-fleet-black-25;
|
|
fill: $ui-fleet-black-25;
|
|
}
|
|
.checkbox-unchecked-state {
|
|
stroke: $ui-fleet-black-25;
|
|
}
|
|
}
|
|
}
|
|
|
|
&__label {
|
|
font-size: $x-small;
|
|
padding-left: $pad-small;
|
|
display: inline-block;
|
|
vertical-align: top;
|
|
|
|
&--disabled {
|
|
color: $ui-fleet-black-50;
|
|
|
|
svg {
|
|
.checkbox-state {
|
|
stroke: $ui-fleet-black-25;
|
|
fill: $ui-fleet-black-25;
|
|
}
|
|
.checkbox-unchecked-state {
|
|
stroke: $ui-fleet-black-25;
|
|
fill: $ui-fleet-black-25;
|
|
}
|
|
}
|
|
|
|
&:hover {
|
|
// Using selectors to avoid not allowed cursor on clickable white space right of checkbox
|
|
.fleet-checkbox__label,
|
|
.fleet-checkbox__icon,
|
|
.fleet-checkbox__label-tooltip {
|
|
cursor: not-allowed;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
&__label-tooltip {
|
|
font-size: $x-small;
|
|
padding-left: $pad-small;
|
|
display: inherit;
|
|
vertical-align: top;
|
|
}
|
|
|
|
&__help-text {
|
|
@include help-text;
|
|
}
|
|
}
|
|
|
|
.inverse {
|
|
flex-direction: row-reverse; // Switches the text to the left side of checkbox as all checkboxes are now display flex
|
|
|
|
.fleet-checkbox {
|
|
&__icon {
|
|
padding-left: $pad-small;
|
|
}
|
|
|
|
&__label {
|
|
float: left;
|
|
padding-left: 0;
|
|
font-weight: $bold;
|
|
font-size: $x-small;
|
|
}
|
|
}
|
|
}
|