aboutsummaryrefslogtreecommitdiff
path: root/js/src/util
AgeCommit message (Collapse)AuthorFilesLines
2021-08-04Prepare v5.1.0. (#34674)v5.1.0XhmikosR6-6/+6
2021-07-30Enable a few eslint-config-xo rules (#34620)XhmikosR1-1/+1
* unicorn/prefer-dom-node-append * unicorn/prefer-dom-node-remove
2021-07-28Use a streamlined way to trigger component dismiss (#34170)GeoSot1-0/+34
* use a streamlined way to trigger component dismiss * add documentation Co-authored-by: XhmikosR <[email protected]>
2021-07-27Add shift-tab keyboard support for dialogs (modal & Offcanvas components) ↵Ryan Berliner1-0/+109
(#33865) * consolidate dialog focus trap logic * add shift-tab support to focustrap * remove redundant null check of trap element Co-authored-by: GeoSot <[email protected]> * remove area support forom focusableChildren * fix no expectations warning in focustrap tests Co-authored-by: GeoSot <[email protected]> Co-authored-by: XhmikosR <[email protected]>
2021-07-21Remove whitespace at beginning of util/index.js (#34545)Ryan Berliner1-1/+0
2021-07-20Fix `Util.reflow` function and add documentation (#34543)GeoSot1-1/+12
* add documentation to reflow function * refactor to void as it should be Co-authored-by: XhmikosR <[email protected]>
2021-07-14util.js: remove `Selector.findOne()` dependency (#34441)GeoSot1-2/+1
Co-authored-by: XhmikosR <[email protected]>
2021-06-25Variablize backdrop for modal and offcanvasMark Otto1-2/+3
2021-06-22Release v5.0.2 (#34276)v5.0.2XhmikosR4-4/+4
* Bump version to v5.0.2. * Dist
2021-06-22Register only one `DOMContentLoaded` event listener in `onDOMContentLoaded` ↵alpadev1-1/+10
(#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 <[email protected]>
2021-06-06Refactor scrollbar.js to be used as a Class (#33947)GeoSot1-54/+67
2021-06-03Fix handling of transitionend events dispatched by nested elements(#33845)alpadev2-29/+33
Fix handling of transitionend events dispatched by nested elements Properly handle events from nested elements Change `emulateTransitionEnd` to `executeAfterTransition` &&
2021-05-31Changing Backdrop rootElement to default to a string (#34092)Ryan Weaver1-4/+5
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-25Change `element.parentNode.removeChild(element)` to `element.remove()` (#34071)GeoSot2-6/+2
2021-05-22Automatically select an item in the dropdown when using arrow keys (#34052)alpadev1-2/+2
2021-05-22Fix bug where backdrop calls method on null if it is already removed from ↵Ryan Weaver1-1/+5
the body (#34014) Co-authored-by: Rohit Sharma <[email protected]>
2021-05-20Refactor `isVisible` helper, fixing false positives from deep nesting or ↵Ryan Berliner1-11/+2
alternate means (#33960)
2021-05-20Add Tests on scrollbar.js & better handling if a style property doesn't ↵GeoSot1-1/+4
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-19Add `getNextActiveElement` helper function to utils, replacing custom ↵GeoSot1-0/+29
implementation through components (#33608)
2021-05-13Release v5.0.1 (#33972)v5.0.1XhmikosR4-4/+4
* Bump version to 5.0.1. * Dist
2021-05-13Move get element functionality to a helper (#33327)GeoSot1-1/+26
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-11Extract static `DATA_KEY` & `EVENT_KEY` to base-component (#33635)GeoSot1-1/+2
* Force each plugin that extends base-components to implement a static method `NAME()` * Remove redundant `NAME` argument from 'Utils.defineJQueryPlugin' & fix test
2021-05-10Fix backdrop `rootElement` not initialized in Modal (#33853)Nagarjun Bodduna1-0/+2
* Initialize default value of rootElement before using * Remove redundant test | put rootElement tests together Co-authored-by: GeoSot <[email protected]>
2021-05-05Release v5.0.0 (#33647)v5.0.0XhmikosR4-4/+4
* Bump version to 5.0.0 * Fix npm tag * Dist
2021-04-25Scrollbar: respect the initial body overflow value (#33706)GeoSot1-4/+14
* add method to handle overflow on body element & tests * replace duplicated code on modal/offcanvas tests
2021-04-19Use the backdrop util in offcanvas, enforcing consistency (#33545)GeoSot1-2/+12
* 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-14Decouple BackDrop from modal (#32439)GeoSot2-1/+131
* 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 <[email protected]>
2021-04-11Use cached `noop` function everywhereRohit Sharma1-1/+1
2021-04-11Decouple Modal's scrollbar functionality (#33245)GeoSot1-2/+3
2021-03-30Use template literals instead of concatenation (#33497)Rohit Sharma2-5/+3
2021-03-23Release v5.0.0-beta3 (#33439)v5.0.0-beta3XhmikosR3-3/+3
2021-03-17Use more safe check for 'isDisabled' helper (#33385)GeoSot1-1/+1
2021-03-16Accept data-bs-body option in the configuration object as well (#33248)GeoSot1-0/+17
* 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 <[email protected]> Co-authored-by: XhmikosR <[email protected]>
2021-03-02Offcanvas as component (#29017)GeoSot1-0/+70
* 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 <[email protected]> Co-authored-by: Martijn Cuppens <[email protected]> Co-authored-by: Mark Otto <[email protected]>
2021-02-19Adjust regex `SAFE_URL_PATTERN` for use with test method of regexes. (#33136)Nikon the Third1-1/+1
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 <[email protected]>
2021-02-16util: change `isRTL` to a function (#32446)XhmikosR1-1/+1
This allows the bundler to tree-shake the function.
2021-02-10Release v5.0.0-beta2 (#32467)v5.0.0-beta2XhmikosR2-2/+2
* Bump version to 5.0.0-beta2 * Dist
2021-02-03Prevent `getSelector` from returning URLs as selector (#32586)Florian Vick1-1/+14
* 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 <[email protected]>
2021-01-14Bump eslint-plugin-unicorn from 25.0.1 to 26.0.1 (#32784)dependabot[bot]1-2/+2
* 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] <[email protected]> * Updates for `[email protected]` Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: XhmikosR <[email protected]>
2021-01-13Throw a `TypeError` instead of the generic `Error` (#32585)Rohit Sharma1-5/+4
* 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 <[email protected]>
2020-12-10Remove `TRANSITION_END` from utils (#32394)XhmikosR1-1/+0
2020-12-08Refactor components to use a utility function to define jQuery plugins (#32285)alpadev1-1/+18
* refactor: use an utility function to define jQuery plugins * test: add spec for defineJQueryPlugin utility function * Update .bundlewatch.config.json Co-authored-by: XhmikosR <[email protected]>
2020-12-07Prepare v5.0.0-beta1.XhmikosR2-2/+2
2020-12-04feat(RTL): implement RTLGaël Poupard1-1/+4
Using RTLCSS directives, renaming things to use logical names and following best practices.
2020-12-02Unbreak lines. (#32304)XhmikosR1-4/+2
2020-11-14Switch to `Set#has()`XhmikosR1-3/+3
2020-11-14Switch to Number propertiesXhmikosR1-3/+3
2020-11-14Switch to `String.includes()`XhmikosR1-3/+3
2020-11-14Add `bs` in data attributesRohit Sharma1-2/+2
- Add `bs` in data APIs everywhere - Update unit tests
2020-11-11Prepare v5.0.0-alpha3 (#32122)v5.0.0-alpha3XhmikosR2-2/+2