def navbar(self, values=None, html_code=None, width=(100, "%"), height=(None, "%"), profile=None, options=None): """ Description: ----------- Attributes: ---------- :param values: :param html_code: :param width: :param height: :param profile: :param options: """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsNavBar(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) component.attr["aria-labelledby"] = "offcanvasLabel" component.attr["tabindex"] = "-1" component.add_to_header(self.page.web.bs.offcanvas.dismiss(component)) if values is not None: for v in values: component.add_to_body(v) return component
def custom(self, values=None, html_code=None, width=(100, "%"), height=(None, "%"), profile=None, options=None): """ Description: ----------- Push notifications to your visitors with a toast, a lightweight and easily customizable alert message. Usage:: t = page.web.bs.toasts.custom(["This is content"]) b = page.web.bs.button("Hide") b.click([t.js.hide()]) Related Pages: https://getbootstrap.com/docs/5.0/components/toasts/ https://getbootstrap.com/docs/5.0/components/toasts/#custom-content Attributes: ---------- :param values: List<Components>. The different HTML objects to be added to the component. :param html_code: String. Optional. An identifier for this component (on both Python and Javascript side). :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. :param options: Dictionary. Optional. Specific Python options available for this component. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsToast(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) component.flex_container = True component.attr["role"] = "alert" component.aria.live = "assertive" component.aria.atomic = "true" if values is not None: for v in values: component.add_to_body(v) return component
def carousel(self, images=None, active=None, width=(100, "%"), height=(300, "px"), html_code=None, options=None, profile=None): """ Description: ----------- Add carousel component. TODO: Fix component and add js events. Related Pages: https://getbootstrap.com/docs/5.1/components/carousel/ Usages:: page.web.bs.images.carousel([ r"/static/template_3.PNG", "/static/v1.6.PNG"]) Attributes: ---------- :param images: List<String>. Optional. The image paths. :param active: Boolean. optional. :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param html_code: String. Optional. An identifier for this component (on both Python and Javascript side). :param options: Dictionary. Optional. Specific Python options available for this component. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsCarousel(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) component.attr["data-bs-ride"] = "carousel" if images is not None: for image in images: component.add_item(image, active=active) return component
def offcanva(self, values=None, position="start", html_code=None, width=(100, "%"), height=(None, "%"), profile=None, options=None): """ Description: ------------ Add an off canvas panel. Related Pages: https://getbootstrap.com/docs/5.0/components/offcanvas/ Usage:: oc = page.web.bs.offcanvas(["AAA", "BBB"]) Attributes: ---------- :param values: Dictionary. Optional. Title: content. :param position: String. Optional. The offcanvas position in the page. :param html_code: String. Optional. An identifier for this component (on both Python and Javascript side). :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. :param options: Dictionary. Optional. Specific Python options available for this component. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsOffCanvas(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) component.add_style(["offcanvas-%s" % position]) component.attr["aria-labelledby"] = "offcanvasLabel" component.attr["tabindex"] = "-1" component.add_to_header(self.page.web.bs.offcanvas.dismiss(component)) if values is not None: for v in values: component.add_to_body(v) return component
def accordion(self, values=None, html_code=None, width=(100, "%"), height=(None, "%"), profile=None, options=None): """ Description: ------------ Add an Accordion panel. Related Pages: https://getbootstrap.com/docs/5.1/components/accordion/ Usage:: acc = page.web.bs.accordion() acc.add_section("Test", "content") acc.header(0).click([ acc.panel(0).build("New content") ]) Attributes: ---------- :param values: Dictionary. Optional. Title: content. :param html_code: String. Optional. An identifier for this component (on both Python and Javascript side). :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. :param options: Dictionary. Optional. Specific Python options available for this component. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsAccordion(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) if values is not None: for k, v in reversed(list(values.items())): component.add_section(k, v) return component
def nav(self, items=None, active=None, vertical=False, width=(100, '%'), height=(100, '%'), options=None, profile=None): """ Description: ----------- Add a simple navigation bar. Usage:: n1 = page.web.bs.panels.nav(["tab 1", "tab 2"], active="tab 2") n1.style.bs.justify_content("end") page.web.bs.panels.nav(["tab 1", "tab 2"], active="tab 2", vertical=True) Attributes: ---------- :param items: :param active: Boolean. Optional. :param vertical: Boolean. Optional. The direction for the navigation bar. :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param options: Dictionary. Optional. Specific Python options available for this component. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsNav(self.page, None, None, options or {}, profile, { "width": width, "height": height }) component.attr["data-bs-ride"] = "carousel" if vertical: component.attr["class"].add("flex-column") if items is not None: for item in items: component.add_item(item, active=active == item) return component
def breadcrumb(self, values=None, active=None, html_code=None, width=(100, "%"), height=(None, "%"), profile=None, options=None): """ Description: ------------ Add an breadcrumb. Related Pages: https://getbootstrap.com/docs/5.1/components/breadcrumb/ Usage:: page.web.bs.breadcrumb(["AAA", "BBBB"], active="AAA") Attributes: ---------- :param values: List. Optional. Title: content. :param active: String. Optional. The active section in the breadcrumb. :param html_code: String. Optional. An identifier for this component (on both Python and Javascript side). :param width: Tuple | Number. Optional. A tuple with the integer for the component width and its unit. :param height: Tuple | Number. Optional. A tuple with the integer for the component height and its unit. :param profile: Boolean | Dictionary. Optional. A flag to set the component performance storage. :param options: Dictionary. Optional. Specific Python options available for this component. """ width = Arguments.size(width, unit="px") height = Arguments.size(height, unit="px") component = HtmlBsWidgets.BsBreadcrumb(self.page, None, html_code, options or {}, profile, { "width": width, "height": height }) if values is not None: for v in values: component.add_section(v, active=v == active) return component