Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark mode: Quantity selector #2287

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2307,6 +2307,11 @@ $quantity-selector-sm-width: 5.5rem !default;

$quantity-selector-btn-padding-x: add($btn-icon-padding-x, 2px) !default;
$quantity-selector-btn-padding-x-sm: add($btn-icon-padding-x-sm, 2px) !default;
$quantity-selector-btn-bg: var(--#{$prefix}body-bg) !default;
$quantity-selector-btn-border: var(--#{$prefix}border-width) solid var(--#{$prefix}border-color-translucent) !default;

$quantity-selector-disabled-color: var(--#{$prefix}disabled-color) !default;
$quantity-selector-disabled-bg: var(--#{$prefix}body-bg) !default;

$quantity-selector-icon-width: .875rem !default;
$quantity-selector-icon-sm-width: .625rem !default;
Expand Down
11 changes: 8 additions & 3 deletions scss/forms/_quantity-selector.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,18 @@
}

&:disabled {
color: $gray-500;
background-color: $white;
color: $quantity-selector-disabled-color;
background-color: $quantity-selector-disabled-bg;
}
}

button {
border: var(--#{$prefix}border-width) solid $gray-500;
background-color: $quantity-selector-btn-bg;
border: $quantity-selector-btn-border;

&:disabled {
background-color: $quantity-selector-btn-bg;
}

&:first-of-type {
@include button-icon($quantity-selector-icon-remove, $size: $quantity-selector-icon-width $quantity-selector-icon-remove-height, $pseudo: "after");
Expand Down
117 changes: 117 additions & 0 deletions site/content/docs/5.3/dark-mode.md
Original file line number Diff line number Diff line change
Expand Up @@ -2621,6 +2621,123 @@ sitemap_exclude: true
<div class="form-text" data-bs-theme="light">Form text helper</div>
</div>

### Quantity selector

<h4 class="mt-3">No theme</h4>

<div class="d-flex gap-2 border border-tertiary p-3">
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelector" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="5" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector">
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector" data-bs-step="down">
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector" data-bs-step="up">
<span class="visually-hidden">Step up</span>
</button>
</div>
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelectorDisabled" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="0" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector" disabled>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled" data-bs-step="down" disabled>
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled" data-bs-step="up" disabled>
<span class="visually-hidden">Step up</span>
</button>
</div>
</div>

<h4 class="mt-3">Dark theme on container</h4>

<div class="d-flex gap-2 border border-tertiary p-3 bg-body" data-bs-theme="dark">
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelector1" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="5" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector">
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector1" data-bs-step="down">
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector1" data-bs-step="up">
<span class="visually-hidden">Step up</span>
</button>
</div>
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelectorDisabled1" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="0" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector" disabled>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled1" data-bs-step="down" disabled>
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled1" data-bs-step="up" disabled>
<span class="visually-hidden">Step up</span>
</button>
</div>
</div>

<h4 class="mt-3">Light theme on container</h4>

<div class="d-flex gap-2 border border-tertiary p-3 bg-body" data-bs-theme="light">
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelector2" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="5" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector">
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector2" data-bs-step="down">
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector2" data-bs-step="up">
<span class="visually-hidden">Step up</span>
</button>
</div>
<div class="input-group quantity-selector">
<input type="number" id="inputQuantitySelectorDisabled2" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="0" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector" disabled>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled2" data-bs-step="down" disabled>
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled2" data-bs-step="up" disabled>
<span class="visually-hidden">Step up</span>
</button>
</div>
</div>

<h4 class="mt-3">Dark theme on component</h4>

<div class="d-flex gap-2 border border-tertiary p-3" style="background-color: #282d55;">
<div class="input-group quantity-selector" data-bs-theme="dark">
<input type="number" id="inputQuantitySelector3" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="5" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector">
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector3" data-bs-step="down">
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector3" data-bs-step="up">
<span class="visually-hidden">Step up</span>
</button>
</div>
<div class="input-group quantity-selector" data-bs-theme="dark">
<input type="number" id="inputQuantitySelectorDisabled3" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="0" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector" disabled>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled3" data-bs-step="down" disabled>
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled3" data-bs-step="up" disabled>
<span class="visually-hidden">Step up</span>
</button>
</div>
</div>

<h4 class="mt-3">Light theme on component</h4>

<div class="d-flex gap-2 border border-tertiary p-3" style="background-color: #b5e8f7">
<div class="input-group quantity-selector" data-bs-theme="light">
<input type="number" id="inputQuantitySelector4" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="5" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector">
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector4" data-bs-step="down">
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelector4" data-bs-step="up">
<span class="visually-hidden">Step up</span>
</button>
</div>
<div class="input-group quantity-selector" data-bs-theme="light">
<input type="number" id="inputQuantitySelectorDisabled4" class="form-control" aria-live="polite" data-bs-step="counter" name="quantity" title="quantity" value="0" min="0" max="10" step="1" data-bs-round="0" aria-label="Quantity selector" disabled>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled4" data-bs-step="down" disabled>
<span class="visually-hidden">Step down</span>
</button>
<button type="button" class="btn btn-icon btn-outline-secondary" aria-describedby="inputQuantitySelectorDisabled4" data-bs-step="up" disabled>
<span class="visually-hidden">Step up</span>
</button>
</div>
</div>

### Range

<h4 class="mt-3">No theme</h4>
Expand Down