diff --git a/__snapshots__/checkbox/showcase/chromium-highContrast/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/chromium-highContrast/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index 5db9c2cfaeb..865464c1c14 100644 Binary files a/__snapshots__/checkbox/showcase/chromium-highContrast/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/chromium-highContrast/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/__snapshots__/checkbox/showcase/chromium/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/chromium/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index aa6446eb293..760d8ef4e23 100644 Binary files a/__snapshots__/checkbox/showcase/chromium/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/chromium/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/__snapshots__/checkbox/showcase/firefox/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/firefox/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index 9e1879057a0..0e14b4d72fb 100644 Binary files a/__snapshots__/checkbox/showcase/firefox/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/firefox/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/__snapshots__/checkbox/showcase/mobile-chrome/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/mobile-chrome/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index 537a48984c8..cf8162985a1 100644 Binary files a/__snapshots__/checkbox/showcase/mobile-chrome/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/mobile-chrome/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/__snapshots__/checkbox/showcase/mobile-safari/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/mobile-safari/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index ac5366c0e4a..1f981836fdc 100644 Binary files a/__snapshots__/checkbox/showcase/mobile-safari/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/mobile-safari/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/__snapshots__/checkbox/showcase/webkit/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png b/__snapshots__/checkbox/showcase/webkit/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png index ea3ad875b12..21a29ca82be 100644 Binary files a/__snapshots__/checkbox/showcase/webkit/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png and b/__snapshots__/checkbox/showcase/webkit/DBCheckbox-should-match-screenshot-1/DBCheckbox-should-match-screenshot.png differ diff --git a/packages/components/src/components/checkbox/checkbox.scss b/packages/components/src/components/checkbox/checkbox.scss index 2b96192e027..5292c44bcd6 100644 --- a/packages/components/src/components/checkbox/checkbox.scss +++ b/packages/components/src/components/checkbox/checkbox.scss @@ -6,25 +6,39 @@ @use "../../styles/component"; @use "../../styles/form-components"; +%center-icon { + &::before { + --db-icon-margin-end: 0; + + display: inline-flex; + align-items: center; + justify-content: center; + block-size: calc( + #{form-components.$font-size-height} - 2 * #{variables.$db-border-height-3xs} + ); + inline-size: calc( + #{form-components.$font-size-height} - 2 * #{variables.$db-border-height-3xs} + ); + } +} + .db-checkbox { @extend %helper-message; @include form-components.set-default-check-element(check); input { + display: flex; border-radius: variables.$db-border-radius-2xs; - - &::before { - --db-icon-margin-end: 0; - - position: absolute; - inset-inline: 0; - inset-block: 0; - } + margin-block: auto; + align-items: center; + justify-content: center; &:checked { --db-check-element-border-color: #{colors.$db-adaptive-on-bg-basic-emphasis-70-default}; + @extend %center-icon; + // Check icon @include icons.set-icon("check"); @include colors.set-current-colors( @@ -39,6 +53,8 @@ } &:indeterminate { + @extend %center-icon; + @include icons.set-icon("minus"); } diff --git a/packages/components/src/styles/_form-components.scss b/packages/components/src/styles/_form-components.scss index e84ebb9fdd6..72c17b17621 100644 --- a/packages/components/src/styles/_form-components.scss +++ b/packages/components/src/styles/_form-components.scss @@ -478,10 +478,7 @@ $input-valid-types: "color", "date", "datetime-local", "email", "file", "hidden" aspect-ratio: 1; border: #{$check-border-size} solid var(--db-check-element-border-color, #{colors.$db-adaptive-on-bg-basic-emphasis-100-default}); block-size: $font-size-height; - - // TODO: probably extract this to an overwrite or external file - // workarounds for power apps - inline-size: auto; + inline-size: $font-size-height; padding: 0; @include helpers.hover { diff --git a/showcases/shared/checkbox.json b/showcases/shared/checkbox.json index 73a39509b8f..dbfdce4fb66 100644 --- a/showcases/shared/checkbox.json +++ b/showcases/shared/checkbox.json @@ -97,8 +97,7 @@ "props": { "name": "States", "indeterminate": true, - "required": true, - "checked": true + "required": true } } ] @@ -159,6 +158,16 @@ "name": "Content" } }, + { + "name": "Long label", + "style": { + "width": "100px" + }, + "props": { + "checked": true, + "name": "Long label" + } + }, { "name": "No Label", "props": {