├── .gitignore ├── src ├── index.js └── Dropdown.svelte ├── public ├── favicon.png └── index.html ├── site ├── main.js └── App.svelte ├── configs ├── rollup.config.js └── rollup.dev-config.js ├── package.json ├── README.md ├── LICENSE └── dist ├── index.mjs └── index.js /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules/ 2 | /public/build/ 3 | 4 | .DS_Store 5 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import Dropdown from './Dropdown.svelte'; 2 | 3 | export default Dropdown; -------------------------------------------------------------------------------- /public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Sidd27/sv-bootstrap-dropdown/HEAD/public/favicon.png -------------------------------------------------------------------------------- /site/main.js: -------------------------------------------------------------------------------- 1 | import App from './App.svelte'; 2 | 3 | const app = new App({ 4 | target: document.body 5 | }); 6 | 7 | export default app; -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | Svelte app 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /configs/rollup.config.js: -------------------------------------------------------------------------------- 1 | import svelte from 'rollup-plugin-svelte'; 2 | import resolve from '@rollup/plugin-node-resolve'; 3 | import commonjs from '@rollup/plugin-commonjs'; 4 | import { 5 | terser 6 | } from 'rollup-plugin-terser'; 7 | import replace from '@rollup/plugin-replace'; 8 | import pkg from '../package.json'; 9 | 10 | 11 | 12 | const production = !process.env.ROLLUP_WATCH; 13 | 14 | export default { 15 | input: 'src/index.js', 16 | output: [ 17 | { 18 | file: pkg.module, 19 | format: 'es', 20 | sourcemap: true, 21 | name: pkg.name 22 | }, 23 | { 24 | file: pkg.main, 25 | format: 'umd', 26 | sourcemap: true, 27 | name: pkg.name 28 | } 29 | ], 30 | plugins: [ 31 | svelte({ 32 | dev: !production, 33 | hydratable: true 34 | }), 35 | resolve({ 36 | dedupe: ['svelte'] 37 | }), 38 | commonjs(), 39 | production && terser(), 40 | replace({ 41 | 'process.env.NODE_ENV': JSON.stringify('production'), 42 | include: '**/node_modules/**', 43 | }) 44 | ], 45 | watch: { 46 | clearScreen: false 47 | } 48 | }; -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "sv-bootstrap-dropdown", 3 | "description": "Dropdown component for Svelte", 4 | "author": { 5 | "name": "Sidddharth Pandey" 6 | }, 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/Sidd27/sv-bootstrap-dropdown" 10 | }, 11 | "version": "0.4.4", 12 | "main": "dist/index.js", 13 | "module": "dist/index.mjs", 14 | "svelte": "src/index.js", 15 | "scripts": { 16 | "build": "rollup -c configs/rollup.config.js", 17 | "dev": "rollup -c configs/rollup.dev-config.js -w", 18 | "start": "sirv public", 19 | "prepublishOnly": "npm run build" 20 | }, 21 | "peerDependencies": { 22 | "@rollup/plugin-replace": "^2.3.2" 23 | }, 24 | "devDependencies": { 25 | "@popperjs/core": "^2.4.0", 26 | "@rollup/plugin-commonjs": "^12.0.0", 27 | "@rollup/plugin-node-resolve": "^8.0.0", 28 | "@rollup/plugin-replace": "^2.3.2", 29 | "rollup": "^2.3.4", 30 | "rollup-plugin-livereload": "^1.0.0", 31 | "rollup-plugin-svelte": "^5.0.3", 32 | "rollup-plugin-terser": "^7.0.2", 33 | "svelte": "^3.0.0" 34 | }, 35 | "dependencies": { 36 | "@popperjs/core": "^2.4.0", 37 | "sirv-cli": "^0.4.4" 38 | }, 39 | "files": [ 40 | "src", 41 | "dist" 42 | ], 43 | "license": "Apache-2.0", 44 | "keywords": [ 45 | "svelte", 46 | "bootstrap", 47 | "dropdown" 48 | ] 49 | } 50 | -------------------------------------------------------------------------------- /configs/rollup.dev-config.js: -------------------------------------------------------------------------------- 1 | import svelte from 'rollup-plugin-svelte'; 2 | import resolve from '@rollup/plugin-node-resolve'; 3 | import commonjs from '@rollup/plugin-commonjs'; 4 | import livereload from 'rollup-plugin-livereload'; 5 | import { 6 | terser 7 | } from 'rollup-plugin-terser'; 8 | import replace from '@rollup/plugin-replace'; 9 | 10 | const production = !process.env.ROLLUP_WATCH; 11 | 12 | export default { 13 | input: 'site/main.js', 14 | output: { 15 | sourcemap: true, 16 | format: 'iife', 17 | name: 'app', 18 | file: 'public/build/bundle.js' 19 | }, 20 | plugins: [ 21 | svelte({ 22 | // enable run-time checks when not in production 23 | dev: !production, 24 | // we'll extract any component CSS out into 25 | // a separate file - better for performance 26 | css: css => { 27 | css.write('public/build/bundle.css'); 28 | } 29 | }), 30 | 31 | // If you have external dependencies installed from 32 | // npm, you'll most likely need these plugins. In 33 | // some cases you'll need additional configuration - 34 | // consult the documentation for details: 35 | // https://github.com/rollup/plugins/tree/master/packages/commonjs 36 | resolve({ 37 | browser: true, 38 | dedupe: ['svelte'] 39 | }), 40 | commonjs(), 41 | 42 | // In dev mode, call `npm run start` once 43 | // the bundle has been generated 44 | !production && serve(), 45 | 46 | // Watch the `public` directory and refresh the 47 | // browser on changes when not in production 48 | !production && livereload('public'), 49 | 50 | // If we're building for production (npm run build 51 | // instead of npm run dev), minify 52 | production && terser(), 53 | 54 | replace({ 55 | 'process.env.NODE_ENV': JSON.stringify('production'), 56 | include: '**/node_modules/**', 57 | }), 58 | ], 59 | watch: { 60 | clearScreen: false 61 | } 62 | }; 63 | 64 | function serve() { 65 | let started = false; 66 | 67 | return { 68 | writeBundle() { 69 | if (!started) { 70 | started = true; 71 | 72 | require('child_process').spawn('npm', ['run', 'start', '--', '--dev'], { 73 | stdio: ['ignore', 'inherit', 'inherit'], 74 | shell: true 75 | }); 76 | } 77 | } 78 | }; 79 | } 80 | -------------------------------------------------------------------------------- /site/App.svelte: -------------------------------------------------------------------------------- 1 | 9 | 10 |
11 |

Single button

12 | 13 | 19 |
20 | Action 21 | Another action 22 | Something else here 23 |
24 |
25 | 26 |

Split button

27 | 28 | 29 | 37 |
38 | Action 39 | Another action 40 | 43 | 44 | 45 |

Placement

46 | 47 | 53 |
54 | Action 55 | Another action 56 | 59 | 60 | 61 |

Responsive alignment

62 | 67 | 73 |
74 | 75 | 76 | 77 |
78 |
79 | 80 |

Offset

81 | 82 | 88 | 93 | 94 |
95 | -------------------------------------------------------------------------------- /src/Dropdown.svelte: -------------------------------------------------------------------------------- 1 | 207 | 208 |
209 | 210 | {#if open} 211 | 218 | {/if} 219 |
220 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # sv-bootstrap-dropdown (Svelte Bootstrap Dropdown) 2 | Svelte Dropdown Component for Bootstrap (Bootstrap’s dropdown plugin in svlete applications), can be used with sapper or standalone with svelte.Just like Vainilla bootstrap this plugin too is built on a third party library, [Popper.js](https://popper.js.org/), which provides dynamic positioning and viewport detection. But Unlike Vainilla bootstrap we are using PopperJs V2 instead of v1 3 | 4 | ## How to install 5 | 1. ```npm install --save-dev sv-bootstrap-dropdown @rollup/plugin-replace``` 6 | 2. Add below code in your rollup config 7 | 8 | ```js 9 | import replace from '@rollup/plugin-replace'; 10 | .. 11 | .. 12 | .. 13 | plugins: [ 14 | ..., // Other Plugins 15 | ..., // Other Plugins 16 | replace({ 17 | 'process.env.NODE_ENV': JSON.stringify('production'), 18 | include: '**/node_modules/**', 19 | }) 20 | ] 21 | ``` 22 | 23 | ### Requirements 24 | Bootstrap CSS needs to be present globally in project 25 | 26 | ## Simple Demo 27 | [Demo](https://svelte.dev/repl/f9b0e2f4193b4260b6b16bc097fa0155?version=3.23.0) 28 | ## Usage 29 | 30 | ### Single button 31 | 32 | #### Example 33 | ```html 34 | 38 | 39 | 40 | 47 |
48 | Action 49 | Another action 50 | Something else here 51 |
52 |
53 | ``` 54 | 55 | ### Split button 56 | Similarly, create split button dropdowns with virtually the same markup as single button dropdowns, but with the addition of .dropdown-toggle-split for proper spacing around the dropdown caret. Just make triggerElement as splited caret button of btn-group and class `.btn-group` via classes option on Dropdown component 57 | 58 | #### Example 59 | 60 | ```html 61 | 65 | 66 | 67 | 68 | 76 |
77 | Action 78 | Another action 79 | 82 | 83 | ``` 84 | 85 | ### Trigger Sizing 86 | 87 | Button dropdowns work with buttons of all sizes, including default and split dropdown buttons as the triggerElement is being handled by the developer they have freedom to add any classes, style etc 88 | 89 | |Small|Large|Extra large| 90 | |---|---|---| 91 | | .btn-sm | .btn-lg | .btn-xl | 92 | 93 | ### Flip 94 | 95 | This option should tell the `Dropdown` to filp side if there is no space on the prefered side 96 | 97 | ### Example 98 | 99 | ```html 100 | 104 | 105 | 106 | ... 107 | 108 | ``` 109 | 110 | ### Directions 111 | 112 | Use `placement` option on `Dropdown` component for placement change 113 | 114 | --- 115 | **NOTE** 116 | 117 | > The `flip` option will take effect if there is no space for dropdown on the side mentioned in placement. 118 | 119 | --- 120 | 121 | #### Example 122 | 123 | ```html 124 | 128 | 129 | 130 | 136 |
137 | Action 138 | Another action 139 | 142 | 143 | ``` 144 | 145 | #### Complete Placement Options 146 | 147 | You can use more options than Vanilla Bootstrap by using placement option 148 | 149 | |Placement|Description| 150 | |--- |--- | 151 | |auto|Placements will choose the side with most space and it will be in the center of trigger element| 152 | |auto-start|Placements will choose the side with most space and it will be in the start of trigger element| 153 | |auto-end|Placements will choose the side with most space and it will be in the end of trigger element| 154 | |top|Placements will be upside (dropup) and it will be in the center of trigger element| 155 | |top-start|Placements will be upside (dropup) and it will be in the start of trigger element| 156 | |top-end|Placements will be upside (dropup) and it will be in the end of trigger element| 157 | |bottom|Placements will be downside (dropdown) and it will be in the center of trigger element| 158 | |bottom-start|Placements will be downside (dropdown) and it will be in the start of trigger element| 159 | |bottom-end|Placements will be downside (dropdown) and it will be in the end of trigger element| 160 | |right|Placements will be rightside (dropright) and it will be in the center of trigger element| 161 | |right-start|Placements will be rightside (dropright) and it will be in the start of trigger element| 162 | |right-end|Placements will be rightside (dropright) and it will be in the end of trigger element| 163 | |left|Placements will be leftside (dropleft) and it will be in the center of trigger element| 164 | |left-start|Placements will be leftside (dropleft) and it will be in the start of trigger element| 165 | |left-end|Placements will be leftside (dropleft) and it will be in the end of trigger element| 166 | 167 | ### Responsive alignment 168 | If you want to use responsive alignment, disable dynamic positioning by using the `displayStatic="true"` attribute and use the responsive variation classes on option `menuClasses` in Dropdown component 169 | 170 | --- 171 | **NOTE** 172 | 173 | > The containing element is div and `.dropdown` is the default class on the `Dropdown` component. As it's a block-level element so width will be 100% to change use `classes` options add `.d-inline-block` or `.btn-group` so that the menu will adjust properly. 174 | 175 | --- 176 | 177 | ### Example 178 | 179 | ``` html 180 | 184 | 185 | 190 | 196 |
197 | 198 | 199 | 200 |
201 |
202 | ``` 203 | 204 | ### Offset option 205 | The offset modifier lets you displace menu element from its parent dropdown element. This option takes an array of length 2 both item of array should be Number 206 | 207 | `Ex: [10,8]` 208 | 209 | * First array Element represent `Skidding` 210 | * Seconf array Element represent `Distance` 211 | 212 | #### Example 213 | 214 | ```html 215 | 219 | 220 | 221 | 227 |
228 | Action 229 | Another action 230 | Something else here 231 |
232 |
233 | ``` 234 | 235 | --- 236 | [PopperJS Documentation](https://popper.js.org/docs/v2/migration-guide/#4-remove-all-css-margins) 237 | 238 | In Popper 2 we no longer consider CSS margin because of inherent issues with it. Instead, to apply some padding between the popper and its reference element, use the offset modifier. 239 | 240 | --- 241 | Therefore we have default distance offset as 2 to have exact distance as Vanilla Bootstrap 242 | 243 | ### Component Options 244 | 245 | |Name|Type|Default|Description| 246 | |--- |--- |--- |--- | 247 | |open|boolean|false|You can use this to open the dropdown programtically from function.(*Note: setting open to true on load may lead to bug of placement in popper u can use it with displayStatic option*).| 248 | |flip|boolean|true|Allow Dropdown to flip in case of an overlapping on the reference element. For more information refer to [Popper.js](https://popper.js.org/docs/v2/modifiers/flip/).| 249 | |placement|string|'bottom-start'|Use `placement` option on `Dropdown` component for placement change.| 250 | |displayStatic|boolean|false|By default, we use Popper.js for dynamic positioning. Disable this with displayStatic.| 251 | |keyboard|boolean|true|Closes the dropdown when escape key is pressed.| 252 | |insideClick|boolean|false|By default, a dropdown menu closes on document click, even if you clicked on an element inside the dropdown. Use `insideClick="true"` to allow click inside the dropdown.| 253 | |closeOnOutsideClick|boolean|true|By default, a dropdown menu closes on document click. Use `closeOnOutsideClick="false"` to disable closing of dropdown on outside click.| 254 | |offset|[?number, ?number] or Function([Definition](https://popper.js.org/docs/v2/modifiers/offset/#options))|[0,2]|The offset modifier lets you displace menu element from its parent dropdown element.| 255 | |menuClasses|string|""|You can add any number of classes to `.dropdown-menu` element.| 256 | |classes|string|""|You can add any number of classes to `.dropdown` element.| 257 | |labelledby|string|""|Used for aria-labelledby on `.dropdown-menu`| 258 | |onClosed|function|Empty function(noop)|Can be Used for callbacks After Dropdown is Closed| 259 | |onOpened|function|Empty function(noop)|Can be Used for callbacks After Dropdown is Opened| 260 | 261 | ### License 262 | [Apache-2.0](https://github.com/Sidd27/sv-bootstrap-dropdown/blob/master/LICENSE) 263 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /dist/index.mjs: -------------------------------------------------------------------------------- 1 | function e(){}function t(e){return e()}function n(){return Object.create(null)}function r(e){e.forEach(t)}function o(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e,t,n,r){if(e){const o=s(e,t,n,r);return e[0](o)}}function s(e,t,n,r){return e[1]&&r?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](r(t))):n.ctx}function c(e,t,n,r,o,i,a){const c=function(e,t,n,r){if(e[2]&&r){const o=e[2](r(n));if(void 0===t.dirty)return o;if("object"==typeof o){const e=[],n=Math.max(t.dirty.length,o.length);for(let r=0;r{S.delete(e),r&&(n&&e.d(1),r())})),e.o(t)}}function T(i,a,s,c,f,l,p=[-1]){const d=v;b(i);const h=a.props||{},g=i.$$={fragment:null,ctx:null,props:l,update:e,not_equal:f,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(d?d.$$.context:[]),callbacks:n(),dirty:p};let y=!1;if(g.ctx=s?s(i,h,((e,t,...n)=>{const r=n.length?n[0]:t;return g.ctx&&f(g.ctx[e],g.ctx[e]=r)&&(g.bound[e]&&g.bound[e](r),y&&function(e,t){-1===e.$$.dirty[0]&&(x.push(e),D(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const n=s.map(t).filter(o);c?c.push(...n):r(n),e.$$.on_mount=[]})),f.forEach(C)}(i,a.target,a.anchor),A()}b(d)}function H(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function R(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t?t.defaultView:window}return e}function q(e){var t=R(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function V(e){return e instanceof R(e).Element||e instanceof Element}function I(e){return e instanceof R(e).HTMLElement||e instanceof HTMLElement}function U(e){return e?(e.nodeName||"").toLowerCase():null}function z(e){return(V(e)?e.ownerDocument:e.document).documentElement}function F(e){return H(z(e)).left+q(e).scrollLeft}function X(e){return R(e).getComputedStyle(e)}function Y(e){var t=X(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function G(e,t,n){void 0===n&&(n=!1);var r,o=z(t),i=H(e),a={scrollLeft:0,scrollTop:0},s={x:0,y:0};return n||(("body"!==U(t)||Y(o))&&(a=(r=t)!==R(r)&&I(r)?function(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}(r):q(r)),I(t)?((s=H(t)).x+=t.clientLeft,s.y+=t.clientTop):o&&(s.x=F(o))),{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function J(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function K(e){return"html"===U(e)?e:e.assignedSlot||e.parentNode||e.host||z(e)}function Q(e){return["html","body","#document"].indexOf(U(e))>=0?e.ownerDocument.body:I(e)&&Y(e)?e:Q(K(e))}function Z(e,t){void 0===t&&(t=[]);var n=Q(e),r="body"===U(n),o=R(n),i=r?[o].concat(o.visualViewport||[],Y(n)?n:[]):n,a=t.concat(i);return r?a:a.concat(Z(K(i)))}function ee(e){return["table","td","th"].indexOf(U(e))>=0}function te(e){return I(e)&&"fixed"!==X(e).position?e.offsetParent:null}function ne(e){for(var t=R(e),n=te(e);n&&ee(n);)n=te(n);return n&&"body"===U(n)&&"static"===X(n).position?t:n||t}var re="top",oe="bottom",ie="right",ae="left",se=[re,oe,ie,ae],ce=se.reduce((function(e,t){return e.concat([t+"-start",t+"-end"])}),[]),fe=[].concat(se,["auto"]).reduce((function(e,t){return e.concat([t,t+"-start",t+"-end"])}),[]),ue=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function le(e){var t=new Map,n=new Set,r=[];function o(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var r=t.get(e);r&&o(r)}})),r.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||o(e)})),r}function pe(e){return e.split("-")[0]}var de={placement:"bottom",modifiers:[],strategy:"absolute"};function me(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function be(e){var t,n=e.reference,r=e.element,o=e.placement,i=o?pe(o):null,a=o?ye(o):null,s=n.x+n.width/2-r.width/2,c=n.y+n.height/2-r.height/2;switch(i){case re:t={x:s,y:n.y-r.height};break;case oe:t={x:s,y:n.y+n.height};break;case ie:t={x:n.x+n.width,y:c};break;case ae:t={x:n.x-r.width,y:c};break;default:t={x:n.x,y:n.y}}var f=i?ve(i):null;if(null!=f){var u="y"===f?"height":"width";switch(a){case"start":t[f]=Math.floor(t[f])-Math.floor(n[u]/2-r[u]/2);break;case"end":t[f]=Math.floor(t[f])+Math.ceil(n[u]/2-r[u]/2)}}return t}var we={top:"auto",right:"auto",bottom:"auto",left:"auto"};function xe(e){var t,n=e.popper,r=e.popperRect,o=e.placement,i=e.offsets,a=e.position,s=e.gpuAcceleration,c=e.adaptive,f=function(e){var t=e.x,n=e.y,r=window.devicePixelRatio||1;return{x:Math.round(t*r)/r||0,y:Math.round(n*r)/r||0}}(i),u=f.x,l=f.y,p=i.hasOwnProperty("x"),d=i.hasOwnProperty("y"),m=ae,h=re,g=window;if(c){var y=ne(n);y===R(n)&&(y=z(n)),o===re&&(h=oe,l-=y.clientHeight-r.height,l*=s?1:-1),o===ae&&(m=ie,u-=y.clientWidth-r.width,u*=s?1:-1)}var v,b=Object.assign({position:a},c&&we);return s?Object.assign({},b,((v={})[h]=d?"0":"",v[m]=p?"0":"",v.transform=(g.devicePixelRatio||1)<2?"translate("+u+"px, "+l+"px)":"translate3d("+u+"px, "+l+"px, 0)",v)):Object.assign({},b,((t={})[h]=d?l+"px":"",t[m]=p?u+"px":"",t.transform="",t))}var Oe={left:"right",right:"left",bottom:"top",top:"bottom"};function Ee(e){return e.replace(/left|right|bottom|top/g,(function(e){return Oe[e]}))}var $e={start:"end",end:"start"};function ke(e){return e.replace(/start|end/g,(function(e){return $e[e]}))}function je(e){return parseFloat(e)||0}function De(e){var t=R(e),n=function(e){var t=I(e)?X(e):{};return{top:je(t.borderTopWidth),right:je(t.borderRightWidth),bottom:je(t.borderBottomWidth),left:je(t.borderLeftWidth)}}(e),r="html"===U(e),o=F(e),i=e.clientWidth+n.right,a=e.clientHeight+n.bottom;return r&&t.innerHeight-e.clientHeight>50&&(a=t.innerHeight-n.bottom),{top:r?0:e.clientTop,right:e.clientLeft>n.left?n.right:r?t.innerWidth-i-o:e.offsetWidth-i,bottom:r?t.innerHeight-a:e.offsetHeight-a,left:r?o:e.clientLeft}}function Me(e,t){var n=Boolean(t.getRootNode&&t.getRootNode().host);if(e.contains(t))return!0;if(n){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Ce(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function Le(e,t){return"viewport"===t?Ce(function(e){var t=R(e),n=t.visualViewport,r=t.innerWidth,o=t.innerHeight;return n&&/iPhone|iPod|iPad/.test(navigator.platform)&&(r=n.width,o=n.height),{width:r,height:o,x:0,y:0}}(e)):I(t)?H(t):Ce(function(e){var t=R(e),n=q(e),r=G(z(e),t);return r.height=Math.max(r.height,t.innerHeight),r.width=Math.max(r.width,t.innerWidth),r.x=-n.scrollLeft,r.y=-n.scrollTop,r}(z(e)))}function Pe(e,t,n){var r="clippingParents"===t?function(e){var t=Z(e),n=["absolute","fixed"].indexOf(X(e).position)>=0&&I(e)?ne(e):e;return V(n)?t.filter((function(e){return V(e)&&Me(e,n)})):[]}(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce((function(t,n){var r=Le(e,n),o=De(I(n)?n:z(e));return t.top=Math.max(r.top+o.top,t.top),t.right=Math.min(r.right-o.right,t.right),t.bottom=Math.min(r.bottom-o.bottom,t.bottom),t.left=Math.max(r.left+o.left,t.left),t}),Le(e,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ae(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},{},e)}function Be(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function Se(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=void 0===r?e.placement:r,i=n.boundary,a=void 0===i?"clippingParents":i,s=n.rootBoundary,c=void 0===s?"viewport":s,f=n.elementContext,u=void 0===f?"popper":f,l=n.altBoundary,p=void 0!==l&&l,d=n.padding,m=void 0===d?0:d,h=Ae("number"!=typeof m?m:Be(m,se)),g="popper"===u?"reference":"popper",y=e.elements.reference,v=e.rects.popper,b=e.elements[p?g:u],w=Pe(V(b)?b:b.contextElement||z(e.elements.popper),a,c),x=H(y),O=be({reference:x,element:v,strategy:"absolute",placement:o}),E=Ce(Object.assign({},v,{},O)),$="popper"===u?E:x,k={top:w.top-$.top+h.top,bottom:$.bottom-w.bottom+h.bottom,left:w.left-$.left+h.left,right:$.right-w.right+h.right},j=e.modifiersData.offset;if("popper"===u&&j){var D=j[o];Object.keys(k).forEach((function(e){var t=[ie,oe].indexOf(e)>=0?1:-1,n=[re,oe].indexOf(e)>=0?"y":"x";k[e]+=D[n]*t}))}return k}function _e(e,t){void 0===t&&(t={});var n=t,r=n.placement,o=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,f=void 0===c?fe:c,u=ye(r),l=(u?s?ce:ce.filter((function(e){return ye(e)===u})):se).filter((function(e){return f.indexOf(e)>=0})).reduce((function(t,n){return t[n]=Se(e,{placement:n,boundary:o,rootBoundary:i,padding:a})[pe(n)],t}),{});return Object.keys(l).sort((function(e,t){return l[e]-l[t]}))}function We(e,t,n){return Math.max(e,Math.min(t,n))}function Ne(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Te(e){return[re,ie,oe,ae].some((function(t){return e[t]>=0}))}var He=he({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,i=void 0===o||o,a=r.resize,s=void 0===a||a,c=R(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",n.update,ge)})),s&&c.addEventListener("resize",n.update,ge),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",n.update,ge)})),s&&c.removeEventListener("resize",n.update,ge)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=be({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=void 0===r||r,i=n.adaptive,a=void 0===i||i,s={placement:pe(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,{},xe(Object.assign({},s,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,{},xe(Object.assign({},s,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},r=t.attributes[e]||{},o=t.elements[e];I(o)&&U(o)&&(Object.assign(o.style,n),Object.keys(r).forEach((function(e){var t=r[e];!1===t?o.removeAttribute(e):o.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var r=t.elements[e],o=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});I(r)&&U(r)&&(Object.assign(r.style,i),Object.keys(o).forEach((function(e){r.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.offset,i=void 0===o?[0,0]:o,a=fe.reduce((function(e,n){return e[n]=function(e,t,n){var r=pe(e),o=[ae,re].indexOf(r)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*o,[ae,ie].indexOf(r)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],c=s.x,f=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=f),t.modifiersData[r]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,f=n.padding,u=n.boundary,l=n.rootBoundary,p=n.altBoundary,d=n.flipVariations,m=void 0===d||d,h=n.allowedAutoPlacements,g=t.options.placement,y=pe(g),v=c||(y===g||!m?[Ee(g)]:function(e){if("auto"===pe(e))return[];var t=Ee(e);return[ke(e),t,ke(t)]}(g)),b=[g].concat(v).reduce((function(e,n){return e.concat("auto"===pe(n)?_e(t,{placement:n,boundary:u,rootBoundary:l,padding:f,flipVariations:m,allowedAutoPlacements:h}):n)}),[]),w=t.rects.reference,x=t.rects.popper,O=new Map,E=!0,$=b[0],k=0;k=0,L=C?"width":"height",P=Se(t,{placement:j,boundary:u,rootBoundary:l,altBoundary:p,padding:f}),A=C?M?ie:ae:M?oe:re;w[L]>x[L]&&(A=Ee(A));var B=Ee(A),S=[];if(i&&S.push(P[D]<=0),s&&S.push(P[A]<=0,P[B]<=0),S.every((function(e){return e}))){$=j,E=!1;break}O.set(j,S)}if(E)for(var _=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return $=t,"break"},W=m?3:1;W>0;W--){if("break"===_(W))break}t.placement!==$&&(t.modifiersData[r]._skip=!0,t.placement=$,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,i=void 0===o||o,a=n.altAxis,s=void 0!==a&&a,c=n.boundary,f=n.rootBoundary,u=n.altBoundary,l=n.padding,p=n.tether,d=void 0===p||p,m=n.tetherOffset,h=void 0===m?0:m,g=Se(t,{boundary:c,rootBoundary:f,padding:l,altBoundary:u}),y=pe(t.placement),v=ye(t.placement),b=!v,w=ve(y),x="x"===w?"y":"x",O=t.modifiersData.popperOffsets,E=t.rects.reference,$=t.rects.popper,k="function"==typeof h?h(Object.assign({},t.rects,{placement:t.placement})):h,j={x:0,y:0};if(O){if(i){var D="y"===w?re:ae,M="y"===w?oe:ie,C="y"===w?"height":"width",L=O[w],P=O[w]+g[D],A=O[w]-g[M],B=d?-$[C]/2:0,S="start"===v?E[C]:$[C],_="start"===v?-$[C]:-E[C],W=t.elements.arrow,N=d&&W?J(W):{width:0,height:0},T=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},H=T[D],R=T[M],q=We(0,E[C],N[C]),V=b?E[C]/2-B-q-H-k:S-q-H-k,I=b?-E[C]/2+B+q+R+k:_+q+R+k,U=t.elements.arrow&&ne(t.elements.arrow),z=U?"y"===w?U.clientTop||0:U.clientLeft||0:0,F=t.modifiersData.offset?t.modifiersData.offset[t.placement][w]:0,X=O[w]+V-F-z,Y=O[w]+I-F,G=We(d?Math.min(P,X):P,L,d?Math.max(A,Y):A);O[w]=G,j[w]=G-L}if(s){var K="x"===w?re:ae,Q="x"===w?oe:ie,Z=O[x],ee=We(Z+g[K],Z,Z-g[Q]);O[x]=ee,j[x]=ee-Z}t.modifiersData[r]=j}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,r=e.name,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=pe(n.placement),s=ve(a),c=[ae,ie].indexOf(a)>=0?"height":"width";if(o&&i){var f=n.modifiersData[r+"#persistent"].padding,u=J(o),l="y"===s?re:ae,p="y"===s?oe:ie,d=n.rects.reference[c]+n.rects.reference[s]-i[s]-n.rects.popper[c],m=i[s]-n.rects.reference[s],h=ne(o),g=h?"y"===s?h.clientHeight||0:h.clientWidth||0:0,y=d/2-m/2,v=f[l],b=g-u[c]-f[p],w=g/2-u[c]/2+y,x=We(v,w,b),O=s;n.modifiersData[r]=((t={})[O]=x,t.centerOffset=x-w,t)}},effect:function(e){var t=e.state,n=e.options,r=e.name,o=n.element,i=void 0===o?"[data-popper-arrow]":o,a=n.padding,s=void 0===a?0:a;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&Me(t.elements.popper,i)&&(t.elements.arrow=i,t.modifiersData[r+"#persistent"]={padding:Ae("number"!=typeof s?s:Be(s,se))})},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,i=t.modifiersData.preventOverflow,a=Se(t,{elementContext:"reference"}),s=Se(t,{altBoundary:!0}),c=Ne(a,r),f=Ne(s,o,i),u=Te(c),l=Te(f);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:l},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":l})}}]});const Re=e=>({}),qe=e=>({});function Ve(e){let t,n,r,o,i;const s=e[34].DropdownMenu,p=a(s,e,e[33],qe);return{c(){t=l("div"),p&&p.c(),this.h()},l(e){t=h(e,"DIV",{class:!0,"aria-labelledby":!0});var n=m(t);p&&p.l(n),n.forEach(u),this.h()},h(){d(t,"class",n="dropdown-menu show "+e[1]),d(t,"aria-labelledby",e[3])},m(n,a){var s,c,u,l;f(n,t,a),p&&p.m(t,null),e[35](t),r=!0,o||(s=t,c="click",u=e[6],s.addEventListener(c,u,l),i=()=>s.removeEventListener(c,u,l),o=!0)},p(e,o){p&&p.p&&4&o[1]&&c(p,s,e,e[33],o,Re,qe),(!r||2&o[0]&&n!==(n="dropdown-menu show "+e[1]))&&d(t,"class",n),(!r||8&o[0])&&d(t,"aria-labelledby",e[3])},i(e){r||(W(p,e),r=!0)},o(e){N(p,e),r=!1},d(n){n&&u(t),p&&p.d(n),e[35](null),o=!1,i()}}}function Ie(e){let t,n,o,i;const s=e[34].default,v=a(s,e,e[33],null);let b=e[0]&&Ve(e);return{c(){t=l("div"),v&&v.c(),n=p(" "),b&&b.c(),this.h()},l(e){t=h(e,"DIV",{class:!0});var r=m(t);v&&v.l(r),n=g(r),b&&b.l(r),r.forEach(u),this.h()},h(){d(t,"class",o=e[5]+" "+e[2]),y(t,"show",e[0])},m(e,r){f(e,t,r),v&&v.m(t,null),function(e,t){e.appendChild(t)}(t,n),b&&b.m(t,null),i=!0},p(e,n){v&&v.p&&4&n[1]&&c(v,s,e,e[33],n,null,null),e[0]?b?(b.p(e,n),1&n[0]&&W(b,1)):(b=Ve(e),b.c(),W(b,1),b.m(t,null)):b&&(_={r:0,c:[],p:_},N(b,1,1,(()=>{b=null})),_.r||r(_.c),_=_.p),(!i||36&n[0]&&o!==(o=e[5]+" "+e[2]))&&d(t,"class",o),37&n[0]&&y(t,"show",e[0])},i(e){i||(W(v,e),W(b),i=!0)},o(e){N(v,e),N(b),i=!1},d(e){e&&u(t),v&&v.d(e),b&&b.d()}}}function Ue(e,...t){return e.addEventListener(...t),{remove:()=>e.removeEventListener(...t)}}function ze(e){if(!e)return!1;if(e.style&&e.parentNode&&e.parentNode.style){const t=getComputedStyle(e),n=getComputedStyle(e.parentNode);return"none"!==t.display&&"none"!==n.display&&"hidden"!==t.visibility}return!1}function Fe(e,t,n){const r=()=>{};let o,i,a,s,c,f,{open:u=!1}=t,{flip:l=!0}=t,{placement:p="bottom-start"}=t,{displayStatic:d=!1}=t,{keyboard:m=!0}=t,{insideClick:h=!1}=t,{closeOnOutsideClick:g=!0}=t,{offset:y=[0,2]}=t,{menuClasses:v=""}=t,{classes:b=""}=t,{triggerElement:x}=t,{onOpened:E=r}=t,{onClosed:$=r}=t,{labelledby:k=""}=t,j=[];const D=new RegExp("ArrowUp|ArrowDown|Escape"),C={top:"dropup",bottom:"dropdown",right:"dropright",left:"dropleft"};async function L(){await M(),i=He(x,o,{placement:p,modifiers:[{name:"flip",enabled:l},{name:"offset",options:{offset:y}},{name:"preventOverflow",options:{altBoundary:!0}}]})}async function P(){await M();const e=o.querySelectorAll(".dropdown-item:not(.disabled):not(:disabled)");j=[...e].filter(ze)}function A(){m&&(s=Ue(document,"keydown",(e=>{if(!/input|textarea/i.test(e.target.tagName)&&D.test(e.key)){if(e.preventDefault(),e.stopPropagation(),"Escape"===e.key&&n(0,u=!1),!j.length)return;let t=j.indexOf(e.target);"ArrowUp"===e.key&&t>0&&t--,"ArrowDown"===e.key&&t{e.target===o||o.contains(e.target)||n(0,u=!1)})))}async function S(){P(),A(),B(),d||L(),E()}function _(){s&&s.remove(),c&&c.remove(),N()}function W(){_(),$()}function N(){i&&(i.destroy(),i=null)}var T;T=async()=>{await M(),f=Ue(x,"click",(e=>{e.stopPropagation(),n(0,u=!u)}))},w().$$.on_mount.push(T),function(e){w().$$.on_destroy.push(e)}((()=>{_(),f.remove()}));let{$$slots:H={},$$scope:R}=t;return e.$set=e=>{"open"in e&&n(0,u=e.open),"flip"in e&&n(7,l=e.flip),"placement"in e&&n(8,p=e.placement),"displayStatic"in e&&n(9,d=e.displayStatic),"keyboard"in e&&n(10,m=e.keyboard),"insideClick"in e&&n(11,h=e.insideClick),"closeOnOutsideClick"in e&&n(12,g=e.closeOnOutsideClick),"offset"in e&&n(13,y=e.offset),"menuClasses"in e&&n(1,v=e.menuClasses),"classes"in e&&n(2,b=e.classes),"triggerElement"in e&&n(14,x=e.triggerElement),"onOpened"in e&&n(15,E=e.onOpened),"onClosed"in e&&n(16,$=e.onClosed),"labelledby"in e&&n(3,k=e.labelledby),"$$scope"in e&&n(33,R=e.$$scope)},e.$$.update=()=>{1&e.$$.dirty[0]&&(u?S():W()),256&e.$$.dirty[0]&&n(5,a=C[p.split("-")[0]])},[u,v,b,k,o,a,function(){h||n(0,u=!1)},l,p,d,m,h,g,y,x,E,$,i,s,c,f,j,r,D,C,L,P,A,B,S,_,W,N,R,H,function(e){O[e?"unshift":"push"]((()=>{n(4,o=e)}))}]}export default class extends class{$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(r(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}}{constructor(e){super(),T(this,e,Fe,Ie,i,{open:0,flip:7,placement:8,displayStatic:9,keyboard:10,insideClick:11,closeOnOutsideClick:12,offset:13,menuClasses:1,classes:2,triggerElement:14,onOpened:15,onClosed:16,labelledby:3},[-1,-1])}} 2 | //# sourceMappingURL=index.mjs.map 3 | -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self)["sv-bootstrap-dropdown"]=t()}(this,(function(){"use strict";function e(){}function t(e){return e()}function n(){return Object.create(null)}function o(e){e.forEach(t)}function r(e){return"function"==typeof e}function i(e,t){return e!=e?t==t:e!==t||e&&"object"==typeof e||"function"==typeof e}function a(e,t,n,o){if(e){const r=s(e,t,n,o);return e[0](r)}}function s(e,t,n,o){return e[1]&&o?function(e,t){for(const n in t)e[n]=t[n];return e}(n.ctx.slice(),e[1](o(t))):n.ctx}function c(e,t,n,o,r,i,a){const c=function(e,t,n,o){if(e[2]&&o){const r=e[2](o(n));if(void 0===t.dirty)return r;if("object"==typeof r){const e=[],n=Math.max(t.dirty.length,r.length);for(let o=0;o{S.delete(e),o&&(n&&e.d(1),o())})),e.o(t)}}function T(i,a,s,c,f,l,p=[-1]){const d=v;b(i);const h=a.props||{},g=i.$$={fragment:null,ctx:null,props:l,update:e,not_equal:f,bound:n(),on_mount:[],on_destroy:[],before_update:[],after_update:[],context:new Map(d?d.$$.context:[]),callbacks:n(),dirty:p};let y=!1;if(g.ctx=s?s(i,h,((e,t,...n)=>{const o=n.length?n[0]:t;return g.ctx&&f(g.ctx[e],g.ctx[e]=o)&&(g.bound[e]&&g.bound[e](o),y&&function(e,t){-1===e.$$.dirty[0]&&(x.push(e),D(),e.$$.dirty.fill(0)),e.$$.dirty[t/31|0]|=1<{const n=s.map(t).filter(r);c?c.push(...n):o(n),e.$$.on_mount=[]})),f.forEach(C)}(i,a.target,a.anchor),A()}b(d)}function H(e){var t=e.getBoundingClientRect();return{width:t.width,height:t.height,top:t.top,right:t.right,bottom:t.bottom,left:t.left,x:t.left,y:t.top}}function R(e){if("[object Window]"!==e.toString()){var t=e.ownerDocument;return t?t.defaultView:window}return e}function q(e){var t=R(e);return{scrollLeft:t.pageXOffset,scrollTop:t.pageYOffset}}function V(e){return e instanceof R(e).Element||e instanceof Element}function I(e){return e instanceof R(e).HTMLElement||e instanceof HTMLElement}function U(e){return e?(e.nodeName||"").toLowerCase():null}function z(e){return(V(e)?e.ownerDocument:e.document).documentElement}function F(e){return H(z(e)).left+q(e).scrollLeft}function X(e){return R(e).getComputedStyle(e)}function Y(e){var t=X(e),n=t.overflow,o=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+o)}function G(e,t,n){void 0===n&&(n=!1);var o,r=z(t),i=H(e),a={scrollLeft:0,scrollTop:0},s={x:0,y:0};return n||(("body"!==U(t)||Y(r))&&(a=(o=t)!==R(o)&&I(o)?function(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}(o):q(o)),I(t)?((s=H(t)).x+=t.clientLeft,s.y+=t.clientTop):r&&(s.x=F(r))),{x:i.left+a.scrollLeft-s.x,y:i.top+a.scrollTop-s.y,width:i.width,height:i.height}}function J(e){return{x:e.offsetLeft,y:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}}function K(e){return"html"===U(e)?e:e.assignedSlot||e.parentNode||e.host||z(e)}function Q(e){return["html","body","#document"].indexOf(U(e))>=0?e.ownerDocument.body:I(e)&&Y(e)?e:Q(K(e))}function Z(e,t){void 0===t&&(t=[]);var n=Q(e),o="body"===U(n),r=R(n),i=o?[r].concat(r.visualViewport||[],Y(n)?n:[]):n,a=t.concat(i);return o?a:a.concat(Z(K(i)))}function ee(e){return["table","td","th"].indexOf(U(e))>=0}function te(e){return I(e)&&"fixed"!==X(e).position?e.offsetParent:null}function ne(e){for(var t=R(e),n=te(e);n&&ee(n);)n=te(n);return n&&"body"===U(n)&&"static"===X(n).position?t:n||t}var oe="top",re="bottom",ie="right",ae="left",se="auto",ce=[oe,re,ie,ae],fe="start",ue="end",le="viewport",pe="popper",de=ce.reduce((function(e,t){return e.concat([t+"-"+fe,t+"-"+ue])}),[]),me=[].concat(ce,[se]).reduce((function(e,t){return e.concat([t,t+"-"+fe,t+"-"+ue])}),[]),he=["beforeRead","read","afterRead","beforeMain","main","afterMain","beforeWrite","write","afterWrite"];function ge(e){var t=new Map,n=new Set,o=[];function r(e){n.add(e.name),[].concat(e.requires||[],e.requiresIfExists||[]).forEach((function(e){if(!n.has(e)){var o=t.get(e);o&&r(o)}})),o.push(e)}return e.forEach((function(e){t.set(e.name,e)})),e.forEach((function(e){n.has(e.name)||r(e)})),o}function ye(e){return e.split("-")[0]}var ve={placement:"bottom",modifiers:[],strategy:"absolute"};function be(){for(var e=arguments.length,t=new Array(e),n=0;n=0?"x":"y"}function $e(e){var t,n=e.reference,o=e.element,r=e.placement,i=r?ye(r):null,a=r?Oe(r):null,s=n.x+n.width/2-o.width/2,c=n.y+n.height/2-o.height/2;switch(i){case oe:t={x:s,y:n.y-o.height};break;case re:t={x:s,y:n.y+n.height};break;case ie:t={x:n.x+n.width,y:c};break;case ae:t={x:n.x-o.width,y:c};break;default:t={x:n.x,y:n.y}}var f=i?Ee(i):null;if(null!=f){var u="y"===f?"height":"width";switch(a){case fe:t[f]=Math.floor(t[f])-Math.floor(n[u]/2-o[u]/2);break;case ue:t[f]=Math.floor(t[f])+Math.ceil(n[u]/2-o[u]/2)}}return t}var ke={top:"auto",right:"auto",bottom:"auto",left:"auto"};function je(e){var t,n=e.popper,o=e.popperRect,r=e.placement,i=e.offsets,a=e.position,s=e.gpuAcceleration,c=e.adaptive,f=function(e){var t=e.x,n=e.y,o=window.devicePixelRatio||1;return{x:Math.round(t*o)/o||0,y:Math.round(n*o)/o||0}}(i),u=f.x,l=f.y,p=i.hasOwnProperty("x"),d=i.hasOwnProperty("y"),m=ae,h=oe,g=window;if(c){var y=ne(n);y===R(n)&&(y=z(n)),r===oe&&(h=re,l-=y.clientHeight-o.height,l*=s?1:-1),r===ae&&(m=ie,u-=y.clientWidth-o.width,u*=s?1:-1)}var v,b=Object.assign({position:a},c&&ke);return s?Object.assign({},b,((v={})[h]=d?"0":"",v[m]=p?"0":"",v.transform=(g.devicePixelRatio||1)<2?"translate("+u+"px, "+l+"px)":"translate3d("+u+"px, "+l+"px, 0)",v)):Object.assign({},b,((t={})[h]=d?l+"px":"",t[m]=p?u+"px":"",t.transform="",t))}var De={left:"right",right:"left",bottom:"top",top:"bottom"};function Me(e){return e.replace(/left|right|bottom|top/g,(function(e){return De[e]}))}var Ce={start:"end",end:"start"};function Le(e){return e.replace(/start|end/g,(function(e){return Ce[e]}))}function Pe(e){return parseFloat(e)||0}function Ae(e){var t=R(e),n=function(e){var t=I(e)?X(e):{};return{top:Pe(t.borderTopWidth),right:Pe(t.borderRightWidth),bottom:Pe(t.borderBottomWidth),left:Pe(t.borderLeftWidth)}}(e),o="html"===U(e),r=F(e),i=e.clientWidth+n.right,a=e.clientHeight+n.bottom;return o&&t.innerHeight-e.clientHeight>50&&(a=t.innerHeight-n.bottom),{top:o?0:e.clientTop,right:e.clientLeft>n.left?n.right:o?t.innerWidth-i-r:e.offsetWidth-i,bottom:o?t.innerHeight-a:e.offsetHeight-a,left:o?r:e.clientLeft}}function Be(e,t){var n=Boolean(t.getRootNode&&t.getRootNode().host);if(e.contains(t))return!0;if(n){var o=t;do{if(o&&e.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Se(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function _e(e,t){return t===le?Se(function(e){var t=R(e),n=t.visualViewport,o=t.innerWidth,r=t.innerHeight;return n&&/iPhone|iPod|iPad/.test(navigator.platform)&&(o=n.width,r=n.height),{width:o,height:r,x:0,y:0}}(e)):I(t)?H(t):Se(function(e){var t=R(e),n=q(e),o=G(z(e),t);return o.height=Math.max(o.height,t.innerHeight),o.width=Math.max(o.width,t.innerWidth),o.x=-n.scrollLeft,o.y=-n.scrollTop,o}(z(e)))}function We(e,t,n){var o="clippingParents"===t?function(e){var t=Z(e),n=["absolute","fixed"].indexOf(X(e).position)>=0&&I(e)?ne(e):e;return V(n)?t.filter((function(e){return V(e)&&Be(e,n)})):[]}(e):[].concat(t),r=[].concat(o,[n]),i=r[0],a=r.reduce((function(t,n){var o=_e(e,n),r=Ae(I(n)?n:z(e));return t.top=Math.max(o.top+r.top,t.top),t.right=Math.min(o.right-r.right,t.right),t.bottom=Math.min(o.bottom-r.bottom,t.bottom),t.left=Math.max(o.left+r.left,t.left),t}),_e(e,i));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function Ne(e){return Object.assign({},{top:0,right:0,bottom:0,left:0},{},e)}function Te(e,t){return t.reduce((function(t,n){return t[n]=e,t}),{})}function He(e,t){void 0===t&&(t={});var n=t,o=n.placement,r=void 0===o?e.placement:o,i=n.boundary,a=void 0===i?"clippingParents":i,s=n.rootBoundary,c=void 0===s?le:s,f=n.elementContext,u=void 0===f?pe:f,l=n.altBoundary,p=void 0!==l&&l,d=n.padding,m=void 0===d?0:d,h=Ne("number"!=typeof m?m:Te(m,ce)),g=u===pe?"reference":pe,y=e.elements.reference,v=e.rects.popper,b=e.elements[p?g:u],w=We(V(b)?b:b.contextElement||z(e.elements.popper),a,c),x=H(y),O=$e({reference:x,element:v,strategy:"absolute",placement:r}),E=Se(Object.assign({},v,{},O)),$=u===pe?E:x,k={top:w.top-$.top+h.top,bottom:$.bottom-w.bottom+h.bottom,left:w.left-$.left+h.left,right:$.right-w.right+h.right},j=e.modifiersData.offset;if(u===pe&&j){var D=j[r];Object.keys(k).forEach((function(e){var t=[ie,re].indexOf(e)>=0?1:-1,n=[oe,re].indexOf(e)>=0?"y":"x";k[e]+=D[n]*t}))}return k}function Re(e,t){void 0===t&&(t={});var n=t,o=n.placement,r=n.boundary,i=n.rootBoundary,a=n.padding,s=n.flipVariations,c=n.allowedAutoPlacements,f=void 0===c?me:c,u=Oe(o),l=(u?s?de:de.filter((function(e){return Oe(e)===u})):ce).filter((function(e){return f.indexOf(e)>=0})).reduce((function(t,n){return t[n]=He(e,{placement:n,boundary:r,rootBoundary:i,padding:a})[ye(n)],t}),{});return Object.keys(l).sort((function(e,t){return l[e]-l[t]}))}function qe(e,t,n){return Math.max(e,Math.min(t,n))}function Ve(e,t,n){return void 0===n&&(n={x:0,y:0}),{top:e.top-t.height-n.y,right:e.right-t.width+n.x,bottom:e.bottom-t.height+n.y,left:e.left-t.width-n.x}}function Ie(e){return[oe,ie,re,ae].some((function(t){return e[t]>=0}))}var Ue=we({defaultModifiers:[{name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:function(e){var t=e.state,n=e.instance,o=e.options,r=o.scroll,i=void 0===r||r,a=o.resize,s=void 0===a||a,c=R(t.elements.popper),f=[].concat(t.scrollParents.reference,t.scrollParents.popper);return i&&f.forEach((function(e){e.addEventListener("scroll",n.update,xe)})),s&&c.addEventListener("resize",n.update,xe),function(){i&&f.forEach((function(e){e.removeEventListener("scroll",n.update,xe)})),s&&c.removeEventListener("resize",n.update,xe)}},data:{}},{name:"popperOffsets",enabled:!0,phase:"read",fn:function(e){var t=e.state,n=e.name;t.modifiersData[n]=$e({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})},data:{}},{name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:function(e){var t=e.state,n=e.options,o=n.gpuAcceleration,r=void 0===o||o,i=n.adaptive,a=void 0===i||i,s={placement:ye(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r};null!=t.modifiersData.popperOffsets&&(t.styles.popper=Object.assign({},t.styles.popper,{},je(Object.assign({},s,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a})))),null!=t.modifiersData.arrow&&(t.styles.arrow=Object.assign({},t.styles.arrow,{},je(Object.assign({},s,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})},data:{}},{name:"applyStyles",enabled:!0,phase:"write",fn:function(e){var t=e.state;Object.keys(t.elements).forEach((function(e){var n=t.styles[e]||{},o=t.attributes[e]||{},r=t.elements[e];I(r)&&U(r)&&(Object.assign(r.style,n),Object.keys(o).forEach((function(e){var t=o[e];!1===t?r.removeAttribute(e):r.setAttribute(e,!0===t?"":t)})))}))},effect:function(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach((function(e){var o=t.elements[e],r=t.attributes[e]||{},i=Object.keys(t.styles.hasOwnProperty(e)?t.styles[e]:n[e]).reduce((function(e,t){return e[t]="",e}),{});I(o)&&U(o)&&(Object.assign(o.style,i),Object.keys(r).forEach((function(e){o.removeAttribute(e)})))}))}},requires:["computeStyles"]},{name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:function(e){var t=e.state,n=e.options,o=e.name,r=n.offset,i=void 0===r?[0,0]:r,a=me.reduce((function(e,n){return e[n]=function(e,t,n){var o=ye(e),r=[ae,oe].indexOf(o)>=0?-1:1,i="function"==typeof n?n(Object.assign({},t,{placement:e})):n,a=i[0],s=i[1];return a=a||0,s=(s||0)*r,[ae,ie].indexOf(o)>=0?{x:s,y:a}:{x:a,y:s}}(n,t.rects,i),e}),{}),s=a[t.placement],c=s.x,f=s.y;null!=t.modifiersData.popperOffsets&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=f),t.modifiersData[o]=a}},{name:"flip",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,o=e.name;if(!t.modifiersData[o]._skip){for(var r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0===a||a,c=n.fallbackPlacements,f=n.padding,u=n.boundary,l=n.rootBoundary,p=n.altBoundary,d=n.flipVariations,m=void 0===d||d,h=n.allowedAutoPlacements,g=t.options.placement,y=ye(g),v=c||(y===g||!m?[Me(g)]:function(e){if(ye(e)===se)return[];var t=Me(e);return[Le(e),t,Le(t)]}(g)),b=[g].concat(v).reduce((function(e,n){return e.concat(ye(n)===se?Re(t,{placement:n,boundary:u,rootBoundary:l,padding:f,flipVariations:m,allowedAutoPlacements:h}):n)}),[]),w=t.rects.reference,x=t.rects.popper,O=new Map,E=!0,$=b[0],k=0;k=0,L=C?"width":"height",P=He(t,{placement:j,boundary:u,rootBoundary:l,altBoundary:p,padding:f}),A=C?M?ie:ae:M?re:oe;w[L]>x[L]&&(A=Me(A));var B=Me(A),S=[];if(i&&S.push(P[D]<=0),s&&S.push(P[A]<=0,P[B]<=0),S.every((function(e){return e}))){$=j,E=!1;break}O.set(j,S)}if(E)for(var _=function(e){var t=b.find((function(t){var n=O.get(t);if(n)return n.slice(0,e).every((function(e){return e}))}));if(t)return $=t,"break"},W=m?3:1;W>0;W--){if("break"===_(W))break}t.placement!==$&&(t.modifiersData[o]._skip=!0,t.placement=$,t.reset=!0)}},requiresIfExists:["offset"],data:{_skip:!1}},{name:"preventOverflow",enabled:!0,phase:"main",fn:function(e){var t=e.state,n=e.options,o=e.name,r=n.mainAxis,i=void 0===r||r,a=n.altAxis,s=void 0!==a&&a,c=n.boundary,f=n.rootBoundary,u=n.altBoundary,l=n.padding,p=n.tether,d=void 0===p||p,m=n.tetherOffset,h=void 0===m?0:m,g=He(t,{boundary:c,rootBoundary:f,padding:l,altBoundary:u}),y=ye(t.placement),v=Oe(t.placement),b=!v,w=Ee(y),x="x"===w?"y":"x",O=t.modifiersData.popperOffsets,E=t.rects.reference,$=t.rects.popper,k="function"==typeof h?h(Object.assign({},t.rects,{placement:t.placement})):h,j={x:0,y:0};if(O){if(i){var D="y"===w?oe:ae,M="y"===w?re:ie,C="y"===w?"height":"width",L=O[w],P=O[w]+g[D],A=O[w]-g[M],B=d?-$[C]/2:0,S=v===fe?E[C]:$[C],_=v===fe?-$[C]:-E[C],W=t.elements.arrow,N=d&&W?J(W):{width:0,height:0},T=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:{top:0,right:0,bottom:0,left:0},H=T[D],R=T[M],q=qe(0,E[C],N[C]),V=b?E[C]/2-B-q-H-k:S-q-H-k,I=b?-E[C]/2+B+q+R+k:_+q+R+k,U=t.elements.arrow&&ne(t.elements.arrow),z=U?"y"===w?U.clientTop||0:U.clientLeft||0:0,F=t.modifiersData.offset?t.modifiersData.offset[t.placement][w]:0,X=O[w]+V-F-z,Y=O[w]+I-F,G=qe(d?Math.min(P,X):P,L,d?Math.max(A,Y):A);O[w]=G,j[w]=G-L}if(s){var K="x"===w?oe:ae,Q="x"===w?re:ie,Z=O[x],ee=qe(Z+g[K],Z,Z-g[Q]);O[x]=ee,j[x]=ee-Z}t.modifiersData[o]=j}},requiresIfExists:["offset"]},{name:"arrow",enabled:!0,phase:"main",fn:function(e){var t,n=e.state,o=e.name,r=n.elements.arrow,i=n.modifiersData.popperOffsets,a=ye(n.placement),s=Ee(a),c=[ae,ie].indexOf(a)>=0?"height":"width";if(r&&i){var f=n.modifiersData[o+"#persistent"].padding,u=J(r),l="y"===s?oe:ae,p="y"===s?re:ie,d=n.rects.reference[c]+n.rects.reference[s]-i[s]-n.rects.popper[c],m=i[s]-n.rects.reference[s],h=ne(r),g=h?"y"===s?h.clientHeight||0:h.clientWidth||0:0,y=d/2-m/2,v=f[l],b=g-u[c]-f[p],w=g/2-u[c]/2+y,x=qe(v,w,b),O=s;n.modifiersData[o]=((t={})[O]=x,t.centerOffset=x-w,t)}},effect:function(e){var t=e.state,n=e.options,o=e.name,r=n.element,i=void 0===r?"[data-popper-arrow]":r,a=n.padding,s=void 0===a?0:a;null!=i&&("string"!=typeof i||(i=t.elements.popper.querySelector(i)))&&Be(t.elements.popper,i)&&(t.elements.arrow=i,t.modifiersData[o+"#persistent"]={padding:Ne("number"!=typeof s?s:Te(s,ce))})},requires:["popperOffsets"],requiresIfExists:["preventOverflow"]},{name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:function(e){var t=e.state,n=e.name,o=t.rects.reference,r=t.rects.popper,i=t.modifiersData.preventOverflow,a=He(t,{elementContext:"reference"}),s=He(t,{altBoundary:!0}),c=Ve(a,o),f=Ve(s,r,i),u=Ie(c),l=Ie(f);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:f,isReferenceHidden:u,hasPopperEscaped:l},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":l})}}]});const ze=e=>({}),Fe=e=>({});function Xe(e){let t,n,o,r,i;const s=e[34].DropdownMenu,p=a(s,e,e[33],Fe);return{c(){t=l("div"),p&&p.c(),this.h()},l(e){t=h(e,"DIV",{class:!0,"aria-labelledby":!0});var n=m(t);p&&p.l(n),n.forEach(u),this.h()},h(){d(t,"class",n="dropdown-menu show "+e[1]),d(t,"aria-labelledby",e[3])},m(n,a){var s,c,u,l;f(n,t,a),p&&p.m(t,null),e[35](t),o=!0,r||(s=t,c="click",u=e[6],s.addEventListener(c,u,l),i=()=>s.removeEventListener(c,u,l),r=!0)},p(e,r){p&&p.p&&4&r[1]&&c(p,s,e,e[33],r,ze,Fe),(!o||2&r[0]&&n!==(n="dropdown-menu show "+e[1]))&&d(t,"class",n),(!o||8&r[0])&&d(t,"aria-labelledby",e[3])},i(e){o||(W(p,e),o=!0)},o(e){N(p,e),o=!1},d(n){n&&u(t),p&&p.d(n),e[35](null),r=!1,i()}}}function Ye(e){let t,n,r,i;const s=e[34].default,v=a(s,e,e[33],null);let b=e[0]&&Xe(e);return{c(){t=l("div"),v&&v.c(),n=p(" "),b&&b.c(),this.h()},l(e){t=h(e,"DIV",{class:!0});var o=m(t);v&&v.l(o),n=g(o),b&&b.l(o),o.forEach(u),this.h()},h(){d(t,"class",r=e[5]+" "+e[2]),y(t,"show",e[0])},m(e,o){f(e,t,o),v&&v.m(t,null),function(e,t){e.appendChild(t)}(t,n),b&&b.m(t,null),i=!0},p(e,n){v&&v.p&&4&n[1]&&c(v,s,e,e[33],n,null,null),e[0]?b?(b.p(e,n),1&n[0]&&W(b,1)):(b=Xe(e),b.c(),W(b,1),b.m(t,null)):b&&(_={r:0,c:[],p:_},N(b,1,1,(()=>{b=null})),_.r||o(_.c),_=_.p),(!i||36&n[0]&&r!==(r=e[5]+" "+e[2]))&&d(t,"class",r),37&n[0]&&y(t,"show",e[0])},i(e){i||(W(v,e),W(b),i=!0)},o(e){N(v,e),N(b),i=!1},d(e){e&&u(t),v&&v.d(e),b&&b.d()}}}const Ge="Escape",Je="ArrowUp",Ke="ArrowDown";function Qe(e,...t){return e.addEventListener(...t),{remove:()=>e.removeEventListener(...t)}}function Ze(e){if(!e)return!1;if(e.style&&e.parentNode&&e.parentNode.style){const t=getComputedStyle(e),n=getComputedStyle(e.parentNode);return"none"!==t.display&&"none"!==n.display&&"hidden"!==t.visibility}return!1}function et(e,t,n){const o=()=>{};let r,i,a,s,c,f,{open:u=!1}=t,{flip:l=!0}=t,{placement:p="bottom-start"}=t,{displayStatic:d=!1}=t,{keyboard:m=!0}=t,{insideClick:h=!1}=t,{closeOnOutsideClick:g=!0}=t,{offset:y=[0,2]}=t,{menuClasses:v=""}=t,{classes:b=""}=t,{triggerElement:x}=t,{onOpened:E=o}=t,{onClosed:$=o}=t,{labelledby:k=""}=t,j=[];const D=new RegExp("ArrowUp|ArrowDown|Escape"),C={top:"dropup",bottom:"dropdown",right:"dropright",left:"dropleft"};async function L(){await M(),i=Ue(x,r,{placement:p,modifiers:[{name:"flip",enabled:l},{name:"offset",options:{offset:y}},{name:"preventOverflow",options:{altBoundary:!0}}]})}async function P(){await M();const e=r.querySelectorAll(".dropdown-item:not(.disabled):not(:disabled)");j=[...e].filter(Ze)}function A(){m&&(s=Qe(document,"keydown",(e=>{if(!/input|textarea/i.test(e.target.tagName)&&D.test(e.key)){if(e.preventDefault(),e.stopPropagation(),e.key===Ge&&n(0,u=!1),!j.length)return;let t=j.indexOf(e.target);e.key===Je&&t>0&&t--,e.key===Ke&&t{e.target===r||r.contains(e.target)||n(0,u=!1)})))}async function S(){P(),A(),B(),d||L(),E()}function _(){s&&s.remove(),c&&c.remove(),N()}function W(){_(),$()}function N(){i&&(i.destroy(),i=null)}var T;T=async()=>{await M(),f=Qe(x,"click",(e=>{e.stopPropagation(),n(0,u=!u)}))},w().$$.on_mount.push(T),function(e){w().$$.on_destroy.push(e)}((()=>{_(),f.remove()}));let{$$slots:H={},$$scope:R}=t;return e.$set=e=>{"open"in e&&n(0,u=e.open),"flip"in e&&n(7,l=e.flip),"placement"in e&&n(8,p=e.placement),"displayStatic"in e&&n(9,d=e.displayStatic),"keyboard"in e&&n(10,m=e.keyboard),"insideClick"in e&&n(11,h=e.insideClick),"closeOnOutsideClick"in e&&n(12,g=e.closeOnOutsideClick),"offset"in e&&n(13,y=e.offset),"menuClasses"in e&&n(1,v=e.menuClasses),"classes"in e&&n(2,b=e.classes),"triggerElement"in e&&n(14,x=e.triggerElement),"onOpened"in e&&n(15,E=e.onOpened),"onClosed"in e&&n(16,$=e.onClosed),"labelledby"in e&&n(3,k=e.labelledby),"$$scope"in e&&n(33,R=e.$$scope)},e.$$.update=()=>{1&e.$$.dirty[0]&&(u?S():W()),256&e.$$.dirty[0]&&n(5,a=C[p.split("-")[0]])},[u,v,b,k,r,a,function(){h||n(0,u=!1)},l,p,d,m,h,g,y,x,E,$,i,s,c,f,j,o,D,C,L,P,A,B,S,_,W,N,R,H,function(e){O[e?"unshift":"push"]((()=>{n(4,r=e)}))}]}return class extends class{$destroy(){!function(e,t){const n=e.$$;null!==n.fragment&&(o(n.on_destroy),n.fragment&&n.fragment.d(t),n.on_destroy=n.fragment=null,n.ctx=[])}(this,1),this.$destroy=e}$on(e,t){const n=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return n.push(t),()=>{const e=n.indexOf(t);-1!==e&&n.splice(e,1)}}$set(){}}{constructor(e){super(),T(this,e,et,Ye,i,{open:0,flip:7,placement:8,displayStatic:9,keyboard:10,insideClick:11,closeOnOutsideClick:12,offset:13,menuClasses:1,classes:2,triggerElement:14,onOpened:15,onClosed:16,labelledby:3},[-1,-1])}}})); 2 | //# sourceMappingURL=index.js.map 3 | --------------------------------------------------------------------------------