@govtechsg/sgds-web-component 3.2.0 → 3.3.0
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/Masthead/index.js +46 -15
- package/components/Badge/badge.js +1 -1
- package/components/Badge/index.umd.js +4532 -197
- package/components/Badge/index.umd.js.map +1 -1
- package/components/Badge/sgds-badge.js +70 -30
- package/components/Badge/sgds-badge.js.map +1 -1
- package/components/Breadcrumb/index.umd.js +3 -3
- package/components/Breadcrumb/index.umd.js.map +1 -1
- package/components/Card/index.umd.js +2 -2
- package/components/Card/index.umd.js.map +1 -1
- package/components/ComboBox/combo-box-item2.js +1 -1
- package/components/ComboBox/index.umd.js +1321 -174
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/Datepicker/index.umd.js +61 -17
- package/components/Datepicker/index.umd.js.map +1 -1
- package/components/Datepicker/sgds-datepicker.js +29 -11
- package/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/components/DescriptionList/index.umd.js.map +1 -1
- package/components/Dropdown/dropdown-item.js +1 -1
- package/components/Dropdown/index.umd.js +1 -1
- package/components/IconList/icon-list.js +1 -1
- package/components/IconList/index.umd.js +1 -1
- package/components/Input/index.umd.js +33 -6
- package/components/Input/index.umd.js.map +1 -1
- package/components/Input/input.js +1 -1
- package/components/Input/sgds-input.js +32 -5
- package/components/Input/sgds-input.js.map +1 -1
- package/components/Link/index.umd.js +2 -2
- package/components/Link/index.umd.js.map +1 -1
- package/components/Link/link.js +1 -1
- package/components/Link/sgds-link.js +1 -1
- package/components/Link/sgds-link.js.map +1 -1
- package/components/Mainnav/index.umd.js +4 -4
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Mainnav/mainnav-item.js +1 -1
- package/components/Mainnav/mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav.js +1 -1
- package/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/components/Masthead/index.umd.js +46 -15
- package/components/Masthead/index.umd.js.map +1 -1
- package/components/Masthead/masthead.js +1 -1
- package/components/Masthead/sgds-masthead.js +45 -14
- package/components/Masthead/sgds-masthead.js.map +1 -1
- package/components/Modal/index.umd.js.map +1 -1
- package/components/QuantityToggle/index.umd.js +33 -6
- package/components/QuantityToggle/index.umd.js.map +1 -1
- package/components/Select/index.umd.js +1 -1
- package/components/Select/select-item2.js +1 -1
- package/components/Subnav/index.umd.js +1 -1
- package/components/Subnav/subnav.js +1 -1
- package/components/Switch/index.umd.js.map +1 -1
- package/components/Table/index.umd.js.map +1 -1
- package/components/Tooltip/index.umd.js +1 -1
- package/components/Tooltip/tooltip.js +1 -1
- package/components/index.umd.js +18901 -18771
- package/components/index.umd.js.map +1 -1
- package/css/reboot.css +0 -1
- package/index.umd.js +18885 -18755
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/components/Badge/badge.cjs.js +1 -1
- package/react/components/Badge/badge.js +1 -1
- package/react/components/Badge/sgds-badge.cjs.js +69 -29
- package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/react/components/Badge/sgds-badge.js +70 -30
- package/react/components/Badge/sgds-badge.js.map +1 -1
- package/react/components/ComboBox/combo-box-item.cjs2.js +1 -1
- package/react/components/ComboBox/combo-box-item2.js +1 -1
- package/react/components/Datepicker/sgds-datepicker.cjs.js +29 -11
- package/react/components/Datepicker/sgds-datepicker.cjs.js.map +1 -1
- package/react/components/Datepicker/sgds-datepicker.js +29 -11
- package/react/components/Datepicker/sgds-datepicker.js.map +1 -1
- package/react/components/Dropdown/dropdown-item.cjs.js +1 -1
- package/react/components/Dropdown/dropdown-item.js +1 -1
- package/react/components/IconList/icon-list.cjs.js +1 -1
- package/react/components/IconList/icon-list.js +1 -1
- package/react/components/Input/input.cjs.js +1 -1
- package/react/components/Input/input.js +1 -1
- package/react/components/Input/sgds-input.cjs.js +32 -5
- package/react/components/Input/sgds-input.cjs.js.map +1 -1
- package/react/components/Input/sgds-input.js +32 -5
- package/react/components/Input/sgds-input.js.map +1 -1
- package/react/components/Link/link.cjs.js +1 -1
- package/react/components/Link/link.js +1 -1
- package/react/components/Link/sgds-link.cjs.js +1 -1
- package/react/components/Link/sgds-link.cjs.js.map +1 -1
- package/react/components/Link/sgds-link.js +1 -1
- package/react/components/Link/sgds-link.js.map +1 -1
- package/react/components/Mainnav/mainnav-item.cjs.js +1 -1
- package/react/components/Mainnav/mainnav-item.js +1 -1
- package/react/components/Mainnav/mainnav.cjs.js +1 -1
- package/react/components/Mainnav/mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js +1 -1
- package/react/components/Mainnav/sgds-mainnav.cjs.js.map +1 -1
- package/react/components/Mainnav/sgds-mainnav.js +1 -1
- package/react/components/Mainnav/sgds-mainnav.js.map +1 -1
- package/react/components/Masthead/masthead.cjs.js +1 -1
- package/react/components/Masthead/masthead.js +1 -1
- package/react/components/Masthead/sgds-masthead.cjs.js +45 -14
- package/react/components/Masthead/sgds-masthead.cjs.js.map +1 -1
- package/react/components/Masthead/sgds-masthead.js +45 -14
- package/react/components/Masthead/sgds-masthead.js.map +1 -1
- package/react/components/Select/select-item.cjs2.js +1 -1
- package/react/components/Select/select-item2.js +1 -1
- package/react/components/Subnav/subnav.cjs.js +1 -1
- package/react/components/Subnav/subnav.js +1 -1
- package/react/components/Tooltip/tooltip.cjs.js +1 -1
- package/react/components/Tooltip/tooltip.js +1 -1
- package/react/index.cjs.js +8 -8
- package/react/index.js +1 -1
- package/react/utils/slot.cjs.js +18 -0
- package/react/utils/slot.cjs.js.map +1 -1
- package/react/utils/slot.js +18 -1
- package/react/utils/slot.js.map +1 -1
- package/scripts/figma/sync-figma-to-tokens/__tests__/write-tokens-to-css-var.test.d.ts +0 -0
- package/scripts/figma/sync-figma-to-tokens/color.d.ts +8 -0
- package/scripts/figma/sync-figma-to-tokens/figma_api.d.ts +8 -0
- package/scripts/figma/sync-figma-to-tokens/sync-figma-to-tokens.d.ts +1 -0
- package/scripts/figma/sync-figma-to-tokens/token_export.d.ts +5 -0
- package/scripts/figma/sync-figma-to-tokens/token_types.d.ts +52 -0
- package/scripts/figma/sync-figma-to-tokens/utils.d.ts +3 -0
- package/scripts/figma/sync-figma-to-tokens/write-tokens-to-css-var.d.ts +8 -0
- package/{components → src/components}/Badge/sgds-badge.d.ts +11 -0
- package/{components → src/components}/Datepicker/sgds-datepicker.d.ts +13 -3
- package/{components → src/components}/Input/sgds-input.d.ts +5 -1
- package/{components → src/components}/Link/sgds-link.d.ts +2 -2
- package/themes/day.css +1 -0
- package/themes/night.css +1 -0
- package/themes/root.css +2 -0
- package/utils/slot.js +18 -1
- package/utils/slot.js.map +1 -1
- package/{base → src/base}/button-element.d.ts +0 -0
- package/{base → src/base}/card-element.d.ts +0 -0
- package/{base → src/base}/dropdown-element.d.ts +0 -0
- package/{base → src/base}/dropdown-list-element.d.ts +0 -0
- package/{base → src/base}/form-control-element.d.ts +0 -0
- package/{base → src/base}/link-element.d.ts +0 -0
- package/{base → src/base}/select-element.d.ts +0 -0
- package/{base → src/base}/sgds-element.d.ts +0 -0
- package/{components → src/components}/Accordion/index.d.ts +0 -0
- package/{components → src/components}/Accordion/sgds-accordion-item.d.ts +0 -0
- package/{components → src/components}/Accordion/sgds-accordion.d.ts +0 -0
- package/{components → src/components}/Alert/index.d.ts +0 -0
- package/{components → src/components}/Alert/sgds-alert-link.d.ts +0 -0
- package/{components → src/components}/Alert/sgds-alert.d.ts +0 -0
- package/{components → src/components}/Badge/index.d.ts +0 -0
- package/{components → src/components}/Breadcrumb/index.d.ts +0 -0
- package/{components → src/components}/Breadcrumb/sgds-breadcrumb-item.d.ts +0 -0
- package/{components → src/components}/Breadcrumb/sgds-breadcrumb.d.ts +0 -0
- package/{components → src/components}/Button/index.d.ts +0 -0
- package/{components → src/components}/Button/sgds-button.d.ts +0 -0
- package/{components → src/components}/Card/index.d.ts +0 -0
- package/{components → src/components}/Card/sgds-card.d.ts +0 -0
- package/{components → src/components}/Checkbox/index.d.ts +0 -0
- package/{components → src/components}/Checkbox/sgds-checkbox-group.d.ts +0 -0
- package/{components → src/components}/Checkbox/sgds-checkbox.d.ts +0 -0
- package/{components → src/components}/ComboBox/combo-box-item.d.ts +0 -0
- package/{components → src/components}/ComboBox/index.d.ts +0 -0
- package/{components → src/components}/ComboBox/sgds-combo-box.d.ts +0 -0
- package/{components → src/components}/Datepicker/datepicker-calendar.d.ts +0 -0
- package/{components → src/components}/Datepicker/datepicker-header.d.ts +0 -0
- package/{components → src/components}/Datepicker/datepicker-input.d.ts +0 -0
- package/{components → src/components}/Datepicker/index.d.ts +0 -0
- package/{components → src/components}/Datepicker/types.d.ts +0 -0
- package/{components → src/components}/DescriptionList/index.d.ts +0 -0
- package/{components → src/components}/DescriptionList/sgds-description-list-group.d.ts +0 -0
- package/{components → src/components}/DescriptionList/sgds-description-list.d.ts +0 -0
- package/{components → src/components}/Divider/index.d.ts +0 -0
- package/{components → src/components}/Divider/sgds-divider.d.ts +0 -0
- package/{components → src/components}/Drawer/index.d.ts +0 -0
- package/{components → src/components}/Drawer/sgds-drawer.d.ts +0 -0
- package/{components → src/components}/Dropdown/index.d.ts +0 -0
- package/{components → src/components}/Dropdown/sgds-dropdown-item.d.ts +0 -0
- package/{components → src/components}/Dropdown/sgds-dropdown.d.ts +0 -0
- package/{components → src/components}/FileUpload/index.d.ts +0 -0
- package/{components → src/components}/FileUpload/sgds-file-upload.d.ts +0 -0
- package/{components → src/components}/Footer/index.d.ts +0 -0
- package/{components → src/components}/Footer/sgds-footer-item.d.ts +0 -0
- package/{components → src/components}/Footer/sgds-footer.d.ts +0 -0
- package/{components → src/components}/Icon/icon-registry.d.ts +0 -0
- package/{components → src/components}/Icon/icons/archive.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-bar-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-bar-left.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-bar-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-bar-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-circle-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-circle-left.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-circle-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-circle-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-clockwise.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-left.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-repeat.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-square-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-square-left.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-square-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-square-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/arrow-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bank-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bell-slash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bell.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bi-funnel.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bookmark-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bookmark.d.ts +0 -0
- package/{components → src/components}/Icon/icons/box-arrow-up-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/box-seam.d.ts +0 -0
- package/{components → src/components}/Icon/icons/building.d.ts +0 -0
- package/{components → src/components}/Icon/icons/bus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/calculator.d.ts +0 -0
- package/{components → src/components}/Icon/icons/calendar-check.d.ts +0 -0
- package/{components → src/components}/Icon/icons/calendar-x.d.ts +0 -0
- package/{components → src/components}/Icon/icons/calendar.d.ts +0 -0
- package/{components → src/components}/Icon/icons/camera.d.ts +0 -0
- package/{components → src/components}/Icon/icons/car.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chat-dots.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chat-left-text.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chat.d.ts +0 -0
- package/{components → src/components}/Icon/icons/check-circle-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/check-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/check.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chevron-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chevron-left.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chevron-right.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chevron-selector-vertical.d.ts +0 -0
- package/{components → src/components}/Icon/icons/chevron-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/clock.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cloud-check.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cloud-download.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cloud-upload.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cloud.d.ts +0 -0
- package/{components → src/components}/Icon/icons/compass.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cross.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cursor-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/cursor.d.ts +0 -0
- package/{components → src/components}/Icon/icons/dash-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/dash-square.d.ts +0 -0
- package/{components → src/components}/Icon/icons/dash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/download.d.ts +0 -0
- package/{components → src/components}/Icon/icons/edit.d.ts +0 -0
- package/{components → src/components}/Icon/icons/exclamation-circle-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/exclamation-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/exclamation-triangle-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/exclamation-triangle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/exclamation.d.ts +0 -0
- package/{components → src/components}/Icon/icons/eye-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/eye-slash-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/eye-slash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/eye.d.ts +0 -0
- package/{components → src/components}/Icon/icons/facebook.d.ts +0 -0
- package/{components → src/components}/Icon/icons/file-earmark-text.d.ts +0 -0
- package/{components → src/components}/Icon/icons/file-pdf.d.ts +0 -0
- package/{components → src/components}/Icon/icons/file-plus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/file-text.d.ts +0 -0
- package/{components → src/components}/Icon/icons/file.d.ts +0 -0
- package/{components → src/components}/Icon/icons/files.d.ts +0 -0
- package/{components → src/components}/Icon/icons/folder-check.d.ts +0 -0
- package/{components → src/components}/Icon/icons/folder-minus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/folder-plus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/folder.d.ts +0 -0
- package/{components → src/components}/Icon/icons/gear.d.ts +0 -0
- package/{components → src/components}/Icon/icons/geo-alt.d.ts +0 -0
- package/{components → src/components}/Icon/icons/geo-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/geo.d.ts +0 -0
- package/{components → src/components}/Icon/icons/globe-alt.d.ts +0 -0
- package/{components → src/components}/Icon/icons/globe.d.ts +0 -0
- package/{components → src/components}/Icon/icons/google.d.ts +0 -0
- package/{components → src/components}/Icon/icons/grid-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/hand-thumbs-down.d.ts +0 -0
- package/{components → src/components}/Icon/icons/hand-thumbs-up.d.ts +0 -0
- package/{components → src/components}/Icon/icons/hard-drive.d.ts +0 -0
- package/{components → src/components}/Icon/icons/heart.d.ts +0 -0
- package/{components → src/components}/Icon/icons/house-door.d.ts +0 -0
- package/{components → src/components}/Icon/icons/house.d.ts +0 -0
- package/{components → src/components}/Icon/icons/image.d.ts +0 -0
- package/{components → src/components}/Icon/icons/in-box.d.ts +0 -0
- package/{components → src/components}/Icon/icons/info-circle-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/info-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/instagram.d.ts +0 -0
- package/{components → src/components}/Icon/icons/laptop.d.ts +0 -0
- package/{components → src/components}/Icon/icons/layers.d.ts +0 -0
- package/{components → src/components}/Icon/icons/layout-text-window-reverse.d.ts +0 -0
- package/{components → src/components}/Icon/icons/layout-text-window.d.ts +0 -0
- package/{components → src/components}/Icon/icons/layout.d.ts +0 -0
- package/{components → src/components}/Icon/icons/lightbulb.d.ts +0 -0
- package/{components → src/components}/Icon/icons/link.d.ts +0 -0
- package/{components → src/components}/Icon/icons/linkedin.d.ts +0 -0
- package/{components → src/components}/Icon/icons/list.d.ts +0 -0
- package/{components → src/components}/Icon/icons/lock-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/lock.d.ts +0 -0
- package/{components → src/components}/Icon/icons/login.d.ts +0 -0
- package/{components → src/components}/Icon/icons/logout.d.ts +0 -0
- package/{components → src/components}/Icon/icons/luggage.d.ts +0 -0
- package/{components → src/components}/Icon/icons/mail.d.ts +0 -0
- package/{components → src/components}/Icon/icons/map.d.ts +0 -0
- package/{components → src/components}/Icon/icons/menu.d.ts +0 -0
- package/{components → src/components}/Icon/icons/microphone.d.ts +0 -0
- package/{components → src/components}/Icon/icons/monitor.d.ts +0 -0
- package/{components → src/components}/Icon/icons/paperclip.d.ts +0 -0
- package/{components → src/components}/Icon/icons/passport.d.ts +0 -0
- package/{components → src/components}/Icon/icons/pencil.d.ts +0 -0
- package/{components → src/components}/Icon/icons/pending-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/person-dash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/person-plus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/person-x.d.ts +0 -0
- package/{components → src/components}/Icon/icons/person.d.ts +0 -0
- package/{components → src/components}/Icon/icons/phone.d.ts +0 -0
- package/{components → src/components}/Icon/icons/pin-map-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/pin.d.ts +0 -0
- package/{components → src/components}/Icon/icons/placeholder.d.ts +0 -0
- package/{components → src/components}/Icon/icons/plane.d.ts +0 -0
- package/{components → src/components}/Icon/icons/plus-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/plus-square.d.ts +0 -0
- package/{components → src/components}/Icon/icons/plus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/printer.d.ts +0 -0
- package/{components → src/components}/Icon/icons/question-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/rocket.d.ts +0 -0
- package/{components → src/components}/Icon/icons/save.d.ts +0 -0
- package/{components → src/components}/Icon/icons/search.d.ts +0 -0
- package/{components → src/components}/Icon/icons/send.d.ts +0 -0
- package/{components → src/components}/Icon/icons/sg-crest.d.ts +0 -0
- package/{components → src/components}/Icon/icons/share.d.ts +0 -0
- package/{components → src/components}/Icon/icons/slash-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/sliders.d.ts +0 -0
- package/{components → src/components}/Icon/icons/speedometer.d.ts +0 -0
- package/{components → src/components}/Icon/icons/star-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/star.d.ts +0 -0
- package/{components → src/components}/Icon/icons/stoplights.d.ts +0 -0
- package/{components → src/components}/Icon/icons/switch-horizontal.d.ts +0 -0
- package/{components → src/components}/Icon/icons/switch-vertical.d.ts +0 -0
- package/{components → src/components}/Icon/icons/tablet.d.ts +0 -0
- package/{components → src/components}/Icon/icons/telephone.d.ts +0 -0
- package/{components → src/components}/Icon/icons/three-dots-vertical.d.ts +0 -0
- package/{components → src/components}/Icon/icons/three-dots.d.ts +0 -0
- package/{components → src/components}/Icon/icons/ticket.d.ts +0 -0
- package/{components → src/components}/Icon/icons/toggle-off.d.ts +0 -0
- package/{components → src/components}/Icon/icons/toggle-on.d.ts +0 -0
- package/{components → src/components}/Icon/icons/train.d.ts +0 -0
- package/{components → src/components}/Icon/icons/translate.d.ts +0 -0
- package/{components → src/components}/Icon/icons/trash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/truck.d.ts +0 -0
- package/{components → src/components}/Icon/icons/twitter-x.d.ts +0 -0
- package/{components → src/components}/Icon/icons/unlock.d.ts +0 -0
- package/{components → src/components}/Icon/icons/upload.d.ts +0 -0
- package/{components → src/components}/Icon/icons/user-circle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/user-square.d.ts +0 -0
- package/{components → src/components}/Icon/icons/users.d.ts +0 -0
- package/{components → src/components}/Icon/icons/video-recorder.d.ts +0 -0
- package/{components → src/components}/Icon/icons/volume-max.d.ts +0 -0
- package/{components → src/components}/Icon/icons/volume-x.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-dash.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-desktop.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-dock.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-fullscreen.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-plus.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-sidebar.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-split.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-stack.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window-x.d.ts +0 -0
- package/{components → src/components}/Icon/icons/window.d.ts +0 -0
- package/{components → src/components}/Icon/icons/xcircle-fill.d.ts +0 -0
- package/{components → src/components}/Icon/icons/xcircle.d.ts +0 -0
- package/{components → src/components}/Icon/icons/youtube.d.ts +0 -0
- package/{components → src/components}/Icon/icons/zoom-in.d.ts +0 -0
- package/{components → src/components}/Icon/icons/zoom-out.d.ts +0 -0
- package/{components → src/components}/Icon/index.d.ts +0 -0
- package/{components → src/components}/Icon/sgds-icon.d.ts +0 -0
- package/{components → src/components}/IconButton/index.d.ts +0 -0
- package/{components → src/components}/IconButton/sgds-icon-button.d.ts +0 -0
- package/{components → src/components}/IconList/index.d.ts +0 -0
- package/{components → src/components}/IconList/sgds-icon-list.d.ts +0 -0
- package/{components → src/components}/Input/index.d.ts +0 -0
- package/{components → src/components}/Link/index.d.ts +0 -0
- package/{components → src/components}/Mainnav/index.d.ts +0 -0
- package/{components → src/components}/Mainnav/mainnav-context.d.ts +0 -0
- package/{components → src/components}/Mainnav/sgds-mainnav-dropdown.d.ts +0 -0
- package/{components → src/components}/Mainnav/sgds-mainnav-item.d.ts +0 -0
- package/{components → src/components}/Mainnav/sgds-mainnav.d.ts +0 -0
- package/{components → src/components}/Masthead/index.d.ts +0 -0
- package/{components → src/components}/Masthead/sgds-masthead.d.ts +0 -0
- package/{components → src/components}/Modal/index.d.ts +0 -0
- package/{components → src/components}/Modal/sgds-modal.d.ts +0 -0
- package/{components → src/components}/Pagination/index.d.ts +0 -0
- package/{components → src/components}/Pagination/sgds-pagination.d.ts +0 -0
- package/{components → src/components}/ProgressBar/index.d.ts +0 -0
- package/{components → src/components}/ProgressBar/sgds-progress-bar.d.ts +0 -0
- package/{components → src/components}/QuantityToggle/index.d.ts +0 -0
- package/{components → src/components}/QuantityToggle/sgds-quantity-toggle.d.ts +0 -0
- package/{components → src/components}/Radio/index.d.ts +0 -0
- package/{components → src/components}/Radio/sgds-radio-group.d.ts +0 -0
- package/{components → src/components}/Radio/sgds-radio.d.ts +0 -0
- package/{components → src/components}/Select/index.d.ts +0 -0
- package/{components → src/components}/Select/select-item.d.ts +0 -0
- package/{components → src/components}/Select/sgds-select.d.ts +0 -0
- package/{components → src/components}/Sidenav/index.d.ts +0 -0
- package/{components → src/components}/Sidenav/sgds-sidenav-item.d.ts +0 -0
- package/{components → src/components}/Sidenav/sgds-sidenav-link.d.ts +0 -0
- package/{components → src/components}/Sidenav/sgds-sidenav.d.ts +0 -0
- package/{components → src/components}/Skeleton/index.d.ts +0 -0
- package/{components → src/components}/Skeleton/sgds-skeleton.d.ts +0 -0
- package/{components → src/components}/Spinner/index.d.ts +0 -0
- package/{components → src/components}/Spinner/sgds-spinner.d.ts +0 -0
- package/{components → src/components}/Stepper/index.d.ts +0 -0
- package/{components → src/components}/Stepper/sgds-stepper.d.ts +0 -0
- package/{components → src/components}/Subnav/index.d.ts +0 -0
- package/{components → src/components}/Subnav/sgds-subnav-item.d.ts +0 -0
- package/{components → src/components}/Subnav/sgds-subnav.d.ts +0 -0
- package/{components → src/components}/Switch/index.d.ts +0 -0
- package/{components → src/components}/Switch/sgds-switch.d.ts +0 -0
- package/{components → src/components}/Tab/index.d.ts +0 -0
- package/{components → src/components}/Tab/sgds-tab-group.d.ts +0 -0
- package/{components → src/components}/Tab/sgds-tab-panel.d.ts +0 -0
- package/{components → src/components}/Tab/sgds-tab.d.ts +0 -0
- package/{components → src/components}/Table/index.d.ts +0 -0
- package/{components → src/components}/Table/sgds-table-cell.d.ts +0 -0
- package/{components → src/components}/Table/sgds-table-head.d.ts +0 -0
- package/{components → src/components}/Table/sgds-table-row.d.ts +0 -0
- package/{components → src/components}/Table/sgds-table.d.ts +0 -0
- package/{components → src/components}/TableOfContents/index.d.ts +0 -0
- package/{components → src/components}/TableOfContents/sgds-table-of-contents.d.ts +0 -0
- package/{components → src/components}/Textarea/index.d.ts +0 -0
- package/{components → src/components}/Textarea/sgds-textarea.d.ts +0 -0
- package/{components → src/components}/Toast/index.d.ts +0 -0
- package/{components → src/components}/Toast/sgds-toast-container.d.ts +0 -0
- package/{components → src/components}/Toast/sgds-toast.d.ts +0 -0
- package/{components → src/components}/Tooltip/index.d.ts +0 -0
- package/{components → src/components}/Tooltip/sgds-tooltip.d.ts +0 -0
- package/{components → src/components}/index.d.ts +0 -0
- package/{index.d.ts → src/index.d.ts} +0 -0
- package/{internals → src/internals}/CloseButton/index.d.ts +0 -0
- package/{internals → src/internals}/CloseButton/sgds-close-button.d.ts +0 -0
- package/{internals → src/internals}/OverflowMenu/index.d.ts +0 -0
- package/{internals → src/internals}/OverflowMenu/sgds-overflow-menu.d.ts +0 -0
- package/{react → src/react}/accordion/index.d.ts +0 -0
- package/{react → src/react}/accordion-item/index.d.ts +0 -0
- package/{react → src/react}/alert/index.d.ts +0 -0
- package/{react → src/react}/alert-link/index.d.ts +0 -0
- package/{react → src/react}/badge/index.d.ts +0 -0
- package/{react → src/react}/breadcrumb/index.d.ts +0 -0
- package/{react → src/react}/breadcrumb-item/index.d.ts +0 -0
- package/{react → src/react}/button/index.d.ts +0 -0
- package/{react → src/react}/card/index.d.ts +0 -0
- package/{react → src/react}/checkbox/index.d.ts +0 -0
- package/{react → src/react}/checkbox-group/index.d.ts +0 -0
- package/{react → src/react}/combo-box/index.d.ts +0 -0
- package/{react → src/react}/datepicker/index.d.ts +0 -0
- package/{react → src/react}/description-list/index.d.ts +0 -0
- package/{react → src/react}/description-list-group/index.d.ts +0 -0
- package/{react → src/react}/divider/index.d.ts +0 -0
- package/{react → src/react}/drawer/index.d.ts +0 -0
- package/{react → src/react}/dropdown/index.d.ts +0 -0
- package/{react → src/react}/dropdown-item/index.d.ts +0 -0
- package/{react → src/react}/file-upload/index.d.ts +0 -0
- package/{react → src/react}/footer/index.d.ts +0 -0
- package/{react → src/react}/footer-item/index.d.ts +0 -0
- package/{react → src/react}/icon/index.d.ts +0 -0
- package/{react → src/react}/icon-button/index.d.ts +0 -0
- package/{react → src/react}/icon-list/index.d.ts +0 -0
- package/{react → src/react}/index.d.ts +1 -1
- /package/{react → src/react}/input/index.d.ts +0 -0
- /package/{react → src/react}/link/index.d.ts +0 -0
- /package/{react → src/react}/mainnav/index.d.ts +0 -0
- /package/{react → src/react}/mainnav-dropdown/index.d.ts +0 -0
- /package/{react → src/react}/mainnav-item/index.d.ts +0 -0
- /package/{react → src/react}/masthead/index.d.ts +0 -0
- /package/{react → src/react}/modal/index.d.ts +0 -0
- /package/{react → src/react}/pagination/index.d.ts +0 -0
- /package/{react → src/react}/progress-bar/index.d.ts +0 -0
- /package/{react → src/react}/quantity-toggle/index.d.ts +0 -0
- /package/{react → src/react}/radio/index.d.ts +0 -0
- /package/{react → src/react}/radio-group/index.d.ts +0 -0
- /package/{react → src/react}/select/index.d.ts +0 -0
- /package/{react → src/react}/sidenav/index.d.ts +0 -0
- /package/{react → src/react}/sidenav-item/index.d.ts +0 -0
- /package/{react → src/react}/sidenav-link/index.d.ts +0 -0
- /package/{react → src/react}/skeleton/index.d.ts +0 -0
- /package/{react → src/react}/spinner/index.d.ts +0 -0
- /package/{react → src/react}/stepper/index.d.ts +0 -0
- /package/{react → src/react}/subnav/index.d.ts +0 -0
- /package/{react → src/react}/subnav-item/index.d.ts +0 -0
- /package/{react → src/react}/switch/index.d.ts +0 -0
- /package/{react → src/react}/tab/index.d.ts +0 -0
- /package/{react → src/react}/tab-group/index.d.ts +0 -0
- /package/{react → src/react}/tab-panel/index.d.ts +0 -0
- /package/{react → src/react}/table/index.d.ts +0 -0
- /package/{react → src/react}/table-cell/index.d.ts +0 -0
- /package/{react → src/react}/table-head/index.d.ts +0 -0
- /package/{react → src/react}/table-of-contents/index.d.ts +0 -0
- /package/{react → src/react}/table-row/index.d.ts +0 -0
- /package/{react → src/react}/textarea/index.d.ts +0 -0
- /package/{react → src/react}/toast/index.d.ts +0 -0
- /package/{react → src/react}/toast-container/index.d.ts +0 -0
- /package/{react → src/react}/tooltip/index.d.ts +0 -0
- /package/{utils → src/utils}/animate.d.ts +0 -0
- /package/{utils → src/utils}/animation-registry.d.ts +0 -0
- /package/{utils → src/utils}/breakpoints.d.ts +0 -0
- /package/{utils → src/utils}/ce-registry.d.ts +0 -0
- /package/{utils → src/utils}/defaultvalue.d.ts +0 -0
- /package/{utils → src/utils}/event.d.ts +0 -0
- /package/{utils → src/utils}/formSubmitController.d.ts +0 -0
- /package/{utils → src/utils}/generateCustomElementName.d.ts +0 -0
- /package/{utils → src/utils}/generateId.d.ts +0 -0
- /package/{utils → src/utils}/inputValidationController.d.ts +0 -0
- /package/{utils → src/utils}/mergeDeep.d.ts +0 -0
- /package/{utils → src/utils}/modal.d.ts +0 -0
- /package/{utils → src/utils}/object.d.ts +0 -0
- /package/{utils → src/utils}/offset.d.ts +0 -0
- /package/{utils → src/utils}/scroll.d.ts +0 -0
- /package/{utils → src/utils}/slot.d.ts +0 -0
- /package/{utils → src/utils}/tabbable.d.ts +0 -0
- /package/{utils → src/utils}/test.d.ts +0 -0
- /package/{utils → src/utils}/time.d.ts +0 -0
- /package/{utils → src/utils}/validatorMixin.d.ts +0 -0
- /package/{utils → src/utils}/watch.d.ts +0 -0
|
@@ -4064,6 +4064,64 @@
|
|
|
4064
4064
|
};
|
|
4065
4065
|
}
|
|
4066
4066
|
|
|
4067
|
+
/**
|
|
4068
|
+
* @license
|
|
4069
|
+
* Copyright 2017 Google LLC
|
|
4070
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4071
|
+
*/
|
|
4072
|
+
/**
|
|
4073
|
+
* Declares a private or protected reactive property that still triggers
|
|
4074
|
+
* updates to the element when it changes. It does not reflect from the
|
|
4075
|
+
* corresponding attribute.
|
|
4076
|
+
*
|
|
4077
|
+
* Properties declared this way must not be used from HTML or HTML templating
|
|
4078
|
+
* systems, they're solely for properties internal to the element. These
|
|
4079
|
+
* properties may be renamed by optimization tools like closure compiler.
|
|
4080
|
+
* @category Decorator
|
|
4081
|
+
*/
|
|
4082
|
+
function state(options) {
|
|
4083
|
+
return property({
|
|
4084
|
+
...options,
|
|
4085
|
+
// Add both `state` and `attribute` because we found a third party
|
|
4086
|
+
// controller that is keying off of PropertyOptions.state to determine
|
|
4087
|
+
// whether a field is a private internal property or not.
|
|
4088
|
+
state: true,
|
|
4089
|
+
attribute: false,
|
|
4090
|
+
});
|
|
4091
|
+
}
|
|
4092
|
+
|
|
4093
|
+
/**
|
|
4094
|
+
* @license
|
|
4095
|
+
* Copyright 2017 Google LLC
|
|
4096
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4097
|
+
*/
|
|
4098
|
+
/**
|
|
4099
|
+
* Wraps up a few best practices when returning a property descriptor from a
|
|
4100
|
+
* decorator.
|
|
4101
|
+
*
|
|
4102
|
+
* Marks the defined property as configurable, and enumerable, and handles
|
|
4103
|
+
* the case where we have a busted Reflect.decorate zombiefill (e.g. in Angular
|
|
4104
|
+
* apps).
|
|
4105
|
+
*
|
|
4106
|
+
* @internal
|
|
4107
|
+
*/
|
|
4108
|
+
const desc = (obj, name, descriptor) => {
|
|
4109
|
+
// For backwards compatibility, we keep them configurable and enumerable.
|
|
4110
|
+
descriptor.configurable = true;
|
|
4111
|
+
descriptor.enumerable = true;
|
|
4112
|
+
if (
|
|
4113
|
+
// We check for Reflect.decorate each time, in case the zombiefill
|
|
4114
|
+
// is applied via lazy loading some Angular code.
|
|
4115
|
+
Reflect.decorate &&
|
|
4116
|
+
typeof name !== 'object') {
|
|
4117
|
+
// If we're called as a legacy decorator, and Reflect.decorate is present
|
|
4118
|
+
// then we have no guarantees that the returned descriptor will be
|
|
4119
|
+
// defined on the class, so we must apply it directly ourselves.
|
|
4120
|
+
Object.defineProperty(obj, name, descriptor);
|
|
4121
|
+
}
|
|
4122
|
+
return descriptor;
|
|
4123
|
+
};
|
|
4124
|
+
|
|
4067
4125
|
/**
|
|
4068
4126
|
* @license
|
|
4069
4127
|
* Copyright 2017 Google LLC
|
|
@@ -4075,6 +4133,56 @@
|
|
|
4075
4133
|
(globalThis.litIssuedWarnings ??= new Set());
|
|
4076
4134
|
}
|
|
4077
4135
|
|
|
4136
|
+
/**
|
|
4137
|
+
* @license
|
|
4138
|
+
* Copyright 2021 Google LLC
|
|
4139
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
4140
|
+
*/
|
|
4141
|
+
/**
|
|
4142
|
+
* A property decorator that converts a class property into a getter that
|
|
4143
|
+
* returns the `assignedElements` of the given `slot`. Provides a declarative
|
|
4144
|
+
* way to use
|
|
4145
|
+
* [`HTMLSlotElement.assignedElements`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLSlotElement/assignedElements).
|
|
4146
|
+
*
|
|
4147
|
+
* Can be passed an optional {@linkcode QueryAssignedElementsOptions} object.
|
|
4148
|
+
*
|
|
4149
|
+
* Example usage:
|
|
4150
|
+
* ```ts
|
|
4151
|
+
* class MyElement {
|
|
4152
|
+
* @queryAssignedElements({ slot: 'list' })
|
|
4153
|
+
* listItems!: Array<HTMLElement>;
|
|
4154
|
+
* @queryAssignedElements()
|
|
4155
|
+
* unnamedSlotEls!: Array<HTMLElement>;
|
|
4156
|
+
*
|
|
4157
|
+
* render() {
|
|
4158
|
+
* return html`
|
|
4159
|
+
* <slot name="list"></slot>
|
|
4160
|
+
* <slot></slot>
|
|
4161
|
+
* `;
|
|
4162
|
+
* }
|
|
4163
|
+
* }
|
|
4164
|
+
* ```
|
|
4165
|
+
*
|
|
4166
|
+
* Note, the type of this property should be annotated as `Array<HTMLElement>`.
|
|
4167
|
+
*
|
|
4168
|
+
* @category Decorator
|
|
4169
|
+
*/
|
|
4170
|
+
function queryAssignedElements(options) {
|
|
4171
|
+
return ((obj, name) => {
|
|
4172
|
+
const { slot, selector } = options ?? {};
|
|
4173
|
+
const slotSelector = `slot${slot ? `[name=${slot}]` : ':not([name])'}`;
|
|
4174
|
+
return desc(obj, name, {
|
|
4175
|
+
get() {
|
|
4176
|
+
const slotEl = this.renderRoot?.querySelector(slotSelector);
|
|
4177
|
+
const elements = slotEl?.assignedElements(options) ?? [];
|
|
4178
|
+
return (selector === undefined
|
|
4179
|
+
? elements
|
|
4180
|
+
: elements.filter((node) => node.matches(selector)));
|
|
4181
|
+
},
|
|
4182
|
+
});
|
|
4183
|
+
});
|
|
4184
|
+
}
|
|
4185
|
+
|
|
4078
4186
|
/**
|
|
4079
4187
|
* @license
|
|
4080
4188
|
* Copyright 2017 Google LLC
|
|
@@ -4207,6 +4315,45 @@
|
|
|
4207
4315
|
*/
|
|
4208
4316
|
const classMap = directive(ClassMapDirective);
|
|
4209
4317
|
|
|
4318
|
+
// @watch decorator
|
|
4319
|
+
//
|
|
4320
|
+
// Runs when an observed property changes, e.g. @property or @state, but before the component updates.
|
|
4321
|
+
//
|
|
4322
|
+
// To wait for an update to complete after a change occurs, use `await this.updateComplete` in the handler. To start
|
|
4323
|
+
// watching after the initial update/render, use `{ waitUntilFirstUpdate: true }` or `this.hasUpdated` in the handler.
|
|
4324
|
+
//
|
|
4325
|
+
// Usage:
|
|
4326
|
+
//
|
|
4327
|
+
// @watch('propName')
|
|
4328
|
+
// handlePropChange(oldValue, newValue) {
|
|
4329
|
+
// ...
|
|
4330
|
+
// }
|
|
4331
|
+
function watch(propName, options) {
|
|
4332
|
+
const resolvedOptions = Object.assign({ waitUntilFirstUpdate: false }, options);
|
|
4333
|
+
return (proto, decoratedFnName) => {
|
|
4334
|
+
// @ts-expect-error -- update is a protected property
|
|
4335
|
+
const { update } = proto;
|
|
4336
|
+
if (propName in proto) {
|
|
4337
|
+
const propNameKey = propName;
|
|
4338
|
+
// @ts-expect-error -- update is a protected property
|
|
4339
|
+
proto.update = function (changedProps) {
|
|
4340
|
+
if (changedProps.has(propNameKey)) {
|
|
4341
|
+
const oldValue = changedProps.get(propNameKey);
|
|
4342
|
+
const newValue = this[propNameKey];
|
|
4343
|
+
if (oldValue !== newValue) {
|
|
4344
|
+
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
4345
|
+
this[decoratedFnName](oldValue, newValue);
|
|
4346
|
+
}
|
|
4347
|
+
}
|
|
4348
|
+
}
|
|
4349
|
+
update.call(this, changedProps);
|
|
4350
|
+
};
|
|
4351
|
+
}
|
|
4352
|
+
};
|
|
4353
|
+
}
|
|
4354
|
+
|
|
4355
|
+
var css_248z$3 = css`:host{cursor:default;display:inline-flex;max-width:100%}:host([variant=success]) .badge{background-color:var(--sgds-success-surface-default)}:host([variant=danger]) .badge{background-color:var(--sgds-danger-surface-default)}:host([variant=warning]) .badge{background-color:var(--sgds-warning-surface-default);color:var(--sgds-color-fixed-dark)}:host([variant=neutral]) .badge{background-color:var(--sgds-neutral-surface-default)}:host([variant=success][outlined]) .badge{background-color:var(--sgds-success-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-success-border-color-default)}:host([variant=danger][outlined]) .badge{background-color:var(--sgds-danger-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-danger-border-color-default)}:host([variant=warning][outlined]) .badge{background-color:var(--sgds-warning-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-warning-border-color-default)}:host([variant=neutral][outlined]) .badge{background-color:var(--sgds-neutral-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-neutral-border-color-default)}sgds-tooltip{display:block;max-width:100%}.badge{align-items:center;background-color:var(--sgds-primary-surface-default);border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-border-radius-sm);color:var(--sgds-color-fixed-light);display:inline-flex;font-size:var(--sgds-font-size-1);height:var(--sgds-dimension-24,24px);justify-content:center;max-width:192px;min-width:var(--sgds-dimension-24);padding:var(--sgds-padding-none) var(--sgds-padding-2-xs)}.badge.outlined{background-color:var(--sgds-primary-surface-muted);border:var(--sgds-border-width-1) solid var(--sgds-primary-border-color-default);color:var(--sgds-color-fixed-dark)}.badge.full-width{max-width:100%}.badge-label{line-height:var(--sgds-line-height-min);padding:var(--sgds-padding-none) var(--sgds-padding-2-xs)}.badge-dismissible{padding-right:0}.badge-dimissible sgds-close-button{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm)}.badge.truncated .badge-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}slot::slotted(*){font-size:14px;font-weight:400}`;
|
|
4356
|
+
|
|
4210
4357
|
var css_248z$2 = css`:host{-webkit-text-size-adjust:100%;-webkit-tap-highlight-color:rgba(0,0,0,0);color:var(--sgds-body-color-default);font-family:var(--sgds-font-family-brand);font-size:var(--sgds-font-size-2);font-weight:var(--sgds-font-weight-regular);line-height:var(--sgds-line-height-body);margin:0;*,:after,:before{box-sizing:border-box}:disabled{cursor:not-allowed}@media (prefers-reduced-motion:no-preference){:root{scroll-behavior:smooth}}a[target=_blank]{align-items:center;display:flex;gap:var(--sgds-gap-2-xs)}::slotted(a[target=_blank]):after,a[target=_blank]:after{background-color:currentColor;content:"/";display:inline-block;-webkit-mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");mask-image:url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M9.274 3.9H9.3a.6.6 0 0 1 0 1.2c-.85 0-1.451 0-1.922.039-.463.038-.745.11-.968.223A2.4 2.4 0 0 0 5.361 6.41c-.113.223-.184.505-.222.968-.039.47-.04 1.072-.04 1.922v5.4c0 .85.001 1.451.04 1.922.038.463.11.745.222.968a2.4 2.4 0 0 0 1.05 1.048c.222.114.504.185.967.223.47.038 1.072.039 1.922.039h5.4c.85 0 1.451 0 1.921-.039.464-.038.746-.11.969-.223a2.4 2.4 0 0 0 1.048-1.048c.113-.223.185-.505.223-.968.038-.47.039-1.072.039-1.922a.6.6 0 1 1 1.2 0v.026c0 .818 0 1.469-.043 1.993-.044.538-.136.996-.35 1.415a3.6 3.6 0 0 1-1.573 1.574c-.42.213-.878.305-1.415.35-.525.042-1.175.042-1.993.042H9.274c-.818 0-1.469 0-1.993-.043-.538-.044-.996-.136-1.415-.35a3.6 3.6 0 0 1-1.574-1.573c-.213-.42-.305-.877-.35-1.415-.042-.524-.042-1.175-.042-1.993V9.274c0-.818 0-1.468.043-1.993.044-.538.136-.996.35-1.415a3.6 3.6 0 0 1 1.573-1.574c.42-.213.877-.305 1.415-.35C7.805 3.9 8.456 3.9 9.274 3.9Zm3.626.6a.6.6 0 0 1 .6-.6h6a.6.6 0 0 1 .6.6v6a.6.6 0 1 1-1.2 0V5.949l-5.976 5.975a.6.6 0 0 1-.848-.848L18.05 5.1H13.5a.6.6 0 0 1-.6-.6Z' fill='%230E0E0E'/%3E%3C/svg%3E");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;padding:0 .45em}::slotted(svg){vertical-align:middle}}`;
|
|
4211
4358
|
|
|
4212
4359
|
/**
|
|
@@ -4268,219 +4415,4395 @@
|
|
|
4268
4415
|
/** @internal */
|
|
4269
4416
|
SgdsElement.dependencies = {};
|
|
4270
4417
|
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4418
|
+
var top = 'top';
|
|
4419
|
+
var bottom = 'bottom';
|
|
4420
|
+
var right = 'right';
|
|
4421
|
+
var left = 'left';
|
|
4422
|
+
var auto = 'auto';
|
|
4423
|
+
var basePlacements = [top, bottom, right, left];
|
|
4424
|
+
var start = 'start';
|
|
4425
|
+
var end = 'end';
|
|
4426
|
+
var clippingParents = 'clippingParents';
|
|
4427
|
+
var viewport = 'viewport';
|
|
4428
|
+
var popper = 'popper';
|
|
4429
|
+
var reference = 'reference';
|
|
4430
|
+
var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {
|
|
4431
|
+
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
|
4432
|
+
}, []);
|
|
4433
|
+
var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {
|
|
4434
|
+
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
|
4435
|
+
}, []); // modifiers that need to read the DOM
|
|
4283
4436
|
|
|
4284
|
-
var
|
|
4437
|
+
var beforeRead = 'beforeRead';
|
|
4438
|
+
var read = 'read';
|
|
4439
|
+
var afterRead = 'afterRead'; // pure-logic modifiers
|
|
4285
4440
|
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
4289
|
-
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4441
|
+
var beforeMain = 'beforeMain';
|
|
4442
|
+
var main = 'main';
|
|
4443
|
+
var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)
|
|
4444
|
+
|
|
4445
|
+
var beforeWrite = 'beforeWrite';
|
|
4446
|
+
var write = 'write';
|
|
4447
|
+
var afterWrite = 'afterWrite';
|
|
4448
|
+
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
4449
|
+
|
|
4450
|
+
function getNodeName(element) {
|
|
4451
|
+
return element ? (element.nodeName || '').toLowerCase() : null;
|
|
4293
4452
|
}
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4453
|
+
|
|
4454
|
+
function getWindow(node) {
|
|
4455
|
+
if (node == null) {
|
|
4456
|
+
return window;
|
|
4457
|
+
}
|
|
4458
|
+
|
|
4459
|
+
if (node.toString() !== '[object Window]') {
|
|
4460
|
+
var ownerDocument = node.ownerDocument;
|
|
4461
|
+
return ownerDocument ? ownerDocument.defaultView || window : window;
|
|
4462
|
+
}
|
|
4463
|
+
|
|
4464
|
+
return node;
|
|
4298
4465
|
}
|
|
4299
|
-
|
|
4300
|
-
|
|
4301
|
-
|
|
4302
|
-
|
|
4303
|
-
else {
|
|
4304
|
-
console.error(`Custom element of name : ${name} is not registered. Remember to import the component file for custom element registration`);
|
|
4305
|
-
return false;
|
|
4306
|
-
}
|
|
4466
|
+
|
|
4467
|
+
function isElement$1(node) {
|
|
4468
|
+
var OwnElement = getWindow(node).Element;
|
|
4469
|
+
return node instanceof OwnElement || node instanceof Element;
|
|
4307
4470
|
}
|
|
4308
4471
|
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
* @cssprop --sgds-close-btn-border-radius - The border radius of close button border
|
|
4313
|
-
*
|
|
4314
|
-
*/
|
|
4315
|
-
class SgdsCloseButton extends SgdsElement {
|
|
4316
|
-
constructor() {
|
|
4317
|
-
super(...arguments);
|
|
4318
|
-
this.ariaLabel = "Close button";
|
|
4319
|
-
/** Specifies a large or small button */
|
|
4320
|
-
this.size = "md";
|
|
4321
|
-
this.variant = "default";
|
|
4322
|
-
this._clickHandler = () => {
|
|
4323
|
-
return;
|
|
4324
|
-
};
|
|
4325
|
-
}
|
|
4326
|
-
_handleClick() {
|
|
4327
|
-
this.removeEventListener("click", this._clickHandler);
|
|
4328
|
-
this.addEventListener("click", this._clickHandler);
|
|
4329
|
-
}
|
|
4330
|
-
firstUpdated() {
|
|
4331
|
-
/** Cannot register sgds-icon as dependency due to some circular dependencies, so we check and warn instead */
|
|
4332
|
-
warnUnregisteredElements("sgds-icon");
|
|
4333
|
-
}
|
|
4334
|
-
render() {
|
|
4335
|
-
return html `
|
|
4336
|
-
<button
|
|
4337
|
-
class=${classMap({
|
|
4338
|
-
"btn-close": true,
|
|
4339
|
-
[`btn-close-${this.size}`]: this.size,
|
|
4340
|
-
"btn-close-light": this.variant === "light",
|
|
4341
|
-
"btn-close-dark": this.variant === "dark"
|
|
4342
|
-
})}
|
|
4343
|
-
aria-label=${ifDefined(this.ariaLabel)}
|
|
4344
|
-
@click=${this._handleClick}
|
|
4345
|
-
>
|
|
4346
|
-
<sgds-icon name="cross" size=${this.size}></sgds-icon>
|
|
4347
|
-
</button>
|
|
4348
|
-
`;
|
|
4349
|
-
}
|
|
4472
|
+
function isHTMLElement(node) {
|
|
4473
|
+
var OwnElement = getWindow(node).HTMLElement;
|
|
4474
|
+
return node instanceof OwnElement || node instanceof HTMLElement;
|
|
4350
4475
|
}
|
|
4351
|
-
SgdsCloseButton.styles = [...SgdsElement.styles, css_248z$1];
|
|
4352
|
-
__decorate([
|
|
4353
|
-
property({ type: String })
|
|
4354
|
-
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
4355
|
-
__decorate([
|
|
4356
|
-
property({ type: String, reflect: true })
|
|
4357
|
-
], SgdsCloseButton.prototype, "size", void 0);
|
|
4358
|
-
__decorate([
|
|
4359
|
-
property({ type: String, reflect: true })
|
|
4360
|
-
], SgdsCloseButton.prototype, "variant", void 0);
|
|
4361
4476
|
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
//
|
|
4371
|
-
// @watch('propName')
|
|
4372
|
-
// handlePropChange(oldValue, newValue) {
|
|
4373
|
-
// ...
|
|
4374
|
-
// }
|
|
4375
|
-
function watch(propName, options) {
|
|
4376
|
-
const resolvedOptions = Object.assign({ waitUntilFirstUpdate: false }, options);
|
|
4377
|
-
return (proto, decoratedFnName) => {
|
|
4378
|
-
// @ts-expect-error -- update is a protected property
|
|
4379
|
-
const { update } = proto;
|
|
4380
|
-
if (propName in proto) {
|
|
4381
|
-
const propNameKey = propName;
|
|
4382
|
-
// @ts-expect-error -- update is a protected property
|
|
4383
|
-
proto.update = function (changedProps) {
|
|
4384
|
-
if (changedProps.has(propNameKey)) {
|
|
4385
|
-
const oldValue = changedProps.get(propNameKey);
|
|
4386
|
-
const newValue = this[propNameKey];
|
|
4387
|
-
if (oldValue !== newValue) {
|
|
4388
|
-
if (!resolvedOptions.waitUntilFirstUpdate || this.hasUpdated) {
|
|
4389
|
-
this[decoratedFnName](oldValue, newValue);
|
|
4390
|
-
}
|
|
4391
|
-
}
|
|
4392
|
-
}
|
|
4393
|
-
update.call(this, changedProps);
|
|
4394
|
-
};
|
|
4395
|
-
}
|
|
4396
|
-
};
|
|
4477
|
+
function isShadowRoot(node) {
|
|
4478
|
+
// IE 11 has no ShadowRoot
|
|
4479
|
+
if (typeof ShadowRoot === 'undefined') {
|
|
4480
|
+
return false;
|
|
4481
|
+
}
|
|
4482
|
+
|
|
4483
|
+
var OwnElement = getWindow(node).ShadowRoot;
|
|
4484
|
+
return node instanceof OwnElement || node instanceof ShadowRoot;
|
|
4397
4485
|
}
|
|
4398
4486
|
|
|
4399
|
-
|
|
4487
|
+
// and applies them to the HTMLElements such as popper and arrow
|
|
4400
4488
|
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4420
|
-
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4489
|
+
function applyStyles(_ref) {
|
|
4490
|
+
var state = _ref.state;
|
|
4491
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
4492
|
+
var style = state.styles[name] || {};
|
|
4493
|
+
var attributes = state.attributes[name] || {};
|
|
4494
|
+
var element = state.elements[name]; // arrow is optional + virtual elements
|
|
4495
|
+
|
|
4496
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
4497
|
+
return;
|
|
4498
|
+
} // Flow doesn't support to extend this property, but it's the most
|
|
4499
|
+
// effective way to apply styles to an HTMLElement
|
|
4500
|
+
// $FlowFixMe[cannot-write]
|
|
4501
|
+
|
|
4502
|
+
|
|
4503
|
+
Object.assign(element.style, style);
|
|
4504
|
+
Object.keys(attributes).forEach(function (name) {
|
|
4505
|
+
var value = attributes[name];
|
|
4506
|
+
|
|
4507
|
+
if (value === false) {
|
|
4508
|
+
element.removeAttribute(name);
|
|
4509
|
+
} else {
|
|
4510
|
+
element.setAttribute(name, value === true ? '' : value);
|
|
4511
|
+
}
|
|
4512
|
+
});
|
|
4513
|
+
});
|
|
4514
|
+
}
|
|
4515
|
+
|
|
4516
|
+
function effect$2(_ref2) {
|
|
4517
|
+
var state = _ref2.state;
|
|
4518
|
+
var initialStyles = {
|
|
4519
|
+
popper: {
|
|
4520
|
+
position: state.options.strategy,
|
|
4521
|
+
left: '0',
|
|
4522
|
+
top: '0',
|
|
4523
|
+
margin: '0'
|
|
4524
|
+
},
|
|
4525
|
+
arrow: {
|
|
4526
|
+
position: 'absolute'
|
|
4527
|
+
},
|
|
4528
|
+
reference: {}
|
|
4529
|
+
};
|
|
4530
|
+
Object.assign(state.elements.popper.style, initialStyles.popper);
|
|
4531
|
+
state.styles = initialStyles;
|
|
4532
|
+
|
|
4533
|
+
if (state.elements.arrow) {
|
|
4534
|
+
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
|
4535
|
+
}
|
|
4536
|
+
|
|
4537
|
+
return function () {
|
|
4538
|
+
Object.keys(state.elements).forEach(function (name) {
|
|
4539
|
+
var element = state.elements[name];
|
|
4540
|
+
var attributes = state.attributes[name] || {};
|
|
4541
|
+
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them
|
|
4542
|
+
|
|
4543
|
+
var style = styleProperties.reduce(function (style, property) {
|
|
4544
|
+
style[property] = '';
|
|
4545
|
+
return style;
|
|
4546
|
+
}, {}); // arrow is optional + virtual elements
|
|
4547
|
+
|
|
4548
|
+
if (!isHTMLElement(element) || !getNodeName(element)) {
|
|
4549
|
+
return;
|
|
4550
|
+
}
|
|
4551
|
+
|
|
4552
|
+
Object.assign(element.style, style);
|
|
4553
|
+
Object.keys(attributes).forEach(function (attribute) {
|
|
4554
|
+
element.removeAttribute(attribute);
|
|
4555
|
+
});
|
|
4556
|
+
});
|
|
4557
|
+
};
|
|
4558
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4559
|
+
|
|
4560
|
+
|
|
4561
|
+
var applyStyles$1 = {
|
|
4562
|
+
name: 'applyStyles',
|
|
4563
|
+
enabled: true,
|
|
4564
|
+
phase: 'write',
|
|
4565
|
+
fn: applyStyles,
|
|
4566
|
+
effect: effect$2,
|
|
4567
|
+
requires: ['computeStyles']
|
|
4568
|
+
};
|
|
4569
|
+
|
|
4570
|
+
function getBasePlacement(placement) {
|
|
4571
|
+
return placement.split('-')[0];
|
|
4572
|
+
}
|
|
4573
|
+
|
|
4574
|
+
var max = Math.max;
|
|
4575
|
+
var min = Math.min;
|
|
4576
|
+
var round = Math.round;
|
|
4577
|
+
|
|
4578
|
+
function getUAString() {
|
|
4579
|
+
var uaData = navigator.userAgentData;
|
|
4580
|
+
|
|
4581
|
+
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
4582
|
+
return uaData.brands.map(function (item) {
|
|
4583
|
+
return item.brand + "/" + item.version;
|
|
4584
|
+
}).join(' ');
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4587
|
+
return navigator.userAgent;
|
|
4588
|
+
}
|
|
4589
|
+
|
|
4590
|
+
function isLayoutViewport() {
|
|
4591
|
+
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
4592
|
+
}
|
|
4593
|
+
|
|
4594
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
4595
|
+
if (includeScale === void 0) {
|
|
4596
|
+
includeScale = false;
|
|
4597
|
+
}
|
|
4598
|
+
|
|
4599
|
+
if (isFixedStrategy === void 0) {
|
|
4600
|
+
isFixedStrategy = false;
|
|
4601
|
+
}
|
|
4602
|
+
|
|
4603
|
+
var clientRect = element.getBoundingClientRect();
|
|
4604
|
+
var scaleX = 1;
|
|
4605
|
+
var scaleY = 1;
|
|
4606
|
+
|
|
4607
|
+
if (includeScale && isHTMLElement(element)) {
|
|
4608
|
+
scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;
|
|
4609
|
+
scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;
|
|
4610
|
+
}
|
|
4611
|
+
|
|
4612
|
+
var _ref = isElement$1(element) ? getWindow(element) : window,
|
|
4613
|
+
visualViewport = _ref.visualViewport;
|
|
4614
|
+
|
|
4615
|
+
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
4616
|
+
var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
4617
|
+
var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
4618
|
+
var width = clientRect.width / scaleX;
|
|
4619
|
+
var height = clientRect.height / scaleY;
|
|
4620
|
+
return {
|
|
4621
|
+
width: width,
|
|
4622
|
+
height: height,
|
|
4623
|
+
top: y,
|
|
4624
|
+
right: x + width,
|
|
4625
|
+
bottom: y + height,
|
|
4626
|
+
left: x,
|
|
4627
|
+
x: x,
|
|
4628
|
+
y: y
|
|
4629
|
+
};
|
|
4630
|
+
}
|
|
4631
|
+
|
|
4632
|
+
// means it doesn't take into account transforms.
|
|
4633
|
+
|
|
4634
|
+
function getLayoutRect(element) {
|
|
4635
|
+
var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.
|
|
4636
|
+
// Fixes https://github.com/popperjs/popper-core/issues/1223
|
|
4637
|
+
|
|
4638
|
+
var width = element.offsetWidth;
|
|
4639
|
+
var height = element.offsetHeight;
|
|
4640
|
+
|
|
4641
|
+
if (Math.abs(clientRect.width - width) <= 1) {
|
|
4642
|
+
width = clientRect.width;
|
|
4643
|
+
}
|
|
4644
|
+
|
|
4645
|
+
if (Math.abs(clientRect.height - height) <= 1) {
|
|
4646
|
+
height = clientRect.height;
|
|
4647
|
+
}
|
|
4648
|
+
|
|
4649
|
+
return {
|
|
4650
|
+
x: element.offsetLeft,
|
|
4651
|
+
y: element.offsetTop,
|
|
4652
|
+
width: width,
|
|
4653
|
+
height: height
|
|
4654
|
+
};
|
|
4655
|
+
}
|
|
4656
|
+
|
|
4657
|
+
function contains(parent, child) {
|
|
4658
|
+
var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method
|
|
4659
|
+
|
|
4660
|
+
if (parent.contains(child)) {
|
|
4661
|
+
return true;
|
|
4662
|
+
} // then fallback to custom implementation with Shadow DOM support
|
|
4663
|
+
else if (rootNode && isShadowRoot(rootNode)) {
|
|
4664
|
+
var next = child;
|
|
4665
|
+
|
|
4666
|
+
do {
|
|
4667
|
+
if (next && parent.isSameNode(next)) {
|
|
4668
|
+
return true;
|
|
4669
|
+
} // $FlowFixMe[prop-missing]: need a better way to handle this...
|
|
4670
|
+
|
|
4671
|
+
|
|
4672
|
+
next = next.parentNode || next.host;
|
|
4673
|
+
} while (next);
|
|
4674
|
+
} // Give up, the result is false
|
|
4675
|
+
|
|
4676
|
+
|
|
4677
|
+
return false;
|
|
4678
|
+
}
|
|
4679
|
+
|
|
4680
|
+
function getComputedStyle$1(element) {
|
|
4681
|
+
return getWindow(element).getComputedStyle(element);
|
|
4682
|
+
}
|
|
4683
|
+
|
|
4684
|
+
function isTableElement(element) {
|
|
4685
|
+
return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;
|
|
4686
|
+
}
|
|
4687
|
+
|
|
4688
|
+
function getDocumentElement(element) {
|
|
4689
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
4690
|
+
return ((isElement$1(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]
|
|
4691
|
+
element.document) || window.document).documentElement;
|
|
4692
|
+
}
|
|
4693
|
+
|
|
4694
|
+
function getParentNode(element) {
|
|
4695
|
+
if (getNodeName(element) === 'html') {
|
|
4696
|
+
return element;
|
|
4697
|
+
}
|
|
4698
|
+
|
|
4699
|
+
return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
|
4700
|
+
// $FlowFixMe[incompatible-return]
|
|
4701
|
+
// $FlowFixMe[prop-missing]
|
|
4702
|
+
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
4703
|
+
element.parentNode || ( // DOM Element detected
|
|
4704
|
+
isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
4705
|
+
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
4706
|
+
getDocumentElement(element) // fallback
|
|
4707
|
+
|
|
4708
|
+
);
|
|
4709
|
+
}
|
|
4710
|
+
|
|
4711
|
+
function getTrueOffsetParent(element) {
|
|
4712
|
+
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
4713
|
+
getComputedStyle$1(element).position === 'fixed') {
|
|
4714
|
+
return null;
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4717
|
+
return element.offsetParent;
|
|
4718
|
+
} // `.offsetParent` reports `null` for fixed elements, while absolute elements
|
|
4719
|
+
// return the containing block
|
|
4720
|
+
|
|
4721
|
+
|
|
4722
|
+
function getContainingBlock(element) {
|
|
4723
|
+
var isFirefox = /firefox/i.test(getUAString());
|
|
4724
|
+
var isIE = /Trident/i.test(getUAString());
|
|
4725
|
+
|
|
4726
|
+
if (isIE && isHTMLElement(element)) {
|
|
4727
|
+
// In IE 9, 10 and 11 fixed elements containing block is always established by the viewport
|
|
4728
|
+
var elementCss = getComputedStyle$1(element);
|
|
4729
|
+
|
|
4730
|
+
if (elementCss.position === 'fixed') {
|
|
4731
|
+
return null;
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
|
|
4735
|
+
var currentNode = getParentNode(element);
|
|
4736
|
+
|
|
4737
|
+
if (isShadowRoot(currentNode)) {
|
|
4738
|
+
currentNode = currentNode.host;
|
|
4739
|
+
}
|
|
4740
|
+
|
|
4741
|
+
while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {
|
|
4742
|
+
var css = getComputedStyle$1(currentNode); // This is non-exhaustive but covers the most common CSS properties that
|
|
4743
|
+
// create a containing block.
|
|
4744
|
+
// https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block
|
|
4745
|
+
|
|
4746
|
+
if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {
|
|
4747
|
+
return currentNode;
|
|
4748
|
+
} else {
|
|
4749
|
+
currentNode = currentNode.parentNode;
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
|
|
4753
|
+
return null;
|
|
4754
|
+
} // Gets the closest ancestor positioned element. Handles some edge cases,
|
|
4755
|
+
// such as table ancestors and cross browser bugs.
|
|
4756
|
+
|
|
4757
|
+
|
|
4758
|
+
function getOffsetParent(element) {
|
|
4759
|
+
var window = getWindow(element);
|
|
4760
|
+
var offsetParent = getTrueOffsetParent(element);
|
|
4761
|
+
|
|
4762
|
+
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$1(offsetParent).position === 'static') {
|
|
4763
|
+
offsetParent = getTrueOffsetParent(offsetParent);
|
|
4764
|
+
}
|
|
4765
|
+
|
|
4766
|
+
if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle$1(offsetParent).position === 'static')) {
|
|
4767
|
+
return window;
|
|
4768
|
+
}
|
|
4769
|
+
|
|
4770
|
+
return offsetParent || getContainingBlock(element) || window;
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4773
|
+
function getMainAxisFromPlacement(placement) {
|
|
4774
|
+
return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
function within(min$1, value, max$1) {
|
|
4778
|
+
return max(min$1, min(value, max$1));
|
|
4779
|
+
}
|
|
4780
|
+
function withinMaxClamp(min, value, max) {
|
|
4781
|
+
var v = within(min, value, max);
|
|
4782
|
+
return v > max ? max : v;
|
|
4783
|
+
}
|
|
4784
|
+
|
|
4785
|
+
function getFreshSideObject() {
|
|
4786
|
+
return {
|
|
4787
|
+
top: 0,
|
|
4788
|
+
right: 0,
|
|
4789
|
+
bottom: 0,
|
|
4790
|
+
left: 0
|
|
4791
|
+
};
|
|
4792
|
+
}
|
|
4793
|
+
|
|
4794
|
+
function mergePaddingObject(paddingObject) {
|
|
4795
|
+
return Object.assign({}, getFreshSideObject(), paddingObject);
|
|
4796
|
+
}
|
|
4797
|
+
|
|
4798
|
+
function expandToHashMap(value, keys) {
|
|
4799
|
+
return keys.reduce(function (hashMap, key) {
|
|
4800
|
+
hashMap[key] = value;
|
|
4801
|
+
return hashMap;
|
|
4802
|
+
}, {});
|
|
4803
|
+
}
|
|
4804
|
+
|
|
4805
|
+
var toPaddingObject = function toPaddingObject(padding, state) {
|
|
4806
|
+
padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {
|
|
4807
|
+
placement: state.placement
|
|
4808
|
+
})) : padding;
|
|
4809
|
+
return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
4810
|
+
};
|
|
4811
|
+
|
|
4812
|
+
function arrow(_ref) {
|
|
4813
|
+
var _state$modifiersData$;
|
|
4814
|
+
|
|
4815
|
+
var state = _ref.state,
|
|
4816
|
+
name = _ref.name,
|
|
4817
|
+
options = _ref.options;
|
|
4818
|
+
var arrowElement = state.elements.arrow;
|
|
4819
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
|
4820
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
4821
|
+
var axis = getMainAxisFromPlacement(basePlacement);
|
|
4822
|
+
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
|
4823
|
+
var len = isVertical ? 'height' : 'width';
|
|
4824
|
+
|
|
4825
|
+
if (!arrowElement || !popperOffsets) {
|
|
4826
|
+
return;
|
|
4827
|
+
}
|
|
4828
|
+
|
|
4829
|
+
var paddingObject = toPaddingObject(options.padding, state);
|
|
4830
|
+
var arrowRect = getLayoutRect(arrowElement);
|
|
4831
|
+
var minProp = axis === 'y' ? top : left;
|
|
4832
|
+
var maxProp = axis === 'y' ? bottom : right;
|
|
4833
|
+
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];
|
|
4834
|
+
var startDiff = popperOffsets[axis] - state.rects.reference[axis];
|
|
4835
|
+
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
4836
|
+
var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
4837
|
+
var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is
|
|
4838
|
+
// outside of the popper bounds
|
|
4839
|
+
|
|
4840
|
+
var min = paddingObject[minProp];
|
|
4841
|
+
var max = clientSize - arrowRect[len] - paddingObject[maxProp];
|
|
4842
|
+
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
|
4843
|
+
var offset = within(min, center, max); // Prevents breaking syntax highlighting...
|
|
4844
|
+
|
|
4845
|
+
var axisProp = axis;
|
|
4846
|
+
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);
|
|
4847
|
+
}
|
|
4848
|
+
|
|
4849
|
+
function effect$1(_ref2) {
|
|
4850
|
+
var state = _ref2.state,
|
|
4851
|
+
options = _ref2.options;
|
|
4852
|
+
var _options$element = options.element,
|
|
4853
|
+
arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;
|
|
4854
|
+
|
|
4855
|
+
if (arrowElement == null) {
|
|
4856
|
+
return;
|
|
4857
|
+
} // CSS selector
|
|
4858
|
+
|
|
4859
|
+
|
|
4860
|
+
if (typeof arrowElement === 'string') {
|
|
4861
|
+
arrowElement = state.elements.popper.querySelector(arrowElement);
|
|
4862
|
+
|
|
4863
|
+
if (!arrowElement) {
|
|
4864
|
+
return;
|
|
4865
|
+
}
|
|
4866
|
+
}
|
|
4867
|
+
|
|
4868
|
+
if (!contains(state.elements.popper, arrowElement)) {
|
|
4869
|
+
return;
|
|
4870
|
+
}
|
|
4871
|
+
|
|
4872
|
+
state.elements.arrow = arrowElement;
|
|
4873
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
4874
|
+
|
|
4875
|
+
|
|
4876
|
+
var arrow$1 = {
|
|
4877
|
+
name: 'arrow',
|
|
4878
|
+
enabled: true,
|
|
4879
|
+
phase: 'main',
|
|
4880
|
+
fn: arrow,
|
|
4881
|
+
effect: effect$1,
|
|
4882
|
+
requires: ['popperOffsets'],
|
|
4883
|
+
requiresIfExists: ['preventOverflow']
|
|
4884
|
+
};
|
|
4885
|
+
|
|
4886
|
+
function getVariation(placement) {
|
|
4887
|
+
return placement.split('-')[1];
|
|
4888
|
+
}
|
|
4889
|
+
|
|
4890
|
+
var unsetSides = {
|
|
4891
|
+
top: 'auto',
|
|
4892
|
+
right: 'auto',
|
|
4893
|
+
bottom: 'auto',
|
|
4894
|
+
left: 'auto'
|
|
4895
|
+
}; // Round the offsets to the nearest suitable subpixel based on the DPR.
|
|
4896
|
+
// Zooming can change the DPR, but it seems to report a value that will
|
|
4897
|
+
// cleanly divide the values into the appropriate subpixels.
|
|
4898
|
+
|
|
4899
|
+
function roundOffsetsByDPR(_ref, win) {
|
|
4900
|
+
var x = _ref.x,
|
|
4901
|
+
y = _ref.y;
|
|
4902
|
+
var dpr = win.devicePixelRatio || 1;
|
|
4903
|
+
return {
|
|
4904
|
+
x: round(x * dpr) / dpr || 0,
|
|
4905
|
+
y: round(y * dpr) / dpr || 0
|
|
4906
|
+
};
|
|
4907
|
+
}
|
|
4908
|
+
|
|
4909
|
+
function mapToStyles(_ref2) {
|
|
4910
|
+
var _Object$assign2;
|
|
4911
|
+
|
|
4912
|
+
var popper = _ref2.popper,
|
|
4913
|
+
popperRect = _ref2.popperRect,
|
|
4914
|
+
placement = _ref2.placement,
|
|
4915
|
+
variation = _ref2.variation,
|
|
4916
|
+
offsets = _ref2.offsets,
|
|
4917
|
+
position = _ref2.position,
|
|
4918
|
+
gpuAcceleration = _ref2.gpuAcceleration,
|
|
4919
|
+
adaptive = _ref2.adaptive,
|
|
4920
|
+
roundOffsets = _ref2.roundOffsets,
|
|
4921
|
+
isFixed = _ref2.isFixed;
|
|
4922
|
+
var _offsets$x = offsets.x,
|
|
4923
|
+
x = _offsets$x === void 0 ? 0 : _offsets$x,
|
|
4924
|
+
_offsets$y = offsets.y,
|
|
4925
|
+
y = _offsets$y === void 0 ? 0 : _offsets$y;
|
|
4926
|
+
|
|
4927
|
+
var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({
|
|
4928
|
+
x: x,
|
|
4929
|
+
y: y
|
|
4930
|
+
}) : {
|
|
4931
|
+
x: x,
|
|
4932
|
+
y: y
|
|
4933
|
+
};
|
|
4934
|
+
|
|
4935
|
+
x = _ref3.x;
|
|
4936
|
+
y = _ref3.y;
|
|
4937
|
+
var hasX = offsets.hasOwnProperty('x');
|
|
4938
|
+
var hasY = offsets.hasOwnProperty('y');
|
|
4939
|
+
var sideX = left;
|
|
4940
|
+
var sideY = top;
|
|
4941
|
+
var win = window;
|
|
4942
|
+
|
|
4943
|
+
if (adaptive) {
|
|
4944
|
+
var offsetParent = getOffsetParent(popper);
|
|
4945
|
+
var heightProp = 'clientHeight';
|
|
4946
|
+
var widthProp = 'clientWidth';
|
|
4947
|
+
|
|
4948
|
+
if (offsetParent === getWindow(popper)) {
|
|
4949
|
+
offsetParent = getDocumentElement(popper);
|
|
4950
|
+
|
|
4951
|
+
if (getComputedStyle$1(offsetParent).position !== 'static' && position === 'absolute') {
|
|
4952
|
+
heightProp = 'scrollHeight';
|
|
4953
|
+
widthProp = 'scrollWidth';
|
|
4954
|
+
}
|
|
4955
|
+
} // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it
|
|
4956
|
+
|
|
4957
|
+
|
|
4958
|
+
offsetParent = offsetParent;
|
|
4959
|
+
|
|
4960
|
+
if (placement === top || (placement === left || placement === right) && variation === end) {
|
|
4961
|
+
sideY = bottom;
|
|
4962
|
+
var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]
|
|
4963
|
+
offsetParent[heightProp];
|
|
4964
|
+
y -= offsetY - popperRect.height;
|
|
4965
|
+
y *= gpuAcceleration ? 1 : -1;
|
|
4966
|
+
}
|
|
4967
|
+
|
|
4968
|
+
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
|
4969
|
+
sideX = right;
|
|
4970
|
+
var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]
|
|
4971
|
+
offsetParent[widthProp];
|
|
4972
|
+
x -= offsetX - popperRect.width;
|
|
4973
|
+
x *= gpuAcceleration ? 1 : -1;
|
|
4974
|
+
}
|
|
4975
|
+
}
|
|
4976
|
+
|
|
4977
|
+
var commonStyles = Object.assign({
|
|
4978
|
+
position: position
|
|
4979
|
+
}, adaptive && unsetSides);
|
|
4980
|
+
|
|
4981
|
+
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
4982
|
+
x: x,
|
|
4983
|
+
y: y
|
|
4984
|
+
}, getWindow(popper)) : {
|
|
4985
|
+
x: x,
|
|
4986
|
+
y: y
|
|
4987
|
+
};
|
|
4988
|
+
|
|
4989
|
+
x = _ref4.x;
|
|
4990
|
+
y = _ref4.y;
|
|
4991
|
+
|
|
4992
|
+
if (gpuAcceleration) {
|
|
4993
|
+
var _Object$assign;
|
|
4994
|
+
|
|
4995
|
+
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
|
4996
|
+
}
|
|
4997
|
+
|
|
4998
|
+
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : '', _Object$assign2[sideX] = hasX ? x + "px" : '', _Object$assign2.transform = '', _Object$assign2));
|
|
4999
|
+
}
|
|
5000
|
+
|
|
5001
|
+
function computeStyles(_ref5) {
|
|
5002
|
+
var state = _ref5.state,
|
|
5003
|
+
options = _ref5.options;
|
|
5004
|
+
var _options$gpuAccelerat = options.gpuAcceleration,
|
|
5005
|
+
gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,
|
|
5006
|
+
_options$adaptive = options.adaptive,
|
|
5007
|
+
adaptive = _options$adaptive === void 0 ? true : _options$adaptive,
|
|
5008
|
+
_options$roundOffsets = options.roundOffsets,
|
|
5009
|
+
roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
|
5010
|
+
var commonStyles = {
|
|
5011
|
+
placement: getBasePlacement(state.placement),
|
|
5012
|
+
variation: getVariation(state.placement),
|
|
5013
|
+
popper: state.elements.popper,
|
|
5014
|
+
popperRect: state.rects.popper,
|
|
5015
|
+
gpuAcceleration: gpuAcceleration,
|
|
5016
|
+
isFixed: state.options.strategy === 'fixed'
|
|
5017
|
+
};
|
|
5018
|
+
|
|
5019
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
5020
|
+
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
|
5021
|
+
offsets: state.modifiersData.popperOffsets,
|
|
5022
|
+
position: state.options.strategy,
|
|
5023
|
+
adaptive: adaptive,
|
|
5024
|
+
roundOffsets: roundOffsets
|
|
5025
|
+
})));
|
|
5026
|
+
}
|
|
5027
|
+
|
|
5028
|
+
if (state.modifiersData.arrow != null) {
|
|
5029
|
+
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
|
5030
|
+
offsets: state.modifiersData.arrow,
|
|
5031
|
+
position: 'absolute',
|
|
5032
|
+
adaptive: false,
|
|
5033
|
+
roundOffsets: roundOffsets
|
|
5034
|
+
})));
|
|
5035
|
+
}
|
|
5036
|
+
|
|
5037
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
5038
|
+
'data-popper-placement': state.placement
|
|
5039
|
+
});
|
|
5040
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5041
|
+
|
|
5042
|
+
|
|
5043
|
+
var computeStyles$1 = {
|
|
5044
|
+
name: 'computeStyles',
|
|
5045
|
+
enabled: true,
|
|
5046
|
+
phase: 'beforeWrite',
|
|
5047
|
+
fn: computeStyles,
|
|
5048
|
+
data: {}
|
|
5049
|
+
};
|
|
5050
|
+
|
|
5051
|
+
var passive = {
|
|
5052
|
+
passive: true
|
|
5053
|
+
};
|
|
5054
|
+
|
|
5055
|
+
function effect(_ref) {
|
|
5056
|
+
var state = _ref.state,
|
|
5057
|
+
instance = _ref.instance,
|
|
5058
|
+
options = _ref.options;
|
|
5059
|
+
var _options$scroll = options.scroll,
|
|
5060
|
+
scroll = _options$scroll === void 0 ? true : _options$scroll,
|
|
5061
|
+
_options$resize = options.resize,
|
|
5062
|
+
resize = _options$resize === void 0 ? true : _options$resize;
|
|
5063
|
+
var window = getWindow(state.elements.popper);
|
|
5064
|
+
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
|
5065
|
+
|
|
5066
|
+
if (scroll) {
|
|
5067
|
+
scrollParents.forEach(function (scrollParent) {
|
|
5068
|
+
scrollParent.addEventListener('scroll', instance.update, passive);
|
|
5069
|
+
});
|
|
5070
|
+
}
|
|
5071
|
+
|
|
5072
|
+
if (resize) {
|
|
5073
|
+
window.addEventListener('resize', instance.update, passive);
|
|
5074
|
+
}
|
|
5075
|
+
|
|
5076
|
+
return function () {
|
|
5077
|
+
if (scroll) {
|
|
5078
|
+
scrollParents.forEach(function (scrollParent) {
|
|
5079
|
+
scrollParent.removeEventListener('scroll', instance.update, passive);
|
|
5080
|
+
});
|
|
5081
|
+
}
|
|
5082
|
+
|
|
5083
|
+
if (resize) {
|
|
5084
|
+
window.removeEventListener('resize', instance.update, passive);
|
|
5085
|
+
}
|
|
5086
|
+
};
|
|
5087
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5088
|
+
|
|
5089
|
+
|
|
5090
|
+
var eventListeners = {
|
|
5091
|
+
name: 'eventListeners',
|
|
5092
|
+
enabled: true,
|
|
5093
|
+
phase: 'write',
|
|
5094
|
+
fn: function fn() {},
|
|
5095
|
+
effect: effect,
|
|
5096
|
+
data: {}
|
|
5097
|
+
};
|
|
5098
|
+
|
|
5099
|
+
var hash$1 = {
|
|
5100
|
+
left: 'right',
|
|
5101
|
+
right: 'left',
|
|
5102
|
+
bottom: 'top',
|
|
5103
|
+
top: 'bottom'
|
|
5104
|
+
};
|
|
5105
|
+
function getOppositePlacement(placement) {
|
|
5106
|
+
return placement.replace(/left|right|bottom|top/g, function (matched) {
|
|
5107
|
+
return hash$1[matched];
|
|
5108
|
+
});
|
|
5109
|
+
}
|
|
5110
|
+
|
|
5111
|
+
var hash = {
|
|
5112
|
+
start: 'end',
|
|
5113
|
+
end: 'start'
|
|
5114
|
+
};
|
|
5115
|
+
function getOppositeVariationPlacement(placement) {
|
|
5116
|
+
return placement.replace(/start|end/g, function (matched) {
|
|
5117
|
+
return hash[matched];
|
|
5118
|
+
});
|
|
5119
|
+
}
|
|
5120
|
+
|
|
5121
|
+
function getWindowScroll(node) {
|
|
5122
|
+
var win = getWindow(node);
|
|
5123
|
+
var scrollLeft = win.pageXOffset;
|
|
5124
|
+
var scrollTop = win.pageYOffset;
|
|
5125
|
+
return {
|
|
5126
|
+
scrollLeft: scrollLeft,
|
|
5127
|
+
scrollTop: scrollTop
|
|
5128
|
+
};
|
|
5129
|
+
}
|
|
5130
|
+
|
|
5131
|
+
function getWindowScrollBarX(element) {
|
|
5132
|
+
// If <html> has a CSS width greater than the viewport, then this will be
|
|
5133
|
+
// incorrect for RTL.
|
|
5134
|
+
// Popper 1 is broken in this case and never had a bug report so let's assume
|
|
5135
|
+
// it's not an issue. I don't think anyone ever specifies width on <html>
|
|
5136
|
+
// anyway.
|
|
5137
|
+
// Browsers where the left scrollbar doesn't cause an issue report `0` for
|
|
5138
|
+
// this (e.g. Edge 2019, IE11, Safari)
|
|
5139
|
+
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
5140
|
+
}
|
|
5141
|
+
|
|
5142
|
+
function getViewportRect(element, strategy) {
|
|
5143
|
+
var win = getWindow(element);
|
|
5144
|
+
var html = getDocumentElement(element);
|
|
5145
|
+
var visualViewport = win.visualViewport;
|
|
5146
|
+
var width = html.clientWidth;
|
|
5147
|
+
var height = html.clientHeight;
|
|
5148
|
+
var x = 0;
|
|
5149
|
+
var y = 0;
|
|
5150
|
+
|
|
5151
|
+
if (visualViewport) {
|
|
5152
|
+
width = visualViewport.width;
|
|
5153
|
+
height = visualViewport.height;
|
|
5154
|
+
var layoutViewport = isLayoutViewport();
|
|
5155
|
+
|
|
5156
|
+
if (layoutViewport || !layoutViewport && strategy === 'fixed') {
|
|
5157
|
+
x = visualViewport.offsetLeft;
|
|
5158
|
+
y = visualViewport.offsetTop;
|
|
5159
|
+
}
|
|
5160
|
+
}
|
|
5161
|
+
|
|
5162
|
+
return {
|
|
5163
|
+
width: width,
|
|
5164
|
+
height: height,
|
|
5165
|
+
x: x + getWindowScrollBarX(element),
|
|
5166
|
+
y: y
|
|
5167
|
+
};
|
|
5168
|
+
}
|
|
5169
|
+
|
|
5170
|
+
// of the `<html>` and `<body>` rect bounds if horizontally scrollable
|
|
5171
|
+
|
|
5172
|
+
function getDocumentRect(element) {
|
|
5173
|
+
var _element$ownerDocumen;
|
|
5174
|
+
|
|
5175
|
+
var html = getDocumentElement(element);
|
|
5176
|
+
var winScroll = getWindowScroll(element);
|
|
5177
|
+
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
5178
|
+
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
5179
|
+
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
5180
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
5181
|
+
var y = -winScroll.scrollTop;
|
|
5182
|
+
|
|
5183
|
+
if (getComputedStyle$1(body || html).direction === 'rtl') {
|
|
5184
|
+
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
5185
|
+
}
|
|
5186
|
+
|
|
5187
|
+
return {
|
|
5188
|
+
width: width,
|
|
5189
|
+
height: height,
|
|
5190
|
+
x: x,
|
|
5191
|
+
y: y
|
|
5192
|
+
};
|
|
5193
|
+
}
|
|
5194
|
+
|
|
5195
|
+
function isScrollParent(element) {
|
|
5196
|
+
// Firefox wants us to check `-x` and `-y` variations as well
|
|
5197
|
+
var _getComputedStyle = getComputedStyle$1(element),
|
|
5198
|
+
overflow = _getComputedStyle.overflow,
|
|
5199
|
+
overflowX = _getComputedStyle.overflowX,
|
|
5200
|
+
overflowY = _getComputedStyle.overflowY;
|
|
5201
|
+
|
|
5202
|
+
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
5203
|
+
}
|
|
5204
|
+
|
|
5205
|
+
function getScrollParent(node) {
|
|
5206
|
+
if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {
|
|
5207
|
+
// $FlowFixMe[incompatible-return]: assume body is always available
|
|
5208
|
+
return node.ownerDocument.body;
|
|
5209
|
+
}
|
|
5210
|
+
|
|
5211
|
+
if (isHTMLElement(node) && isScrollParent(node)) {
|
|
5212
|
+
return node;
|
|
5213
|
+
}
|
|
5214
|
+
|
|
5215
|
+
return getScrollParent(getParentNode(node));
|
|
5216
|
+
}
|
|
5217
|
+
|
|
5218
|
+
/*
|
|
5219
|
+
given a DOM element, return the list of all scroll parents, up the list of ancesors
|
|
5220
|
+
until we get to the top window object. This list is what we attach scroll listeners
|
|
5221
|
+
to, because if any of these parent elements scroll, we'll need to re-calculate the
|
|
5222
|
+
reference element's position.
|
|
5223
|
+
*/
|
|
5224
|
+
|
|
5225
|
+
function listScrollParents(element, list) {
|
|
5226
|
+
var _element$ownerDocumen;
|
|
5227
|
+
|
|
5228
|
+
if (list === void 0) {
|
|
5229
|
+
list = [];
|
|
5230
|
+
}
|
|
5231
|
+
|
|
5232
|
+
var scrollParent = getScrollParent(element);
|
|
5233
|
+
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
5234
|
+
var win = getWindow(scrollParent);
|
|
5235
|
+
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
5236
|
+
var updatedList = list.concat(target);
|
|
5237
|
+
return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
|
5238
|
+
updatedList.concat(listScrollParents(getParentNode(target)));
|
|
5239
|
+
}
|
|
5240
|
+
|
|
5241
|
+
function rectToClientRect(rect) {
|
|
5242
|
+
return Object.assign({}, rect, {
|
|
5243
|
+
left: rect.x,
|
|
5244
|
+
top: rect.y,
|
|
5245
|
+
right: rect.x + rect.width,
|
|
5246
|
+
bottom: rect.y + rect.height
|
|
5247
|
+
});
|
|
5248
|
+
}
|
|
5249
|
+
|
|
5250
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
5251
|
+
var rect = getBoundingClientRect(element, false, strategy === 'fixed');
|
|
5252
|
+
rect.top = rect.top + element.clientTop;
|
|
5253
|
+
rect.left = rect.left + element.clientLeft;
|
|
5254
|
+
rect.bottom = rect.top + element.clientHeight;
|
|
5255
|
+
rect.right = rect.left + element.clientWidth;
|
|
5256
|
+
rect.width = element.clientWidth;
|
|
5257
|
+
rect.height = element.clientHeight;
|
|
5258
|
+
rect.x = rect.left;
|
|
5259
|
+
rect.y = rect.top;
|
|
5260
|
+
return rect;
|
|
5261
|
+
}
|
|
5262
|
+
|
|
5263
|
+
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
5264
|
+
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$1(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
|
5265
|
+
} // A "clipping parent" is an overflowable container with the characteristic of
|
|
5266
|
+
// clipping (or hiding) overflowing elements with a position different from
|
|
5267
|
+
// `initial`
|
|
5268
|
+
|
|
5269
|
+
|
|
5270
|
+
function getClippingParents(element) {
|
|
5271
|
+
var clippingParents = listScrollParents(getParentNode(element));
|
|
5272
|
+
var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle$1(element).position) >= 0;
|
|
5273
|
+
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
|
5274
|
+
|
|
5275
|
+
if (!isElement$1(clipperElement)) {
|
|
5276
|
+
return [];
|
|
5277
|
+
} // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414
|
|
5278
|
+
|
|
5279
|
+
|
|
5280
|
+
return clippingParents.filter(function (clippingParent) {
|
|
5281
|
+
return isElement$1(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';
|
|
5282
|
+
});
|
|
5283
|
+
} // Gets the maximum area that the element is visible in due to any number of
|
|
5284
|
+
// clipping parents
|
|
5285
|
+
|
|
5286
|
+
|
|
5287
|
+
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
5288
|
+
var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);
|
|
5289
|
+
var clippingParents = [].concat(mainClippingParents, [rootBoundary]);
|
|
5290
|
+
var firstClippingParent = clippingParents[0];
|
|
5291
|
+
var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {
|
|
5292
|
+
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
5293
|
+
accRect.top = max(rect.top, accRect.top);
|
|
5294
|
+
accRect.right = min(rect.right, accRect.right);
|
|
5295
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
5296
|
+
accRect.left = max(rect.left, accRect.left);
|
|
5297
|
+
return accRect;
|
|
5298
|
+
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
5299
|
+
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
5300
|
+
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
|
5301
|
+
clippingRect.x = clippingRect.left;
|
|
5302
|
+
clippingRect.y = clippingRect.top;
|
|
5303
|
+
return clippingRect;
|
|
5304
|
+
}
|
|
5305
|
+
|
|
5306
|
+
function computeOffsets(_ref) {
|
|
5307
|
+
var reference = _ref.reference,
|
|
5308
|
+
element = _ref.element,
|
|
5309
|
+
placement = _ref.placement;
|
|
5310
|
+
var basePlacement = placement ? getBasePlacement(placement) : null;
|
|
5311
|
+
var variation = placement ? getVariation(placement) : null;
|
|
5312
|
+
var commonX = reference.x + reference.width / 2 - element.width / 2;
|
|
5313
|
+
var commonY = reference.y + reference.height / 2 - element.height / 2;
|
|
5314
|
+
var offsets;
|
|
5315
|
+
|
|
5316
|
+
switch (basePlacement) {
|
|
5317
|
+
case top:
|
|
5318
|
+
offsets = {
|
|
5319
|
+
x: commonX,
|
|
5320
|
+
y: reference.y - element.height
|
|
5321
|
+
};
|
|
5322
|
+
break;
|
|
5323
|
+
|
|
5324
|
+
case bottom:
|
|
5325
|
+
offsets = {
|
|
5326
|
+
x: commonX,
|
|
5327
|
+
y: reference.y + reference.height
|
|
5328
|
+
};
|
|
5329
|
+
break;
|
|
5330
|
+
|
|
5331
|
+
case right:
|
|
5332
|
+
offsets = {
|
|
5333
|
+
x: reference.x + reference.width,
|
|
5334
|
+
y: commonY
|
|
5335
|
+
};
|
|
5336
|
+
break;
|
|
5337
|
+
|
|
5338
|
+
case left:
|
|
5339
|
+
offsets = {
|
|
5340
|
+
x: reference.x - element.width,
|
|
5341
|
+
y: commonY
|
|
5342
|
+
};
|
|
5343
|
+
break;
|
|
5344
|
+
|
|
5345
|
+
default:
|
|
5346
|
+
offsets = {
|
|
5347
|
+
x: reference.x,
|
|
5348
|
+
y: reference.y
|
|
5349
|
+
};
|
|
5350
|
+
}
|
|
5351
|
+
|
|
5352
|
+
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
|
5353
|
+
|
|
5354
|
+
if (mainAxis != null) {
|
|
5355
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
5356
|
+
|
|
5357
|
+
switch (variation) {
|
|
5358
|
+
case start:
|
|
5359
|
+
offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);
|
|
5360
|
+
break;
|
|
5361
|
+
|
|
5362
|
+
case end:
|
|
5363
|
+
offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);
|
|
5364
|
+
break;
|
|
5365
|
+
}
|
|
5366
|
+
}
|
|
5367
|
+
|
|
5368
|
+
return offsets;
|
|
5369
|
+
}
|
|
5370
|
+
|
|
5371
|
+
function detectOverflow(state, options) {
|
|
5372
|
+
if (options === void 0) {
|
|
5373
|
+
options = {};
|
|
5374
|
+
}
|
|
5375
|
+
|
|
5376
|
+
var _options = options,
|
|
5377
|
+
_options$placement = _options.placement,
|
|
5378
|
+
placement = _options$placement === void 0 ? state.placement : _options$placement,
|
|
5379
|
+
_options$strategy = _options.strategy,
|
|
5380
|
+
strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,
|
|
5381
|
+
_options$boundary = _options.boundary,
|
|
5382
|
+
boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,
|
|
5383
|
+
_options$rootBoundary = _options.rootBoundary,
|
|
5384
|
+
rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,
|
|
5385
|
+
_options$elementConte = _options.elementContext,
|
|
5386
|
+
elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,
|
|
5387
|
+
_options$altBoundary = _options.altBoundary,
|
|
5388
|
+
altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,
|
|
5389
|
+
_options$padding = _options.padding,
|
|
5390
|
+
padding = _options$padding === void 0 ? 0 : _options$padding;
|
|
5391
|
+
var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));
|
|
5392
|
+
var altContext = elementContext === popper ? reference : popper;
|
|
5393
|
+
var popperRect = state.rects.popper;
|
|
5394
|
+
var element = state.elements[altBoundary ? altContext : elementContext];
|
|
5395
|
+
var clippingClientRect = getClippingRect(isElement$1(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);
|
|
5396
|
+
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
|
5397
|
+
var popperOffsets = computeOffsets({
|
|
5398
|
+
reference: referenceClientRect,
|
|
5399
|
+
element: popperRect,
|
|
5400
|
+
strategy: 'absolute',
|
|
5401
|
+
placement: placement
|
|
5402
|
+
});
|
|
5403
|
+
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));
|
|
5404
|
+
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect
|
|
5405
|
+
// 0 or negative = within the clipping rect
|
|
5406
|
+
|
|
5407
|
+
var overflowOffsets = {
|
|
5408
|
+
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
5409
|
+
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
|
5410
|
+
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
|
5411
|
+
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
|
5412
|
+
};
|
|
5413
|
+
var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element
|
|
5414
|
+
|
|
5415
|
+
if (elementContext === popper && offsetData) {
|
|
5416
|
+
var offset = offsetData[placement];
|
|
5417
|
+
Object.keys(overflowOffsets).forEach(function (key) {
|
|
5418
|
+
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
|
5419
|
+
var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';
|
|
5420
|
+
overflowOffsets[key] += offset[axis] * multiply;
|
|
5421
|
+
});
|
|
5422
|
+
}
|
|
5423
|
+
|
|
5424
|
+
return overflowOffsets;
|
|
5425
|
+
}
|
|
5426
|
+
|
|
5427
|
+
function computeAutoPlacement(state, options) {
|
|
5428
|
+
if (options === void 0) {
|
|
5429
|
+
options = {};
|
|
5430
|
+
}
|
|
5431
|
+
|
|
5432
|
+
var _options = options,
|
|
5433
|
+
placement = _options.placement,
|
|
5434
|
+
boundary = _options.boundary,
|
|
5435
|
+
rootBoundary = _options.rootBoundary,
|
|
5436
|
+
padding = _options.padding,
|
|
5437
|
+
flipVariations = _options.flipVariations,
|
|
5438
|
+
_options$allowedAutoP = _options.allowedAutoPlacements,
|
|
5439
|
+
allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
|
5440
|
+
var variation = getVariation(placement);
|
|
5441
|
+
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {
|
|
5442
|
+
return getVariation(placement) === variation;
|
|
5443
|
+
}) : basePlacements;
|
|
5444
|
+
var allowedPlacements = placements$1.filter(function (placement) {
|
|
5445
|
+
return allowedAutoPlacements.indexOf(placement) >= 0;
|
|
5446
|
+
});
|
|
5447
|
+
|
|
5448
|
+
if (allowedPlacements.length === 0) {
|
|
5449
|
+
allowedPlacements = placements$1;
|
|
5450
|
+
} // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...
|
|
5451
|
+
|
|
5452
|
+
|
|
5453
|
+
var overflows = allowedPlacements.reduce(function (acc, placement) {
|
|
5454
|
+
acc[placement] = detectOverflow(state, {
|
|
5455
|
+
placement: placement,
|
|
5456
|
+
boundary: boundary,
|
|
5457
|
+
rootBoundary: rootBoundary,
|
|
5458
|
+
padding: padding
|
|
5459
|
+
})[getBasePlacement(placement)];
|
|
5460
|
+
return acc;
|
|
5461
|
+
}, {});
|
|
5462
|
+
return Object.keys(overflows).sort(function (a, b) {
|
|
5463
|
+
return overflows[a] - overflows[b];
|
|
5464
|
+
});
|
|
5465
|
+
}
|
|
5466
|
+
|
|
5467
|
+
function getExpandedFallbackPlacements(placement) {
|
|
5468
|
+
if (getBasePlacement(placement) === auto) {
|
|
5469
|
+
return [];
|
|
5470
|
+
}
|
|
5471
|
+
|
|
5472
|
+
var oppositePlacement = getOppositePlacement(placement);
|
|
5473
|
+
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
|
5474
|
+
}
|
|
5475
|
+
|
|
5476
|
+
function flip(_ref) {
|
|
5477
|
+
var state = _ref.state,
|
|
5478
|
+
options = _ref.options,
|
|
5479
|
+
name = _ref.name;
|
|
5480
|
+
|
|
5481
|
+
if (state.modifiersData[name]._skip) {
|
|
5482
|
+
return;
|
|
5483
|
+
}
|
|
5484
|
+
|
|
5485
|
+
var _options$mainAxis = options.mainAxis,
|
|
5486
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
5487
|
+
_options$altAxis = options.altAxis,
|
|
5488
|
+
checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,
|
|
5489
|
+
specifiedFallbackPlacements = options.fallbackPlacements,
|
|
5490
|
+
padding = options.padding,
|
|
5491
|
+
boundary = options.boundary,
|
|
5492
|
+
rootBoundary = options.rootBoundary,
|
|
5493
|
+
altBoundary = options.altBoundary,
|
|
5494
|
+
_options$flipVariatio = options.flipVariations,
|
|
5495
|
+
flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,
|
|
5496
|
+
allowedAutoPlacements = options.allowedAutoPlacements;
|
|
5497
|
+
var preferredPlacement = state.options.placement;
|
|
5498
|
+
var basePlacement = getBasePlacement(preferredPlacement);
|
|
5499
|
+
var isBasePlacement = basePlacement === preferredPlacement;
|
|
5500
|
+
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
|
5501
|
+
var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {
|
|
5502
|
+
return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {
|
|
5503
|
+
placement: placement,
|
|
5504
|
+
boundary: boundary,
|
|
5505
|
+
rootBoundary: rootBoundary,
|
|
5506
|
+
padding: padding,
|
|
5507
|
+
flipVariations: flipVariations,
|
|
5508
|
+
allowedAutoPlacements: allowedAutoPlacements
|
|
5509
|
+
}) : placement);
|
|
5510
|
+
}, []);
|
|
5511
|
+
var referenceRect = state.rects.reference;
|
|
5512
|
+
var popperRect = state.rects.popper;
|
|
5513
|
+
var checksMap = new Map();
|
|
5514
|
+
var makeFallbackChecks = true;
|
|
5515
|
+
var firstFittingPlacement = placements[0];
|
|
5516
|
+
|
|
5517
|
+
for (var i = 0; i < placements.length; i++) {
|
|
5518
|
+
var placement = placements[i];
|
|
5519
|
+
|
|
5520
|
+
var _basePlacement = getBasePlacement(placement);
|
|
5521
|
+
|
|
5522
|
+
var isStartVariation = getVariation(placement) === start;
|
|
5523
|
+
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
5524
|
+
var len = isVertical ? 'width' : 'height';
|
|
5525
|
+
var overflow = detectOverflow(state, {
|
|
5526
|
+
placement: placement,
|
|
5527
|
+
boundary: boundary,
|
|
5528
|
+
rootBoundary: rootBoundary,
|
|
5529
|
+
altBoundary: altBoundary,
|
|
5530
|
+
padding: padding
|
|
5531
|
+
});
|
|
5532
|
+
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
|
5533
|
+
|
|
5534
|
+
if (referenceRect[len] > popperRect[len]) {
|
|
5535
|
+
mainVariationSide = getOppositePlacement(mainVariationSide);
|
|
5536
|
+
}
|
|
5537
|
+
|
|
5538
|
+
var altVariationSide = getOppositePlacement(mainVariationSide);
|
|
5539
|
+
var checks = [];
|
|
5540
|
+
|
|
5541
|
+
if (checkMainAxis) {
|
|
5542
|
+
checks.push(overflow[_basePlacement] <= 0);
|
|
5543
|
+
}
|
|
5544
|
+
|
|
5545
|
+
if (checkAltAxis) {
|
|
5546
|
+
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
|
5547
|
+
}
|
|
5548
|
+
|
|
5549
|
+
if (checks.every(function (check) {
|
|
5550
|
+
return check;
|
|
5551
|
+
})) {
|
|
5552
|
+
firstFittingPlacement = placement;
|
|
5553
|
+
makeFallbackChecks = false;
|
|
5554
|
+
break;
|
|
5555
|
+
}
|
|
5556
|
+
|
|
5557
|
+
checksMap.set(placement, checks);
|
|
5558
|
+
}
|
|
5559
|
+
|
|
5560
|
+
if (makeFallbackChecks) {
|
|
5561
|
+
// `2` may be desired in some cases – research later
|
|
5562
|
+
var numberOfChecks = flipVariations ? 3 : 1;
|
|
5563
|
+
|
|
5564
|
+
var _loop = function _loop(_i) {
|
|
5565
|
+
var fittingPlacement = placements.find(function (placement) {
|
|
5566
|
+
var checks = checksMap.get(placement);
|
|
5567
|
+
|
|
5568
|
+
if (checks) {
|
|
5569
|
+
return checks.slice(0, _i).every(function (check) {
|
|
5570
|
+
return check;
|
|
5571
|
+
});
|
|
5572
|
+
}
|
|
5573
|
+
});
|
|
5574
|
+
|
|
5575
|
+
if (fittingPlacement) {
|
|
5576
|
+
firstFittingPlacement = fittingPlacement;
|
|
5577
|
+
return "break";
|
|
5578
|
+
}
|
|
5579
|
+
};
|
|
5580
|
+
|
|
5581
|
+
for (var _i = numberOfChecks; _i > 0; _i--) {
|
|
5582
|
+
var _ret = _loop(_i);
|
|
5583
|
+
|
|
5584
|
+
if (_ret === "break") break;
|
|
5585
|
+
}
|
|
5586
|
+
}
|
|
5587
|
+
|
|
5588
|
+
if (state.placement !== firstFittingPlacement) {
|
|
5589
|
+
state.modifiersData[name]._skip = true;
|
|
5590
|
+
state.placement = firstFittingPlacement;
|
|
5591
|
+
state.reset = true;
|
|
5592
|
+
}
|
|
5593
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5594
|
+
|
|
5595
|
+
|
|
5596
|
+
var flip$1 = {
|
|
5597
|
+
name: 'flip',
|
|
5598
|
+
enabled: true,
|
|
5599
|
+
phase: 'main',
|
|
5600
|
+
fn: flip,
|
|
5601
|
+
requiresIfExists: ['offset'],
|
|
5602
|
+
data: {
|
|
5603
|
+
_skip: false
|
|
5604
|
+
}
|
|
5605
|
+
};
|
|
5606
|
+
|
|
5607
|
+
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
5608
|
+
if (preventedOffsets === void 0) {
|
|
5609
|
+
preventedOffsets = {
|
|
5610
|
+
x: 0,
|
|
5611
|
+
y: 0
|
|
5612
|
+
};
|
|
5613
|
+
}
|
|
5614
|
+
|
|
5615
|
+
return {
|
|
5616
|
+
top: overflow.top - rect.height - preventedOffsets.y,
|
|
5617
|
+
right: overflow.right - rect.width + preventedOffsets.x,
|
|
5618
|
+
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
|
5619
|
+
left: overflow.left - rect.width - preventedOffsets.x
|
|
5620
|
+
};
|
|
5621
|
+
}
|
|
5622
|
+
|
|
5623
|
+
function isAnySideFullyClipped(overflow) {
|
|
5624
|
+
return [top, right, bottom, left].some(function (side) {
|
|
5625
|
+
return overflow[side] >= 0;
|
|
5626
|
+
});
|
|
5627
|
+
}
|
|
5628
|
+
|
|
5629
|
+
function hide(_ref) {
|
|
5630
|
+
var state = _ref.state,
|
|
5631
|
+
name = _ref.name;
|
|
5632
|
+
var referenceRect = state.rects.reference;
|
|
5633
|
+
var popperRect = state.rects.popper;
|
|
5634
|
+
var preventedOffsets = state.modifiersData.preventOverflow;
|
|
5635
|
+
var referenceOverflow = detectOverflow(state, {
|
|
5636
|
+
elementContext: 'reference'
|
|
5637
|
+
});
|
|
5638
|
+
var popperAltOverflow = detectOverflow(state, {
|
|
5639
|
+
altBoundary: true
|
|
5640
|
+
});
|
|
5641
|
+
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
5642
|
+
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
5643
|
+
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
5644
|
+
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
5645
|
+
state.modifiersData[name] = {
|
|
5646
|
+
referenceClippingOffsets: referenceClippingOffsets,
|
|
5647
|
+
popperEscapeOffsets: popperEscapeOffsets,
|
|
5648
|
+
isReferenceHidden: isReferenceHidden,
|
|
5649
|
+
hasPopperEscaped: hasPopperEscaped
|
|
5650
|
+
};
|
|
5651
|
+
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
|
5652
|
+
'data-popper-reference-hidden': isReferenceHidden,
|
|
5653
|
+
'data-popper-escaped': hasPopperEscaped
|
|
5654
|
+
});
|
|
5655
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5656
|
+
|
|
5657
|
+
|
|
5658
|
+
var hide$1 = {
|
|
5659
|
+
name: 'hide',
|
|
5660
|
+
enabled: true,
|
|
5661
|
+
phase: 'main',
|
|
5662
|
+
requiresIfExists: ['preventOverflow'],
|
|
5663
|
+
fn: hide
|
|
5664
|
+
};
|
|
5665
|
+
|
|
5666
|
+
function distanceAndSkiddingToXY(placement, rects, offset) {
|
|
5667
|
+
var basePlacement = getBasePlacement(placement);
|
|
5668
|
+
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
|
5669
|
+
|
|
5670
|
+
var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {
|
|
5671
|
+
placement: placement
|
|
5672
|
+
})) : offset,
|
|
5673
|
+
skidding = _ref[0],
|
|
5674
|
+
distance = _ref[1];
|
|
5675
|
+
|
|
5676
|
+
skidding = skidding || 0;
|
|
5677
|
+
distance = (distance || 0) * invertDistance;
|
|
5678
|
+
return [left, right].indexOf(basePlacement) >= 0 ? {
|
|
5679
|
+
x: distance,
|
|
5680
|
+
y: skidding
|
|
5681
|
+
} : {
|
|
5682
|
+
x: skidding,
|
|
5683
|
+
y: distance
|
|
5684
|
+
};
|
|
5685
|
+
}
|
|
5686
|
+
|
|
5687
|
+
function offset(_ref2) {
|
|
5688
|
+
var state = _ref2.state,
|
|
5689
|
+
options = _ref2.options,
|
|
5690
|
+
name = _ref2.name;
|
|
5691
|
+
var _options$offset = options.offset,
|
|
5692
|
+
offset = _options$offset === void 0 ? [0, 0] : _options$offset;
|
|
5693
|
+
var data = placements.reduce(function (acc, placement) {
|
|
5694
|
+
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);
|
|
5695
|
+
return acc;
|
|
5696
|
+
}, {});
|
|
5697
|
+
var _data$state$placement = data[state.placement],
|
|
5698
|
+
x = _data$state$placement.x,
|
|
5699
|
+
y = _data$state$placement.y;
|
|
5700
|
+
|
|
5701
|
+
if (state.modifiersData.popperOffsets != null) {
|
|
5702
|
+
state.modifiersData.popperOffsets.x += x;
|
|
5703
|
+
state.modifiersData.popperOffsets.y += y;
|
|
5704
|
+
}
|
|
5705
|
+
|
|
5706
|
+
state.modifiersData[name] = data;
|
|
5707
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5708
|
+
|
|
5709
|
+
|
|
5710
|
+
var offset$1 = {
|
|
5711
|
+
name: 'offset',
|
|
5712
|
+
enabled: true,
|
|
5713
|
+
phase: 'main',
|
|
5714
|
+
requires: ['popperOffsets'],
|
|
5715
|
+
fn: offset
|
|
5716
|
+
};
|
|
5717
|
+
|
|
5718
|
+
function popperOffsets(_ref) {
|
|
5719
|
+
var state = _ref.state,
|
|
5720
|
+
name = _ref.name;
|
|
5721
|
+
// Offsets are the actual position the popper needs to have to be
|
|
5722
|
+
// properly positioned near its reference element
|
|
5723
|
+
// This is the most basic placement, and will be adjusted by
|
|
5724
|
+
// the modifiers in the next step
|
|
5725
|
+
state.modifiersData[name] = computeOffsets({
|
|
5726
|
+
reference: state.rects.reference,
|
|
5727
|
+
element: state.rects.popper,
|
|
5728
|
+
strategy: 'absolute',
|
|
5729
|
+
placement: state.placement
|
|
5730
|
+
});
|
|
5731
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5732
|
+
|
|
5733
|
+
|
|
5734
|
+
var popperOffsets$1 = {
|
|
5735
|
+
name: 'popperOffsets',
|
|
5736
|
+
enabled: true,
|
|
5737
|
+
phase: 'read',
|
|
5738
|
+
fn: popperOffsets,
|
|
5739
|
+
data: {}
|
|
5740
|
+
};
|
|
5741
|
+
|
|
5742
|
+
function getAltAxis(axis) {
|
|
5743
|
+
return axis === 'x' ? 'y' : 'x';
|
|
5744
|
+
}
|
|
5745
|
+
|
|
5746
|
+
function preventOverflow(_ref) {
|
|
5747
|
+
var state = _ref.state,
|
|
5748
|
+
options = _ref.options,
|
|
5749
|
+
name = _ref.name;
|
|
5750
|
+
var _options$mainAxis = options.mainAxis,
|
|
5751
|
+
checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,
|
|
5752
|
+
_options$altAxis = options.altAxis,
|
|
5753
|
+
checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,
|
|
5754
|
+
boundary = options.boundary,
|
|
5755
|
+
rootBoundary = options.rootBoundary,
|
|
5756
|
+
altBoundary = options.altBoundary,
|
|
5757
|
+
padding = options.padding,
|
|
5758
|
+
_options$tether = options.tether,
|
|
5759
|
+
tether = _options$tether === void 0 ? true : _options$tether,
|
|
5760
|
+
_options$tetherOffset = options.tetherOffset,
|
|
5761
|
+
tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
5762
|
+
var overflow = detectOverflow(state, {
|
|
5763
|
+
boundary: boundary,
|
|
5764
|
+
rootBoundary: rootBoundary,
|
|
5765
|
+
padding: padding,
|
|
5766
|
+
altBoundary: altBoundary
|
|
5767
|
+
});
|
|
5768
|
+
var basePlacement = getBasePlacement(state.placement);
|
|
5769
|
+
var variation = getVariation(state.placement);
|
|
5770
|
+
var isBasePlacement = !variation;
|
|
5771
|
+
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
|
5772
|
+
var altAxis = getAltAxis(mainAxis);
|
|
5773
|
+
var popperOffsets = state.modifiersData.popperOffsets;
|
|
5774
|
+
var referenceRect = state.rects.reference;
|
|
5775
|
+
var popperRect = state.rects.popper;
|
|
5776
|
+
var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {
|
|
5777
|
+
placement: state.placement
|
|
5778
|
+
})) : tetherOffset;
|
|
5779
|
+
var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {
|
|
5780
|
+
mainAxis: tetherOffsetValue,
|
|
5781
|
+
altAxis: tetherOffsetValue
|
|
5782
|
+
} : Object.assign({
|
|
5783
|
+
mainAxis: 0,
|
|
5784
|
+
altAxis: 0
|
|
5785
|
+
}, tetherOffsetValue);
|
|
5786
|
+
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
|
5787
|
+
var data = {
|
|
5788
|
+
x: 0,
|
|
5789
|
+
y: 0
|
|
5790
|
+
};
|
|
5791
|
+
|
|
5792
|
+
if (!popperOffsets) {
|
|
5793
|
+
return;
|
|
5794
|
+
}
|
|
5795
|
+
|
|
5796
|
+
if (checkMainAxis) {
|
|
5797
|
+
var _offsetModifierState$;
|
|
5798
|
+
|
|
5799
|
+
var mainSide = mainAxis === 'y' ? top : left;
|
|
5800
|
+
var altSide = mainAxis === 'y' ? bottom : right;
|
|
5801
|
+
var len = mainAxis === 'y' ? 'height' : 'width';
|
|
5802
|
+
var offset = popperOffsets[mainAxis];
|
|
5803
|
+
var min$1 = offset + overflow[mainSide];
|
|
5804
|
+
var max$1 = offset - overflow[altSide];
|
|
5805
|
+
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
5806
|
+
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
5807
|
+
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go
|
|
5808
|
+
// outside the reference bounds
|
|
5809
|
+
|
|
5810
|
+
var arrowElement = state.elements.arrow;
|
|
5811
|
+
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
|
5812
|
+
width: 0,
|
|
5813
|
+
height: 0
|
|
5814
|
+
};
|
|
5815
|
+
var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();
|
|
5816
|
+
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
|
5817
|
+
var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want
|
|
5818
|
+
// to include its full size in the calculation. If the reference is small
|
|
5819
|
+
// and near the edge of a boundary, the popper can overflow even if the
|
|
5820
|
+
// reference is not overflowing as well (e.g. virtual elements with no
|
|
5821
|
+
// width or height)
|
|
5822
|
+
|
|
5823
|
+
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
5824
|
+
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
5825
|
+
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
5826
|
+
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
|
5827
|
+
var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
5828
|
+
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
5829
|
+
var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;
|
|
5830
|
+
var tetherMax = offset + maxOffset - offsetModifierValue;
|
|
5831
|
+
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset, tether ? max(max$1, tetherMax) : max$1);
|
|
5832
|
+
popperOffsets[mainAxis] = preventedOffset;
|
|
5833
|
+
data[mainAxis] = preventedOffset - offset;
|
|
5834
|
+
}
|
|
5835
|
+
|
|
5836
|
+
if (checkAltAxis) {
|
|
5837
|
+
var _offsetModifierState$2;
|
|
5838
|
+
|
|
5839
|
+
var _mainSide = mainAxis === 'x' ? top : left;
|
|
5840
|
+
|
|
5841
|
+
var _altSide = mainAxis === 'x' ? bottom : right;
|
|
5842
|
+
|
|
5843
|
+
var _offset = popperOffsets[altAxis];
|
|
5844
|
+
|
|
5845
|
+
var _len = altAxis === 'y' ? 'height' : 'width';
|
|
5846
|
+
|
|
5847
|
+
var _min = _offset + overflow[_mainSide];
|
|
5848
|
+
|
|
5849
|
+
var _max = _offset - overflow[_altSide];
|
|
5850
|
+
|
|
5851
|
+
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
|
5852
|
+
|
|
5853
|
+
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
|
5854
|
+
|
|
5855
|
+
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
|
5856
|
+
|
|
5857
|
+
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
|
5858
|
+
|
|
5859
|
+
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
|
5860
|
+
|
|
5861
|
+
popperOffsets[altAxis] = _preventedOffset;
|
|
5862
|
+
data[altAxis] = _preventedOffset - _offset;
|
|
5863
|
+
}
|
|
5864
|
+
|
|
5865
|
+
state.modifiersData[name] = data;
|
|
5866
|
+
} // eslint-disable-next-line import/no-unused-modules
|
|
5867
|
+
|
|
5868
|
+
|
|
5869
|
+
var preventOverflow$1 = {
|
|
5870
|
+
name: 'preventOverflow',
|
|
5871
|
+
enabled: true,
|
|
5872
|
+
phase: 'main',
|
|
5873
|
+
fn: preventOverflow,
|
|
5874
|
+
requiresIfExists: ['offset']
|
|
5875
|
+
};
|
|
5876
|
+
|
|
5877
|
+
function getHTMLElementScroll(element) {
|
|
5878
|
+
return {
|
|
5879
|
+
scrollLeft: element.scrollLeft,
|
|
5880
|
+
scrollTop: element.scrollTop
|
|
5881
|
+
};
|
|
5882
|
+
}
|
|
5883
|
+
|
|
5884
|
+
function getNodeScroll(node) {
|
|
5885
|
+
if (node === getWindow(node) || !isHTMLElement(node)) {
|
|
5886
|
+
return getWindowScroll(node);
|
|
5887
|
+
} else {
|
|
5888
|
+
return getHTMLElementScroll(node);
|
|
5889
|
+
}
|
|
5890
|
+
}
|
|
5891
|
+
|
|
5892
|
+
function isElementScaled(element) {
|
|
5893
|
+
var rect = element.getBoundingClientRect();
|
|
5894
|
+
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
5895
|
+
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
5896
|
+
return scaleX !== 1 || scaleY !== 1;
|
|
5897
|
+
} // Returns the composite rect of an element relative to its offsetParent.
|
|
5898
|
+
// Composite means it takes into account transforms as well as layout.
|
|
5899
|
+
|
|
5900
|
+
|
|
5901
|
+
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
5902
|
+
if (isFixed === void 0) {
|
|
5903
|
+
isFixed = false;
|
|
5904
|
+
}
|
|
5905
|
+
|
|
5906
|
+
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
|
5907
|
+
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
|
5908
|
+
var documentElement = getDocumentElement(offsetParent);
|
|
5909
|
+
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
5910
|
+
var scroll = {
|
|
5911
|
+
scrollLeft: 0,
|
|
5912
|
+
scrollTop: 0
|
|
5913
|
+
};
|
|
5914
|
+
var offsets = {
|
|
5915
|
+
x: 0,
|
|
5916
|
+
y: 0
|
|
5917
|
+
};
|
|
5918
|
+
|
|
5919
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
5920
|
+
if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078
|
|
5921
|
+
isScrollParent(documentElement)) {
|
|
5922
|
+
scroll = getNodeScroll(offsetParent);
|
|
5923
|
+
}
|
|
5924
|
+
|
|
5925
|
+
if (isHTMLElement(offsetParent)) {
|
|
5926
|
+
offsets = getBoundingClientRect(offsetParent, true);
|
|
5927
|
+
offsets.x += offsetParent.clientLeft;
|
|
5928
|
+
offsets.y += offsetParent.clientTop;
|
|
5929
|
+
} else if (documentElement) {
|
|
5930
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
5931
|
+
}
|
|
5932
|
+
}
|
|
5933
|
+
|
|
5934
|
+
return {
|
|
5935
|
+
x: rect.left + scroll.scrollLeft - offsets.x,
|
|
5936
|
+
y: rect.top + scroll.scrollTop - offsets.y,
|
|
5937
|
+
width: rect.width,
|
|
5938
|
+
height: rect.height
|
|
5939
|
+
};
|
|
5940
|
+
}
|
|
5941
|
+
|
|
5942
|
+
function order(modifiers) {
|
|
5943
|
+
var map = new Map();
|
|
5944
|
+
var visited = new Set();
|
|
5945
|
+
var result = [];
|
|
5946
|
+
modifiers.forEach(function (modifier) {
|
|
5947
|
+
map.set(modifier.name, modifier);
|
|
5948
|
+
}); // On visiting object, check for its dependencies and visit them recursively
|
|
5949
|
+
|
|
5950
|
+
function sort(modifier) {
|
|
5951
|
+
visited.add(modifier.name);
|
|
5952
|
+
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
|
5953
|
+
requires.forEach(function (dep) {
|
|
5954
|
+
if (!visited.has(dep)) {
|
|
5955
|
+
var depModifier = map.get(dep);
|
|
5956
|
+
|
|
5957
|
+
if (depModifier) {
|
|
5958
|
+
sort(depModifier);
|
|
5959
|
+
}
|
|
5960
|
+
}
|
|
5961
|
+
});
|
|
5962
|
+
result.push(modifier);
|
|
5963
|
+
}
|
|
5964
|
+
|
|
5965
|
+
modifiers.forEach(function (modifier) {
|
|
5966
|
+
if (!visited.has(modifier.name)) {
|
|
5967
|
+
// check for visited object
|
|
5968
|
+
sort(modifier);
|
|
5969
|
+
}
|
|
5970
|
+
});
|
|
5971
|
+
return result;
|
|
5972
|
+
}
|
|
5973
|
+
|
|
5974
|
+
function orderModifiers(modifiers) {
|
|
5975
|
+
// order based on dependencies
|
|
5976
|
+
var orderedModifiers = order(modifiers); // order based on phase
|
|
5977
|
+
|
|
5978
|
+
return modifierPhases.reduce(function (acc, phase) {
|
|
5979
|
+
return acc.concat(orderedModifiers.filter(function (modifier) {
|
|
5980
|
+
return modifier.phase === phase;
|
|
5981
|
+
}));
|
|
5982
|
+
}, []);
|
|
5983
|
+
}
|
|
5984
|
+
|
|
5985
|
+
function debounce(fn) {
|
|
5986
|
+
var pending;
|
|
5987
|
+
return function () {
|
|
5988
|
+
if (!pending) {
|
|
5989
|
+
pending = new Promise(function (resolve) {
|
|
5990
|
+
Promise.resolve().then(function () {
|
|
5991
|
+
pending = undefined;
|
|
5992
|
+
resolve(fn());
|
|
5993
|
+
});
|
|
5994
|
+
});
|
|
5995
|
+
}
|
|
5996
|
+
|
|
5997
|
+
return pending;
|
|
5998
|
+
};
|
|
5999
|
+
}
|
|
6000
|
+
|
|
6001
|
+
function mergeByName(modifiers) {
|
|
6002
|
+
var merged = modifiers.reduce(function (merged, current) {
|
|
6003
|
+
var existing = merged[current.name];
|
|
6004
|
+
merged[current.name] = existing ? Object.assign({}, existing, current, {
|
|
6005
|
+
options: Object.assign({}, existing.options, current.options),
|
|
6006
|
+
data: Object.assign({}, existing.data, current.data)
|
|
6007
|
+
}) : current;
|
|
6008
|
+
return merged;
|
|
6009
|
+
}, {}); // IE11 does not support Object.values
|
|
6010
|
+
|
|
6011
|
+
return Object.keys(merged).map(function (key) {
|
|
6012
|
+
return merged[key];
|
|
6013
|
+
});
|
|
6014
|
+
}
|
|
6015
|
+
|
|
6016
|
+
var DEFAULT_OPTIONS = {
|
|
6017
|
+
placement: 'bottom',
|
|
6018
|
+
modifiers: [],
|
|
6019
|
+
strategy: 'absolute'
|
|
6020
|
+
};
|
|
6021
|
+
|
|
6022
|
+
function areValidElements() {
|
|
6023
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
6024
|
+
args[_key] = arguments[_key];
|
|
6025
|
+
}
|
|
6026
|
+
|
|
6027
|
+
return !args.some(function (element) {
|
|
6028
|
+
return !(element && typeof element.getBoundingClientRect === 'function');
|
|
6029
|
+
});
|
|
6030
|
+
}
|
|
6031
|
+
|
|
6032
|
+
function popperGenerator(generatorOptions) {
|
|
6033
|
+
if (generatorOptions === void 0) {
|
|
6034
|
+
generatorOptions = {};
|
|
6035
|
+
}
|
|
6036
|
+
|
|
6037
|
+
var _generatorOptions = generatorOptions,
|
|
6038
|
+
_generatorOptions$def = _generatorOptions.defaultModifiers,
|
|
6039
|
+
defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,
|
|
6040
|
+
_generatorOptions$def2 = _generatorOptions.defaultOptions,
|
|
6041
|
+
defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
|
6042
|
+
return function createPopper(reference, popper, options) {
|
|
6043
|
+
if (options === void 0) {
|
|
6044
|
+
options = defaultOptions;
|
|
6045
|
+
}
|
|
6046
|
+
|
|
6047
|
+
var state = {
|
|
6048
|
+
placement: 'bottom',
|
|
6049
|
+
orderedModifiers: [],
|
|
6050
|
+
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
|
6051
|
+
modifiersData: {},
|
|
6052
|
+
elements: {
|
|
6053
|
+
reference: reference,
|
|
6054
|
+
popper: popper
|
|
6055
|
+
},
|
|
6056
|
+
attributes: {},
|
|
6057
|
+
styles: {}
|
|
6058
|
+
};
|
|
6059
|
+
var effectCleanupFns = [];
|
|
6060
|
+
var isDestroyed = false;
|
|
6061
|
+
var instance = {
|
|
6062
|
+
state: state,
|
|
6063
|
+
setOptions: function setOptions(setOptionsAction) {
|
|
6064
|
+
var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;
|
|
6065
|
+
cleanupModifierEffects();
|
|
6066
|
+
state.options = Object.assign({}, defaultOptions, state.options, options);
|
|
6067
|
+
state.scrollParents = {
|
|
6068
|
+
reference: isElement$1(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],
|
|
6069
|
+
popper: listScrollParents(popper)
|
|
6070
|
+
}; // Orders the modifiers based on their dependencies and `phase`
|
|
6071
|
+
// properties
|
|
6072
|
+
|
|
6073
|
+
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers
|
|
6074
|
+
|
|
6075
|
+
state.orderedModifiers = orderedModifiers.filter(function (m) {
|
|
6076
|
+
return m.enabled;
|
|
6077
|
+
});
|
|
6078
|
+
runModifierEffects();
|
|
6079
|
+
return instance.update();
|
|
6080
|
+
},
|
|
6081
|
+
// Sync update – it will always be executed, even if not necessary. This
|
|
6082
|
+
// is useful for low frequency updates where sync behavior simplifies the
|
|
6083
|
+
// logic.
|
|
6084
|
+
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
|
6085
|
+
// prefer the async Popper#update method
|
|
6086
|
+
forceUpdate: function forceUpdate() {
|
|
6087
|
+
if (isDestroyed) {
|
|
6088
|
+
return;
|
|
6089
|
+
}
|
|
6090
|
+
|
|
6091
|
+
var _state$elements = state.elements,
|
|
6092
|
+
reference = _state$elements.reference,
|
|
6093
|
+
popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements
|
|
6094
|
+
// anymore
|
|
6095
|
+
|
|
6096
|
+
if (!areValidElements(reference, popper)) {
|
|
6097
|
+
return;
|
|
6098
|
+
} // Store the reference and popper rects to be read by modifiers
|
|
6099
|
+
|
|
6100
|
+
|
|
6101
|
+
state.rects = {
|
|
6102
|
+
reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),
|
|
6103
|
+
popper: getLayoutRect(popper)
|
|
6104
|
+
}; // Modifiers have the ability to reset the current update cycle. The
|
|
6105
|
+
// most common use case for this is the `flip` modifier changing the
|
|
6106
|
+
// placement, which then needs to re-run all the modifiers, because the
|
|
6107
|
+
// logic was previously ran for the previous placement and is therefore
|
|
6108
|
+
// stale/incorrect
|
|
6109
|
+
|
|
6110
|
+
state.reset = false;
|
|
6111
|
+
state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier
|
|
6112
|
+
// is filled with the initial data specified by the modifier. This means
|
|
6113
|
+
// it doesn't persist and is fresh on each update.
|
|
6114
|
+
// To ensure persistent data, use `${name}#persistent`
|
|
6115
|
+
|
|
6116
|
+
state.orderedModifiers.forEach(function (modifier) {
|
|
6117
|
+
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
|
6118
|
+
});
|
|
6119
|
+
|
|
6120
|
+
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
|
6121
|
+
if (state.reset === true) {
|
|
6122
|
+
state.reset = false;
|
|
6123
|
+
index = -1;
|
|
6124
|
+
continue;
|
|
6125
|
+
}
|
|
6126
|
+
|
|
6127
|
+
var _state$orderedModifie = state.orderedModifiers[index],
|
|
6128
|
+
fn = _state$orderedModifie.fn,
|
|
6129
|
+
_state$orderedModifie2 = _state$orderedModifie.options,
|
|
6130
|
+
_options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,
|
|
6131
|
+
name = _state$orderedModifie.name;
|
|
6132
|
+
|
|
6133
|
+
if (typeof fn === 'function') {
|
|
6134
|
+
state = fn({
|
|
6135
|
+
state: state,
|
|
6136
|
+
options: _options,
|
|
6137
|
+
name: name,
|
|
6138
|
+
instance: instance
|
|
6139
|
+
}) || state;
|
|
6140
|
+
}
|
|
6141
|
+
}
|
|
6142
|
+
},
|
|
6143
|
+
// Async and optimistically optimized update – it will not be executed if
|
|
6144
|
+
// not necessary (debounced to run at most once-per-tick)
|
|
6145
|
+
update: debounce(function () {
|
|
6146
|
+
return new Promise(function (resolve) {
|
|
6147
|
+
instance.forceUpdate();
|
|
6148
|
+
resolve(state);
|
|
6149
|
+
});
|
|
6150
|
+
}),
|
|
6151
|
+
destroy: function destroy() {
|
|
6152
|
+
cleanupModifierEffects();
|
|
6153
|
+
isDestroyed = true;
|
|
6154
|
+
}
|
|
6155
|
+
};
|
|
6156
|
+
|
|
6157
|
+
if (!areValidElements(reference, popper)) {
|
|
6158
|
+
return instance;
|
|
6159
|
+
}
|
|
6160
|
+
|
|
6161
|
+
instance.setOptions(options).then(function (state) {
|
|
6162
|
+
if (!isDestroyed && options.onFirstUpdate) {
|
|
6163
|
+
options.onFirstUpdate(state);
|
|
6164
|
+
}
|
|
6165
|
+
}); // Modifiers have the ability to execute arbitrary code before the first
|
|
6166
|
+
// update cycle runs. They will be executed in the same order as the update
|
|
6167
|
+
// cycle. This is useful when a modifier adds some persistent data that
|
|
6168
|
+
// other modifiers need to use, but the modifier is run after the dependent
|
|
6169
|
+
// one.
|
|
6170
|
+
|
|
6171
|
+
function runModifierEffects() {
|
|
6172
|
+
state.orderedModifiers.forEach(function (_ref) {
|
|
6173
|
+
var name = _ref.name,
|
|
6174
|
+
_ref$options = _ref.options,
|
|
6175
|
+
options = _ref$options === void 0 ? {} : _ref$options,
|
|
6176
|
+
effect = _ref.effect;
|
|
6177
|
+
|
|
6178
|
+
if (typeof effect === 'function') {
|
|
6179
|
+
var cleanupFn = effect({
|
|
6180
|
+
state: state,
|
|
6181
|
+
name: name,
|
|
6182
|
+
instance: instance,
|
|
6183
|
+
options: options
|
|
6184
|
+
});
|
|
6185
|
+
|
|
6186
|
+
var noopFn = function noopFn() {};
|
|
6187
|
+
|
|
6188
|
+
effectCleanupFns.push(cleanupFn || noopFn);
|
|
6189
|
+
}
|
|
6190
|
+
});
|
|
6191
|
+
}
|
|
6192
|
+
|
|
6193
|
+
function cleanupModifierEffects() {
|
|
6194
|
+
effectCleanupFns.forEach(function (fn) {
|
|
6195
|
+
return fn();
|
|
6196
|
+
});
|
|
6197
|
+
effectCleanupFns = [];
|
|
6198
|
+
}
|
|
6199
|
+
|
|
6200
|
+
return instance;
|
|
6201
|
+
};
|
|
6202
|
+
}
|
|
6203
|
+
var createPopper$2 = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules
|
|
6204
|
+
|
|
6205
|
+
var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
|
|
6206
|
+
var createPopper$1 = /*#__PURE__*/popperGenerator({
|
|
6207
|
+
defaultModifiers: defaultModifiers$1
|
|
6208
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
|
6209
|
+
|
|
6210
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
|
6211
|
+
var createPopper = /*#__PURE__*/popperGenerator({
|
|
6212
|
+
defaultModifiers: defaultModifiers
|
|
6213
|
+
}); // eslint-disable-next-line import/no-unused-modules
|
|
6214
|
+
|
|
6215
|
+
var Popper = /*#__PURE__*/Object.freeze({
|
|
6216
|
+
__proto__: null,
|
|
6217
|
+
popperGenerator: popperGenerator,
|
|
6218
|
+
detectOverflow: detectOverflow,
|
|
6219
|
+
createPopperBase: createPopper$2,
|
|
6220
|
+
createPopper: createPopper,
|
|
6221
|
+
createPopperLite: createPopper$1,
|
|
6222
|
+
top: top,
|
|
6223
|
+
bottom: bottom,
|
|
6224
|
+
right: right,
|
|
6225
|
+
left: left,
|
|
6226
|
+
auto: auto,
|
|
6227
|
+
basePlacements: basePlacements,
|
|
6228
|
+
start: start,
|
|
6229
|
+
end: end,
|
|
6230
|
+
clippingParents: clippingParents,
|
|
6231
|
+
viewport: viewport,
|
|
6232
|
+
popper: popper,
|
|
6233
|
+
reference: reference,
|
|
6234
|
+
variationPlacements: variationPlacements,
|
|
6235
|
+
placements: placements,
|
|
6236
|
+
beforeRead: beforeRead,
|
|
6237
|
+
read: read,
|
|
6238
|
+
afterRead: afterRead,
|
|
6239
|
+
beforeMain: beforeMain,
|
|
6240
|
+
main: main,
|
|
6241
|
+
afterMain: afterMain,
|
|
6242
|
+
beforeWrite: beforeWrite,
|
|
6243
|
+
write: write,
|
|
6244
|
+
afterWrite: afterWrite,
|
|
6245
|
+
modifierPhases: modifierPhases,
|
|
6246
|
+
applyStyles: applyStyles$1,
|
|
6247
|
+
arrow: arrow$1,
|
|
6248
|
+
computeStyles: computeStyles$1,
|
|
6249
|
+
eventListeners: eventListeners,
|
|
6250
|
+
flip: flip$1,
|
|
6251
|
+
hide: hide$1,
|
|
6252
|
+
offset: offset$1,
|
|
6253
|
+
popperOffsets: popperOffsets$1,
|
|
6254
|
+
preventOverflow: preventOverflow$1
|
|
6255
|
+
});
|
|
6256
|
+
|
|
6257
|
+
/**
|
|
6258
|
+
* --------------------------------------------------------------------------
|
|
6259
|
+
* Bootstrap dom/data.js
|
|
6260
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6261
|
+
* --------------------------------------------------------------------------
|
|
6262
|
+
*/
|
|
6263
|
+
|
|
6264
|
+
/**
|
|
6265
|
+
* Constants
|
|
6266
|
+
*/
|
|
6267
|
+
|
|
6268
|
+
const elementMap = new Map();
|
|
6269
|
+
|
|
6270
|
+
var Data = {
|
|
6271
|
+
set(element, key, instance) {
|
|
6272
|
+
if (!elementMap.has(element)) {
|
|
6273
|
+
elementMap.set(element, new Map());
|
|
6274
|
+
}
|
|
6275
|
+
|
|
6276
|
+
const instanceMap = elementMap.get(element);
|
|
6277
|
+
|
|
6278
|
+
// make it clear we only want one instance per element
|
|
6279
|
+
// can be removed later when multiple key/instances are fine to be used
|
|
6280
|
+
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
|
6281
|
+
// eslint-disable-next-line no-console
|
|
6282
|
+
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
|
6283
|
+
return
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
instanceMap.set(key, instance);
|
|
6287
|
+
},
|
|
6288
|
+
|
|
6289
|
+
get(element, key) {
|
|
6290
|
+
if (elementMap.has(element)) {
|
|
6291
|
+
return elementMap.get(element).get(key) || null
|
|
6292
|
+
}
|
|
6293
|
+
|
|
6294
|
+
return null
|
|
6295
|
+
},
|
|
6296
|
+
|
|
6297
|
+
remove(element, key) {
|
|
6298
|
+
if (!elementMap.has(element)) {
|
|
6299
|
+
return
|
|
6300
|
+
}
|
|
6301
|
+
|
|
6302
|
+
const instanceMap = elementMap.get(element);
|
|
6303
|
+
|
|
6304
|
+
instanceMap.delete(key);
|
|
6305
|
+
|
|
6306
|
+
// free up element references if there are no instances left for an element
|
|
6307
|
+
if (instanceMap.size === 0) {
|
|
6308
|
+
elementMap.delete(element);
|
|
6309
|
+
}
|
|
6310
|
+
}
|
|
6311
|
+
};
|
|
6312
|
+
|
|
6313
|
+
/**
|
|
6314
|
+
* --------------------------------------------------------------------------
|
|
6315
|
+
* Bootstrap util/index.js
|
|
6316
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6317
|
+
* --------------------------------------------------------------------------
|
|
6318
|
+
*/
|
|
6319
|
+
|
|
6320
|
+
const MAX_UID = 1_000_000;
|
|
6321
|
+
const MILLISECONDS_MULTIPLIER = 1000;
|
|
6322
|
+
const TRANSITION_END = 'transitionend';
|
|
6323
|
+
|
|
6324
|
+
/**
|
|
6325
|
+
* Properly escape IDs selectors to handle weird IDs
|
|
6326
|
+
* @param {string} selector
|
|
6327
|
+
* @returns {string}
|
|
6328
|
+
*/
|
|
6329
|
+
const parseSelector = selector => {
|
|
6330
|
+
if (selector && window.CSS && window.CSS.escape) {
|
|
6331
|
+
// document.querySelector needs escaping to handle IDs (html5+) containing for instance /
|
|
6332
|
+
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
|
|
6333
|
+
}
|
|
6334
|
+
|
|
6335
|
+
return selector
|
|
6336
|
+
};
|
|
6337
|
+
|
|
6338
|
+
// Shout-out Angus Croll (https://goo.gl/pxwQGp)
|
|
6339
|
+
const toType = object => {
|
|
6340
|
+
if (object === null || object === undefined) {
|
|
6341
|
+
return `${object}`
|
|
6342
|
+
}
|
|
6343
|
+
|
|
6344
|
+
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase()
|
|
6345
|
+
};
|
|
6346
|
+
|
|
6347
|
+
/**
|
|
6348
|
+
* Public Util API
|
|
6349
|
+
*/
|
|
6350
|
+
|
|
6351
|
+
const getUID = prefix => {
|
|
6352
|
+
do {
|
|
6353
|
+
prefix += Math.floor(Math.random() * MAX_UID);
|
|
6354
|
+
} while (document.getElementById(prefix))
|
|
6355
|
+
|
|
6356
|
+
return prefix
|
|
6357
|
+
};
|
|
6358
|
+
|
|
6359
|
+
const getTransitionDurationFromElement = element => {
|
|
6360
|
+
if (!element) {
|
|
6361
|
+
return 0
|
|
6362
|
+
}
|
|
6363
|
+
|
|
6364
|
+
// Get transition-duration of the element
|
|
6365
|
+
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
|
6366
|
+
|
|
6367
|
+
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
|
6368
|
+
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
|
6369
|
+
|
|
6370
|
+
// Return 0 if element or transition duration is not found
|
|
6371
|
+
if (!floatTransitionDuration && !floatTransitionDelay) {
|
|
6372
|
+
return 0
|
|
6373
|
+
}
|
|
6374
|
+
|
|
6375
|
+
// If multiple durations are defined, take the first
|
|
6376
|
+
transitionDuration = transitionDuration.split(',')[0];
|
|
6377
|
+
transitionDelay = transitionDelay.split(',')[0];
|
|
6378
|
+
|
|
6379
|
+
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER
|
|
6380
|
+
};
|
|
6381
|
+
|
|
6382
|
+
const triggerTransitionEnd = element => {
|
|
6383
|
+
element.dispatchEvent(new Event(TRANSITION_END));
|
|
6384
|
+
};
|
|
6385
|
+
|
|
6386
|
+
const isElement = object => {
|
|
6387
|
+
if (!object || typeof object !== 'object') {
|
|
6388
|
+
return false
|
|
6389
|
+
}
|
|
6390
|
+
|
|
6391
|
+
if (typeof object.jquery !== 'undefined') {
|
|
6392
|
+
object = object[0];
|
|
6393
|
+
}
|
|
6394
|
+
|
|
6395
|
+
return typeof object.nodeType !== 'undefined'
|
|
6396
|
+
};
|
|
6397
|
+
|
|
6398
|
+
const getElement = object => {
|
|
6399
|
+
// it's a jQuery object or a node element
|
|
6400
|
+
if (isElement(object)) {
|
|
6401
|
+
return object.jquery ? object[0] : object
|
|
6402
|
+
}
|
|
6403
|
+
|
|
6404
|
+
if (typeof object === 'string' && object.length > 0) {
|
|
6405
|
+
return document.querySelector(parseSelector(object))
|
|
6406
|
+
}
|
|
6407
|
+
|
|
6408
|
+
return null
|
|
6409
|
+
};
|
|
6410
|
+
|
|
6411
|
+
const isVisible = element => {
|
|
6412
|
+
if (!isElement(element) || element.getClientRects().length === 0) {
|
|
6413
|
+
return false
|
|
6414
|
+
}
|
|
6415
|
+
|
|
6416
|
+
const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible';
|
|
6417
|
+
// Handle `details` element as its content may falsie appear visible when it is closed
|
|
6418
|
+
const closedDetails = element.closest('details:not([open])');
|
|
6419
|
+
|
|
6420
|
+
if (!closedDetails) {
|
|
6421
|
+
return elementIsVisible
|
|
6422
|
+
}
|
|
6423
|
+
|
|
6424
|
+
if (closedDetails !== element) {
|
|
6425
|
+
const summary = element.closest('summary');
|
|
6426
|
+
if (summary && summary.parentNode !== closedDetails) {
|
|
6427
|
+
return false
|
|
6428
|
+
}
|
|
6429
|
+
|
|
6430
|
+
if (summary === null) {
|
|
6431
|
+
return false
|
|
6432
|
+
}
|
|
6433
|
+
}
|
|
6434
|
+
|
|
6435
|
+
return elementIsVisible
|
|
6436
|
+
};
|
|
6437
|
+
|
|
6438
|
+
const isDisabled = element => {
|
|
6439
|
+
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
|
6440
|
+
return true
|
|
6441
|
+
}
|
|
6442
|
+
|
|
6443
|
+
if (element.classList.contains('disabled')) {
|
|
6444
|
+
return true
|
|
6445
|
+
}
|
|
6446
|
+
|
|
6447
|
+
if (typeof element.disabled !== 'undefined') {
|
|
6448
|
+
return element.disabled
|
|
6449
|
+
}
|
|
6450
|
+
|
|
6451
|
+
return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'
|
|
6452
|
+
};
|
|
6453
|
+
|
|
6454
|
+
const findShadowRoot = element => {
|
|
6455
|
+
if (!document.documentElement.attachShadow) {
|
|
6456
|
+
return null
|
|
6457
|
+
}
|
|
6458
|
+
|
|
6459
|
+
// Can find the shadow root otherwise it'll return the document
|
|
6460
|
+
if (typeof element.getRootNode === 'function') {
|
|
6461
|
+
const root = element.getRootNode();
|
|
6462
|
+
return root instanceof ShadowRoot ? root : null
|
|
6463
|
+
}
|
|
6464
|
+
|
|
6465
|
+
if (element instanceof ShadowRoot) {
|
|
6466
|
+
return element
|
|
6467
|
+
}
|
|
6468
|
+
|
|
6469
|
+
// when we don't find a shadow root
|
|
6470
|
+
if (!element.parentNode) {
|
|
6471
|
+
return null
|
|
6472
|
+
}
|
|
6473
|
+
|
|
6474
|
+
return findShadowRoot(element.parentNode)
|
|
6475
|
+
};
|
|
6476
|
+
|
|
6477
|
+
const noop = () => {};
|
|
6478
|
+
|
|
6479
|
+
const getjQuery = () => {
|
|
6480
|
+
if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {
|
|
6481
|
+
return window.jQuery
|
|
6482
|
+
}
|
|
6483
|
+
|
|
6484
|
+
return null
|
|
6485
|
+
};
|
|
6486
|
+
|
|
6487
|
+
const DOMContentLoadedCallbacks = [];
|
|
6488
|
+
|
|
6489
|
+
const onDOMContentLoaded = callback => {
|
|
6490
|
+
if (document.readyState === 'loading') {
|
|
6491
|
+
// add listener on the first call when the document is in loading state
|
|
6492
|
+
if (!DOMContentLoadedCallbacks.length) {
|
|
6493
|
+
document.addEventListener('DOMContentLoaded', () => {
|
|
6494
|
+
for (const callback of DOMContentLoadedCallbacks) {
|
|
6495
|
+
callback();
|
|
6496
|
+
}
|
|
6497
|
+
});
|
|
6498
|
+
}
|
|
6499
|
+
|
|
6500
|
+
DOMContentLoadedCallbacks.push(callback);
|
|
6501
|
+
} else {
|
|
6502
|
+
callback();
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
|
|
6506
|
+
const isRTL = () => document.documentElement.dir === 'rtl';
|
|
6507
|
+
|
|
6508
|
+
const defineJQueryPlugin = plugin => {
|
|
6509
|
+
onDOMContentLoaded(() => {
|
|
6510
|
+
const $ = getjQuery();
|
|
6511
|
+
/* istanbul ignore if */
|
|
6512
|
+
if ($) {
|
|
6513
|
+
const name = plugin.NAME;
|
|
6514
|
+
const JQUERY_NO_CONFLICT = $.fn[name];
|
|
6515
|
+
$.fn[name] = plugin.jQueryInterface;
|
|
6516
|
+
$.fn[name].Constructor = plugin;
|
|
6517
|
+
$.fn[name].noConflict = () => {
|
|
6518
|
+
$.fn[name] = JQUERY_NO_CONFLICT;
|
|
6519
|
+
return plugin.jQueryInterface
|
|
6520
|
+
};
|
|
6521
|
+
}
|
|
6522
|
+
});
|
|
6523
|
+
};
|
|
6524
|
+
|
|
6525
|
+
const execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
|
|
6526
|
+
return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue
|
|
6527
|
+
};
|
|
6528
|
+
|
|
6529
|
+
const executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
|
6530
|
+
if (!waitForTransition) {
|
|
6531
|
+
execute(callback);
|
|
6532
|
+
return
|
|
6533
|
+
}
|
|
6534
|
+
|
|
6535
|
+
const durationPadding = 5;
|
|
6536
|
+
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
|
6537
|
+
|
|
6538
|
+
let called = false;
|
|
6539
|
+
|
|
6540
|
+
const handler = ({ target }) => {
|
|
6541
|
+
if (target !== transitionElement) {
|
|
6542
|
+
return
|
|
6543
|
+
}
|
|
6544
|
+
|
|
6545
|
+
called = true;
|
|
6546
|
+
transitionElement.removeEventListener(TRANSITION_END, handler);
|
|
6547
|
+
execute(callback);
|
|
6548
|
+
};
|
|
6549
|
+
|
|
6550
|
+
transitionElement.addEventListener(TRANSITION_END, handler);
|
|
6551
|
+
setTimeout(() => {
|
|
6552
|
+
if (!called) {
|
|
6553
|
+
triggerTransitionEnd(transitionElement);
|
|
6554
|
+
}
|
|
6555
|
+
}, emulatedDuration);
|
|
6556
|
+
};
|
|
6557
|
+
|
|
6558
|
+
/**
|
|
6559
|
+
* --------------------------------------------------------------------------
|
|
6560
|
+
* Bootstrap dom/event-handler.js
|
|
6561
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6562
|
+
* --------------------------------------------------------------------------
|
|
6563
|
+
*/
|
|
6564
|
+
|
|
6565
|
+
/**
|
|
6566
|
+
* Constants
|
|
6567
|
+
*/
|
|
6568
|
+
|
|
6569
|
+
const namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
|
6570
|
+
const stripNameRegex = /\..*/;
|
|
6571
|
+
const stripUidRegex = /::\d+$/;
|
|
6572
|
+
const eventRegistry = {}; // Events storage
|
|
6573
|
+
let uidEvent = 1;
|
|
6574
|
+
const customEvents = {
|
|
6575
|
+
mouseenter: 'mouseover',
|
|
6576
|
+
mouseleave: 'mouseout'
|
|
6577
|
+
};
|
|
6578
|
+
|
|
6579
|
+
const nativeEvents = new Set([
|
|
6580
|
+
'click',
|
|
6581
|
+
'dblclick',
|
|
6582
|
+
'mouseup',
|
|
6583
|
+
'mousedown',
|
|
6584
|
+
'contextmenu',
|
|
6585
|
+
'mousewheel',
|
|
6586
|
+
'DOMMouseScroll',
|
|
6587
|
+
'mouseover',
|
|
6588
|
+
'mouseout',
|
|
6589
|
+
'mousemove',
|
|
6590
|
+
'selectstart',
|
|
6591
|
+
'selectend',
|
|
6592
|
+
'keydown',
|
|
6593
|
+
'keypress',
|
|
6594
|
+
'keyup',
|
|
6595
|
+
'orientationchange',
|
|
6596
|
+
'touchstart',
|
|
6597
|
+
'touchmove',
|
|
6598
|
+
'touchend',
|
|
6599
|
+
'touchcancel',
|
|
6600
|
+
'pointerdown',
|
|
6601
|
+
'pointermove',
|
|
6602
|
+
'pointerup',
|
|
6603
|
+
'pointerleave',
|
|
6604
|
+
'pointercancel',
|
|
6605
|
+
'gesturestart',
|
|
6606
|
+
'gesturechange',
|
|
6607
|
+
'gestureend',
|
|
6608
|
+
'focus',
|
|
6609
|
+
'blur',
|
|
6610
|
+
'change',
|
|
6611
|
+
'reset',
|
|
6612
|
+
'select',
|
|
6613
|
+
'submit',
|
|
6614
|
+
'focusin',
|
|
6615
|
+
'focusout',
|
|
6616
|
+
'load',
|
|
6617
|
+
'unload',
|
|
6618
|
+
'beforeunload',
|
|
6619
|
+
'resize',
|
|
6620
|
+
'move',
|
|
6621
|
+
'DOMContentLoaded',
|
|
6622
|
+
'readystatechange',
|
|
6623
|
+
'error',
|
|
6624
|
+
'abort',
|
|
6625
|
+
'scroll'
|
|
6626
|
+
]);
|
|
6627
|
+
|
|
6628
|
+
/**
|
|
6629
|
+
* Private methods
|
|
6630
|
+
*/
|
|
6631
|
+
|
|
6632
|
+
function makeEventUid(element, uid) {
|
|
6633
|
+
return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++
|
|
6634
|
+
}
|
|
6635
|
+
|
|
6636
|
+
function getElementEvents(element) {
|
|
6637
|
+
const uid = makeEventUid(element);
|
|
6638
|
+
|
|
6639
|
+
element.uidEvent = uid;
|
|
6640
|
+
eventRegistry[uid] = eventRegistry[uid] || {};
|
|
6641
|
+
|
|
6642
|
+
return eventRegistry[uid]
|
|
6643
|
+
}
|
|
6644
|
+
|
|
6645
|
+
function bootstrapHandler(element, fn) {
|
|
6646
|
+
return function handler(event) {
|
|
6647
|
+
hydrateObj(event, { delegateTarget: element });
|
|
6648
|
+
|
|
6649
|
+
if (handler.oneOff) {
|
|
6650
|
+
EventHandler.off(element, event.type, fn);
|
|
6651
|
+
}
|
|
6652
|
+
|
|
6653
|
+
return fn.apply(element, [event])
|
|
6654
|
+
}
|
|
6655
|
+
}
|
|
6656
|
+
|
|
6657
|
+
function bootstrapDelegationHandler(element, selector, fn) {
|
|
6658
|
+
return function handler(event) {
|
|
6659
|
+
const domElements = element.querySelectorAll(selector);
|
|
6660
|
+
|
|
6661
|
+
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
|
6662
|
+
for (const domElement of domElements) {
|
|
6663
|
+
if (domElement !== target) {
|
|
6664
|
+
continue
|
|
6665
|
+
}
|
|
6666
|
+
|
|
6667
|
+
hydrateObj(event, { delegateTarget: target });
|
|
6668
|
+
|
|
6669
|
+
if (handler.oneOff) {
|
|
6670
|
+
EventHandler.off(element, event.type, selector, fn);
|
|
6671
|
+
}
|
|
6672
|
+
|
|
6673
|
+
return fn.apply(target, [event])
|
|
6674
|
+
}
|
|
6675
|
+
}
|
|
6676
|
+
}
|
|
6677
|
+
}
|
|
6678
|
+
|
|
6679
|
+
function findHandler(events, callable, delegationSelector = null) {
|
|
6680
|
+
return Object.values(events)
|
|
6681
|
+
.find(event => event.callable === callable && event.delegationSelector === delegationSelector)
|
|
6682
|
+
}
|
|
6683
|
+
|
|
6684
|
+
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
|
|
6685
|
+
const isDelegated = typeof handler === 'string';
|
|
6686
|
+
// TODO: tooltip passes `false` instead of selector, so we need to check
|
|
6687
|
+
const callable = isDelegated ? delegationFunction : (handler || delegationFunction);
|
|
6688
|
+
let typeEvent = getTypeEvent(originalTypeEvent);
|
|
6689
|
+
|
|
6690
|
+
if (!nativeEvents.has(typeEvent)) {
|
|
6691
|
+
typeEvent = originalTypeEvent;
|
|
6692
|
+
}
|
|
6693
|
+
|
|
6694
|
+
return [isDelegated, callable, typeEvent]
|
|
6695
|
+
}
|
|
6696
|
+
|
|
6697
|
+
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
|
|
6698
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
|
6699
|
+
return
|
|
6700
|
+
}
|
|
6701
|
+
|
|
6702
|
+
let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
|
6703
|
+
|
|
6704
|
+
// in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position
|
|
6705
|
+
// this prevents the handler from being dispatched the same way as mouseover or mouseout does
|
|
6706
|
+
if (originalTypeEvent in customEvents) {
|
|
6707
|
+
const wrapFunction = fn => {
|
|
6708
|
+
return function (event) {
|
|
6709
|
+
if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {
|
|
6710
|
+
return fn.call(this, event)
|
|
6711
|
+
}
|
|
6712
|
+
}
|
|
6713
|
+
};
|
|
6714
|
+
|
|
6715
|
+
callable = wrapFunction(callable);
|
|
6716
|
+
}
|
|
6717
|
+
|
|
6718
|
+
const events = getElementEvents(element);
|
|
6719
|
+
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
|
6720
|
+
const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
|
|
6721
|
+
|
|
6722
|
+
if (previousFunction) {
|
|
6723
|
+
previousFunction.oneOff = previousFunction.oneOff && oneOff;
|
|
6724
|
+
|
|
6725
|
+
return
|
|
6726
|
+
}
|
|
6727
|
+
|
|
6728
|
+
const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''));
|
|
6729
|
+
const fn = isDelegated ?
|
|
6730
|
+
bootstrapDelegationHandler(element, handler, callable) :
|
|
6731
|
+
bootstrapHandler(element, callable);
|
|
6732
|
+
|
|
6733
|
+
fn.delegationSelector = isDelegated ? handler : null;
|
|
6734
|
+
fn.callable = callable;
|
|
6735
|
+
fn.oneOff = oneOff;
|
|
6736
|
+
fn.uidEvent = uid;
|
|
6737
|
+
handlers[uid] = fn;
|
|
6738
|
+
|
|
6739
|
+
element.addEventListener(typeEvent, fn, isDelegated);
|
|
6740
|
+
}
|
|
6741
|
+
|
|
6742
|
+
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
|
6743
|
+
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
|
6744
|
+
|
|
6745
|
+
if (!fn) {
|
|
6746
|
+
return
|
|
6747
|
+
}
|
|
6748
|
+
|
|
6749
|
+
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
|
6750
|
+
delete events[typeEvent][fn.uidEvent];
|
|
6751
|
+
}
|
|
6752
|
+
|
|
6753
|
+
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
|
6754
|
+
const storeElementEvent = events[typeEvent] || {};
|
|
6755
|
+
|
|
6756
|
+
for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
|
|
6757
|
+
if (handlerKey.includes(namespace)) {
|
|
6758
|
+
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
|
6759
|
+
}
|
|
6760
|
+
}
|
|
6761
|
+
}
|
|
6762
|
+
|
|
6763
|
+
function getTypeEvent(event) {
|
|
6764
|
+
// allow to get the native events from namespaced events ('click.bs.button' --> 'click')
|
|
6765
|
+
event = event.replace(stripNameRegex, '');
|
|
6766
|
+
return customEvents[event] || event
|
|
6767
|
+
}
|
|
6768
|
+
|
|
6769
|
+
const EventHandler = {
|
|
6770
|
+
on(element, event, handler, delegationFunction) {
|
|
6771
|
+
addHandler(element, event, handler, delegationFunction, false);
|
|
6772
|
+
},
|
|
6773
|
+
|
|
6774
|
+
one(element, event, handler, delegationFunction) {
|
|
6775
|
+
addHandler(element, event, handler, delegationFunction, true);
|
|
6776
|
+
},
|
|
6777
|
+
|
|
6778
|
+
off(element, originalTypeEvent, handler, delegationFunction) {
|
|
6779
|
+
if (typeof originalTypeEvent !== 'string' || !element) {
|
|
6780
|
+
return
|
|
6781
|
+
}
|
|
6782
|
+
|
|
6783
|
+
const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
|
6784
|
+
const inNamespace = typeEvent !== originalTypeEvent;
|
|
6785
|
+
const events = getElementEvents(element);
|
|
6786
|
+
const storeElementEvent = events[typeEvent] || {};
|
|
6787
|
+
const isNamespace = originalTypeEvent.startsWith('.');
|
|
6788
|
+
|
|
6789
|
+
if (typeof callable !== 'undefined') {
|
|
6790
|
+
// Simplest case: handler is passed, remove that listener ONLY.
|
|
6791
|
+
if (!Object.keys(storeElementEvent).length) {
|
|
6792
|
+
return
|
|
6793
|
+
}
|
|
6794
|
+
|
|
6795
|
+
removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
|
|
6796
|
+
return
|
|
6797
|
+
}
|
|
6798
|
+
|
|
6799
|
+
if (isNamespace) {
|
|
6800
|
+
for (const elementEvent of Object.keys(events)) {
|
|
6801
|
+
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
|
6802
|
+
}
|
|
6803
|
+
}
|
|
6804
|
+
|
|
6805
|
+
for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
|
|
6806
|
+
const handlerKey = keyHandlers.replace(stripUidRegex, '');
|
|
6807
|
+
|
|
6808
|
+
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
|
6809
|
+
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
|
6810
|
+
}
|
|
6811
|
+
}
|
|
6812
|
+
},
|
|
6813
|
+
|
|
6814
|
+
trigger(element, event, args) {
|
|
6815
|
+
if (typeof event !== 'string' || !element) {
|
|
6816
|
+
return null
|
|
6817
|
+
}
|
|
6818
|
+
|
|
6819
|
+
const $ = getjQuery();
|
|
6820
|
+
const typeEvent = getTypeEvent(event);
|
|
6821
|
+
const inNamespace = event !== typeEvent;
|
|
6822
|
+
|
|
6823
|
+
let jQueryEvent = null;
|
|
6824
|
+
let bubbles = true;
|
|
6825
|
+
let nativeDispatch = true;
|
|
6826
|
+
let defaultPrevented = false;
|
|
6827
|
+
|
|
6828
|
+
if (inNamespace && $) {
|
|
6829
|
+
jQueryEvent = $.Event(event, args);
|
|
6830
|
+
|
|
6831
|
+
$(element).trigger(jQueryEvent);
|
|
6832
|
+
bubbles = !jQueryEvent.isPropagationStopped();
|
|
6833
|
+
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
|
6834
|
+
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
|
6835
|
+
}
|
|
6836
|
+
|
|
6837
|
+
const evt = hydrateObj(new Event(event, { bubbles, cancelable: true }), args);
|
|
6838
|
+
|
|
6839
|
+
if (defaultPrevented) {
|
|
6840
|
+
evt.preventDefault();
|
|
6841
|
+
}
|
|
6842
|
+
|
|
6843
|
+
if (nativeDispatch) {
|
|
6844
|
+
element.dispatchEvent(evt);
|
|
6845
|
+
}
|
|
6846
|
+
|
|
6847
|
+
if (evt.defaultPrevented && jQueryEvent) {
|
|
6848
|
+
jQueryEvent.preventDefault();
|
|
6849
|
+
}
|
|
6850
|
+
|
|
6851
|
+
return evt
|
|
6852
|
+
}
|
|
6853
|
+
};
|
|
6854
|
+
|
|
6855
|
+
function hydrateObj(obj, meta = {}) {
|
|
6856
|
+
for (const [key, value] of Object.entries(meta)) {
|
|
6857
|
+
try {
|
|
6858
|
+
obj[key] = value;
|
|
6859
|
+
} catch {
|
|
6860
|
+
Object.defineProperty(obj, key, {
|
|
6861
|
+
configurable: true,
|
|
6862
|
+
get() {
|
|
6863
|
+
return value
|
|
6864
|
+
}
|
|
6865
|
+
});
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
|
|
6869
|
+
return obj
|
|
6870
|
+
}
|
|
6871
|
+
|
|
6872
|
+
/**
|
|
6873
|
+
* --------------------------------------------------------------------------
|
|
6874
|
+
* Bootstrap dom/manipulator.js
|
|
6875
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6876
|
+
* --------------------------------------------------------------------------
|
|
6877
|
+
*/
|
|
6878
|
+
|
|
6879
|
+
function normalizeData(value) {
|
|
6880
|
+
if (value === 'true') {
|
|
6881
|
+
return true
|
|
6882
|
+
}
|
|
6883
|
+
|
|
6884
|
+
if (value === 'false') {
|
|
6885
|
+
return false
|
|
6886
|
+
}
|
|
6887
|
+
|
|
6888
|
+
if (value === Number(value).toString()) {
|
|
6889
|
+
return Number(value)
|
|
6890
|
+
}
|
|
6891
|
+
|
|
6892
|
+
if (value === '' || value === 'null') {
|
|
6893
|
+
return null
|
|
6894
|
+
}
|
|
6895
|
+
|
|
6896
|
+
if (typeof value !== 'string') {
|
|
6897
|
+
return value
|
|
6898
|
+
}
|
|
6899
|
+
|
|
6900
|
+
try {
|
|
6901
|
+
return JSON.parse(decodeURIComponent(value))
|
|
6902
|
+
} catch {
|
|
6903
|
+
return value
|
|
6904
|
+
}
|
|
6905
|
+
}
|
|
6906
|
+
|
|
6907
|
+
function normalizeDataKey(key) {
|
|
6908
|
+
return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)
|
|
6909
|
+
}
|
|
6910
|
+
|
|
6911
|
+
const Manipulator = {
|
|
6912
|
+
setDataAttribute(element, key, value) {
|
|
6913
|
+
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
|
6914
|
+
},
|
|
6915
|
+
|
|
6916
|
+
removeDataAttribute(element, key) {
|
|
6917
|
+
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
|
6918
|
+
},
|
|
6919
|
+
|
|
6920
|
+
getDataAttributes(element) {
|
|
6921
|
+
if (!element) {
|
|
6922
|
+
return {}
|
|
6923
|
+
}
|
|
6924
|
+
|
|
6925
|
+
const attributes = {};
|
|
6926
|
+
const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'));
|
|
6927
|
+
|
|
6928
|
+
for (const key of bsKeys) {
|
|
6929
|
+
let pureKey = key.replace(/^bs/, '');
|
|
6930
|
+
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
|
6931
|
+
attributes[pureKey] = normalizeData(element.dataset[key]);
|
|
6932
|
+
}
|
|
6933
|
+
|
|
6934
|
+
return attributes
|
|
6935
|
+
},
|
|
6936
|
+
|
|
6937
|
+
getDataAttribute(element, key) {
|
|
6938
|
+
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))
|
|
6939
|
+
}
|
|
6940
|
+
};
|
|
6941
|
+
|
|
6942
|
+
/**
|
|
6943
|
+
* --------------------------------------------------------------------------
|
|
6944
|
+
* Bootstrap util/config.js
|
|
6945
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
6946
|
+
* --------------------------------------------------------------------------
|
|
6947
|
+
*/
|
|
6948
|
+
|
|
6949
|
+
/**
|
|
6950
|
+
* Class definition
|
|
6951
|
+
*/
|
|
6952
|
+
|
|
6953
|
+
class Config {
|
|
6954
|
+
// Getters
|
|
6955
|
+
static get Default() {
|
|
6956
|
+
return {}
|
|
6957
|
+
}
|
|
6958
|
+
|
|
6959
|
+
static get DefaultType() {
|
|
6960
|
+
return {}
|
|
6961
|
+
}
|
|
6962
|
+
|
|
6963
|
+
static get NAME() {
|
|
6964
|
+
throw new Error('You have to implement the static method "NAME", for each component!')
|
|
6965
|
+
}
|
|
6966
|
+
|
|
6967
|
+
_getConfig(config) {
|
|
6968
|
+
config = this._mergeConfigObj(config);
|
|
6969
|
+
config = this._configAfterMerge(config);
|
|
6970
|
+
this._typeCheckConfig(config);
|
|
6971
|
+
return config
|
|
6972
|
+
}
|
|
6973
|
+
|
|
6974
|
+
_configAfterMerge(config) {
|
|
6975
|
+
return config
|
|
6976
|
+
}
|
|
6977
|
+
|
|
6978
|
+
_mergeConfigObj(config, element) {
|
|
6979
|
+
const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {}; // try to parse
|
|
6980
|
+
|
|
6981
|
+
return {
|
|
6982
|
+
...this.constructor.Default,
|
|
6983
|
+
...(typeof jsonConfig === 'object' ? jsonConfig : {}),
|
|
6984
|
+
...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),
|
|
6985
|
+
...(typeof config === 'object' ? config : {})
|
|
6986
|
+
}
|
|
6987
|
+
}
|
|
6988
|
+
|
|
6989
|
+
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
|
6990
|
+
for (const [property, expectedTypes] of Object.entries(configTypes)) {
|
|
6991
|
+
const value = config[property];
|
|
6992
|
+
const valueType = isElement(value) ? 'element' : toType(value);
|
|
6993
|
+
|
|
6994
|
+
if (!new RegExp(expectedTypes).test(valueType)) {
|
|
6995
|
+
throw new TypeError(
|
|
6996
|
+
`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
|
|
6997
|
+
)
|
|
6998
|
+
}
|
|
6999
|
+
}
|
|
7000
|
+
}
|
|
7001
|
+
}
|
|
7002
|
+
|
|
7003
|
+
/**
|
|
7004
|
+
* --------------------------------------------------------------------------
|
|
7005
|
+
* Bootstrap base-component.js
|
|
7006
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
7007
|
+
* --------------------------------------------------------------------------
|
|
7008
|
+
*/
|
|
7009
|
+
|
|
7010
|
+
/**
|
|
7011
|
+
* Constants
|
|
7012
|
+
*/
|
|
7013
|
+
|
|
7014
|
+
const VERSION = '5.3.3';
|
|
7015
|
+
|
|
7016
|
+
/**
|
|
7017
|
+
* Class definition
|
|
7018
|
+
*/
|
|
7019
|
+
|
|
7020
|
+
class BaseComponent extends Config {
|
|
7021
|
+
constructor(element, config) {
|
|
7022
|
+
super();
|
|
7023
|
+
|
|
7024
|
+
element = getElement(element);
|
|
7025
|
+
if (!element) {
|
|
7026
|
+
return
|
|
7027
|
+
}
|
|
7028
|
+
|
|
7029
|
+
this._element = element;
|
|
7030
|
+
this._config = this._getConfig(config);
|
|
7031
|
+
|
|
7032
|
+
Data.set(this._element, this.constructor.DATA_KEY, this);
|
|
7033
|
+
}
|
|
7034
|
+
|
|
7035
|
+
// Public
|
|
7036
|
+
dispose() {
|
|
7037
|
+
Data.remove(this._element, this.constructor.DATA_KEY);
|
|
7038
|
+
EventHandler.off(this._element, this.constructor.EVENT_KEY);
|
|
7039
|
+
|
|
7040
|
+
for (const propertyName of Object.getOwnPropertyNames(this)) {
|
|
7041
|
+
this[propertyName] = null;
|
|
7042
|
+
}
|
|
7043
|
+
}
|
|
7044
|
+
|
|
7045
|
+
_queueCallback(callback, element, isAnimated = true) {
|
|
7046
|
+
executeAfterTransition(callback, element, isAnimated);
|
|
7047
|
+
}
|
|
7048
|
+
|
|
7049
|
+
_getConfig(config) {
|
|
7050
|
+
config = this._mergeConfigObj(config, this._element);
|
|
7051
|
+
config = this._configAfterMerge(config);
|
|
7052
|
+
this._typeCheckConfig(config);
|
|
7053
|
+
return config
|
|
7054
|
+
}
|
|
7055
|
+
|
|
7056
|
+
// Static
|
|
7057
|
+
static getInstance(element) {
|
|
7058
|
+
return Data.get(getElement(element), this.DATA_KEY)
|
|
7059
|
+
}
|
|
7060
|
+
|
|
7061
|
+
static getOrCreateInstance(element, config = {}) {
|
|
7062
|
+
return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)
|
|
7063
|
+
}
|
|
7064
|
+
|
|
7065
|
+
static get VERSION() {
|
|
7066
|
+
return VERSION
|
|
7067
|
+
}
|
|
7068
|
+
|
|
7069
|
+
static get DATA_KEY() {
|
|
7070
|
+
return `bs.${this.NAME}`
|
|
7071
|
+
}
|
|
7072
|
+
|
|
7073
|
+
static get EVENT_KEY() {
|
|
7074
|
+
return `.${this.DATA_KEY}`
|
|
7075
|
+
}
|
|
7076
|
+
|
|
7077
|
+
static eventName(name) {
|
|
7078
|
+
return `${name}${this.EVENT_KEY}`
|
|
7079
|
+
}
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7082
|
+
/**
|
|
7083
|
+
* --------------------------------------------------------------------------
|
|
7084
|
+
* Bootstrap util/sanitizer.js
|
|
7085
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
7086
|
+
* --------------------------------------------------------------------------
|
|
7087
|
+
*/
|
|
7088
|
+
|
|
7089
|
+
// js-docs-start allow-list
|
|
7090
|
+
const ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i;
|
|
7091
|
+
|
|
7092
|
+
const DefaultAllowlist = {
|
|
7093
|
+
// Global attributes allowed on any supplied element below.
|
|
7094
|
+
'*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],
|
|
7095
|
+
a: ['target', 'href', 'title', 'rel'],
|
|
7096
|
+
area: [],
|
|
7097
|
+
b: [],
|
|
7098
|
+
br: [],
|
|
7099
|
+
col: [],
|
|
7100
|
+
code: [],
|
|
7101
|
+
dd: [],
|
|
7102
|
+
div: [],
|
|
7103
|
+
dl: [],
|
|
7104
|
+
dt: [],
|
|
7105
|
+
em: [],
|
|
7106
|
+
hr: [],
|
|
7107
|
+
h1: [],
|
|
7108
|
+
h2: [],
|
|
7109
|
+
h3: [],
|
|
7110
|
+
h4: [],
|
|
7111
|
+
h5: [],
|
|
7112
|
+
h6: [],
|
|
7113
|
+
i: [],
|
|
7114
|
+
img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],
|
|
7115
|
+
li: [],
|
|
7116
|
+
ol: [],
|
|
7117
|
+
p: [],
|
|
7118
|
+
pre: [],
|
|
7119
|
+
s: [],
|
|
7120
|
+
small: [],
|
|
7121
|
+
span: [],
|
|
7122
|
+
sub: [],
|
|
7123
|
+
sup: [],
|
|
7124
|
+
strong: [],
|
|
7125
|
+
u: [],
|
|
7126
|
+
ul: []
|
|
7127
|
+
};
|
|
7128
|
+
// js-docs-end allow-list
|
|
7129
|
+
|
|
7130
|
+
const uriAttributes = new Set([
|
|
7131
|
+
'background',
|
|
7132
|
+
'cite',
|
|
7133
|
+
'href',
|
|
7134
|
+
'itemtype',
|
|
7135
|
+
'longdesc',
|
|
7136
|
+
'poster',
|
|
7137
|
+
'src',
|
|
7138
|
+
'xlink:href'
|
|
7139
|
+
]);
|
|
7140
|
+
|
|
7141
|
+
/**
|
|
7142
|
+
* A pattern that recognizes URLs that are safe wrt. XSS in URL navigation
|
|
7143
|
+
* contexts.
|
|
7144
|
+
*
|
|
7145
|
+
* Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38
|
|
7146
|
+
*/
|
|
7147
|
+
// eslint-disable-next-line unicorn/better-regex
|
|
7148
|
+
const SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i;
|
|
7149
|
+
|
|
7150
|
+
const allowedAttribute = (attribute, allowedAttributeList) => {
|
|
7151
|
+
const attributeName = attribute.nodeName.toLowerCase();
|
|
7152
|
+
|
|
7153
|
+
if (allowedAttributeList.includes(attributeName)) {
|
|
7154
|
+
if (uriAttributes.has(attributeName)) {
|
|
7155
|
+
return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue))
|
|
7156
|
+
}
|
|
7157
|
+
|
|
7158
|
+
return true
|
|
7159
|
+
}
|
|
7160
|
+
|
|
7161
|
+
// Check if a regular expression validates the attribute.
|
|
7162
|
+
return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)
|
|
7163
|
+
.some(regex => regex.test(attributeName))
|
|
7164
|
+
};
|
|
7165
|
+
|
|
7166
|
+
function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {
|
|
7167
|
+
if (!unsafeHtml.length) {
|
|
7168
|
+
return unsafeHtml
|
|
7169
|
+
}
|
|
7170
|
+
|
|
7171
|
+
if (sanitizeFunction && typeof sanitizeFunction === 'function') {
|
|
7172
|
+
return sanitizeFunction(unsafeHtml)
|
|
7173
|
+
}
|
|
7174
|
+
|
|
7175
|
+
const domParser = new window.DOMParser();
|
|
7176
|
+
const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html');
|
|
7177
|
+
const elements = [].concat(...createdDocument.body.querySelectorAll('*'));
|
|
7178
|
+
|
|
7179
|
+
for (const element of elements) {
|
|
7180
|
+
const elementName = element.nodeName.toLowerCase();
|
|
7181
|
+
|
|
7182
|
+
if (!Object.keys(allowList).includes(elementName)) {
|
|
7183
|
+
element.remove();
|
|
7184
|
+
continue
|
|
7185
|
+
}
|
|
7186
|
+
|
|
7187
|
+
const attributeList = [].concat(...element.attributes);
|
|
7188
|
+
const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || []);
|
|
7189
|
+
|
|
7190
|
+
for (const attribute of attributeList) {
|
|
7191
|
+
if (!allowedAttribute(attribute, allowedAttributes)) {
|
|
7192
|
+
element.removeAttribute(attribute.nodeName);
|
|
7193
|
+
}
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
|
|
7197
|
+
return createdDocument.body.innerHTML
|
|
7198
|
+
}
|
|
7199
|
+
|
|
7200
|
+
/**
|
|
7201
|
+
* --------------------------------------------------------------------------
|
|
7202
|
+
* Bootstrap dom/selector-engine.js
|
|
7203
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
7204
|
+
* --------------------------------------------------------------------------
|
|
7205
|
+
*/
|
|
7206
|
+
|
|
7207
|
+
const getSelector = element => {
|
|
7208
|
+
let selector = element.getAttribute('data-bs-target');
|
|
7209
|
+
|
|
7210
|
+
if (!selector || selector === '#') {
|
|
7211
|
+
let hrefAttribute = element.getAttribute('href');
|
|
7212
|
+
|
|
7213
|
+
// The only valid content that could double as a selector are IDs or classes,
|
|
7214
|
+
// so everything starting with `#` or `.`. If a "real" URL is used as the selector,
|
|
7215
|
+
// `document.querySelector` will rightfully complain it is invalid.
|
|
7216
|
+
// See https://github.com/twbs/bootstrap/issues/32273
|
|
7217
|
+
if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {
|
|
7218
|
+
return null
|
|
7219
|
+
}
|
|
7220
|
+
|
|
7221
|
+
// Just in case some CMS puts out a full URL with the anchor appended
|
|
7222
|
+
if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {
|
|
7223
|
+
hrefAttribute = `#${hrefAttribute.split('#')[1]}`;
|
|
7224
|
+
}
|
|
7225
|
+
|
|
7226
|
+
selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null;
|
|
7227
|
+
}
|
|
7228
|
+
|
|
7229
|
+
return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null
|
|
7230
|
+
};
|
|
7231
|
+
|
|
7232
|
+
const SelectorEngine = {
|
|
7233
|
+
find(selector, element = document.documentElement) {
|
|
7234
|
+
return [].concat(...Element.prototype.querySelectorAll.call(element, selector))
|
|
7235
|
+
},
|
|
7236
|
+
|
|
7237
|
+
findOne(selector, element = document.documentElement) {
|
|
7238
|
+
return Element.prototype.querySelector.call(element, selector)
|
|
7239
|
+
},
|
|
7240
|
+
|
|
7241
|
+
children(element, selector) {
|
|
7242
|
+
return [].concat(...element.children).filter(child => child.matches(selector))
|
|
7243
|
+
},
|
|
7244
|
+
|
|
7245
|
+
parents(element, selector) {
|
|
7246
|
+
const parents = [];
|
|
7247
|
+
let ancestor = element.parentNode.closest(selector);
|
|
7248
|
+
|
|
7249
|
+
while (ancestor) {
|
|
7250
|
+
parents.push(ancestor);
|
|
7251
|
+
ancestor = ancestor.parentNode.closest(selector);
|
|
7252
|
+
}
|
|
7253
|
+
|
|
7254
|
+
return parents
|
|
7255
|
+
},
|
|
7256
|
+
|
|
7257
|
+
prev(element, selector) {
|
|
7258
|
+
let previous = element.previousElementSibling;
|
|
7259
|
+
|
|
7260
|
+
while (previous) {
|
|
7261
|
+
if (previous.matches(selector)) {
|
|
7262
|
+
return [previous]
|
|
7263
|
+
}
|
|
7264
|
+
|
|
7265
|
+
previous = previous.previousElementSibling;
|
|
7266
|
+
}
|
|
7267
|
+
|
|
7268
|
+
return []
|
|
7269
|
+
},
|
|
7270
|
+
// TODO: this is now unused; remove later along with prev()
|
|
7271
|
+
next(element, selector) {
|
|
7272
|
+
let next = element.nextElementSibling;
|
|
7273
|
+
|
|
7274
|
+
while (next) {
|
|
7275
|
+
if (next.matches(selector)) {
|
|
7276
|
+
return [next]
|
|
7277
|
+
}
|
|
7278
|
+
|
|
7279
|
+
next = next.nextElementSibling;
|
|
7280
|
+
}
|
|
7281
|
+
|
|
7282
|
+
return []
|
|
7283
|
+
},
|
|
7284
|
+
|
|
7285
|
+
focusableChildren(element) {
|
|
7286
|
+
const focusables = [
|
|
7287
|
+
'a',
|
|
7288
|
+
'button',
|
|
7289
|
+
'input',
|
|
7290
|
+
'textarea',
|
|
7291
|
+
'select',
|
|
7292
|
+
'details',
|
|
7293
|
+
'[tabindex]',
|
|
7294
|
+
'[contenteditable="true"]'
|
|
7295
|
+
].map(selector => `${selector}:not([tabindex^="-"])`).join(',');
|
|
7296
|
+
|
|
7297
|
+
return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))
|
|
7298
|
+
},
|
|
7299
|
+
|
|
7300
|
+
getSelectorFromElement(element) {
|
|
7301
|
+
const selector = getSelector(element);
|
|
7302
|
+
|
|
7303
|
+
if (selector) {
|
|
7304
|
+
return SelectorEngine.findOne(selector) ? selector : null
|
|
7305
|
+
}
|
|
7306
|
+
|
|
7307
|
+
return null
|
|
7308
|
+
},
|
|
7309
|
+
|
|
7310
|
+
getElementFromSelector(element) {
|
|
7311
|
+
const selector = getSelector(element);
|
|
7312
|
+
|
|
7313
|
+
return selector ? SelectorEngine.findOne(selector) : null
|
|
7314
|
+
},
|
|
7315
|
+
|
|
7316
|
+
getMultipleElementsFromSelector(element) {
|
|
7317
|
+
const selector = getSelector(element);
|
|
7318
|
+
|
|
7319
|
+
return selector ? SelectorEngine.find(selector) : []
|
|
7320
|
+
}
|
|
7321
|
+
};
|
|
7322
|
+
|
|
7323
|
+
/**
|
|
7324
|
+
* --------------------------------------------------------------------------
|
|
7325
|
+
* Bootstrap util/template-factory.js
|
|
7326
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
7327
|
+
* --------------------------------------------------------------------------
|
|
7328
|
+
*/
|
|
7329
|
+
|
|
7330
|
+
/**
|
|
7331
|
+
* Constants
|
|
7332
|
+
*/
|
|
7333
|
+
|
|
7334
|
+
const NAME$1 = 'TemplateFactory';
|
|
7335
|
+
|
|
7336
|
+
const Default$1 = {
|
|
7337
|
+
allowList: DefaultAllowlist,
|
|
7338
|
+
content: {}, // { selector : text , selector2 : text2 , }
|
|
7339
|
+
extraClass: '',
|
|
7340
|
+
html: false,
|
|
7341
|
+
sanitize: true,
|
|
7342
|
+
sanitizeFn: null,
|
|
7343
|
+
template: '<div></div>'
|
|
7344
|
+
};
|
|
7345
|
+
|
|
7346
|
+
const DefaultType$1 = {
|
|
7347
|
+
allowList: 'object',
|
|
7348
|
+
content: 'object',
|
|
7349
|
+
extraClass: '(string|function)',
|
|
7350
|
+
html: 'boolean',
|
|
7351
|
+
sanitize: 'boolean',
|
|
7352
|
+
sanitizeFn: '(null|function)',
|
|
7353
|
+
template: 'string'
|
|
7354
|
+
};
|
|
7355
|
+
|
|
7356
|
+
const DefaultContentType = {
|
|
7357
|
+
entry: '(string|element|function|null)',
|
|
7358
|
+
selector: '(string|element)'
|
|
7359
|
+
};
|
|
7360
|
+
|
|
7361
|
+
/**
|
|
7362
|
+
* Class definition
|
|
7363
|
+
*/
|
|
7364
|
+
|
|
7365
|
+
class TemplateFactory extends Config {
|
|
7366
|
+
constructor(config) {
|
|
7367
|
+
super();
|
|
7368
|
+
this._config = this._getConfig(config);
|
|
7369
|
+
}
|
|
7370
|
+
|
|
7371
|
+
// Getters
|
|
7372
|
+
static get Default() {
|
|
7373
|
+
return Default$1
|
|
7374
|
+
}
|
|
7375
|
+
|
|
7376
|
+
static get DefaultType() {
|
|
7377
|
+
return DefaultType$1
|
|
7378
|
+
}
|
|
7379
|
+
|
|
7380
|
+
static get NAME() {
|
|
7381
|
+
return NAME$1
|
|
7382
|
+
}
|
|
7383
|
+
|
|
7384
|
+
// Public
|
|
7385
|
+
getContent() {
|
|
7386
|
+
return Object.values(this._config.content)
|
|
7387
|
+
.map(config => this._resolvePossibleFunction(config))
|
|
7388
|
+
.filter(Boolean)
|
|
7389
|
+
}
|
|
7390
|
+
|
|
7391
|
+
hasContent() {
|
|
7392
|
+
return this.getContent().length > 0
|
|
7393
|
+
}
|
|
7394
|
+
|
|
7395
|
+
changeContent(content) {
|
|
7396
|
+
this._checkContent(content);
|
|
7397
|
+
this._config.content = { ...this._config.content, ...content };
|
|
7398
|
+
return this
|
|
7399
|
+
}
|
|
7400
|
+
|
|
7401
|
+
toHtml() {
|
|
7402
|
+
const templateWrapper = document.createElement('div');
|
|
7403
|
+
templateWrapper.innerHTML = this._maybeSanitize(this._config.template);
|
|
7404
|
+
|
|
7405
|
+
for (const [selector, text] of Object.entries(this._config.content)) {
|
|
7406
|
+
this._setContent(templateWrapper, text, selector);
|
|
7407
|
+
}
|
|
7408
|
+
|
|
7409
|
+
const template = templateWrapper.children[0];
|
|
7410
|
+
const extraClass = this._resolvePossibleFunction(this._config.extraClass);
|
|
7411
|
+
|
|
7412
|
+
if (extraClass) {
|
|
7413
|
+
template.classList.add(...extraClass.split(' '));
|
|
7414
|
+
}
|
|
7415
|
+
|
|
7416
|
+
return template
|
|
7417
|
+
}
|
|
7418
|
+
|
|
7419
|
+
// Private
|
|
7420
|
+
_typeCheckConfig(config) {
|
|
7421
|
+
super._typeCheckConfig(config);
|
|
7422
|
+
this._checkContent(config.content);
|
|
7423
|
+
}
|
|
7424
|
+
|
|
7425
|
+
_checkContent(arg) {
|
|
7426
|
+
for (const [selector, content] of Object.entries(arg)) {
|
|
7427
|
+
super._typeCheckConfig({ selector, entry: content }, DefaultContentType);
|
|
7428
|
+
}
|
|
7429
|
+
}
|
|
7430
|
+
|
|
7431
|
+
_setContent(template, content, selector) {
|
|
7432
|
+
const templateElement = SelectorEngine.findOne(selector, template);
|
|
7433
|
+
|
|
7434
|
+
if (!templateElement) {
|
|
7435
|
+
return
|
|
7436
|
+
}
|
|
7437
|
+
|
|
7438
|
+
content = this._resolvePossibleFunction(content);
|
|
7439
|
+
|
|
7440
|
+
if (!content) {
|
|
7441
|
+
templateElement.remove();
|
|
7442
|
+
return
|
|
7443
|
+
}
|
|
7444
|
+
|
|
7445
|
+
if (isElement(content)) {
|
|
7446
|
+
this._putElementInTemplate(getElement(content), templateElement);
|
|
7447
|
+
return
|
|
7448
|
+
}
|
|
7449
|
+
|
|
7450
|
+
if (this._config.html) {
|
|
7451
|
+
templateElement.innerHTML = this._maybeSanitize(content);
|
|
7452
|
+
return
|
|
7453
|
+
}
|
|
7454
|
+
|
|
7455
|
+
templateElement.textContent = content;
|
|
7456
|
+
}
|
|
7457
|
+
|
|
7458
|
+
_maybeSanitize(arg) {
|
|
7459
|
+
return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg
|
|
7460
|
+
}
|
|
7461
|
+
|
|
7462
|
+
_resolvePossibleFunction(arg) {
|
|
7463
|
+
return execute(arg, [this])
|
|
7464
|
+
}
|
|
7465
|
+
|
|
7466
|
+
_putElementInTemplate(element, templateElement) {
|
|
7467
|
+
if (this._config.html) {
|
|
7468
|
+
templateElement.innerHTML = '';
|
|
7469
|
+
templateElement.append(element);
|
|
7470
|
+
return
|
|
7471
|
+
}
|
|
7472
|
+
|
|
7473
|
+
templateElement.textContent = element.textContent;
|
|
7474
|
+
}
|
|
7475
|
+
}
|
|
7476
|
+
|
|
7477
|
+
/**
|
|
7478
|
+
* --------------------------------------------------------------------------
|
|
7479
|
+
* Bootstrap tooltip.js
|
|
7480
|
+
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
|
|
7481
|
+
* --------------------------------------------------------------------------
|
|
7482
|
+
*/
|
|
7483
|
+
|
|
7484
|
+
/**
|
|
7485
|
+
* Constants
|
|
7486
|
+
*/
|
|
7487
|
+
|
|
7488
|
+
const NAME = 'tooltip';
|
|
7489
|
+
const DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']);
|
|
7490
|
+
|
|
7491
|
+
const CLASS_NAME_FADE = 'fade';
|
|
7492
|
+
const CLASS_NAME_MODAL = 'modal';
|
|
7493
|
+
const CLASS_NAME_SHOW = 'show';
|
|
7494
|
+
|
|
7495
|
+
const SELECTOR_TOOLTIP_INNER = '.tooltip-inner';
|
|
7496
|
+
const SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`;
|
|
7497
|
+
|
|
7498
|
+
const EVENT_MODAL_HIDE = 'hide.bs.modal';
|
|
7499
|
+
|
|
7500
|
+
const TRIGGER_HOVER = 'hover';
|
|
7501
|
+
const TRIGGER_FOCUS = 'focus';
|
|
7502
|
+
const TRIGGER_CLICK = 'click';
|
|
7503
|
+
const TRIGGER_MANUAL = 'manual';
|
|
7504
|
+
|
|
7505
|
+
const EVENT_HIDE = 'hide';
|
|
7506
|
+
const EVENT_HIDDEN = 'hidden';
|
|
7507
|
+
const EVENT_SHOW = 'show';
|
|
7508
|
+
const EVENT_SHOWN = 'shown';
|
|
7509
|
+
const EVENT_INSERTED = 'inserted';
|
|
7510
|
+
const EVENT_CLICK = 'click';
|
|
7511
|
+
const EVENT_FOCUSIN = 'focusin';
|
|
7512
|
+
const EVENT_FOCUSOUT = 'focusout';
|
|
7513
|
+
const EVENT_MOUSEENTER = 'mouseenter';
|
|
7514
|
+
const EVENT_MOUSELEAVE = 'mouseleave';
|
|
7515
|
+
|
|
7516
|
+
const AttachmentMap = {
|
|
7517
|
+
AUTO: 'auto',
|
|
7518
|
+
TOP: 'top',
|
|
7519
|
+
RIGHT: isRTL() ? 'left' : 'right',
|
|
7520
|
+
BOTTOM: 'bottom',
|
|
7521
|
+
LEFT: isRTL() ? 'right' : 'left'
|
|
7522
|
+
};
|
|
7523
|
+
|
|
7524
|
+
const Default = {
|
|
7525
|
+
allowList: DefaultAllowlist,
|
|
7526
|
+
animation: true,
|
|
7527
|
+
boundary: 'clippingParents',
|
|
7528
|
+
container: false,
|
|
7529
|
+
customClass: '',
|
|
7530
|
+
delay: 0,
|
|
7531
|
+
fallbackPlacements: ['top', 'right', 'bottom', 'left'],
|
|
7532
|
+
html: false,
|
|
7533
|
+
offset: [0, 6],
|
|
7534
|
+
placement: 'top',
|
|
7535
|
+
popperConfig: null,
|
|
7536
|
+
sanitize: true,
|
|
7537
|
+
sanitizeFn: null,
|
|
7538
|
+
selector: false,
|
|
7539
|
+
template: '<div class="tooltip" role="tooltip">' +
|
|
7540
|
+
'<div class="tooltip-arrow"></div>' +
|
|
7541
|
+
'<div class="tooltip-inner"></div>' +
|
|
7542
|
+
'</div>',
|
|
7543
|
+
title: '',
|
|
7544
|
+
trigger: 'hover focus'
|
|
7545
|
+
};
|
|
7546
|
+
|
|
7547
|
+
const DefaultType = {
|
|
7548
|
+
allowList: 'object',
|
|
7549
|
+
animation: 'boolean',
|
|
7550
|
+
boundary: '(string|element)',
|
|
7551
|
+
container: '(string|element|boolean)',
|
|
7552
|
+
customClass: '(string|function)',
|
|
7553
|
+
delay: '(number|object)',
|
|
7554
|
+
fallbackPlacements: 'array',
|
|
7555
|
+
html: 'boolean',
|
|
7556
|
+
offset: '(array|string|function)',
|
|
7557
|
+
placement: '(string|function)',
|
|
7558
|
+
popperConfig: '(null|object|function)',
|
|
7559
|
+
sanitize: 'boolean',
|
|
7560
|
+
sanitizeFn: '(null|function)',
|
|
7561
|
+
selector: '(string|boolean)',
|
|
7562
|
+
template: 'string',
|
|
7563
|
+
title: '(string|element|function)',
|
|
7564
|
+
trigger: 'string'
|
|
7565
|
+
};
|
|
7566
|
+
|
|
7567
|
+
/**
|
|
7568
|
+
* Class definition
|
|
7569
|
+
*/
|
|
7570
|
+
|
|
7571
|
+
class Tooltip extends BaseComponent {
|
|
7572
|
+
constructor(element, config) {
|
|
7573
|
+
if (typeof Popper === 'undefined') {
|
|
7574
|
+
throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)')
|
|
7575
|
+
}
|
|
7576
|
+
|
|
7577
|
+
super(element, config);
|
|
7578
|
+
|
|
7579
|
+
// Private
|
|
7580
|
+
this._isEnabled = true;
|
|
7581
|
+
this._timeout = 0;
|
|
7582
|
+
this._isHovered = null;
|
|
7583
|
+
this._activeTrigger = {};
|
|
7584
|
+
this._popper = null;
|
|
7585
|
+
this._templateFactory = null;
|
|
7586
|
+
this._newContent = null;
|
|
7587
|
+
|
|
7588
|
+
// Protected
|
|
7589
|
+
this.tip = null;
|
|
7590
|
+
|
|
7591
|
+
this._setListeners();
|
|
7592
|
+
|
|
7593
|
+
if (!this._config.selector) {
|
|
7594
|
+
this._fixTitle();
|
|
7595
|
+
}
|
|
7596
|
+
}
|
|
7597
|
+
|
|
7598
|
+
// Getters
|
|
7599
|
+
static get Default() {
|
|
7600
|
+
return Default
|
|
7601
|
+
}
|
|
7602
|
+
|
|
7603
|
+
static get DefaultType() {
|
|
7604
|
+
return DefaultType
|
|
7605
|
+
}
|
|
7606
|
+
|
|
7607
|
+
static get NAME() {
|
|
7608
|
+
return NAME
|
|
7609
|
+
}
|
|
7610
|
+
|
|
7611
|
+
// Public
|
|
7612
|
+
enable() {
|
|
7613
|
+
this._isEnabled = true;
|
|
7614
|
+
}
|
|
7615
|
+
|
|
7616
|
+
disable() {
|
|
7617
|
+
this._isEnabled = false;
|
|
7618
|
+
}
|
|
7619
|
+
|
|
7620
|
+
toggleEnabled() {
|
|
7621
|
+
this._isEnabled = !this._isEnabled;
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7624
|
+
toggle() {
|
|
7625
|
+
if (!this._isEnabled) {
|
|
7626
|
+
return
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7629
|
+
this._activeTrigger.click = !this._activeTrigger.click;
|
|
7630
|
+
if (this._isShown()) {
|
|
7631
|
+
this._leave();
|
|
7632
|
+
return
|
|
7633
|
+
}
|
|
7634
|
+
|
|
7635
|
+
this._enter();
|
|
7636
|
+
}
|
|
7637
|
+
|
|
7638
|
+
dispose() {
|
|
7639
|
+
clearTimeout(this._timeout);
|
|
7640
|
+
|
|
7641
|
+
EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
7642
|
+
|
|
7643
|
+
if (this._element.getAttribute('data-bs-original-title')) {
|
|
7644
|
+
this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'));
|
|
7645
|
+
}
|
|
7646
|
+
|
|
7647
|
+
this._disposePopper();
|
|
7648
|
+
super.dispose();
|
|
7649
|
+
}
|
|
7650
|
+
|
|
7651
|
+
show() {
|
|
7652
|
+
if (this._element.style.display === 'none') {
|
|
7653
|
+
throw new Error('Please use show on visible elements')
|
|
7654
|
+
}
|
|
7655
|
+
|
|
7656
|
+
if (!(this._isWithContent() && this._isEnabled)) {
|
|
7657
|
+
return
|
|
7658
|
+
}
|
|
7659
|
+
|
|
7660
|
+
const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW));
|
|
7661
|
+
const shadowRoot = findShadowRoot(this._element);
|
|
7662
|
+
const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element);
|
|
7663
|
+
|
|
7664
|
+
if (showEvent.defaultPrevented || !isInTheDom) {
|
|
7665
|
+
return
|
|
7666
|
+
}
|
|
7667
|
+
|
|
7668
|
+
// TODO: v6 remove this or make it optional
|
|
7669
|
+
this._disposePopper();
|
|
7670
|
+
|
|
7671
|
+
const tip = this._getTipElement();
|
|
7672
|
+
|
|
7673
|
+
this._element.setAttribute('aria-describedby', tip.getAttribute('id'));
|
|
7674
|
+
|
|
7675
|
+
const { container } = this._config;
|
|
7676
|
+
|
|
7677
|
+
if (!this._element.ownerDocument.documentElement.contains(this.tip)) {
|
|
7678
|
+
container.append(tip);
|
|
7679
|
+
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED));
|
|
7680
|
+
}
|
|
7681
|
+
|
|
7682
|
+
this._popper = this._createPopper(tip);
|
|
7683
|
+
|
|
7684
|
+
tip.classList.add(CLASS_NAME_SHOW);
|
|
7685
|
+
|
|
7686
|
+
// If this is a touch-enabled device we add extra
|
|
7687
|
+
// empty mouseover listeners to the body's immediate children;
|
|
7688
|
+
// only needed because of broken event delegation on iOS
|
|
7689
|
+
// https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html
|
|
7690
|
+
if ('ontouchstart' in document.documentElement) {
|
|
7691
|
+
for (const element of [].concat(...document.body.children)) {
|
|
7692
|
+
EventHandler.on(element, 'mouseover', noop);
|
|
7693
|
+
}
|
|
7694
|
+
}
|
|
7695
|
+
|
|
7696
|
+
const complete = () => {
|
|
7697
|
+
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN));
|
|
7698
|
+
|
|
7699
|
+
if (this._isHovered === false) {
|
|
7700
|
+
this._leave();
|
|
7701
|
+
}
|
|
7702
|
+
|
|
7703
|
+
this._isHovered = false;
|
|
7704
|
+
};
|
|
7705
|
+
|
|
7706
|
+
this._queueCallback(complete, this.tip, this._isAnimated());
|
|
7707
|
+
}
|
|
7708
|
+
|
|
7709
|
+
hide() {
|
|
7710
|
+
if (!this._isShown()) {
|
|
7711
|
+
return
|
|
7712
|
+
}
|
|
7713
|
+
|
|
7714
|
+
const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE));
|
|
7715
|
+
if (hideEvent.defaultPrevented) {
|
|
7716
|
+
return
|
|
7717
|
+
}
|
|
7718
|
+
|
|
7719
|
+
const tip = this._getTipElement();
|
|
7720
|
+
tip.classList.remove(CLASS_NAME_SHOW);
|
|
7721
|
+
|
|
7722
|
+
// If this is a touch-enabled device we remove the extra
|
|
7723
|
+
// empty mouseover listeners we added for iOS support
|
|
7724
|
+
if ('ontouchstart' in document.documentElement) {
|
|
7725
|
+
for (const element of [].concat(...document.body.children)) {
|
|
7726
|
+
EventHandler.off(element, 'mouseover', noop);
|
|
7727
|
+
}
|
|
7728
|
+
}
|
|
7729
|
+
|
|
7730
|
+
this._activeTrigger[TRIGGER_CLICK] = false;
|
|
7731
|
+
this._activeTrigger[TRIGGER_FOCUS] = false;
|
|
7732
|
+
this._activeTrigger[TRIGGER_HOVER] = false;
|
|
7733
|
+
this._isHovered = null; // it is a trick to support manual triggering
|
|
7734
|
+
|
|
7735
|
+
const complete = () => {
|
|
7736
|
+
if (this._isWithActiveTrigger()) {
|
|
7737
|
+
return
|
|
7738
|
+
}
|
|
7739
|
+
|
|
7740
|
+
if (!this._isHovered) {
|
|
7741
|
+
this._disposePopper();
|
|
7742
|
+
}
|
|
7743
|
+
|
|
7744
|
+
this._element.removeAttribute('aria-describedby');
|
|
7745
|
+
EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN));
|
|
7746
|
+
};
|
|
7747
|
+
|
|
7748
|
+
this._queueCallback(complete, this.tip, this._isAnimated());
|
|
7749
|
+
}
|
|
7750
|
+
|
|
7751
|
+
update() {
|
|
7752
|
+
if (this._popper) {
|
|
7753
|
+
this._popper.update();
|
|
7754
|
+
}
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
// Protected
|
|
7758
|
+
_isWithContent() {
|
|
7759
|
+
return Boolean(this._getTitle())
|
|
7760
|
+
}
|
|
7761
|
+
|
|
7762
|
+
_getTipElement() {
|
|
7763
|
+
if (!this.tip) {
|
|
7764
|
+
this.tip = this._createTipElement(this._newContent || this._getContentForTemplate());
|
|
7765
|
+
}
|
|
7766
|
+
|
|
7767
|
+
return this.tip
|
|
7768
|
+
}
|
|
7769
|
+
|
|
7770
|
+
_createTipElement(content) {
|
|
7771
|
+
const tip = this._getTemplateFactory(content).toHtml();
|
|
7772
|
+
|
|
7773
|
+
// TODO: remove this check in v6
|
|
7774
|
+
if (!tip) {
|
|
7775
|
+
return null
|
|
7776
|
+
}
|
|
7777
|
+
|
|
7778
|
+
tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW);
|
|
7779
|
+
// TODO: v6 the following can be achieved with CSS only
|
|
7780
|
+
tip.classList.add(`bs-${this.constructor.NAME}-auto`);
|
|
7781
|
+
|
|
7782
|
+
const tipId = getUID(this.constructor.NAME).toString();
|
|
7783
|
+
|
|
7784
|
+
tip.setAttribute('id', tipId);
|
|
7785
|
+
|
|
7786
|
+
if (this._isAnimated()) {
|
|
7787
|
+
tip.classList.add(CLASS_NAME_FADE);
|
|
7788
|
+
}
|
|
7789
|
+
|
|
7790
|
+
return tip
|
|
7791
|
+
}
|
|
7792
|
+
|
|
7793
|
+
setContent(content) {
|
|
7794
|
+
this._newContent = content;
|
|
7795
|
+
if (this._isShown()) {
|
|
7796
|
+
this._disposePopper();
|
|
7797
|
+
this.show();
|
|
7798
|
+
}
|
|
7799
|
+
}
|
|
7800
|
+
|
|
7801
|
+
_getTemplateFactory(content) {
|
|
7802
|
+
if (this._templateFactory) {
|
|
7803
|
+
this._templateFactory.changeContent(content);
|
|
7804
|
+
} else {
|
|
7805
|
+
this._templateFactory = new TemplateFactory({
|
|
7806
|
+
...this._config,
|
|
7807
|
+
// the `content` var has to be after `this._config`
|
|
7808
|
+
// to override config.content in case of popover
|
|
7809
|
+
content,
|
|
7810
|
+
extraClass: this._resolvePossibleFunction(this._config.customClass)
|
|
7811
|
+
});
|
|
7812
|
+
}
|
|
7813
|
+
|
|
7814
|
+
return this._templateFactory
|
|
7815
|
+
}
|
|
7816
|
+
|
|
7817
|
+
_getContentForTemplate() {
|
|
7818
|
+
return {
|
|
7819
|
+
[SELECTOR_TOOLTIP_INNER]: this._getTitle()
|
|
7820
|
+
}
|
|
7821
|
+
}
|
|
7822
|
+
|
|
7823
|
+
_getTitle() {
|
|
7824
|
+
return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')
|
|
7825
|
+
}
|
|
7826
|
+
|
|
7827
|
+
// Private
|
|
7828
|
+
_initializeOnDelegatedTarget(event) {
|
|
7829
|
+
return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())
|
|
7830
|
+
}
|
|
7831
|
+
|
|
7832
|
+
_isAnimated() {
|
|
7833
|
+
return this._config.animation || (this.tip && this.tip.classList.contains(CLASS_NAME_FADE))
|
|
7834
|
+
}
|
|
7835
|
+
|
|
7836
|
+
_isShown() {
|
|
7837
|
+
return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW)
|
|
7838
|
+
}
|
|
7839
|
+
|
|
7840
|
+
_createPopper(tip) {
|
|
7841
|
+
const placement = execute(this._config.placement, [this, tip, this._element]);
|
|
7842
|
+
const attachment = AttachmentMap[placement.toUpperCase()];
|
|
7843
|
+
return createPopper(this._element, tip, this._getPopperConfig(attachment))
|
|
7844
|
+
}
|
|
7845
|
+
|
|
7846
|
+
_getOffset() {
|
|
7847
|
+
const { offset } = this._config;
|
|
7848
|
+
|
|
7849
|
+
if (typeof offset === 'string') {
|
|
7850
|
+
return offset.split(',').map(value => Number.parseInt(value, 10))
|
|
7851
|
+
}
|
|
7852
|
+
|
|
7853
|
+
if (typeof offset === 'function') {
|
|
7854
|
+
return popperData => offset(popperData, this._element)
|
|
7855
|
+
}
|
|
7856
|
+
|
|
7857
|
+
return offset
|
|
7858
|
+
}
|
|
7859
|
+
|
|
7860
|
+
_resolvePossibleFunction(arg) {
|
|
7861
|
+
return execute(arg, [this._element])
|
|
7862
|
+
}
|
|
7863
|
+
|
|
7864
|
+
_getPopperConfig(attachment) {
|
|
7865
|
+
const defaultBsPopperConfig = {
|
|
7866
|
+
placement: attachment,
|
|
7867
|
+
modifiers: [
|
|
7868
|
+
{
|
|
7869
|
+
name: 'flip',
|
|
7870
|
+
options: {
|
|
7871
|
+
fallbackPlacements: this._config.fallbackPlacements
|
|
7872
|
+
}
|
|
7873
|
+
},
|
|
7874
|
+
{
|
|
7875
|
+
name: 'offset',
|
|
7876
|
+
options: {
|
|
7877
|
+
offset: this._getOffset()
|
|
7878
|
+
}
|
|
7879
|
+
},
|
|
7880
|
+
{
|
|
7881
|
+
name: 'preventOverflow',
|
|
7882
|
+
options: {
|
|
7883
|
+
boundary: this._config.boundary
|
|
7884
|
+
}
|
|
7885
|
+
},
|
|
7886
|
+
{
|
|
7887
|
+
name: 'arrow',
|
|
7888
|
+
options: {
|
|
7889
|
+
element: `.${this.constructor.NAME}-arrow`
|
|
7890
|
+
}
|
|
7891
|
+
},
|
|
7892
|
+
{
|
|
7893
|
+
name: 'preSetPlacement',
|
|
7894
|
+
enabled: true,
|
|
7895
|
+
phase: 'beforeMain',
|
|
7896
|
+
fn: data => {
|
|
7897
|
+
// Pre-set Popper's placement attribute in order to read the arrow sizes properly.
|
|
7898
|
+
// Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement
|
|
7899
|
+
this._getTipElement().setAttribute('data-popper-placement', data.state.placement);
|
|
7900
|
+
}
|
|
7901
|
+
}
|
|
7902
|
+
]
|
|
7903
|
+
};
|
|
7904
|
+
|
|
7905
|
+
return {
|
|
7906
|
+
...defaultBsPopperConfig,
|
|
7907
|
+
...execute(this._config.popperConfig, [defaultBsPopperConfig])
|
|
7908
|
+
}
|
|
7909
|
+
}
|
|
7910
|
+
|
|
7911
|
+
_setListeners() {
|
|
7912
|
+
const triggers = this._config.trigger.split(' ');
|
|
7913
|
+
|
|
7914
|
+
for (const trigger of triggers) {
|
|
7915
|
+
if (trigger === 'click') {
|
|
7916
|
+
EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {
|
|
7917
|
+
const context = this._initializeOnDelegatedTarget(event);
|
|
7918
|
+
context.toggle();
|
|
7919
|
+
});
|
|
7920
|
+
} else if (trigger !== TRIGGER_MANUAL) {
|
|
7921
|
+
const eventIn = trigger === TRIGGER_HOVER ?
|
|
7922
|
+
this.constructor.eventName(EVENT_MOUSEENTER) :
|
|
7923
|
+
this.constructor.eventName(EVENT_FOCUSIN);
|
|
7924
|
+
const eventOut = trigger === TRIGGER_HOVER ?
|
|
7925
|
+
this.constructor.eventName(EVENT_MOUSELEAVE) :
|
|
7926
|
+
this.constructor.eventName(EVENT_FOCUSOUT);
|
|
7927
|
+
|
|
7928
|
+
EventHandler.on(this._element, eventIn, this._config.selector, event => {
|
|
7929
|
+
const context = this._initializeOnDelegatedTarget(event);
|
|
7930
|
+
context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true;
|
|
7931
|
+
context._enter();
|
|
7932
|
+
});
|
|
7933
|
+
EventHandler.on(this._element, eventOut, this._config.selector, event => {
|
|
7934
|
+
const context = this._initializeOnDelegatedTarget(event);
|
|
7935
|
+
context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] =
|
|
7936
|
+
context._element.contains(event.relatedTarget);
|
|
7937
|
+
|
|
7938
|
+
context._leave();
|
|
7939
|
+
});
|
|
7940
|
+
}
|
|
7941
|
+
}
|
|
7942
|
+
|
|
7943
|
+
this._hideModalHandler = () => {
|
|
7944
|
+
if (this._element) {
|
|
7945
|
+
this.hide();
|
|
7946
|
+
}
|
|
7947
|
+
};
|
|
7948
|
+
|
|
7949
|
+
EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler);
|
|
7950
|
+
}
|
|
7951
|
+
|
|
7952
|
+
_fixTitle() {
|
|
7953
|
+
const title = this._element.getAttribute('title');
|
|
7954
|
+
|
|
7955
|
+
if (!title) {
|
|
7956
|
+
return
|
|
7957
|
+
}
|
|
7958
|
+
|
|
7959
|
+
if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {
|
|
7960
|
+
this._element.setAttribute('aria-label', title);
|
|
7961
|
+
}
|
|
7962
|
+
|
|
7963
|
+
this._element.setAttribute('data-bs-original-title', title); // DO NOT USE IT. Is only for backwards compatibility
|
|
7964
|
+
this._element.removeAttribute('title');
|
|
7965
|
+
}
|
|
7966
|
+
|
|
7967
|
+
_enter() {
|
|
7968
|
+
if (this._isShown() || this._isHovered) {
|
|
7969
|
+
this._isHovered = true;
|
|
7970
|
+
return
|
|
7971
|
+
}
|
|
7972
|
+
|
|
7973
|
+
this._isHovered = true;
|
|
7974
|
+
|
|
7975
|
+
this._setTimeout(() => {
|
|
7976
|
+
if (this._isHovered) {
|
|
7977
|
+
this.show();
|
|
7978
|
+
}
|
|
7979
|
+
}, this._config.delay.show);
|
|
7980
|
+
}
|
|
7981
|
+
|
|
7982
|
+
_leave() {
|
|
7983
|
+
if (this._isWithActiveTrigger()) {
|
|
7984
|
+
return
|
|
7985
|
+
}
|
|
7986
|
+
|
|
7987
|
+
this._isHovered = false;
|
|
7988
|
+
|
|
7989
|
+
this._setTimeout(() => {
|
|
7990
|
+
if (!this._isHovered) {
|
|
7991
|
+
this.hide();
|
|
7992
|
+
}
|
|
7993
|
+
}, this._config.delay.hide);
|
|
7994
|
+
}
|
|
7995
|
+
|
|
7996
|
+
_setTimeout(handler, timeout) {
|
|
7997
|
+
clearTimeout(this._timeout);
|
|
7998
|
+
this._timeout = setTimeout(handler, timeout);
|
|
7999
|
+
}
|
|
8000
|
+
|
|
8001
|
+
_isWithActiveTrigger() {
|
|
8002
|
+
return Object.values(this._activeTrigger).includes(true)
|
|
8003
|
+
}
|
|
8004
|
+
|
|
8005
|
+
_getConfig(config) {
|
|
8006
|
+
const dataAttributes = Manipulator.getDataAttributes(this._element);
|
|
8007
|
+
|
|
8008
|
+
for (const dataAttribute of Object.keys(dataAttributes)) {
|
|
8009
|
+
if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {
|
|
8010
|
+
delete dataAttributes[dataAttribute];
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
|
|
8014
|
+
config = {
|
|
8015
|
+
...dataAttributes,
|
|
8016
|
+
...(typeof config === 'object' && config ? config : {})
|
|
8017
|
+
};
|
|
8018
|
+
config = this._mergeConfigObj(config);
|
|
8019
|
+
config = this._configAfterMerge(config);
|
|
8020
|
+
this._typeCheckConfig(config);
|
|
8021
|
+
return config
|
|
8022
|
+
}
|
|
8023
|
+
|
|
8024
|
+
_configAfterMerge(config) {
|
|
8025
|
+
config.container = config.container === false ? document.body : getElement(config.container);
|
|
8026
|
+
|
|
8027
|
+
if (typeof config.delay === 'number') {
|
|
8028
|
+
config.delay = {
|
|
8029
|
+
show: config.delay,
|
|
8030
|
+
hide: config.delay
|
|
8031
|
+
};
|
|
8032
|
+
}
|
|
8033
|
+
|
|
8034
|
+
if (typeof config.title === 'number') {
|
|
8035
|
+
config.title = config.title.toString();
|
|
8036
|
+
}
|
|
8037
|
+
|
|
8038
|
+
if (typeof config.content === 'number') {
|
|
8039
|
+
config.content = config.content.toString();
|
|
8040
|
+
}
|
|
8041
|
+
|
|
8042
|
+
return config
|
|
8043
|
+
}
|
|
8044
|
+
|
|
8045
|
+
_getDelegateConfig() {
|
|
8046
|
+
const config = {};
|
|
8047
|
+
|
|
8048
|
+
for (const [key, value] of Object.entries(this._config)) {
|
|
8049
|
+
if (this.constructor.Default[key] !== value) {
|
|
8050
|
+
config[key] = value;
|
|
8051
|
+
}
|
|
8052
|
+
}
|
|
8053
|
+
|
|
8054
|
+
config.selector = false;
|
|
8055
|
+
config.trigger = 'manual';
|
|
8056
|
+
|
|
8057
|
+
// In the future can be replaced with:
|
|
8058
|
+
// const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])
|
|
8059
|
+
// `Object.fromEntries(keysWithDifferentValues)`
|
|
8060
|
+
return config
|
|
8061
|
+
}
|
|
8062
|
+
|
|
8063
|
+
_disposePopper() {
|
|
8064
|
+
if (this._popper) {
|
|
8065
|
+
this._popper.destroy();
|
|
8066
|
+
this._popper = null;
|
|
8067
|
+
}
|
|
8068
|
+
|
|
8069
|
+
if (this.tip) {
|
|
8070
|
+
this.tip.remove();
|
|
8071
|
+
this.tip = null;
|
|
8072
|
+
}
|
|
8073
|
+
}
|
|
8074
|
+
|
|
8075
|
+
// Static
|
|
8076
|
+
static jQueryInterface(config) {
|
|
8077
|
+
return this.each(function () {
|
|
8078
|
+
const data = Tooltip.getOrCreateInstance(this, config);
|
|
8079
|
+
|
|
8080
|
+
if (typeof config !== 'string') {
|
|
8081
|
+
return
|
|
8082
|
+
}
|
|
8083
|
+
|
|
8084
|
+
if (typeof data[config] === 'undefined') {
|
|
8085
|
+
throw new TypeError(`No method named "${config}"`)
|
|
8086
|
+
}
|
|
8087
|
+
|
|
8088
|
+
data[config]();
|
|
8089
|
+
})
|
|
8090
|
+
}
|
|
8091
|
+
}
|
|
8092
|
+
|
|
8093
|
+
/**
|
|
8094
|
+
* jQuery
|
|
8095
|
+
*/
|
|
8096
|
+
|
|
8097
|
+
defineJQueryPlugin(Tooltip);
|
|
8098
|
+
|
|
8099
|
+
/**
|
|
8100
|
+
* @license
|
|
8101
|
+
* Copyright 2020 Google LLC
|
|
8102
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8103
|
+
*/
|
|
8104
|
+
window.ShadyDOM?.inUse &&
|
|
8105
|
+
window.ShadyDOM?.noPatch === true
|
|
8106
|
+
? window.ShadyDOM.wrap
|
|
8107
|
+
: (node) => node;
|
|
8108
|
+
/**
|
|
8109
|
+
* Tests whether a part has only a single-expression with no strings to
|
|
8110
|
+
* interpolate between.
|
|
8111
|
+
*
|
|
8112
|
+
* Only AttributePart and PropertyPart can have multiple expressions.
|
|
8113
|
+
* Multi-expression parts have a `strings` property and single-expression
|
|
8114
|
+
* parts do not.
|
|
8115
|
+
*/
|
|
8116
|
+
const isSingleExpression = (part) => part.strings === undefined;
|
|
8117
|
+
|
|
8118
|
+
/**
|
|
8119
|
+
* @license
|
|
8120
|
+
* Copyright 2017 Google LLC
|
|
8121
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8122
|
+
*/
|
|
8123
|
+
/**
|
|
8124
|
+
* Recursively walks down the tree of Parts/TemplateInstances/Directives to set
|
|
8125
|
+
* the connected state of directives and run `disconnected`/ `reconnected`
|
|
8126
|
+
* callbacks.
|
|
8127
|
+
*
|
|
8128
|
+
* @return True if there were children to disconnect; false otherwise
|
|
8129
|
+
*/
|
|
8130
|
+
const notifyChildrenConnectedChanged = (parent, isConnected) => {
|
|
8131
|
+
const children = parent._$disconnectableChildren;
|
|
8132
|
+
if (children === undefined) {
|
|
8133
|
+
return false;
|
|
8134
|
+
}
|
|
8135
|
+
for (const obj of children) {
|
|
8136
|
+
// The existence of `_$notifyDirectiveConnectionChanged` is used as a "brand" to
|
|
8137
|
+
// disambiguate AsyncDirectives from other DisconnectableChildren
|
|
8138
|
+
// (as opposed to using an instanceof check to know when to call it); the
|
|
8139
|
+
// redundancy of "Directive" in the API name is to avoid conflicting with
|
|
8140
|
+
// `_$notifyConnectionChanged`, which exists `ChildParts` which are also in
|
|
8141
|
+
// this list
|
|
8142
|
+
// Disconnect Directive (and any nested directives contained within)
|
|
8143
|
+
// This property needs to remain unminified.
|
|
8144
|
+
obj['_$notifyDirectiveConnectionChanged']?.(isConnected, false);
|
|
8145
|
+
// Disconnect Part/TemplateInstance
|
|
8146
|
+
notifyChildrenConnectedChanged(obj, isConnected);
|
|
8147
|
+
}
|
|
8148
|
+
return true;
|
|
8149
|
+
};
|
|
8150
|
+
/**
|
|
8151
|
+
* Removes the given child from its parent list of disconnectable children, and
|
|
8152
|
+
* if the parent list becomes empty as a result, removes the parent from its
|
|
8153
|
+
* parent, and so forth up the tree when that causes subsequent parent lists to
|
|
8154
|
+
* become empty.
|
|
8155
|
+
*/
|
|
8156
|
+
const removeDisconnectableFromParent = (obj) => {
|
|
8157
|
+
let parent, children;
|
|
8158
|
+
do {
|
|
8159
|
+
if ((parent = obj._$parent) === undefined) {
|
|
8160
|
+
break;
|
|
8161
|
+
}
|
|
8162
|
+
children = parent._$disconnectableChildren;
|
|
8163
|
+
children.delete(obj);
|
|
8164
|
+
obj = parent;
|
|
8165
|
+
} while (children?.size === 0);
|
|
8166
|
+
};
|
|
8167
|
+
const addDisconnectableToParent = (obj) => {
|
|
8168
|
+
// Climb the parent tree, creating a sparse tree of children needing
|
|
8169
|
+
// disconnection
|
|
8170
|
+
for (let parent; (parent = obj._$parent); obj = parent) {
|
|
8171
|
+
let children = parent._$disconnectableChildren;
|
|
8172
|
+
if (children === undefined) {
|
|
8173
|
+
parent._$disconnectableChildren = children = new Set();
|
|
8174
|
+
}
|
|
8175
|
+
else if (children.has(obj)) {
|
|
8176
|
+
// Once we've reached a parent that already contains this child, we
|
|
8177
|
+
// can short-circuit
|
|
8178
|
+
break;
|
|
8179
|
+
}
|
|
8180
|
+
children.add(obj);
|
|
8181
|
+
installDisconnectAPI(parent);
|
|
8182
|
+
}
|
|
8183
|
+
};
|
|
8184
|
+
/**
|
|
8185
|
+
* Changes the parent reference of the ChildPart, and updates the sparse tree of
|
|
8186
|
+
* Disconnectable children accordingly.
|
|
8187
|
+
*
|
|
8188
|
+
* Note, this method will be patched onto ChildPart instances and called from
|
|
8189
|
+
* the core code when parts are moved between different parents.
|
|
8190
|
+
*/
|
|
8191
|
+
function reparentDisconnectables(newParent) {
|
|
8192
|
+
if (this._$disconnectableChildren !== undefined) {
|
|
8193
|
+
removeDisconnectableFromParent(this);
|
|
8194
|
+
this._$parent = newParent;
|
|
8195
|
+
addDisconnectableToParent(this);
|
|
8196
|
+
}
|
|
8197
|
+
else {
|
|
8198
|
+
this._$parent = newParent;
|
|
8199
|
+
}
|
|
8200
|
+
}
|
|
8201
|
+
/**
|
|
8202
|
+
* Sets the connected state on any directives contained within the committed
|
|
8203
|
+
* value of this part (i.e. within a TemplateInstance or iterable of
|
|
8204
|
+
* ChildParts) and runs their `disconnected`/`reconnected`s, as well as within
|
|
8205
|
+
* any directives stored on the ChildPart (when `valueOnly` is false).
|
|
8206
|
+
*
|
|
8207
|
+
* `isClearingValue` should be passed as `true` on a top-level part that is
|
|
8208
|
+
* clearing itself, and not as a result of recursively disconnecting directives
|
|
8209
|
+
* as part of a `clear` operation higher up the tree. This both ensures that any
|
|
8210
|
+
* directive on this ChildPart that produced a value that caused the clear
|
|
8211
|
+
* operation is not disconnected, and also serves as a performance optimization
|
|
8212
|
+
* to avoid needless bookkeeping when a subtree is going away; when clearing a
|
|
8213
|
+
* subtree, only the top-most part need to remove itself from the parent.
|
|
8214
|
+
*
|
|
8215
|
+
* `fromPartIndex` is passed only in the case of a partial `_clear` running as a
|
|
8216
|
+
* result of truncating an iterable.
|
|
8217
|
+
*
|
|
8218
|
+
* Note, this method will be patched onto ChildPart instances and called from the
|
|
8219
|
+
* core code when parts are cleared or the connection state is changed by the
|
|
8220
|
+
* user.
|
|
8221
|
+
*/
|
|
8222
|
+
function notifyChildPartConnectedChanged(isConnected, isClearingValue = false, fromPartIndex = 0) {
|
|
8223
|
+
const value = this._$committedValue;
|
|
8224
|
+
const children = this._$disconnectableChildren;
|
|
8225
|
+
if (children === undefined || children.size === 0) {
|
|
8226
|
+
return;
|
|
8227
|
+
}
|
|
8228
|
+
if (isClearingValue) {
|
|
8229
|
+
if (Array.isArray(value)) {
|
|
8230
|
+
// Iterable case: Any ChildParts created by the iterable should be
|
|
8231
|
+
// disconnected and removed from this ChildPart's disconnectable
|
|
8232
|
+
// children (starting at `fromPartIndex` in the case of truncation)
|
|
8233
|
+
for (let i = fromPartIndex; i < value.length; i++) {
|
|
8234
|
+
notifyChildrenConnectedChanged(value[i], false);
|
|
8235
|
+
removeDisconnectableFromParent(value[i]);
|
|
8236
|
+
}
|
|
8237
|
+
}
|
|
8238
|
+
else if (value != null) {
|
|
8239
|
+
// TemplateInstance case: If the value has disconnectable children (will
|
|
8240
|
+
// only be in the case that it is a TemplateInstance), we disconnect it
|
|
8241
|
+
// and remove it from this ChildPart's disconnectable children
|
|
8242
|
+
notifyChildrenConnectedChanged(value, false);
|
|
8243
|
+
removeDisconnectableFromParent(value);
|
|
8244
|
+
}
|
|
8245
|
+
}
|
|
8246
|
+
else {
|
|
8247
|
+
notifyChildrenConnectedChanged(this, isConnected);
|
|
8248
|
+
}
|
|
8249
|
+
}
|
|
8250
|
+
/**
|
|
8251
|
+
* Patches disconnection API onto ChildParts.
|
|
8252
|
+
*/
|
|
8253
|
+
const installDisconnectAPI = (obj) => {
|
|
8254
|
+
if (obj.type == PartType.CHILD) {
|
|
8255
|
+
obj._$notifyConnectionChanged ??=
|
|
8256
|
+
notifyChildPartConnectedChanged;
|
|
8257
|
+
obj._$reparentDisconnectables ??= reparentDisconnectables;
|
|
8258
|
+
}
|
|
8259
|
+
};
|
|
8260
|
+
/**
|
|
8261
|
+
* An abstract `Directive` base class whose `disconnected` method will be
|
|
8262
|
+
* called when the part containing the directive is cleared as a result of
|
|
8263
|
+
* re-rendering, or when the user calls `part.setConnected(false)` on
|
|
8264
|
+
* a part that was previously rendered containing the directive (as happens
|
|
8265
|
+
* when e.g. a LitElement disconnects from the DOM).
|
|
8266
|
+
*
|
|
8267
|
+
* If `part.setConnected(true)` is subsequently called on a
|
|
8268
|
+
* containing part, the directive's `reconnected` method will be called prior
|
|
8269
|
+
* to its next `update`/`render` callbacks. When implementing `disconnected`,
|
|
8270
|
+
* `reconnected` should also be implemented to be compatible with reconnection.
|
|
8271
|
+
*
|
|
8272
|
+
* Note that updates may occur while the directive is disconnected. As such,
|
|
8273
|
+
* directives should generally check the `this.isConnected` flag during
|
|
8274
|
+
* render/update to determine whether it is safe to subscribe to resources
|
|
8275
|
+
* that may prevent garbage collection.
|
|
8276
|
+
*/
|
|
8277
|
+
class AsyncDirective extends Directive {
|
|
8278
|
+
constructor() {
|
|
8279
|
+
super(...arguments);
|
|
8280
|
+
// @internal
|
|
8281
|
+
this._$disconnectableChildren = undefined;
|
|
8282
|
+
}
|
|
8283
|
+
/**
|
|
8284
|
+
* Initialize the part with internal fields
|
|
8285
|
+
* @param part
|
|
8286
|
+
* @param parent
|
|
8287
|
+
* @param attributeIndex
|
|
8288
|
+
*/
|
|
8289
|
+
_$initialize(part, parent, attributeIndex) {
|
|
8290
|
+
super._$initialize(part, parent, attributeIndex);
|
|
8291
|
+
addDisconnectableToParent(this);
|
|
8292
|
+
this.isConnected = part._$isConnected;
|
|
8293
|
+
}
|
|
8294
|
+
// This property needs to remain unminified.
|
|
8295
|
+
/**
|
|
8296
|
+
* Called from the core code when a directive is going away from a part (in
|
|
8297
|
+
* which case `shouldRemoveFromParent` should be true), and from the
|
|
8298
|
+
* `setChildrenConnected` helper function when recursively changing the
|
|
8299
|
+
* connection state of a tree (in which case `shouldRemoveFromParent` should
|
|
8300
|
+
* be false).
|
|
8301
|
+
*
|
|
8302
|
+
* @param isConnected
|
|
8303
|
+
* @param isClearingDirective - True when the directive itself is being
|
|
8304
|
+
* removed; false when the tree is being disconnected
|
|
8305
|
+
* @internal
|
|
8306
|
+
*/
|
|
8307
|
+
['_$notifyDirectiveConnectionChanged'](isConnected, isClearingDirective = true) {
|
|
8308
|
+
if (isConnected !== this.isConnected) {
|
|
8309
|
+
this.isConnected = isConnected;
|
|
8310
|
+
if (isConnected) {
|
|
8311
|
+
this.reconnected?.();
|
|
8312
|
+
}
|
|
8313
|
+
else {
|
|
8314
|
+
this.disconnected?.();
|
|
8315
|
+
}
|
|
8316
|
+
}
|
|
8317
|
+
if (isClearingDirective) {
|
|
8318
|
+
notifyChildrenConnectedChanged(this, isConnected);
|
|
8319
|
+
removeDisconnectableFromParent(this);
|
|
8320
|
+
}
|
|
8321
|
+
}
|
|
8322
|
+
/**
|
|
8323
|
+
* Sets the value of the directive's Part outside the normal `update`/`render`
|
|
8324
|
+
* lifecycle of a directive.
|
|
8325
|
+
*
|
|
8326
|
+
* This method should not be called synchronously from a directive's `update`
|
|
8327
|
+
* or `render`.
|
|
8328
|
+
*
|
|
8329
|
+
* @param directive The directive to update
|
|
8330
|
+
* @param value The value to set
|
|
8331
|
+
*/
|
|
8332
|
+
setValue(value) {
|
|
8333
|
+
if (isSingleExpression(this.__part)) {
|
|
8334
|
+
this.__part._$setValue(value, this);
|
|
8335
|
+
}
|
|
8336
|
+
else {
|
|
8337
|
+
// this.__attributeIndex will be defined in this case, but
|
|
8338
|
+
// assert it in dev mode
|
|
8339
|
+
if (this.__attributeIndex === undefined) {
|
|
8340
|
+
throw new Error(`Expected this.__attributeIndex to be a number`);
|
|
8341
|
+
}
|
|
8342
|
+
const newValues = [...this.__part._$committedValue];
|
|
8343
|
+
newValues[this.__attributeIndex] = value;
|
|
8344
|
+
this.__part._$setValue(newValues, this, 0);
|
|
8345
|
+
}
|
|
8346
|
+
}
|
|
8347
|
+
/**
|
|
8348
|
+
* User callbacks for implementing logic to release any resources/subscriptions
|
|
8349
|
+
* that may have been retained by this directive. Since directives may also be
|
|
8350
|
+
* re-connected, `reconnected` should also be implemented to restore the
|
|
8351
|
+
* working state of the directive prior to the next render.
|
|
8352
|
+
*/
|
|
8353
|
+
disconnected() { }
|
|
8354
|
+
reconnected() { }
|
|
8355
|
+
}
|
|
8356
|
+
|
|
8357
|
+
/**
|
|
8358
|
+
* @license
|
|
8359
|
+
* Copyright 2020 Google LLC
|
|
8360
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8361
|
+
*/
|
|
8362
|
+
/**
|
|
8363
|
+
* Creates a new Ref object, which is container for a reference to an element.
|
|
8364
|
+
*/
|
|
8365
|
+
const createRef = () => new Ref();
|
|
8366
|
+
/**
|
|
8367
|
+
* An object that holds a ref value.
|
|
8368
|
+
*/
|
|
8369
|
+
class Ref {
|
|
8370
|
+
}
|
|
8371
|
+
// When callbacks are used for refs, this map tracks the last value the callback
|
|
8372
|
+
// was called with, for ensuring a directive doesn't clear the ref if the ref
|
|
8373
|
+
// has already been rendered to a new spot. It is double-keyed on both the
|
|
8374
|
+
// context (`options.host`) and the callback, since we auto-bind class methods
|
|
8375
|
+
// to `options.host`.
|
|
8376
|
+
const lastElementForContextAndCallback = new WeakMap();
|
|
8377
|
+
class RefDirective extends AsyncDirective {
|
|
8378
|
+
render(_ref) {
|
|
8379
|
+
return nothing;
|
|
8380
|
+
}
|
|
8381
|
+
update(part, [ref]) {
|
|
8382
|
+
const refChanged = ref !== this._ref;
|
|
8383
|
+
if (refChanged && this._ref !== undefined) {
|
|
8384
|
+
// The ref passed to the directive has changed;
|
|
8385
|
+
// unset the previous ref's value
|
|
8386
|
+
this._updateRefValue(undefined);
|
|
8387
|
+
}
|
|
8388
|
+
if (refChanged || this._lastElementForRef !== this._element) {
|
|
8389
|
+
// We either got a new ref or this is the first render;
|
|
8390
|
+
// store the ref/element & update the ref value
|
|
8391
|
+
this._ref = ref;
|
|
8392
|
+
this._context = part.options?.host;
|
|
8393
|
+
this._updateRefValue((this._element = part.element));
|
|
8394
|
+
}
|
|
8395
|
+
return nothing;
|
|
8396
|
+
}
|
|
8397
|
+
_updateRefValue(element) {
|
|
8398
|
+
if (!this.isConnected) {
|
|
8399
|
+
element = undefined;
|
|
8400
|
+
}
|
|
8401
|
+
if (typeof this._ref === 'function') {
|
|
8402
|
+
// If the current ref was called with a previous value, call with
|
|
8403
|
+
// `undefined`; We do this to ensure callbacks are called in a consistent
|
|
8404
|
+
// way regardless of whether a ref might be moving up in the tree (in
|
|
8405
|
+
// which case it would otherwise be called with the new value before the
|
|
8406
|
+
// previous one unsets it) and down in the tree (where it would be unset
|
|
8407
|
+
// before being set). Note that element lookup is keyed by
|
|
8408
|
+
// both the context and the callback, since we allow passing unbound
|
|
8409
|
+
// functions that are called on options.host, and we want to treat
|
|
8410
|
+
// these as unique "instances" of a function.
|
|
8411
|
+
const context = this._context ?? globalThis;
|
|
8412
|
+
let lastElementForCallback = lastElementForContextAndCallback.get(context);
|
|
8413
|
+
if (lastElementForCallback === undefined) {
|
|
8414
|
+
lastElementForCallback = new WeakMap();
|
|
8415
|
+
lastElementForContextAndCallback.set(context, lastElementForCallback);
|
|
8416
|
+
}
|
|
8417
|
+
if (lastElementForCallback.get(this._ref) !== undefined) {
|
|
8418
|
+
this._ref.call(this._context, undefined);
|
|
8419
|
+
}
|
|
8420
|
+
lastElementForCallback.set(this._ref, element);
|
|
8421
|
+
// Call the ref with the new element value
|
|
8422
|
+
if (element !== undefined) {
|
|
8423
|
+
this._ref.call(this._context, element);
|
|
8424
|
+
}
|
|
8425
|
+
}
|
|
8426
|
+
else {
|
|
8427
|
+
this._ref.value = element;
|
|
8428
|
+
}
|
|
8429
|
+
}
|
|
8430
|
+
get _lastElementForRef() {
|
|
8431
|
+
return typeof this._ref === 'function'
|
|
8432
|
+
? lastElementForContextAndCallback
|
|
8433
|
+
.get(this._context ?? globalThis)
|
|
8434
|
+
?.get(this._ref)
|
|
8435
|
+
: this._ref?.value;
|
|
8436
|
+
}
|
|
8437
|
+
disconnected() {
|
|
8438
|
+
// Only clear the box if our element is still the one in it (i.e. another
|
|
8439
|
+
// directive instance hasn't rendered its element to it before us); that
|
|
8440
|
+
// only happens in the event of the directive being cleared (not via manual
|
|
8441
|
+
// disconnection)
|
|
8442
|
+
if (this._lastElementForRef === this._element) {
|
|
8443
|
+
this._updateRefValue(undefined);
|
|
8444
|
+
}
|
|
8445
|
+
}
|
|
8446
|
+
reconnected() {
|
|
8447
|
+
// If we were manually disconnected, we can safely put our element back in
|
|
8448
|
+
// the box, since no rendering could have occurred to change its state
|
|
8449
|
+
this._updateRefValue(this._element);
|
|
8450
|
+
}
|
|
8451
|
+
}
|
|
8452
|
+
/**
|
|
8453
|
+
* Sets the value of a Ref object or calls a ref callback with the element it's
|
|
8454
|
+
* bound to.
|
|
8455
|
+
*
|
|
8456
|
+
* A Ref object acts as a container for a reference to an element. A ref
|
|
8457
|
+
* callback is a function that takes an element as its only argument.
|
|
8458
|
+
*
|
|
8459
|
+
* The ref directive sets the value of the Ref object or calls the ref callback
|
|
8460
|
+
* during rendering, if the referenced element changed.
|
|
8461
|
+
*
|
|
8462
|
+
* Note: If a ref callback is rendered to a different element position or is
|
|
8463
|
+
* removed in a subsequent render, it will first be called with `undefined`,
|
|
8464
|
+
* followed by another call with the new element it was rendered to (if any).
|
|
8465
|
+
*
|
|
8466
|
+
* ```js
|
|
8467
|
+
* // Using Ref object
|
|
8468
|
+
* const inputRef = createRef();
|
|
8469
|
+
* render(html`<input ${ref(inputRef)}>`, container);
|
|
8470
|
+
* inputRef.value.focus();
|
|
8471
|
+
*
|
|
8472
|
+
* // Using callback
|
|
8473
|
+
* const callback = (inputElement) => inputElement.focus();
|
|
8474
|
+
* render(html`<input ${ref(callback)}>`, container);
|
|
8475
|
+
* ```
|
|
8476
|
+
*/
|
|
8477
|
+
const ref = directive(RefDirective);
|
|
8478
|
+
|
|
8479
|
+
var css_248z$1 = css`:host{display:contents}.tooltip-placeholder{display:inline-block;max-width:100%}.tooltip{word-wrap:break-word;display:block;line-break:auto;opacity:0;text-align:left;text-decoration:none;text-shadow:none;text-transform:none;white-space:normal;word-break:normal;word-spacing:normal;z-index:1080}.tooltip.show{opacity:1}.tooltip-inner{background-color:var(--sgds-surface-fixed-dark);border-radius:var(--sgds-border-radius-md);box-shadow:0 0 2px 0 rgba(0,0,0,.12),0 8px 16px 0 rgba(0,0,0,.14);color:var(--sgds-color-fixed-light);font-size:var(--sgds-font-size-1);max-width:var(--sgds-dimension-320);padding:var(--sgds-padding-xs) var(--sgds-padding-sm)}div{max-width:fit-content}`;
|
|
8480
|
+
|
|
8481
|
+
/**
|
|
8482
|
+
* @summary Tooltips display more information when users hover over, focus on, or interact with an element.
|
|
8483
|
+
* @slot default - The element to target the tooltip to.
|
|
8484
|
+
*
|
|
8485
|
+
*/
|
|
8486
|
+
class SgdsTooltip extends SgdsElement {
|
|
8487
|
+
constructor() {
|
|
8488
|
+
super(...arguments);
|
|
8489
|
+
this._myTooltip = createRef();
|
|
8490
|
+
this._bsTooltip = null;
|
|
8491
|
+
/** The tooltip's content. Content has to be textual */
|
|
8492
|
+
this.content = "";
|
|
8493
|
+
/** The placement of tooltip relative to its target */
|
|
8494
|
+
this.placement = "top";
|
|
8495
|
+
/** The method to invoke the tooltip. `hover focus` is the default value which allows tooltip to be triggered via mouse hover and keyboard focus. Add `tabindex=0 `for HTMLelements that are not tabbable. */
|
|
8496
|
+
this.trigger = "hover focus";
|
|
8497
|
+
}
|
|
8498
|
+
_handleSlotChange() {
|
|
8499
|
+
// For a11y purpose
|
|
8500
|
+
this._tooltipTargetElements.forEach(el => el.setAttribute("data-sgds-tooltip", this.content));
|
|
8501
|
+
}
|
|
8502
|
+
_handleClickOutOfElement(e, self) {
|
|
8503
|
+
if (!e.composedPath().includes(self)) {
|
|
8504
|
+
this.hide();
|
|
8505
|
+
}
|
|
8506
|
+
}
|
|
8507
|
+
connectedCallback() {
|
|
8508
|
+
super.connectedCallback();
|
|
8509
|
+
if (this.trigger === "click") {
|
|
8510
|
+
document.addEventListener("click", (event) => this._handleClickOutOfElement(event, this));
|
|
8511
|
+
document.addEventListener("touchstart", (event) => this._handleClickOutOfElement(event, this));
|
|
8512
|
+
}
|
|
8513
|
+
}
|
|
8514
|
+
disconnectedCallback() {
|
|
8515
|
+
super.disconnectedCallback();
|
|
8516
|
+
document.removeEventListener("click", (event) => this._handleClickOutOfElement(event, this));
|
|
8517
|
+
document.removeEventListener("touchstart", (event) => this._handleClickOutOfElement(event, this));
|
|
8518
|
+
}
|
|
8519
|
+
_initializeTooltip() {
|
|
8520
|
+
this.tooltipConfig = {
|
|
8521
|
+
popperConfig: (defaultConfig) => {
|
|
8522
|
+
this.popperConfig = defaultConfig;
|
|
8523
|
+
const defaultModifiers = defaultConfig.modifiers;
|
|
8524
|
+
const newModifiers = defaultModifiers.map(mod => {
|
|
8525
|
+
if (mod.name === "flip") {
|
|
8526
|
+
mod.options.fallbackPlacements = [];
|
|
8527
|
+
}
|
|
8528
|
+
return mod;
|
|
8529
|
+
});
|
|
8530
|
+
this.popperConfig.modifiers = newModifiers;
|
|
8531
|
+
return this.popperConfig;
|
|
8532
|
+
},
|
|
8533
|
+
placement: this.placement,
|
|
8534
|
+
trigger: this.trigger,
|
|
8535
|
+
title: this.content,
|
|
8536
|
+
html: true,
|
|
8537
|
+
container: this.shadowRoot.querySelector("div") // tooltip to appear inside the shadow root of sgds-tooltip instead of anywhere in the DOM, so that scoped styles can apply
|
|
8538
|
+
};
|
|
8539
|
+
this._bsTooltip = new Tooltip(this._myTooltip.value, this.tooltipConfig);
|
|
8540
|
+
}
|
|
8541
|
+
firstUpdated() {
|
|
8542
|
+
this._initializeTooltip();
|
|
8543
|
+
this._myTooltip.value.addEventListener("show.bs.tooltip", () => {
|
|
8544
|
+
this.emit("sgds-show");
|
|
8545
|
+
});
|
|
8546
|
+
this._myTooltip.value.addEventListener("shown.bs.tooltip", () => {
|
|
8547
|
+
this.emit("sgds-after-show");
|
|
8548
|
+
});
|
|
8549
|
+
this._myTooltip.value.addEventListener("hide.bs.tooltip", () => {
|
|
8550
|
+
this.emit("sgds-hide");
|
|
8551
|
+
});
|
|
8552
|
+
this._myTooltip.value.addEventListener("hidden.bs.tooltip", () => {
|
|
8553
|
+
this.emit("sgds-after-hide");
|
|
8554
|
+
});
|
|
8555
|
+
}
|
|
8556
|
+
/** Hides the Tooltip */
|
|
8557
|
+
hide() {
|
|
8558
|
+
this._bsTooltip.hide();
|
|
8559
|
+
}
|
|
8560
|
+
/** Shows the Tooltip */
|
|
8561
|
+
show() {
|
|
8562
|
+
this._bsTooltip.show();
|
|
8563
|
+
}
|
|
8564
|
+
render() {
|
|
8565
|
+
return html `
|
|
8566
|
+
<div ${ref(this._myTooltip)} class="tooltip-placeholder">
|
|
8567
|
+
<slot @slotchange=${this._handleSlotChange}></slot>
|
|
8568
|
+
</div>
|
|
8569
|
+
`;
|
|
8570
|
+
}
|
|
8571
|
+
}
|
|
8572
|
+
SgdsTooltip.styles = [...SgdsElement.styles, css_248z$1];
|
|
8573
|
+
__decorate([
|
|
8574
|
+
property({ type: String })
|
|
8575
|
+
], SgdsTooltip.prototype, "content", void 0);
|
|
8576
|
+
__decorate([
|
|
8577
|
+
property({ type: String })
|
|
8578
|
+
], SgdsTooltip.prototype, "placement", void 0);
|
|
8579
|
+
__decorate([
|
|
8580
|
+
property({ type: String })
|
|
8581
|
+
], SgdsTooltip.prototype, "trigger", void 0);
|
|
8582
|
+
__decorate([
|
|
8583
|
+
state()
|
|
8584
|
+
], SgdsTooltip.prototype, "popperConfig", void 0);
|
|
8585
|
+
__decorate([
|
|
8586
|
+
queryAssignedElements()
|
|
8587
|
+
], SgdsTooltip.prototype, "_tooltipTargetElements", void 0);
|
|
8588
|
+
|
|
8589
|
+
/**
|
|
8590
|
+
* @license
|
|
8591
|
+
* Copyright 2018 Google LLC
|
|
8592
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
8593
|
+
*/
|
|
8594
|
+
/**
|
|
8595
|
+
* For AttributeParts, sets the attribute if the value is defined and removes
|
|
8596
|
+
* the attribute if the value is undefined.
|
|
8597
|
+
*
|
|
8598
|
+
* For other part types, this directive is a no-op.
|
|
8599
|
+
*/
|
|
8600
|
+
const ifDefined = (value) => value ?? nothing;
|
|
8601
|
+
|
|
8602
|
+
var css_248z = css`:host{--sgds-close-btn-border-radius:var(--sgds-border-radius-sm);display:inline-flex}.btn-close{align-items:center;background-color:var(--sgds-bg-transparent);border:0;border:var(--sgds-border-width-1) solid var(--sgds-border-color-transparent);border-radius:var(--sgds-close-btn-border-radius);cursor:pointer;display:flex;height:var(--sgds-dimension-32);justify-content:center;padding:0;position:relative;width:var(--sgds-dimension-32)}.btn-close-light{color:var(--sgds-color-fixed-light)}.btn-close-dark{color:var(--sgds-color-fixed-dark)}.btn-close:hover{background-color:var(--sgds-bg-translucent)}.btn-close:focus,.btn-close:focus-visible{background-color:var(--sgds-bg-translucent);box-shadow:var(--sgds-box-shadow-focus);outline:0}.btn-close-sm{height:var(--sgds-dimension-24);width:var(--sgds-dimension-24)}.btn-close.btn-close-sm{height:var(--sgds-icon-size-sm);width:var(--sgds-icon-size-sm)}`;
|
|
8603
|
+
|
|
8604
|
+
/**
|
|
8605
|
+
*
|
|
8606
|
+
* @param name tagname of custom element
|
|
8607
|
+
* @returns boolean
|
|
8608
|
+
*/
|
|
8609
|
+
function isRegistered(name) {
|
|
8610
|
+
return !!customElements.get(name);
|
|
8611
|
+
}
|
|
8612
|
+
function register(name, constructor) {
|
|
8613
|
+
if (!customElements.get(name)) {
|
|
8614
|
+
customElements.define(name, constructor);
|
|
8615
|
+
}
|
|
8616
|
+
}
|
|
8617
|
+
function warnUnregisteredElements(name) {
|
|
8618
|
+
if (isRegistered(name)) {
|
|
8619
|
+
return true;
|
|
8620
|
+
}
|
|
8621
|
+
else {
|
|
8622
|
+
console.error(`Custom element of name : ${name} is not registered. Remember to import the component file for custom element registration`);
|
|
8623
|
+
return false;
|
|
8624
|
+
}
|
|
8625
|
+
}
|
|
8626
|
+
|
|
8627
|
+
/**
|
|
8628
|
+
* @summary Close button for closing actions. Used in Modal, Drawer, Alert and Toast.
|
|
8629
|
+
*
|
|
8630
|
+
* @cssprop --sgds-close-btn-border-radius - The border radius of close button border
|
|
8631
|
+
*
|
|
8632
|
+
*/
|
|
8633
|
+
class SgdsCloseButton extends SgdsElement {
|
|
8634
|
+
constructor() {
|
|
8635
|
+
super(...arguments);
|
|
8636
|
+
this.ariaLabel = "Close button";
|
|
8637
|
+
/** Specifies a large or small button */
|
|
8638
|
+
this.size = "md";
|
|
8639
|
+
this.variant = "default";
|
|
8640
|
+
this._clickHandler = () => {
|
|
8641
|
+
return;
|
|
8642
|
+
};
|
|
8643
|
+
}
|
|
8644
|
+
_handleClick() {
|
|
8645
|
+
this.removeEventListener("click", this._clickHandler);
|
|
8646
|
+
this.addEventListener("click", this._clickHandler);
|
|
8647
|
+
}
|
|
8648
|
+
firstUpdated() {
|
|
8649
|
+
/** Cannot register sgds-icon as dependency due to some circular dependencies, so we check and warn instead */
|
|
8650
|
+
warnUnregisteredElements("sgds-icon");
|
|
8651
|
+
}
|
|
8652
|
+
render() {
|
|
8653
|
+
return html `
|
|
8654
|
+
<button
|
|
8655
|
+
class=${classMap({
|
|
8656
|
+
"btn-close": true,
|
|
8657
|
+
[`btn-close-${this.size}`]: this.size,
|
|
8658
|
+
"btn-close-light": this.variant === "light",
|
|
8659
|
+
"btn-close-dark": this.variant === "dark"
|
|
8660
|
+
})}
|
|
8661
|
+
aria-label=${ifDefined(this.ariaLabel)}
|
|
8662
|
+
@click=${this._handleClick}
|
|
8663
|
+
>
|
|
8664
|
+
<sgds-icon name="cross" size=${this.size}></sgds-icon>
|
|
8665
|
+
</button>
|
|
8666
|
+
`;
|
|
8667
|
+
}
|
|
8668
|
+
}
|
|
8669
|
+
SgdsCloseButton.styles = [...SgdsElement.styles, css_248z];
|
|
8670
|
+
__decorate([
|
|
8671
|
+
property({ type: String })
|
|
8672
|
+
], SgdsCloseButton.prototype, "ariaLabel", void 0);
|
|
8673
|
+
__decorate([
|
|
8674
|
+
property({ type: String, reflect: true })
|
|
8675
|
+
], SgdsCloseButton.prototype, "size", void 0);
|
|
8676
|
+
__decorate([
|
|
8677
|
+
property({ type: String, reflect: true })
|
|
8678
|
+
], SgdsCloseButton.prototype, "variant", void 0);
|
|
8679
|
+
|
|
8680
|
+
/**
|
|
8681
|
+
* Given a slot, this function iterates over all of its assigned text nodes and returns the concatenated text as a
|
|
8682
|
+
* string. This is useful because we can't use slot.textContent as an alternative.
|
|
8683
|
+
*/
|
|
8684
|
+
function getTextContent(slot) {
|
|
8685
|
+
if (!slot) {
|
|
8686
|
+
return "";
|
|
8687
|
+
}
|
|
8688
|
+
const nodes = slot.assignedNodes({ flatten: true });
|
|
8689
|
+
let text = "";
|
|
8690
|
+
[...nodes].forEach(node => {
|
|
8691
|
+
if (node.nodeType === Node.TEXT_NODE) {
|
|
8692
|
+
text += node.textContent.trim();
|
|
8693
|
+
}
|
|
8694
|
+
});
|
|
8695
|
+
return text;
|
|
8696
|
+
}
|
|
8697
|
+
|
|
8698
|
+
/**
|
|
8699
|
+
* @summary Badges can be used to highlight important bits of information such as labels, notifications & status.
|
|
8700
|
+
* When the text exceeds the width, it will be truncated with a tooltip that will be displayed on hover.
|
|
8701
|
+
*
|
|
8702
|
+
* @slot default - slot for badge
|
|
8703
|
+
* @slot icon - The slot for icon to the left of the badge text
|
|
8704
|
+
*
|
|
8705
|
+
* @event sgds-show - Emitted when the badge appears.
|
|
8706
|
+
* @event sgds-hide - Emitted when the badge is starting to close but has not closed.
|
|
8707
|
+
* @event sgds-after-show - Emitted after the badge has appeared
|
|
8708
|
+
* @event sgds-after-hide - Emitted after the badge has closed
|
|
8709
|
+
*/
|
|
8710
|
+
class SgdsBadge extends SgdsElement {
|
|
8711
|
+
constructor() {
|
|
8712
|
+
super(...arguments);
|
|
8713
|
+
/** Controls the appearance of the dismissible badge. This prop only applies when dismissible is true */
|
|
8714
|
+
this.show = false;
|
|
8715
|
+
/** One or more button variant combinations buttons may be one of a variety of visual variants such as: `info`, `success`, `danger`, `warning`, 'neutral' */
|
|
8716
|
+
this.variant = "info";
|
|
8717
|
+
/** Manually set the outlined state to false */
|
|
8718
|
+
this.outlined = false;
|
|
8719
|
+
/** Manually set the dismissible state of the button to `false` */
|
|
8720
|
+
this.dismissible = false;
|
|
8721
|
+
/** Manually enable full width */
|
|
8722
|
+
this.fullWidth = false;
|
|
8723
|
+
this.truncated = false;
|
|
8724
|
+
this.text = "";
|
|
8725
|
+
}
|
|
8726
|
+
/** Closes the badge */
|
|
8727
|
+
close() {
|
|
8728
|
+
this.show = false;
|
|
8729
|
+
}
|
|
8730
|
+
/**@internal */
|
|
8731
|
+
_handleShowChange() {
|
|
8732
|
+
if (this.show) {
|
|
8733
|
+
const sgdsShow = this.emit("sgds-show", { cancelable: true });
|
|
8734
|
+
if (sgdsShow.defaultPrevented) {
|
|
8735
|
+
this.show = false;
|
|
8736
|
+
return;
|
|
8737
|
+
}
|
|
8738
|
+
// animations if any go here
|
|
8739
|
+
this.emit("sgds-after-show");
|
|
8740
|
+
}
|
|
8741
|
+
else {
|
|
8742
|
+
const sgdsHide = this.emit("sgds-hide", { cancelable: true });
|
|
8743
|
+
if (sgdsHide.defaultPrevented) {
|
|
8744
|
+
this.show = true;
|
|
8745
|
+
return;
|
|
8746
|
+
}
|
|
8747
|
+
// animations if any go here
|
|
8748
|
+
this.emit("sgds-after-hide");
|
|
8749
|
+
}
|
|
8750
|
+
}
|
|
8751
|
+
/**@internal */
|
|
8752
|
+
_handleTruncation() {
|
|
8753
|
+
// checking of text height if its exceeding parent, it needs to be truncated
|
|
8754
|
+
const badge = this.shadowRoot.querySelector(".badge");
|
|
8755
|
+
const badgeLabel = this.shadowRoot.querySelector(".badge-label");
|
|
8756
|
+
if (badge && badgeLabel) {
|
|
8757
|
+
const labelHeight = badgeLabel.getBoundingClientRect().height;
|
|
8758
|
+
const badgeHeight = badge.getBoundingClientRect().height;
|
|
8759
|
+
this.truncated = labelHeight > badgeHeight;
|
|
8760
|
+
}
|
|
8761
|
+
}
|
|
8762
|
+
_handleLabelSlotChange(e) {
|
|
8763
|
+
this.text = getTextContent(e.target);
|
|
8764
|
+
return;
|
|
8765
|
+
}
|
|
8766
|
+
_renderBadge() {
|
|
8767
|
+
return html `<div
|
|
8768
|
+
class="
|
|
8769
|
+
${classMap({
|
|
8770
|
+
[`badge-dismissible`]: this.dismissible,
|
|
8771
|
+
badge: true,
|
|
8772
|
+
outlined: this.outlined,
|
|
8773
|
+
truncated: this.truncated,
|
|
8774
|
+
"full-width": this.fullWidth
|
|
8775
|
+
})}"
|
|
8776
|
+
aria-hidden=${this.show ? "false" : "true"}
|
|
8777
|
+
>
|
|
8778
|
+
${!this.dismissible ? html `<slot name="icon"></slot>` : nothing}
|
|
8779
|
+
|
|
8780
|
+
<span class="badge-label">
|
|
8781
|
+
<slot @slotchange=${this._handleLabelSlotChange}></slot>
|
|
8782
|
+
</span>
|
|
8783
|
+
|
|
8784
|
+
${this.dismissible
|
|
8785
|
+
? html `<sgds-close-button
|
|
8786
|
+
size="sm"
|
|
8787
|
+
aria-label="close the badge"
|
|
8788
|
+
@click=${this.close}
|
|
8789
|
+
variant=${this.outlined ? "dark" : "light"}
|
|
8790
|
+
></sgds-close-button>`
|
|
8791
|
+
: nothing}
|
|
8792
|
+
</div>`;
|
|
8793
|
+
}
|
|
8794
|
+
render() {
|
|
8795
|
+
return (this.dismissible && this.show) || !this.dismissible
|
|
8796
|
+
? this.truncated
|
|
8797
|
+
? html `<sgds-tooltip content=${this.text}>${this._renderBadge()}</sgds-tooltip>`
|
|
8798
|
+
: this._renderBadge()
|
|
4477
8799
|
: nothing;
|
|
4478
8800
|
}
|
|
4479
8801
|
}
|
|
4480
|
-
SgdsBadge.styles = [...SgdsElement.styles, css_248z];
|
|
8802
|
+
SgdsBadge.styles = [...SgdsElement.styles, css_248z$3];
|
|
4481
8803
|
/**@internal */
|
|
4482
8804
|
SgdsBadge.dependencies = {
|
|
4483
|
-
"sgds-close-button": SgdsCloseButton
|
|
8805
|
+
"sgds-close-button": SgdsCloseButton,
|
|
8806
|
+
"sgds-tooltip": SgdsTooltip
|
|
4484
8807
|
};
|
|
4485
8808
|
__decorate([
|
|
4486
8809
|
property({ type: Boolean, reflect: true })
|
|
@@ -4494,9 +8817,21 @@
|
|
|
4494
8817
|
__decorate([
|
|
4495
8818
|
property({ type: Boolean, reflect: true })
|
|
4496
8819
|
], SgdsBadge.prototype, "dismissible", void 0);
|
|
8820
|
+
__decorate([
|
|
8821
|
+
property({ type: Boolean, reflect: true })
|
|
8822
|
+
], SgdsBadge.prototype, "fullWidth", void 0);
|
|
8823
|
+
__decorate([
|
|
8824
|
+
state()
|
|
8825
|
+
], SgdsBadge.prototype, "truncated", void 0);
|
|
8826
|
+
__decorate([
|
|
8827
|
+
state()
|
|
8828
|
+
], SgdsBadge.prototype, "text", void 0);
|
|
4497
8829
|
__decorate([
|
|
4498
8830
|
watch("show")
|
|
4499
8831
|
], SgdsBadge.prototype, "_handleShowChange", null);
|
|
8832
|
+
__decorate([
|
|
8833
|
+
watch("text")
|
|
8834
|
+
], SgdsBadge.prototype, "_handleTruncation", null);
|
|
4500
8835
|
|
|
4501
8836
|
register("sgds-badge", SgdsBadge);
|
|
4502
8837
|
|