Package with an initial set of functions added

NOTE: Not all tests have been written yet!
This commit is contained in:
2026-01-22 15:59:54 +00:00
parent c94ca1549a
commit 6d3843a92b
25 changed files with 711 additions and 4 deletions

View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlBoxManipulation.R
\name{htmlAddBoxAttributes}
\alias{htmlAddBoxAttributes}
\title{Add attributes to .box elements (\code{shinydashboard::box})}
\usage{
htmlAddBoxAttributes(box, ...)
}
\arguments{
\item{box}{The box to set the attributes on}
\item{...}{The attributes to set on the box}
}
\value{
The modified box
}
\description{
Add attributes to .box elements (\code{shinydashboard::box})
}
\examples{
x <- shinydashboard::box()
htmlAddBoxAttributes(x, role = "region", `aria-label` = "This is a special box")
}

View File

@@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlBoxManipulation.R
\name{htmlAddBoxRegionFromTitle}
\alias{htmlAddBoxRegionFromTitle}
\title{Creates an aria landmark for a \code{shinydashboard::box} from the box title}
\usage{
htmlAddBoxRegionFromTitle(box)
}
\arguments{
\item{box}{The box to set the aria landmark on}
}
\value{
The modified box
}
\description{
Creates an aria landmark for a \code{shinydashboard::box} from the box title
}
\examples{
x <- shinydashboard::box(title = "This is a powerful box")
htmlAddBoxRegionFromTitle(x)
}

View File

@@ -0,0 +1,21 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlDisableAutocomplete.R
\name{htmlDisableAutocomplete}
\alias{htmlDisableAutocomplete}
\title{Mark an HTML input as autocomplete = off}
\usage{
htmlDisableAutocomplete(input)
}
\arguments{
\item{input}{The Shiny input to set the autocomplete attribute on}
}
\value{
The modified input
}
\description{
Mark an HTML input as autocomplete = off
}
\examples{
x <- shiny::textInput("input_id", "Some text input")
htmlDisableAutocomplete(x)
}

View File

@@ -0,0 +1,24 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlBoxManipulation.R
\name{htmlFixBoxCollapseButtonAria}
\alias{htmlFixBoxCollapseButtonAria}
\title{Adds "aria-label" attribute to the box collapse/expand button}
\usage{
htmlFixBoxCollapseButtonAria(box, context = NULL)
}
\arguments{
\item{box}{The box to set the attributes on}
\item{context}{The context for the aria label. Defaults to the box title if
not set}
}
\value{
The modified box
}
\description{
Adds "aria-label" attribute to the box collapse/expand button
}
\examples{
x <- shinydashboard::box(title = "This is a box")
htmlFixBoxCollapseButtonAria(x)
}

23
man/htmlMarkOptional.Rd Normal file
View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlMarkOptional.R
\name{htmlMarkOptional}
\alias{htmlMarkOptional}
\title{Explicitly mark a Shiny input as optional}
\usage{
htmlMarkOptional(input, optClass = "text-muted font-italic")
}
\arguments{
\item{input}{The Shiny input to mark as optional}
\item{optClass}{The classes to add to the indicator text}
}
\value{
The modified input
}
\description{
Explicitly mark a Shiny input as optional
}
\examples{
x <- shiny::textInput("input_id", "Some text input")
htmlMarkOptional(x)
}

23
man/htmlMarkRequired.Rd Normal file
View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlMarkRequired.R
\name{htmlMarkRequired}
\alias{htmlMarkRequired}
\title{Mark a Shiny input as required}
\usage{
htmlMarkRequired(input, reqClass = "text-danger required")
}
\arguments{
\item{input}{The Shiny input to mark as required}
\item{reqClass}{The classes to add to the indicator asterisk}
}
\value{
The modified input
}
\description{
Mark a Shiny input as required
}
\examples{
x <- shiny::textInput("input_id", "Some text input")
htmlMarkRequired(x)
}

View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlRemoveAttributes.R
\name{htmlRemoveAttributes}
\alias{htmlRemoveAttributes}
\title{Remove attributes from an HTML element}
\usage{
htmlRemoveAttributes(el, ...)
}
\arguments{
\item{el}{The element to remove the attributes from}
\item{...}{The attribute names to be removed}
}
\value{
The modified element
}
\description{
Remove attributes from an HTML element
}
\examples{
x <- shiny::icon("wrench")
htmlRemoveAttributes(x, "aria-label")
}

View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlBoxManipulation.R
\name{htmlReplaceBoxTitleLevel}
\alias{htmlReplaceBoxTitleLevel}
\title{Replaces the default \code{shinydashboard::box} title level (h3)}
\usage{
htmlReplaceBoxTitleLevel(box, newLevel = 2)
}
\arguments{
\item{box}{The box to set the title level on}
\item{newLevel}{The new title level (default = 2)}
}
\value{
The modified box
}
\description{
Replaces the default \code{shinydashboard::box} title level (h3)
}
\examples{
x <- shinydashboard::box(title = "This is a box")
htmlReplaceBoxTitleLevel(x, 2)
}

23
man/htmlSetMaxLength.Rd Normal file
View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlSetXLength.R
\name{htmlSetMaxLength}
\alias{htmlSetMaxLength}
\title{Set the maximum length on a text or textarea input}
\usage{
htmlSetMaxLength(input, length)
}
\arguments{
\item{input}{The Shiny input to set the length attribute on}
\item{length}{The maximum length allowed on the input}
}
\value{
The modified input
}
\description{
Set the maximum length on a text or textarea input
}
\examples{
x <- shiny::textInput("input_id", "Some text input")
htmlSetMaxLength(x, 50)
}

23
man/htmlSetMinLength.Rd Normal file
View File

@@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/htmlSetXLength.R
\name{htmlSetMinLength}
\alias{htmlSetMinLength}
\title{Set the minimum length on a text or textarea input}
\usage{
htmlSetMinLength(input, length)
}
\arguments{
\item{input}{The Shiny input to set the length attribute on}
\item{length}{The minimum length allowed on the input}
}
\value{
The modified input
}
\description{
Set the minimum length on a text or textarea input
}
\examples{
x <- shiny::textInput("input_id", "Some text input")
htmlSetMinLength(x, 3)
}