0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00
Commit Graph

2033 Commits

Author SHA1 Message Date
XhmikosR
2732a60ecd
@rollup/plugin-replace: specify preventAssignment: true (#33329)
This is to fix a warning since the option will be set to true in the next major version of the plugin
2021-03-10 18:47:42 +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
XhmikosR
730566221f
visual tests: add missing base-component dist file (#33167)
Regression of #32313
2021-02-22 08:42:43 +02:00
Patrick H. Lauke
5693f1ad86
Fix small typos / follow-up to #32630 (#33164) 2021-02-21 08:00:03 +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
324107f3af
Simplify karma.conf.js (#33045)
`customLaunchers` does not seem to be needed.
2021-02-16 12:18:06 +02: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
GeoSot
3602828a90
Add tests for DATA_KEY (#33090)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-16 08:58:08 +02:00
Rohit Sharma
6b6db4fd8a
Add the missing expectations for touch events (#33060) 2021-02-12 08:36:20 +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
Mark Otto
037b5df737
Revert dist changes from #32747 (#33050) 2021-02-11 17:22:18 +02:00
Mark Otto
4c7a3e8adf
Add Sass docs (variables, mixins, and loops) to most pages (#32747)
* WIP: Mention variables, mixins, and loops in docs

* Add Sass sections to component pages

* add sass docs for forms and content

* Update buttons.md

* Remove empty mixins sections

* Massive update to utilities and some consistency changes

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-02-10 19:29:59 -08: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
Patrick H. Lauke
96be06e32b
Dynamic tabs: use buttons rather than links (#32630)
* Dynamic tabs: use buttons rather than links

- change docs
- add mention that tabs should be <button> elements
- tweak styles to neutralise border and background

* Update js unit and visual test accordingly

- replace links with buttons
- make one specific test that uses links instead of buttons, as we still want to support it despite it being non-semantically appropriate
- Leaving a couple of tests for now. The test for removed tabs should be redone so that tabs are removed programmatically (as the approach of having that close button inside the link is invalid and broken markup). The test for dropdowns should be removed together we actually ripping out the handling for dropdowns in the tab.js code (arguably a breaking change, though we discouraged this for a few versions and effectively "deprecated" it)

* Add isolation:isolate to prevent focus being overlapped

https://github.com/twbs/bootstrap/pull/32630#issuecomment-756015766
2021-02-09 07:23:45 +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
XhmikosR
a56bf1de9f
Minor ESLint rules cleanup (#32904) 2021-01-28 11:34:20 +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
Patrick H. Lauke
3aa3fda730
Carousel: use buttons, not links, for prev/next controls (#32627)
* Carousel: use buttons, not links, for prev/next

- expand the styles to neutralise border/background
- change docs page
- add extra unit test to check that links or buttons work as controls
- modify visual test to use buttons as well
- use buttons instead of links for prev/next
- remove `role="button"` from links that are actually links

* Clarify that controls can be button or link

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

Co-authored-by: Mark Otto <markd.otto@gmail.com>

* Explicitly set padding to 0 to prevent dipping/moving on active in Firefox

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-27 17:31:16 +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
XhmikosR
cad88abdb0
JS: update karma config (#32769)
* rename constants
* enforce the constants to be Boolean
* fix karma `logLevel`
2021-01-13 19:16:51 +02:00
Théophile Helleboid - chtitux
80557b3ac0
Move "active" class from .nav-item to .nav-link (#32730) 2021-01-08 20:53:04 +02:00
Rohit Sharma
3c934ddcef
Scrollspy - Remove unnecessary event argument (#32603)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2021-01-07 09:34:08 +02:00
Daniele Faraglia
59cd71631e
collapse: prevent url change if A nested tag is clicked (#32438)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:37:35 +02:00
Nils K
2d46e47464
Support Popper virtual elements (#32376)
Adds the ability to use objects implementing the virtual element interface as the value for the reference option of a dropdown config.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-21 14:32:11 +02:00
Gaël Poupard
58ab1c2cd5
test(carousel): french word in the wild (#32528) 2020-12-18 17:22:16 +02:00
dependabot[bot]
66f323af70
Bump eslint-plugin-unicorn from 23.0.0 to 24.0.0 (#32516)
* Bump eslint-plugin-unicorn from 23.0.0 to 24.0.0

Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 23.0.0 to 24.0.0.
- [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases)
- [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v23.0.0...v24.0.0)

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

* Update karma.conf.js

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-18 15:11:07 +02:00
Rohit Sharma
f12657b39f
tests: replace deprecated jQuery method (#32309)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-16 17:21:43 +02:00
XhmikosR
29e4eb91c1
BrowserStack: test on macOS Catalina instead of High Sierra (#32486) 2020-12-16 12:45:48 +02:00
Rohit Sharma
042a4a255f
Tooltip/popover - change the default value for fallbackPlacements (#32437)
The default Popper `fallbackPlacements` value is `[oppositePlacement]`.

- The default value was previously (in v4) `'flip'` that can be achieved by passing the single value in the array, like — `[oppositePlacement]`. Keeping `null` also sets the `fallbackPlacements` to `[oppositePlacement]` (Default value in Popper)
- It's better to have **clockwise** (`['top', 'right', 'bottom', 'left']`) fallback options so that tooltip/popover can be placed to another side even if the opposite placement doesn't fit.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-14 20:51:14 +02:00
Rohit Sharma
ebce95dc60
Tooltip - Add missing callback in async spec (#32465) 2020-12-14 13:02:34 +02:00
Gaël Poupard
b85ca045e0 fix(carousel): switch prev/next directions in RTL 2020-12-14 11:11:47 +02:00
XhmikosR
93ab072027
carousel: switch to string constants (#32393) 2020-12-11 16:12:13 +02:00
XhmikosR
d154f0df7f
Use the ternary operator in a few more places (#32303) 2020-12-11 15:47:34 +02:00
Rohit Sharma
4535b09c46
Tooltip - check if tip and its parent node exist in dispose method (#32420) 2020-12-10 21:06:41 +02:00
XhmikosR
1edec546cb
Remove TRANSITION_END from utils (#32394) 2020-12-10 16:54:50 +02:00
XhmikosR
6f9c38f65e
carousel: switch to if/else (#32395)
There are only two conditions, so `if/else` is shorter and has the same effect.
2020-12-10 00:38:24 +02:00
Martijn Cuppens
f132400865 Add fallback behaviour 2020-12-09 13:34:51 -08:00
XhmikosR
0ca5addea4
alert: rename variables for consistency (#32392) 2020-12-09 15:09:41 +02:00
XhmikosR
41bc0e26d2
SelectorEngine: drop variable used once (#32391) 2020-12-09 15:05:52 +02:00
alpadev
85208ae557
Refactor components to use a utility function to define jQuery plugins (#32285)
* refactor: use an utility function to define jQuery plugins

* test: add spec for defineJQueryPlugin utility function

* Update .bundlewatch.config.json

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-12-08 08:16:50 +02:00
XhmikosR
d15a0247ce
Remove SelectorEngine.matches(). (#32339)
It's basically unused.
2020-12-07 19:10:20 +02:00
XhmikosR
63f3d939ea Dist 2020-12-07 18:18:16 +02:00
XhmikosR
8dc85c657e Prepare v5.0.0-beta1. 2020-12-07 18:18:16 +02:00
XhmikosR
4eea630d16 Be explicit with element.closest()'s return value 2020-12-06 18:42:40 +02:00
Martijn Cuppens
d8f247392d Fix conflict with Bootstrap CSS 2020-12-06 18:42:40 +02:00
Johann-S
adfdf7160b Update to popper.js v2.x 2020-12-06 18:42:40 +02:00
Gaël Poupard
0a141dae94 chore(dist): generate dist files 2020-12-04 07:52:03 +02:00
Gaël Poupard
9488978fb5 feat(RTL): implement RTL
Using RTLCSS directives, renaming things to use logical names and following best practices.
2020-12-04 07:52:03 +02:00
XhmikosR
cfe31592d7
Dist (#32323) 2020-12-03 16:18:59 +02:00
XhmikosR
cfd00b5eeb
Remove Polyfill leftovers (#32310)
Leftovers from #32057
2020-12-02 08:30:35 +02:00
XhmikosR
701c6c6e77
Unbreak lines. (#32304) 2020-12-02 06:45:15 +02:00
Rohit Sharma
c3689ac073
Remove the show property from the modal plugin (#32279)
Drop the support of show property from the modal plugin.
When creating the new modal instance in v5, the `show` property does not work anymore, so instead of fixing the behavior just removing it permanently to keep the consistency between all the plugins. (All other plugins require the `show()` method to be called on the instances to be shown)

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-30 12:12:40 +02:00
XhmikosR
03ed3e0b3b tooltip.js: reuse existent variable 2020-11-30 12:07:51 +02:00
XhmikosR
dd992c7226 Add tests 2020-11-30 12:07:51 +02:00
Patrick H. Lauke
adc857f617 Extra check for existence of any aria-label
before overwriting it...
2020-11-30 12:07:51 +02:00
Matty Williams
b0372bb658 Accessibility update for tooltip.js
Update to the tooltip.js to add an aria-label attribute that contains the original title of the element, but only if the element doesn't have an existing aria-label attribute.

This is to address cases where screen readers are not capturing the aria-describedby attribute that is added when the tooltip is triggered.  This should also avoid a race condition between the screen reader and the appearance of the tooltip.
2020-11-30 12:07:51 +02:00
Rohit Sharma
04674f88b0 Remove setData from construtors (#32264) 2020-11-29 20:58:26 +02:00
Johann-S
4999c3dbbc remove data key in base component 2020-11-29 20:58:26 +02:00
Rohit Sharma
f6a8733741 Move VERSION to BaseComponent (#32254) 2020-11-29 20:58:26 +02:00
Johann-S
9eb9d02084 add dispose in base component 2020-11-29 20:58:26 +02:00
XhmikosR
51a208f119 Switch to Jasmine's toBeInstanceOf matcher 2020-11-29 20:58:26 +02:00
Johann-S
9f6b342dc7 create a base component 2020-11-29 20:58:26 +02:00
Rohit Sharma
c348ad4a94
Ability to add custom class in tooltip/popover (#32217)
Porting of #31834 to main.

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-25 09:16:22 +02:00
XhmikosR
767db7b746
tests/integration/index.html: revert accidental changes 2020-11-23 22:14:52 +02:00
Rohit Sharma
7c7f08b5e0
Update bundle.js in tests/integration (#32233)
* Use `[].concat` instead of direct spreading nodelist

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-23 21:35:46 +02:00
XhmikosR
3e823e0b75
Dist (#32216) 2020-11-23 15:17:16 +02:00
XhmikosR
f4457bca02
Be consistent with Popper's name. (#32224)
The npm package is named "popper.js" but the project is named "Popper", so use the latter consistently.
2020-11-21 16:22:08 +02:00
Rohit Sharma
358c36d4b5
Add missing tags in unit tests (#32221) 2020-11-20 20:10:15 +02:00
Rohit Sharma
0839cbf04d
Don't hide modal when keyboard is set to false in modal's configuration (#32179)
* Don't hide modal when config.keyboard is false

* Update unit test

- Modal should not be closed when pressing esc key if keyboard = false
  and backdrop is 'static'

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 15:36:24 +02:00
Rohit Sharma
2630b05eb3
Make the attribute methods bs specific (#32173)
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-20 11:13:13 +02:00
XhmikosR
2d4f1b272c
Update karma.conf.js (#32182)
When we are on CI, this statement won't be reached.
2020-11-18 13:06:04 +02:00
Gaël Poupard
1955ffc01e
Handle Chromium to run Karma (#32178)
* chore(karma): handle Chromium to run tests

* Update karma.conf.js

Co-authored-by: XhmikosR <xhmikosr@gmail.com>
2020-11-17 21:42:55 +02:00
XhmikosR
60c79b28aa
BrowserStack: test both on iPhone 7 and iPhone X (#32154) 2020-11-16 14:31:03 +02:00
XhmikosR
eaf616c653 Use Array.find instead of Array.filter 2020-11-14 15:54:50 +02:00
XhmikosR
53ec604eb1 Use String.startsWith 2020-11-14 15:54:50 +02:00
XhmikosR
6d7bc54d22 Switch to Set#has() 2020-11-14 15:54:50 +02:00
XhmikosR
2e758f64cf Switch to Number properties 2020-11-14 15:54:50 +02:00
XhmikosR
b9f7668cf6 Switch to String.includes() 2020-11-14 15:54:50 +02:00
XhmikosR
470e99ed5f
tooltip.js: deduplicate _fixTitle() (#32124) 2020-11-14 15:43:25 +02:00