0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-12-01 13:24:25 +01:00
Commit Graph

900 Commits

Author SHA1 Message Date
GeoSot
c376cb0763
Dropdown: fix toggle focus after dropdown is hidden using the ESC button (#35500) 2021-12-09 15:34:17 +02:00
GeoSot
4fd5539c75
ScrollBar.js. Minor refactoring and add test (#35492) 2021-12-09 15:05:50 +02:00
GeoSot
328f723008
Tooltip: remove title attribute before show & add tests (#35456) 2021-12-07 15:51:56 +02:00
GeoSot
385fea49e8 Tooltip/Popover: add underscore prefix to protected functions 2021-12-01 18:00:36 +02:00
GeoSot
bd79d69a73 Tooltip: a simple code-block position change 2021-12-01 18:00:36 +02:00
GeoSot
1f7b83203d Tooltip: simplify popper check 2021-12-01 18:00:36 +02:00
GeoSot
9b9372e8dd Tooltip: refactor _hoverState to Boolean to achieve better control 2021-12-01 18:00:36 +02:00
GeoSot
8eacbaa08b Tooltip: merge timeout functionality 2021-12-01 18:00:36 +02:00
GeoSot
c69ccba08c Tooltip: Change _enter & _leave to work without arguments 2021-12-01 18:00:36 +02:00
GeoSot
a20e4203fe Tooltip: Remove redundant config.delay check
`config.delay` is always an object after initialization
2021-12-01 18:00:36 +02:00
GeoSot
724663b3cd Tooltip: Remove Data.set usage for dynamically created tip
This is not used any further, so we were just setting it.
2021-12-01 18:00:36 +02:00
GeoSot
3baeb0a5c1 Tooltip: merge isAnimated checks 2021-12-01 18:00:36 +02:00
GeoSot
53c77c0203 Tooltip: refactor jQueryInterface 2021-12-01 18:00:36 +02:00
GeoSot
dd07c1ff9e Dropdown: clearMenus is always an event callback 2021-12-01 17:10:39 +02:00
GeoSot
f71640f048 Dropdown: Clean more 2021-12-01 17:10:39 +02:00
GeoSot
21e5618ba7 Dropdown: rename vars 2021-12-01 17:10:39 +02:00
GeoSot
0686fa00f0 Dropdown: Remove redundant Space check 2021-12-01 17:10:39 +02:00
GeoSot
a14a552d83 Dropdown: Deduplicate complex check 2021-12-01 17:10:39 +02:00
GeoSot
bff95d55af Dropdown: Remove redundant check since the show method already does it 2021-12-01 17:10:39 +02:00
GeoSot
2d32802f53 Dropdown: Change constant to the way we use it 2021-12-01 17:10:39 +02:00
GeoSot
fb5921dec4 Dropdown: Merge display='static' & isNavbar functionality activating static popper with no styles attached 2021-12-01 17:10:39 +02:00
GeoSot
137b324930 Dropdown: Remove static method used once 2021-12-01 17:10:39 +02:00
GeoSot
cab62af2e6
Fix popover arrow & tooltip template after the setContent addition (#35441) 2021-12-01 15:10:10 +02:00
GeoSot
44a6cd724c
Tooltip: remove leftover method (#35440)
Remove a leftover after #32692

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-12-01 14:53:56 +02:00
GeoSot
6f077ff7bc
Clean tooltip component unneeded functionality (#32692) 2021-11-25 20:08:11 +02:00
GeoSot
374eeecfbc
tooltip.js: use array.includes instead of for iteration (#35127) 2021-11-25 19:39:13 +02:00
GeoSot
91ad255e07 Change adjustDialog's if conditions to improve readability 2021-11-25 19:23:49 +02:00
GeoSot
0f9fd75d6c Respect modal's initial overflowY 2021-11-25 19:23:49 +02:00
GeoSot
cc3e5789ec Remove some uncovered code that seems to be unused 2021-11-25 19:23:49 +02:00
GeoSot
92e664c921 Change check for dynamic modal 2021-11-25 19:23:49 +02:00
GeoSot
fc33ce4b46 Tweak methods
Name them to be more descriptive and have agnostic functionality
2021-11-25 19:23:49 +02:00
GeoSot
79e01c3bad Some refactoring on modal, to improve readability and generic functionality 2021-11-25 19:23:49 +02:00
GeoSot
94a596fbcb
Add a template factory helper to handle all template cases (#34519)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-11-25 19:14:02 +02:00
GeoSot
9640e2d5dd Change the way collapse handles its children on opening 2021-10-13 16:38:27 +03:00
GeoSot
1eea132866 collapse: extract duplicate code to a function 2021-10-13 16:38:27 +03:00
XhmikosR
e8f702666f
JS: minor refactoring (#35183)
* add missing comments
* shorten block comments
* reorder constants
* reorder public/private methods
* sort exports alphabetically in util/index.js
* fix a couple of typos
2021-10-13 15:19:28 +03:00
GeoSot
db44392bda
Swipe: add test to ensure that it ignores pinch events (#35161) 2021-10-12 15:48:19 +03:00
GeoSot
8ec6c94522
Extract Carousel's swipe functionality to a separate Class (#32999) 2021-10-11 17:04:43 +03:00
XhmikosR
24e3ca2474
tooltip.js: ignore a LGTM error (#35147)
The code on this line is either sanitized or the user chose to not sanitize it.
2021-10-10 14:49:41 +03:00
XhmikosR
c44d64ed71 Merge remote-tracking branch 'remotes/origin/v513' 2021-10-09 18:28:28 +03:00
XhmikosR
1a6fdfae6b Bump version to 5.1.3. 2021-10-09 09:43:19 +03:00
XhmikosR
eb0f705621
scrollspy.js: chain functions (#35139) 2021-10-08 12:28:05 +03:00
XhmikosR
64e13162fa
Sanitizer: fix logic and add a test. (#35133)
This was broken in 2596c97 inadvertently.
Added a test so that we don't hit this in the future.
2021-10-07 17:48:36 +03:00
XhmikosR
2596c97034
util/sanitizer.js: use Array.every() (#35120) 2021-10-06 00:23:14 +03:00
XhmikosR
3afe4b8c7d Enable unicorn/numeric-separators-style rule.
This is taken care of by babel via @babel/plugin-proposal-numeric-separator
2021-10-05 19:52:11 +03:00
XhmikosR
567a41347e Fix a unicorn/no-array-callback-reference issue 2021-10-05 19:52:11 +03:00
XhmikosR
666fe596bf Enable unicorn/no-array-for-each rule 2021-10-05 19:52:11 +03:00
XhmikosR
2b4d0d166b Enable unicorn/no-for-loop rule 2021-10-05 19:52:11 +03:00
XhmikosR
9f1579aa04 Enable unicorn/prefer-prototype-methods rule 2021-10-05 19:52:11 +03:00
XhmikosR
5ecef8ac01
Release v5.1.2 (#35114) 2021-10-05 18:50:18 +03:00
XhmikosR
759fc89f4b
sanitizer: add sms in the SAFE_URL_PATTERN (#35074) 2021-09-29 07:41:06 +03:00
GeoSot
bdfb4cc54d
Fix Collapse regression of handling toggling between sibling chilldren (#34951) 2021-09-15 15:33:19 +03:00
XhmikosR
8f2e678424
Minor refactoring (#34980)
Rename variables and remove a temporary one
2021-09-15 14:34:24 +03:00
XhmikosR
c5d03d93fc
Rename e to event (#34979) 2021-09-15 14:27:46 +03:00
Julien Déramond
499485589f
Remove remaining "master" branch references (#34932) 2021-09-08 17:58:50 +03:00
XhmikosR
0d81d3cbc1
Release v5.1.1 (#34869)
* Prepare v5.1.1.

* Dist
2021-09-07 18:37:44 +03:00
GeoSot
51afe026ca
Fix tooltip data-bs-original-title issue (#34842) 2021-08-31 16:11:22 +03:00
XhmikosR
4a4b61f082 Update eslint-plugin-unicorn to v35.0.0 2021-08-30 15:51:44 +03:00
GeoSot
c1fc1dbbee
Collapse on toggle, should not hide descendant tabpanels (#34835) 2021-08-30 15:29:02 +03:00
Sébastien ALFAIATE
91295c2187
alert.js: Add missing newline (#34785) 2021-08-20 18:30:08 +03:00
GeoSot
1e5e655670
Fix modal when is triggered by bs-toggle, to hide other open instances (#34701) 2021-08-10 17:55:34 +03:00
XhmikosR
418fe8113e
carousel: move common checks to a function (#34621) 2021-08-10 17:50:32 +03:00
XhmikosR
f20fece3a8
Prepare v5.1.0. (#34674) 2021-08-04 18:41:51 +03:00
GeoSot
a6a2d1e2df
Regression on tooltip template creation process. (#34628)
* Regression on tooltip template creation process.

* check if template content does not exist, or given argument is empty

* call `setContent()` once.
2021-08-03 11:59:33 +03:00
XhmikosR
742269a734
tooltip: move repeated strings to constants (#34619) 2021-07-30 00:32:07 +02:00
XhmikosR
6d707f4801
Enable a few eslint-config-xo rules (#34620)
* unicorn/prefer-dom-node-append
* unicorn/prefer-dom-node-remove
2021-07-30 00:23:00 +02:00
GeoSot
2bf32ad180 transfer interface inside jQueryInterface 2021-07-29 16:30:02 +03:00
GeoSot
e5b606d242 simplify initialization on data-toggle click 2021-07-29 16:30:02 +03:00
GeoSot
6f17e634ce keep parent only as element 2021-07-29 16:30:02 +03:00
GeoSot
4c1f7bb051 remove duplicated Selector.find 2021-07-29 16:30:02 +03:00
GeoSot
7a71703fd3 Simplify check for children 2021-07-29 16:30:02 +03:00
GeoSot
8fc4f3aaf3 initialize variable properly 2021-07-29 16:30:02 +03:00
GeoSot
1947ca033e Refactor internal function to use it in more cases.
Also, remove a few redundant checks since we already check for it in `_addAriaAndCollapsedClass()`.
2021-07-29 16:30:02 +03:00
GeoSot
5882d5dbe8 Add a helper function to check for showing
Also, remove the `isTransitioning()` helper.
2021-07-29 16:30:02 +03:00
GeoSot
4961ad0c63 Remove redundant check on data-toggle click.
Previously, it was assumed that the trigger element would have its own separate config than the collapse element itself.
2021-07-29 16:30:02 +03:00
GeoSot
2ad0a4a9fd streamline _getConfig & interface 2021-07-29 16:30:02 +03:00
GeoSot
4bfd8a2cbc
Use a streamlined way to trigger component dismiss (#34170)
* use a streamlined way to trigger component dismiss

* add documentation

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-28 17:39:32 +03:00
alpadev
047145e808
Fix Manipulator.offset() (#33603)
* test: add more test cases for Manipulator.offset()

* fix: Manipulator.offset() is using obsolete properties to get scroll position

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: GeoSot <geo.sotis@gmail.com>
2021-07-28 17:23:32 +03:00
Ryan Berliner
7646f6bd33
Add shift-tab keyboard support for dialogs (modal & Offcanvas components) (#33865)
* consolidate dialog focus trap logic

* add shift-tab support to focustrap

* remove redundant null check of trap element

Co-authored-by: GeoSot <geo.sotis@gmail.com>

* remove area support forom focusableChildren

* fix no expectations warning in focustrap tests

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-27 08:01:04 +03:00
GeoSot
41292a5257
Toasts: Change showing timings and classes to keep toast display:none by default (#33610) 2021-07-22 18:13:13 +03:00
GeoSot
e85a6ed77c make dataApiKeydownHandler to handle specific instance, avoiding extra manipulations 2021-07-22 17:54:48 +03:00
GeoSot
9916191311 extract createPopper method 2021-07-22 17:54:48 +03:00
GeoSot
b1dad0943f handle click event in one place, remove undocumented click listener on element in case of not having the proper markup 2021-07-22 17:54:48 +03:00
GeoSot
d01a08547d use classList add instead of toggle on show 2021-07-22 17:54:48 +03:00
GeoSot
d130b00cad simplify toggle 2021-07-22 17:54:48 +03:00
GeoSot
3533e2d637 Merge dropdownInterface to jQueryInterface 2021-07-22 17:54:48 +03:00
GeoSot
d3c6f25fd0 Add isShown method and reuse it 2021-07-22 17:54:48 +03:00
GeoSot
da2db218ed Use on private method to set content & cleanup template 2021-07-22 17:20:38 +03:00
GeoSot
9c3ceaa25b popover: Move common code in tooltip's getTipElement() 2021-07-22 17:20:38 +03:00
GeoSot
a97fd1cd24 use one private method to resolve string or function 2021-07-22 17:20:38 +03:00
GeoSot
3716603dbc Use getOrCreateInstance on _initializeOnDelegatedTarget 2021-07-22 17:20:38 +03:00
GeoSot
92c7056619 _getDelegateConfig(): add a comment and remove an unneeded config check 2021-07-22 17:20:38 +03:00
GeoSot
c4e189df40 use a class private getter to decouple same methods usage 2021-07-22 17:20:38 +03:00
Ryan Berliner
119cfc3dfe
Remove whitespace at beginning of util/index.js (#34545) 2021-07-21 07:49:55 +03:00
GeoSot
5541179b38
Fix Util.reflow function and add documentation (#34543)
* add documentation to reflow function

* refactor to void as it should be

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-20 17:20:43 +03:00
GeoSot
dfafb9a60c
modal: change data-dismiss so that it can be outside of a modal using bs-target (#33403)
* change data-dismiss, so can be outside modal, using a bs-target

* Update site/content/docs/5.0/components/modal.md

Co-authored-by: Gaël Poupard <ffoodd@users.noreply.github.com>
2021-07-19 16:56:05 +03:00
GeoSot
e45b25e08e
util.js: remove Selector.findOne() dependency (#34441)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-07-14 09:08:10 +03:00
Mark Otto
359ed099e5 Add horizontal collapse support 2021-07-05 17:22:29 -10:00
Jeremy Jackson
d314466a4d
Accept argument of different types in the getInstance method (#34333) 2021-06-29 17:45:45 +03:00
GeoSot
70dd7f6ff5
Changes to Alert component to match the others (#33402)
Alert.js: Refactor code to match the other components
* Use this._element
* Remove handleDismiss method and keep its functionality on event
* Change JqueryInterface to be more generic
* Correct docs to be aligned with code, and add undocumented functionality
* Update alerts.md

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-28 16:34:47 +03:00
Mark Otto
45d26de728 Variablize backdrop for modal and offcanvas 2021-06-25 13:41:15 -07:00
GeoSot
f94f497ad5 ScrollSpy: Make Proper use of the SelectorEngine
* avoid extra work, creating ids
* simplify selectors and constrain search inside `config.target`
2021-06-22 19:50:21 -07:00
XhmikosR
688bce4fa6
Release v5.0.2 (#34276)
* Bump version to v5.0.2.

* Dist
2021-06-22 21:29:16 +03:00
alpadev
4927388197
Register only one DOMContentLoaded event listener in onDOMContentLoaded (#34158)
* refactor: reuse one DOMContentLoaded event listener in onDOMContentLoaded function

Instead of adding an event listener everytime the utility function is called, cache the callbacks and execute them all at once.

* refactor: drop iife for onDOMContentLoaded

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-22 20:19:55 +03:00
alpadev
290b9ee2cd
fix(carousel): arrow keys break animation if carousel sliding (#34307) 2021-06-22 13:11:03 +03:00
alpadev
d62ba935ef
Fix carousel buttons (#34266)
* test(carousel): add test to check if next/prev button work as intended

* fix(carousel): merge passed config with instance config in carouselInterface
2021-06-16 07:48:23 +03:00
GeoSot
cb47b8c964
Refactor scrollbar.js to be used as a Class (#33947) 2021-06-06 09:26:36 +03:00
GeoSot
c98657b830
Add getOrCreateInstance method in base-component (#33276)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-06-03 18:53:27 +03:00
alpadev
4a5029ea29
Fix handling of transitionend events dispatched by nested elements(#33845)
Fix handling of transitionend events dispatched by nested elements
Properly handle events from nested elements

Change `emulateTransitionEnd` to `executeAfterTransition` &&
2021-06-03 14:44:16 +03:00
Ryan Weaver
0cb70e214f
Changing Backdrop rootElement to default to a string (#34092)
The current config can cause the "body" to become stale. Specifically,
if the entire body element is swapped out for a new body element, then
the backdrop will continue to append itself to the original body element,
since it's stored in memory as a reference on this object.

This also no longer allows an explicit null to be passed to Backdrop's rootElement

This still accomplishes the laziness of "not finding the rootElement
until the Backdrop is created" to avoid problems of the JavaScript
being included inside <head> (so, before body is available).
2021-05-31 12:35:59 +03:00
GeoSot
544d9ac3cf
Change element.parentNode.removeChild(element) to element.remove() (#34071) 2021-05-25 18:30:38 +03:00
alpadev
b513a19003
Fix prevented show event disables modals with fade class from being displayed again (#34085)
Fix modal, in case is faded, a prevented show event can cause show method to not  be executed again.
2021-05-24 18:52:36 +03:00
alpadev
b39b665072
Automatically select an item in the dropdown when using arrow keys (#34052) 2021-05-22 10:58:52 +03:00
Ryan Weaver
a2b5901efc
Fix bug where backdrop calls method on null if it is already removed from the body (#34014)
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-05-22 01:16:05 +03:00
Ryan Berliner
4ac711b5b4
Refactor isVisible helper, fixing false positives from deep nesting or alternate means (#33960) 2021-05-20 16:50:53 +03:00
GeoSot
79c3bf47bc
Add Tests on scrollbar.js & better handling if a style property doesn't exists (#33948)
* scrollbar.js:
add some tests
transfer test from modal.spec. to scrollbar.spec
proper handling if style property doesn't exist
2021-05-20 16:29:04 +03:00
GeoSot
9e4f87ae8f
Allow use of dispose/hide methods on Tooltip & Popover from jQueryInterface, when component does not exists. (#33371) 2021-05-20 16:16:55 +03:00
GeoSot
df72a21fa8
Add getNextActiveElement helper function to utils, replacing custom implementation through components (#33608) 2021-05-19 01:23:52 +03:00
GeoSot
2757fbe28e
Reset inside a Dialog does not work if data-dismiss="modal" is set (#33928) 2021-05-18 09:26:22 +03:00
Rohit Sharma
153cf3a235
Don't add empty content holder when there is no content available (#33982)
* Remove content holder when there is no content

* Add tests to check the removal of header/content

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-05-18 09:02:39 +03:00
XhmikosR
58b1be927f
Release v5.0.1 (#33972)
* Bump version to 5.0.1.

* Dist
2021-05-13 19:22:20 +03:00
GeoSot
6e1c9096f0
Move get element functionality to a helper (#33327)
Looking around on js components I found out many checks, different expressed but with same purpose.
Some of them are trying to parse string to element, others, jQuery element to js simple nodeElement etc

With this Pr, I am trying to give a standard way to parse an element

So this pr:

* Creates `getElement` helper that tries to parse an argument to element or null
* Changes `isElement` to make  explicit checks and return Boolean 
* fixes tests deficiencies
2021-05-13 18:17:20 +03:00
GeoSot
9a9e22475c
Popover/Tooltip: streamline config property to start with underscore (#33381) 2021-05-12 12:15:59 +03:00
GeoSot
9fe36edf68
Extract static DATA_KEY & EVENT_KEY to base-component (#33635)
* Force each plugin that extends base-components to implement a static method `NAME()`
* Remove redundant `NAME` argument from 'Utils.defineJQueryPlugin' & fix test
2021-05-11 10:49:30 +03:00
alpadev
7647b8fe5b
Fix: Click on input outside of dropdown-menu prevents dropdown from closing (#33920)
* test: add test if user clicks on input not contained within dropdown-menu

* fix: click on inputs that are not contained within dropdown-menu prevent dropdown from closing
2021-05-11 09:09:00 +03:00
GeoSot
03842b5f25
Refactor: move disposing properties into the base class (#33740)
Moves more functionality to `base-component`, transferring the responsibility of disposal to parent class.
Each component, dusting disposal, sets its protected properties to `null`. So the same can be done in one place for all children components .
2021-05-11 09:04:42 +03:00
Ryan Berliner
9c3ab6557e
Prevent toast autohiding if focusing or hovering (#33221) 2021-05-11 08:37:57 +03:00
GeoSot
90b1a6907e Merge js-components 'transitionend' listener callbacks into one method 2021-05-10 13:59:55 -07:00
Nagarjun Bodduna
741fa589d0
Fix backdrop rootElement not initialized in Modal (#33853)
* Initialize default value of rootElement before using

* Remove redundant test | put rootElement tests together

Co-authored-by: GeoSot <geo.sotis@gmail.com>
2021-05-10 21:17:53 +03:00
XhmikosR
bf09367486
Release v5.0.0 (#33647)
* Bump version to 5.0.0

* Fix npm tag

* Dist
2021-05-05 22:32:12 +03:00
GeoSot
d381820d16
Scrollbar: respect the initial body overflow value (#33706)
* add method to handle overflow on body element & tests
* replace duplicated code on modal/offcanvas tests
2021-04-25 06:50:16 +03:00
Carson Sievert
2cbb0a941c
Dropdown: support .dropdown-item wrapped in <li> tags (#33634)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-21 08:30:19 +03:00
GeoSot
079f2cd90c
Offcanvas.js: If scroll is allowed, should allow focus on other elements (#33677) 2021-04-20 08:32:52 +03:00
GeoSot
0bbe45cd97
Tab.js: Fixes on click handling (#33586)
* use prevent default only if triggered by anchor
* disable auto-initialization if trigger is disabled
2021-04-20 08:26:58 +03:00
Rohit Sharma
b59b75bc55
Dropdown — Add option to make the dropdown menu clickable (#33389) 2021-04-20 08:19:57 +03:00
Rohit Sharma
a22f4d3cfd
Don't change the value for altBoundary option (#33684)
- Since bootstrap is not changing the default value of `elementContext`
  option, changing the value of `altBoundary` option is not needed for
any modifier in real

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-19 19:58:45 +03:00
alpadev
d67121db28
Fix regression for handling mouseenter/mouseleave events introduced by #33310 (#33679)
* test: update spec for sibling adjacent mouseenter/mouseleave events

there is a regression introduced by #33310 - this would have catched that

* fix: fixup regression for mouseenter/mouseleave events introduced by #33310

the old logic only worked for parent-child movement since it checked for the relatedTarget to contain the delegateTarget - this should be fixed with this

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-04-19 08:30:33 +03:00
GeoSot
a9d7a62658
Use the backdrop util in offcanvas, enforcing consistency (#33545)
* respect /share modal's backdrop functionality, keeping consistency
* listen click events over backdrop (only) and trigger `hide()` without add/remove event tricks
* achieve to hide foreign open offcanvas instances without glitches `if (allReadyOpen && allReadyOpen !== target)`, in case another is going to be open, when user clicks on trigger button
2021-04-19 08:20:25 +03:00
alpadev
6d312b37c2
fix: clicking an item in navbar dropdown collapses the dropdown in firefox (#33643) 2021-04-18 09:01:23 +03:00
Rohit Sharma
7eadf73f03 Change toggle method to remove
Since the class `.show` must be removed
2021-04-18 08:47:50 +03:00
Rohit Sharma
bce4684d34 Use context properties 2021-04-18 08:47:50 +03:00
Rohit Sharma
38a79ec64c Refactor dropdown's hide functionality 2021-04-18 08:47:50 +03:00
Carson Sievert
69f5c0130b
Fix v5 regressions in tab dropdown functionality (#33626)
Scope selector to `dropdownElement` when adding active classes
2021-04-15 13:53:55 +03:00
GeoSot
80085a12f6
Decouple BackDrop from modal (#32439)
* Create backdrop.js util

* revert breaking changes

remove PromiseTimout usage

revert class name

* one more test | change bundlewatch.config

* add config obj to backdrop helper | tests for rootElement | use transitionend helper

* Minor tweaks — Renaming

Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-04-14 13:28:50 -07:00
alpadev
db32b2380c
fix: make EventHandler better handle mouseenter/mouseleave events (#33310)
* fix: make EventHandler better handle mouseenter/mouseleave events

* refactor: simplify custom events regex and move it to a variable
2021-04-13 06:25:58 +03:00
alpadev
ad10f00d5e
refactor: make static selectMenuItem method private (#33589) 2021-04-11 18:34:46 +03:00
GeoSot
566451230f
Remove element event listeners through base component (#33429)
After some research, I found out that EventHandler saves all the custom events per element using namespace, and is capable of removing handlers using only the element and its namespace (`DATA_KEY`).

So, probably is better to utilize the base-component to do the same job.
2021-04-11 09:54:48 +03:00
Rohit Sharma
5f946d3a86 Dropdown — Don't use event delegation 2021-04-11 09:42:52 +03:00
Rohit Sharma
b2bc159d72 Use cached noop function everywhere 2021-04-11 09:42:52 +03:00
GeoSot
7b7f4a5ced
Decouple Modal's scrollbar functionality (#33245) 2021-04-11 09:37:59 +03:00
GeoSot
0795a778f2
Fix wrong carousel transformation, direction to order (#33499) 2021-04-07 08:29:31 +03:00
GeoSot
317c2cd08e Omit getting data-attributes from toggle element 2021-04-06 18:43:43 +03:00
GeoSot
752b001b0a Simplify Modal config 2021-04-06 18:43:43 +03:00
GeoSot
0b34ff2fae
Simplify ScrollSpy config (#33250) 2021-04-06 18:28:10 +03:00
Rohit Sharma
20cfbdff79
Add missing things in hide method of dropdown (#33451)
* Update `aria-expanded` attribute in `hide` method

* Remove empty mouseover listeners added for iOS
2021-04-01 21:51:55 +03:00
alpadev
f36f834453
Fix dropdown escape propagation (#33479) 2021-04-01 21:44:04 +03:00
Rohit Sharma
5cc53a0ef0
Use template literals instead of concatenation (#33497) 2021-03-30 08:57:05 +03:00
GeoSot
8c3e6ebc6e
Use our isDisabled util on dropdown (#33456) 2021-03-30 07:42:23 +03:00
XhmikosR
220139a89f
Release v5.0.0-beta3 (#33439) 2021-03-23 18:26:54 +02:00
Casey Holzer
16bc47da3c Allow data-toggle="dropdown" and form click events to bubble
* remove stopPropagation from button click event

* test for delegated click events

* ensure button children can open menu

* test to ensure clicking button opens the menu

* check current element and parents

* allow dropdown form click events to bubble
2021-03-23 15:56:28 +02:00
dependabot[bot]
9667438c1e
Bump eslint-plugin-unicorn from 28.0.2 to 29.0.0 (#33435)
* Bump eslint-plugin-unicorn from 28.0.2 to 29.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 28.0.2 to 29.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v28.0.2...v29.0.0)

Signed-off-by: dependabot[bot] <support@github.com>

* Fix lint failure

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-23 15:27:46 +02:00
GeoSot
1c02ef4f97
Allow offcanvas to be initialized in open state (#33382)
* Update docs to use new .show behavior and clarify some copy for first example

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-23 08:22:59 +02:00
Patrick H. Lauke
3ce0a8d3ec
Dynamic tab should not show when triggered on disabled element (#33257)
* show() should bail if the trigger has `disabled` attribute

* use 'isDisabled' helper

Co-authored-by: GeoSot <geo.sotis@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 10:52:40 +02:00
GeoSot
b9f30903a5
Fix carousel RTL and refactor code, fix rtl swipe issues (#32913)
* move common code to reusable functions

* add/re-factor tests, directionToOrder func

* add _orderToDirection tests

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-17 07:58:43 +02:00
GeoSot
c5083d5fc3
Use more safe check for 'isDisabled' helper (#33385) 2021-03-17 07:44:15 +02:00
GeoSot
ddf72bc612
Accept data-bs-body option in the configuration object as well (#33248)
* Accept data-bs-body option in the configuration object as well

Tweak jqueryInterface, add some more tests

* Fix Markdown table formatting and tweak the wording on backdrop

Co-authored-by: Mark Otto <markdotto@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-03-16 18:35:03 +02:00
Ryan Berliner
99b2c0b390 only trigger tooltip inserted event on true dom insert 2021-03-16 07:48:50 +02:00
Ryan Berliner
72d2313579 reuse existing popper on show during tooltip fadeout 2021-03-16 07:48:50 +02:00
Ryan Berliner
6ef70b342c prevent quick interactions from misplacing tooltips 2021-03-16 07:48:50 +02:00
Ryan Berliner
d491c29aa0 prevent tooltip from being deleted on quick re-activations 2021-03-16 07:48:50 +02:00
Rohit Sharma
6ecd1c626e
Change the name of the Offcanvas constructor (#33261) 2021-03-16 07:21:04 +02:00
GeoSot
e163d98845
modal: move common code to a new isAnimated method (#33056) 2021-03-08 18:35:59 +02:00
GeoSot
548be2ed66
Offcanvas as component (#29017)
* Add a new offcanvas component

* offcanvas.js: switch to string constants and `event.key`

* Remove unneeded code

* Sass optimizations

* Fixes

Make sure the element is hidden and not offscreen when inactive
fix close icon negative margins
Add content in right & bottom examples
Re-fix bottom offcanvas height not to cover all viewport

* Wording tweaks

* update tests and offcanvas class

* separate scrollbar functionality and use it in offcanvas

* Update .bundlewatch.config.json

* fix focus

* update btn-close / fix focus on close

* add aria-modal and role
return focus on trigger when offcanvas is closed
change body scrolling timings

* move common code to reusable functions

* add aria-labelledby

* Replace lorem ipsum text

* fix focus when offcanvas is closed

* updates

* revert modal, add tests for scrollbar

* show backdrop by default

* Update offcanvas.md

* Update offcanvas CSS to better match modals

- Add background-clip for borders
- Move from outline to border (less clever, more consistent)
- Add scss-docs in vars

* Revamp offcanvas docs

- Add static example to show and explain the components
- Split live examples and rename them
- Simplify example content
- Expand docs notes elsewhere
- Add sass docs

* Add .offcanvas-title instead of .modal-title

* Rename offcanvas example to offcanvas-navbar to reflect it's purpose

* labelledby references title and not header

* Add default shadow to offcanvas

* enable offcanvas-body to fill all the remaining wrapper area

* Be more descriptive, on Accessibility area

* remove redundant classes

* ensure in case of an already open offcanvas, not to open another one

* bring back backdrop|scroll combinations

* bring back toggling class

* refactor scrollbar method, plus tests

* add check if element is not full-width, according to #30621

* revert all in modal

* use documentElement innerWidth

* Rename classes to -start and -end

Also copyedit some docs wording

* omit some things on scrollbar

* PASS BrowserStack tests

-- IOS devices, Android devices and Browsers on Mac, hide scrollbar by default and appear it, only while scrolling.

* Rename '_handleClosing' to '_addEventListeners'

* change pipe usage to comma

* change Data.getData to Data.get

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Martijn Cuppens <martijn.cuppens@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-03-02 19:10:10 +02:00
Rohit Sharma
b9e51dc3c4
Dropdown — Drop flip option (#33198) 2021-03-02 17:27:13 +02:00
alpadev
48a95f7280
refactor: use a Map instead of an Object in dom/data (#32180)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-03-02 16:55:44 +02:00
Muhammadamin
056216a3bd
modal: don't add margin & padding when sticky is not full width (#30621)
* modal: don't add margin & padding when sticky is not full width

* Check if element is shorter than window

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-23 14:52:09 +02:00
Rohit Sharma
dc5e3328c1
Allow constructors to accept a CSS selector (#32245)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <otto@github.com>
2021-02-22 09:01:04 +02:00
Nikon the Third
e8f08d1802
Adjust regex SAFE_URL_PATTERN for use with test method of regexes. (#33136)
The test method on regexes behaves different than the match method on strings in the presence of the global modifier.
Add a unit test for sanitizing the same template twice.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-19 10:24:53 +02:00
nlipka
536c53c16c add some space 2021-02-18 08:19:15 -08:00
XhmikosR
92434fa30f
util: change isRTL to a function (#32446)
This allows the bundler to tree-shake the function.
2021-02-16 10:14:05 +02:00
Kyle Tsang
02dbd87ffa
Fix event handler removal in dropdown/carousel dispose (#33000)
* Fix event handler removal in carousel dispose

* Fix event handler removal in dropdown dispose

* Test event handlers in scrollspy dispose

* Test event handlers in toast dispose

* Test event handlers in tooltip dispose

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-12 07:51:34 +02:00
XhmikosR
e50c11b8c6
Release v5.0.0-beta2 (#32467)
* Bump version to 5.0.0-beta2

* Dist
2021-02-10 18:14:51 +02:00
Rohit Sharma
f7088e5d28
Add function type for popperConfig option (#32882)
* Add function type for `popperConfig` option

* Update .bundlewatch.config.json

* copy edits

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
Co-authored-by: Mark Otto <markdotto@gmail.com>
2021-02-09 21:16:13 +02:00
Rohit Sharma
29e0c9dfa1
Dropdown — Change the selector to check the use of Popper (#33003)
* Create the popper instance first

Make sure that popper instance has been created first and then apply the
styling on the dropdown(menu)

* Use `data-bs-popper` attibute to check popper

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-09 21:04:23 +02:00
Mark Otto
8f1c882545 Remove .dropdown-menu[style] reset and adjust .dropdown-menu-* modifiers
- Removes the &[style] selector that was used for resetting Popper styles
- Separate Popper-based alignment from static alignment with `data-bs-popover` attribute that separates the --bs-position and custom right/left properties

Co-Authored-By: Rohit Sharma <rohit2sharma95@gmail.com>
2021-02-09 14:34:27 +02:00
Rohit Sharma
0eaa6c05cf
Remove custom fallbackPlacements from dropdown (#32843) 2021-02-09 07:55:17 +02:00
Kyle Tsang
d63a922436
Fix Popper preventOverflow boundary config (#32845)
Currently, the boundary config is being assigned to the wrong var (`rootBoundary`) in the popper config.  It should be assigned to the `boundary` var in popper's config.

Ref: https://popper.js.org/docs/v2/utils/detect-overflow/#boundary
2021-02-04 06:55:25 +02:00
Siju Samson
b376a3d80d
Fix dropdown keys to open menu (#32750)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 22:03:21 +02:00
Florian Vick
2a9d72133d
Prevent getSelector from returning URLs as selector (#32586)
* added checks to getSelector in util to prevent returning hrefs that are invalid selectors

* restored compatibility for the class selector and added test cases for keeping urls from being returned as a selector

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:58:54 +02:00
Rohit Sharma
3770b7b9e3
Dropdown — Emit events on the .dropdown-toggle button (#32625)
* Emit events on the dropdown button

Emit the events on `.dropdown-toggle` button and then bubble up

* Add migration note for events

* Update the docs for events

* Add unit test to check the event bubbling

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:51:19 +02:00
Rohit Sharma
217d84d6b2
Remove the initial margin from dropdown/popover in favor of Popper (#32524)
* Remove the margin from dropdown in favor of Popper

- Set the default margin to 0 for dropdowns (To remove the Popper's  warning)
- Set the required offset in dropdown's defaults

* Remove the margin from the popover component

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-03 21:37:25 +02:00
Rohit Sharma
e79c8f3489 Just find the active indicator 2021-01-28 23:32:24 +02:00
Patrick H. Lauke
a882614c45 Make carousel indicators actual buttons 2021-01-28 23:32:24 +02:00
Rohit Sharma
b1bd54955e Restore offset option for tooltip/popover components 2021-01-28 12:23:33 +02:00
joke2k
881f43a3b9 Restore offset option for dropdown component 2021-01-28 12:23:33 +02:00
GeoSot
5d7b51e1d0
Tooltip refactoring (#32523)
* tooltip: move common code to a reusable function

* tooltip: return early in `show()`

Co-authored-by: Rohit Sharma <rohit2sharma95@gmail.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-27 19:01:24 +02:00
GeoSot
b5bf3131fb
modal: move common code to reusable functions (#32511)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-14 21:22:09 +02:00
dependabot[bot]
1b46601ce8
Bump eslint-plugin-unicorn from 25.0.1 to 26.0.1 (#32784)
* Bump eslint-plugin-unicorn from 25.0.1 to 26.0.1

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 25.0.1 to 26.0.1.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v25.0.1...v26.0.1)

Signed-off-by: dependabot[bot] <support@github.com>

* Updates for `eslint-plugin-unicorn@26.0.1`

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-14 00:29:26 +02:00
Rohit Sharma
c9cd741aff
Throw a TypeError instead of the generic Error (#32585)
* Change from Error to TypeError

* Convert the `NAME` to upper case to make the consistency in the error message

* Update the remaining tests to be stricter

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 22:13:30 +02:00
Rohit Sharma
e34481b6eb
Fix toggling modal when clicking on data-bs-toggle="modal" (#32691)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-13 21:59:47 +02:00