@telesign/boreal-web-components 0.1.0-alpha.3 → 0.1.0-alpha.4
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/components-build/bds-avatar.d.ts +11 -0
- package/components-build/bds-avatar.js +1 -0
- package/components-build/bds-badge.d.ts +11 -0
- package/components-build/bds-badge.js +1 -0
- package/components-build/bds-banner.js +1 -1
- package/components-build/bds-button.js +1 -1
- package/components-build/bds-checkbox.js +1 -1
- package/components-build/bds-dialog.js +1 -1
- package/components-build/bds-divider.d.ts +11 -0
- package/components-build/bds-divider.js +1 -0
- package/components-build/bds-flag.js +1 -1
- package/components-build/bds-grid-item.d.ts +11 -0
- package/components-build/bds-grid-item.js +1 -0
- package/components-build/bds-grid.d.ts +11 -0
- package/components-build/bds-grid.js +1 -0
- package/components-build/bds-list-menu-item.d.ts +11 -0
- package/components-build/bds-list-menu-item.js +1 -0
- package/components-build/bds-list-menu.d.ts +11 -0
- package/components-build/bds-list-menu.js +1 -0
- package/components-build/bds-popover.js +1 -1
- package/components-build/bds-spinner.js +1 -1
- package/components-build/bds-status.d.ts +11 -0
- package/components-build/bds-status.js +1 -0
- package/components-build/bds-tag.d.ts +11 -0
- package/components-build/bds-tag.js +1 -0
- package/components-build/bds-text-field.js +1 -1
- package/components-build/bds-toggle.d.ts +11 -0
- package/components-build/bds-toggle.js +1 -0
- package/components-build/bds-tooltip.js +1 -1
- package/components-build/bds-typography.js +1 -1
- package/components-build/index.js +1 -1
- package/components-build/p-B8n1ru5i.js +1 -0
- package/components-build/p-Bfazyxqi.js +1 -0
- package/components-build/p-CGdxFth9.js +1 -0
- package/components-build/p-CrAt6pGl.js +1 -0
- package/components-build/p-DCwT43Kz.js +1 -0
- package/components-build/p-DIY3CDNL.js +1 -0
- package/components-build/p-DhSchGPI.js +1 -0
- package/components-build/p-kGnB15Lz.js +1 -0
- package/custom-elements.json +2588 -540
- package/dist/boreal-web-components/boreal-web-components.esm.js +1 -1
- package/dist/boreal-web-components/boreal-web-components.js +1 -1
- package/dist/boreal-web-components/css/boreal.css +1066 -1074
- package/dist/boreal-web-components/css/global.css +403 -407
- package/dist/boreal-web-components/css/theme-connect.css +163 -164
- package/dist/boreal-web-components/css/theme-engage.css +163 -164
- package/dist/boreal-web-components/css/theme-protect.css +163 -164
- package/dist/boreal-web-components/css/theme-proximus.css +164 -165
- package/dist/boreal-web-components/p-0028481c.entry.js +1 -0
- package/dist/boreal-web-components/p-127a4134.entry.js +1 -0
- package/dist/boreal-web-components/p-1466de58.system.entry.js +1 -0
- package/dist/boreal-web-components/p-1d1bb9d2.entry.js +1 -0
- package/dist/boreal-web-components/p-2158a7cd.entry.js +1 -0
- package/dist/boreal-web-components/{p-8c57e06a.entry.js → p-251b3002.entry.js} +1 -1
- package/dist/boreal-web-components/p-251d35df.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-fc2cb919.entry.js → p-2b8bd1dd.entry.js} +1 -1
- package/dist/boreal-web-components/p-32c23246.system.entry.js +1 -0
- package/dist/boreal-web-components/p-3fbcc233.entry.js +1 -0
- package/dist/boreal-web-components/p-401f1aee.system.entry.js +1 -0
- package/dist/boreal-web-components/p-41b48701.system.entry.js +1 -0
- package/dist/boreal-web-components/p-41cac1b8.system.entry.js +1 -0
- package/dist/boreal-web-components/p-44ceff4e.system.entry.js +1 -0
- package/dist/boreal-web-components/{p-efe57901.system.entry.js → p-52600375.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-627b19a5.system.entry.js +1 -0
- package/dist/boreal-web-components/p-649737e5.entry.js +1 -0
- package/dist/boreal-web-components/p-64cb5825.entry.js +1 -0
- package/dist/boreal-web-components/p-66360e63.entry.js +1 -0
- package/dist/boreal-web-components/p-695d0830.entry.js +1 -0
- package/dist/boreal-web-components/p-6a99f4c6.system.entry.js +1 -0
- package/dist/boreal-web-components/p-731b88cc.entry.js +1 -0
- package/dist/boreal-web-components/{p-22378341.system.entry.js → p-74c13bed.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-7a4efddd.system.entry.js +1 -0
- package/dist/boreal-web-components/p-7db870b7.entry.js +1 -0
- package/dist/boreal-web-components/p-7f7ac40f.entry.js +1 -0
- package/dist/boreal-web-components/p-80822731.system.entry.js +1 -0
- package/dist/boreal-web-components/p-82d49661.entry.js +1 -0
- package/dist/boreal-web-components/p-83ca193e.entry.js +1 -0
- package/dist/boreal-web-components/p-871c9a9f.system.entry.js +1 -0
- package/dist/boreal-web-components/p-BQ_zoZa2.js +1 -0
- package/dist/boreal-web-components/p-Bfazyxqi.js +1 -0
- package/dist/boreal-web-components/{p-D4EFsvs1.js → p-BqJlOB6b.js} +2 -2
- package/dist/boreal-web-components/p-BsZkk4oK.system.js +1 -0
- package/dist/boreal-web-components/p-CXz1RLGi.system.js +1 -0
- package/dist/boreal-web-components/p-CtknSula.system.js +1 -0
- package/dist/boreal-web-components/p-CvK2d92c.js +1 -0
- package/dist/boreal-web-components/p-CzYQb3pP.js +1 -0
- package/dist/boreal-web-components/p-DCKg5Cg_.system.js +2 -0
- package/dist/boreal-web-components/p-DZcx75cy.system.js +1 -0
- package/dist/boreal-web-components/p-DhSchGPI.js +1 -0
- package/dist/boreal-web-components/{p-BkDQsB4R.system.js → p-Dme-NuTD.system.js} +1 -1
- package/dist/boreal-web-components/p-RhSdMyWk.system.js +1 -0
- package/dist/boreal-web-components/{p-5fa53a80.system.entry.js → p-ab5ffa15.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-b12d4788.system.entry.js +1 -0
- package/dist/boreal-web-components/p-ba2b625a.system.entry.js +1 -0
- package/dist/boreal-web-components/p-bf2ef10b.entry.js +1 -0
- package/dist/boreal-web-components/{p-6de2b44c.system.entry.js → p-c7aee9f4.system.entry.js} +1 -1
- package/dist/boreal-web-components/p-e0bf8a6e.entry.js +1 -0
- package/dist/boreal-web-components/p-edca16b6.system.entry.js +1 -0
- package/dist/boreal-web-components/p-fc24d963.entry.js +1 -0
- package/dist/boreal-web-components/p-kGnB15Lz.js +1 -0
- package/dist/boreal-web-components/p-vzZJGcYF.system.js +1 -0
- package/dist/boreal-web-components/scss/maps/_primitives.scss +404 -408
- package/dist/boreal-web-components/scss/maps/_theme-connect.scss +164 -165
- package/dist/boreal-web-components/scss/maps/_theme-engage.scss +164 -165
- package/dist/boreal-web-components/scss/maps/_theme-protect.scss +164 -165
- package/dist/boreal-web-components/scss/maps/_theme-proximus.scss +165 -166
- package/dist/boreal-web-components/scss/variables/_primitives.scss +404 -408
- package/dist/boreal-web-components/scss/variables/_theme-connect.scss +164 -165
- package/dist/boreal-web-components/scss/variables/_theme-engage.scss +164 -165
- package/dist/boreal-web-components/scss/variables/_theme-protect.scss +164 -165
- package/dist/boreal-web-components/scss/variables/_theme-proximus.scss +165 -166
- package/dist/cjs/BaseAttributes-DBBhKt7O.js +14 -0
- package/dist/cjs/Keys-DbIXSJF2.js +22 -0
- package/dist/cjs/bds-avatar.cjs.entry.js +89 -0
- package/dist/cjs/bds-badge.cjs.entry.js +50 -0
- package/dist/cjs/bds-banner.cjs.entry.js +12 -5
- package/dist/cjs/bds-button.cjs.entry.js +5 -5
- package/dist/cjs/bds-checkbox.cjs.entry.js +6 -6
- package/dist/cjs/bds-dialog.cjs.entry.js +7 -6
- package/dist/cjs/bds-divider.cjs.entry.js +46 -0
- package/dist/cjs/bds-flag.cjs.entry.js +3 -3
- package/dist/cjs/bds-grid-item.cjs.entry.js +93 -0
- package/dist/cjs/bds-grid.cjs.entry.js +37 -0
- package/dist/cjs/bds-list-menu-item.cjs.entry.js +468 -0
- package/dist/cjs/bds-list-menu.cjs.entry.js +130 -0
- package/dist/cjs/bds-popover.cjs.entry.js +17 -8
- package/dist/cjs/bds-spinner.cjs.entry.js +4 -4
- package/dist/cjs/bds-status.cjs.entry.js +59 -0
- package/dist/cjs/bds-tag.cjs.entry.js +140 -0
- package/dist/cjs/bds-text-field.cjs.entry.js +12 -22
- package/dist/cjs/bds-toggle.cjs.entry.js +186 -0
- package/dist/cjs/bds-tooltip_2.cjs.entry.js +320 -0
- package/dist/cjs/boreal-web-components.cjs.js +2 -2
- package/dist/cjs/{anchored.mixin-CnIwkaUi.js → getOffset-m4hBgyVP.js} +42 -26
- package/dist/cjs/{index-BcSjvXJk.js → index-CwYIVC9N.js} +64 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{states-iIYiazaM.js → states-BweP5Vpu.js} +8 -0
- package/dist/cjs/validateProps-CJe9X5x8.js +42 -0
- package/dist/collection/collection-manifest.json +10 -0
- package/dist/collection/components/actions/bds-button/bds-button.js +2 -2
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu/bds-list-menu.css +25 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu/bds-list-menu.js +301 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.css +71 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.js +437 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/types/IListMenuItem.js +1 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/types/enum.js +4 -0
- package/dist/collection/components/actions/bds-list-menu/bds-list-menu-item/types/types.js +1 -0
- package/dist/collection/components/actions/bds-toggle/bds-toggle.css +120 -0
- package/dist/collection/components/actions/bds-toggle/bds-toggle.js +544 -0
- package/dist/collection/components/actions/bds-toggle/types/IEventChange.js +1 -0
- package/dist/collection/components/actions/bds-toggle/types/IToggle.js +1 -0
- package/dist/collection/components/actions/bds-toggle/types/enum.js +4 -0
- package/dist/collection/components/actions/bds-toggle/types/index.js +4 -0
- package/dist/collection/components/actions/bds-toggle/types/types.js +1 -0
- package/dist/collection/components/feedback/bds-badge/bds-badge.css +76 -0
- package/dist/collection/components/feedback/bds-badge/bds-badge.js +120 -0
- package/dist/collection/components/feedback/bds-badge/types/IBadge.js +1 -0
- package/dist/collection/components/feedback/bds-badge/types/enum.js +5 -0
- package/dist/collection/components/feedback/bds-banner/bds-banner.css +1 -2
- package/dist/collection/components/feedback/bds-banner/bds-banner.js +30 -6
- package/dist/collection/components/feedback/bds-spinner/bds-spinner.css +7 -8
- package/dist/collection/components/feedback/bds-spinner/bds-spinner.js +1 -1
- package/dist/collection/components/feedback/bds-status/bds-status.css +101 -0
- package/dist/collection/components/feedback/bds-status/bds-status.js +122 -0
- package/dist/collection/components/feedback/bds-status/types/IStatus.js +1 -0
- package/dist/collection/components/feedback/bds-status/types/enum.js +5 -0
- package/dist/collection/components/feedback/bds-status/types/types.js +1 -0
- package/dist/collection/components/feedback/bds-tag/bds-tag.css +202 -0
- package/dist/collection/components/feedback/bds-tag/bds-tag.js +375 -0
- package/dist/collection/components/feedback/bds-tag/types/ITag.js +1 -0
- package/dist/collection/components/feedback/bds-tag/types/enum.js +10 -0
- package/dist/collection/components/feedback/bds-tag/types/index.js +3 -0
- package/dist/collection/components/feedback/bds-tag/types/types.js +1 -0
- package/dist/collection/components/forms/bds-checkbox/bds-checkbox.js +1 -1
- package/dist/collection/components/forms/bds-flag/bds-flag.js +1 -1
- package/dist/collection/components/forms/bds-text-field/bds-text-field.js +1 -1
- package/dist/collection/components/helpers/bds-divider.css +36 -0
- package/dist/collection/components/helpers/bds-divider.js +88 -0
- package/dist/collection/components/helpers/types/IDivider.js +1 -0
- package/dist/collection/components/helpers/types/enum.js +4 -0
- package/dist/collection/components/helpers/types/types.js +1 -0
- package/dist/collection/components/images-icons/bds-avatar/bds-avatar.css +52 -0
- package/dist/collection/components/images-icons/bds-avatar/bds-avatar.js +219 -0
- package/dist/collection/components/images-icons/bds-avatar/types/IAvatar.js +1 -0
- package/dist/collection/components/images-icons/bds-avatar/types/enum.js +5 -0
- package/dist/collection/components/images-icons/bds-avatar/types/index.js +3 -0
- package/dist/collection/components/images-icons/bds-avatar/types/types.js +1 -0
- package/dist/collection/components/layouts/bds-grid/grid/bds-grid.css +57 -0
- package/dist/collection/components/layouts/bds-grid/grid/bds-grid.js +100 -0
- package/dist/collection/components/layouts/bds-grid/grid/types/IGrid.js +1 -0
- package/dist/collection/components/layouts/bds-grid/grid/types/enum.js +4 -0
- package/dist/collection/components/layouts/bds-grid/grid/types/index.js +3 -0
- package/dist/collection/components/layouts/bds-grid/grid/types/types.js +1 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/bds-grid-item.css +70 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/bds-grid-item.js +306 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/types/IGridItem.js +1 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/types/enum.js +10 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/types/index.js +3 -0
- package/dist/collection/components/layouts/bds-grid/grid-item/types/types.js +1 -0
- package/dist/collection/components/overlays/bds-dialog/bds-dialog.js +4 -3
- package/dist/collection/components/overlays/bds-popover/bds-popover.css +16 -2
- package/dist/collection/components/overlays/bds-popover/bds-popover.js +12 -4
- package/dist/collection/components/overlays/bds-popover/constants/Offset.js +1 -0
- package/dist/collection/components/overlays/bds-tooltip/bds-tooltip.css +2 -13
- package/dist/collection/components/overlays/bds-tooltip/bds-tooltip.js +4 -2
- package/dist/collection/components/overlays/bds-tooltip/constants/Offset.js +1 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.css +4 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.js +20 -19
- package/dist/collection/components/titles-text/bds-typography/utils/bds-typography-utils.js +2 -2
- package/dist/collection/css/boreal.css +1066 -1074
- package/dist/collection/css/global.css +403 -407
- package/dist/collection/css/theme-connect.css +163 -164
- package/dist/collection/css/theme-engage.css +163 -164
- package/dist/collection/css/theme-protect.css +163 -164
- package/dist/collection/css/theme-proximus.css +164 -165
- package/dist/collection/mixins/anchored.mixin.js +14 -1
- package/dist/collection/mixins/index.js +2 -0
- package/dist/collection/mixins/links.mixin.js +153 -0
- package/dist/collection/mixins/menu-behavior.mixin.js +113 -0
- package/dist/collection/scss/maps/_primitives.scss +404 -408
- package/dist/collection/scss/maps/_theme-connect.scss +164 -165
- package/dist/collection/scss/maps/_theme-engage.scss +164 -165
- package/dist/collection/scss/maps/_theme-protect.scss +164 -165
- package/dist/collection/scss/maps/_theme-proximus.scss +165 -166
- package/dist/collection/scss/variables/_primitives.scss +404 -408
- package/dist/collection/scss/variables/_theme-connect.scss +164 -165
- package/dist/collection/scss/variables/_theme-engage.scss +164 -165
- package/dist/collection/scss/variables/_theme-protect.scss +164 -165
- package/dist/collection/scss/variables/_theme-proximus.scss +165 -166
- package/dist/collection/services/floating/positioning.service.js +1 -1
- package/dist/collection/types/IFormProps.js +1 -0
- package/dist/collection/types/index.js +3 -0
- package/dist/collection/types/links.js +1 -0
- package/dist/collection/types/menu.js +8 -0
- package/dist/collection/types/position.js +6 -2
- package/dist/collection/utils/constants/common/Keys.js +12 -0
- package/dist/collection/utils/helpers/overlays/getOffset.js +13 -0
- package/dist/collection/utils/helpers/validateProps.js +21 -0
- package/dist/collection/utils/index.js +2 -1
- package/dist/collection/utils/menu/index.js +1 -0
- package/dist/collection/utils/menu/menu-item.utils.js +81 -0
- package/dist/collection/utils/{__test__ → testing}/index.js +0 -2
- package/dist/collection/utils/testing/mocks/console.js +30 -0
- package/dist/collection/utils/testing/mocks/index.js +4 -0
- package/dist/css/boreal.css +1066 -1074
- package/dist/css/global.css +403 -407
- package/dist/css/theme-connect.css +163 -164
- package/dist/css/theme-engage.css +163 -164
- package/dist/css/theme-protect.css +163 -164
- package/dist/css/theme-proximus.css +164 -165
- package/dist/esm/BaseAttributes-DhSchGPI.js +12 -0
- package/dist/esm/Keys-CzYQb3pP.js +20 -0
- package/dist/esm/bds-avatar.entry.js +87 -0
- package/dist/esm/bds-badge.entry.js +48 -0
- package/dist/esm/bds-banner.entry.js +12 -5
- package/dist/esm/bds-button.entry.js +5 -5
- package/dist/esm/bds-checkbox.entry.js +3 -3
- package/dist/esm/bds-dialog.entry.js +7 -6
- package/dist/esm/bds-divider.entry.js +44 -0
- package/dist/esm/bds-flag.entry.js +3 -3
- package/dist/esm/bds-grid-item.entry.js +91 -0
- package/dist/esm/bds-grid.entry.js +35 -0
- package/dist/esm/bds-list-menu-item.entry.js +466 -0
- package/dist/esm/bds-list-menu.entry.js +128 -0
- package/dist/esm/bds-popover.entry.js +16 -7
- package/dist/esm/bds-spinner.entry.js +4 -4
- package/dist/esm/bds-status.entry.js +57 -0
- package/dist/esm/bds-tag.entry.js +138 -0
- package/dist/esm/bds-text-field.entry.js +5 -15
- package/dist/esm/bds-toggle.entry.js +184 -0
- package/dist/esm/bds-tooltip_2.entry.js +317 -0
- package/dist/esm/boreal-web-components.js +3 -3
- package/dist/esm/{anchored.mixin-Y3MkGc2X.js → getOffset-DKPjeBHi.js} +40 -25
- package/dist/esm/{index-D4EFsvs1.js → index-BqJlOB6b.js} +64 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{states-BhTPNsBb.js → states-Bfazyxqi.js} +8 -1
- package/dist/esm/validateProps-kGnB15Lz.js +39 -0
- package/dist/esm-es5/BaseAttributes-DhSchGPI.js +1 -0
- package/dist/esm-es5/Keys-CzYQb3pP.js +1 -0
- package/dist/esm-es5/bds-avatar.entry.js +1 -0
- package/dist/esm-es5/bds-badge.entry.js +1 -0
- package/dist/esm-es5/bds-banner.entry.js +1 -1
- package/dist/esm-es5/bds-button.entry.js +1 -1
- package/dist/esm-es5/bds-checkbox.entry.js +1 -1
- package/dist/esm-es5/bds-dialog.entry.js +1 -1
- package/dist/esm-es5/bds-divider.entry.js +1 -0
- package/dist/esm-es5/bds-flag.entry.js +1 -1
- package/dist/esm-es5/bds-grid-item.entry.js +1 -0
- package/dist/esm-es5/bds-grid.entry.js +1 -0
- package/dist/esm-es5/bds-list-menu-item.entry.js +1 -0
- package/dist/esm-es5/bds-list-menu.entry.js +1 -0
- package/dist/esm-es5/bds-popover.entry.js +1 -1
- package/dist/esm-es5/bds-spinner.entry.js +1 -1
- package/dist/esm-es5/bds-status.entry.js +1 -0
- package/dist/esm-es5/bds-tag.entry.js +1 -0
- package/dist/esm-es5/bds-text-field.entry.js +1 -1
- package/dist/esm-es5/bds-toggle.entry.js +1 -0
- package/dist/esm-es5/bds-tooltip_2.entry.js +1 -0
- package/dist/esm-es5/boreal-web-components.js +1 -1
- package/dist/esm-es5/form-associated.mixin-CvK2d92c.js +1 -0
- package/dist/esm-es5/getOffset-DKPjeBHi.js +1 -0
- package/dist/esm-es5/index-BqJlOB6b.js +2 -0
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/states-Bfazyxqi.js +1 -0
- package/dist/esm-es5/validateProps-kGnB15Lz.js +1 -0
- package/dist/scss/maps/_primitives.scss +404 -408
- package/dist/scss/maps/_theme-connect.scss +164 -165
- package/dist/scss/maps/_theme-engage.scss +164 -165
- package/dist/scss/maps/_theme-protect.scss +164 -165
- package/dist/scss/maps/_theme-proximus.scss +165 -166
- package/dist/scss/variables/_primitives.scss +404 -408
- package/dist/scss/variables/_theme-connect.scss +164 -165
- package/dist/scss/variables/_theme-engage.scss +164 -165
- package/dist/scss/variables/_theme-protect.scss +164 -165
- package/dist/scss/variables/_theme-proximus.scss +165 -166
- package/dist/types/components/actions/bds-list-menu/bds-list-menu/bds-list-menu.d.ts +70 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/bds-list-menu-item.d.ts +116 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/types/IListMenuItem.d.ts +12 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/types/enum.d.ts +5 -0
- package/dist/types/components/actions/bds-list-menu/bds-list-menu-item/types/types.d.ts +3 -0
- package/dist/types/components/actions/bds-toggle/bds-toggle.d.ts +91 -0
- package/dist/types/components/actions/bds-toggle/types/IEventChange.d.ts +5 -0
- package/dist/types/components/actions/bds-toggle/types/IToggle.d.ts +12 -0
- package/dist/types/components/actions/bds-toggle/types/enum.d.ts +5 -0
- package/dist/types/components/actions/bds-toggle/types/index.d.ts +5 -0
- package/dist/types/components/actions/bds-toggle/types/types.d.ts +3 -0
- package/dist/types/components/feedback/bds-badge/bds-badge.d.ts +31 -0
- package/dist/types/components/feedback/bds-badge/types/IBadge.d.ts +6 -0
- package/dist/types/components/feedback/bds-badge/types/enum.d.ts +9 -0
- package/dist/types/components/feedback/bds-banner/bds-banner.d.ts +8 -4
- package/dist/types/components/feedback/bds-status/bds-status.d.ts +26 -0
- package/dist/types/components/feedback/bds-status/types/IStatus.d.ts +7 -0
- package/dist/types/components/feedback/bds-status/types/enum.d.ts +6 -0
- package/dist/types/components/feedback/bds-status/types/types.d.ts +3 -0
- package/dist/types/components/feedback/bds-tag/bds-tag.d.ts +71 -0
- package/dist/types/components/feedback/bds-tag/types/ITag.d.ts +13 -0
- package/dist/types/components/feedback/bds-tag/types/enum.d.ts +11 -0
- package/dist/types/components/feedback/bds-tag/types/index.d.ts +4 -0
- package/dist/types/components/feedback/bds-tag/types/types.d.ts +8 -0
- package/dist/types/components/forms/bds-flag/bds-flag.d.ts +3 -4
- package/dist/types/components/helpers/bds-divider.d.ts +26 -0
- package/dist/types/components/helpers/types/IDivider.d.ts +5 -0
- package/dist/types/components/helpers/types/enum.d.ts +5 -0
- package/dist/types/components/helpers/types/types.d.ts +3 -0
- package/dist/types/components/images-icons/bds-avatar/bds-avatar.d.ts +51 -0
- package/dist/types/components/images-icons/bds-avatar/types/IAvatar.d.ts +9 -0
- package/dist/types/components/images-icons/bds-avatar/types/enum.d.ts +6 -0
- package/dist/types/components/images-icons/bds-avatar/types/index.d.ts +4 -0
- package/dist/types/components/images-icons/bds-avatar/types/types.d.ts +3 -0
- package/dist/types/components/layouts/bds-grid/grid/bds-grid.d.ts +19 -0
- package/dist/types/components/layouts/bds-grid/grid/types/IGrid.d.ts +6 -0
- package/dist/types/components/layouts/bds-grid/grid/types/enum.d.ts +5 -0
- package/dist/types/components/layouts/bds-grid/grid/types/index.d.ts +4 -0
- package/dist/types/components/layouts/bds-grid/grid/types/types.d.ts +3 -0
- package/dist/types/components/layouts/bds-grid/grid-item/bds-grid-item.d.ts +31 -0
- package/dist/types/components/layouts/bds-grid/grid-item/types/IGridItem.d.ts +12 -0
- package/dist/types/components/layouts/bds-grid/grid-item/types/enum.d.ts +11 -0
- package/dist/types/components/layouts/bds-grid/grid-item/types/index.d.ts +4 -0
- package/dist/types/components/layouts/bds-grid/grid-item/types/types.d.ts +3 -0
- package/dist/types/components/overlays/bds-dialog/bds-dialog.d.ts +2 -2
- package/dist/types/components/overlays/bds-popover/bds-popover.d.ts +1 -0
- package/dist/types/components/overlays/bds-popover/constants/Offset.d.ts +2 -0
- package/dist/types/components/overlays/bds-tooltip/bds-tooltip.d.ts +1 -0
- package/dist/types/components/overlays/bds-tooltip/constants/Offset.d.ts +2 -0
- package/dist/types/components/titles-text/bds-typography/bds-typography.d.ts +9 -9
- package/dist/types/components/titles-text/bds-typography/types/ITypography.d.ts +2 -2
- package/dist/types/components/titles-text/bds-typography/utils/bds-typography-utils.d.ts +1 -1
- package/dist/types/components.d.ts +1268 -54
- package/dist/types/mixins/anchored.mixin.d.ts +5 -0
- package/dist/types/mixins/index.d.ts +2 -0
- package/dist/types/mixins/links.mixin.d.ts +85 -0
- package/dist/types/mixins/menu-behavior.mixin.d.ts +91 -0
- package/dist/types/types/IFormProps.d.ts +25 -0
- package/dist/types/types/index.d.ts +3 -0
- package/dist/types/types/links.d.ts +14 -0
- package/dist/types/types/menu.d.ts +16 -0
- package/dist/types/types/position.d.ts +6 -2
- package/dist/types/utils/constants/common/Keys.d.ts +7 -6
- package/dist/types/utils/helpers/overlays/getOffset.d.ts +9 -0
- package/dist/types/utils/helpers/validateProps.d.ts +11 -0
- package/dist/types/utils/index.d.ts +2 -1
- package/dist/types/utils/menu/index.d.ts +2 -0
- package/dist/types/utils/menu/menu-item.utils.d.ts +50 -0
- package/dist/types/utils/{__test__ → testing}/index.d.ts +0 -2
- package/dist/types/utils/{__test__/backdrop-mock.d.ts → testing/mocks/backdrop.d.ts} +1 -1
- package/dist/types/utils/testing/mocks/console.d.ts +17 -0
- package/dist/types/utils/{__test__/mocks/ElementInternals.d.ts → testing/mocks/elementInternals.d.ts} +1 -1
- package/dist/types/utils/testing/mocks/index.d.ts +5 -0
- package/dist/types/utils/{__test__/popover-mock.d.ts → testing/mocks/popover.d.ts} +1 -1
- package/package.json +1 -1
- package/components-build/p-B6R9EVXK.js +0 -1
- package/components-build/p-BSpJ_e9f.js +0 -1
- package/components-build/p-BYEAJCas.js +0 -1
- package/components-build/p-BhTPNsBb.js +0 -1
- package/components-build/p-CYojP4vI.js +0 -1
- package/components-build/p-D5omSME4.js +0 -1
- package/components-build/p-vfAIdwy0.js +0 -1
- package/dist/boreal-web-components/p-07a933df.entry.js +0 -1
- package/dist/boreal-web-components/p-1bb2b33f.entry.js +0 -1
- package/dist/boreal-web-components/p-1fccea3f.system.entry.js +0 -1
- package/dist/boreal-web-components/p-20af732b.system.entry.js +0 -1
- package/dist/boreal-web-components/p-39c26e58.entry.js +0 -1
- package/dist/boreal-web-components/p-6210d025.entry.js +0 -1
- package/dist/boreal-web-components/p-91b9e94e.entry.js +0 -1
- package/dist/boreal-web-components/p-9e06910d.system.entry.js +0 -1
- package/dist/boreal-web-components/p-BIJhHSAt.system.js +0 -1
- package/dist/boreal-web-components/p-BKRyWlfr.js +0 -1
- package/dist/boreal-web-components/p-BhTPNsBb.js +0 -1
- package/dist/boreal-web-components/p-DoDeP7KR.system.js +0 -1
- package/dist/boreal-web-components/p-Dtp4O0H2.system.js +0 -1
- package/dist/boreal-web-components/p-Dy7QKP9e.js +0 -1
- package/dist/boreal-web-components/p-GjKJvOVG.system.js +0 -2
- package/dist/boreal-web-components/p-ac64d4a5.system.entry.js +0 -1
- package/dist/boreal-web-components/p-b61fe06c.entry.js +0 -1
- package/dist/boreal-web-components/p-cdc87437.entry.js +0 -1
- package/dist/boreal-web-components/p-d8ec8557.system.entry.js +0 -1
- package/dist/boreal-web-components/p-ea889727.entry.js +0 -1
- package/dist/boreal-web-components/p-fa327346.system.entry.js +0 -1
- package/dist/boreal-web-components/p-sDZFaZMN.system.js +0 -1
- package/dist/boreal-web-components/p-vfAIdwy0.js +0 -1
- package/dist/cjs/bds-tooltip.cjs.entry.js +0 -152
- package/dist/cjs/bds-typography.cjs.entry.js +0 -168
- package/dist/cjs/validateProps-BNOBk1Xs.js +0 -20
- package/dist/collection/utils/__test__/mocks/index.js +0 -1
- package/dist/esm/bds-tooltip.entry.js +0 -150
- package/dist/esm/bds-typography.entry.js +0 -166
- package/dist/esm/validateProps-vfAIdwy0.js +0 -18
- package/dist/esm-es5/anchored.mixin-Y3MkGc2X.js +0 -1
- package/dist/esm-es5/bds-tooltip.entry.js +0 -1
- package/dist/esm-es5/bds-typography.entry.js +0 -1
- package/dist/esm-es5/index-D4EFsvs1.js +0 -2
- package/dist/esm-es5/internals-Dy7QKP9e.js +0 -1
- package/dist/esm-es5/states-BhTPNsBb.js +0 -1
- package/dist/esm-es5/validateProps-vfAIdwy0.js +0 -1
- package/dist/types/utils/__test__/mocks/index.d.ts +0 -2
- package/dist/cjs/{internals-X77qKxsK.js → form-associated.mixin-DXwvF_vW.js} +30 -30
- package/dist/collection/utils/{__test__ → testing}/constants.js +0 -0
- package/dist/collection/utils/{__test__ → testing}/fixtures.js +0 -0
- package/dist/collection/utils/{__test__ → testing}/helpers.js +0 -0
- package/dist/collection/utils/{__test__/backdrop-mock.js → testing/mocks/backdrop.js} +0 -0
- package/dist/collection/utils/{__test__/mocks/ElementInternals.js → testing/mocks/elementInternals.js} +0 -0
- package/dist/collection/utils/{__test__/popover-mock.js → testing/mocks/popover.js} +0 -0
- package/dist/esm/{internals-Dy7QKP9e.js → form-associated.mixin-CvK2d92c.js} +30 -30
- /package/dist/types/utils/{__test__ → testing}/constants.d.ts +0 -0
- /package/dist/types/utils/{__test__ → testing}/fixtures.d.ts +0 -0
- /package/dist/types/utils/{__test__ → testing}/helpers.d.ts +0 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
import { M as Mixin, r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-BqJlOB6b.js';
|
|
2
|
+
import { C as COMPONENT_STATES } from './states-Bfazyxqi.js';
|
|
3
|
+
import { v as validatePropValue } from './validateProps-kGnB15Lz.js';
|
|
4
|
+
import { K as KEYBOARD } from './Keys-CzYQb3pP.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Resolves the appropriate ARIA role for a menu item.
|
|
8
|
+
* @param {MenuRole} role - The role of the parent menu container ('menu' or 'listbox').
|
|
9
|
+
* @returns {MenuItemRole} - Returns 'menuitem' if parent is 'menu', otherwise 'option'.
|
|
10
|
+
* @example
|
|
11
|
+
* const itemRole = resolveMenuItemRole('menu'); // returns 'menuitem'
|
|
12
|
+
*/
|
|
13
|
+
function resolveMenuItemRole(role) {
|
|
14
|
+
return role === 'menu' ? 'menuitem' : 'option';
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Determines the aria-selected value based on the item's role and state.
|
|
18
|
+
* @param {MenuItemRole} role - The role of the item ('menuitem' or 'option').
|
|
19
|
+
* @param {boolean} selected - The current selection state of the item.
|
|
20
|
+
* @returns {string | null} - Returns the string representation of the boolean if role is 'option', otherwise null.
|
|
21
|
+
* @example
|
|
22
|
+
* const attr = resolveAriaSelected('option', true); // returns 'true'
|
|
23
|
+
* const attrNull = resolveAriaSelected('menuitem', true); // returns null
|
|
24
|
+
*/
|
|
25
|
+
function resolveAriaSelected(role, selected) {
|
|
26
|
+
return role === 'option' ? String(selected) : null;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Resolves the tabIndex attribute for keyboard navigation.
|
|
30
|
+
* @param {MenuItemRole} role - The role of the item.
|
|
31
|
+
* @param {boolean} disabled - Whether the item is currently disabled.
|
|
32
|
+
* @param {boolean} selected - Whether the item is currently selected.
|
|
33
|
+
* @param {boolean} active - Whether the item is currently active.
|
|
34
|
+
* @returns {number} - Returns 0 for focusable menu items, or -1 for disabled/options.
|
|
35
|
+
* @example
|
|
36
|
+
* const index = resolveTabIndex('menuitem', false); // returns 0
|
|
37
|
+
* const indexDisabled = resolveTabIndex('menuitem', true); // returns -1
|
|
38
|
+
*/
|
|
39
|
+
function resolveTabIndex(role, disabled, selected, active) {
|
|
40
|
+
if (disabled)
|
|
41
|
+
return -1;
|
|
42
|
+
if (role === 'option')
|
|
43
|
+
return selected || active ? 0 : -1;
|
|
44
|
+
if (role === 'menuitem')
|
|
45
|
+
return active ? 0 : -1;
|
|
46
|
+
return -1;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Manages focus and activation through keyboard events.
|
|
50
|
+
* @param {KeyboardEvent} event - The keyboard event object from the listener.
|
|
51
|
+
* @param {HTMLElement[]} items - An array of focusable HTML elements within the menu.
|
|
52
|
+
* @param {number} currentIndex - The index of the currently focused item.
|
|
53
|
+
* @returns {void}
|
|
54
|
+
* @example
|
|
55
|
+
* handleMenuKeyNavigation(event, menuItems, 2);
|
|
56
|
+
*/
|
|
57
|
+
function handleMenuKeyNavigation(event, items, currentIndex) {
|
|
58
|
+
if (items.length === 0 || currentIndex === -1)
|
|
59
|
+
return;
|
|
60
|
+
let nextIndex = -1;
|
|
61
|
+
switch (event.key) {
|
|
62
|
+
case KEYBOARD.ArrowDown.key:
|
|
63
|
+
nextIndex = (currentIndex + 1) % items.length;
|
|
64
|
+
break;
|
|
65
|
+
case KEYBOARD.ArrowUp.key:
|
|
66
|
+
nextIndex = (currentIndex - 1 + items.length) % items.length;
|
|
67
|
+
break;
|
|
68
|
+
default:
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
items[nextIndex].focus();
|
|
72
|
+
}
|
|
73
|
+
/** Prevents default browser behavior for specific navigation keys.
|
|
74
|
+
* @param {KeyboardEvent} e - The keyboard event to evaluate.
|
|
75
|
+
* @returns {void}
|
|
76
|
+
* @example
|
|
77
|
+
* // Inside a keydown listener:
|
|
78
|
+
* preventNavigationKeys(event);
|
|
79
|
+
*/
|
|
80
|
+
function preventNavigationKeys(e) {
|
|
81
|
+
const navigationKeys = [KEYBOARD.ArrowDown.key, KEYBOARD.ArrowUp.key, KEYBOARD.Enter.key, KEYBOARD.Space.key];
|
|
82
|
+
if (navigationKeys.includes(e.key)) {
|
|
83
|
+
e.preventDefault();
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* A Mixin that provides menu item behaviors, including ARIA roles,
|
|
89
|
+
* focus management, and keyboard navigation logic.
|
|
90
|
+
* This mixin is designed to be used with Stencil components that represent items within a menu or listbox,
|
|
91
|
+
* allowing them to automatically adapt their behavior based on the context of their parent container.
|
|
92
|
+
*
|
|
93
|
+
* The mixin includes:
|
|
94
|
+
* - Dynamic ARIA role resolution based on the nearest parent menu or listbox.
|
|
95
|
+
* - Computation of aria-selected and tabIndex attributes for accessibility.
|
|
96
|
+
* - A method to handle keyboard navigation (Arrow keys, Enter, Space) within the menu context.
|
|
97
|
+
*
|
|
98
|
+
*
|
|
99
|
+
* @typeParam B - The base constructor type.
|
|
100
|
+
* @param {B} Base - The base component class to be extended.
|
|
101
|
+
* @returns {MenuBehaviorMixin} - A class with injected menu behaviors.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```tsx
|
|
105
|
+
* import { Component, h } from '@stencil/core';
|
|
106
|
+
* import { MenuItemBehavior } from '@/mixins/menu-behavior.mixin';
|
|
107
|
+
*
|
|
108
|
+
* @Component({
|
|
109
|
+
* tag: 'my-menu-item',
|
|
110
|
+
* styleUrl: 'my-menu-item.scss',
|
|
111
|
+
* })
|
|
112
|
+
* export class MyMenuItem extends Mixin(MenuItemBehavior) {
|
|
113
|
+
* @Element() el!: HTMLElement;
|
|
114
|
+
* @Prop() disabled: boolean = false;
|
|
115
|
+
* @Prop() selected: boolean = false;
|
|
116
|
+
*
|
|
117
|
+
* private handleKeyDown = (e: KeyboardEvent) => {
|
|
118
|
+
* if (this.disabled) return;
|
|
119
|
+
* this.handleKeyDownLogic(e, () => this.handleSelection());
|
|
120
|
+
* };
|
|
121
|
+
*
|
|
122
|
+
* render() {
|
|
123
|
+
* return (
|
|
124
|
+
* <Host
|
|
125
|
+
* role={this.menuItemRole}
|
|
126
|
+
* aria-selected={this.ariaSelected}
|
|
127
|
+
* tabIndex={ this.itemTabIndex}
|
|
128
|
+
* onKeyDown={this.handleKeyDown} >
|
|
129
|
+
* <slot />
|
|
130
|
+
* </Host>
|
|
131
|
+
* );
|
|
132
|
+
* }
|
|
133
|
+
* } ```
|
|
134
|
+
*
|
|
135
|
+
*
|
|
136
|
+
*/
|
|
137
|
+
const MenuItemBehavior = (Base) => {
|
|
138
|
+
class MenuBehaviorMixin extends Base {
|
|
139
|
+
constructor() {
|
|
140
|
+
super(...arguments);
|
|
141
|
+
this.disabled = false;
|
|
142
|
+
this.selected = false;
|
|
143
|
+
this.activeItem = false;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Detects the ARIA role of the nearest parent menu or listbox.
|
|
147
|
+
* @returns {MenuRole | null} - 'menu', 'listbox', or null if not found.
|
|
148
|
+
*/
|
|
149
|
+
get parentRole() {
|
|
150
|
+
const parent = this.el.closest('[role="menu"], [role="listbox"]');
|
|
151
|
+
return parent !== null ? parent.getAttribute('role') : null;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Resolves the specific item role ('menuitem' or 'option').
|
|
155
|
+
* Defaults to 'menuitem' if no parent is detected.
|
|
156
|
+
* @returns {MenuItemRole}
|
|
157
|
+
*/
|
|
158
|
+
get menuItemRole() {
|
|
159
|
+
return resolveMenuItemRole(this.parentRole || 'menu');
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Returns the 'aria-selected' value as a string for listbox options.
|
|
163
|
+
* @returns {string | null}
|
|
164
|
+
*/
|
|
165
|
+
get ariaSelected() {
|
|
166
|
+
return resolveAriaSelected(this.menuItemRole, this.selected);
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Calculates the tabIndex for the item.
|
|
170
|
+
* @returns {number} 0 for focusable menu items, -1 otherwise.
|
|
171
|
+
*/
|
|
172
|
+
get itemTabIndex() {
|
|
173
|
+
return resolveTabIndex(this.menuItemRole, this.disabled, this.selected, this.activeItem);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Processes keyboard events for arrow navigation and activation.
|
|
177
|
+
* @param {KeyboardEvent} e - The native keyboard event.
|
|
178
|
+
* @param {() => void} onActivate - Function to execute when Enter or Space is pressed.
|
|
179
|
+
* @example
|
|
180
|
+
* // Inside a component's keydown listener:
|
|
181
|
+
* this.handleKeyDownLogic(event, () => this.emitSelection());
|
|
182
|
+
*/
|
|
183
|
+
handleKeyDownLogic(e, onActivate) {
|
|
184
|
+
preventNavigationKeys(e);
|
|
185
|
+
if (e.key === KEYBOARD.Enter.key || e.key === KEYBOARD.Space.key) {
|
|
186
|
+
onActivate();
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const parent = this.el.closest("[role='menu'], [role='listbox']");
|
|
190
|
+
if (parent === null)
|
|
191
|
+
return;
|
|
192
|
+
const items = Array.from(parent.querySelectorAll(`${this.el.tagName.toLocaleLowerCase()}:not([disabled]):not([variant="label"])`));
|
|
193
|
+
const currentIndex = items.indexOf(this.el);
|
|
194
|
+
handleMenuKeyNavigation(e, items, currentIndex);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return MenuBehaviorMixin;
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Creates a mixin that adds link-related properties and behaviors to a base class.
|
|
202
|
+
* It provides computed attributes for links, handles keyboard interactions, and sanitizes URLs to ensure security.
|
|
203
|
+
* It allows components to easily handle link attributes and execute link events.
|
|
204
|
+
*
|
|
205
|
+
* This mixin includes:
|
|
206
|
+
* - `href`: The URL the link points to.
|
|
207
|
+
* - `newTab`: Whether the link should open in a new tab.
|
|
208
|
+
* - `downloadable`: Whether the link should be treated as a download.
|
|
209
|
+
* - `filename`: The filename to use when downloading.
|
|
210
|
+
* - `getLinkAttributes`: A computed property that returns the appropriate attributes for the link based on its state and props.
|
|
211
|
+
* - `handleLinkKeyDown`: A method to handle keyboard interactions for accessibility.
|
|
212
|
+
* - `handleLinkClick`: A method to manage click behavior, including external links and downloads.
|
|
213
|
+
* - `sanitizeUrl`: A utility method to sanitize URLs and prevent XSS vulnerabilities.
|
|
214
|
+
*
|
|
215
|
+
* @typeParam T - The base constructor type to extend.
|
|
216
|
+
* @param {T} Base - The base component class to be extended.
|
|
217
|
+
* @returns {WithLinks} - A class with injected link behaviors.
|
|
218
|
+
*
|
|
219
|
+
* @example
|
|
220
|
+
* ```tsx
|
|
221
|
+
* import { Component, h } from '@stencil/core';
|
|
222
|
+
* import { WithLinks } from '@/mixins/links.mixin';
|
|
223
|
+
*
|
|
224
|
+
* @Component({
|
|
225
|
+
* tag: 'my-link',
|
|
226
|
+
* styleUrl: 'my-link.scss',
|
|
227
|
+
* })
|
|
228
|
+
* class MyLink extends Mixin(WithLinks) {
|
|
229
|
+
* @Element() el!: HTMLElement;
|
|
230
|
+
* @Prop() href: string = '';
|
|
231
|
+
* @Prop() newTab: boolean = false;
|
|
232
|
+
* @Prop() downloadable: boolean = false;
|
|
233
|
+
* @Prop() filename: string = '';
|
|
234
|
+
* @Prop() disabled: boolean = false;
|
|
235
|
+
*
|
|
236
|
+
* private handleKeyDown = (e: KeyboardEvent) => {
|
|
237
|
+
* if (this.disabled) return;
|
|
238
|
+
* this.handleLinkKeyDown(e);
|
|
239
|
+
* };
|
|
240
|
+
*
|
|
241
|
+
* render() {
|
|
242
|
+
* return (
|
|
243
|
+
* <Host
|
|
244
|
+
* {...this.getLinkAttributes}
|
|
245
|
+
* onKeyDown={this.handleKeyDown} >
|
|
246
|
+
* <slot />
|
|
247
|
+
* </Host>
|
|
248
|
+
* );
|
|
249
|
+
* }
|
|
250
|
+
* } ```
|
|
251
|
+
*
|
|
252
|
+
*/
|
|
253
|
+
const WithLinks = (Base) => {
|
|
254
|
+
class WithLinks extends Base {
|
|
255
|
+
constructor() {
|
|
256
|
+
super(...arguments);
|
|
257
|
+
this.href = '';
|
|
258
|
+
this.newTab = false;
|
|
259
|
+
this.download = '';
|
|
260
|
+
}
|
|
261
|
+
get isLink() {
|
|
262
|
+
return this.href !== '' || this.download !== '';
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* Computes the appropriate link attributes based on the component's props and state.
|
|
266
|
+
* It handles external links, new tab behavior, and download attributes while ensuring accessibility.
|
|
267
|
+
* @returns {LinksAttrs} - The computed link attributes.
|
|
268
|
+
* */
|
|
269
|
+
get linkAttributes() {
|
|
270
|
+
const attributes = {};
|
|
271
|
+
if (!this.isLink)
|
|
272
|
+
return attributes;
|
|
273
|
+
const sanitizedHref = this.sanitizeUrl(this.href);
|
|
274
|
+
attributes.href = sanitizedHref;
|
|
275
|
+
attributes.target = this.newTab ? '_blank' : '_self';
|
|
276
|
+
attributes.rel =
|
|
277
|
+
this._isExternalLink(sanitizedHref) || this.newTab || this.download !== '' ? 'noopener noreferrer' : '';
|
|
278
|
+
attributes.download = this.download !== '' ? this.download : undefined;
|
|
279
|
+
if (this.el.tagName.toLowerCase() !== 'a') {
|
|
280
|
+
attributes.role = 'link';
|
|
281
|
+
attributes.tabindex = '0';
|
|
282
|
+
}
|
|
283
|
+
return attributes;
|
|
284
|
+
}
|
|
285
|
+
_isExternalLink(url) {
|
|
286
|
+
const isExternal = /^https?:\/\//.test(url) && !url.includes(window.location.hostname);
|
|
287
|
+
return isExternal;
|
|
288
|
+
}
|
|
289
|
+
/** Keydown handler to allow keyboard interaction with the link */
|
|
290
|
+
handleLinkKeyDown(event) {
|
|
291
|
+
if (!this.isLink)
|
|
292
|
+
return;
|
|
293
|
+
if (this.el.tagName.toLowerCase() !== 'a' &&
|
|
294
|
+
(event.key === KEYBOARD.Enter.key || event.key === KEYBOARD.Space.key)) {
|
|
295
|
+
event.preventDefault();
|
|
296
|
+
this.handleLinkClick(new MouseEvent('click', { bubbles: true, cancelable: true }));
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/** Click handler to manage link behavior, including external links and downloads */
|
|
300
|
+
handleLinkClick(event) {
|
|
301
|
+
if (!this.isLink) {
|
|
302
|
+
event.preventDefault();
|
|
303
|
+
return;
|
|
304
|
+
}
|
|
305
|
+
const attributes = this.linkAttributes;
|
|
306
|
+
if (attributes.download !== '' && attributes.download !== undefined) {
|
|
307
|
+
event.preventDefault();
|
|
308
|
+
const logger = document.createElement('a');
|
|
309
|
+
logger.href = attributes.download || '';
|
|
310
|
+
logger.download = attributes.download;
|
|
311
|
+
logger.style.display = 'none';
|
|
312
|
+
document.body.appendChild(logger);
|
|
313
|
+
console.log('Initiating download:', logger.href);
|
|
314
|
+
logger.click();
|
|
315
|
+
document.body.removeChild(logger);
|
|
316
|
+
}
|
|
317
|
+
if (this.el.tagName.toLowerCase() !== 'a') {
|
|
318
|
+
if (attributes.target === '_blank') {
|
|
319
|
+
window.open(attributes.href, '_blank', attributes.rel);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
window.location.href = attributes.href || '';
|
|
323
|
+
}
|
|
324
|
+
event.preventDefault();
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
/** Sanitizes the URL to prevent XSS vulnerabilities. It removes dangerous protocols and ensures valid URLs.
|
|
328
|
+
* @param {string} url - The URL to sanitize.
|
|
329
|
+
* @returns {string} - The sanitized URL, or an empty string if the URL is deemed unsafe.
|
|
330
|
+
* @example
|
|
331
|
+
* const safeUrl = sanitizeUrl('https://example.com'); // returns 'https://example.com'
|
|
332
|
+
* const unsafeUrl = sanitizeUrl('javascript:alert(1)'); // returns ''
|
|
333
|
+
*/
|
|
334
|
+
sanitizeUrl(url) {
|
|
335
|
+
const sanitized = url.trim().toLowerCase();
|
|
336
|
+
if (sanitized.startsWith('javascript:') || sanitized.startsWith('data:') || sanitized.includes('\0')) {
|
|
337
|
+
return '';
|
|
338
|
+
}
|
|
339
|
+
if (!sanitized.startsWith('http://') &&
|
|
340
|
+
!sanitized.startsWith('https://') &&
|
|
341
|
+
!sanitized.startsWith('mailto:') &&
|
|
342
|
+
!sanitized.startsWith('tel:') &&
|
|
343
|
+
!sanitized.startsWith('/') &&
|
|
344
|
+
!sanitized.startsWith('#')) {
|
|
345
|
+
return sanitized.startsWith('://') ? '' : `https://${url}`;
|
|
346
|
+
}
|
|
347
|
+
return url;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return WithLinks;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
const LIST_MENU_ITEM_VARIANTS = {
|
|
354
|
+
LABEL: 'label',
|
|
355
|
+
BUTTON: 'button',
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
const bdsListMenuItemCss = () => `@charset "UTF-8";.bds-list-item,.bds-list-item__content,.bds-list-item__content--left,.bds-list-item__content--right{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.bds-list-item{font-family:var(--boreal-typography-font-family-primary);-ms-flex-item-align:stretch;align-self:stretch;color:var(--boreal-text-default);width:100%;font-size:var(--boreal-typography-font-size-sm);font-style:normal;font-weight:var(--boreal-typography-font-weight-regular);line-height:var(--boreal-typography-line-height-sm)}.bds-list-item__content{-ms-flex-pack:justify;justify-content:space-between;width:100%;gap:var(--boreal-spacing-3xs)}.bds-list-item__content [class*=bds-icon-]{font-size:var(--boreal-typography-font-size-md)}.bds-list-item--button{cursor:pointer;padding:var(--boreal-spacing-2xs) var(--boreal-spacing-s);-webkit-transition:background-color 0.3s ease, border-color 0.3s ease, -webkit-box-shadow 0.3s ease;transition:background-color 0.3s ease, border-color 0.3s ease, -webkit-box-shadow 0.3s ease;transition:background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;transition:background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, -webkit-box-shadow 0.3s ease}.bds-list-item--button:not(.bds-list-item--disabled):hover:not([selected]){background-color:var(--boreal-ui-default-lighter);-webkit-box-shadow:0 1px 2px 0 rgba(19, 19, 22, 0.15);box-shadow:0 1px 2px 0 rgba(19, 19, 22, 0.15)}.bds-list-item--button:not(.bds-list-item--disabled):focus,.bds-list-item--button:not(.bds-list-item--disabled):focus-visible{outline:none;-webkit-box-shadow:0 0 0 1px var(--boreal-ui-inverse), 0 0 0 3px var(--boreal-stroke-focus);box-shadow:0 0 0 1px var(--boreal-ui-inverse), 0 0 0 3px var(--boreal-stroke-focus);z-index:1}.bds-list-item--button:not(.bds-list-item--disabled):active,.bds-list-item--button:not(.bds-list-item--disabled).bds-list-item--state-active{-webkit-box-shadow:0 0 0 1px var(--boreal-ui-inverse), 0 0 0 3px var(--boreal-stroke-focus), 0 1px 2px 0 rgba(19, 19, 22, 0.15) inset;box-shadow:0 0 0 1px var(--boreal-ui-inverse), 0 0 0 3px var(--boreal-stroke-focus), 0 1px 2px 0 rgba(19, 19, 22, 0.15) inset;background-color:var(--boreal-ui-default-lighter)}.bds-list-item--selected{background-color:var(--boreal-ui-primary-lighter)}.bds-list-item--disabled{color:var(--boreal-text-disabled);cursor:not-allowed}.bds-list-item--label{cursor:default;padding:var(--boreal-spacing-3xs) 0}.bds-list-item--label .bds-typography label{color:var(--boreal-text-default-light)}`;
|
|
359
|
+
|
|
360
|
+
const BdsListMenuItem = class extends Mixin(MenuItemBehavior, WithLinks) {
|
|
361
|
+
constructor(hostRef) {
|
|
362
|
+
super();
|
|
363
|
+
registerInstance(this, hostRef);
|
|
364
|
+
this.bdsSelect = createEvent(this, "bdsSelect");
|
|
365
|
+
/**
|
|
366
|
+
* Defines the visual style of the list menu item.
|
|
367
|
+
* - 'button': A standard clickable item.
|
|
368
|
+
* - 'label': A non-interactive label, typically used for grouping items.
|
|
369
|
+
*/
|
|
370
|
+
this.variant = LIST_MENU_ITEM_VARIANTS.BUTTON;
|
|
371
|
+
/** The name of the list menu item */
|
|
372
|
+
this.name = '';
|
|
373
|
+
/** Disabled state item */
|
|
374
|
+
this.disabled = false;
|
|
375
|
+
/** Selected item state */
|
|
376
|
+
this.selected = false;
|
|
377
|
+
/** Value associated with the menu item */
|
|
378
|
+
this.value = '';
|
|
379
|
+
/** Active state item */
|
|
380
|
+
this.activeItem = false;
|
|
381
|
+
/** Link behavior props */
|
|
382
|
+
this.href = '';
|
|
383
|
+
/** Opens the link in a new tab if true */
|
|
384
|
+
this.newTab = false;
|
|
385
|
+
/** Makes the link downloadable if true */
|
|
386
|
+
this.download = '';
|
|
387
|
+
/** State to manage click and keyboard interaction states */
|
|
388
|
+
this.currentState = COMPONENT_STATES.DEFAULT;
|
|
389
|
+
/** Event to notify when the menu item is clicked */
|
|
390
|
+
this.handleClick = (e) => {
|
|
391
|
+
if (this.disabled || this.isLabelVariant)
|
|
392
|
+
return;
|
|
393
|
+
if (this.isLink) {
|
|
394
|
+
this.handleLinkClick(e);
|
|
395
|
+
return;
|
|
396
|
+
}
|
|
397
|
+
this.bdsSelect.emit({
|
|
398
|
+
value: this.value,
|
|
399
|
+
selected: !this.selected,
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
/** Event to handle keydown navigation and trigger click */
|
|
403
|
+
this.handleKeyDown = (e) => {
|
|
404
|
+
if (this.disabled || this.isLabelVariant)
|
|
405
|
+
return;
|
|
406
|
+
this.handleKeyDownLogic(e, () => this.handleClick(e));
|
|
407
|
+
// If the item is a link, we dont activate this animation
|
|
408
|
+
if (!this.isLink || this.linkAttributes.download !== undefined) {
|
|
409
|
+
this.currentState =
|
|
410
|
+
e.key === KEYBOARD.Enter.key || e.key === KEYBOARD.Space.key ? COMPONENT_STATES.ACTIVE : this.currentState;
|
|
411
|
+
}
|
|
412
|
+
};
|
|
413
|
+
/** Event to handle keyup navigation and reset active state */
|
|
414
|
+
this.handleKeyUp = () => {
|
|
415
|
+
if (this.disabled || this.isLabelVariant)
|
|
416
|
+
return;
|
|
417
|
+
this.currentState = COMPONENT_STATES.DEFAULT;
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
checkPropsVariant() {
|
|
421
|
+
validatePropValue(Object.values(LIST_MENU_ITEM_VARIANTS), LIST_MENU_ITEM_VARIANTS.BUTTON, this.el, 'variant');
|
|
422
|
+
}
|
|
423
|
+
/** Lifecycle method called before the component is loaded */
|
|
424
|
+
componentWillLoad() {
|
|
425
|
+
this.checkPropsVariant();
|
|
426
|
+
}
|
|
427
|
+
/** Checks if the variant is a label */
|
|
428
|
+
get isLabelVariant() {
|
|
429
|
+
return this.variant === LIST_MENU_ITEM_VARIANTS.LABEL;
|
|
430
|
+
}
|
|
431
|
+
/** Returns the class map for the list menu item */
|
|
432
|
+
get classMap() {
|
|
433
|
+
return {
|
|
434
|
+
'bds-list-item': true,
|
|
435
|
+
'bds-list-item--disabled': this.disabled,
|
|
436
|
+
'bds-list-item--selected': this.selected,
|
|
437
|
+
[`bds-list-item--state-${this.currentState}`]: true,
|
|
438
|
+
[`bds-list-item--${this.variant}`]: true,
|
|
439
|
+
};
|
|
440
|
+
}
|
|
441
|
+
/** Return the render for the label variant of the list menu item */
|
|
442
|
+
renderTypeLabel() {
|
|
443
|
+
return (h("bds-typography", { variant: "label", element: "label", align: "start", role: "presentation" }, h("slot", { name: "left-content" }), " ", h("slot", null)));
|
|
444
|
+
}
|
|
445
|
+
/** Return the render for the button variant of the list menu item */
|
|
446
|
+
renderTypeButton() {
|
|
447
|
+
return (h("div", { class: "bds-list-item__content" }, h("div", { class: "bds-list-item__content--left" }, h("slot", { name: "left-content" }), h("slot", null)), h("div", { class: "bds-list-item__content--right" }, h("slot", { name: "right-content" }))));
|
|
448
|
+
}
|
|
449
|
+
/** Main render */
|
|
450
|
+
render() {
|
|
451
|
+
let renderItem = this.renderTypeButton();
|
|
452
|
+
if (this.isLabelVariant)
|
|
453
|
+
renderItem = this.renderTypeLabel();
|
|
454
|
+
const linkAttributes = this.isLink ? { ...this.linkAttributes, tabindex: this.activeItem ? 0 : -1 } : {};
|
|
455
|
+
return (h(Host, { key: 'ccf9e4a413fd0f13e38f040a0da92493c84d5ae2', class: this.classMap, role: this.isLabelVariant ? 'presentation' : this.menuItemRole, "aria-selected": this.ariaSelected, tabIndex: this.isLabelVariant ? -1 : this.itemTabIndex, onClick: this.handleClick, onKeyDown: this.handleKeyDown, onKeyUp: this.handleKeyUp, ...linkAttributes }, renderItem));
|
|
456
|
+
}
|
|
457
|
+
get el() { return getElement(this); }
|
|
458
|
+
static get watchers() { return {
|
|
459
|
+
"variant": [{
|
|
460
|
+
"checkPropsVariant": 0
|
|
461
|
+
}]
|
|
462
|
+
}; }
|
|
463
|
+
};
|
|
464
|
+
BdsListMenuItem.style = bdsListMenuItemCss();
|
|
465
|
+
|
|
466
|
+
export { BdsListMenuItem as bds_list_menu_item };
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { r as registerInstance, c as createEvent, h, a as Host, g as getElement } from './index-BqJlOB6b.js';
|
|
2
|
+
|
|
3
|
+
const bdsListMenuCss = () => `@charset "UTF-8";:host{display:block}.bds-list-menu{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;max-width:350px}`;
|
|
4
|
+
|
|
5
|
+
const BdsListMenu = class {
|
|
6
|
+
constructor(hostRef) {
|
|
7
|
+
registerInstance(this, hostRef);
|
|
8
|
+
this.bdsChange = createEvent(this, "bdsChange");
|
|
9
|
+
this.bdsClicked = createEvent(this, "bdsClicked");
|
|
10
|
+
/** If true, allows multiple items to be selected. Default is false (single selection). */
|
|
11
|
+
this.multiple = false;
|
|
12
|
+
/** Defines the ARIA role of the menu. Can be 'menu' or 'listbox'. Default is 'menu'. */
|
|
13
|
+
this.menuRole = 'menu';
|
|
14
|
+
/** State to manage selected values */
|
|
15
|
+
this.selectedValues = [];
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the currently selected value(s) programmatically.
|
|
19
|
+
* @method getSelectedValues
|
|
20
|
+
* @returns {Promise<string | string[]>} The selected value(s) based on the 'multiple' prop.
|
|
21
|
+
*/
|
|
22
|
+
async getSelectedValues() {
|
|
23
|
+
return this.multiple ? this.selectedValues : this.selectedValues[0];
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Sets the selected values programmatically.
|
|
27
|
+
* Useful for initializing the menu from an external data source or form reset.
|
|
28
|
+
* @method setSelectedValues
|
|
29
|
+
* @param {string | string[]} values - The value or values to be marked as selected.
|
|
30
|
+
*/
|
|
31
|
+
async setSelectedValues(values) {
|
|
32
|
+
if (this.multiple) {
|
|
33
|
+
this.selectedValues = Array.isArray(values) ? values : [values];
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.selectedValues = values !== null ? [values] : [];
|
|
37
|
+
}
|
|
38
|
+
this.updateChildrenState();
|
|
39
|
+
}
|
|
40
|
+
/** Handles the click event on a menu item, updating the selection state accordingly. */
|
|
41
|
+
handleItemClick(event) {
|
|
42
|
+
const { value, selected } = event.detail;
|
|
43
|
+
if (this.menuRole === 'listbox') {
|
|
44
|
+
if (this.multiple) {
|
|
45
|
+
this.handleMultipleSelection(value, selected);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
this.handleSingleSelection(value, selected);
|
|
49
|
+
}
|
|
50
|
+
this.bdsChange.emit(this.multiple ? this.selectedValues : this.selectedValues[0] || undefined);
|
|
51
|
+
this.updateChildrenState();
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
this.bdsClicked.emit(event.target);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/** Initializes the selected values based on the child menu items that have the 'selected' attribute set. */
|
|
58
|
+
componentWillLoad() {
|
|
59
|
+
this.initialSelectedValues();
|
|
60
|
+
this.updateActiveState();
|
|
61
|
+
}
|
|
62
|
+
/** Get all child menu items */
|
|
63
|
+
get childItems() {
|
|
64
|
+
const items = Array.from(this.el.querySelectorAll('bds-list-menu-item'));
|
|
65
|
+
return items;
|
|
66
|
+
}
|
|
67
|
+
/** First clickable element */
|
|
68
|
+
get firstEnabledItem() {
|
|
69
|
+
const items = this.childItems;
|
|
70
|
+
const firstEnabled = items.find(item => !item.disabled && item.variant !== 'label');
|
|
71
|
+
return firstEnabled;
|
|
72
|
+
}
|
|
73
|
+
/** Updates the active state of the menu items based on the current selection. */
|
|
74
|
+
updateActiveState() {
|
|
75
|
+
const firstEnabled = this.firstEnabledItem;
|
|
76
|
+
const items = this.childItems;
|
|
77
|
+
const hasSelection = items.some(item => item.selected && !item.disabled);
|
|
78
|
+
if (!hasSelection && firstEnabled !== undefined) {
|
|
79
|
+
firstEnabled.setAttribute('active-item', '');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/** Handles selection logic for multiple selection mode. */
|
|
83
|
+
handleMultipleSelection(value, selected) {
|
|
84
|
+
this.selectedValues = selected
|
|
85
|
+
? [...this.selectedValues, value]
|
|
86
|
+
: this.selectedValues.filter(v => v !== value);
|
|
87
|
+
}
|
|
88
|
+
/** Handles selection logic for single selection mode. */
|
|
89
|
+
handleSingleSelection(value, selected) {
|
|
90
|
+
this.selectedValues = selected ? [value] : [];
|
|
91
|
+
}
|
|
92
|
+
/** Updates the state of child menu items based on the current selection. */
|
|
93
|
+
updateChildrenState() {
|
|
94
|
+
const items = this.childItems;
|
|
95
|
+
items.forEach((item) => {
|
|
96
|
+
if (item.value !== undefined) {
|
|
97
|
+
const isSelected = this.selectedValues.includes(item.value);
|
|
98
|
+
item.selected = isSelected;
|
|
99
|
+
if (isSelected)
|
|
100
|
+
item.setAttribute('active-item', '');
|
|
101
|
+
else
|
|
102
|
+
item.removeAttribute('active-item');
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
if (this.selectedValues.length === 0)
|
|
106
|
+
this.updateActiveState();
|
|
107
|
+
}
|
|
108
|
+
/** Initializes the selected values based on the child menu items that have the 'selected' attribute set. */
|
|
109
|
+
initialSelectedValues() {
|
|
110
|
+
const nodes = Array.from(this.el.querySelectorAll('bds-list-menu-item[selected]'));
|
|
111
|
+
if (nodes.length > 0) {
|
|
112
|
+
const initialSelected = Array.from(nodes);
|
|
113
|
+
const values = initialSelected.map(item => {
|
|
114
|
+
return item.getAttribute('value') || '';
|
|
115
|
+
});
|
|
116
|
+
this.selectedValues = this.multiple ? values : [values[0]];
|
|
117
|
+
this.updateChildrenState();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
/** Renders the component with a slot for menu items. */
|
|
121
|
+
render() {
|
|
122
|
+
return (h(Host, { key: '30f57283c4f8ee82833217c0281f0df6e6126d26', class: "bds-list-menu", role: this.menuRole, tabIndex: "-1", "aria-multiselectable": this.multiple ? 'true' : 'false' }, h("slot", { key: '3d39f6022a967a57b6d95d889ad5aadd5ba7aa96' })));
|
|
123
|
+
}
|
|
124
|
+
get el() { return getElement(this); }
|
|
125
|
+
};
|
|
126
|
+
BdsListMenu.style = bdsListMenuCss();
|
|
127
|
+
|
|
128
|
+
export { BdsListMenu as bds_list_menu };
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import { M as Mixin, r as registerInstance, h, a as Host, g as getElement } from './index-
|
|
2
|
-
import { a as anchoredMixin } from './
|
|
1
|
+
import { M as Mixin, r as registerInstance, h, a as Host, g as getElement } from './index-BqJlOB6b.js';
|
|
2
|
+
import { a as anchoredMixin, g as getOffset } from './getOffset-DKPjeBHi.js';
|
|
3
3
|
import { B as BUTTON_SIZES } from './enum-C8mRvnTA.js';
|
|
4
4
|
import './floating.mixin-DCXSEEVH.js';
|
|
5
|
+
import './Keys-CzYQb3pP.js';
|
|
5
6
|
|
|
6
|
-
const
|
|
7
|
+
const OFFSET = 11;
|
|
8
|
+
|
|
9
|
+
const bdsPopoverCss = () => `@charset "UTF-8";:root{--popover-arrow-size:var(--boreal-spacing-s);--popover-width:320px}.popover{position:fixed;margin:0;overflow:visible;border-radius:var(--boreal-radius-xs2);font-size:var(--boreal-typography-font-size-xs);line-height:var(--boreal-typography-line-height-xs);font-family:var(--boreal-typography-font-family-primary);font-weight:var(--boreal-typography-font-weight-regular);background:var(--boreal-ui-inverse);-webkit-filter:drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.15));filter:drop-shadow(0px 2px 8px rgba(0, 0, 0, 0.15));-webkit-box-shadow:none;box-shadow:none;-webkit-box-sizing:border-box;box-sizing:border-box;border:transparent;cursor:auto}.popover-content{position:relative;padding:var(--boreal-spacing-s)}.popover[popover]:not(:popover-open){display:none}.popover-header{border-bottom:var(--boreal-stroke-default-light) solid 1px;padding:var(--boreal-spacing-m) var(--boreal-spacing-xs) var(--boreal-spacing-m) var(--boreal-spacing-s);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}.popover-header__content{display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center}.popover-header__title{font-size:var(--boreal-typography-font-size-sm);font-weight:var(--boreal-typography-font-weight-semibold);line-height:var(--boreal-typography-line-height-sm)}.popover-header__icon{font-size:var(--boreal-typography-font-size-md);margin-right:var(--boreal-spacing-3xs)}.popover-header__close{margin-left:var(--boreal-spacing-s)}.popover-header__close .bds-button{margin:0;padding:0;width:var(--boreal-spacing-ml);height:var(--boreal-spacing-ml)}.popover-header__close .bds-button__content{width:var(--boreal-spacing-ml);height:var(--boreal-spacing-ml)}.popover-header__close em{font-size:var(--boreal-typography-font-size-xs)}.popover-footer{border-top:var(--boreal-stroke-default-light) solid 1px;padding:var(--boreal-spacing-s) var(--boreal-spacing-xs) var(--boreal-spacing-s) var(--boreal-spacing-s);display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-pack:justify;justify-content:space-between}.popover .popover-arrow{position:absolute;width:var(--popover-arrow-size);height:var(--popover-arrow-size);pointer-events:none}.popover .popover-arrow::before{content:"";position:absolute;width:var(--popover-arrow-size);height:var(--popover-arrow-size);background:var(--boreal-ui-inverse);-webkit-transform:rotate(45deg);transform:rotate(45deg);inset:0}.popover[data-placement^=top] .popover-arrow{bottom:calc(var(--popover-arrow-size) / -2)}.popover[data-placement^=top] .popover-arrow::before{bottom:0}.popover[data-placement^=bottom] .popover-arrow{top:calc(var(--popover-arrow-size) / -2)}.popover[data-placement^=bottom] .popover-arrow::before{bottom:0}.popover[data-placement^=left] .popover-arrow{right:calc(var(--popover-arrow-size) / -2)}.popover[data-placement^=left] .popover-arrow::before{left:0}.popover[data-placement^=right] .popover-arrow{left:calc(var(--popover-arrow-size) / -2)}.popover[data-placement^=right] .popover-arrow::before{left:0}`;
|
|
7
10
|
|
|
8
11
|
const BdsPopover = class extends Mixin(anchoredMixin) {
|
|
9
12
|
constructor(hostRef) {
|
|
@@ -55,7 +58,7 @@ const BdsPopover = class extends Mixin(anchoredMixin) {
|
|
|
55
58
|
get options() {
|
|
56
59
|
return {
|
|
57
60
|
placement: this.floatingOptions.placement ?? 'bottom',
|
|
58
|
-
offset: this.floatingOptions.offset
|
|
61
|
+
offset: getOffset(this.floatingOptions?.hideArrow, this.floatingOptions?.offset, OFFSET),
|
|
59
62
|
arrow: this.floatingOptions.hideArrow ? undefined : this.arrowElement,
|
|
60
63
|
strategy: 'fixed',
|
|
61
64
|
shift: true,
|
|
@@ -122,7 +125,13 @@ const BdsPopover = class extends Mixin(anchoredMixin) {
|
|
|
122
125
|
*/
|
|
123
126
|
setArrowPosition(result) {
|
|
124
127
|
if (result.middlewareData?.arrow && !this.disabled && this.arrowElement?.isConnected) {
|
|
125
|
-
const
|
|
128
|
+
const placement = this.floatingOptions.placement;
|
|
129
|
+
const arrowData = result.middlewareData.arrow;
|
|
130
|
+
const isStartPlacement = placement === 'top-start' || placement === 'bottom-start';
|
|
131
|
+
let arrowX = arrowData.x || undefined;
|
|
132
|
+
if (isStartPlacement)
|
|
133
|
+
arrowX = arrowData.x ? 20 : undefined;
|
|
134
|
+
const arrowY = result.middlewareData.arrow.y;
|
|
126
135
|
Object.assign(this.arrowElement.style, {
|
|
127
136
|
left: arrowX != null ? `${arrowX}px` : '',
|
|
128
137
|
top: arrowY != null ? `${arrowY}px` : '',
|
|
@@ -136,7 +145,7 @@ const BdsPopover = class extends Mixin(anchoredMixin) {
|
|
|
136
145
|
*/
|
|
137
146
|
handleClickOutside(e) {
|
|
138
147
|
const target = e.target;
|
|
139
|
-
const clickedInsideTrigger = this.
|
|
148
|
+
const clickedInsideTrigger = this.listenTarget?.contains(target) || this.trigger?.contains(target) || this.triggerSlot?.contains(target);
|
|
140
149
|
const clickedInsideFloating = this.floatingContent.contains(target) || this.floatingContent === target;
|
|
141
150
|
if (!clickedInsideTrigger && !clickedInsideFloating) {
|
|
142
151
|
this.hide();
|
|
@@ -260,7 +269,7 @@ const BdsPopover = class extends Mixin(anchoredMixin) {
|
|
|
260
269
|
this.trigger.removeEventListener('click', (evt) => this.handleShow(evt));
|
|
261
270
|
}
|
|
262
271
|
render() {
|
|
263
|
-
return (h(Host, { key: '
|
|
272
|
+
return (h(Host, { key: 'd9bdf356fc8aa99312073be3589cf50f4bd1afbe', class: "popover", style: { width: this.popoverWidth }, popover: "manual", role: "tooltip", "data-placement": this.getPlacement, "data-hidearrow": this.canShowArrow, "aria-hidden": this.isVisible ? 'false' : 'true', onClick: (e) => this.handleContentClick(e), ref: el => (this.floatingContent = el) }, this.header && (h("div", { key: 'a9172eb13620a218c1a37bd52eddaa6f9b53739c', class: "popover-header" }, h("div", { key: '3b8774f0f8f461ce164220d53c48139e95a1b8f5', class: "popover-header__content" }, h("span", { key: '86cc8cedf2c7970834a61c8374fc23d67417c2dd', class: "popover-header__icon" }, h("slot", { key: '1e356d9b87672942ef4d19f33f5de9c707d02cb2', name: "header-icon" })), h("span", { key: 'c014a7a269a4cc79841d4350e7e8efc4fc39cb06', class: "popover-header__title" }, h("slot", { key: '39ce847785bbad57635834c7957146b89245438e', name: "header-title" }))), this.closable && (h("bds-button", { key: 'a54358b74d8d29f5afeaa9f6fe1f07343f6784c6', class: "popover-header__close", size: BUTTON_SIZES.SMALL, onBdsClick: () => this.hide() }, h("em", { key: 'efdca5b8e1f0560a15e063e832f1aeb9c754a820', slot: "icon", class: "bds-icon-close" }))))), this.canShowArrow && (h("div", { key: '16870352c06b06de9b67e542e9e1753c7e3bff66', class: "popover-arrow", part: "arrow", ref: el => (this.arrowElement = el) })), h("div", { key: 'b5dddeeedcc5ba9d107af57a25d9ca350a0621a8', class: "popover-content", tabIndex: -1, part: "popover-content" }, h("slot", { key: '4bfc174186ab356747175464922c0d6b09d6b608' })), this.footer && (h("div", { key: '8476df1ee6751d6cba4cc52efad6675ea74bdc18', class: "popover-footer", onClick: (e) => e.stopPropagation() }, h("slot", { key: 'de60d356d96ae56c8e0a1349f6bafa87700998c6', name: "footer-helper" }), h("slot", { key: '21e59115a077f31b7b05aeea29cd23394642dd4d', name: "footer-button" })))));
|
|
264
273
|
}
|
|
265
274
|
get el() { return getElement(this); }
|
|
266
275
|
};
|