@ribajs/bs4
Advanced tools
Comparing version 1.9.0-alpha.11 to 1.9.0-beta.0
{ | ||
"name": "@ribajs/bs4", | ||
"description": "Bootstrap 4 module for Riba.js", | ||
"version": "1.9.0-alpha.11", | ||
"version": "1.9.0-beta.0", | ||
"author": "Pascal Garber <pascal@artandcode.studio>", | ||
@@ -56,5 +56,5 @@ "contributors": [], | ||
"@babel/runtime-corejs3": "^7.11.2", | ||
"@ribajs/eslint-config": "1.9.0-alpha.11", | ||
"@ribajs/tsconfig": "1.9.0-alpha.11", | ||
"@ribajs/types": "1.9.0-alpha.11", | ||
"@ribajs/eslint-config": "1.9.0-beta.0", | ||
"@ribajs/tsconfig": "1.9.0-beta.0", | ||
"@ribajs/types": "1.9.0-beta.0", | ||
"@types/jest": "^26.0.13", | ||
@@ -80,6 +80,6 @@ "@typescript-eslint/eslint-plugin": "^3.10.1", | ||
"dependencies": { | ||
"@ribajs/cache": "1.9.0-alpha.11", | ||
"@ribajs/core": "1.9.0-alpha.11", | ||
"@ribajs/extras": "1.9.0-alpha.11", | ||
"@ribajs/utils": "1.9.0-alpha.11", | ||
"@ribajs/cache": "1.9.0-beta.0", | ||
"@ribajs/core": "1.9.0-beta.0", | ||
"@ribajs/extras": "1.9.0-beta.0", | ||
"@ribajs/utils": "1.9.0-beta.0", | ||
"bootstrap": "^4.5.2", | ||
@@ -86,0 +86,0 @@ "popper.js": "^1.16.1" |
@@ -6,2 +6,3 @@ export { collapseOnUrlBinder } from "./bs4-collapse-on-url.binder"; | ||
export { expanOnUrlBinder } from "./bs4-expan-on-url.binder"; | ||
export { popoverBinder } from "./bs4-popover.binder"; | ||
export { showToastOnEventBinder } from "./bs4-show-toast-on.binder"; | ||
@@ -8,0 +9,0 @@ export { scrollspyClassBinder } from "./bs4-scrollspy-class.binder"; |
@@ -139,2 +139,3 @@ import { Component } from "@ribajs/core"; | ||
super.connectedCallback(); | ||
super.init(Bs4CarouselComponent.observedAttributes); | ||
} | ||
@@ -141,0 +142,0 @@ |
export * from "./carousel-class-name"; | ||
export * from "./carousel-direction"; | ||
export * from "./carousel-option"; | ||
export * from "./modal"; | ||
export * from "./notification"; | ||
export * from "./placement"; | ||
export * from "./popover-options"; | ||
export * from "./share-item"; | ||
export * from "./toast"; | ||
export * from "./modal"; | ||
export * from "./notification"; | ||
export * from "./tooltip-options"; |
@@ -11,3 +11,8 @@ /** | ||
import { findOne } from "./dom/selector-engine"; | ||
import { TooltipService, ConfigContentFn } from "./tooltip.service"; | ||
import { TooltipService } from "./tooltip.service"; | ||
import { | ||
TooltipContentFn, | ||
PopoverOptions, | ||
TooltipOptions, | ||
} from "../interfaces"; | ||
@@ -27,3 +32,3 @@ /** | ||
const Default = { | ||
const Default: PopoverOptions = { | ||
...TooltipService.Default, | ||
@@ -35,3 +40,3 @@ placement: "right", | ||
'<div class="popover" role="tooltip">' + | ||
'<div class="popover-arrow"></div>' + | ||
'<div class="popover-arrow arrow"></div>' + | ||
'<h3 class="popover-header"></h3>' + | ||
@@ -98,3 +103,3 @@ '<div class="popover-body"></div></div>', | ||
static get Default() { | ||
static get Default(): PopoverOptions { | ||
return Default; | ||
@@ -124,4 +129,7 @@ } | ||
// Overrides | ||
constructor(element: HTMLElement | HTMLUnknownElement, config: any) { | ||
super(element, config); | ||
constructor( | ||
element: HTMLElement | HTMLUnknownElement, | ||
config: Partial<PopoverOptions> | ||
) { | ||
super(element, config as TooltipOptions); | ||
element.style.backgroundColor = "#ffff00"; | ||
@@ -134,3 +142,3 @@ } | ||
setContent() { | ||
setContent(content?: string | TooltipContentFn) { | ||
const tip = this.getTipElement(); | ||
@@ -140,5 +148,7 @@ | ||
this.setElementContent(findOne(SELECTOR_TITLE, tip), this.getTitle()); | ||
let content = this._getContent(); | ||
if (!content) { | ||
content = this._getContent(); | ||
} | ||
if (typeof content === "function") { | ||
content = (content as ConfigContentFn)(this.element); | ||
content = (content as TooltipContentFn)(this.element); | ||
} | ||
@@ -173,2 +183,8 @@ | ||
_getPopperConfig(attachment: string) { | ||
const config = super._getPopperConfig(attachment); | ||
config.modifiers.arrow.element = `.${PopoverService.NAME}-arrow`; | ||
return config; | ||
} | ||
// Static | ||
@@ -175,0 +191,0 @@ static getInstance(element: HTMLElement) { |
@@ -19,3 +19,3 @@ /** | ||
import { getUID, getElementFromEvent } from "@ribajs/utils/src/dom"; | ||
import { DefaultAllowlist, AllowList, sanitizeHtml } from "./sanitizer"; | ||
import { DefaultAllowlist, sanitizeHtml } from "./sanitizer"; | ||
import Data from "./dom/data"; | ||
@@ -26,31 +26,8 @@ import EventHandler from "./dom/event-handler"; | ||
import { findOne } from "./dom/selector-engine"; | ||
import { | ||
TooltipOptions, | ||
TooltipTitleFn, | ||
TooltipOffsetFn, | ||
} from "./../interfaces/tooltip-options"; | ||
export type ConfigOffsetFn = ( | ||
offsets: any /*TODO*/, | ||
el: HTMLElement | ||
) => number[]; | ||
export type ConfigPlacementFn = (el1: HTMLElement, el2: HTMLElement) => string; | ||
export type ConfigTitleFn = (el: HTMLElement) => string; | ||
export type ConfigContentFn = (el: HTMLElement) => string; | ||
export interface Config { | ||
animation: boolean; | ||
delay: number | { show: number; hide: number }; | ||
html: boolean; | ||
placement: string | ConfigPlacementFn; | ||
selector?: string; | ||
template: string; | ||
title: string | ConfigTitleFn; | ||
trigger: string; | ||
offset: number | ConfigOffsetFn; | ||
container?: Element; // TODO, | ||
fallbackPlacement: "flip"; | ||
boundary: "scrollParent"; | ||
sanitize: boolean; | ||
sanitizeFn: null; | ||
allowList: AllowList; | ||
popperConfig: null | any; // TODO | ||
content?: string | ConfigContentFn; | ||
} | ||
/** | ||
@@ -97,3 +74,3 @@ * ------------------------------------------------------------------------ | ||
const Default: Config = { | ||
const Default: TooltipOptions = { | ||
animation: true, | ||
@@ -107,3 +84,3 @@ container: undefined, | ||
'<div class="tooltip" role="tooltip">' + | ||
'<div class="tooltip-arrow"></div>' + | ||
'<div class="tooltip-arrow arrow"></div>' + | ||
'<div class="tooltip-inner"></div></div>', | ||
@@ -190,6 +167,9 @@ title: "", | ||
protected element: HTMLElement | HTMLUnknownElement; | ||
protected config: Config; | ||
protected config: TooltipOptions; | ||
protected tip: null | HTMLElement = null; | ||
constructor(element: HTMLElement | HTMLUnknownElement, config: Config) { | ||
constructor( | ||
element: HTMLElement | HTMLUnknownElement, | ||
config: TooltipOptions | ||
) { | ||
if (typeof Popper === "undefined") { | ||
@@ -535,3 +515,3 @@ throw new TypeError( | ||
typeof this.config.title === "function" | ||
? (this.config.title as ConfigTitleFn)(this.element) | ||
? (this.config.title as TooltipTitleFn)(this.element) | ||
: this.config.title; | ||
@@ -585,3 +565,3 @@ } | ||
...data.offsets, | ||
...((this.config.offset as ConfigOffsetFn)( | ||
...((this.config.offset as TooltipOffsetFn)( | ||
data.offsets, | ||
@@ -790,3 +770,3 @@ this.element | ||
_getConfig(config: Config) { | ||
_getConfig(config: TooltipOptions) { | ||
const dataAttributes = Manipulator.getDataAttributes(this.element); | ||
@@ -843,4 +823,4 @@ | ||
_getDelegateConfig(): Config { | ||
const config: Partial<Config> = {}; | ||
_getDelegateConfig(): TooltipOptions { | ||
const config: Partial<TooltipOptions> = {}; | ||
@@ -858,3 +838,3 @@ if (this.config) { | ||
return config as Config; | ||
return config as TooltipOptions; | ||
} | ||
@@ -861,0 +841,0 @@ |
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
308331
111
8411
+ Added@ribajs/cache@1.9.0-beta.0(transitive)
+ Added@ribajs/core@1.9.0-beta.0(transitive)
+ Added@ribajs/extras@1.9.0-beta.0(transitive)
+ Added@ribajs/utils@1.9.0-beta.0(transitive)
- Removed@ribajs/cache@1.9.0-alpha.11(transitive)
- Removed@ribajs/core@1.9.0-alpha.11(transitive)
- Removed@ribajs/extras@1.9.0-alpha.11(transitive)
- Removed@ribajs/utils@1.9.0-alpha.11(transitive)
Updated@ribajs/cache@1.9.0-beta.0
Updated@ribajs/core@1.9.0-beta.0
Updated@ribajs/extras@1.9.0-beta.0
Updated@ribajs/utils@1.9.0-beta.0