1
0
mirror of https://github.com/twbs/bootstrap.git synced 2025-09-26 13:29:06 +02:00

feat(RTL): implement RTL

Using RTLCSS directives, renaming things to use logical names and following best practices.
This commit is contained in:
Gaël Poupard
2020-06-26 17:06:20 +03:00
committed by XhmikosR
parent 71ecc3323f
commit 9488978fb5
37 changed files with 301 additions and 200 deletions

View File

@@ -14,6 +14,7 @@ import {
getTransitionDurationFromElement,
getUID,
isElement,
isRTL,
noop,
typeCheckConfig
} from './util/index'
@@ -64,9 +65,9 @@ const DefaultType = {
const AttachmentMap = {
AUTO: 'auto',
TOP: 'top',
RIGHT: 'right',
RIGHT: isRTL ? 'left' : 'right',
BOTTOM: 'bottom',
LEFT: 'left'
LEFT: isRTL ? 'right' : 'left'
}
const Default = {
@@ -453,6 +454,18 @@ class Tooltip extends BaseComponent {
return title
}
updateAttachment(attachment) {
if (attachment === 'right') {
return 'end'
}
if (attachment === 'left') {
return 'start'
}
return attachment
}
// Private
_getPopperConfig(attachment) {
@@ -485,7 +498,7 @@ class Tooltip extends BaseComponent {
}
_addAttachmentClass(attachment) {
this.getTipElement().classList.add(`${CLASS_PREFIX}-${attachment}`)
this.getTipElement().classList.add(`${CLASS_PREFIX}-${this.updateAttachment(attachment)}`)
}
_getOffset() {