@orangesk/orange-design-system 2.0.0-alpha.0 → 2.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/404.html +1 -1
- package/build/_next/static/CRhIjUFtohDOfdDfzvfXM/_buildManifest.js +1 -0
- package/build/_next/static/chunks/925.75d0c8afa7ab7cfa.js +1 -0
- package/build/_next/static/chunks/998-a45c3cf6f575e126.js +1 -0
- package/build/_next/static/chunks/app/components/alert/page-d591b03a7394f81e.js +1 -0
- package/build/_next/static/chunks/app/components/button/page-b922a8f5114b0a69.js +1 -0
- package/build/_next/static/chunks/app/components/buttons/page-0a5bf7e5ac7991fb.js +1 -0
- package/build/_next/static/chunks/app/components/icon/page-dac6ba29b85d924d.js +1 -0
- package/build/_next/static/chunks/app/components/modal/page-4a249b6d271eea91.js +1 -0
- package/build/_next/static/chunks/app/components/tabs/page-7d82e8eafd25b86e.js +1 -0
- package/build/_next/static/chunks/app/layout-f74d44a2772d8d63.js +1 -0
- package/build/_next/static/chunks/app/page-9efa16a51ef59461.js +1 -0
- package/build/_next/static/chunks/webpack-623f6e616651e1c0.js +1 -0
- package/build/_next/static/css/14f3a3e0186fb7a8.css +3 -0
- package/build/_next/static/css/168dd2b7e791cf72.css +1 -0
- package/build/_next/static/css/28a41a1d7dcdbfd9.css +1 -0
- package/build/_next/static/css/291602d64f1f3570.css +1 -0
- package/build/_next/static/css/4c4366b3963177f0.css +1 -0
- package/build/_next/static/css/5481aeac9adca710.css +1 -0
- package/build/_next/static/css/73b136688c14b891.css +1 -0
- package/build/_next/static/css/91c8cf755bf9ff19.css +1 -0
- package/build/_next/static/css/c1b0424033f305ff.css +1 -0
- package/build/_next/static/css/eea9fd9ccdd56c76.css +1 -0
- package/build/_next/static/media/671791babd225be4-s.p.woff2 +0 -0
- package/build/_next/static/media/c62d990acddde5f0-s.p.woff2 +0 -0
- package/build/_next/static/media/dfdbb1c4973e0bd7-s.p.woff2 +0 -0
- package/build/components/Accordion/index.js +1170 -0
- package/build/components/Accordion/index.js.map +1 -0
- package/build/components/Accordion/style.css +2 -0
- package/build/components/Accordion/style.css.map +1 -0
- package/build/components/Alert/index.js +1920 -0
- package/build/components/Alert/index.js.map +1 -0
- package/build/components/Alert/style.css +2 -0
- package/build/components/Alert/style.css.map +1 -0
- package/build/components/Badge/index.js +6 -3
- package/build/components/Badge/index.js.map +1 -1
- package/build/components/Badge/style.css +1 -1
- package/build/components/Badge/style.css.map +1 -1
- package/build/components/Breadcrumbs/index.js +687 -0
- package/build/components/Breadcrumbs/index.js.map +1 -0
- package/build/components/Breadcrumbs/style.css +2 -0
- package/build/components/Breadcrumbs/style.css.map +1 -0
- package/build/components/Button/index.js +734 -0
- package/build/components/Button/index.js.map +1 -0
- package/build/components/Button/style.css +2 -0
- package/build/components/Button/style.css.map +1 -0
- package/build/components/Buttons/index.js +614 -0
- package/build/components/Buttons/index.js.map +1 -0
- package/build/components/Buttons/style.css +2 -0
- package/build/components/Buttons/style.css.map +1 -0
- package/build/components/Container/index.js +611 -0
- package/build/components/Container/index.js.map +1 -0
- package/build/components/Container/style.css +2 -0
- package/build/components/Container/style.css.map +1 -0
- package/build/components/Grid/index.js +1082 -0
- package/build/components/Grid/index.js.map +1 -0
- package/build/components/Grid/style.css +2 -0
- package/build/components/Grid/style.css.map +1 -0
- package/build/components/Icon/index.js +628 -0
- package/build/components/Icon/index.js.map +1 -0
- package/build/components/Icon/style.css +2 -0
- package/build/components/Icon/style.css.map +1 -0
- package/build/components/Image/index.js +659 -0
- package/build/components/Image/index.js.map +1 -0
- package/build/components/Image/style.css +2 -0
- package/build/components/Image/style.css.map +1 -0
- package/build/components/Link/index.js +173 -0
- package/build/components/Link/index.js.map +1 -0
- package/build/components/Link/style.css +2 -0
- package/build/components/Link/style.css.map +1 -0
- package/build/components/Modal/index.js +3170 -0
- package/build/components/Modal/index.js.map +1 -0
- package/build/components/Modal/style.css +2 -0
- package/build/components/Modal/style.css.map +1 -0
- package/build/components/Section/index.js +632 -0
- package/build/components/Section/index.js.map +1 -0
- package/build/components/Section/style.css +2 -0
- package/build/components/Section/style.css.map +1 -0
- package/build/components/Tabs/index.js +1056 -0
- package/build/components/Tabs/index.js.map +1 -0
- package/build/components/Tabs/style.css +2 -0
- package/build/components/Tabs/style.css.map +1 -0
- package/build/components/alert.html +2 -0
- package/build/components/alert.txt +30 -0
- package/build/components/badge.html +4 -1
- package/build/components/badge.txt +23 -18
- package/build/components/button.html +2 -0
- package/build/components/button.txt +27 -0
- package/build/components/buttons.html +1 -0
- package/build/components/buttons.txt +27 -0
- package/build/components/icon.html +1 -0
- package/build/components/icon.txt +23 -0
- package/build/components/index.css +1 -1
- package/build/components/index.css.map +1 -1
- package/build/components/index.js +3079 -17
- package/build/components/index.js.map +1 -1
- package/build/components/modal.html +1 -0
- package/build/components/modal.txt +29 -0
- package/build/components/static.js +1261 -17
- package/build/components/static.js.map +1 -1
- package/build/components/tabs.html +1 -0
- package/build/components/tabs.txt +27 -0
- package/build/components/types/components/Alert/Alert.d.ts +25 -0
- package/build/components/types/components/Alert/data.d.ts +7 -0
- package/build/components/types/components/Alert/index.d.ts +2 -0
- package/build/components/types/{Badge → components/Badge}/Badge.d.ts +2 -2
- package/build/components/types/components/Badge/index.d.ts +2 -0
- package/build/components/types/components/Button/Button.d.ts +25 -0
- package/build/components/types/components/Button/IconButton.d.ts +18 -0
- package/build/components/types/components/Button/index.d.ts +17 -0
- package/build/components/types/components/Buttons/Buttons.d.ts +8 -0
- package/build/components/types/components/Buttons/index.d.ts +2 -0
- package/build/components/types/components/Container/Container.d.ts +6 -0
- package/build/components/types/components/Container/index.d.ts +3 -0
- package/build/components/types/components/Icon/Icon.d.ts +18 -0
- package/build/components/types/components/Icon/SpritePathContext.d.ts +8 -0
- package/build/components/types/components/Icon/index.d.ts +3 -0
- package/build/components/types/components/Modal/Modal.d.ts +33 -0
- package/build/components/types/components/Modal/Modal.static.d.ts +33 -0
- package/build/components/types/components/Modal/ModalBody.d.ts +10 -0
- package/build/components/types/components/Modal/ModalCloseButton.d.ts +8 -0
- package/build/components/types/components/Modal/ModalTitle.d.ts +9 -0
- package/build/components/types/components/Modal/index.d.ts +5 -0
- package/build/components/types/components/Section/Section.d.ts +23 -0
- package/build/components/types/components/Section/index.d.ts +2 -0
- package/build/components/types/components/Tabs/Tab.d.ts +13 -0
- package/build/components/types/components/Tabs/TabPanel.d.ts +14 -0
- package/build/components/types/components/Tabs/Tabs.d.ts +33 -0
- package/build/components/types/components/Tabs/Tabs.static.d.ts +28 -0
- package/build/components/types/components/Tabs/index.d.ts +4 -0
- package/build/components/types/components/index.d.ts +11 -0
- package/build/components/types/utils/ConditionalWrapper.d.ts +13 -0
- package/build/components/types/utils/constants.d.ts +18 -0
- package/build/components/types/utils/generateId.d.ts +6 -0
- package/build/components/types/utils/hooks.d.ts +29 -0
- package/build/components/types/utils/keyboard.d.ts +14 -0
- package/build/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/build/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/build/index.html +11 -46
- package/build/index.txt +22 -17
- package/build/lib/after-components.css +1 -1
- package/build/lib/after-components.css.map +1 -1
- package/build/lib/before-components.css +1 -1
- package/build/lib/before-components.css.map +1 -1
- package/build/lib/components.css +1 -1
- package/build/lib/components.css.map +1 -1
- package/build/lib/fonts.css +1 -1
- package/build/lib/fonts.css.map +1 -1
- package/build/lib/scripts.js +1261 -17
- package/build/lib/scripts.js.map +1 -1
- package/build/lib/style.css +1 -1
- package/build/lib/style.css.map +1 -1
- package/build/sprite.svg +1 -0
- package/package.json +8 -4
- package/public/fonts/HelveticaNeue-Bold.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Light.woff2 +0 -0
- package/public/fonts/HelveticaNeue-Roman.woff2 +0 -0
- package/src/assets/icons/4g.svg +1 -0
- package/src/assets/icons/5g.svg +1 -0
- package/src/assets/icons/accessibility-mobility.svg +1 -0
- package/src/assets/icons/accessibility-motor.svg +1 -0
- package/src/assets/icons/accessibility-vision.svg +1 -0
- package/src/assets/icons/accessibility.svg +1 -0
- package/src/assets/icons/add.svg +1 -0
- package/src/assets/icons/advertising.svg +1 -0
- package/src/assets/icons/aeroplane.svg +1 -0
- package/src/assets/icons/age-rating-3.svg +1 -0
- package/src/assets/icons/airbox-auto.svg +1 -0
- package/src/assets/icons/alias-numbers.svg +1 -0
- package/src/assets/icons/android-manage.svg +1 -0
- package/src/assets/icons/antenna.svg +1 -0
- package/src/assets/icons/apartment-building.svg +1 -0
- package/src/assets/icons/apps.svg +1 -0
- package/src/assets/icons/assistance.svg +1 -0
- package/src/assets/icons/assistent.svg +1 -0
- package/src/assets/icons/at.svg +1 -0
- package/src/assets/icons/avatar.svg +1 -0
- package/src/assets/icons/backup-internet.svg +1 -0
- package/src/assets/icons/bank.svg +1 -0
- package/src/assets/icons/battery-charging.svg +1 -0
- package/src/assets/icons/battery-full.svg +1 -0
- package/src/assets/icons/battery-status-1-3.svg +1 -0
- package/src/assets/icons/battery-status-charging.svg +1 -0
- package/src/assets/icons/battery-status-full.svg +1 -0
- package/src/assets/icons/bed.svg +1 -0
- package/src/assets/icons/birth.svg +1 -0
- package/src/assets/icons/birthday.svg +1 -0
- package/src/assets/icons/bluetooth.svg +1 -0
- package/src/assets/icons/boarding-pass.svg +1 -0
- package/src/assets/icons/book-award.svg +1 -0
- package/src/assets/icons/book.svg +1 -0
- package/src/assets/icons/boxes.svg +1 -0
- package/src/assets/icons/briefcase.svg +1 -0
- package/src/assets/icons/browser-plug-in.svg +1 -0
- package/src/assets/icons/business-advisor.svg +1 -0
- package/src/assets/icons/business-consultant.svg +1 -0
- package/src/assets/icons/business-lounge.svg +1 -0
- package/src/assets/icons/buy.svg +1 -0
- package/src/assets/icons/calendar-30.svg +1 -0
- package/src/assets/icons/calendar-alarm.svg +1 -0
- package/src/assets/icons/calendar-day.svg +1 -0
- package/src/assets/icons/calendar-month.svg +1 -0
- package/src/assets/icons/call-in.svg +1 -0
- package/src/assets/icons/call-out.svg +1 -0
- package/src/assets/icons/call.svg +1 -0
- package/src/assets/icons/camera.svg +1 -0
- package/src/assets/icons/car-park.svg +1 -0
- package/src/assets/icons/car.svg +1 -0
- package/src/assets/icons/card-reader.svg +1 -0
- package/src/assets/icons/casting.svg +1 -0
- package/src/assets/icons/cest-ici.svg +1 -0
- package/src/assets/icons/charger.svg +1 -0
- package/src/assets/icons/chatbot.svg +1 -0
- package/src/assets/icons/check-your-balance.svg +1 -0
- package/src/assets/icons/checked.svg +1 -0
- package/src/assets/icons/chevron-down.svg +1 -0
- package/src/assets/icons/chevron-end.svg +1 -0
- package/src/assets/icons/chevron-left.svg +1 -0
- package/src/assets/icons/chevron-right.svg +1 -0
- package/src/assets/icons/chevron-start.svg +1 -0
- package/src/assets/icons/chevron-up.svg +1 -0
- package/src/assets/icons/child.svg +1 -0
- package/src/assets/icons/children-channel.svg +1 -0
- package/src/assets/icons/childrens-content.svg +1 -0
- package/src/assets/icons/christmas-tree.svg +1 -0
- package/src/assets/icons/cinema-ticket-2-for-1.svg +1 -0
- package/src/assets/icons/cle-pc.svg +1 -0
- package/src/assets/icons/clock.svg +1 -0
- package/src/assets/icons/close.svg +5 -0
- package/src/assets/icons/closed-captions.svg +1 -0
- package/src/assets/icons/cloud-backup.svg +1 -0
- package/src/assets/icons/cloud-security.svg +1 -0
- package/src/assets/icons/collective-class-training.svg +1 -0
- package/src/assets/icons/community-sms.svg +1 -0
- package/src/assets/icons/company-structure.svg +1 -0
- package/src/assets/icons/connections.svg +1 -0
- package/src/assets/icons/control-centre.svg +1 -0
- package/src/assets/icons/control-my-data.svg +3 -0
- package/src/assets/icons/cpu.svg +1 -0
- package/src/assets/icons/currency-euro.svg +1 -0
- package/src/assets/icons/cyber-shield.svg +1 -0
- package/src/assets/icons/dashboard-display.svg +1 -0
- package/src/assets/icons/data-analytics.svg +1 -0
- package/src/assets/icons/data-centre.svg +1 -0
- package/src/assets/icons/data-services.svg +1 -0
- package/src/assets/icons/data-traffic.svg +1 -0
- package/src/assets/icons/data.svg +1 -0
- package/src/assets/icons/delete.svg +1 -0
- package/src/assets/icons/desk-phone.svg +1 -0
- package/src/assets/icons/desktop-pc.svg +1 -0
- package/src/assets/icons/device-fixed-line-phone.svg +1 -0
- package/src/assets/icons/device-laptop-computer-connected.svg +1 -0
- package/src/assets/icons/device-laptop-computer.svg +1 -0
- package/src/assets/icons/device-smart-phone.svg +1 -0
- package/src/assets/icons/device-tablet.svg +1 -0
- package/src/assets/icons/device-tv.svg +1 -0
- package/src/assets/icons/diagnostic.svg +1 -0
- package/src/assets/icons/digital-frame.svg +1 -0
- package/src/assets/icons/discussion-more.svg +1 -0
- package/src/assets/icons/doctor.svg +1 -0
- package/src/assets/icons/documentary.svg +1 -0
- package/src/assets/icons/donation.svg +1 -0
- package/src/assets/icons/download-file.svg +1 -0
- package/src/assets/icons/download.svg +1 -0
- package/src/assets/icons/e-reader.svg +1 -0
- package/src/assets/icons/e-shop.svg +1 -0
- package/src/assets/icons/easy-internet.svg +1 -0
- package/src/assets/icons/eco-mode.svg +1 -0
- package/src/assets/icons/edit.svg +1 -0
- package/src/assets/icons/electrcar.svg +1 -0
- package/src/assets/icons/email.svg +1 -0
- package/src/assets/icons/employees.svg +1 -0
- package/src/assets/icons/empty-trash.svg +1 -0
- package/src/assets/icons/entertainment.svg +1 -0
- package/src/assets/icons/epg.svg +1 -0
- package/src/assets/icons/error-severe.svg +1 -0
- package/src/assets/icons/ethernet.svg +1 -0
- package/src/assets/icons/euro.svg +1 -0
- package/src/assets/icons/exit.svg +1 -0
- package/src/assets/icons/facebook-2.svg +1 -0
- package/src/assets/icons/facebook.svg +1 -0
- package/src/assets/icons/factory.svg +1 -0
- package/src/assets/icons/family-place.svg +1 -0
- package/src/assets/icons/fashion.svg +1 -0
- package/src/assets/icons/fast-delivery.svg +1 -0
- package/src/assets/icons/file-compressed.svg +1 -0
- package/src/assets/icons/file-copy.svg +1 -0
- package/src/assets/icons/file-document-compose.svg +1 -0
- package/src/assets/icons/file-download.svg +1 -0
- package/src/assets/icons/file-draft-edit.svg +1 -0
- package/src/assets/icons/file-pdf.svg +1 -0
- package/src/assets/icons/file-terms-and-conditions.svg +1 -0
- package/src/assets/icons/files.svg +1 -0
- package/src/assets/icons/film.svg +1 -0
- package/src/assets/icons/filter.svg +1 -0
- package/src/assets/icons/finance.svg +1 -0
- package/src/assets/icons/firewall.svg +1 -0
- package/src/assets/icons/flag.svg +1 -0
- package/src/assets/icons/flashlight.svg +1 -0
- package/src/assets/icons/flexible-storage.svg +1 -0
- package/src/assets/icons/folder.svg +1 -0
- package/src/assets/icons/football-match.svg +1 -0
- package/src/assets/icons/football-quiz.svg +1 -0
- package/src/assets/icons/football.svg +1 -0
- package/src/assets/icons/form-tick.svg +1 -0
- package/src/assets/icons/front-end-dashboard.svg +1 -0
- package/src/assets/icons/funny.svg +1 -0
- package/src/assets/icons/futher-education.svg +1 -0
- package/src/assets/icons/games.svg +1 -0
- package/src/assets/icons/garage-closed.svg +1 -0
- package/src/assets/icons/gauge-rate.svg +1 -0
- package/src/assets/icons/gears.svg +1 -0
- package/src/assets/icons/geolocation.svg +1 -0
- package/src/assets/icons/guide-info.svg +1 -0
- package/src/assets/icons/hammer.svg +1 -0
- package/src/assets/icons/hand-shake.svg +1 -0
- package/src/assets/icons/hard-drive.svg +1 -0
- package/src/assets/icons/hdmi-key.svg +1 -0
- package/src/assets/icons/headphones.svg +1 -0
- package/src/assets/icons/health-app.svg +1 -0
- package/src/assets/icons/health-monitor.svg +1 -0
- package/src/assets/icons/health-patient.svg +1 -0
- package/src/assets/icons/heart.svg +1 -0
- package/src/assets/icons/home-appliance.svg +1 -0
- package/src/assets/icons/home.svg +1 -0
- package/src/assets/icons/homelive.svg +1 -0
- package/src/assets/icons/hourglass.svg +1 -0
- package/src/assets/icons/house.svg +1 -0
- package/src/assets/icons/id-card.svg +1 -0
- package/src/assets/icons/image.svg +1 -0
- package/src/assets/icons/important.svg +1 -0
- package/src/assets/icons/improvement.svg +1 -0
- package/src/assets/icons/inbox.svg +1 -0
- package/src/assets/icons/info.svg +1 -0
- package/src/assets/icons/information-data.svg +1 -0
- package/src/assets/icons/instagram.svg +1 -0
- package/src/assets/icons/international-globe.svg +1 -0
- package/src/assets/icons/internet-browser.svg +1 -0
- package/src/assets/icons/internet-security-desktop.svg +1 -0
- package/src/assets/icons/internet-security-mobile.svg +1 -0
- package/src/assets/icons/internet-security-password.svg +1 -0
- package/src/assets/icons/internet-usage.svg +1 -0
- package/src/assets/icons/internet.svg +1 -0
- package/src/assets/icons/invoice-euro.svg +1 -0
- package/src/assets/icons/invoices-euro.svg +1 -0
- package/src/assets/icons/iso.svg +1 -0
- package/src/assets/icons/it-infrastructure.svg +1 -0
- package/src/assets/icons/keyboard.svg +1 -0
- package/src/assets/icons/la-cle-tv.svg +1 -0
- package/src/assets/icons/laptop-connected.svg +1 -0
- package/src/assets/icons/laptop.svg +1 -0
- package/src/assets/icons/le-vote.svg +1 -0
- package/src/assets/icons/link.svg +1 -0
- package/src/assets/icons/linkedin-2.svg +1 -0
- package/src/assets/icons/linkedin.svg +1 -0
- package/src/assets/icons/location-on-map.svg +1 -0
- package/src/assets/icons/location-pin.svg +1 -0
- package/src/assets/icons/lock-open.svg +1 -0
- package/src/assets/icons/lock.svg +1 -0
- package/src/assets/icons/logistics.svg +1 -0
- package/src/assets/icons/love-logo.svg +1 -0
- package/src/assets/icons/mahali.svg +1 -0
- package/src/assets/icons/maintenance-man.svg +1 -0
- package/src/assets/icons/map-pin.svg +1 -0
- package/src/assets/icons/map.svg +1 -0
- package/src/assets/icons/medal.svg +1 -0
- package/src/assets/icons/medical-app.svg +1 -0
- package/src/assets/icons/medical-chart.svg +1 -0
- package/src/assets/icons/medicine.svg +1 -0
- package/src/assets/icons/menu-arrow.svg +1 -0
- package/src/assets/icons/menu-grid.svg +1 -0
- package/src/assets/icons/menu.svg +1 -0
- package/src/assets/icons/message-alert.svg +1 -0
- package/src/assets/icons/messages.svg +1 -0
- package/src/assets/icons/micro-sd-card.svg +1 -0
- package/src/assets/icons/microphone-mute.svg +1 -0
- package/src/assets/icons/microphone.svg +1 -0
- package/src/assets/icons/mini-games.svg +1 -0
- package/src/assets/icons/mobile-applications.svg +1 -0
- package/src/assets/icons/mobile-data-toggle.svg +1 -0
- package/src/assets/icons/mobile-insurance.svg +1 -0
- package/src/assets/icons/mobile-network-coverage.svg +1 -0
- package/src/assets/icons/mobile-payment.svg +1 -0
- package/src/assets/icons/mobile-security.svg +1 -0
- package/src/assets/icons/mobile-setup.svg +1 -0
- package/src/assets/icons/modem.svg +1 -0
- package/src/assets/icons/modifier-delete.svg +1 -0
- package/src/assets/icons/modifier-done.svg +1 -0
- package/src/assets/icons/modifier-download.svg +1 -0
- package/src/assets/icons/modifier-upload.svg +1 -0
- package/src/assets/icons/money-box.svg +1 -0
- package/src/assets/icons/more-dots.svg +1 -0
- package/src/assets/icons/multi-sim.svg +1 -0
- package/src/assets/icons/music.svg +1 -0
- package/src/assets/icons/my-account.svg +1 -0
- package/src/assets/icons/my-orange.svg +1 -0
- package/src/assets/icons/my-skills.svg +1 -0
- package/src/assets/icons/my-vacation.svg +1 -0
- package/src/assets/icons/network-dslam.svg +1 -0
- package/src/assets/icons/network-gatekeeper.svg +1 -0
- package/src/assets/icons/network-gateway.svg +1 -0
- package/src/assets/icons/network-optical-amplifier.svg +1 -0
- package/src/assets/icons/network-optical-transport.svg +1 -0
- package/src/assets/icons/network-wan-optimisation-engine.svg +1 -0
- package/src/assets/icons/networks.svg +1 -0
- package/src/assets/icons/newspaper.svg +1 -0
- package/src/assets/icons/not-checked.svg +1 -0
- package/src/assets/icons/notification-alert.svg +1 -0
- package/src/assets/icons/office.svg +1 -0
- package/src/assets/icons/online-help.svg +1 -0
- package/src/assets/icons/orange-assistant.svg +1 -0
- package/src/assets/icons/orange-cash.svg +1 -0
- package/src/assets/icons/orange-detente.svg +1 -0
- package/src/assets/icons/orange-dialler.svg +1 -0
- package/src/assets/icons/orange-events.svg +1 -0
- package/src/assets/icons/orange-experts-expert.svg +1 -0
- package/src/assets/icons/orange-experts-insurance.svg +1 -0
- package/src/assets/icons/orange-experts-orange-business-consultant.svg +1 -0
- package/src/assets/icons/orange-experts-recycle.svg +1 -0
- package/src/assets/icons/orange-experts-repair.svg +1 -0
- package/src/assets/icons/orange-football-club.svg +1 -0
- package/src/assets/icons/orange-games.svg +1 -0
- package/src/assets/icons/orange-messenger.svg +1 -0
- package/src/assets/icons/orange-money-nfc.svg +1 -0
- package/src/assets/icons/orange-reflect.svg +1 -0
- package/src/assets/icons/orange-rewards.svg +1 -0
- package/src/assets/icons/orange-tv.svg +1 -0
- package/src/assets/icons/orange-vr-experience.svg +1 -0
- package/src/assets/icons/outbox.svg +1 -0
- package/src/assets/icons/package-content.svg +1 -0
- package/src/assets/icons/package-services.svg +1 -0
- package/src/assets/icons/package.svg +1 -0
- package/src/assets/icons/packaging-icon-hd.svg +1 -0
- package/src/assets/icons/parabole-tv.svg +1 -0
- package/src/assets/icons/parental-control.svg +1 -0
- package/src/assets/icons/pause.svg +1 -0
- package/src/assets/icons/payment-card.svg +1 -0
- package/src/assets/icons/payment-euro.svg +1 -0
- package/src/assets/icons/pda.svg +1 -0
- package/src/assets/icons/pdf-file.svg +1 -0
- package/src/assets/icons/pencil.svg +1 -0
- package/src/assets/icons/personal-hotspot.svg +1 -0
- package/src/assets/icons/personal-smartphone-trainer.svg +1 -0
- package/src/assets/icons/phone-advisor.svg +1 -0
- package/src/assets/icons/play-and-win.svg +1 -0
- package/src/assets/icons/play.svg +1 -0
- package/src/assets/icons/plug-socket.svg +1 -0
- package/src/assets/icons/power.svg +1 -0
- package/src/assets/icons/powerstation.svg +1 -0
- package/src/assets/icons/presentation.svg +1 -0
- package/src/assets/icons/print.svg +1 -0
- package/src/assets/icons/printer.svg +1 -0
- package/src/assets/icons/real-time.svg +1 -0
- package/src/assets/icons/recycle-device.svg +1 -0
- package/src/assets/icons/recycle.svg +1 -0
- package/src/assets/icons/reduction.svg +1 -0
- package/src/assets/icons/reload.svg +1 -0
- package/src/assets/icons/reminders.svg +1 -0
- package/src/assets/icons/remote-desktop-protocol.svg +1 -0
- package/src/assets/icons/remove.svg +1 -0
- package/src/assets/icons/repair.svg +1 -0
- package/src/assets/icons/reseau.svg +1 -0
- package/src/assets/icons/restaurant.svg +1 -0
- package/src/assets/icons/rewards.svg +1 -0
- package/src/assets/icons/running.svg +1 -0
- package/src/assets/icons/safety.svg +1 -0
- package/src/assets/icons/satallite.svg +1 -0
- package/src/assets/icons/save.svg +1 -0
- package/src/assets/icons/school.svg +1 -0
- package/src/assets/icons/science.svg +1 -0
- package/src/assets/icons/sd-card.svg +1 -0
- package/src/assets/icons/search.svg +1 -0
- package/src/assets/icons/security-status-good.svg +1 -0
- package/src/assets/icons/send.svg +1 -0
- package/src/assets/icons/senior-person.svg +1 -0
- package/src/assets/icons/server-storage-array.svg +1 -0
- package/src/assets/icons/server-tower.svg +1 -0
- package/src/assets/icons/session-enter.svg +1 -0
- package/src/assets/icons/session-leave.svg +1 -0
- package/src/assets/icons/settings.svg +1 -0
- package/src/assets/icons/share.svg +1 -0
- package/src/assets/icons/shop-pin.svg +1 -0
- package/src/assets/icons/shop.svg +1 -0
- package/src/assets/icons/showroom-mobile-pro.svg +1 -0
- package/src/assets/icons/signal-5-5.svg +1 -0
- package/src/assets/icons/silence.svg +1 -0
- package/src/assets/icons/sim-e.svg +1 -0
- package/src/assets/icons/sim.svg +1 -0
- package/src/assets/icons/simple-mode.svg +1 -0
- package/src/assets/icons/simplicity.svg +1 -0
- package/src/assets/icons/siren.svg +1 -0
- package/src/assets/icons/skiing.svg +1 -0
- package/src/assets/icons/skip-to-end.svg +1 -0
- package/src/assets/icons/skip-to-start.svg +1 -0
- package/src/assets/icons/sleep.svg +1 -0
- package/src/assets/icons/smart-care.svg +1 -0
- package/src/assets/icons/smart-home.svg +1 -0
- package/src/assets/icons/smart-tap.svg +1 -0
- package/src/assets/icons/smart-watch.svg +1 -0
- package/src/assets/icons/sms-alert.svg +1 -0
- package/src/assets/icons/sms-message-compose.svg +1 -0
- package/src/assets/icons/sms-message.svg +1 -0
- package/src/assets/icons/social-network.svg +1 -0
- package/src/assets/icons/sofa.svg +1 -0
- package/src/assets/icons/sort.svg +1 -0
- package/src/assets/icons/stadium.svg +1 -0
- package/src/assets/icons/star-empty.svg +1 -0
- package/src/assets/icons/star-favourite-half.svg +1 -0
- package/src/assets/icons/star-favourite.svg +1 -0
- package/src/assets/icons/startover.svg +1 -0
- package/src/assets/icons/statistics.svg +1 -0
- package/src/assets/icons/stop-secret.svg +1 -0
- package/src/assets/icons/storage-cloud.svg +1 -0
- package/src/assets/icons/store-locator.svg +1 -0
- package/src/assets/icons/street.svg +1 -0
- package/src/assets/icons/subscription-package.svg +1 -0
- package/src/assets/icons/suitcase.svg +1 -0
- package/src/assets/icons/support.svg +1 -0
- package/src/assets/icons/surveillance-camera.svg +1 -0
- package/src/assets/icons/syncronise.svg +1 -0
- package/src/assets/icons/tag-advertising.svg +1 -0
- package/src/assets/icons/tag.svg +1 -0
- package/src/assets/icons/target-location.svg +1 -0
- package/src/assets/icons/tarif.svg +1 -0
- package/src/assets/icons/task-list.svg +1 -0
- package/src/assets/icons/team-connect.svg +1 -0
- package/src/assets/icons/thumb-up.svg +1 -0
- package/src/assets/icons/tick.svg +1 -0
- package/src/assets/icons/ticket.svg +1 -0
- package/src/assets/icons/top-up-card-euro.svg +1 -0
- package/src/assets/icons/top-up-euro.svg +1 -0
- package/src/assets/icons/top-up-time.svg +1 -0
- package/src/assets/icons/town.svg +1 -0
- package/src/assets/icons/townhall.svg +1 -0
- package/src/assets/icons/train.svg +1 -0
- package/src/assets/icons/training-session.svg +1 -0
- package/src/assets/icons/tranquility.svg +1 -0
- package/src/assets/icons/transfer-data.svg +1 -0
- package/src/assets/icons/transfers.svg +1 -0
- package/src/assets/icons/trash.svg +1 -0
- package/src/assets/icons/tv-channel-list.svg +1 -0
- package/src/assets/icons/tv-commande.svg +1 -0
- package/src/assets/icons/unlimited-calls.svg +1 -0
- package/src/assets/icons/upload.svg +1 -0
- package/src/assets/icons/usb-hard-drive.svg +1 -0
- package/src/assets/icons/usb-key.svg +1 -0
- package/src/assets/icons/user-manual.svg +1 -0
- package/src/assets/icons/user.svg +1 -0
- package/src/assets/icons/video-call.svg +1 -0
- package/src/assets/icons/video-live.svg +1 -0
- package/src/assets/icons/video-phone.svg +1 -0
- package/src/assets/icons/video-record.svg +1 -0
- package/src/assets/icons/video.svg +1 -0
- package/src/assets/icons/vip-contact.svg +1 -0
- package/src/assets/icons/virtual-gamepad.svg +1 -0
- package/src/assets/icons/vod-portrait.svg +1 -0
- package/src/assets/icons/volte.svg +1 -0
- package/src/assets/icons/volume-status-4-4.svg +1 -0
- package/src/assets/icons/vowifi.svg +1 -0
- package/src/assets/icons/wallet.svg +1 -0
- package/src/assets/icons/warning-important.svg +1 -0
- package/src/assets/icons/washroom.svg +1 -0
- package/src/assets/icons/watch.svg +1 -0
- package/src/assets/icons/water.svg +1 -0
- package/src/assets/icons/weather.svg +1 -0
- package/src/assets/icons/web-browser.svg +1 -0
- package/src/assets/icons/web-camera.svg +1 -0
- package/src/assets/icons/weighing-scales.svg +1 -0
- package/src/assets/icons/widget.svg +1 -0
- package/src/assets/icons/wifi-home.svg +1 -0
- package/src/assets/icons/wifi.svg +1 -0
- package/src/assets/icons/x.svg +1 -0
- package/src/assets/icons/your-balance.svg +1 -0
- package/src/assets/icons/youtube.svg +1 -0
- package/src/assets/icons/zoom-in.svg +1 -0
- package/src/assets/icons/zoom-out.svg +1 -0
- package/src/assets/images/developers/hands-with-phones.svg +90 -0
- package/src/assets/images/developers/iphone-size-2x.png +0 -0
- package/src/assets/images/developers/iphone-xr-white-select.png +0 -0
- package/src/assets/images/developers/phones.png +0 -0
- package/src/assets/images/developers/router.png +0 -0
- package/src/assets/images/developers/rule-component-block.png +0 -0
- package/src/assets/images/developers/rule-component-inline.png +0 -0
- package/src/assets/images/developers/rule-container.png +0 -0
- package/src/assets/images/developers/rule-content.png +0 -0
- package/src/assets/images/developers/two-phones.png +0 -0
- package/src/assets/logo/logo.svg +1 -0
- package/src/components/Accordion/Accordion.mdx +222 -0
- package/src/components/Accordion/Accordion.static.ts +104 -0
- package/src/components/Accordion/Accordion.tsx +70 -0
- package/src/components/Accordion/AccordionHeader.tsx +59 -0
- package/src/components/Accordion/AccordionItem.tsx +76 -0
- package/src/components/Accordion/HeadingContext.tsx +5 -0
- package/src/components/Accordion/index.ts +4 -0
- package/src/components/Accordion/styles/config.scss +8 -0
- package/src/components/Accordion/styles/mixins.scss +91 -0
- package/src/components/Accordion/styles/style.scss +47 -0
- package/src/components/Accordion/tests/Accordion.static.test.js +207 -0
- package/src/components/Accordion/tests/Accordion.unit.test.js +822 -0
- package/src/components/Accordion/tests/data.js +18 -0
- package/src/components/Alert/Alert.mdx +141 -0
- package/src/components/Alert/Alert.tsx +119 -0
- package/src/components/Alert/CHANGELOG.md +33 -0
- package/src/components/Alert/data.ts +8 -0
- package/src/components/Alert/index.ts +3 -0
- package/src/components/Alert/styles/config.scss +58 -0
- package/src/components/Alert/styles/mixins.scss +54 -0
- package/src/components/Alert/styles/style.scss +44 -0
- package/src/components/Alert/tests/Alert.conformance.test.js +30 -0
- package/src/components/Alert/tests/Alert.test.js +87 -0
- package/src/components/Badge/Badge.tsx +5 -3
- package/src/components/Badge/index.ts +1 -1
- package/src/components/Badge/styles/config.scss +53 -17
- package/src/components/Badge/styles/mixins.scss +8 -2
- package/src/components/Badge/styles/style.scss +7 -3
- package/src/components/Badge/tests/Badge.conformance.test.js +8 -8
- package/src/components/Badge/tests/Badge.unit.test.js +3 -3
- package/src/components/Breadcrumbs/BreadcrumbItem.tsx +54 -0
- package/src/components/Breadcrumbs/Breadcrumbs.mdx +84 -0
- package/src/components/Breadcrumbs/Breadcrumbs.tsx +60 -0
- package/src/components/Breadcrumbs/index.ts +5 -0
- package/src/components/Breadcrumbs/styles/config.scss +2 -0
- package/src/components/Breadcrumbs/styles/mixins.scss +105 -0
- package/src/components/Breadcrumbs/styles/style.scss +37 -0
- package/src/components/Breadcrumbs/tests/BreadcrumbItem.unit.test.js +295 -0
- package/src/components/Breadcrumbs/tests/Breadcrumbs.conformance.test.js +53 -0
- package/src/components/Breadcrumbs/tests/Breadcrumbs.integration.test.js +309 -0
- package/src/components/Breadcrumbs/tests/Breadcrumbs.unit.test.js +280 -0
- package/src/components/Button/Button.mdx +273 -0
- package/src/components/Button/Button.tsx +105 -0
- package/src/components/Button/IconButton.tsx +67 -0
- package/src/components/Button/index.tsx +23 -0
- package/src/components/Button/styles/config.scss +229 -0
- package/src/components/Button/styles/mixins.scss +164 -0
- package/src/components/Button/styles/style.scss +66 -0
- package/src/components/Button/tests/Button.conformance.test.js +37 -0
- package/src/components/Button/tests/Button.test.js +114 -0
- package/src/components/Button/tests/IconButton.unit.test.js +107 -0
- package/src/components/Buttons/Buttons.mdx +39 -0
- package/src/components/Buttons/Buttons.tsx +34 -0
- package/src/components/Buttons/index.ts +3 -0
- package/src/components/Buttons/styles/config.scss +3 -0
- package/src/components/Buttons/styles/mixins.scss +39 -0
- package/src/components/Buttons/styles/style.scss +10 -0
- package/src/components/Buttons/tests/Buttons.conformance.test.js +22 -0
- package/src/components/Buttons/tests/Buttons.unit.test.js +26 -0
- package/src/components/Container/Container.mdx +73 -0
- package/src/components/Container/Container.tsx +15 -0
- package/src/components/Container/index.ts +5 -0
- package/src/components/Container/styles/config.scss +11 -0
- package/src/components/Container/styles/mixins.scss +22 -0
- package/src/components/Container/styles/style.scss +5 -0
- package/src/components/Container/tests/Container.conformance.test.js +209 -0
- package/src/components/Container/tests/Container.unit.test.js +320 -0
- package/src/components/Grid/Grid.mdx +319 -0
- package/src/components/Grid/Grid.tsx +51 -0
- package/src/components/Grid/GridCol.tsx +33 -0
- package/src/components/Grid/index.ts +6 -0
- package/src/components/Grid/styles/config.scss +10 -0
- package/src/components/Grid/styles/mixins.scss +126 -0
- package/src/components/Grid/styles/style.scss +41 -0
- package/src/components/Grid/tests/Grid.unit.test.tsx +533 -0
- package/src/components/Grid/tests/GridCol.unit.test.tsx +199 -0
- package/src/components/Icon/Icon.mdx +172 -0
- package/src/components/Icon/Icon.tsx +73 -0
- package/src/components/Icon/IconSearch.jsx +247 -0
- package/src/components/Icon/SpritePathContext.tsx +22 -0
- package/src/components/Icon/iconSearchTags.ts +437 -0
- package/src/components/Icon/index.ts +5 -0
- package/src/components/Icon/styles/config.scss +27 -0
- package/src/components/Icon/styles/export/color.scss +8 -0
- package/src/components/Icon/styles/export/size.scss +13 -0
- package/src/components/Icon/styles/mixins.scss +31 -0
- package/src/components/Icon/styles/style.scss +13 -0
- package/src/components/Icon/tests/Icon.conformance.test.js +22 -0
- package/src/components/Icon/tests/Icon.unit.test.js +112 -0
- package/src/components/Image/Image.mdx +166 -0
- package/src/components/Image/Image.tsx +65 -0
- package/src/components/Image/index.ts +7 -0
- package/src/components/Image/styles/mixins.scss +12 -0
- package/src/components/Image/styles/style.scss +9 -0
- package/src/components/Image/tests/Image.conformance.test.js +264 -0
- package/src/components/Image/tests/Image.unit.test.js +338 -0
- package/src/components/Link/Link.mdx +224 -0
- package/src/components/Link/Link.tsx +52 -0
- package/src/components/Link/index.ts +3 -0
- package/src/components/Link/styles/config.scss +85 -0
- package/src/components/Link/styles/mixins.scss +42 -0
- package/src/components/Link/styles/style.scss +59 -0
- package/src/components/Link/tests/Link.conformance.test.js +302 -0
- package/src/components/Link/tests/Link.integration.test.js +393 -0
- package/src/components/Link/tests/Link.unit.test.js +308 -0
- package/src/components/Modal/Modal.mdx +449 -0
- package/src/components/Modal/Modal.static.ts +223 -0
- package/src/components/Modal/Modal.tsx +145 -0
- package/src/components/Modal/ModalBody.tsx +46 -0
- package/src/components/Modal/ModalCloseButton.tsx +26 -0
- package/src/components/Modal/ModalTitle.tsx +32 -0
- package/src/components/Modal/TODO.md +2 -0
- package/src/components/Modal/index.ts +6 -0
- package/src/components/Modal/styles/config.scss +42 -0
- package/src/components/Modal/styles/mixins.scss +200 -0
- package/src/components/Modal/styles/style.scss +97 -0
- package/src/components/Modal/tests/Modal.conformance.test.js +41 -0
- package/src/components/Modal/tests/Modal.unit.test.js +56 -0
- package/src/components/Modal/tests/ModalBody.unit.test.js +39 -0
- package/src/components/Modal/tests/ModalCloseButton.unit.test.js +84 -0
- package/src/components/Modal/tests/ModalTitle.unit.test.js +25 -0
- package/src/components/Section/Section.mdx +397 -0
- package/src/components/Section/Section.tsx +54 -0
- package/src/components/Section/index.ts +3 -0
- package/src/components/Section/styles/config.scss +38 -0
- package/src/components/Section/styles/mixins.scss +30 -0
- package/src/components/Section/styles/style.scss +35 -0
- package/src/components/Section/tests/Section.conformance.test.js +502 -0
- package/src/components/Section/tests/Section.unit.test.js +642 -0
- package/src/components/Tabs/TODO.md +2 -0
- package/src/components/Tabs/Tab.tsx +55 -0
- package/src/components/Tabs/TabPanel.tsx +42 -0
- package/src/components/Tabs/Tabs.mdx +373 -0
- package/src/components/Tabs/Tabs.static.ts +185 -0
- package/src/components/Tabs/Tabs.tsx +130 -0
- package/src/components/Tabs/index.ts +5 -0
- package/src/components/Tabs/styles/config.scss +78 -0
- package/src/components/Tabs/styles/mixins.scss +107 -0
- package/src/components/Tabs/styles/style.scss +64 -0
- package/src/components/Tabs/tests/Tab.unit.test.js +85 -0
- package/src/components/Tabs/tests/TabPanel.unit.test.js +53 -0
- package/src/components/Tabs/tests/Tabs.unit.test.js +260 -0
- package/src/components/index.ts +33 -2
- package/src/styles/base/globals.scss +18 -13
- package/src/styles/base/styleguide.scss +1 -1
- package/src/styles/before-components.scss +1 -1
- package/src/styles/export/breakpoint.ts +12 -0
- package/src/styles/export/color.scss +1 -1
- package/src/styles/tokens/base.scss +6 -4
- package/src/styles/tokens/color.scss +127 -25
- package/src/styles/tools/convert.scss +1 -1
- package/src/styles/typography/config.scss +187 -0
- package/src/{components/Typography/styles → styles/typography}/mixins.scss +31 -24
- package/src/{components/Typography/styles → styles/typography}/style.scss +9 -3
- package/src/styles/utilities/text.scss +2 -2
- package/build/.htaccess +0 -7
- package/build/_next/static/chunks/app/layout-69efc42b1696abf9.js +0 -1
- package/build/_next/static/chunks/app/page-687dfdffc8d1b6e5.js +0 -1
- package/build/_next/static/chunks/webpack-778f3ec87f8d2826.js +0 -1
- package/build/_next/static/css/08a2fcd6f5aac3e0.css +0 -1
- package/build/_next/static/css/d2fc2f581fe4b371.css +0 -1
- package/build/_next/static/rsiMOOYAxBtOjvpzBN4vJ/_buildManifest.js +0 -1
- package/build/_redirects +0 -1
- package/build/components/types/Badge/index.d.ts +0 -2
- package/build/components/types/index.d.ts +0 -4
- package/build/fonts/HelvNeue55_W1G.eot +0 -0
- package/build/fonts/HelvNeue55_W1G.svg +0 -653
- package/build/fonts/HelvNeue55_W1G.ttf +0 -0
- package/build/fonts/HelvNeue55_W1G.woff +0 -0
- package/build/fonts/HelvNeue55_W1G.woff2 +0 -0
- package/build/fonts/HelvNeue75_W1G.eot +0 -0
- package/build/fonts/HelvNeue75_W1G.svg +0 -653
- package/build/fonts/HelvNeue75_W1G.ttf +0 -0
- package/build/fonts/HelvNeue75_W1G.woff +0 -0
- package/build/fonts/HelvNeue75_W1G.woff2 +0 -0
- package/build/manifest.json +0 -15
- package/build/sprite-sg.svg +0 -1
- package/public/fonts/HelvNeue55_W1G.eot +0 -0
- package/public/fonts/HelvNeue55_W1G.svg +0 -653
- package/public/fonts/HelvNeue55_W1G.ttf +0 -0
- package/public/fonts/HelvNeue55_W1G.woff +0 -0
- package/public/fonts/HelvNeue55_W1G.woff2 +0 -0
- package/public/fonts/HelvNeue75_W1G.eot +0 -0
- package/public/fonts/HelvNeue75_W1G.svg +0 -653
- package/public/fonts/HelvNeue75_W1G.ttf +0 -0
- package/public/fonts/HelvNeue75_W1G.woff +0 -0
- package/public/fonts/HelvNeue75_W1G.woff2 +0 -0
- package/src/components/Badge/Badge.test.js +0 -45
- package/src/components/Typography/styles/config.scss +0 -181
- /package/build/_next/static/{rsiMOOYAxBtOjvpzBN4vJ → CRhIjUFtohDOfdDfzvfXM}/_ssgManifest.js +0 -0
- /package/build/_next/static/chunks/{4bd1b696-67ee12fb04071d3b.js → 4bd1b696-40a218329c8ae32b.js} +0 -0
- /package/build/_next/static/chunks/{684-2d117c50cbadadca.js → 684-c72f8f73e7f2d568.js} +0 -0
- /package/build/_next/static/chunks/app/_not-found/{page-f08302ee705a96b1.js → page-c799b4c91b89a5c2.js} +0 -0
|
@@ -561,6 +561,1252 @@ function lowerCamelCase(string) {
|
|
|
561
561
|
return string.charAt(0).toLowerCase() + string.slice(1);
|
|
562
562
|
}
|
|
563
563
|
|
|
564
|
+
const not = {
|
|
565
|
+
inert: ':not([inert]):not([inert] *)',
|
|
566
|
+
negTabIndex: ':not([tabindex^="-"])',
|
|
567
|
+
disabled: ':not(:disabled)',
|
|
568
|
+
};
|
|
569
|
+
|
|
570
|
+
var focusableSelectors = [
|
|
571
|
+
`a[href]${not.inert}${not.negTabIndex}`,
|
|
572
|
+
`area[href]${not.inert}${not.negTabIndex}`,
|
|
573
|
+
`input:not([type="hidden"]):not([type="radio"])${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
574
|
+
`input[type="radio"]${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
575
|
+
`select${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
576
|
+
`textarea${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
577
|
+
`button${not.inert}${not.negTabIndex}${not.disabled}`,
|
|
578
|
+
`details${not.inert} > summary:first-of-type${not.negTabIndex}`,
|
|
579
|
+
// Discard until Firefox supports `:has()`
|
|
580
|
+
// See: https://github.com/KittyGiraudel/focusable-selectors/issues/12
|
|
581
|
+
// `details:not(:has(> summary))${not.inert}${not.negTabIndex}`,
|
|
582
|
+
`iframe${not.inert}${not.negTabIndex}`,
|
|
583
|
+
`audio[controls]${not.inert}${not.negTabIndex}`,
|
|
584
|
+
`video[controls]${not.inert}${not.negTabIndex}`,
|
|
585
|
+
`[contenteditable]${not.inert}${not.negTabIndex}`,
|
|
586
|
+
`[tabindex]${not.inert}${not.negTabIndex}`,
|
|
587
|
+
];
|
|
588
|
+
|
|
589
|
+
/**
|
|
590
|
+
* Set the focus to the first element with `autofocus` with the element or the
|
|
591
|
+
* element itself.
|
|
592
|
+
*/
|
|
593
|
+
function focus(el) {
|
|
594
|
+
(el.querySelector('[autofocus]') || el).focus();
|
|
595
|
+
}
|
|
596
|
+
/**
|
|
597
|
+
* Get the first and last focusable elements within a given element.
|
|
598
|
+
*/
|
|
599
|
+
function getFocusableEdges(el) {
|
|
600
|
+
// Check for a focusable element within the subtree of the given element.
|
|
601
|
+
const firstEl = findFocusableEl(el, true);
|
|
602
|
+
// Only if we find the first element do we need to look for the last one. If
|
|
603
|
+
// there’s no last element, we set `lastEl` as a reference to `firstEl` so
|
|
604
|
+
// that the returned array is still always of length 2.
|
|
605
|
+
const lastEl = firstEl ? findFocusableEl(el, false) || firstEl : null;
|
|
606
|
+
return [firstEl, lastEl];
|
|
607
|
+
}
|
|
608
|
+
/**
|
|
609
|
+
* Find the first focusable element inside the given element if `forward` is
|
|
610
|
+
* truthy or the last focusable element otherwise.
|
|
611
|
+
*/
|
|
612
|
+
function findFocusableEl(el, forward) {
|
|
613
|
+
// If we’re walking forward, check if this element is focusable, and return it
|
|
614
|
+
// immediately if it is.
|
|
615
|
+
if (forward && isFocusable(el))
|
|
616
|
+
return el;
|
|
617
|
+
// We should only search the subtree of this element if it can have focusable
|
|
618
|
+
// children.
|
|
619
|
+
if (canHaveFocusableChildren(el)) {
|
|
620
|
+
// Start walking the DOM tree, looking for focusable elements.
|
|
621
|
+
// Case 1: If this element has a shadow root, search it recursively.
|
|
622
|
+
if (el.shadowRoot) {
|
|
623
|
+
// Descend into this subtree.
|
|
624
|
+
let next = getNextChildEl(el.shadowRoot, forward);
|
|
625
|
+
// Traverse the siblings, searching the subtree of each one for focusable
|
|
626
|
+
// elements.
|
|
627
|
+
while (next) {
|
|
628
|
+
const focusableEl = findFocusableEl(next, forward);
|
|
629
|
+
if (focusableEl)
|
|
630
|
+
return focusableEl;
|
|
631
|
+
next = getNextSiblingEl(next, forward);
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
// Case 2: If this element is a slot for a Custom Element, search its
|
|
635
|
+
// assigned elements recursively.
|
|
636
|
+
else if (el.localName === 'slot') {
|
|
637
|
+
const assignedElements = el.assignedElements({
|
|
638
|
+
flatten: true,
|
|
639
|
+
});
|
|
640
|
+
if (!forward)
|
|
641
|
+
assignedElements.reverse();
|
|
642
|
+
for (const assignedElement of assignedElements) {
|
|
643
|
+
const focusableEl = findFocusableEl(assignedElement, forward);
|
|
644
|
+
if (focusableEl)
|
|
645
|
+
return focusableEl;
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
// Case 3: this is a regular Light DOM element. Search its subtree.
|
|
649
|
+
else {
|
|
650
|
+
// Descend into this subtree.
|
|
651
|
+
let next = getNextChildEl(el, forward);
|
|
652
|
+
// Traverse siblings, searching the subtree of each one
|
|
653
|
+
// for focusable elements.
|
|
654
|
+
while (next) {
|
|
655
|
+
const focusableEl = findFocusableEl(next, forward);
|
|
656
|
+
if (focusableEl)
|
|
657
|
+
return focusableEl;
|
|
658
|
+
next = getNextSiblingEl(next, forward);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
}
|
|
662
|
+
// If we’re walking backward, we want to check the element’s entire subtree
|
|
663
|
+
// before checking the element itself. If this element is focusable, return
|
|
664
|
+
// it.
|
|
665
|
+
if (!forward && isFocusable(el))
|
|
666
|
+
return el;
|
|
667
|
+
return null;
|
|
668
|
+
}
|
|
669
|
+
function getNextChildEl(el, forward) {
|
|
670
|
+
return forward ? el.firstElementChild : el.lastElementChild;
|
|
671
|
+
}
|
|
672
|
+
function getNextSiblingEl(el, forward) {
|
|
673
|
+
return forward ? el.nextElementSibling : el.previousElementSibling;
|
|
674
|
+
}
|
|
675
|
+
/**
|
|
676
|
+
* Determine if an element is hidden from the user.
|
|
677
|
+
*/
|
|
678
|
+
const isHidden$1 = (el) => {
|
|
679
|
+
// Browsers hide all non-<summary> descendants of closed <details> elements
|
|
680
|
+
// from user interaction, but those non-<summary> elements may still match our
|
|
681
|
+
// focusable-selectors and may still have dimensions, so we need a special
|
|
682
|
+
// case to ignore them.
|
|
683
|
+
if (el.matches('details:not([open]) *') &&
|
|
684
|
+
!el.matches('details>summary:first-of-type'))
|
|
685
|
+
return true;
|
|
686
|
+
// If this element has no painted dimensions, it's hidden.
|
|
687
|
+
return !(el.offsetWidth || el.offsetHeight || el.getClientRects().length);
|
|
688
|
+
};
|
|
689
|
+
/**
|
|
690
|
+
* Determine if an element is focusable and has user-visible painted dimensions.
|
|
691
|
+
*/
|
|
692
|
+
const isFocusable = (el) => {
|
|
693
|
+
// A shadow host that delegates focus will never directly receive focus,
|
|
694
|
+
// even with `tabindex=0`. Consider our <fancy-button> custom element, which
|
|
695
|
+
// delegates focus to its shadow button:
|
|
696
|
+
//
|
|
697
|
+
// <fancy-button tabindex="0">
|
|
698
|
+
// #shadow-root
|
|
699
|
+
// <button><slot></slot></button>
|
|
700
|
+
// </fancy-button>
|
|
701
|
+
//
|
|
702
|
+
// The browser acts as as if there is only one focusable element – the shadow
|
|
703
|
+
// button. Our library should behave the same way.
|
|
704
|
+
if (el.shadowRoot?.delegatesFocus)
|
|
705
|
+
return false;
|
|
706
|
+
return el.matches(focusableSelectors.join(',')) && !isHidden$1(el);
|
|
707
|
+
};
|
|
708
|
+
/**
|
|
709
|
+
* Determine if an element can have focusable children. Useful for bailing out
|
|
710
|
+
* early when walking the DOM tree.
|
|
711
|
+
* @example
|
|
712
|
+
* This div is inert, so none of its children can be focused, even though they
|
|
713
|
+
* meet our criteria for what is focusable. Once we check the div, we can skip
|
|
714
|
+
* the rest of the subtree.
|
|
715
|
+
* ```html
|
|
716
|
+
* <div inert>
|
|
717
|
+
* <button>Button</button>
|
|
718
|
+
* <a href="#">Link</a>
|
|
719
|
+
* </div>
|
|
720
|
+
* ```
|
|
721
|
+
*/
|
|
722
|
+
function canHaveFocusableChildren(el) {
|
|
723
|
+
// The browser will never send focus into a Shadow DOM if the host element
|
|
724
|
+
// has a negative tabindex. This applies to both slotted Light DOM Shadow DOM
|
|
725
|
+
// children
|
|
726
|
+
if (el.shadowRoot && el.getAttribute('tabindex') === '-1')
|
|
727
|
+
return false;
|
|
728
|
+
// Elemments matching this selector are either hidden entirely from the user,
|
|
729
|
+
// or are visible but unavailable for interaction. Their descentants can never
|
|
730
|
+
// receive focus.
|
|
731
|
+
return !el.matches(':disabled,[hidden],[inert]');
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* Get the active element, accounting for Shadow DOM subtrees.
|
|
735
|
+
* @author Cory LaViska
|
|
736
|
+
* @see: https://www.abeautifulsite.net/posts/finding-the-active-element-in-a-shadow-root/
|
|
737
|
+
*/
|
|
738
|
+
function getActiveEl(root = document) {
|
|
739
|
+
const activeEl = root.activeElement;
|
|
740
|
+
if (!activeEl)
|
|
741
|
+
return null;
|
|
742
|
+
// If there’s a shadow root, recursively find the active element within it.
|
|
743
|
+
// If the recursive call returns null, return the active element
|
|
744
|
+
// of the top-level Document.
|
|
745
|
+
if (activeEl.shadowRoot)
|
|
746
|
+
return getActiveEl(activeEl.shadowRoot) || document.activeElement;
|
|
747
|
+
// If not, we can just return the active element
|
|
748
|
+
return activeEl;
|
|
749
|
+
}
|
|
750
|
+
/**
|
|
751
|
+
* Trap the focus inside the given element
|
|
752
|
+
*/
|
|
753
|
+
function trapTabKey(el, event) {
|
|
754
|
+
const [firstFocusableEl, lastFocusableEl] = getFocusableEdges(el);
|
|
755
|
+
// If there are no focusable children in the dialog, prevent the user from
|
|
756
|
+
// tabbing out of it
|
|
757
|
+
if (!firstFocusableEl)
|
|
758
|
+
return event.preventDefault();
|
|
759
|
+
const activeEl = getActiveEl();
|
|
760
|
+
// If the SHIFT key is pressed while tabbing (moving backwards) and the
|
|
761
|
+
// currently focused item is the first one, move the focus to the last
|
|
762
|
+
// focusable item from the dialog element
|
|
763
|
+
if (event.shiftKey && activeEl === firstFocusableEl) {
|
|
764
|
+
// @ts-ignore: we know that `lastFocusableEl` is not null here
|
|
765
|
+
lastFocusableEl.focus();
|
|
766
|
+
event.preventDefault();
|
|
767
|
+
}
|
|
768
|
+
// If the SHIFT key is not pressed (moving forwards) and the currently focused
|
|
769
|
+
// item is the last one, move the focus to the first focusable item from the
|
|
770
|
+
// dialog element
|
|
771
|
+
else if (!event.shiftKey && activeEl === lastFocusableEl) {
|
|
772
|
+
firstFocusableEl.focus();
|
|
773
|
+
event.preventDefault();
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Find the closest element to the given element matching the given selector,
|
|
778
|
+
* accounting for Shadow DOM subtrees.
|
|
779
|
+
* @author Louis St-Amour
|
|
780
|
+
* @see: https://stackoverflow.com/a/56105394
|
|
781
|
+
*/
|
|
782
|
+
function closest(selector, base) {
|
|
783
|
+
function from(el) {
|
|
784
|
+
if (!el || el === document || el === window)
|
|
785
|
+
return null;
|
|
786
|
+
// Reading the `assignedSlot` property from the element (as suggested by the
|
|
787
|
+
// aforementioned StackOverflow answer) is not enough, because it does not
|
|
788
|
+
// take into consideration elements nested deeply within a <slot>. For these
|
|
789
|
+
// elements, the `assignedSlot` property is `null` as it is only specified
|
|
790
|
+
// for top-level elements within a <slot>. To still find the closest <slot>,
|
|
791
|
+
// we walk up the tree looking for the `assignedSlot` property.
|
|
792
|
+
const slot = findAssignedSlot(el);
|
|
793
|
+
if (slot)
|
|
794
|
+
el = slot;
|
|
795
|
+
return (el.closest(selector) ||
|
|
796
|
+
from(el.getRootNode().host));
|
|
797
|
+
}
|
|
798
|
+
return from(base);
|
|
799
|
+
}
|
|
800
|
+
function findAssignedSlot(node) {
|
|
801
|
+
return (node.assignedSlot ||
|
|
802
|
+
(node.parentNode ? findAssignedSlot(node.parentNode) : null));
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
const SCOPE = 'data-a11y-dialog';
|
|
806
|
+
class A11yDialog {
|
|
807
|
+
$el;
|
|
808
|
+
id;
|
|
809
|
+
previouslyFocused;
|
|
810
|
+
shown;
|
|
811
|
+
constructor(element) {
|
|
812
|
+
this.$el = element;
|
|
813
|
+
this.id = this.$el.getAttribute(SCOPE) || this.$el.id;
|
|
814
|
+
this.previouslyFocused = null;
|
|
815
|
+
this.shown = false;
|
|
816
|
+
this.maintainFocus = this.maintainFocus.bind(this);
|
|
817
|
+
this.bindKeypress = this.bindKeypress.bind(this);
|
|
818
|
+
this.handleTriggerClicks = this.handleTriggerClicks.bind(this);
|
|
819
|
+
this.show = this.show.bind(this);
|
|
820
|
+
this.hide = this.hide.bind(this);
|
|
821
|
+
this.$el.setAttribute('aria-hidden', 'true');
|
|
822
|
+
this.$el.setAttribute('aria-modal', 'true');
|
|
823
|
+
this.$el.setAttribute('tabindex', '-1');
|
|
824
|
+
if (!this.$el.hasAttribute('role')) {
|
|
825
|
+
this.$el.setAttribute('role', 'dialog');
|
|
826
|
+
}
|
|
827
|
+
document.addEventListener('click', this.handleTriggerClicks, true);
|
|
828
|
+
}
|
|
829
|
+
/**
|
|
830
|
+
* Destroy the current instance (after making sure the dialog has been hidden)
|
|
831
|
+
* and remove all associated listeners from dialog openers and closers
|
|
832
|
+
*/
|
|
833
|
+
destroy() {
|
|
834
|
+
// Dispatch a `destroy` event
|
|
835
|
+
const destroyEvent = this.fire('destroy');
|
|
836
|
+
// If the event was prevented, do not continue with the normal behavior
|
|
837
|
+
if (destroyEvent.defaultPrevented)
|
|
838
|
+
return this;
|
|
839
|
+
// Hide the dialog to avoid destroying an open instance
|
|
840
|
+
this.hide();
|
|
841
|
+
// Remove the click event delegates for our openers and closers
|
|
842
|
+
document.removeEventListener('click', this.handleTriggerClicks, true);
|
|
843
|
+
// Clone and replace the dialog element to prevent memory leaks caused by
|
|
844
|
+
// event listeners that the author might not have cleaned up.
|
|
845
|
+
this.$el.replaceWith(this.$el.cloneNode(true));
|
|
846
|
+
return this;
|
|
847
|
+
}
|
|
848
|
+
/**
|
|
849
|
+
* Show the dialog element, trap the current focus within it, listen for some
|
|
850
|
+
* specific key presses and fire all registered callbacks for `show` event
|
|
851
|
+
*/
|
|
852
|
+
show(event) {
|
|
853
|
+
// If the dialog is already open, abort
|
|
854
|
+
if (this.shown)
|
|
855
|
+
return this;
|
|
856
|
+
// Dispatch a `show` event
|
|
857
|
+
const showEvent = this.fire('show', event);
|
|
858
|
+
// If the event was prevented, do not continue with the normal behavior
|
|
859
|
+
if (showEvent.defaultPrevented)
|
|
860
|
+
return this;
|
|
861
|
+
// Keep a reference to the currently focused element to be able to restore
|
|
862
|
+
// it later
|
|
863
|
+
this.shown = true;
|
|
864
|
+
this.$el.removeAttribute('aria-hidden');
|
|
865
|
+
this.previouslyFocused = getActiveEl();
|
|
866
|
+
// Due to a long lasting bug in Safari, clicking an interactive element
|
|
867
|
+
// (like a <button>) does *not* move the focus to that element, which means
|
|
868
|
+
// `document.activeElement` is whatever element is currently focused (like
|
|
869
|
+
// an <input>), or the <body> element otherwise. We can work around that
|
|
870
|
+
// problem by checking whether the focused element is the <body>, and if it,
|
|
871
|
+
// store the click event target.
|
|
872
|
+
// See: https://bugs.webkit.org/show_bug.cgi?id=22261
|
|
873
|
+
if (this.previouslyFocused?.tagName === 'BODY' && event?.target) {
|
|
874
|
+
this.previouslyFocused = event.target;
|
|
875
|
+
}
|
|
876
|
+
// Set the focus to the dialog element
|
|
877
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/pull/583
|
|
878
|
+
if (event?.type === 'focus') {
|
|
879
|
+
this.maintainFocus();
|
|
880
|
+
}
|
|
881
|
+
else {
|
|
882
|
+
focus(this.$el);
|
|
883
|
+
}
|
|
884
|
+
// Bind a focus event listener to the body element to make sure the focus
|
|
885
|
+
// stays trapped inside the dialog while open, and start listening for some
|
|
886
|
+
// specific key presses (TAB and ESC)
|
|
887
|
+
document.body.addEventListener('focus', this.maintainFocus, true);
|
|
888
|
+
this.$el.addEventListener('keydown', this.bindKeypress, true);
|
|
889
|
+
return this;
|
|
890
|
+
}
|
|
891
|
+
/**
|
|
892
|
+
* Hide the dialog element, restore the focus to the previously active
|
|
893
|
+
* element, stop listening for some specific key presses and fire all
|
|
894
|
+
* registered callbacks for `hide` event
|
|
895
|
+
*/
|
|
896
|
+
hide(event) {
|
|
897
|
+
// If the dialog is already closed, abort
|
|
898
|
+
if (!this.shown)
|
|
899
|
+
return this;
|
|
900
|
+
// Dispatch a `hide` event
|
|
901
|
+
const hideEvent = this.fire('hide', event);
|
|
902
|
+
// If the event was prevented, do not continue with the normal behavior
|
|
903
|
+
if (hideEvent.defaultPrevented)
|
|
904
|
+
return this;
|
|
905
|
+
this.shown = false;
|
|
906
|
+
this.$el.setAttribute('aria-hidden', 'true');
|
|
907
|
+
// Remove the focus event listener to the body element and stop listening
|
|
908
|
+
// for specific key presses
|
|
909
|
+
document.body.removeEventListener('focus', this.maintainFocus, true);
|
|
910
|
+
this.$el.removeEventListener('keydown', this.bindKeypress, true);
|
|
911
|
+
// Ensure the previously focused element (if any) has a `focus` method
|
|
912
|
+
// before attempting to call it to account for SVG elements
|
|
913
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/108
|
|
914
|
+
this.previouslyFocused?.focus?.();
|
|
915
|
+
return this;
|
|
916
|
+
}
|
|
917
|
+
/**
|
|
918
|
+
* Register a new callback for the given event type
|
|
919
|
+
*/
|
|
920
|
+
on(type, handler, options) {
|
|
921
|
+
this.$el.addEventListener(type, handler, options);
|
|
922
|
+
return this;
|
|
923
|
+
}
|
|
924
|
+
/**
|
|
925
|
+
* Unregister an existing callback for the given event type
|
|
926
|
+
*/
|
|
927
|
+
off(type, handler, options) {
|
|
928
|
+
this.$el.removeEventListener(type, handler, options);
|
|
929
|
+
return this;
|
|
930
|
+
}
|
|
931
|
+
/**
|
|
932
|
+
* Dispatch and return a custom event from the DOM element associated with
|
|
933
|
+
* this dialog; this allows authors to listen for and respond to the events
|
|
934
|
+
* in their own code
|
|
935
|
+
*/
|
|
936
|
+
fire(type, event) {
|
|
937
|
+
const customEvent = new CustomEvent(type, {
|
|
938
|
+
detail: event,
|
|
939
|
+
cancelable: true,
|
|
940
|
+
});
|
|
941
|
+
this.$el.dispatchEvent(customEvent);
|
|
942
|
+
return customEvent;
|
|
943
|
+
}
|
|
944
|
+
/**
|
|
945
|
+
* Add a delegated event listener for when elememts that open or close the
|
|
946
|
+
* dialog are clicked, and call `show` or `hide`, respectively
|
|
947
|
+
*/
|
|
948
|
+
handleTriggerClicks(event) {
|
|
949
|
+
// We need to retrieve the click target while accounting for Shadow DOM.
|
|
950
|
+
// When within a web component, `event.target` is the shadow root (e.g.
|
|
951
|
+
// `<my-dialog>`), so we need to use `event.composedPath()` to get the click
|
|
952
|
+
// target
|
|
953
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/582
|
|
954
|
+
const target = event.composedPath()[0];
|
|
955
|
+
const opener = closest(`[${SCOPE}-show="${this.id}"]`, target);
|
|
956
|
+
const explicitCloser = closest(`[${SCOPE}-hide="${this.id}"]`, target);
|
|
957
|
+
const implicitCloser = closest(`[${SCOPE}-hide]`, target) &&
|
|
958
|
+
closest('[aria-modal="true"]', target) === this.$el;
|
|
959
|
+
// We use `closest(..)` (instead of `matches(..)`) so that clicking an
|
|
960
|
+
// element nested within a dialog opener does cause the dialog to open, and
|
|
961
|
+
// we use our custom `closest(..)` function so that it can cross shadow
|
|
962
|
+
// boundaries
|
|
963
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/712
|
|
964
|
+
if (opener)
|
|
965
|
+
this.show(event);
|
|
966
|
+
if (explicitCloser || implicitCloser)
|
|
967
|
+
this.hide(event);
|
|
968
|
+
}
|
|
969
|
+
/**
|
|
970
|
+
* Private event handler used when listening to some specific key presses
|
|
971
|
+
* (namely ESC and TAB)
|
|
972
|
+
*/
|
|
973
|
+
bindKeypress(event) {
|
|
974
|
+
// This is an escape hatch in case there are nested open dialogs, so that
|
|
975
|
+
// only the top most dialog gets interacted with (`closest` is basically
|
|
976
|
+
// `Element.prototype.closest()` accounting for Shadow DOM subtrees)
|
|
977
|
+
if (closest('[aria-modal="true"]', getActiveEl()) !== this.$el) {
|
|
978
|
+
return;
|
|
979
|
+
}
|
|
980
|
+
let hasOpenPopover = false;
|
|
981
|
+
try {
|
|
982
|
+
hasOpenPopover = !!this.$el.querySelector('[popover]:not([popover="manual"]):popover-open');
|
|
983
|
+
}
|
|
984
|
+
catch {
|
|
985
|
+
// Run that DOM query in a try/catch because not all browsers support the
|
|
986
|
+
// `:popover-open` selector, which would cause the whole expression to
|
|
987
|
+
// fail
|
|
988
|
+
// See: https://caniuse.com/mdn-css_selectors_popover-open
|
|
989
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/pull/578#discussion_r1343215149
|
|
990
|
+
}
|
|
991
|
+
// If the dialog is shown and the ESC key is pressed, prevent any further
|
|
992
|
+
// effects from the ESC key and hide the dialog, unless:
|
|
993
|
+
// - its role is `alertdialog`, which means it should be modal
|
|
994
|
+
// - or it contains an open popover, in which case ESC should close it
|
|
995
|
+
if (event.key === 'Escape' &&
|
|
996
|
+
this.$el.getAttribute('role') !== 'alertdialog' &&
|
|
997
|
+
!hasOpenPopover) {
|
|
998
|
+
event.preventDefault();
|
|
999
|
+
this.hide(event);
|
|
1000
|
+
}
|
|
1001
|
+
// If the dialog is shown and the TAB key is pressed, make sure the focus
|
|
1002
|
+
// stays trapped within the dialog element
|
|
1003
|
+
if (event.key === 'Tab') {
|
|
1004
|
+
trapTabKey(this.$el, event);
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
/**
|
|
1008
|
+
* If the dialog is shown and the focus is not within a dialog element (either
|
|
1009
|
+
* this one or another one in case of nested dialogs) or an element with the
|
|
1010
|
+
* ignore attribute, move it back to the dialog container
|
|
1011
|
+
* See: https://github.com/KittyGiraudel/a11y-dialog/issues/177
|
|
1012
|
+
*/
|
|
1013
|
+
maintainFocus() {
|
|
1014
|
+
// We use `getActiveEl()` and not `event.target` here because the latter can
|
|
1015
|
+
// be a shadow root. This can happen when having a focusable element after
|
|
1016
|
+
// slotted content: tabbing out of it causes this focus listener to trigger
|
|
1017
|
+
// with the shadow root as a target event. In such a case, the focus would
|
|
1018
|
+
// be incorrectly moved to the dialog, which shouldn’t happen. Getting the
|
|
1019
|
+
// active element (while accounting for Shadow DOM) avoids that problem.
|
|
1020
|
+
// See: https://github.com/KittyGiraudel/a11y-dialog/issues/778
|
|
1021
|
+
const target = getActiveEl();
|
|
1022
|
+
if (!closest(`[aria-modal="true"], [${SCOPE}-ignore-focus-trap]`, target)) {
|
|
1023
|
+
focus(this.$el);
|
|
1024
|
+
}
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
function instantiateDialogs() {
|
|
1029
|
+
for (const el of document.querySelectorAll('[data-a11y-dialog]')) {
|
|
1030
|
+
new A11yDialog(el);
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
if (typeof document !== 'undefined') {
|
|
1034
|
+
if (document.readyState === 'loading') {
|
|
1035
|
+
document.addEventListener('DOMContentLoaded', instantiateDialogs);
|
|
1036
|
+
}
|
|
1037
|
+
else {
|
|
1038
|
+
instantiateDialogs();
|
|
1039
|
+
}
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/*!
|
|
1043
|
+
* tabbable 6.2.0
|
|
1044
|
+
* @license MIT, https://github.com/focus-trap/tabbable/blob/master/LICENSE
|
|
1045
|
+
*/
|
|
1046
|
+
// NOTE: separate `:not()` selectors has broader browser support than the newer
|
|
1047
|
+
// `:not([inert], [inert] *)` (Feb 2023)
|
|
1048
|
+
// CAREFUL: JSDom does not support `:not([inert] *)` as a selector; using it causes
|
|
1049
|
+
// the entire query to fail, resulting in no nodes found, which will break a lot
|
|
1050
|
+
// of things... so we have to rely on JS to identify nodes inside an inert container
|
|
1051
|
+
var candidateSelectors = ['input:not([inert])', 'select:not([inert])', 'textarea:not([inert])', 'a[href]:not([inert])', 'button:not([inert])', '[tabindex]:not(slot):not([inert])', 'audio[controls]:not([inert])', 'video[controls]:not([inert])', '[contenteditable]:not([contenteditable="false"]):not([inert])', 'details>summary:first-of-type:not([inert])', 'details:not([inert])'];
|
|
1052
|
+
var candidateSelector = /* #__PURE__ */candidateSelectors.join(',');
|
|
1053
|
+
var NoElement = typeof Element === 'undefined';
|
|
1054
|
+
var matches = NoElement ? function () {} : Element.prototype.matches || Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;
|
|
1055
|
+
var getRootNode = !NoElement && Element.prototype.getRootNode ? function (element) {
|
|
1056
|
+
var _element$getRootNode;
|
|
1057
|
+
return element === null || element === void 0 ? void 0 : (_element$getRootNode = element.getRootNode) === null || _element$getRootNode === void 0 ? void 0 : _element$getRootNode.call(element);
|
|
1058
|
+
} : function (element) {
|
|
1059
|
+
return element === null || element === void 0 ? void 0 : element.ownerDocument;
|
|
1060
|
+
};
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Determines if a node is inert or in an inert ancestor.
|
|
1064
|
+
* @param {Element} [node]
|
|
1065
|
+
* @param {boolean} [lookUp] If true and `node` is not inert, looks up at ancestors to
|
|
1066
|
+
* see if any of them are inert. If false, only `node` itself is considered.
|
|
1067
|
+
* @returns {boolean} True if inert itself or by way of being in an inert ancestor.
|
|
1068
|
+
* False if `node` is falsy.
|
|
1069
|
+
*/
|
|
1070
|
+
var isInert = function isInert(node, lookUp) {
|
|
1071
|
+
var _node$getAttribute;
|
|
1072
|
+
if (lookUp === void 0) {
|
|
1073
|
+
lookUp = true;
|
|
1074
|
+
}
|
|
1075
|
+
// CAREFUL: JSDom does not support inert at all, so we can't use the `HTMLElement.inert`
|
|
1076
|
+
// JS API property; we have to check the attribute, which can either be empty or 'true';
|
|
1077
|
+
// if it's `null` (not specified) or 'false', it's an active element
|
|
1078
|
+
var inertAtt = node === null || node === void 0 ? void 0 : (_node$getAttribute = node.getAttribute) === null || _node$getAttribute === void 0 ? void 0 : _node$getAttribute.call(node, 'inert');
|
|
1079
|
+
var inert = inertAtt === '' || inertAtt === 'true';
|
|
1080
|
+
|
|
1081
|
+
// NOTE: this could also be handled with `node.matches('[inert], :is([inert] *)')`
|
|
1082
|
+
// if it weren't for `matches()` not being a function on shadow roots; the following
|
|
1083
|
+
// code works for any kind of node
|
|
1084
|
+
// CAREFUL: JSDom does not appear to support certain selectors like `:not([inert] *)`
|
|
1085
|
+
// so it likely would not support `:is([inert] *)` either...
|
|
1086
|
+
var result = inert || lookUp && node && isInert(node.parentNode); // recursive
|
|
1087
|
+
|
|
1088
|
+
return result;
|
|
1089
|
+
};
|
|
1090
|
+
|
|
1091
|
+
/**
|
|
1092
|
+
* Determines if a node's content is editable.
|
|
1093
|
+
* @param {Element} [node]
|
|
1094
|
+
* @returns True if it's content-editable; false if it's not or `node` is falsy.
|
|
1095
|
+
*/
|
|
1096
|
+
var isContentEditable = function isContentEditable(node) {
|
|
1097
|
+
var _node$getAttribute2;
|
|
1098
|
+
// CAREFUL: JSDom does not support the `HTMLElement.isContentEditable` API so we have
|
|
1099
|
+
// to use the attribute directly to check for this, which can either be empty or 'true';
|
|
1100
|
+
// if it's `null` (not specified) or 'false', it's a non-editable element
|
|
1101
|
+
var attValue = node === null || node === void 0 ? void 0 : (_node$getAttribute2 = node.getAttribute) === null || _node$getAttribute2 === void 0 ? void 0 : _node$getAttribute2.call(node, 'contenteditable');
|
|
1102
|
+
return attValue === '' || attValue === 'true';
|
|
1103
|
+
};
|
|
1104
|
+
|
|
1105
|
+
/**
|
|
1106
|
+
* @private
|
|
1107
|
+
* Determines if the node has an explicitly specified `tabindex` attribute.
|
|
1108
|
+
* @param {HTMLElement} node
|
|
1109
|
+
* @returns {boolean} True if so; false if not.
|
|
1110
|
+
*/
|
|
1111
|
+
var hasTabIndex = function hasTabIndex(node) {
|
|
1112
|
+
return !isNaN(parseInt(node.getAttribute('tabindex'), 10));
|
|
1113
|
+
};
|
|
1114
|
+
|
|
1115
|
+
/**
|
|
1116
|
+
* Determine the tab index of a given node.
|
|
1117
|
+
* @param {HTMLElement} node
|
|
1118
|
+
* @returns {number} Tab order (negative, 0, or positive number).
|
|
1119
|
+
* @throws {Error} If `node` is falsy.
|
|
1120
|
+
*/
|
|
1121
|
+
var getTabIndex = function getTabIndex(node) {
|
|
1122
|
+
if (!node) {
|
|
1123
|
+
throw new Error('No node provided');
|
|
1124
|
+
}
|
|
1125
|
+
if (node.tabIndex < 0) {
|
|
1126
|
+
// in Chrome, <details/>, <audio controls/> and <video controls/> elements get a default
|
|
1127
|
+
// `tabIndex` of -1 when the 'tabindex' attribute isn't specified in the DOM,
|
|
1128
|
+
// yet they are still part of the regular tab order; in FF, they get a default
|
|
1129
|
+
// `tabIndex` of 0; since Chrome still puts those elements in the regular tab
|
|
1130
|
+
// order, consider their tab index to be 0.
|
|
1131
|
+
// Also browsers do not return `tabIndex` correctly for contentEditable nodes;
|
|
1132
|
+
// so if they don't have a tabindex attribute specifically set, assume it's 0.
|
|
1133
|
+
if ((/^(AUDIO|VIDEO|DETAILS)$/.test(node.tagName) || isContentEditable(node)) && !hasTabIndex(node)) {
|
|
1134
|
+
return 0;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
return node.tabIndex;
|
|
1138
|
+
};
|
|
1139
|
+
var isInput = function isInput(node) {
|
|
1140
|
+
return node.tagName === 'INPUT';
|
|
1141
|
+
};
|
|
1142
|
+
var isHiddenInput = function isHiddenInput(node) {
|
|
1143
|
+
return isInput(node) && node.type === 'hidden';
|
|
1144
|
+
};
|
|
1145
|
+
var isDetailsWithSummary = function isDetailsWithSummary(node) {
|
|
1146
|
+
var r = node.tagName === 'DETAILS' && Array.prototype.slice.apply(node.children).some(function (child) {
|
|
1147
|
+
return child.tagName === 'SUMMARY';
|
|
1148
|
+
});
|
|
1149
|
+
return r;
|
|
1150
|
+
};
|
|
1151
|
+
var getCheckedRadio = function getCheckedRadio(nodes, form) {
|
|
1152
|
+
for (var i = 0; i < nodes.length; i++) {
|
|
1153
|
+
if (nodes[i].checked && nodes[i].form === form) {
|
|
1154
|
+
return nodes[i];
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
};
|
|
1158
|
+
var isTabbableRadio = function isTabbableRadio(node) {
|
|
1159
|
+
if (!node.name) {
|
|
1160
|
+
return true;
|
|
1161
|
+
}
|
|
1162
|
+
var radioScope = node.form || getRootNode(node);
|
|
1163
|
+
var queryRadios = function queryRadios(name) {
|
|
1164
|
+
return radioScope.querySelectorAll('input[type="radio"][name="' + name + '"]');
|
|
1165
|
+
};
|
|
1166
|
+
var radioSet;
|
|
1167
|
+
if (typeof window !== 'undefined' && typeof window.CSS !== 'undefined' && typeof window.CSS.escape === 'function') {
|
|
1168
|
+
radioSet = queryRadios(window.CSS.escape(node.name));
|
|
1169
|
+
} else {
|
|
1170
|
+
try {
|
|
1171
|
+
radioSet = queryRadios(node.name);
|
|
1172
|
+
} catch (err) {
|
|
1173
|
+
// eslint-disable-next-line no-console
|
|
1174
|
+
console.error('Looks like you have a radio button with a name attribute containing invalid CSS selector characters and need the CSS.escape polyfill: %s', err.message);
|
|
1175
|
+
return false;
|
|
1176
|
+
}
|
|
1177
|
+
}
|
|
1178
|
+
var checked = getCheckedRadio(radioSet, node.form);
|
|
1179
|
+
return !checked || checked === node;
|
|
1180
|
+
};
|
|
1181
|
+
var isRadio = function isRadio(node) {
|
|
1182
|
+
return isInput(node) && node.type === 'radio';
|
|
1183
|
+
};
|
|
1184
|
+
var isNonTabbableRadio = function isNonTabbableRadio(node) {
|
|
1185
|
+
return isRadio(node) && !isTabbableRadio(node);
|
|
1186
|
+
};
|
|
1187
|
+
|
|
1188
|
+
// determines if a node is ultimately attached to the window's document
|
|
1189
|
+
var isNodeAttached = function isNodeAttached(node) {
|
|
1190
|
+
var _nodeRoot;
|
|
1191
|
+
// The root node is the shadow root if the node is in a shadow DOM; some document otherwise
|
|
1192
|
+
// (but NOT _the_ document; see second 'If' comment below for more).
|
|
1193
|
+
// If rootNode is shadow root, it'll have a host, which is the element to which the shadow
|
|
1194
|
+
// is attached, and the one we need to check if it's in the document or not (because the
|
|
1195
|
+
// shadow, and all nodes it contains, is never considered in the document since shadows
|
|
1196
|
+
// behave like self-contained DOMs; but if the shadow's HOST, which is part of the document,
|
|
1197
|
+
// is hidden, or is not in the document itself but is detached, it will affect the shadow's
|
|
1198
|
+
// visibility, including all the nodes it contains). The host could be any normal node,
|
|
1199
|
+
// or a custom element (i.e. web component). Either way, that's the one that is considered
|
|
1200
|
+
// part of the document, not the shadow root, nor any of its children (i.e. the node being
|
|
1201
|
+
// tested).
|
|
1202
|
+
// To further complicate things, we have to look all the way up until we find a shadow HOST
|
|
1203
|
+
// that is attached (or find none) because the node might be in nested shadows...
|
|
1204
|
+
// If rootNode is not a shadow root, it won't have a host, and so rootNode should be the
|
|
1205
|
+
// document (per the docs) and while it's a Document-type object, that document does not
|
|
1206
|
+
// appear to be the same as the node's `ownerDocument` for some reason, so it's safer
|
|
1207
|
+
// to ignore the rootNode at this point, and use `node.ownerDocument`. Otherwise,
|
|
1208
|
+
// using `rootNode.contains(node)` will _always_ be true we'll get false-positives when
|
|
1209
|
+
// node is actually detached.
|
|
1210
|
+
// NOTE: If `nodeRootHost` or `node` happens to be the `document` itself (which is possible
|
|
1211
|
+
// if a tabbable/focusable node was quickly added to the DOM, focused, and then removed
|
|
1212
|
+
// from the DOM as in https://github.com/focus-trap/focus-trap-react/issues/905), then
|
|
1213
|
+
// `ownerDocument` will be `null`, hence the optional chaining on it.
|
|
1214
|
+
var nodeRoot = node && getRootNode(node);
|
|
1215
|
+
var nodeRootHost = (_nodeRoot = nodeRoot) === null || _nodeRoot === void 0 ? void 0 : _nodeRoot.host;
|
|
1216
|
+
|
|
1217
|
+
// in some cases, a detached node will return itself as the root instead of a document or
|
|
1218
|
+
// shadow root object, in which case, we shouldn't try to look further up the host chain
|
|
1219
|
+
var attached = false;
|
|
1220
|
+
if (nodeRoot && nodeRoot !== node) {
|
|
1221
|
+
var _nodeRootHost, _nodeRootHost$ownerDo, _node$ownerDocument;
|
|
1222
|
+
attached = !!((_nodeRootHost = nodeRootHost) !== null && _nodeRootHost !== void 0 && (_nodeRootHost$ownerDo = _nodeRootHost.ownerDocument) !== null && _nodeRootHost$ownerDo !== void 0 && _nodeRootHost$ownerDo.contains(nodeRootHost) || node !== null && node !== void 0 && (_node$ownerDocument = node.ownerDocument) !== null && _node$ownerDocument !== void 0 && _node$ownerDocument.contains(node));
|
|
1223
|
+
while (!attached && nodeRootHost) {
|
|
1224
|
+
var _nodeRoot2, _nodeRootHost2, _nodeRootHost2$ownerD;
|
|
1225
|
+
// since it's not attached and we have a root host, the node MUST be in a nested shadow DOM,
|
|
1226
|
+
// which means we need to get the host's host and check if that parent host is contained
|
|
1227
|
+
// in (i.e. attached to) the document
|
|
1228
|
+
nodeRoot = getRootNode(nodeRootHost);
|
|
1229
|
+
nodeRootHost = (_nodeRoot2 = nodeRoot) === null || _nodeRoot2 === void 0 ? void 0 : _nodeRoot2.host;
|
|
1230
|
+
attached = !!((_nodeRootHost2 = nodeRootHost) !== null && _nodeRootHost2 !== void 0 && (_nodeRootHost2$ownerD = _nodeRootHost2.ownerDocument) !== null && _nodeRootHost2$ownerD !== void 0 && _nodeRootHost2$ownerD.contains(nodeRootHost));
|
|
1231
|
+
}
|
|
1232
|
+
}
|
|
1233
|
+
return attached;
|
|
1234
|
+
};
|
|
1235
|
+
var isZeroArea = function isZeroArea(node) {
|
|
1236
|
+
var _node$getBoundingClie = node.getBoundingClientRect(),
|
|
1237
|
+
width = _node$getBoundingClie.width,
|
|
1238
|
+
height = _node$getBoundingClie.height;
|
|
1239
|
+
return width === 0 && height === 0;
|
|
1240
|
+
};
|
|
1241
|
+
var isHidden = function isHidden(node, _ref) {
|
|
1242
|
+
var displayCheck = _ref.displayCheck,
|
|
1243
|
+
getShadowRoot = _ref.getShadowRoot;
|
|
1244
|
+
// NOTE: visibility will be `undefined` if node is detached from the document
|
|
1245
|
+
// (see notes about this further down), which means we will consider it visible
|
|
1246
|
+
// (this is legacy behavior from a very long way back)
|
|
1247
|
+
// NOTE: we check this regardless of `displayCheck="none"` because this is a
|
|
1248
|
+
// _visibility_ check, not a _display_ check
|
|
1249
|
+
if (getComputedStyle(node).visibility === 'hidden') {
|
|
1250
|
+
return true;
|
|
1251
|
+
}
|
|
1252
|
+
var isDirectSummary = matches.call(node, 'details>summary:first-of-type');
|
|
1253
|
+
var nodeUnderDetails = isDirectSummary ? node.parentElement : node;
|
|
1254
|
+
if (matches.call(nodeUnderDetails, 'details:not([open]) *')) {
|
|
1255
|
+
return true;
|
|
1256
|
+
}
|
|
1257
|
+
if (!displayCheck || displayCheck === 'full' || displayCheck === 'legacy-full') {
|
|
1258
|
+
if (typeof getShadowRoot === 'function') {
|
|
1259
|
+
// figure out if we should consider the node to be in an undisclosed shadow and use the
|
|
1260
|
+
// 'non-zero-area' fallback
|
|
1261
|
+
var originalNode = node;
|
|
1262
|
+
while (node) {
|
|
1263
|
+
var parentElement = node.parentElement;
|
|
1264
|
+
var rootNode = getRootNode(node);
|
|
1265
|
+
if (parentElement && !parentElement.shadowRoot && getShadowRoot(parentElement) === true // check if there's an undisclosed shadow
|
|
1266
|
+
) {
|
|
1267
|
+
// node has an undisclosed shadow which means we can only treat it as a black box, so we
|
|
1268
|
+
// fall back to a non-zero-area test
|
|
1269
|
+
return isZeroArea(node);
|
|
1270
|
+
} else if (node.assignedSlot) {
|
|
1271
|
+
// iterate up slot
|
|
1272
|
+
node = node.assignedSlot;
|
|
1273
|
+
} else if (!parentElement && rootNode !== node.ownerDocument) {
|
|
1274
|
+
// cross shadow boundary
|
|
1275
|
+
node = rootNode.host;
|
|
1276
|
+
} else {
|
|
1277
|
+
// iterate up normal dom
|
|
1278
|
+
node = parentElement;
|
|
1279
|
+
}
|
|
1280
|
+
}
|
|
1281
|
+
node = originalNode;
|
|
1282
|
+
}
|
|
1283
|
+
// else, `getShadowRoot` might be true, but all that does is enable shadow DOM support
|
|
1284
|
+
// (i.e. it does not also presume that all nodes might have undisclosed shadows); or
|
|
1285
|
+
// it might be a falsy value, which means shadow DOM support is disabled
|
|
1286
|
+
|
|
1287
|
+
// Since we didn't find it sitting in an undisclosed shadow (or shadows are disabled)
|
|
1288
|
+
// now we can just test to see if it would normally be visible or not, provided it's
|
|
1289
|
+
// attached to the main document.
|
|
1290
|
+
// NOTE: We must consider case where node is inside a shadow DOM and given directly to
|
|
1291
|
+
// `isTabbable()` or `isFocusable()` -- regardless of `getShadowRoot` option setting.
|
|
1292
|
+
|
|
1293
|
+
if (isNodeAttached(node)) {
|
|
1294
|
+
// this works wherever the node is: if there's at least one client rect, it's
|
|
1295
|
+
// somehow displayed; it also covers the CSS 'display: contents' case where the
|
|
1296
|
+
// node itself is hidden in place of its contents; and there's no need to search
|
|
1297
|
+
// up the hierarchy either
|
|
1298
|
+
return !node.getClientRects().length;
|
|
1299
|
+
}
|
|
1300
|
+
|
|
1301
|
+
// Else, the node isn't attached to the document, which means the `getClientRects()`
|
|
1302
|
+
// API will __always__ return zero rects (this can happen, for example, if React
|
|
1303
|
+
// is used to render nodes onto a detached tree, as confirmed in this thread:
|
|
1304
|
+
// https://github.com/facebook/react/issues/9117#issuecomment-284228870)
|
|
1305
|
+
//
|
|
1306
|
+
// It also means that even window.getComputedStyle(node).display will return `undefined`
|
|
1307
|
+
// because styles are only computed for nodes that are in the document.
|
|
1308
|
+
//
|
|
1309
|
+
// NOTE: THIS HAS BEEN THE CASE FOR YEARS. It is not new, nor is it caused by tabbable
|
|
1310
|
+
// somehow. Though it was never stated officially, anyone who has ever used tabbable
|
|
1311
|
+
// APIs on nodes in detached containers has actually implicitly used tabbable in what
|
|
1312
|
+
// was later (as of v5.2.0 on Apr 9, 2021) called `displayCheck="none"` mode -- essentially
|
|
1313
|
+
// considering __everything__ to be visible because of the innability to determine styles.
|
|
1314
|
+
//
|
|
1315
|
+
// v6.0.0: As of this major release, the default 'full' option __no longer treats detached
|
|
1316
|
+
// nodes as visible with the 'none' fallback.__
|
|
1317
|
+
if (displayCheck !== 'legacy-full') {
|
|
1318
|
+
return true; // hidden
|
|
1319
|
+
}
|
|
1320
|
+
// else, fallback to 'none' mode and consider the node visible
|
|
1321
|
+
} else if (displayCheck === 'non-zero-area') {
|
|
1322
|
+
// NOTE: Even though this tests that the node's client rect is non-zero to determine
|
|
1323
|
+
// whether it's displayed, and that a detached node will __always__ have a zero-area
|
|
1324
|
+
// client rect, we don't special-case for whether the node is attached or not. In
|
|
1325
|
+
// this mode, we do want to consider nodes that have a zero area to be hidden at all
|
|
1326
|
+
// times, and that includes attached or not.
|
|
1327
|
+
return isZeroArea(node);
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1330
|
+
// visible, as far as we can tell, or per current `displayCheck=none` mode, we assume
|
|
1331
|
+
// it's visible
|
|
1332
|
+
return false;
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
// form fields (nested) inside a disabled fieldset are not focusable/tabbable
|
|
1336
|
+
// unless they are in the _first_ <legend> element of the top-most disabled
|
|
1337
|
+
// fieldset
|
|
1338
|
+
var isDisabledFromFieldset = function isDisabledFromFieldset(node) {
|
|
1339
|
+
if (/^(INPUT|BUTTON|SELECT|TEXTAREA)$/.test(node.tagName)) {
|
|
1340
|
+
var parentNode = node.parentElement;
|
|
1341
|
+
// check if `node` is contained in a disabled <fieldset>
|
|
1342
|
+
while (parentNode) {
|
|
1343
|
+
if (parentNode.tagName === 'FIELDSET' && parentNode.disabled) {
|
|
1344
|
+
// look for the first <legend> among the children of the disabled <fieldset>
|
|
1345
|
+
for (var i = 0; i < parentNode.children.length; i++) {
|
|
1346
|
+
var child = parentNode.children.item(i);
|
|
1347
|
+
// when the first <legend> (in document order) is found
|
|
1348
|
+
if (child.tagName === 'LEGEND') {
|
|
1349
|
+
// if its parent <fieldset> is not nested in another disabled <fieldset>,
|
|
1350
|
+
// return whether `node` is a descendant of its first <legend>
|
|
1351
|
+
return matches.call(parentNode, 'fieldset[disabled] *') ? true : !child.contains(node);
|
|
1352
|
+
}
|
|
1353
|
+
}
|
|
1354
|
+
// the disabled <fieldset> containing `node` has no <legend>
|
|
1355
|
+
return true;
|
|
1356
|
+
}
|
|
1357
|
+
parentNode = parentNode.parentElement;
|
|
1358
|
+
}
|
|
1359
|
+
}
|
|
1360
|
+
|
|
1361
|
+
// else, node's tabbable/focusable state should not be affected by a fieldset's
|
|
1362
|
+
// enabled/disabled state
|
|
1363
|
+
return false;
|
|
1364
|
+
};
|
|
1365
|
+
var isNodeMatchingSelectorFocusable = function isNodeMatchingSelectorFocusable(options, node) {
|
|
1366
|
+
if (node.disabled ||
|
|
1367
|
+
// we must do an inert look up to filter out any elements inside an inert ancestor
|
|
1368
|
+
// because we're limited in the type of selectors we can use in JSDom (see related
|
|
1369
|
+
// note related to `candidateSelectors`)
|
|
1370
|
+
isInert(node) || isHiddenInput(node) || isHidden(node, options) ||
|
|
1371
|
+
// For a details element with a summary, the summary element gets the focus
|
|
1372
|
+
isDetailsWithSummary(node) || isDisabledFromFieldset(node)) {
|
|
1373
|
+
return false;
|
|
1374
|
+
}
|
|
1375
|
+
return true;
|
|
1376
|
+
};
|
|
1377
|
+
var isNodeMatchingSelectorTabbable = function isNodeMatchingSelectorTabbable(options, node) {
|
|
1378
|
+
if (isNonTabbableRadio(node) || getTabIndex(node) < 0 || !isNodeMatchingSelectorFocusable(options, node)) {
|
|
1379
|
+
return false;
|
|
1380
|
+
}
|
|
1381
|
+
return true;
|
|
1382
|
+
};
|
|
1383
|
+
var isTabbable = function isTabbable(node, options) {
|
|
1384
|
+
options = options || {};
|
|
1385
|
+
if (!node) {
|
|
1386
|
+
throw new Error('No node provided');
|
|
1387
|
+
}
|
|
1388
|
+
if (matches.call(node, candidateSelector) === false) {
|
|
1389
|
+
return false;
|
|
1390
|
+
}
|
|
1391
|
+
return isNodeMatchingSelectorTabbable(options, node);
|
|
1392
|
+
};
|
|
1393
|
+
|
|
1394
|
+
var defaultConfig$2 = function defaultConfig() {
|
|
1395
|
+
return {
|
|
1396
|
+
/** Class which indicates that modal is open */
|
|
1397
|
+
classModalIsOpen: "is-active",
|
|
1398
|
+
/** Class on body which indicates that modal is open */
|
|
1399
|
+
classModalIsOpenBody: "has-modal",
|
|
1400
|
+
/** Root of page content which should be hidden when modal is open */
|
|
1401
|
+
root: "#root",
|
|
1402
|
+
/** Move modal into this element selector (must be unique in DOM) */
|
|
1403
|
+
modalsRoot: "#root-modals"
|
|
1404
|
+
};
|
|
1405
|
+
};
|
|
1406
|
+
var Modal = /*#__PURE__*/function () {
|
|
1407
|
+
function Modal(element, config) {
|
|
1408
|
+
_classCallCheck(this, Modal);
|
|
1409
|
+
this.element = element;
|
|
1410
|
+
this.config = Object.assign(Object.assign({}, defaultConfig$2()), config);
|
|
1411
|
+
this.handleShow = this.handleShow.bind(this);
|
|
1412
|
+
this.handleHide = this.handleHide.bind(this);
|
|
1413
|
+
this.show = this.show.bind(this);
|
|
1414
|
+
this.hide = this.hide.bind(this);
|
|
1415
|
+
this.headerFirstItemSpacing = this.headerFirstItemSpacing.bind(this);
|
|
1416
|
+
Modal.moveToModalRoot = Modal.moveToModalRoot.bind(this);
|
|
1417
|
+
Modal.lockBody = Modal.lockBody.bind(this);
|
|
1418
|
+
Modal.unlockBody = Modal.unlockBody.bind(this);
|
|
1419
|
+
this.element.ODS_Modal = this;
|
|
1420
|
+
this.init();
|
|
1421
|
+
return this;
|
|
1422
|
+
}
|
|
1423
|
+
return _createClass(Modal, [{
|
|
1424
|
+
key: "handleShow",
|
|
1425
|
+
value: function handleShow(el) {
|
|
1426
|
+
Modal.lockBody();
|
|
1427
|
+
if (el) el.classList.add(this.config.classModalIsOpen);
|
|
1428
|
+
// Long modals can have first focusabble element under the fold, so static content above the fold should be focused instead to prevent undesirable scrolling
|
|
1429
|
+
var initialFocusEl = el.querySelector("[data-a11y-dialog-initial-focus]");
|
|
1430
|
+
if (!initialFocusEl) {
|
|
1431
|
+
return;
|
|
1432
|
+
}
|
|
1433
|
+
// set tabindex to -1 so element can't be focused via keyboard
|
|
1434
|
+
if (!isTabbable(initialFocusEl)) {
|
|
1435
|
+
initialFocusEl.setAttribute("tabindex", "-1");
|
|
1436
|
+
}
|
|
1437
|
+
initialFocusEl.focus();
|
|
1438
|
+
}
|
|
1439
|
+
}, {
|
|
1440
|
+
key: "handleHide",
|
|
1441
|
+
value: function handleHide(el) {
|
|
1442
|
+
Modal.unlockBody();
|
|
1443
|
+
if (el) el.classList.remove(this.config.classModalIsOpen);
|
|
1444
|
+
}
|
|
1445
|
+
}, {
|
|
1446
|
+
key: "show",
|
|
1447
|
+
value: function show() {
|
|
1448
|
+
this.instance.show();
|
|
1449
|
+
}
|
|
1450
|
+
}, {
|
|
1451
|
+
key: "hide",
|
|
1452
|
+
value: function hide() {
|
|
1453
|
+
this.instance.hide();
|
|
1454
|
+
}
|
|
1455
|
+
}, {
|
|
1456
|
+
key: "headerFirstItemSpacing",
|
|
1457
|
+
value: function headerFirstItemSpacing() {
|
|
1458
|
+
/**
|
|
1459
|
+
* Target the first element which is not .btn inside .modal__header and add margin-right 40px.
|
|
1460
|
+
* css has its limitations and it is not possible with pseudo selectors
|
|
1461
|
+
*/
|
|
1462
|
+
var modalHeader = this.element.querySelector(".modal__header");
|
|
1463
|
+
if (modalHeader) {
|
|
1464
|
+
var firstNonBtnElement = Array.from(modalHeader.children).find(function (child) {
|
|
1465
|
+
return !child.classList.contains("btn");
|
|
1466
|
+
});
|
|
1467
|
+
if (firstNonBtnElement) {
|
|
1468
|
+
firstNonBtnElement.style.marginRight = "40px";
|
|
1469
|
+
}
|
|
1470
|
+
}
|
|
1471
|
+
}
|
|
1472
|
+
}, {
|
|
1473
|
+
key: "init",
|
|
1474
|
+
value: function init() {
|
|
1475
|
+
var _this = this;
|
|
1476
|
+
if (this.config.modalsRoot) {
|
|
1477
|
+
Modal.moveToModalRoot(this.element, document.querySelector(this.config.modalsRoot));
|
|
1478
|
+
}
|
|
1479
|
+
this.instance = new A11yDialog(this.element);
|
|
1480
|
+
this.instance.on("show", function (event) {
|
|
1481
|
+
var dialogEl = event.currentTarget;
|
|
1482
|
+
_this.handleShow(dialogEl);
|
|
1483
|
+
});
|
|
1484
|
+
this.instance.on("hide", function (event) {
|
|
1485
|
+
var dialogEl = event.currentTarget;
|
|
1486
|
+
_this.handleHide(dialogEl);
|
|
1487
|
+
});
|
|
1488
|
+
this.headerFirstItemSpacing();
|
|
1489
|
+
}
|
|
1490
|
+
}, {
|
|
1491
|
+
key: "destroy",
|
|
1492
|
+
value: function destroy() {
|
|
1493
|
+
this.instance.destroy();
|
|
1494
|
+
this.element.ODS_Modal = this;
|
|
1495
|
+
}
|
|
1496
|
+
}, {
|
|
1497
|
+
key: "update",
|
|
1498
|
+
value: function update() {
|
|
1499
|
+
this.destroy();
|
|
1500
|
+
this.init();
|
|
1501
|
+
}
|
|
1502
|
+
}], [{
|
|
1503
|
+
key: "getInstance",
|
|
1504
|
+
value: function getInstance(el) {
|
|
1505
|
+
if (!el) return null;
|
|
1506
|
+
var modalEl = el;
|
|
1507
|
+
return modalEl.ODS_Modal || null;
|
|
1508
|
+
}
|
|
1509
|
+
}, {
|
|
1510
|
+
key: "moveToModalRoot",
|
|
1511
|
+
value: function moveToModalRoot(el, container) {
|
|
1512
|
+
var _a;
|
|
1513
|
+
if (container) {
|
|
1514
|
+
container.appendChild(el);
|
|
1515
|
+
} else {
|
|
1516
|
+
console.warn("`modalsRoot: ".concat((_a = this.config) === null || _a === void 0 ? void 0 : _a.modalsRoot, "` element is not present in DOM. Modal will be placed inside content which can affect it's styling. Please provide `modalsRoot` selector (should be placed outside of main contant, usualy in end of <body /> tag)"));
|
|
1517
|
+
}
|
|
1518
|
+
}
|
|
1519
|
+
}, {
|
|
1520
|
+
key: "lockBody",
|
|
1521
|
+
value: function lockBody(className, root) {
|
|
1522
|
+
var _a, _b;
|
|
1523
|
+
var actualClassName = className || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.classModalIsOpenBody);
|
|
1524
|
+
var actualRoot = root || ((_b = this.config) === null || _b === void 0 ? void 0 : _b.root);
|
|
1525
|
+
var container = document.querySelector(actualRoot);
|
|
1526
|
+
// store current scrollTop value
|
|
1527
|
+
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
|
|
1528
|
+
document.body.setAttribute("data-lock-scrolltop", scrollTop.toString());
|
|
1529
|
+
// add locking styles to body
|
|
1530
|
+
document.body.style.height = "100%";
|
|
1531
|
+
document.body.style.width = "100%";
|
|
1532
|
+
document.body.style.overflow = "hidden";
|
|
1533
|
+
document.body.style.position = "fixed";
|
|
1534
|
+
// add locking styles to scrollTop
|
|
1535
|
+
if (container) {
|
|
1536
|
+
container.style.height = "100%";
|
|
1537
|
+
container.style.width = "100%";
|
|
1538
|
+
container.style.overflow = "hidden";
|
|
1539
|
+
container.style.position = "fixed";
|
|
1540
|
+
// scroll page-container to scrollTop position
|
|
1541
|
+
container.scrollTop = scrollTop;
|
|
1542
|
+
}
|
|
1543
|
+
// add modal class
|
|
1544
|
+
document.body.classList.add(actualClassName);
|
|
1545
|
+
// attempt to scroll top fixed position
|
|
1546
|
+
window.requestAnimationFrame(function () {
|
|
1547
|
+
window.scrollTo(0, scrollTop);
|
|
1548
|
+
});
|
|
1549
|
+
}
|
|
1550
|
+
}, {
|
|
1551
|
+
key: "unlockBody",
|
|
1552
|
+
value: function unlockBody(className, root) {
|
|
1553
|
+
var _a, _b;
|
|
1554
|
+
var actualClassName = className || ((_a = this.config) === null || _a === void 0 ? void 0 : _a.classModalIsOpenBody);
|
|
1555
|
+
var actualRoot = root || ((_b = this.config) === null || _b === void 0 ? void 0 : _b.root);
|
|
1556
|
+
var container = document.querySelector(actualRoot);
|
|
1557
|
+
var scrollTop = document.body.getAttribute("data-lock-scrolltop") || "0";
|
|
1558
|
+
// remove locking styles from body
|
|
1559
|
+
document.body.style.height = "";
|
|
1560
|
+
document.body.style.width = "";
|
|
1561
|
+
document.body.style.overflow = "";
|
|
1562
|
+
document.body.style.position = "";
|
|
1563
|
+
// add modal class
|
|
1564
|
+
document.body.classList.remove(actualClassName);
|
|
1565
|
+
// remove locking styles from page-container
|
|
1566
|
+
if (container) {
|
|
1567
|
+
container.style.height = "";
|
|
1568
|
+
container.style.width = "";
|
|
1569
|
+
container.style.overflow = "";
|
|
1570
|
+
container.style.position = "";
|
|
1571
|
+
}
|
|
1572
|
+
// set scroll position back
|
|
1573
|
+
window.requestAnimationFrame(function () {
|
|
1574
|
+
window.scrollTo({
|
|
1575
|
+
left: 0,
|
|
1576
|
+
top: parseInt(scrollTop, 10),
|
|
1577
|
+
behavior: "instant"
|
|
1578
|
+
});
|
|
1579
|
+
});
|
|
1580
|
+
}
|
|
1581
|
+
}]);
|
|
1582
|
+
}();
|
|
1583
|
+
|
|
1584
|
+
// we use array to include old browser key names like IE11
|
|
1585
|
+
// ie. navigation keys https://developer.mozilla.org/en-US/docs/Web/API/UI_Events/Keyboard_event_key_values#navigation_keys
|
|
1586
|
+
var keys = {
|
|
1587
|
+
TAB: ['Tab'],
|
|
1588
|
+
ARROWLEFT: ['Left', 'ArrowLeft'],
|
|
1589
|
+
ARROWUP: ['Up', 'ArrowUp'],
|
|
1590
|
+
ARROWRIGHT: ['Right', 'ArrowRight'],
|
|
1591
|
+
ARROWDOWN: ['Down', 'ArrowDown']
|
|
1592
|
+
};
|
|
1593
|
+
|
|
1594
|
+
var RovingTabindex = /*#__PURE__*/function () {
|
|
1595
|
+
function RovingTabindex(elems) {
|
|
1596
|
+
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
|
|
1597
|
+
direction: 'horizontal'
|
|
1598
|
+
};
|
|
1599
|
+
_classCallCheck(this, RovingTabindex);
|
|
1600
|
+
this.elems = elems;
|
|
1601
|
+
this.config = config;
|
|
1602
|
+
this.isActive = false;
|
|
1603
|
+
this.onKeydown = this.onKeydown.bind(this);
|
|
1604
|
+
}
|
|
1605
|
+
return _createClass(RovingTabindex, [{
|
|
1606
|
+
key: "init",
|
|
1607
|
+
value: function init() {
|
|
1608
|
+
document.addEventListener('keydown', this.onKeydown);
|
|
1609
|
+
this.isActive = true;
|
|
1610
|
+
}
|
|
1611
|
+
}, {
|
|
1612
|
+
key: "destroy",
|
|
1613
|
+
value: function destroy() {
|
|
1614
|
+
document.removeEventListener('keydown', this.onKeydown);
|
|
1615
|
+
this.isActive = false;
|
|
1616
|
+
}
|
|
1617
|
+
}, {
|
|
1618
|
+
key: "update",
|
|
1619
|
+
value: function update(elems) {
|
|
1620
|
+
this.elems = elems;
|
|
1621
|
+
}
|
|
1622
|
+
}, {
|
|
1623
|
+
key: "onKeydown",
|
|
1624
|
+
value: function onKeydown(e) {
|
|
1625
|
+
var activeElemIndex = this.elems.indexOf(document.activeElement);
|
|
1626
|
+
if ((keys.ARROWUP.includes(e.key) || keys.ARROWDOWN.includes(e.key)) && this.config.direction === 'horizontal') {
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
if ((keys.ARROWLEFT.includes(e.key) || keys.ARROWRIGHT.includes(e.key)) && this.config.direction === 'vertical') {
|
|
1630
|
+
return;
|
|
1631
|
+
}
|
|
1632
|
+
if (keys.ARROWDOWN.includes(e.key) || keys.ARROWRIGHT.includes(e.key)) {
|
|
1633
|
+
e.preventDefault();
|
|
1634
|
+
if (activeElemIndex >= 0 && activeElemIndex < this.elems.length - 1) {
|
|
1635
|
+
this.elems[activeElemIndex + 1].focus();
|
|
1636
|
+
} else {
|
|
1637
|
+
this.elems[0].focus();
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
if (keys.ARROWUP.includes(e.key) || keys.ARROWLEFT.includes(e.key)) {
|
|
1641
|
+
e.preventDefault();
|
|
1642
|
+
if (activeElemIndex >= 1) {
|
|
1643
|
+
this.elems[activeElemIndex - 1].focus();
|
|
1644
|
+
} else {
|
|
1645
|
+
this.elems[this.elems.length - 1].focus();
|
|
1646
|
+
}
|
|
1647
|
+
}
|
|
1648
|
+
if (keys.TAB.includes(e.key)) {
|
|
1649
|
+
this.destroy();
|
|
1650
|
+
}
|
|
1651
|
+
}
|
|
1652
|
+
}]);
|
|
1653
|
+
}();
|
|
1654
|
+
|
|
1655
|
+
var defaultConfig$1 = {
|
|
1656
|
+
tabSelector: '[role="tab"]'
|
|
1657
|
+
};
|
|
1658
|
+
var Tabs = /*#__PURE__*/function () {
|
|
1659
|
+
function Tabs(element, config) {
|
|
1660
|
+
_classCallCheck(this, Tabs);
|
|
1661
|
+
this.isActive = function (el) {
|
|
1662
|
+
return el ? !el.hasAttribute("hidden") : false;
|
|
1663
|
+
};
|
|
1664
|
+
this.isSelected = function (el) {
|
|
1665
|
+
return el.getAttribute("aria-selected") === "true";
|
|
1666
|
+
};
|
|
1667
|
+
this.element = element;
|
|
1668
|
+
this.config = Object.assign(Object.assign({}, defaultConfig$1), config);
|
|
1669
|
+
this.tabs = [];
|
|
1670
|
+
this.tabPanels = [];
|
|
1671
|
+
this.activeTabIndex = null;
|
|
1672
|
+
this.rovingTabindex = null;
|
|
1673
|
+
this.handleClick = this.handleClick.bind(this);
|
|
1674
|
+
this.handleTabFocus = this.handleTabFocus.bind(this);
|
|
1675
|
+
this.element.ODS_Tabs = this;
|
|
1676
|
+
this.init();
|
|
1677
|
+
return this;
|
|
1678
|
+
}
|
|
1679
|
+
return _createClass(Tabs, [{
|
|
1680
|
+
key: "init",
|
|
1681
|
+
value: function init() {
|
|
1682
|
+
var _this = this;
|
|
1683
|
+
this.tabs = Array.from(this.element.querySelectorAll(this.config.tabSelector));
|
|
1684
|
+
this.tabs.map(function (tab, index) {
|
|
1685
|
+
var controlId = tab.getAttribute("aria-controls");
|
|
1686
|
+
_this.tabPanels.push(controlId ? document.getElementById(controlId) : null);
|
|
1687
|
+
tab.addEventListener("click", _this.handleClick);
|
|
1688
|
+
tab.addEventListener("focus", _this.handleTabFocus);
|
|
1689
|
+
if (_this.isSelected(tab)) {
|
|
1690
|
+
_this.activeTabIndex = index;
|
|
1691
|
+
}
|
|
1692
|
+
return tab;
|
|
1693
|
+
});
|
|
1694
|
+
if (!this.rovingTabindex) {
|
|
1695
|
+
this.rovingTabindex = new RovingTabindex(this.tabs, {
|
|
1696
|
+
direction: "any"
|
|
1697
|
+
});
|
|
1698
|
+
} else {
|
|
1699
|
+
this.rovingTabindex.update(this.tabs);
|
|
1700
|
+
}
|
|
1701
|
+
if (this.activeTabIndex !== null) {
|
|
1702
|
+
this.toggleTabPanel(this.tabPanels[this.activeTabIndex], "on");
|
|
1703
|
+
} else if (this.tabs.length > 0) {
|
|
1704
|
+
this.activateNthTab(0);
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}, {
|
|
1708
|
+
key: "destroy",
|
|
1709
|
+
value: function destroy() {
|
|
1710
|
+
var _this2 = this;
|
|
1711
|
+
this.tabs.map(function (tab) {
|
|
1712
|
+
tab.removeEventListener("click", _this2.handleClick);
|
|
1713
|
+
tab.removeEventListener("focus", _this2.handleTabFocus);
|
|
1714
|
+
return tab;
|
|
1715
|
+
});
|
|
1716
|
+
this.tabs = [];
|
|
1717
|
+
this.tabPanels = [];
|
|
1718
|
+
if (this.rovingTabindex) {
|
|
1719
|
+
this.rovingTabindex.destroy();
|
|
1720
|
+
}
|
|
1721
|
+
this.element.ODS_Tabs = null;
|
|
1722
|
+
}
|
|
1723
|
+
}, {
|
|
1724
|
+
key: "update",
|
|
1725
|
+
value: function update() {
|
|
1726
|
+
this.destroy();
|
|
1727
|
+
this.init();
|
|
1728
|
+
}
|
|
1729
|
+
}, {
|
|
1730
|
+
key: "handleClick",
|
|
1731
|
+
value: function handleClick(e) {
|
|
1732
|
+
var _this3 = this;
|
|
1733
|
+
var clickedTab = e.currentTarget;
|
|
1734
|
+
if (clickedTab.hasAttribute("aria-disabled")) {
|
|
1735
|
+
e.preventDefault();
|
|
1736
|
+
return;
|
|
1737
|
+
}
|
|
1738
|
+
this.tabs.map(function (tab, i) {
|
|
1739
|
+
if (tab === clickedTab) {
|
|
1740
|
+
_this3.activeTabIndex = i;
|
|
1741
|
+
return _this3.toggleTab(tab, "on");
|
|
1742
|
+
}
|
|
1743
|
+
return _this3.toggleTab(tab, "off");
|
|
1744
|
+
});
|
|
1745
|
+
this.tabPanels.map(function (tabPanel) {
|
|
1746
|
+
if (tabPanel && tabPanel.getAttribute("id") === clickedTab.getAttribute("aria-controls")) {
|
|
1747
|
+
return _this3.toggleTabPanel(tabPanel, "on");
|
|
1748
|
+
}
|
|
1749
|
+
return _this3.toggleTabPanel(tabPanel, "off");
|
|
1750
|
+
});
|
|
1751
|
+
}
|
|
1752
|
+
}, {
|
|
1753
|
+
key: "toggleTab",
|
|
1754
|
+
value: function toggleTab(el, state) {
|
|
1755
|
+
var isActive = this.isSelected(el);
|
|
1756
|
+
if (state === "on" && !isActive) {
|
|
1757
|
+
el.setAttribute("aria-selected", "true");
|
|
1758
|
+
el.setAttribute("tabindex", "0");
|
|
1759
|
+
}
|
|
1760
|
+
if (state === "off" && isActive) {
|
|
1761
|
+
el.setAttribute("aria-selected", "false");
|
|
1762
|
+
el.setAttribute("tabindex", "-1");
|
|
1763
|
+
}
|
|
1764
|
+
}
|
|
1765
|
+
}, {
|
|
1766
|
+
key: "toggleTabPanel",
|
|
1767
|
+
value: function toggleTabPanel(el, state) {
|
|
1768
|
+
if (!el) return;
|
|
1769
|
+
var isActive = this.isActive(el);
|
|
1770
|
+
if (state === "on" && !isActive) {
|
|
1771
|
+
el.removeAttribute("hidden");
|
|
1772
|
+
}
|
|
1773
|
+
if (state === "off" && isActive) {
|
|
1774
|
+
el.setAttribute("hidden", "");
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
}, {
|
|
1778
|
+
key: "activateNthTab",
|
|
1779
|
+
value: function activateNthTab(index) {
|
|
1780
|
+
var _this4 = this;
|
|
1781
|
+
this.tabs.map(function (tab, i) {
|
|
1782
|
+
if (i === index) {
|
|
1783
|
+
_this4.activeTabIndex = i;
|
|
1784
|
+
return _this4.toggleTab(tab, "on");
|
|
1785
|
+
}
|
|
1786
|
+
return _this4.toggleTab(tab, "off");
|
|
1787
|
+
});
|
|
1788
|
+
this.tabPanels.map(function (tabPanel, i) {
|
|
1789
|
+
if (i === index) {
|
|
1790
|
+
return _this4.toggleTabPanel(tabPanel, "on");
|
|
1791
|
+
}
|
|
1792
|
+
return _this4.toggleTabPanel(tabPanel, "off");
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
}, {
|
|
1796
|
+
key: "handleTabFocus",
|
|
1797
|
+
value: function handleTabFocus() {
|
|
1798
|
+
if (this.rovingTabindex && !this.rovingTabindex.isActive) {
|
|
1799
|
+
this.rovingTabindex.init();
|
|
1800
|
+
}
|
|
1801
|
+
}
|
|
1802
|
+
}], [{
|
|
1803
|
+
key: "getInstance",
|
|
1804
|
+
value: function getInstance(el) {
|
|
1805
|
+
return el && el.ODS_Tabs ? el.ODS_Tabs : null;
|
|
1806
|
+
}
|
|
1807
|
+
}]);
|
|
1808
|
+
}();
|
|
1809
|
+
|
|
564
1810
|
function moduleFactory(Module, selector) {
|
|
565
1811
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
566
1812
|
var elements = Array.from(document.querySelectorAll(selector));
|
|
@@ -573,24 +1819,23 @@ function destroyModulesWithin(container) {
|
|
|
573
1819
|
var destroyedInstances = {};
|
|
574
1820
|
Object.keys(window.ODS.instances).forEach(function (moduleName) {
|
|
575
1821
|
window.ODS.instances[moduleName].forEach(function (instance) {
|
|
576
|
-
if (_typeof(destroyedInstances[moduleName]) !==
|
|
1822
|
+
if (_typeof(destroyedInstances[moduleName]) !== "object") {
|
|
577
1823
|
destroyedInstances[moduleName] = [];
|
|
578
1824
|
}
|
|
579
1825
|
var isInContainer = container.contains(instance.element);
|
|
580
|
-
if (moduleName ===
|
|
1826
|
+
if (moduleName === "modal") {
|
|
581
1827
|
var _instance$instance;
|
|
582
|
-
// eslint-disable-next-line
|
|
583
1828
|
isInContainer = (_instance$instance = instance.instance) === null || _instance$instance === void 0 ? void 0 : _instance$instance._openers.every(function (opener) {
|
|
584
1829
|
return container.contains(opener);
|
|
585
1830
|
});
|
|
586
|
-
} else if (moduleName ===
|
|
1831
|
+
} else if (moduleName === "tooltip") {
|
|
587
1832
|
isInContainer = container.contains(instance.trigger);
|
|
588
1833
|
}
|
|
589
1834
|
if (isInContainer) {
|
|
590
1835
|
instance.destroy();
|
|
591
1836
|
destroyedInstances[moduleName].push(instance);
|
|
592
1837
|
}
|
|
593
|
-
if (isInContainer && removeOrphanedNodes && [
|
|
1838
|
+
if (isInContainer && removeOrphanedNodes && ["modal", "tooltip"].includes(moduleName)) {
|
|
594
1839
|
instance.element.remove();
|
|
595
1840
|
}
|
|
596
1841
|
});
|
|
@@ -615,6 +1860,9 @@ function initModulesWithin(container) {
|
|
|
615
1860
|
});
|
|
616
1861
|
}
|
|
617
1862
|
if (elements.length) {
|
|
1863
|
+
if (!Array.isArray(window.ODS.instances[name])) {
|
|
1864
|
+
window.ODS.instances[name] = [];
|
|
1865
|
+
}
|
|
618
1866
|
instances[name] = elements.map(function (element) {
|
|
619
1867
|
return new module.Module(element);
|
|
620
1868
|
});
|
|
@@ -624,7 +1872,6 @@ function initModulesWithin(container) {
|
|
|
624
1872
|
return instances;
|
|
625
1873
|
}
|
|
626
1874
|
|
|
627
|
-
// eslint-disable-next-line import/no-cycle
|
|
628
1875
|
function toggle(props) {
|
|
629
1876
|
var element = props.element,
|
|
630
1877
|
attribute = props.attribute,
|
|
@@ -1023,7 +2270,6 @@ var SameHeight = /*#__PURE__*/function () {
|
|
|
1023
2270
|
key: "init",
|
|
1024
2271
|
value: function init() {
|
|
1025
2272
|
var _this2 = this;
|
|
1026
|
-
console.log("test");
|
|
1027
2273
|
var imgLoaded = [];
|
|
1028
2274
|
// Instead of finding one child per parent element, we find all elements with the attribute
|
|
1029
2275
|
this.children = this.element.querySelectorAll('[data-same-height-child="true"]');
|
|
@@ -1140,12 +2386,11 @@ var moduleSelectorPairs = [
|
|
|
1140
2386
|
// name: 'Loader',
|
|
1141
2387
|
// selector: '[data-loader]',
|
|
1142
2388
|
// },
|
|
1143
|
-
// {
|
|
1144
|
-
// Module: Modal,
|
|
1145
|
-
// name: 'Modal',
|
|
1146
|
-
// selector: '[data-modal]',
|
|
1147
|
-
// },
|
|
1148
2389
|
{
|
|
2390
|
+
Module: Modal,
|
|
2391
|
+
name: "Modal",
|
|
2392
|
+
selector: "[data-modal]"
|
|
2393
|
+
}, {
|
|
1149
2394
|
Module: SameHeight,
|
|
1150
2395
|
name: "SameHeight",
|
|
1151
2396
|
selector: "[data-same-height]"
|
|
@@ -1165,12 +2410,11 @@ var moduleSelectorPairs = [
|
|
|
1165
2410
|
// name: 'Table',
|
|
1166
2411
|
// selector: '[data-table]',
|
|
1167
2412
|
// },
|
|
1168
|
-
// {
|
|
1169
|
-
// Module: Tabs,
|
|
1170
|
-
// name: 'Tabs',
|
|
1171
|
-
// selector: '[data-tabs]',
|
|
1172
|
-
// },
|
|
1173
2413
|
{
|
|
2414
|
+
Module: Tabs,
|
|
2415
|
+
name: "Tabs",
|
|
2416
|
+
selector: "[data-tabs]"
|
|
2417
|
+
}, {
|
|
1174
2418
|
Module: Toggle,
|
|
1175
2419
|
name: "Toggle",
|
|
1176
2420
|
selector: "[data-toggle]"
|