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:
@@ -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() {
|
||||
|
Reference in New Issue
Block a user