Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore/merge-main@795167d #1247

Merged
merged 71 commits into from
May 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
8f37063
5602093c7be8726f1b1043b3d71bb887d6f1f607
julien-deramond May 11, 2022
bc06995
3990ff04a00f2768b768e1c852594e3a365b9c61
julien-deramond May 11, 2022
ed2df29
3362c8cf13cc3610a6e0ac1efc673f7f8c74ac08
julien-deramond May 11, 2022
a7d6e72
2aad1696f1536202b1d66205f7f9889b3b311755
julien-deramond May 11, 2022
2be55cb
c1eab89238da2cb8ee13b6af0666760202718fbc
julien-deramond May 11, 2022
ff5c5c9
e089aef00fef68c6a815327d8b988e14cfcf4d9b
julien-deramond May 11, 2022
c0e48f9
d6064264fe3a52f6bf0862b270978e1de4f1d261
julien-deramond May 11, 2022
5ba55f4
9ccee925fb563adbd9ccb00f7f6c1c861a254e7f
julien-deramond May 11, 2022
1887d1b
1dc59b0d4e9ea5dd1a07aa91f964b491de1310ba
julien-deramond May 11, 2022
01052ee
Fix cspell error
julien-deramond May 11, 2022
a2bc879
fc87624a5002177eb590101a087e0c03a68f73c0
julien-deramond May 11, 2022
cc7d657
01cffa682249965eafa581058dd993853d82b3c4
julien-deramond May 11, 2022
16a42bc
584600bda36ac13ea325617783216d6c6a331c08
julien-deramond May 11, 2022
c587ecc
554736834dd929263ab307593f4d4d3f28f61479
julien-deramond May 11, 2022
95b5d2f
9a614a7e1dd21d6a4b2f6e36c0ad390fd4767528
julien-deramond May 11, 2022
de03d9c
3edead4ffef40bd86c0bcb114b1f0206f66b51e8
julien-deramond May 11, 2022
9bb4158
00d45b11e7088981d52027df65bebf7f5e4c6050
julien-deramond May 11, 2022
01d639d
a2edb2afb89beac6f05b926e59d153aa0a0e6f22
julien-deramond May 11, 2022
d7d4f1e
3143824ea43cf15e42f8513ce65872b3a3f41d6f
julien-deramond May 11, 2022
7efb0fa
54e0af0303fe6617e438b9bf68e85b377b0e8ef2
julien-deramond May 11, 2022
077515c
544cf8df48de281aafb5ae0615b9bc9fd75ed4f8
julien-deramond May 11, 2022
14b619c
ebb1f485d3e750a67ac7633e5044f2fce0749afe
julien-deramond May 11, 2022
69e8a74
7745730e4132eff204bf2afe8351511e595acee6
julien-deramond May 11, 2022
8d3ca7d
207ddbee4946fa43cef07ab44aa0d00e48fef0f3
julien-deramond May 11, 2022
b4ebdf4
55be3c3fc26d8189120a2a780bac129d3fb2e272
julien-deramond May 11, 2022
f820fe6
ec41392717c767ae0c862e30967774e9a5d6ba7a
julien-deramond May 11, 2022
d46479b
8cd3c3e3bc6b966c2be9491091ad1c0c629a4b30
julien-deramond May 11, 2022
1e132e5
1ac2997cf623f8bf4217aab6bdd573b9f1ee7e48
julien-deramond May 12, 2022
f1a134a
a078b5e0b9c11d5a04497c1d1561fe9d4e0b028b
julien-deramond May 12, 2022
89dee48
2ba73d2c8047b38350e7d469787a476d65c22b9d
julien-deramond May 12, 2022
3efa51f
51535cd95ac8eb5746e19c057aeabdbcafef3a8b
julien-deramond May 12, 2022
44a72fc
cca801683dfbc54dc7ae7a6ef6ce4361b071bc36
julien-deramond May 12, 2022
fe900a1
Change Boosteded into Boosted
julien-deramond May 12, 2022
26ba6ee
5d9500bdfdd02b3b1d91df2be86b1723f517fc52
julien-deramond May 12, 2022
4ec7b6e
bca99232b8bef6a53719e4827de40729098d4ec8
julien-deramond May 12, 2022
eb0b6cb
d2497b0384d05af9159743d7ff58fd071d5c5cbb
julien-deramond May 12, 2022
f228401
d2497b0384d05af9159743d7ff58fd071d5c5cbb
julien-deramond May 12, 2022
c494bf5
6b49d26b21cabb7322a820183c6d925263cddba1
julien-deramond May 12, 2022
000bf73
f82b2ba20d50d49a1554f4fa2891e3e65760fa98
julien-deramond May 12, 2022
19932dd
f02bdf7c5276eecb754343b4cf0e17e385512806
julien-deramond May 12, 2022
26559e8
92e6856235555622c14f120b641f8118af33a5a3
julien-deramond May 12, 2022
6794c59
4a682ab00a86adba2d38b0da7f3eaf1a6208f647
julien-deramond May 12, 2022
2cd41a8
619a65c55af8c49b6cd591eac511fa322afa41a5
julien-deramond May 12, 2022
ecd90a7
68f5965f42ffa2b5a171382d5aed562886e54ffa
julien-deramond May 12, 2022
eced9d2
224b02e6e7f5e19be8b8107215b04e3b9300271c
julien-deramond May 12, 2022
7441606
fb20700a90fb71110e0affd7684263e3c6b6b424
julien-deramond May 12, 2022
8068680
6ac37c9bb2208e0b5ebfd26e053a8073f40deb79
julien-deramond May 12, 2022
4039c43
b2477d5c1e7de9390e04755d78d9678d5a0aa84b
julien-deramond May 12, 2022
99fe28d
6ca83e81b08ff36bbc23e87f5471bcf83f8ec0df
julien-deramond May 12, 2022
e3d014e
78e49f5127c03c6ba434c28d0fa8b6143a358b23
julien-deramond May 12, 2022
9e4d93f
63d4c509b706de9a4117eeb6b80d6b57eea2c615
julien-deramond May 12, 2022
bcefce9
003fcac6190c2b2ebcc479f47558f89f9bc1367a
julien-deramond May 12, 2022
d5722cb
7db2b16beab1d9650be6b74b8e405fa8c07cc724
julien-deramond May 12, 2022
cc9a1ad
8070e2da9d3e92c159b4d50cee2d7d0a33b159cc
julien-deramond May 12, 2022
3f8b2b7
ceb94d07faadba2532de3ae6d8f0ecb097d085d9
julien-deramond May 12, 2022
c7904f3
0e2fe9c8d150cca16a11670130e702570b2129b4
julien-deramond May 12, 2022
bbe39e2
a9f8feb90bca130704c14d02667321c25545d75a
julien-deramond May 12, 2022
b7b7ba4
124bdfa4c17d6ef5b1c70d267e2595a924e99512
julien-deramond May 12, 2022
ee99c24
3cac119930ba0d54771d7cbbb3fc5a29661afb2f
julien-deramond May 12, 2022
413a1f6
795167d822d3752ef2ad4f6e716a37e0270c741e
julien-deramond May 12, 2022
e916919
dd19bf2657addd7738ee9ef107c24bd7b2544f36
julien-deramond May 12, 2022
395f958
.
julien-deramond May 12, 2022
8848174
Fix sidebar content
julien-deramond May 12, 2022
fdc0d56
Enhance search rendering in header and in the modal
julien-deramond May 12, 2022
f1e632a
Some improvements for the search bar
julien-deramond May 12, 2022
0b4a0d6
Enhanced version of search modal
julien-deramond May 12, 2022
cc6beed
.
julien-deramond May 12, 2022
4c814bf
Fix indentation
julien-deramond May 13, 2022
35d1e74
Use .text-bg-secondary for toast example
julien-deramond May 13, 2022
68f467c
Reintegrate long string
julien-deramond May 13, 2022
24b0ecd
Move scrollspy callout
julien-deramond May 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
},
{
"path": "./dist/css/boosted.css",
"maxSize": "34.5 kB"
"maxSize": "35.75 kB"
},
{
"path": "./dist/css/boosted.min.css",
"maxSize": "31.75 kB"
"maxSize": "32.75 kB"
},
{
"path": "./dist/js/boosted.bundle.js",
Expand All @@ -42,7 +42,7 @@
},
{
"path": "./dist/js/boosted.esm.js",
"maxSize": "32.5 kB"
"maxSize": "32.75 kB"
},
{
"path": "./dist/js/boosted.esm.min.js",
Expand All @@ -54,7 +54,7 @@
},
{
"path": "./dist/js/boosted.min.js",
"maxSize": "17.5 kB"
"maxSize": "17.75 kB"
}
],
"ci": {
Expand Down
2 changes: 2 additions & 0 deletions .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"btnradio",
"callout",
"callouts",
"camelCase",
"clearfix",
"clic",
"Codesniffer",
Expand Down Expand Up @@ -69,6 +70,7 @@
"markdownify",
"mediaqueries",
"minifiers",
"misfunction",
"monospace",
"mouseleave",
"navbars",
Expand Down
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

## Our Standards

Expand Down
72 changes: 35 additions & 37 deletions js/src/carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,19 +83,19 @@ const KEY_TO_DIRECTION = {
const Default = {
interval: 5000,
keyboard: true,
slide: false,
pause: 'hover',
wrap: true,
touch: true
ride: false,
touch: true,
wrap: true
}

const DefaultType = {
interval: '(number|boolean)',
keyboard: 'boolean',
slide: '(boolean|string)',
ride: '(boolean|string)',
louismaximepiton marked this conversation as resolved.
Show resolved Hide resolved
pause: '(string|boolean)',
wrap: 'boolean',
touch: 'boolean'
touch: 'boolean',
wrap: 'boolean'
}

/**
Expand All @@ -108,7 +108,6 @@ class Carousel extends BaseComponent {

this._interval = null
this._activeElement = null
this._stayPaused = false
this._isSliding = false
this.touchTimeout = null
this._swipeHelper = null
Expand All @@ -118,6 +117,10 @@ class Carousel extends BaseComponent {
this._playPauseButton = SelectorEngine.findOne(`${SELECTOR_CONTROL_PAUSE}[${SELECTOR_CAROUSEL_TO_PAUSE}="#${this._element.id}"]`) // Boosted mod

this._addEventListeners()

if (this._config.ride === CLASS_NAME_CAROUSEL) {
this.cycle()
}
}

// Getters
Expand Down Expand Up @@ -151,7 +154,7 @@ class Carousel extends BaseComponent {
this._slide(ORDER_PREV)
}

pause(event) {
pause() {
// Boosted mod: reset the animation on progress indicator
if (this._indicatorsElement) {
this._element.classList.add(CLASS_NAME_PAUSED)
Expand All @@ -168,19 +171,14 @@ class Carousel extends BaseComponent {
}
// End mod

if (!event) {
this._stayPaused = true
}

if (this._isSliding) {
triggerTransitionEnd(this._element)
this.cycle(true)
}

this._clearInterval()
}

cycle(event) {
cycle() {
// Boosted mod: restart the animation on progress indicator
if (this._indicatorsElement) {
this._element.classList.remove(CLASS_NAME_PAUSED)
Expand All @@ -197,16 +195,23 @@ class Carousel extends BaseComponent {
}
// End mod

if (!event) {
this._stayPaused = false
}

this._clearInterval()
if (this._config.interval && !this._stayPaused) {
this._updateInterval()
this._updateInterval()

this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
}

this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)
_maybeEnableCycle() {
if (!this._config.ride) {
return
}

if (this._isSliding) {
EventHandler.one(this._element, EVENT_SLID, () => this.cycle())
return
}

this.cycle()
}

to(index) {
Expand All @@ -228,8 +233,6 @@ class Carousel extends BaseComponent {

const activeIndex = this._getItemIndex(this._getActive())
if (activeIndex === index) {
this.pause()
this.cycle()
return
}

Expand Down Expand Up @@ -258,8 +261,8 @@ class Carousel extends BaseComponent {
}

if (this._config.pause === 'hover') {
EventHandler.on(this._element, EVENT_MOUSEENTER, event => this.pause(event))
EventHandler.on(this._element, EVENT_MOUSELEAVE, event => this.cycle(event))
EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())
EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())
}

if (this._config.touch && Swipe.isSupported()) {
Expand Down Expand Up @@ -290,7 +293,7 @@ class Carousel extends BaseComponent {
clearTimeout(this.touchTimeout)
}

this.touchTimeout = setTimeout(event => this.cycle(event), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)
}

const swipeConfig = {
Expand Down Expand Up @@ -436,12 +439,10 @@ class Carousel extends BaseComponent {
return
}

this._isSliding = true

const isCycling = Boolean(this._interval)
if (isCycling) {
this.pause()
}
this.pause()

this._isSliding = true

this._setActiveIndicatorElement(nextElementIndex)
this._activeElement = nextElement
Expand Down Expand Up @@ -554,12 +555,6 @@ class Carousel extends BaseComponent {
}

data[config]()
return
}

if (data._config.interval && data._config.ride) {
data.pause()
data.cycle()
}
})
}
Expand All @@ -583,15 +578,18 @@ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (e

if (slideIndex) {
carousel.to(slideIndex)
carousel._maybeEnableCycle()
return
}

if (Manipulator.getDataAttribute(this, 'slide') === 'next') {
carousel.next()
carousel._maybeEnableCycle()
return
}

carousel.prev()
carousel._maybeEnableCycle()
})

EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_CONTROL_PAUSE, Carousel.PauseCarousel) // Boosted mod
Expand Down
4 changes: 2 additions & 2 deletions js/src/dom/event-handler.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const customEvents = {
mouseenter: 'mouseover',
mouseleave: 'mouseout'
}
const customEventsRegex = /^(mouseenter|mouseleave)/i

const nativeEvents = new Set([
'click',
'dblclick',
Expand Down Expand Up @@ -150,7 +150,7 @@ function addHandler(element, originalTypeEvent, handler, delegationFunction, one

// in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
if (customEventsRegex.test(originalTypeEvent)) {
if (originalTypeEvent in customEvents) {
const wrapFunction = fn => {
return function (event) {
if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {
Expand Down
12 changes: 10 additions & 2 deletions js/src/dom/manipulator.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,15 @@ function normalizeData(value) {
return null
}

return value
if (typeof value !== 'string') {
return value
}

try {
return JSON.parse(decodeURIComponent(value))
} catch {
return value
}
}

function normalizeDataKey(key) {
Expand All @@ -44,7 +52,7 @@ const Manipulator = {
}

const attributes = {}
const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs'))
const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'))

for (const key of bsKeys) {
let pureKey = key.replace(/^bs/, '')
Expand Down
7 changes: 5 additions & 2 deletions js/src/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,11 @@ class Tab extends BaseComponent {
event.stopPropagation()// stopPropagation/preventDefault both added to support up/down keys without scrolling the page
event.preventDefault()
const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key)
const nextActiveElement = getNextActiveElement(this._getChildren(), event.target, isNext, true)
Tab.getOrCreateInstance(nextActiveElement).show()
const nextActiveElement = getNextActiveElement(this._getChildren().filter(element => !isDisabled(element)), event.target, isNext, true)

if (nextActiveElement) {
Tab.getOrCreateInstance(nextActiveElement).show()
}
}

_getChildren() { // collection of inner elements
Expand Down
8 changes: 6 additions & 2 deletions js/src/toast.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class Toast extends BaseComponent {
}

hide() {
if (!this._element.classList.contains(CLASS_NAME_SHOW)) {
if (!this.isShown()) {
return
}

Expand All @@ -123,13 +123,17 @@ class Toast extends BaseComponent {
dispose() {
this._clearTimeout()

if (this._element.classList.contains(CLASS_NAME_SHOW)) {
if (this.isShown()) {
this._element.classList.remove(CLASS_NAME_SHOW)
}

super.dispose()
}

isShown() {
return this._element.classList.contains(CLASS_NAME_SHOW)
}

// Private

_maybeScheduleHide() {
Expand Down
3 changes: 3 additions & 0 deletions js/src/util/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,11 @@ class Config {
}

_mergeConfigObj(config, element) {
const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse

return {
...this.constructor.Default,
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
...(typeof config === 'object' ? config : {})
}
Expand Down
Loading