@types/bootstrap
Advanced tools
Comparing version 4.0.0 to 4.0.1
@@ -7,6 +7,8 @@ // Type definitions for Bootstrap 4.0 | ||
// TODO: collapse, tab (list-group, navs), popovers, scrollspy | ||
/// <reference types="jquery"/> | ||
/// <reference types="jquery" /> | ||
import * as Popper from "popper.js"; | ||
export as namespace Bootstrap; | ||
// -------------------------------------------------------------------------- | ||
@@ -16,6 +18,9 @@ // Some Types and Interfaces | ||
type BootstrapPlacement = "auto" | "top" | "bottom" | "left" | "right"; | ||
type PopperBehavior = "flip" | "clockwise" | "counterclockwise"; | ||
export type Placement = "auto" | "top" | "bottom" | "left" | "right"; | ||
interface BootstrapDelay { | ||
export type Trigger = "click" | "hover" | "focus" | "manual" | | ||
"click hover" | "click focus" | "hover focus" | | ||
"click hover focus"; | ||
export interface Delay { | ||
show: number; | ||
@@ -25,4 +30,4 @@ hide: number; | ||
interface BootstrapTooltipInstance { | ||
config: BootstrapTooltipOption; | ||
export interface TooltipInstance<T extends TooltipOption> { | ||
config: T; | ||
element: Element; | ||
@@ -32,14 +37,7 @@ tip: HTMLElement; | ||
interface BootstrapOffsetExtend { | ||
top?: number; | ||
left?: number; | ||
width?: number; | ||
height?: number; | ||
export interface OffsetsExtend { | ||
popper?: Partial<Popper.Offset>; | ||
reference?: Partial<Popper.Offset>; | ||
} | ||
interface BootstrapOffsetsExtend { | ||
popper?: BootstrapOffsetExtend; | ||
reference?: BootstrapOffsetExtend; | ||
} | ||
// -------------------------------------------------------------------------------------- | ||
@@ -49,3 +47,3 @@ // Options Interfaces | ||
interface BootstrapCarouselOption { | ||
export interface CarouselOption { | ||
/** | ||
@@ -83,4 +81,22 @@ * The amount of time to delay between automatically cycling an item. If false, carousel will not automatically cycle. | ||
interface BootstrapDropdownOption { | ||
export interface CollapseOption { | ||
/** | ||
* If parent is provided, then all collapsible elements under the specified parent will be closed when | ||
* this collapsible item is shown. (similar to traditional accordion behavior - this is dependent on the card class). | ||
* The attribute has to be set on the target collapsible area. | ||
* | ||
* @default "" | ||
*/ | ||
parent?: string | JQuery | Element; | ||
/** | ||
* Toggles the collapsible element on invocation. | ||
* | ||
* @default true | ||
*/ | ||
toggle?: boolean; | ||
} | ||
export interface DropdownOption { | ||
/** | ||
* Offset of the dropdown relative to its target. | ||
@@ -91,3 +107,3 @@ * For more information refer to Popper.js's offset docs. | ||
*/ | ||
offset?: number | string | ((this: BootstrapDropdownOption, offset: BootstrapOffsetsExtend) => BootstrapOffsetsExtend); | ||
offset?: number | string | ((this: DropdownOption, offset: OffsetsExtend) => OffsetsExtend); | ||
@@ -109,6 +125,6 @@ /** | ||
*/ | ||
boundary?: "viewport" | "window" | "scrollParent" | HTMLElement; | ||
boundary?: Popper.Boundary | HTMLElement; | ||
} | ||
interface BootstrapModalOption { | ||
export interface ModalOption { | ||
/** | ||
@@ -144,6 +160,39 @@ * Includes a modal-backdrop element. | ||
interface BootstrapTooltipOption { | ||
export interface PopoverOption extends TooltipOption { | ||
/** | ||
* Apply a CSS fade transition to the tooltip. | ||
* Default content value if data-content attribute isn't present. | ||
* If a function is given, it will be called with its this reference | ||
* set to the element that the popover is attached to. | ||
*/ | ||
content?: string | Element | ((this: Element) => string | Element); | ||
} | ||
export interface ScrollspyOption { | ||
/** | ||
* TODO: https://github.com/twbs/bootstrap/issues/25799 | ||
* | ||
* @default "auto" | ||
*/ | ||
method?: "auto" | "offset" | "position"; | ||
/** | ||
* Pixels to offset from top when calculating position of scroll. | ||
* | ||
* @default 10 | ||
*/ | ||
offset?: number; | ||
/** | ||
* A selector of the parent element or the parent element itself | ||
* of any Bootstrap `.nav` or `.list-group` component. | ||
* | ||
* @default "" | ||
*/ | ||
target?: string | Element; | ||
} | ||
export interface TooltipOption { | ||
/** | ||
* Apply a CSS fade transition to the tooltip or popover. | ||
* | ||
* @default true | ||
@@ -154,6 +203,6 @@ */ | ||
/** | ||
* Appends the tooltip to a specific element. Example: `container: 'body'`. | ||
* This option is particularly useful in that it allows you to position the tooltip | ||
* Appends the tooltip or popover to a specific element. Example: `container: 'body'`. | ||
* This option is particularly useful in that it allows you to position the tooltip or popover | ||
* in the flow of the document near the triggering element - which will prevent | ||
* the tooltip from floating away from the triggering element during a window resize. | ||
* it from floating away from the triggering element during a window resize. | ||
* | ||
@@ -165,3 +214,3 @@ * @default false | ||
/** | ||
* Delay showing and hiding the tooltip (ms) - does not apply to manual trigger type. | ||
* Delay showing and hiding the tooltip or popover (ms) - does not apply to manual trigger type. | ||
* If a number is supplied, delay is applied to both hide/show. | ||
@@ -172,7 +221,7 @@ * Object structure is: `delay: { "show": 500, "hide": 100 }`. | ||
*/ | ||
delay?: number | BootstrapDelay; | ||
delay?: number | Delay; | ||
/** | ||
* Allow HTML in the tooltip. | ||
* If true, HTML tags in the tooltip's title will be rendered in the tooltip. | ||
* Allow HTML in the tooltip or popover. | ||
* If true, HTML tags will be rendered in the tooltip or popover. | ||
* If false, jQuery's text method will be used to insert content into the DOM. | ||
@@ -186,14 +235,14 @@ * Use text if you're worried about XSS attacks. | ||
/** | ||
* How to position the tooltip - auto | top | bottom | left | right. | ||
* When auto is specified, it will dynamically reorient the tooltip. | ||
* How to position the tooltip or popover - auto | top | bottom | left | right. | ||
* When auto is specified, it will dynamically reorient the tooltip or popover. | ||
* When a function is used to determine the placement, it is called with | ||
* the tooltip DOM node as its first argument and the triggering element DOM node as its second. | ||
* The this context is set to the tooltip instance. | ||
* the tooltip or popover DOM node as its first argument and the triggering element DOM node as its second. | ||
* The this context is set to the tooltip or popover instance. | ||
* | ||
* @default "top" | ||
*/ | ||
placement?: BootstrapPlacement | ((this: BootstrapTooltipInstance, tooltip: HTMLElement, trigger: Element) => BootstrapPlacement); | ||
placement?: Placement | ((this: TooltipInstance<this>, node: HTMLElement, trigger: Element) => Placement); | ||
/** | ||
* If a selector is provided, tooltip objects will be delegated to the specified targets. | ||
* If a selector is provided, tooltip or popover objects will be delegated to the specified targets. | ||
* In practice, this is used to enable dynamic HTML content to have popovers added. | ||
@@ -206,7 +255,8 @@ * | ||
/** | ||
* Base HTML to use when creating the tooltip. The tooltip's title will be injected into | ||
* the `.tooltip-inner`. The `.arrow` will become the tooltip's arrow. | ||
* The outermost wrapper element should have the `.tooltip` class and `role="tooltip"`. | ||
* Base HTML to use when creating the tooltip or popover. The tooltip's (resp., popover's) title will be injected into | ||
* the `.tooltip-inner` (resp., `.popover-header`). The `.arrow` will become the tooltip's (resp., popover's) arrow. | ||
* The outermost wrapper element should have the `.tooltip` (resp., .popover) class and `role="tooltip"`. | ||
* | ||
* @default '<div class="tooltip" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>' | ||
* @default '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-header"></h3><div class="popover-body"></div></div>' | ||
*/ | ||
@@ -218,21 +268,19 @@ template?: string; | ||
* If a function is given, it will be called with its this reference set to the element | ||
* that the tooltip is attached to. | ||
* that the tooltip or popover is attached to. | ||
* | ||
* @default "" | ||
*/ | ||
title?: string | Element | ((this: Element) => string); | ||
title?: string | Element | ((this: Element) => string | Element); | ||
/** | ||
* How tooltip is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. | ||
* 'manual' indicates that the tooltip will be triggered programmatically via the .tooltip('show'), .tooltip('hide') and | ||
* .tooltip('toggle') methods; this value cannot be combined with any other trigger. | ||
* 'hover' on its own will result in tooltips that cannot be triggered via the keyboard, and should only be used if | ||
* alternative methods for conveying the same information for keyboard users is present. | ||
* How tooltip or popover is triggered - click | hover | focus | manual. You may pass multiple triggers; separate them with a space. | ||
* 'manual' indicates that the tooltip will be triggered programmatically; this value cannot be combined with any other trigger. | ||
* 'hover' should only be used if alternative methods for conveying the same information for keyboard users is present. | ||
* | ||
* @default "hover focus" | ||
* @default tooltip: "hover focus", popover: "click" | ||
*/ | ||
trigger?: string; | ||
trigger?: Trigger; | ||
/** | ||
* Offset of the tooltip relative to its target. | ||
* Offset of the tooltip or popover relative to its target. | ||
* For more information refer to Popper.js's offset docs. | ||
@@ -242,3 +290,3 @@ * | ||
*/ | ||
offset?: number | string; | ||
offset?: number | string; | ||
@@ -251,6 +299,6 @@ /** | ||
*/ | ||
fallbackPlacement?: PopperBehavior | PopperBehavior[]; | ||
fallbackPlacement?: Popper.Behavior | ReadonlyArray<Popper.Behavior>; | ||
/** | ||
* Overflow constraint boundary of the tooltip. | ||
* Overflow constraint boundary of the tooltip or popover. | ||
* Accepts the values of 'viewport', 'window', 'scrollParent', | ||
@@ -262,3 +310,3 @@ * or an HTMLElement reference (JavaScript only). | ||
*/ | ||
boundary?: "viewport" | "window" | "scrollParent" | HTMLElement; | ||
boundary?: Popper.Boundary | HTMLElement; | ||
} | ||
@@ -270,3 +318,3 @@ | ||
interface BootstrapCarouselEventHandler<TElement> extends JQuery.Event<TElement, undefined> { | ||
export interface CarouselEventHandler<TElement> extends JQuery.Event<TElement, undefined> { | ||
/** | ||
@@ -288,7 +336,11 @@ * The direction in which the carousel is sliding. | ||
type BootstrapAlertEvent = "close.bs.alert" | "closed.bs.alert"; | ||
type BootstrapCarouselEvent = "slide.bs.carousel" | "slid.bs.carousel"; | ||
type BootstrapDropdownEvent = "show.bs.dropdown" | "shown.bs.dropdown" | "hide.bs.dropdown" | "hidden.bs.dropdown"; | ||
type BootstrapModalEvent = "show.bs.modal" | "shown.bs.modal" | "hide.bs.modal" | "hidden.bs.modal"; | ||
type BootstrapTooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.tooltip" | "hidden.bs.tooltip" | "inserted.bs.tooltip"; | ||
export type AlertEvent = "close.bs.alert" | "closed.bs.alert"; | ||
export type CarouselEvent = "slide.bs.carousel" | "slid.bs.carousel"; | ||
export type CollapseEvent = "show.bs.collapse" | "shown.bs.collapse" | "hide.bs.collapse" | "hidden.bs.collapse"; | ||
export type DropdownEvent = "show.bs.dropdown" | "shown.bs.dropdown" | "hide.bs.dropdown" | "hidden.bs.dropdown"; | ||
export type ModalEvent = "show.bs.modal" | "shown.bs.modal" | "hide.bs.modal" | "hidden.bs.modal"; | ||
export type PopoverEvent = "show.bs.popover" | "shown.bs.popover" | "hide.bs.popover" | "hidden.bs.popover" | "inserted.bs.popover"; | ||
export type ScrollspyEvent = "activate.bs.scrollspy"; | ||
export type TapEvent = "show.bs.tab" | "shown.bs.tab" | "hide.bs.tab" | "hidden.bs.tab"; | ||
export type TooltipEvent = "show.bs.tooltip" | "shown.bs.tooltip" | "hide.bs.tooltip" | "hidden.bs.tooltip" | "inserted.bs.tooltip"; | ||
@@ -299,22 +351,37 @@ // -------------------------------------------------------------------------------------- | ||
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> { | ||
alert(action?: "close" | "dispose"): this; | ||
declare global { | ||
interface JQuery<TElement extends Node = HTMLElement> extends Iterable<TElement> { | ||
alert(action?: "close" | "dispose"): this; | ||
button(action: "toggle" | "dispose"): this; | ||
button(action: "toggle" | "dispose"): this; | ||
carousel(action: "cycle" | "pause" | number | "prev" | "next" | "dispose"): this; | ||
carousel(options?: BootstrapCarouselOption): this; | ||
carousel(action: "cycle" | "pause" | number | "prev" | "next" | "dispose"): this; | ||
carousel(options?: CarouselOption): this; | ||
dropdown(action: "toggle" | "update" | "dispose"): this; | ||
dropdown(options?: BootstrapDropdownOption): this; | ||
collapse(action: "toggle" | "show" | "hide" | "dispose"): this; | ||
collapse(options?: CollapseOption): this; | ||
modal(action: "toggle" | "show" | "hide" | "handleUpdate" | "dispose"): this; | ||
modal(options?: BootstrapModalOption): this; | ||
dropdown(action: "toggle" | "update" | "dispose"): this; | ||
dropdown(options?: DropdownOption): this; | ||
tooltip(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this; | ||
tooltip(options?: BootstrapTooltipOption): this; | ||
modal(action: "toggle" | "show" | "hide" | "handleUpdate" | "dispose"): this; | ||
modal(options?: ModalOption): this; | ||
on(events: BootstrapCarouselEvent, handler: JQuery.EventHandlerBase<TElement, BootstrapCarouselEventHandler<TElement>>): this; | ||
on(events: BootstrapAlertEvent | BootstrapDropdownEvent | BootstrapModalEvent | BootstrapTooltipEvent, | ||
handler: JQuery.EventHandler<TElement>): this; | ||
popover(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this; | ||
popover(options?: PopoverOption): this; | ||
scrollspy(action: "refresh" | "dispose"): this; | ||
scrollspy(options?: ScrollspyOption): this; | ||
tab(action: "show" | "dispose"): this; | ||
tooltip(action: "show" | "hide" | "toggle" | "dispose" | "enable" | "disable" | "toggleEnabled" | "update"): this; | ||
tooltip(options?: TooltipOption): this; | ||
on(events: CarouselEvent, handler: JQuery.EventHandlerBase<TElement, CarouselEventHandler<TElement>>): this; | ||
on(events: | ||
AlertEvent | CollapseEvent | DropdownEvent | ModalEvent | | ||
PopoverEvent | ScrollspyEvent | TapEvent | TooltipEvent, | ||
handler: JQuery.EventHandler<TElement>): this; | ||
} | ||
} |
{ | ||
"name": "@types/bootstrap", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "TypeScript definitions for Bootstrap", | ||
@@ -20,6 +20,7 @@ "license": "MIT", | ||
"dependencies": { | ||
"popper.js": "^1.14.1", | ||
"@types/jquery": "*" | ||
}, | ||
"typesPublisherContentHash": "b21378d92bb876555a445aaeffd9af85ddfc6aad22ac73d8d604caae5ed6fc4d", | ||
"typesPublisherContentHash": "4083d77e95208f40c7d9239c42d65c638b6f972fae50e487462e12fa4b388a67", | ||
"typeScriptVersion": "2.3" | ||
} |
@@ -11,7 +11,7 @@ # Installation | ||
Additional Details | ||
* Last updated: Thu, 01 Mar 2018 22:53:49 GMT | ||
* Dependencies: jquery | ||
* Global values: none | ||
* Last updated: Thu, 15 Mar 2018 23:17:55 GMT | ||
* Dependencies: popper.js, jquery | ||
* Global values: Bootstrap | ||
# Credits | ||
These definitions were written by denisname <https://github.com/denisname>. |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
15013
310
0
2
+ Addedpopper.js@^1.14.1
+ Addedpopper.js@1.16.1(transitive)