Skip to content
Closed
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
Binary file modified R/sysdata.rda
Binary file not shown.
2 changes: 1 addition & 1 deletion inst/components/dist/components.css

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions inst/components/scss/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@
justify-content: center;
line-height: 1; // Override Bootstrap's line-height to avoid too much vertical space
height: var(--_toolbar-btn-size); // Keep square icon and label + icon button heights consistent
display: flex;

// Remove margins from action button elements
.action-icon,
.action-label {
margin: 0;
}

&.btn-default:not(.btn-primary):not(.btn-secondary):not(.btn-success):not(.btn-danger):not(.btn-warning):not(.btn-info):not(.btn-light):not(.btn-dark) {
background-color: transparent !important;
Expand Down Expand Up @@ -67,6 +74,13 @@
}
}

// Add spacing between icon and label in buttons with both
.bslib-toolbar-input-button[data-type="both"] {
.action-icon {
margin-right: 0.5ch;
}
}

// Square icon-only buttons
.bslib-toolbar-input-button[data-type="icon"] {
aspect-ratio: 1;
Expand Down
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3-UBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3CUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3GUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3KUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3OUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3iUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMa3yUBA.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMawCUBGEe.woff2
Binary file not shown.
Binary file modified inst/fonts/KFO7CnqEu92Fr1ME7kSn66aGLdTylUAMaxKUBGEe.woff2
Binary file not shown.
2 changes: 1 addition & 1 deletion tests/testthat/_snaps/bs-theme-preset-builtin.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# builtin_bundle() / errors for unknown preset names
# builtin_bundle(): errors for unknown preset names

Code
builtin_bundle("not-a-preset", version = "5")
Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/_snaps/bs-theme-preset.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# resolve_bs_preset() / throws an error if both `name` and `bootswatch` are provided
# resolve_bs_preset(): throws an error if both `name` and `bootswatch` are provided

Code
resolve_bs_preset(preset = "name", bootswatch = "bootswatch")
Expand All @@ -10,7 +10,7 @@
* `preset = "bootswatch"`
* `bootswatch = "bootswatch"`

# resolve_bs_preset() / throws an error if `name` or `bootswatch` are not scalar strings
# resolve_bs_preset(): throws an error if `name` or `bootswatch` are not scalar strings

Code
resolve_bs_preset(preset = c("a", "b"))
Expand All @@ -30,7 +30,7 @@
x Bad: `bootswatch = c("flatly", "darkly")`
v Good: `bootswatch = "flatly"`

# resolve_bs_preset() / throws an error if `name` or `bootswatch` don't match existing presets
# resolve_bs_preset(): throws an error if `name` or `bootswatch` don't match existing presets

Code
resolve_bs_preset(preset = "not_a_preset", version = 4)
Expand Down
111 changes: 17 additions & 94 deletions tests/testthat/_snaps/toolbar.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,7 @@
show_raw_html(toolbar_input_button(id = "label_only", label = "Click me",
show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="label_only" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">Click me</span>
</span>
</button>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="label_only" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">Click me</span></span></button>

---

Expand All @@ -61,16 +54,9 @@
Output
<bslib-tooltip id="test_btn_tooltip" placement="bottom" bsOptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()">
<template>Click me</template>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="test_btn" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="test_btn" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="far fa-star" role="presentation" aria-label="star icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label" hidden>Click me</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label" hidden>Click me</span></span></button>
</bslib-tooltip>

---
Expand All @@ -79,76 +65,41 @@
show_raw_html(toolbar_input_button(id = "test_btn", label = "Click me", icon = shiny::icon(
"star"), show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="both" id="test_btn" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="both" id="test_btn" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="far fa-star" role="presentation" aria-label="star icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">Click me</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">Click me</span></span></button>

# toolbar_input_button() disabled parameter

Code
show_raw_html(toolbar_input_button(id = "disabled_btn", label = "Disabled",
disabled = TRUE, show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" disabled id="disabled_btn" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">Disabled</span>
</span>
</button>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" disabled id="disabled_btn" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">Disabled</span></span></button>

---

Code
show_raw_html(toolbar_input_button(id = "enabled_btn", label = "Enabled",
disabled = FALSE, show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="enabled_btn" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">Enabled</span>
</span>
</button>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="enabled_btn" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">Enabled</span></span></button>

# toolbar_input_button() border parameter

Code
show_raw_html(toolbar_input_button(id = "no_border", label = "No Border",
border = FALSE, show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="no_border" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">No Border</span>
</span>
</button>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="label" id="no_border" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">No Border</span></span></button>

---

Code
show_raw_html(toolbar_input_button(id = "with_border", label = "With Border",
border = TRUE, show_label = TRUE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-1" data-type="label" id="with_border" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">With Border</span>
</span>
</button>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-1" data-type="label" id="with_border" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none"></span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">With Border</span></span></button>

# toolbar_input_button() tooltip parameter

Expand All @@ -158,16 +109,9 @@
Output
<bslib-tooltip id="tooltip_default_tooltip" placement="bottom" bsOptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()">
<template>Help</template>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_default" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_default" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="fas fa-question" role="presentation" aria-label="question icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label" hidden>Help</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label" hidden>Help</span></span></button>
</bslib-tooltip>

---
Expand All @@ -176,16 +120,9 @@
show_raw_html(toolbar_input_button(id = "tooltip_false", label = "No Tooltip",
icon = shiny::icon("question"), tooltip = FALSE))
Output
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_false" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_false" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="fas fa-question" role="presentation" aria-label="question icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label" hidden>No Tooltip</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label" hidden>No Tooltip</span></span></button>

---

Expand All @@ -195,16 +132,9 @@
Output
<bslib-tooltip id="tooltip_custom_tooltip" placement="bottom" bsOptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()">
<template>Click for assistance</template>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_custom" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="icon" id="tooltip_custom" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="fas fa-question" role="presentation" aria-label="question icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label" hidden>Help</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label" hidden>Help</span></span></button>
</bslib-tooltip>

---
Expand All @@ -215,16 +145,9 @@
Output
<bslib-tooltip id="both_label_tooltip_tooltip" placement="bottom" bsOptions="[]" data-require-bs-version="5" data-require-bs-caller="tooltip()">
<template>Save your work</template>
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="both" id="both_label_tooltip" type="button">
<span class="action-icon">
<span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<button aria-labelledby="btn-label-4785" class="btn btn-default action-button bslib-toolbar-input-button btn-sm border-0" data-type="both" id="both_label_tooltip" type="button"><span class="action-icon"><span class="bslib-toolbar-icon" aria-hidden="true" style="pointer-events: none">
<i class="far fa-floppy-disk" role="presentation" aria-label="floppy-disk icon"></i>
</span>
</span>
<span class="action-label">
<span id="btn-label-4785" class="bslib-toolbar-label">Save</span>
</span>
</button>
</span></span><span class="action-label"><span id="btn-label-4785" class="bslib-toolbar-label">Save</span></span></button>
</bslib-tooltip>

# toolbar_divider() creates divider element
Expand Down