Skip to content

Commit

Permalink
Make card() a custom element
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Mar 12, 2024
1 parent 2722bb2 commit 430537d
Show file tree
Hide file tree
Showing 12 changed files with 524 additions and 687 deletions.
13 changes: 3 additions & 10 deletions R/card.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,15 @@ card <- function(..., full_screen = FALSE, height = NULL, max_height = NULL, min
max_height = validateCssUnit(max_height),
min_height = validateCssUnit(min_height)
),
"data-bslib-card-init" = NA,
"data-full-screen" = if (full_screen) "false",
"data-full-screen" = if (full_screen) "false",
!!!attribs,
!!!children,
if (full_screen) full_screen_toggle(attribs$id),
card_init_js(),
component_dependencies()
)

tag <- web_component("bslib-card", tag)

tag <- bindFillRole(tag, container = TRUE, item = fill)
tag <- tagAppendAttributes(tag, class = class)

Expand Down Expand Up @@ -313,13 +313,6 @@ full_screen_toggle <- function(id_controls) {
)
}

card_init_js <- function() {
tags$script(
`data-bslib-card-init` = NA,
HTML("bslib.Card.initializeAllCards();")
)
}

full_screen_toggle_icon <- function() {
# https://www.visiwig.com/icons/
# https://www.visiwig.com/icons-license/
Expand Down
330 changes: 0 additions & 330 deletions inst/components/dist/components.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions inst/components/dist/components.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 430537d

Please sign in to comment.