@radix-ng/primitives 0.24.0 → 0.26.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/avatar/src/avatar-fallback.directive.d.ts +1 -1
- package/compodoc/documentation.json +14105 -11035
- package/core/index.d.ts +3 -2
- package/core/src/positioning/constants.d.ts +3 -0
- package/core/src/positioning/types.d.ts +42 -0
- package/{popover/src/popover.utils.d.ts → core/src/positioning/utils.d.ts} +4 -4
- package/dialog/src/dialog-trigger.directive.d.ts +12 -0
- package/fesm2022/radix-ng-primitives-accordion.mjs +19 -19
- package/fesm2022/radix-ng-primitives-accordion.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs +22 -22
- package/fesm2022/radix-ng-primitives-alert-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs +3 -3
- package/fesm2022/radix-ng-primitives-aspect-ratio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-avatar.mjs +17 -17
- package/fesm2022/radix-ng-primitives-avatar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-checkbox.mjs +16 -16
- package/fesm2022/radix-ng-primitives-checkbox.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-collapsible.mjs +9 -9
- package/fesm2022/radix-ng-primitives-collapsible.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-context-menu.mjs +34 -34
- package/fesm2022/radix-ng-primitives-context-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-core.mjs +224 -236
- package/fesm2022/radix-ng-primitives-core.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dialog.mjs +31 -26
- package/fesm2022/radix-ng-primitives-dialog.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs +34 -34
- package/fesm2022/radix-ng-primitives-dropdown-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-label.mjs +3 -3
- package/fesm2022/radix-ng-primitives-label.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menu.mjs +22 -22
- package/fesm2022/radix-ng-primitives-menu.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-menubar.mjs +31 -31
- package/fesm2022/radix-ng-primitives-menubar.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-popover.mjs +75 -277
- package/fesm2022/radix-ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-progress.mjs +10 -10
- package/fesm2022/radix-ng-primitives-progress.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-radio.mjs +12 -12
- package/fesm2022/radix-ng-primitives-radio.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-roving-focus.mjs +6 -6
- package/fesm2022/radix-ng-primitives-roving-focus.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-select.mjs +34 -35
- package/fesm2022/radix-ng-primitives-select.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-separator.mjs +3 -3
- package/fesm2022/radix-ng-primitives-separator.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-slider.mjs +31 -34
- package/fesm2022/radix-ng-primitives-slider.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-switch.mjs +18 -15
- package/fesm2022/radix-ng-primitives-switch.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tabs.mjs +16 -16
- package/fesm2022/radix-ng-primitives-tabs.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle-group.mjs +9 -9
- package/fesm2022/radix-ng-primitives-toggle-group.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-toggle.mjs +6 -6
- package/fesm2022/radix-ng-primitives-toggle.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-tooltip.mjs +1023 -511
- package/fesm2022/radix-ng-primitives-tooltip.mjs.map +1 -1
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs +9 -9
- package/fesm2022/radix-ng-primitives-visually-hidden.mjs.map +1 -1
- package/package.json +3 -57
- package/popover/index.d.ts +0 -1
- package/popover/src/popover-arrow.directive.d.ts +6 -6
- package/popover/src/popover-content.directive.d.ts +9 -8
- package/popover/src/popover-root.directive.d.ts +9 -8
- package/popover/src/popover.types.d.ts +0 -31
- package/popover/src/utils/cdk-event.service.d.ts +1 -0
- package/switch/src/switch-root.directive.d.ts +4 -1
- package/tooltip/README.md +2 -0
- package/tooltip/index.d.ts +9 -6
- package/tooltip/src/tooltip-anchor.directive.d.ts +28 -0
- package/tooltip/src/tooltip-anchor.token.d.ts +3 -0
- package/tooltip/src/tooltip-arrow.directive.d.ts +23 -8
- package/tooltip/src/tooltip-close.directive.d.ts +18 -0
- package/tooltip/src/tooltip-close.token.d.ts +3 -0
- package/tooltip/src/tooltip-content-attributes.component.d.ts +17 -0
- package/tooltip/src/tooltip-content-attributes.token.d.ts +3 -0
- package/tooltip/src/tooltip-content.directive.d.ts +88 -20
- package/tooltip/src/tooltip-root.directive.d.ts +122 -57
- package/tooltip/src/tooltip-root.inject.d.ts +3 -0
- package/tooltip/src/tooltip-trigger.directive.d.ts +11 -11
- package/tooltip/src/tooltip.types.d.ts +16 -16
- package/tooltip/src/utils/cdk-event.service.d.ts +30 -0
- package/tooltip/src/utils/constants.d.ts +1 -0
- package/tooltip/src/utils/types.d.ts +7 -0
- package/core/src/control-value-accessor/index.d.ts +0 -75
- package/core/src/create-inject-context/assert-injector.d.ts +0 -51
- package/core/src/create-inject-context/index.d.ts +0 -68
- package/core/src/types.d.ts +0 -23
- package/esm2022/accordion/index.mjs +0 -40
- package/esm2022/accordion/radix-ng-primitives-accordion.mjs +0 -5
- package/esm2022/accordion/src/accordion-content.directive.mjs +0 -42
- package/esm2022/accordion/src/accordion-header.directive.mjs +0 -23
- package/esm2022/accordion/src/accordion-item.directive.mjs +0 -196
- package/esm2022/accordion/src/accordion-root.directive.mjs +0 -200
- package/esm2022/accordion/src/accordion-trigger.directive.mjs +0 -42
- package/esm2022/alert-dialog/index.mjs +0 -41
- package/esm2022/alert-dialog/radix-ng-primitives-alert-dialog.mjs +0 -5
- package/esm2022/alert-dialog/src/alert-dialog-cancel.directive.mjs +0 -24
- package/esm2022/alert-dialog/src/alert-dialog-content.directive.mjs +0 -34
- package/esm2022/alert-dialog/src/alert-dialog-root.directive.mjs +0 -24
- package/esm2022/alert-dialog/src/alert-dialog-title.directive.mjs +0 -14
- package/esm2022/alert-dialog/src/alert-dialog-trigger.directive.mjs +0 -24
- package/esm2022/alert-dialog/src/alert-dialog.service.mjs +0 -46
- package/esm2022/aspect-ratio/index.mjs +0 -2
- package/esm2022/aspect-ratio/radix-ng-primitives-aspect-ratio.mjs +0 -5
- package/esm2022/aspect-ratio/src/aspect-ratio.directive.mjs +0 -57
- package/esm2022/avatar/index.mjs +0 -31
- package/esm2022/avatar/radix-ng-primitives-avatar.mjs +0 -5
- package/esm2022/avatar/src/avatar-fallback.directive.mjs +0 -67
- package/esm2022/avatar/src/avatar-image.directive.mjs +0 -65
- package/esm2022/avatar/src/avatar-root.directive.mjs +0 -26
- package/esm2022/avatar/src/avatar.config.mjs +0 -17
- package/esm2022/checkbox/index.mjs +0 -36
- package/esm2022/checkbox/radix-ng-primitives-checkbox.mjs +0 -5
- package/esm2022/checkbox/src/checkbox-button.directive.mjs +0 -33
- package/esm2022/checkbox/src/checkbox-indicator.directive.mjs +0 -24
- package/esm2022/checkbox/src/checkbox-input.directive.mjs +0 -44
- package/esm2022/checkbox/src/checkbox.directive.mjs +0 -141
- package/esm2022/checkbox/src/checkbox.token.mjs +0 -6
- package/esm2022/collapsible/index.mjs +0 -4
- package/esm2022/collapsible/radix-ng-primitives-collapsible.mjs +0 -5
- package/esm2022/collapsible/src/collapsible-content.directive.mjs +0 -42
- package/esm2022/collapsible/src/collapsible-content.token.mjs +0 -3
- package/esm2022/collapsible/src/collapsible-root.directive.mjs +0 -127
- package/esm2022/collapsible/src/collapsible-trigger.directive.mjs +0 -49
- package/esm2022/context-menu/index.mjs +0 -65
- package/esm2022/context-menu/radix-ng-primitives-context-menu.mjs +0 -5
- package/esm2022/context-menu/src/context-menu-content.directive.mjs +0 -56
- package/esm2022/context-menu/src/context-menu-item-checkbox.directive.mjs +0 -39
- package/esm2022/context-menu/src/context-menu-item-indicator.directive.mjs +0 -22
- package/esm2022/context-menu/src/context-menu-item-radio-group.directive.mjs +0 -37
- package/esm2022/context-menu/src/context-menu-item-radio.directive.mjs +0 -67
- package/esm2022/context-menu/src/context-menu-item-selectable.mjs +0 -31
- package/esm2022/context-menu/src/context-menu-item.directive.mjs +0 -70
- package/esm2022/context-menu/src/context-menu-label.directive.mjs +0 -14
- package/esm2022/context-menu/src/context-menu-separator.directive.mjs +0 -21
- package/esm2022/context-menu/src/context-menu-trigger.directive.mjs +0 -92
- package/esm2022/core/index.mjs +0 -11
- package/esm2022/core/radix-ng-primitives-core.mjs +0 -5
- package/esm2022/core/src/accessor/provide-value-accessor.mjs +0 -19
- package/esm2022/core/src/auto-focus.directive.mjs +0 -80
- package/esm2022/core/src/control-value-accessor/index.mjs +0 -103
- package/esm2022/core/src/create-inject-context/assert-injector.mjs +0 -15
- package/esm2022/core/src/create-inject-context/index.mjs +0 -116
- package/esm2022/core/src/document.mjs +0 -6
- package/esm2022/core/src/id-generator.mjs +0 -43
- package/esm2022/core/src/inject-ng-control.mjs +0 -17
- package/esm2022/core/src/is-client.mjs +0 -6
- package/esm2022/core/src/is-inside-form.mjs +0 -7
- package/esm2022/core/src/types.mjs +0 -2
- package/esm2022/core/src/window.mjs +0 -15
- package/esm2022/dialog/index.mjs +0 -50
- package/esm2022/dialog/radix-ng-primitives-dialog.mjs +0 -5
- package/esm2022/dialog/src/dialog-close.directive.mjs +0 -25
- package/esm2022/dialog/src/dialog-content.directive.mjs +0 -46
- package/esm2022/dialog/src/dialog-description.directive.mjs +0 -14
- package/esm2022/dialog/src/dialog-dismiss.directive.mjs +0 -25
- package/esm2022/dialog/src/dialog-ref.mjs +0 -46
- package/esm2022/dialog/src/dialog-title.directive.mjs +0 -14
- package/esm2022/dialog/src/dialog-trigger.directive.mjs +0 -54
- package/esm2022/dialog/src/dialog.config.mjs +0 -6
- package/esm2022/dialog/src/dialog.injectors.mjs +0 -10
- package/esm2022/dialog/src/dialog.providers.mjs +0 -26
- package/esm2022/dialog/src/dialog.service.mjs +0 -96
- package/esm2022/dropdown-menu/index.mjs +0 -68
- package/esm2022/dropdown-menu/radix-ng-primitives-dropdown-menu.mjs +0 -5
- package/esm2022/dropdown-menu/src/dropdown-menu-content.directive.mjs +0 -56
- package/esm2022/dropdown-menu/src/dropdown-menu-item-checkbox.directive.mjs +0 -39
- package/esm2022/dropdown-menu/src/dropdown-menu-item-indicator.directive.mjs +0 -22
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio-group.directive.mjs +0 -37
- package/esm2022/dropdown-menu/src/dropdown-menu-item-radio.directive.mjs +0 -67
- package/esm2022/dropdown-menu/src/dropdown-menu-item-selectable.mjs +0 -31
- package/esm2022/dropdown-menu/src/dropdown-menu-item.directive.mjs +0 -73
- package/esm2022/dropdown-menu/src/dropdown-menu-label.directive.mjs +0 -14
- package/esm2022/dropdown-menu/src/dropdown-menu-separator.directive.mjs +0 -21
- package/esm2022/dropdown-menu/src/dropdown-menu-trigger.directive.mjs +0 -210
- package/esm2022/index.mjs +0 -2
- package/esm2022/label/index.mjs +0 -2
- package/esm2022/label/radix-ng-primitives-label.mjs +0 -5
- package/esm2022/label/src/label.directive.mjs +0 -57
- package/esm2022/menu/index.mjs +0 -45
- package/esm2022/menu/radix-ng-primitives-menu.mjs +0 -5
- package/esm2022/menu/src/menu-content.directive.mjs +0 -17
- package/esm2022/menu/src/menu-directive.mjs +0 -18
- package/esm2022/menu/src/menu-group.directive.mjs +0 -20
- package/esm2022/menu/src/menu-item.directive.mjs +0 -46
- package/esm2022/menu/src/menu-label.directive.mjs +0 -14
- package/esm2022/menu/src/menu-separator.directive.mjs +0 -21
- package/esm2022/menubar/index.mjs +0 -60
- package/esm2022/menubar/radix-ng-primitives-menubar.mjs +0 -5
- package/esm2022/menubar/src/menubar-content.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-item-checkbox.directive.mjs +0 -34
- package/esm2022/menubar/src/menubar-item-indicator.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-item-radio.directive.mjs +0 -35
- package/esm2022/menubar/src/menubar-item.directive.mjs +0 -20
- package/esm2022/menubar/src/menubar-radio-group.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-root.directive.mjs +0 -24
- package/esm2022/menubar/src/menubar-separator.directive.mjs +0 -17
- package/esm2022/menubar/src/menubar-trigger.directive.mjs +0 -45
- package/esm2022/popover/index.mjs +0 -51
- package/esm2022/popover/radix-ng-primitives-popover.mjs +0 -5
- package/esm2022/popover/src/popover-anchor.directive.mjs +0 -75
- package/esm2022/popover/src/popover-anchor.token.mjs +0 -3
- package/esm2022/popover/src/popover-arrow.directive.mjs +0 -117
- package/esm2022/popover/src/popover-arrow.token.mjs +0 -3
- package/esm2022/popover/src/popover-close.directive.mjs +0 -49
- package/esm2022/popover/src/popover-close.token.mjs +0 -3
- package/esm2022/popover/src/popover-content-attributes.component.mjs +0 -70
- package/esm2022/popover/src/popover-content-attributes.token.mjs +0 -3
- package/esm2022/popover/src/popover-content.directive.mjs +0 -270
- package/esm2022/popover/src/popover-root.directive.mjs +0 -320
- package/esm2022/popover/src/popover-root.inject.mjs +0 -7
- package/esm2022/popover/src/popover-trigger.directive.mjs +0 -41
- package/esm2022/popover/src/popover.constants.mjs +0 -90
- package/esm2022/popover/src/popover.types.mjs +0 -31
- package/esm2022/popover/src/popover.utils.mjs +0 -107
- package/esm2022/popover/src/utils/cdk-event.service.mjs +0 -153
- package/esm2022/popover/src/utils/constants.mjs +0 -2
- package/esm2022/popover/src/utils/types.mjs +0 -2
- package/esm2022/progress/index.mjs +0 -25
- package/esm2022/progress/radix-ng-primitives-progress.mjs +0 -5
- package/esm2022/progress/src/progress-indicator.directive.mjs +0 -33
- package/esm2022/progress/src/progress-root.directive.mjs +0 -132
- package/esm2022/radio/index.mjs +0 -5
- package/esm2022/radio/radix-ng-primitives-radio.mjs +0 -5
- package/esm2022/radio/src/radio-indicator.directive.mjs +0 -25
- package/esm2022/radio/src/radio-item-input.directive.mjs +0 -37
- package/esm2022/radio/src/radio-item.directive.mjs +0 -86
- package/esm2022/radio/src/radio-root.directive.mjs +0 -104
- package/esm2022/radio/src/radio-tokens.mjs +0 -3
- package/esm2022/radix-ng-primitives.mjs +0 -5
- package/esm2022/roving-focus/index.mjs +0 -3
- package/esm2022/roving-focus/radix-ng-primitives-roving-focus.mjs +0 -5
- package/esm2022/roving-focus/src/roving-focus-group.directive.mjs +0 -138
- package/esm2022/roving-focus/src/roving-focus-item.directive.mjs +0 -133
- package/esm2022/roving-focus/src/utils.mjs +0 -47
- package/esm2022/select/index.mjs +0 -65
- package/esm2022/select/radix-ng-primitives-select.mjs +0 -5
- package/esm2022/select/src/select-content.directive.mjs +0 -53
- package/esm2022/select/src/select-group.directive.mjs +0 -18
- package/esm2022/select/src/select-icon.directive.mjs +0 -18
- package/esm2022/select/src/select-item-indicator.directive.mjs +0 -23
- package/esm2022/select/src/select-item.directive.mjs +0 -122
- package/esm2022/select/src/select-label.directive.mjs +0 -15
- package/esm2022/select/src/select-separator.directive.mjs +0 -18
- package/esm2022/select/src/select-trigger.directive.mjs +0 -38
- package/esm2022/select/src/select-value.directive.mjs +0 -21
- package/esm2022/select/src/select.component.mjs +0 -234
- package/esm2022/separator/index.mjs +0 -2
- package/esm2022/separator/radix-ng-primitives-separator.mjs +0 -5
- package/esm2022/separator/src/separator.directive.mjs +0 -61
- package/esm2022/slider/index.mjs +0 -28
- package/esm2022/slider/radix-ng-primitives-slider.mjs +0 -5
- package/esm2022/slider/src/slider-horizontal.component.mjs +0 -117
- package/esm2022/slider/src/slider-impl.directive.mjs +0 -89
- package/esm2022/slider/src/slider-orientation-context.service.mjs +0 -27
- package/esm2022/slider/src/slider-range.component.mjs +0 -41
- package/esm2022/slider/src/slider-root.component.mjs +0 -210
- package/esm2022/slider/src/slider-thumb-impl.directive.mjs +0 -106
- package/esm2022/slider/src/slider-thumb.component.mjs +0 -22
- package/esm2022/slider/src/slider-track.component.mjs +0 -27
- package/esm2022/slider/src/slider-vertical.component.mjs +0 -117
- package/esm2022/slider/src/utils.mjs +0 -94
- package/esm2022/switch/index.mjs +0 -30
- package/esm2022/switch/radix-ng-primitives-switch.mjs +0 -5
- package/esm2022/switch/src/switch-input.directive.mjs +0 -44
- package/esm2022/switch/src/switch-root.directive.mjs +0 -145
- package/esm2022/switch/src/switch-thumb.directive.mjs +0 -26
- package/esm2022/tabs/index.mjs +0 -35
- package/esm2022/tabs/radix-ng-primitives-tabs.mjs +0 -5
- package/esm2022/tabs/src/tabs-content.directive.mjs +0 -35
- package/esm2022/tabs/src/tabs-list.directive.mjs +0 -26
- package/esm2022/tabs/src/tabs-root.directive.mjs +0 -57
- package/esm2022/tabs/src/tabs-trigger.directive.mjs +0 -78
- package/esm2022/tabs/src/utils.mjs +0 -7
- package/esm2022/toggle/index.mjs +0 -3
- package/esm2022/toggle/radix-ng-primitives-toggle.mjs +0 -5
- package/esm2022/toggle/src/toggle-visually-hidden-input.directive.mjs +0 -31
- package/esm2022/toggle/src/toggle.directive.mjs +0 -79
- package/esm2022/toggle-group/index.mjs +0 -6
- package/esm2022/toggle-group/radix-ng-primitives-toggle-group.mjs +0 -5
- package/esm2022/toggle-group/src/toggle-group-item.directive.mjs +0 -85
- package/esm2022/toggle-group/src/toggle-group-item.token.mjs +0 -3
- package/esm2022/toggle-group/src/toggle-group-multiple.directive.mjs +0 -185
- package/esm2022/toggle-group/src/toggle-group.directive.mjs +0 -179
- package/esm2022/toggle-group/src/toggle-group.token.mjs +0 -6
- package/esm2022/tooltip/index.mjs +0 -41
- package/esm2022/tooltip/radix-ng-primitives-tooltip.mjs +0 -5
- package/esm2022/tooltip/src/get-content-position.mjs +0 -31
- package/esm2022/tooltip/src/tooltip-arrow.directive.mjs +0 -92
- package/esm2022/tooltip/src/tooltip-arrow.token.mjs +0 -3
- package/esm2022/tooltip/src/tooltip-content-attributes.directive.mjs +0 -24
- package/esm2022/tooltip/src/tooltip-content.directive.mjs +0 -48
- package/esm2022/tooltip/src/tooltip-content.token.mjs +0 -3
- package/esm2022/tooltip/src/tooltip-root.directive.mjs +0 -288
- package/esm2022/tooltip/src/tooltip-trigger.directive.mjs +0 -70
- package/esm2022/tooltip/src/tooltip.config.mjs +0 -18
- package/esm2022/tooltip/src/tooltip.constants.mjs +0 -84
- package/esm2022/tooltip/src/tooltip.types.mjs +0 -14
- package/esm2022/visually-hidden/index.mjs +0 -4
- package/esm2022/visually-hidden/radix-ng-primitives-visually-hidden.mjs +0 -5
- package/esm2022/visually-hidden/src/visually-hidden-input-bubble.directive.mjs +0 -74
- package/esm2022/visually-hidden/src/visually-hidden-input.directive.mjs +0 -74
- package/esm2022/visually-hidden/src/visually-hidden.directive.mjs +0 -42
- package/popover/src/popover.constants.d.ts +0 -8
- package/tooltip/src/get-content-position.d.ts +0 -3
- package/tooltip/src/tooltip-content-attributes.directive.d.ts +0 -8
- package/tooltip/src/tooltip-content.token.d.ts +0 -3
- package/tooltip/src/tooltip.config.d.ts +0 -6
- package/tooltip/src/tooltip.constants.d.ts +0 -9
@@ -1,674 +1,1186 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, inject,
|
3
|
-
import
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
7
|
-
import { filter,
|
2
|
+
import { InjectionToken, inject, TemplateRef, DestroyRef, computed, input, numberAttribute, booleanAttribute, output, effect, untracked, SimpleChange, Directive, ElementRef, NgZone, Renderer2, isDevMode, VERSION, Injectable, makeEnvironmentProviders, signal, contentChild, ViewContainerRef, afterNextRender, assertInInjectionContext, forwardRef, Component, ChangeDetectionStrategy, NgModule } from '@angular/core';
|
3
|
+
import * as i1 from '@angular/cdk/overlay';
|
4
|
+
import { Overlay, CdkConnectedOverlay, CdkOverlayOrigin } from '@angular/cdk/overlay';
|
5
|
+
import { RdxPositionSide, RdxPositionAlign, RDX_POSITIONING_DEFAULTS, getContentPosition, getAllPossibleConnectedPositions, injectDocument, injectWindow, getArrowPositionParams, getSideAndAlignFromAllPossibleConnectedPositions } from '@radix-ng/primitives/core';
|
6
|
+
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
7
|
+
import { filter, tap, Subject, map, debounce, timer } from 'rxjs';
|
8
|
+
|
9
|
+
const RdxTooltipAnchorToken = new InjectionToken('RdxTooltipAnchorToken');
|
8
10
|
|
9
11
|
const RdxTooltipArrowToken = new InjectionToken('RdxTooltipArrowToken');
|
10
12
|
|
11
|
-
const
|
13
|
+
const RdxTooltipCloseToken = new InjectionToken('RdxTooltipCloseToken');
|
12
14
|
|
13
|
-
|
14
|
-
(function (RdxTooltipSide) {
|
15
|
-
RdxTooltipSide["Top"] = "top";
|
16
|
-
RdxTooltipSide["Right"] = "right";
|
17
|
-
RdxTooltipSide["Bottom"] = "bottom";
|
18
|
-
RdxTooltipSide["Left"] = "left";
|
19
|
-
})(RdxTooltipSide || (RdxTooltipSide = {}));
|
20
|
-
var RdxTooltipAlign;
|
21
|
-
(function (RdxTooltipAlign) {
|
22
|
-
RdxTooltipAlign["Start"] = "start";
|
23
|
-
RdxTooltipAlign["Center"] = "center";
|
24
|
-
RdxTooltipAlign["End"] = "end";
|
25
|
-
})(RdxTooltipAlign || (RdxTooltipAlign = {}));
|
15
|
+
const RdxTooltipContentAttributesToken = new InjectionToken('RdxTooltipContentAttributesToken');
|
26
16
|
|
27
|
-
|
17
|
+
var RdxTooltipState;
|
18
|
+
(function (RdxTooltipState) {
|
19
|
+
RdxTooltipState["OPEN"] = "open";
|
20
|
+
RdxTooltipState["CLOSED"] = "closed";
|
21
|
+
})(RdxTooltipState || (RdxTooltipState = {}));
|
22
|
+
var RdxTooltipAction;
|
23
|
+
(function (RdxTooltipAction) {
|
24
|
+
RdxTooltipAction["OPEN"] = "open";
|
25
|
+
RdxTooltipAction["CLOSE"] = "close";
|
26
|
+
})(RdxTooltipAction || (RdxTooltipAction = {}));
|
27
|
+
var RdxTooltipAttachDetachEvent;
|
28
|
+
(function (RdxTooltipAttachDetachEvent) {
|
29
|
+
RdxTooltipAttachDetachEvent["ATTACH"] = "attach";
|
30
|
+
RdxTooltipAttachDetachEvent["DETACH"] = "detach";
|
31
|
+
})(RdxTooltipAttachDetachEvent || (RdxTooltipAttachDetachEvent = {}));
|
32
|
+
var RdxTooltipAnimationStatus;
|
33
|
+
(function (RdxTooltipAnimationStatus) {
|
34
|
+
RdxTooltipAnimationStatus["OPEN_STARTED"] = "open_started";
|
35
|
+
RdxTooltipAnimationStatus["OPEN_ENDED"] = "open_ended";
|
36
|
+
RdxTooltipAnimationStatus["CLOSED_STARTED"] = "closed_started";
|
37
|
+
RdxTooltipAnimationStatus["CLOSED_ENDED"] = "closed_ended";
|
38
|
+
})(RdxTooltipAnimationStatus || (RdxTooltipAnimationStatus = {}));
|
39
|
+
|
40
|
+
class RdxTooltipContentDirective {
|
28
41
|
constructor() {
|
29
42
|
/** @ignore */
|
30
|
-
this.
|
43
|
+
this.rootDirective = injectTooltipRoot();
|
31
44
|
/** @ignore */
|
32
|
-
this.
|
45
|
+
this.templateRef = inject(TemplateRef);
|
33
46
|
/** @ignore */
|
34
|
-
this.
|
47
|
+
this.overlay = inject(Overlay);
|
48
|
+
/** @ignore */
|
49
|
+
this.destroyRef = inject(DestroyRef);
|
50
|
+
/** @ignore */
|
51
|
+
this.connectedOverlay = inject(CdkConnectedOverlay);
|
52
|
+
/** @ignore */
|
53
|
+
this.name = computed(() => `rdx-tooltip-trigger-${this.rootDirective.uniqueId()}`);
|
35
54
|
/**
|
36
|
-
* The
|
55
|
+
* @description The preferred side of the trigger to render against when open. Will be reversed when collisions occur and avoidCollisions is enabled.
|
56
|
+
* @default top
|
37
57
|
*/
|
38
|
-
this.
|
58
|
+
this.side = input(RdxPositionSide.Top);
|
39
59
|
/**
|
40
|
-
* The
|
60
|
+
* @description The distance in pixels from the trigger.
|
61
|
+
* @default undefined
|
41
62
|
*/
|
42
|
-
this.
|
43
|
-
|
44
|
-
this.arrowSvgElement = computed(() => {
|
45
|
-
const width = this.width();
|
46
|
-
const height = this.height();
|
47
|
-
const svgElement = this.renderer.createElement('svg', 'svg');
|
48
|
-
this.renderer.setAttribute(svgElement, 'viewBox', '0 0 30 10');
|
49
|
-
this.renderer.setAttribute(svgElement, 'width', String(width));
|
50
|
-
this.renderer.setAttribute(svgElement, 'height', String(height));
|
51
|
-
const polygonElement = this.renderer.createElement('polygon', 'svg');
|
52
|
-
this.renderer.setAttribute(polygonElement, 'points', '0,0 30,0 15,10');
|
53
|
-
this.renderer.setAttribute(svgElement, 'preserveAspectRatio', 'none');
|
54
|
-
this.renderer.appendChild(svgElement, polygonElement);
|
55
|
-
return svgElement;
|
63
|
+
this.sideOffset = input(NaN, {
|
64
|
+
transform: numberAttribute
|
56
65
|
});
|
57
|
-
/**
|
58
|
-
|
59
|
-
|
60
|
-
|
66
|
+
/**
|
67
|
+
* @description The preferred alignment against the trigger. May change when collisions occur.
|
68
|
+
* @default center
|
69
|
+
*/
|
70
|
+
this.align = input(RdxPositionAlign.Center);
|
71
|
+
/**
|
72
|
+
* @description An offset in pixels from the "start" or "end" alignment options.
|
73
|
+
* @default undefined
|
74
|
+
*/
|
75
|
+
this.alignOffset = input(NaN, {
|
76
|
+
transform: numberAttribute
|
61
77
|
});
|
62
|
-
/**
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
78
|
+
/**
|
79
|
+
* @description Whether to add some alternate positions of the content.
|
80
|
+
* @default false
|
81
|
+
*/
|
82
|
+
this.alternatePositionsDisabled = input(false, { transform: booleanAttribute });
|
83
|
+
/** @description Whether to prevent `onOverlayEscapeKeyDown` handler from calling. */
|
84
|
+
this.onOverlayEscapeKeyDownDisabled = input(false, { transform: booleanAttribute });
|
85
|
+
/** @description Whether to prevent `onOverlayOutsideClick` handler from calling. */
|
86
|
+
this.onOverlayOutsideClickDisabled = input(false, { transform: booleanAttribute });
|
87
|
+
/**
|
88
|
+
* @description Event handler called when the escape key is down.
|
89
|
+
* It can be prevented by setting `onOverlayEscapeKeyDownDisabled` input to `true`.
|
90
|
+
*/
|
91
|
+
this.onOverlayEscapeKeyDown = output();
|
92
|
+
/**
|
93
|
+
* @description Event handler called when a pointer event occurs outside the bounds of the component.
|
94
|
+
* It can be prevented by setting `onOverlayOutsideClickDisabled` input to `true`.
|
95
|
+
*/
|
96
|
+
this.onOverlayOutsideClick = output();
|
97
|
+
/**
|
98
|
+
* @description Event handler called after the overlay is open
|
99
|
+
*/
|
100
|
+
this.onOpen = output();
|
101
|
+
/**
|
102
|
+
* @description Event handler called after the overlay is closed
|
103
|
+
*/
|
104
|
+
this.onClosed = output();
|
105
|
+
/** @ingore */
|
106
|
+
this.positions = computed(() => this.computePositions());
|
107
|
+
this.onOriginChangeEffect();
|
108
|
+
this.onPositionChangeEffect();
|
109
|
+
}
|
110
|
+
/** @ignore */
|
111
|
+
ngOnInit() {
|
112
|
+
this.setScrollStrategy();
|
113
|
+
this.setHasBackdrop();
|
114
|
+
this.setDisableClose();
|
115
|
+
this.onAttach();
|
116
|
+
this.onDetach();
|
117
|
+
this.connectKeydownEscape();
|
118
|
+
this.connectOutsideClick();
|
119
|
+
}
|
120
|
+
/** @ignore */
|
121
|
+
open() {
|
122
|
+
if (this.connectedOverlay.open) {
|
123
|
+
return;
|
124
|
+
}
|
125
|
+
const prevOpen = this.connectedOverlay.open;
|
126
|
+
this.connectedOverlay.open = true;
|
127
|
+
this.fireOverlayNgOnChanges('open', this.connectedOverlay.open, prevOpen);
|
128
|
+
}
|
129
|
+
/** @ignore */
|
130
|
+
close() {
|
131
|
+
if (!this.connectedOverlay.open) {
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
const prevOpen = this.connectedOverlay.open;
|
135
|
+
this.connectedOverlay.open = false;
|
136
|
+
this.fireOverlayNgOnChanges('open', this.connectedOverlay.open, prevOpen);
|
137
|
+
}
|
138
|
+
/** @ignore */
|
139
|
+
positionChange() {
|
140
|
+
return this.connectedOverlay.positionChange.asObservable();
|
141
|
+
}
|
142
|
+
/** @ignore */
|
143
|
+
connectKeydownEscape() {
|
144
|
+
this.connectedOverlay.overlayKeydown
|
145
|
+
.asObservable()
|
146
|
+
.pipe(filter(() => !this.onOverlayEscapeKeyDownDisabled() &&
|
147
|
+
!this.rootDirective.rdxCdkEventService?.primitivePreventedFromCdkEvent(this.rootDirective, 'cdkOverlayEscapeKeyDown')), filter((event) => event.key === 'Escape'), tap((event) => {
|
148
|
+
this.onOverlayEscapeKeyDown.emit(event);
|
149
|
+
}), filter(() => !this.rootDirective.firstDefaultOpen()), tap(() => {
|
150
|
+
this.rootDirective.handleClose();
|
151
|
+
}), takeUntilDestroyed(this.destroyRef))
|
152
|
+
.subscribe();
|
153
|
+
}
|
154
|
+
/** @ignore */
|
155
|
+
connectOutsideClick() {
|
156
|
+
this.connectedOverlay.overlayOutsideClick
|
157
|
+
.asObservable()
|
158
|
+
.pipe(filter(() => !this.onOverlayOutsideClickDisabled() &&
|
159
|
+
!this.rootDirective.rdxCdkEventService?.primitivePreventedFromCdkEvent(this.rootDirective, 'cdkOverlayOutsideClick')),
|
160
|
+
/**
|
161
|
+
* Handle the situation when an anchor is added and the anchor becomes the origin of the overlay
|
162
|
+
* hence the trigger will be considered the outside element
|
163
|
+
*/
|
164
|
+
filter((event) => {
|
165
|
+
return (!this.rootDirective.anchorDirective() ||
|
166
|
+
!this.rootDirective
|
167
|
+
.triggerDirective()
|
168
|
+
.elementRef.nativeElement.contains(event.target));
|
169
|
+
}), tap((event) => {
|
170
|
+
this.onOverlayOutsideClick.emit(event);
|
171
|
+
}), filter(() => !this.rootDirective.firstDefaultOpen()), tap(() => {
|
172
|
+
this.rootDirective.handleClose();
|
173
|
+
}), takeUntilDestroyed(this.destroyRef))
|
174
|
+
.subscribe();
|
175
|
+
}
|
176
|
+
/** @ignore */
|
177
|
+
onAttach() {
|
178
|
+
this.connectedOverlay.attach
|
179
|
+
.asObservable()
|
180
|
+
.pipe(tap(() => {
|
181
|
+
/**
|
182
|
+
* `this.onOpen.emit();` is being delegated to the rootDirective directive due to the opening animation
|
183
|
+
*/
|
184
|
+
this.rootDirective.attachDetachEvent.set(RdxTooltipAttachDetachEvent.ATTACH);
|
185
|
+
}), takeUntilDestroyed(this.destroyRef))
|
186
|
+
.subscribe();
|
187
|
+
}
|
188
|
+
/** @ignore */
|
189
|
+
onDetach() {
|
190
|
+
this.connectedOverlay.detach
|
191
|
+
.asObservable()
|
192
|
+
.pipe(tap(() => {
|
193
|
+
/**
|
194
|
+
* `this.onClosed.emit();` is being delegated to the rootDirective directive due to the closing animation
|
195
|
+
*/
|
196
|
+
this.rootDirective.attachDetachEvent.set(RdxTooltipAttachDetachEvent.DETACH);
|
197
|
+
}), takeUntilDestroyed(this.destroyRef))
|
198
|
+
.subscribe();
|
199
|
+
}
|
200
|
+
/** @ignore */
|
201
|
+
setScrollStrategy() {
|
202
|
+
const prevScrollStrategy = this.connectedOverlay.scrollStrategy;
|
203
|
+
this.connectedOverlay.scrollStrategy = this.overlay.scrollStrategies.reposition();
|
204
|
+
this.fireOverlayNgOnChanges('scrollStrategy', this.connectedOverlay.scrollStrategy, prevScrollStrategy);
|
205
|
+
}
|
206
|
+
/** @ignore */
|
207
|
+
setHasBackdrop() {
|
208
|
+
const prevHasBackdrop = this.connectedOverlay.hasBackdrop;
|
209
|
+
this.connectedOverlay.hasBackdrop = false;
|
210
|
+
this.fireOverlayNgOnChanges('hasBackdrop', this.connectedOverlay.hasBackdrop, prevHasBackdrop);
|
211
|
+
}
|
212
|
+
/** @ignore */
|
213
|
+
setDisableClose() {
|
214
|
+
const prevDisableClose = this.connectedOverlay.disableClose;
|
215
|
+
this.connectedOverlay.disableClose = true;
|
216
|
+
this.fireOverlayNgOnChanges('disableClose', this.connectedOverlay.disableClose, prevDisableClose);
|
217
|
+
}
|
218
|
+
/** @ignore */
|
219
|
+
setOrigin(origin) {
|
220
|
+
const prevOrigin = this.connectedOverlay.origin;
|
221
|
+
this.connectedOverlay.origin = origin;
|
222
|
+
this.fireOverlayNgOnChanges('origin', this.connectedOverlay.origin, prevOrigin);
|
223
|
+
}
|
224
|
+
/** @ignore */
|
225
|
+
setPositions(positions) {
|
226
|
+
const prevPositions = this.connectedOverlay.positions;
|
227
|
+
this.connectedOverlay.positions = positions;
|
228
|
+
this.fireOverlayNgOnChanges('positions', this.connectedOverlay.positions, prevPositions);
|
229
|
+
this.connectedOverlay.overlayRef?.updatePosition();
|
230
|
+
}
|
231
|
+
/** @ignore */
|
232
|
+
computePositions() {
|
233
|
+
const arrowHeight = this.rootDirective.arrowDirective()?.height() ?? 0;
|
234
|
+
const offsets = {
|
235
|
+
sideOffset: isNaN(this.sideOffset())
|
236
|
+
? arrowHeight || RDX_POSITIONING_DEFAULTS.offsets.side
|
237
|
+
: this.sideOffset(),
|
238
|
+
alignOffset: isNaN(this.alignOffset()) ? RDX_POSITIONING_DEFAULTS.offsets.align : this.alignOffset()
|
239
|
+
};
|
240
|
+
const basePosition = getContentPosition({
|
241
|
+
side: this.side(),
|
242
|
+
align: this.align(),
|
243
|
+
sideOffset: offsets.sideOffset,
|
244
|
+
alignOffset: offsets.alignOffset
|
245
|
+
});
|
246
|
+
const positions = [basePosition];
|
247
|
+
if (!this.alternatePositionsDisabled()) {
|
248
|
+
/**
|
249
|
+
* Alternate positions for better user experience along the X/Y axis (e.g. vertical/horizontal scrolling)
|
250
|
+
*/
|
251
|
+
const allPossibleConnectedPositions = getAllPossibleConnectedPositions();
|
252
|
+
allPossibleConnectedPositions.forEach((_, key) => {
|
253
|
+
const sideAndAlignArray = key.split('|');
|
254
|
+
if (sideAndAlignArray[0] !== this.side() ||
|
255
|
+
sideAndAlignArray[1] !== this.align()) {
|
256
|
+
positions.push(getContentPosition({
|
257
|
+
side: sideAndAlignArray[0],
|
258
|
+
align: sideAndAlignArray[1],
|
259
|
+
sideOffset: offsets.sideOffset,
|
260
|
+
alignOffset: offsets.alignOffset
|
261
|
+
}));
|
88
262
|
}
|
89
|
-
}
|
263
|
+
});
|
264
|
+
}
|
265
|
+
return positions;
|
266
|
+
}
|
267
|
+
onOriginChangeEffect() {
|
268
|
+
effect(() => {
|
269
|
+
const origin = (this.rootDirective.anchorDirective() ?? this.rootDirective.triggerDirective())
|
270
|
+
.overlayOrigin;
|
271
|
+
untracked(() => {
|
272
|
+
this.setOrigin(origin);
|
273
|
+
});
|
90
274
|
});
|
91
275
|
}
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
276
|
+
/** @ignore */
|
277
|
+
onPositionChangeEffect() {
|
278
|
+
effect(() => {
|
279
|
+
const positions = this.positions();
|
280
|
+
this.alternatePositionsDisabled();
|
281
|
+
untracked(() => {
|
282
|
+
this.setPositions(positions);
|
283
|
+
});
|
284
|
+
});
|
285
|
+
}
|
286
|
+
/** @ignore */
|
287
|
+
fireOverlayNgOnChanges(input, currentValue, previousValue, firstChange = false) {
|
288
|
+
this.connectedOverlay.ngOnChanges({
|
289
|
+
[input]: new SimpleChange(previousValue, currentValue, firstChange)
|
290
|
+
});
|
291
|
+
}
|
292
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
293
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.5", type: RdxTooltipContentDirective, isStandalone: true, selector: "[rdxTooltipContent]", inputs: { side: { classPropertyName: "side", publicName: "side", isSignal: true, isRequired: false, transformFunction: null }, sideOffset: { classPropertyName: "sideOffset", publicName: "sideOffset", isSignal: true, isRequired: false, transformFunction: null }, align: { classPropertyName: "align", publicName: "align", isSignal: true, isRequired: false, transformFunction: null }, alignOffset: { classPropertyName: "alignOffset", publicName: "alignOffset", isSignal: true, isRequired: false, transformFunction: null }, alternatePositionsDisabled: { classPropertyName: "alternatePositionsDisabled", publicName: "alternatePositionsDisabled", isSignal: true, isRequired: false, transformFunction: null }, onOverlayEscapeKeyDownDisabled: { classPropertyName: "onOverlayEscapeKeyDownDisabled", publicName: "onOverlayEscapeKeyDownDisabled", isSignal: true, isRequired: false, transformFunction: null }, onOverlayOutsideClickDisabled: { classPropertyName: "onOverlayOutsideClickDisabled", publicName: "onOverlayOutsideClickDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { onOverlayEscapeKeyDown: "onOverlayEscapeKeyDown", onOverlayOutsideClick: "onOverlayOutsideClick", onOpen: "onOpen", onClosed: "onClosed" }, hostDirectives: [{ directive: i1.CdkConnectedOverlay }], ngImport: i0 }); }
|
99
294
|
}
|
100
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
295
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipContentDirective, decorators: [{
|
101
296
|
type: Directive,
|
102
297
|
args: [{
|
103
|
-
selector: '[
|
104
|
-
|
105
|
-
|
106
|
-
{
|
107
|
-
provide: RdxTooltipArrowToken,
|
108
|
-
useExisting: forwardRef(() => RdxTooltipArrowDirective)
|
109
|
-
}
|
298
|
+
selector: '[rdxTooltipContent]',
|
299
|
+
hostDirectives: [
|
300
|
+
CdkConnectedOverlay
|
110
301
|
]
|
111
302
|
}]
|
112
|
-
}] });
|
303
|
+
}], ctorParameters: () => [] });
|
113
304
|
|
114
305
|
class RdxTooltipTriggerDirective {
|
115
306
|
constructor() {
|
116
307
|
/** @ignore */
|
117
|
-
this.
|
308
|
+
this.rootDirective = injectTooltipRoot();
|
118
309
|
/** @ignore */
|
119
|
-
this.elementRef = inject(
|
310
|
+
this.elementRef = inject(ElementRef);
|
120
311
|
/** @ignore */
|
121
|
-
this.
|
312
|
+
this.overlayOrigin = inject(CdkOverlayOrigin);
|
122
313
|
/** @ignore */
|
123
|
-
this.
|
124
|
-
}
|
125
|
-
/** @ignore */
|
126
|
-
onPointerMove(event) {
|
127
|
-
if (event.pointerType === 'touch') {
|
128
|
-
return;
|
129
|
-
}
|
130
|
-
if (!this.isPointerInside) {
|
131
|
-
this.tooltipRoot.onTriggerEnter();
|
132
|
-
this.isPointerInside = true;
|
133
|
-
}
|
314
|
+
this.name = computed(() => `rdx-tooltip-trigger-${this.rootDirective.uniqueId()}`);
|
134
315
|
}
|
135
316
|
/** @ignore */
|
136
|
-
|
137
|
-
this.
|
138
|
-
this.tooltipRoot.onTriggerLeave();
|
317
|
+
pointerenter() {
|
318
|
+
this.rootDirective.handleOpen();
|
139
319
|
}
|
140
320
|
/** @ignore */
|
141
|
-
|
142
|
-
this.
|
143
|
-
this.elementRef.nativeElement.addEventListener('pointerup', () => {
|
144
|
-
this.isPointerDown = false;
|
145
|
-
}, { once: true });
|
321
|
+
pointerleave() {
|
322
|
+
this.rootDirective.handleClose();
|
146
323
|
}
|
147
324
|
/** @ignore */
|
148
|
-
|
149
|
-
|
150
|
-
this.tooltipRoot.handleOpen();
|
151
|
-
}
|
325
|
+
focus() {
|
326
|
+
this.rootDirective.handleOpen();
|
152
327
|
}
|
153
328
|
/** @ignore */
|
154
|
-
|
155
|
-
this.
|
329
|
+
blur() {
|
330
|
+
this.rootDirective.handleClose();
|
156
331
|
}
|
157
332
|
/** @ignore */
|
158
|
-
|
159
|
-
this.
|
333
|
+
click() {
|
334
|
+
this.rootDirective.handleClose();
|
160
335
|
}
|
161
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
162
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
336
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
337
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxTooltipTriggerDirective, isStandalone: true, selector: "[rdxTooltipTrigger]", host: { attributes: { "type": "button" }, listeners: { "pointerenter": "pointerenter()", "pointerleave": "pointerleave()", "focus": "focus()", "blur": "blur()", "click": "click()" }, properties: { "attr.id": "name()", "attr.aria-haspopup": "\"dialog\"", "attr.aria-expanded": "rootDirective.isOpen()", "attr.aria-controls": "rootDirective.contentDirective().name()", "attr.data-state": "rootDirective.state()" } }, hostDirectives: [{ directive: i1.CdkOverlayOrigin }], ngImport: i0 }); }
|
163
338
|
}
|
164
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
339
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipTriggerDirective, decorators: [{
|
165
340
|
type: Directive,
|
166
341
|
args: [{
|
167
342
|
selector: '[rdxTooltipTrigger]',
|
168
|
-
|
343
|
+
hostDirectives: [CdkOverlayOrigin],
|
169
344
|
host: {
|
170
|
-
|
171
|
-
'
|
172
|
-
'
|
173
|
-
'
|
174
|
-
'
|
175
|
-
'
|
176
|
-
'(
|
345
|
+
type: 'button',
|
346
|
+
'[attr.id]': 'name()',
|
347
|
+
'[attr.aria-haspopup]': '"dialog"',
|
348
|
+
'[attr.aria-expanded]': 'rootDirective.isOpen()',
|
349
|
+
'[attr.aria-controls]': 'rootDirective.contentDirective().name()',
|
350
|
+
'[attr.data-state]': 'rootDirective.state()',
|
351
|
+
'(pointerenter)': 'pointerenter()',
|
352
|
+
'(pointerleave)': 'pointerleave()',
|
353
|
+
'(focus)': 'focus()',
|
354
|
+
'(blur)': 'blur()',
|
355
|
+
'(click)': 'click()'
|
177
356
|
}
|
178
357
|
}]
|
179
358
|
}] });
|
180
359
|
|
181
|
-
const
|
182
|
-
|
183
|
-
|
184
|
-
}
|
185
|
-
const RdxTooltipConfigToken = new InjectionToken('RdxTooltipConfigToken');
|
186
|
-
function provideRdxTooltipConfig(config) {
|
187
|
-
return [
|
188
|
-
{
|
189
|
-
provide: RdxTooltipConfigToken,
|
190
|
-
useValue: { ...defaultTooltipConfig, ...config }
|
191
|
-
}
|
192
|
-
];
|
360
|
+
const RdxCdkEventServiceWindowKey = Symbol('__RdxCdkEventService__');
|
361
|
+
|
362
|
+
function eventTypeAsPrimitiveConfigKey(eventType) {
|
363
|
+
return `prevent${eventType[0].toUpperCase()}${eventType.slice(1)}`;
|
193
364
|
}
|
194
|
-
|
195
|
-
|
365
|
+
class RdxCdkEventService {
|
366
|
+
#clickDomRootEventCallbacks;
|
367
|
+
constructor() {
|
368
|
+
this.document = injectDocument();
|
369
|
+
this.destroyRef = inject(DestroyRef);
|
370
|
+
this.ngZone = inject(NgZone);
|
371
|
+
this.renderer2 = inject(Renderer2);
|
372
|
+
this.window = injectWindow();
|
373
|
+
this.onDestroyCallbacks = new Set([() => deleteRdxCdkEventServiceWindowKey(this.window)]);
|
374
|
+
this.#clickDomRootEventCallbacks = new Set();
|
375
|
+
this.#listenToClickDomRootEvent();
|
376
|
+
this.#registerOnDestroyCallbacks();
|
377
|
+
}
|
378
|
+
registerPrimitive(primitiveInstance) {
|
379
|
+
if (!this.primitiveConfigs) {
|
380
|
+
this.primitiveConfigs = new Map();
|
381
|
+
}
|
382
|
+
if (!this.primitiveConfigs.has(primitiveInstance)) {
|
383
|
+
this.primitiveConfigs.set(primitiveInstance, {});
|
384
|
+
}
|
385
|
+
}
|
386
|
+
deregisterPrimitive(primitiveInstance) {
|
387
|
+
if (this.primitiveConfigs?.has(primitiveInstance)) {
|
388
|
+
this.primitiveConfigs.delete(primitiveInstance);
|
389
|
+
}
|
390
|
+
}
|
391
|
+
preventPrimitiveFromCdkEvent(primitiveInstance, eventType) {
|
392
|
+
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, true);
|
393
|
+
}
|
394
|
+
allowPrimitiveForCdkEvent(primitiveInstance, eventType) {
|
395
|
+
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, false);
|
396
|
+
}
|
397
|
+
preventPrimitiveFromCdkMultiEvents(primitiveInstance, eventTypes) {
|
398
|
+
eventTypes.forEach((eventType) => {
|
399
|
+
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, true);
|
400
|
+
});
|
401
|
+
}
|
402
|
+
allowPrimitiveForCdkMultiEvents(primitiveInstance, eventTypes) {
|
403
|
+
eventTypes.forEach((eventType) => {
|
404
|
+
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, false);
|
405
|
+
});
|
406
|
+
}
|
407
|
+
setPreventPrimitiveFromCdkMixEvents(primitiveInstance, eventTypes) {
|
408
|
+
Object.keys(eventTypes).forEach((eventType) => {
|
409
|
+
this.#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, eventTypes[eventTypeAsPrimitiveConfigKey(eventType)]);
|
410
|
+
});
|
411
|
+
}
|
412
|
+
primitivePreventedFromCdkEvent(primitiveInstance, eventType) {
|
413
|
+
return this.primitiveConfigs?.get(primitiveInstance)?.[eventTypeAsPrimitiveConfigKey(eventType)];
|
414
|
+
}
|
415
|
+
addClickDomRootEventCallback(callback) {
|
416
|
+
this.#clickDomRootEventCallbacks.add(callback);
|
417
|
+
}
|
418
|
+
removeClickDomRootEventCallback(callback) {
|
419
|
+
return this.#clickDomRootEventCallbacks.delete(callback);
|
420
|
+
}
|
421
|
+
#setPreventPrimitiveFromCdkEvent(primitiveInstance, eventType, value) {
|
422
|
+
if (!this.primitiveConfigs?.has(primitiveInstance)) {
|
423
|
+
isDevMode() &&
|
424
|
+
console.error('[RdxCdkEventService.preventPrimitiveFromCdkEvent] RDX Primitive instance has not been registered!', primitiveInstance);
|
425
|
+
return;
|
426
|
+
}
|
427
|
+
switch (eventType) {
|
428
|
+
case 'cdkOverlayOutsideClick':
|
429
|
+
this.primitiveConfigs.get(primitiveInstance).preventCdkOverlayOutsideClick = value;
|
430
|
+
break;
|
431
|
+
case 'cdkOverlayEscapeKeyDown':
|
432
|
+
this.primitiveConfigs.get(primitiveInstance).preventCdkOverlayEscapeKeyDown = value;
|
433
|
+
break;
|
434
|
+
}
|
435
|
+
}
|
436
|
+
#registerOnDestroyCallbacks() {
|
437
|
+
this.destroyRef.onDestroy(() => {
|
438
|
+
this.onDestroyCallbacks.forEach((onDestroyCallback) => onDestroyCallback());
|
439
|
+
this.onDestroyCallbacks.clear();
|
440
|
+
});
|
441
|
+
}
|
442
|
+
#listenToClickDomRootEvent() {
|
443
|
+
const target = this.document;
|
444
|
+
const eventName = 'click';
|
445
|
+
const options = { capture: true };
|
446
|
+
const callback = (event) => {
|
447
|
+
this.#clickDomRootEventCallbacks.forEach((clickDomRootEventCallback) => clickDomRootEventCallback(event));
|
448
|
+
};
|
449
|
+
const major = parseInt(VERSION.major);
|
450
|
+
const minor = parseInt(VERSION.minor);
|
451
|
+
let destroyClickDomRootEventListener;
|
452
|
+
/**
|
453
|
+
* @see src/cdk/platform/features/backwards-compatibility.ts in @angular/cdk
|
454
|
+
*/
|
455
|
+
if (major > 19 || (major === 19 && minor > 0) || (major === 0 && minor === 0)) {
|
456
|
+
destroyClickDomRootEventListener = this.ngZone.runOutsideAngular(() => {
|
457
|
+
const destroyClickDomRootEventListenerInternal = this.renderer2.listen(target, eventName, callback,
|
458
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
459
|
+
// @ts-expect-error
|
460
|
+
options);
|
461
|
+
return () => {
|
462
|
+
destroyClickDomRootEventListenerInternal();
|
463
|
+
this.#clickDomRootEventCallbacks.clear();
|
464
|
+
};
|
465
|
+
});
|
466
|
+
}
|
467
|
+
else {
|
468
|
+
/**
|
469
|
+
* This part can get removed when v19.1 or higher is on the board
|
470
|
+
*/
|
471
|
+
destroyClickDomRootEventListener = this.ngZone.runOutsideAngular(() => {
|
472
|
+
target.addEventListener(eventName, callback, options);
|
473
|
+
return () => {
|
474
|
+
this.ngZone.runOutsideAngular(() => target.removeEventListener(eventName, callback, options));
|
475
|
+
this.#clickDomRootEventCallbacks.clear();
|
476
|
+
};
|
477
|
+
});
|
478
|
+
}
|
479
|
+
this.onDestroyCallbacks.add(destroyClickDomRootEventListener);
|
480
|
+
}
|
481
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCdkEventService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
|
482
|
+
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCdkEventService }); }
|
196
483
|
}
|
484
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxCdkEventService, decorators: [{
|
485
|
+
type: Injectable
|
486
|
+
}], ctorParameters: () => [] });
|
487
|
+
const RdxCdkEventServiceToken = new InjectionToken('RdxCdkEventServiceToken');
|
488
|
+
const existsErrorMessage = 'RdxCdkEventService should be provided only once!';
|
489
|
+
const deleteRdxCdkEventServiceWindowKey = (window) => {
|
490
|
+
delete window[RdxCdkEventServiceWindowKey];
|
491
|
+
};
|
492
|
+
const getProvider = (throwWhenExists = true) => ({
|
493
|
+
provide: RdxCdkEventServiceToken,
|
494
|
+
useFactory: () => {
|
495
|
+
isDevMode() && console.log('providing RdxCdkEventService...');
|
496
|
+
const window = injectWindow();
|
497
|
+
if (window[RdxCdkEventServiceWindowKey]) {
|
498
|
+
if (throwWhenExists) {
|
499
|
+
throw Error(existsErrorMessage);
|
500
|
+
}
|
501
|
+
else {
|
502
|
+
isDevMode() && console.warn(existsErrorMessage);
|
503
|
+
}
|
504
|
+
}
|
505
|
+
window[RdxCdkEventServiceWindowKey] ??= new RdxCdkEventService();
|
506
|
+
return window[RdxCdkEventServiceWindowKey];
|
507
|
+
}
|
508
|
+
});
|
509
|
+
const provideRdxCdkEventServiceInRoot = () => makeEnvironmentProviders([getProvider()]);
|
510
|
+
const provideRdxCdkEventService = () => getProvider(false);
|
511
|
+
const injectRdxCdkEventService = () => inject(RdxCdkEventServiceToken, { optional: true });
|
197
512
|
|
198
|
-
|
199
|
-
function injectTooltipRoot() {
|
200
|
-
return inject(RdxTooltipRootToken);
|
201
|
-
}
|
513
|
+
let nextId = 0;
|
202
514
|
class RdxTooltipRootDirective {
|
203
515
|
constructor() {
|
204
516
|
/** @ignore */
|
205
|
-
this.
|
206
|
-
/** @ignore */
|
207
|
-
this.destroyRef = inject(DestroyRef);
|
208
|
-
/** @ignore */
|
209
|
-
this.overlay = inject(Overlay);
|
210
|
-
/** @ignore */
|
211
|
-
this.platformId = inject(PLATFORM_ID);
|
517
|
+
this.uniqueId = signal(++nextId);
|
212
518
|
/** @ignore */
|
213
|
-
this.
|
214
|
-
/** @ignore */
|
215
|
-
this.tooltipConfig = injectTooltipConfig();
|
519
|
+
this.name = computed(() => `rdx-tooltip-root-${this.uniqueId()}`);
|
216
520
|
/**
|
217
|
-
* The
|
521
|
+
* @description The anchor directive that comes form outside the tooltip rootDirective
|
522
|
+
* @default undefined
|
218
523
|
*/
|
219
|
-
this.
|
524
|
+
this.anchor = input(void 0);
|
220
525
|
/**
|
221
|
-
* The
|
526
|
+
* @description The open state of the tooltip when it is initially rendered. Use when you do not need to control its open state.
|
527
|
+
* @default false
|
222
528
|
*/
|
223
|
-
this.
|
529
|
+
this.defaultOpen = input(false, { transform: booleanAttribute });
|
224
530
|
/**
|
225
|
-
*
|
531
|
+
* @description The controlled state of the tooltip. `open` input take precedence of `defaultOpen` input.
|
532
|
+
* @default undefined
|
226
533
|
*/
|
227
|
-
this.
|
228
|
-
/** @ignore */
|
229
|
-
this.disableHoverableContent = input(this.tooltipConfig.disableHoverableContent ?? false);
|
534
|
+
this.open = input(void 0, { transform: booleanAttribute });
|
230
535
|
/**
|
231
|
-
*
|
536
|
+
* To customise the open delay for a specific tooltip.
|
232
537
|
*/
|
233
|
-
this.
|
538
|
+
this.openDelay = input(500, {
|
539
|
+
transform: numberAttribute
|
540
|
+
});
|
541
|
+
/**
|
542
|
+
* To customise the close delay for a specific tooltip.
|
543
|
+
*/
|
544
|
+
this.closeDelay = input(200, {
|
545
|
+
transform: numberAttribute
|
546
|
+
});
|
547
|
+
/**
|
548
|
+
* @description Whether to control the state of the tooltip from external. Use in conjunction with `open` input.
|
549
|
+
* @default undefined
|
550
|
+
*/
|
551
|
+
this.externalControl = input(void 0, { transform: booleanAttribute });
|
552
|
+
/**
|
553
|
+
* @description Whether to take into account CSS opening/closing animations.
|
554
|
+
* @default false
|
555
|
+
*/
|
556
|
+
this.cssAnimation = input(false, { transform: booleanAttribute });
|
557
|
+
/**
|
558
|
+
* @description Whether to take into account CSS opening animations. `cssAnimation` input must be set to 'true'
|
559
|
+
* @default false
|
560
|
+
*/
|
561
|
+
this.cssOpeningAnimation = input(false, { transform: booleanAttribute });
|
562
|
+
/**
|
563
|
+
* @description Whether to take into account CSS closing animations. `cssAnimation` input must be set to 'true'
|
564
|
+
* @default false
|
565
|
+
*/
|
566
|
+
this.cssClosingAnimation = input(false, { transform: booleanAttribute });
|
234
567
|
/** @ignore */
|
235
|
-
this.
|
568
|
+
this.cssAnimationStatus = signal(null);
|
236
569
|
/** @ignore */
|
237
|
-
this.
|
570
|
+
this.contentDirective = contentChild.required(RdxTooltipContentDirective);
|
238
571
|
/** @ignore */
|
239
|
-
this.
|
572
|
+
this.triggerDirective = contentChild.required(RdxTooltipTriggerDirective);
|
240
573
|
/** @ignore */
|
241
|
-
this.
|
242
|
-
const currentIsOpen = this.isOpen();
|
243
|
-
const currentWasOpenDelayed = this.wasOpenDelayed();
|
244
|
-
if (currentIsOpen) {
|
245
|
-
return currentWasOpenDelayed ? 'delayed-open' : 'instant-open';
|
246
|
-
}
|
247
|
-
return 'closed';
|
248
|
-
});
|
574
|
+
this.arrowDirective = contentChild(RdxTooltipArrowToken);
|
249
575
|
/** @ignore */
|
250
|
-
this.
|
576
|
+
this.closeDirective = contentChild(RdxTooltipCloseToken);
|
251
577
|
/** @ignore */
|
252
|
-
this.
|
578
|
+
this.contentAttributesComponent = contentChild(RdxTooltipContentAttributesToken);
|
253
579
|
/** @ignore */
|
254
|
-
this.
|
580
|
+
this.internalAnchorDirective = contentChild(RdxTooltipAnchorToken);
|
255
581
|
/** @ignore */
|
256
|
-
this.
|
582
|
+
this.viewContainerRef = inject(ViewContainerRef);
|
257
583
|
/** @ignore */
|
258
|
-
this.
|
584
|
+
this.rdxCdkEventService = injectRdxCdkEventService();
|
259
585
|
/** @ignore */
|
260
|
-
this.
|
261
|
-
const isOpen = this.isOpen();
|
262
|
-
untracked(() => {
|
263
|
-
if (isOpen) {
|
264
|
-
this.show();
|
265
|
-
}
|
266
|
-
else {
|
267
|
-
this.hide();
|
268
|
-
}
|
269
|
-
});
|
270
|
-
});
|
586
|
+
this.destroyRef = inject(DestroyRef);
|
271
587
|
/** @ignore */
|
272
|
-
this.
|
273
|
-
const position = this.tooltipContentDirective().position();
|
274
|
-
if (this.overlayRef) {
|
275
|
-
const positionStrategy = this.getPositionStrategy(position);
|
276
|
-
this.overlayRef.updatePositionStrategy(positionStrategy);
|
277
|
-
}
|
278
|
-
});
|
588
|
+
this.state = signal(RdxTooltipState.CLOSED);
|
279
589
|
/** @ignore */
|
280
|
-
this.
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
590
|
+
this.attachDetachEvent = signal(RdxTooltipAttachDetachEvent.DETACH);
|
591
|
+
/** @ignore */
|
592
|
+
this.isFirstDefaultOpen = signal(false);
|
593
|
+
/** @ignore */
|
594
|
+
this.anchorDirective = computed(() => this.internalAnchorDirective() ?? this.anchor());
|
595
|
+
/** @ignore */
|
596
|
+
this.actionSubject$ = new Subject();
|
597
|
+
/** @ignore */
|
598
|
+
this.onAnchorChangeEffect = () => {
|
599
|
+
effect(() => {
|
600
|
+
const anchor = this.anchor();
|
601
|
+
untracked(() => {
|
602
|
+
if (anchor) {
|
603
|
+
anchor.setRoot(this);
|
604
|
+
}
|
605
|
+
});
|
287
606
|
});
|
607
|
+
};
|
608
|
+
this.rdxCdkEventService?.registerPrimitive(this);
|
609
|
+
this.destroyRef.onDestroy(() => this.rdxCdkEventService?.deregisterPrimitive(this));
|
610
|
+
this.actionSubscription();
|
611
|
+
this.onStateChangeEffect();
|
612
|
+
this.onCssAnimationStatusChangeChangeEffect();
|
613
|
+
this.onOpenChangeEffect();
|
614
|
+
this.onIsFirstDefaultOpenChangeEffect();
|
615
|
+
this.onAnchorChangeEffect();
|
616
|
+
this.emitOpenOrClosedEventEffect();
|
617
|
+
afterNextRender({
|
618
|
+
write: () => {
|
619
|
+
if (this.defaultOpen() && !this.open()) {
|
620
|
+
this.isFirstDefaultOpen.set(true);
|
621
|
+
}
|
622
|
+
}
|
288
623
|
});
|
289
624
|
}
|
290
625
|
/** @ignore */
|
291
|
-
|
292
|
-
|
293
|
-
this.
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
}
|
302
|
-
if (this.isOpenDelayed()) {
|
303
|
-
this.handleDelayedOpen();
|
304
|
-
}
|
305
|
-
else {
|
306
|
-
this.handleOpen();
|
307
|
-
}
|
308
|
-
}
|
309
|
-
/** @ignore */
|
310
|
-
onTriggerLeave() {
|
311
|
-
this.clearTimeout(this.openTimer);
|
312
|
-
this.handleClose();
|
626
|
+
getAnimationParamsSnapshot() {
|
627
|
+
return {
|
628
|
+
cssAnimation: this.cssAnimation(),
|
629
|
+
cssOpeningAnimation: this.cssOpeningAnimation(),
|
630
|
+
cssClosingAnimation: this.cssClosingAnimation(),
|
631
|
+
cssAnimationStatus: this.cssAnimationStatus(),
|
632
|
+
attachDetachEvent: this.attachDetachEvent(),
|
633
|
+
state: this.state(),
|
634
|
+
canEmitOnOpenOrOnClosed: this.canEmitOnOpenOrOnClosed()
|
635
|
+
};
|
313
636
|
}
|
314
637
|
/** @ignore */
|
315
|
-
|
316
|
-
this.
|
317
|
-
this.isOpenDelayed.set(false);
|
638
|
+
controlledExternally() {
|
639
|
+
return this.externalControl;
|
318
640
|
}
|
319
641
|
/** @ignore */
|
320
|
-
|
321
|
-
this.
|
322
|
-
if (isPlatformBrowser(this.platformId)) {
|
323
|
-
this.skipDelayTimer = window.setTimeout(() => {
|
324
|
-
this.isOpenDelayed.set(true);
|
325
|
-
}, this.tooltipConfig.skipDelayDuration);
|
326
|
-
}
|
642
|
+
firstDefaultOpen() {
|
643
|
+
return this.isFirstDefaultOpen();
|
327
644
|
}
|
328
645
|
/** @ignore */
|
329
646
|
handleOpen() {
|
330
|
-
if (this.
|
647
|
+
if (this.externalControl()) {
|
331
648
|
return;
|
332
649
|
}
|
333
|
-
this.
|
334
|
-
this.setOpen(true);
|
650
|
+
this.actionSubject$.next(RdxTooltipAction.OPEN);
|
335
651
|
}
|
336
652
|
/** @ignore */
|
337
|
-
handleClose() {
|
338
|
-
if (this.
|
653
|
+
handleClose(closeButton) {
|
654
|
+
if (this.isFirstDefaultOpen()) {
|
655
|
+
this.isFirstDefaultOpen.set(false);
|
656
|
+
}
|
657
|
+
if (!closeButton && this.externalControl()) {
|
339
658
|
return;
|
340
659
|
}
|
341
|
-
this.
|
342
|
-
this.setOpen(false);
|
660
|
+
this.actionSubject$.next(RdxTooltipAction.CLOSE);
|
343
661
|
}
|
344
662
|
/** @ignore */
|
345
|
-
|
346
|
-
if (
|
663
|
+
handleToggle() {
|
664
|
+
if (this.externalControl()) {
|
347
665
|
return;
|
348
666
|
}
|
349
|
-
this.
|
350
|
-
.keydownEvents()
|
351
|
-
.pipe(filter((event) => event.key === 'Escape'), takeUntilDestroyed(this.destroyRef))
|
352
|
-
.subscribe((event) => {
|
353
|
-
this.tooltipContentDirective().onEscapeKeyDown.emit(event);
|
354
|
-
if (!event.defaultPrevented) {
|
355
|
-
this.handleClose();
|
356
|
-
}
|
357
|
-
});
|
667
|
+
this.isOpen() ? this.handleClose() : this.handleOpen();
|
358
668
|
}
|
359
669
|
/** @ignore */
|
360
|
-
|
361
|
-
|
670
|
+
isOpen(state) {
|
671
|
+
return (state ?? this.state()) === RdxTooltipState.OPEN;
|
672
|
+
}
|
673
|
+
/** @ignore */
|
674
|
+
setState(state = RdxTooltipState.CLOSED) {
|
675
|
+
if (state === this.state()) {
|
362
676
|
return;
|
363
677
|
}
|
364
|
-
this.
|
365
|
-
.outsidePointerEvents()
|
366
|
-
.pipe(takeUntilDestroyed(this.destroyRef))
|
367
|
-
.subscribe((event) => this.tooltipContentDirective().onPointerDownOutside.emit(event));
|
368
|
-
}
|
369
|
-
/** @ignore */
|
370
|
-
handleDelayedOpen() {
|
371
|
-
this.clearTimeout(this.openTimer);
|
372
|
-
if (isPlatformBrowser(this.platformId)) {
|
373
|
-
this.openTimer = window.setTimeout(() => {
|
374
|
-
this.wasOpenDelayed.set(true);
|
375
|
-
this.setOpen(true);
|
376
|
-
}, this.delayDuration());
|
377
|
-
}
|
678
|
+
this.state.set(state);
|
378
679
|
}
|
379
680
|
/** @ignore */
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
this.
|
681
|
+
openContent() {
|
682
|
+
this.contentDirective().open();
|
683
|
+
if (!this.cssAnimation() || !this.cssOpeningAnimation()) {
|
684
|
+
this.cssAnimationStatus.set(null);
|
384
685
|
}
|
385
|
-
else {
|
386
|
-
this.onClose();
|
387
|
-
}
|
388
|
-
this.isOpen.set(open);
|
389
|
-
this.onOpenChange.emit(open);
|
390
686
|
}
|
391
687
|
/** @ignore */
|
392
|
-
|
393
|
-
|
394
|
-
|
688
|
+
closeContent() {
|
689
|
+
this.contentDirective().close();
|
690
|
+
if (!this.cssAnimation() || !this.cssClosingAnimation()) {
|
691
|
+
this.cssAnimationStatus.set(null);
|
395
692
|
}
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
693
|
+
}
|
694
|
+
/** @ignore */
|
695
|
+
emitOnOpen() {
|
696
|
+
this.contentDirective().onOpen.emit();
|
697
|
+
}
|
698
|
+
/** @ignore */
|
699
|
+
emitOnClosed() {
|
700
|
+
this.contentDirective().onClosed.emit();
|
701
|
+
}
|
702
|
+
/** @ignore */
|
703
|
+
ifOpenOrCloseWithoutAnimations(state) {
|
704
|
+
return (!this.contentAttributesComponent() ||
|
705
|
+
!this.cssAnimation() ||
|
706
|
+
(this.cssAnimation() && !this.cssClosingAnimation() && state === RdxTooltipState.CLOSED) ||
|
707
|
+
(this.cssAnimation() && !this.cssOpeningAnimation() && state === RdxTooltipState.OPEN) ||
|
708
|
+
// !this.cssAnimationStatus() ||
|
709
|
+
(this.cssOpeningAnimation() &&
|
710
|
+
state === RdxTooltipState.OPEN &&
|
711
|
+
[RdxTooltipAnimationStatus.OPEN_STARTED].includes(this.cssAnimationStatus())) ||
|
712
|
+
(this.cssClosingAnimation() &&
|
713
|
+
state === RdxTooltipState.CLOSED &&
|
714
|
+
[RdxTooltipAnimationStatus.CLOSED_STARTED].includes(this.cssAnimationStatus())));
|
715
|
+
}
|
716
|
+
/** @ignore */
|
717
|
+
ifOpenOrCloseWithAnimations(cssAnimationStatus) {
|
718
|
+
return (this.contentAttributesComponent() &&
|
719
|
+
this.cssAnimation() &&
|
720
|
+
cssAnimationStatus &&
|
721
|
+
((this.cssOpeningAnimation() &&
|
722
|
+
this.state() === RdxTooltipState.OPEN &&
|
723
|
+
[RdxTooltipAnimationStatus.OPEN_ENDED].includes(cssAnimationStatus)) ||
|
724
|
+
(this.cssClosingAnimation() &&
|
725
|
+
this.state() === RdxTooltipState.CLOSED &&
|
726
|
+
[RdxTooltipAnimationStatus.CLOSED_ENDED].includes(cssAnimationStatus))));
|
727
|
+
}
|
728
|
+
/** @ignore */
|
729
|
+
openOrClose(state) {
|
730
|
+
const isOpen = this.isOpen(state);
|
731
|
+
isOpen ? this.openContent() : this.closeContent();
|
732
|
+
}
|
733
|
+
/** @ignore */
|
734
|
+
emitOnOpenOrOnClosed(state) {
|
735
|
+
this.isOpen(state)
|
736
|
+
? this.attachDetachEvent() === RdxTooltipAttachDetachEvent.ATTACH && this.emitOnOpen()
|
737
|
+
: this.attachDetachEvent() === RdxTooltipAttachDetachEvent.DETACH && this.emitOnClosed();
|
738
|
+
}
|
739
|
+
/** @ignore */
|
740
|
+
canEmitOnOpenOrOnClosed() {
|
741
|
+
return (!this.cssAnimation() ||
|
742
|
+
(!this.cssOpeningAnimation() && this.state() === RdxTooltipState.OPEN) ||
|
743
|
+
(this.cssOpeningAnimation() &&
|
744
|
+
this.state() === RdxTooltipState.OPEN &&
|
745
|
+
this.cssAnimationStatus() === RdxTooltipAnimationStatus.OPEN_ENDED) ||
|
746
|
+
(!this.cssClosingAnimation() && this.state() === RdxTooltipState.CLOSED) ||
|
747
|
+
(this.cssClosingAnimation() &&
|
748
|
+
this.state() === RdxTooltipState.CLOSED &&
|
749
|
+
this.cssAnimationStatus() === RdxTooltipAnimationStatus.CLOSED_ENDED));
|
750
|
+
}
|
751
|
+
/** @ignore */
|
752
|
+
onStateChangeEffect() {
|
753
|
+
let isFirst = true;
|
754
|
+
effect(() => {
|
755
|
+
const state = this.state();
|
756
|
+
untracked(() => {
|
757
|
+
if (isFirst) {
|
758
|
+
isFirst = false;
|
759
|
+
return;
|
760
|
+
}
|
761
|
+
if (!this.ifOpenOrCloseWithoutAnimations(state)) {
|
762
|
+
return;
|
763
|
+
}
|
764
|
+
this.openOrClose(state);
|
765
|
+
});
|
766
|
+
}, {});
|
767
|
+
}
|
768
|
+
/** @ignore */
|
769
|
+
onCssAnimationStatusChangeChangeEffect() {
|
770
|
+
let isFirst = true;
|
771
|
+
effect(() => {
|
772
|
+
const cssAnimationStatus = this.cssAnimationStatus();
|
773
|
+
untracked(() => {
|
774
|
+
if (isFirst) {
|
775
|
+
isFirst = false;
|
776
|
+
return;
|
777
|
+
}
|
778
|
+
if (!this.ifOpenOrCloseWithAnimations(cssAnimationStatus)) {
|
779
|
+
return;
|
780
|
+
}
|
781
|
+
this.openOrClose(this.state());
|
782
|
+
});
|
400
783
|
});
|
401
|
-
this.overlayRef
|
402
|
-
.detachments()
|
403
|
-
.pipe(take(1), takeUntilDestroyed(this.destroyRef))
|
404
|
-
.subscribe(() => this.detach());
|
405
|
-
this.handleOverlayKeydown();
|
406
|
-
this.handlePointerDownOutside();
|
407
|
-
return this.overlayRef;
|
408
|
-
}
|
409
|
-
/** @ignore */
|
410
|
-
show() {
|
411
|
-
this.overlayRef = this.createOverlayRef();
|
412
|
-
this.detach();
|
413
|
-
this.portal =
|
414
|
-
this.portal ||
|
415
|
-
new TemplatePortal(this.tooltipContentDirective().templateRef, this.viewContainerRef, {
|
416
|
-
state: this.state,
|
417
|
-
side: this.tooltipContentDirective().side
|
418
|
-
});
|
419
|
-
this.instance = this.overlayRef.attach(this.portal);
|
420
784
|
}
|
421
785
|
/** @ignore */
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
786
|
+
emitOpenOrClosedEventEffect() {
|
787
|
+
let isFirst = true;
|
788
|
+
effect(() => {
|
789
|
+
this.attachDetachEvent();
|
790
|
+
this.cssAnimationStatus();
|
791
|
+
untracked(() => {
|
792
|
+
if (isFirst) {
|
793
|
+
isFirst = false;
|
794
|
+
return;
|
795
|
+
}
|
796
|
+
const canEmitOpenClose = untracked(() => this.canEmitOnOpenOrOnClosed());
|
797
|
+
if (!canEmitOpenClose) {
|
798
|
+
return;
|
799
|
+
}
|
800
|
+
this.emitOnOpenOrOnClosed(this.state());
|
801
|
+
});
|
802
|
+
});
|
426
803
|
}
|
427
804
|
/** @ignore */
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
}
|
805
|
+
onOpenChangeEffect() {
|
806
|
+
effect(() => {
|
807
|
+
const open = this.open();
|
808
|
+
untracked(() => {
|
809
|
+
this.setState(open ? RdxTooltipState.OPEN : RdxTooltipState.CLOSED);
|
810
|
+
});
|
811
|
+
});
|
812
|
+
}
|
813
|
+
/** @ignore */
|
814
|
+
onIsFirstDefaultOpenChangeEffect() {
|
815
|
+
const effectRef = effect(() => {
|
816
|
+
const defaultOpen = this.defaultOpen();
|
817
|
+
untracked(() => {
|
818
|
+
if (!defaultOpen || this.open()) {
|
819
|
+
effectRef.destroy();
|
820
|
+
return;
|
821
|
+
}
|
822
|
+
this.handleOpen();
|
823
|
+
});
|
824
|
+
});
|
435
825
|
}
|
436
826
|
/** @ignore */
|
437
|
-
|
438
|
-
|
439
|
-
.
|
440
|
-
.
|
441
|
-
.
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
827
|
+
actionSubscription() {
|
828
|
+
this.actionSubject$
|
829
|
+
.asObservable()
|
830
|
+
.pipe(map((action) => {
|
831
|
+
console.log(action);
|
832
|
+
switch (action) {
|
833
|
+
case RdxTooltipAction.OPEN:
|
834
|
+
return { action, duration: this.openDelay() };
|
835
|
+
case RdxTooltipAction.CLOSE:
|
836
|
+
return { action, duration: this.closeDelay() };
|
837
|
+
}
|
838
|
+
}), debounce((config) => timer(config.duration)), tap((config) => {
|
839
|
+
switch (config.action) {
|
840
|
+
case RdxTooltipAction.OPEN:
|
841
|
+
this.setState(RdxTooltipState.OPEN);
|
842
|
+
break;
|
843
|
+
case RdxTooltipAction.CLOSE:
|
844
|
+
this.setState(RdxTooltipState.CLOSED);
|
845
|
+
break;
|
846
|
+
}
|
847
|
+
}), takeUntilDestroyed())
|
848
|
+
.subscribe();
|
849
|
+
}
|
850
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipRootDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
851
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "19.0.5", type: RdxTooltipRootDirective, isStandalone: true, selector: "[rdxTooltipRoot]", inputs: { anchor: { classPropertyName: "anchor", publicName: "anchor", isSignal: true, isRequired: false, transformFunction: null }, defaultOpen: { classPropertyName: "defaultOpen", publicName: "defaultOpen", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null }, openDelay: { classPropertyName: "openDelay", publicName: "openDelay", isSignal: true, isRequired: false, transformFunction: null }, closeDelay: { classPropertyName: "closeDelay", publicName: "closeDelay", isSignal: true, isRequired: false, transformFunction: null }, externalControl: { classPropertyName: "externalControl", publicName: "externalControl", isSignal: true, isRequired: false, transformFunction: null }, cssAnimation: { classPropertyName: "cssAnimation", publicName: "cssAnimation", isSignal: true, isRequired: false, transformFunction: null }, cssOpeningAnimation: { classPropertyName: "cssOpeningAnimation", publicName: "cssOpeningAnimation", isSignal: true, isRequired: false, transformFunction: null }, cssClosingAnimation: { classPropertyName: "cssClosingAnimation", publicName: "cssClosingAnimation", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "contentDirective", first: true, predicate: RdxTooltipContentDirective, descendants: true, isSignal: true }, { propertyName: "triggerDirective", first: true, predicate: RdxTooltipTriggerDirective, descendants: true, isSignal: true }, { propertyName: "arrowDirective", first: true, predicate: RdxTooltipArrowToken, descendants: true, isSignal: true }, { propertyName: "closeDirective", first: true, predicate: RdxTooltipCloseToken, descendants: true, isSignal: true }, { propertyName: "contentAttributesComponent", first: true, predicate: RdxTooltipContentAttributesToken, descendants: true, isSignal: true }, { propertyName: "internalAnchorDirective", first: true, predicate: RdxTooltipAnchorToken, descendants: true, isSignal: true }], exportAs: ["rdxTooltipRoot"], ngImport: i0 }); }
|
852
|
+
}
|
853
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipRootDirective, decorators: [{
|
854
|
+
type: Directive,
|
855
|
+
args: [{
|
856
|
+
selector: '[rdxTooltipRoot]',
|
857
|
+
exportAs: 'rdxTooltipRoot'
|
858
|
+
}]
|
859
|
+
}], ctorParameters: () => [] });
|
860
|
+
|
861
|
+
function injectTooltipRoot(optional = false) {
|
862
|
+
isDevMode() && assertInInjectionContext(injectTooltipRoot);
|
863
|
+
return inject(RdxTooltipRootDirective, { optional });
|
864
|
+
}
|
865
|
+
|
866
|
+
class RdxTooltipAnchorDirective {
|
867
|
+
constructor() {
|
868
|
+
/**
|
869
|
+
* @ignore
|
870
|
+
* If outside the rootDirective then null, otherwise the rootDirective directive - with optional `true` passed in as the first param.
|
871
|
+
* If outside the rootDirective and non-null value that means the html structure is wrong - tooltip inside tooltip.
|
872
|
+
* */
|
873
|
+
this.rootDirective = injectTooltipRoot(true);
|
874
|
+
/** @ignore */
|
875
|
+
this.elementRef = inject(ElementRef);
|
876
|
+
/** @ignore */
|
877
|
+
this.overlayOrigin = inject(CdkOverlayOrigin);
|
878
|
+
/** @ignore */
|
879
|
+
this.document = injectDocument();
|
880
|
+
/** @ignore */
|
881
|
+
this.name = computed(() => `rdx-tooltip-external-anchor-${this.rootDirective?.uniqueId()}`);
|
882
|
+
}
|
883
|
+
/** @ignore */
|
884
|
+
click() {
|
885
|
+
this.emitOutsideClick();
|
446
886
|
}
|
447
887
|
/** @ignore */
|
448
|
-
|
449
|
-
|
450
|
-
|
888
|
+
setRoot(root) {
|
889
|
+
this.rootDirective = root;
|
890
|
+
}
|
891
|
+
emitOutsideClick() {
|
892
|
+
if (!this.rootDirective?.isOpen() || this.rootDirective?.contentDirective().onOverlayOutsideClickDisabled()) {
|
893
|
+
return;
|
451
894
|
}
|
895
|
+
const clickEvent = new MouseEvent('click', {
|
896
|
+
view: this.document.defaultView,
|
897
|
+
bubbles: true,
|
898
|
+
cancelable: true,
|
899
|
+
relatedTarget: this.elementRef.nativeElement
|
900
|
+
});
|
901
|
+
this.rootDirective?.triggerDirective().elementRef.nativeElement.dispatchEvent(clickEvent);
|
452
902
|
}
|
453
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
454
|
-
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "
|
903
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipAnchorDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
904
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxTooltipAnchorDirective, isStandalone: true, selector: "[rdxTooltipAnchor]", host: { attributes: { "type": "button" }, listeners: { "click": "click()" }, properties: { "attr.id": "name()", "attr.aria-haspopup": "\"dialog\"" } }, providers: [
|
455
905
|
{
|
456
|
-
provide:
|
457
|
-
useExisting: forwardRef(() =>
|
906
|
+
provide: RdxTooltipAnchorToken,
|
907
|
+
useExisting: forwardRef(() => RdxTooltipAnchorDirective)
|
458
908
|
}
|
459
|
-
],
|
909
|
+
], exportAs: ["rdxTooltipAnchor"], hostDirectives: [{ directive: i1.CdkOverlayOrigin }], ngImport: i0 }); }
|
460
910
|
}
|
461
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
911
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipAnchorDirective, decorators: [{
|
462
912
|
type: Directive,
|
463
913
|
args: [{
|
464
|
-
selector: '[
|
465
|
-
|
914
|
+
selector: '[rdxTooltipAnchor]',
|
915
|
+
exportAs: 'rdxTooltipAnchor',
|
916
|
+
hostDirectives: [CdkOverlayOrigin],
|
917
|
+
host: {
|
918
|
+
type: 'button',
|
919
|
+
'[attr.id]': 'name()',
|
920
|
+
'[attr.aria-haspopup]': '"dialog"',
|
921
|
+
'(click)': 'click()'
|
922
|
+
},
|
466
923
|
providers: [
|
467
924
|
{
|
468
|
-
provide:
|
469
|
-
useExisting: forwardRef(() =>
|
925
|
+
provide: RdxTooltipAnchorToken,
|
926
|
+
useExisting: forwardRef(() => RdxTooltipAnchorDirective)
|
470
927
|
}
|
471
|
-
]
|
472
|
-
exportAs: 'rdxTooltipRoot'
|
928
|
+
]
|
473
929
|
}]
|
474
930
|
}] });
|
475
931
|
|
476
|
-
class
|
932
|
+
class RdxTooltipArrowDirective {
|
477
933
|
constructor() {
|
478
|
-
|
479
|
-
this.
|
934
|
+
/** @ignore */
|
935
|
+
this.renderer = inject(Renderer2);
|
936
|
+
/** @ignore */
|
937
|
+
this.rootDirective = injectTooltipRoot();
|
938
|
+
/** @ignore */
|
939
|
+
this.elementRef = inject(ElementRef);
|
940
|
+
/**
|
941
|
+
* @description The width of the arrow in pixels.
|
942
|
+
* @default 10
|
943
|
+
*/
|
944
|
+
this.width = input(RDX_POSITIONING_DEFAULTS.arrow.width, { transform: numberAttribute });
|
945
|
+
/**
|
946
|
+
* @description The height of the arrow in pixels.
|
947
|
+
* @default 5
|
948
|
+
*/
|
949
|
+
this.height = input(RDX_POSITIONING_DEFAULTS.arrow.height, { transform: numberAttribute });
|
950
|
+
/** @ignore */
|
951
|
+
this.arrowSvgElement = computed(() => {
|
952
|
+
const width = this.width();
|
953
|
+
const height = this.height();
|
954
|
+
const svgElement = this.renderer.createElement('svg', 'svg');
|
955
|
+
this.renderer.setAttribute(svgElement, 'viewBox', '0 0 30 10');
|
956
|
+
this.renderer.setAttribute(svgElement, 'width', String(width));
|
957
|
+
this.renderer.setAttribute(svgElement, 'height', String(height));
|
958
|
+
const polygonElement = this.renderer.createElement('polygon', 'svg');
|
959
|
+
this.renderer.setAttribute(polygonElement, 'points', '0,0 30,0 15,10');
|
960
|
+
this.renderer.setAttribute(svgElement, 'preserveAspectRatio', 'none');
|
961
|
+
this.renderer.appendChild(svgElement, polygonElement);
|
962
|
+
return svgElement;
|
963
|
+
});
|
964
|
+
/** @ignore */
|
965
|
+
this.currentArrowSvgElement = signal(void 0);
|
966
|
+
/** @ignore */
|
967
|
+
this.position = toSignal(this.rootDirective.contentDirective().positionChange());
|
968
|
+
afterNextRender({
|
969
|
+
write: () => {
|
970
|
+
if (this.elementRef.nativeElement.parentElement) {
|
971
|
+
this.renderer.setStyle(this.elementRef.nativeElement.parentElement, 'position', 'relative');
|
972
|
+
}
|
973
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'position', 'absolute');
|
974
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'boxSizing', '');
|
975
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'fontSize', '0px');
|
976
|
+
}
|
977
|
+
});
|
978
|
+
this.onArrowSvgElementChangeEffect();
|
979
|
+
this.onContentPositionAndArrowDimensionsChangeEffect();
|
980
|
+
}
|
981
|
+
/** @ignore */
|
982
|
+
setAnchorOrTriggerRect() {
|
983
|
+
this.anchorOrTriggerRect = (this.rootDirective.anchorDirective() ?? this.rootDirective.triggerDirective()).elementRef.nativeElement.getBoundingClientRect();
|
480
984
|
}
|
481
|
-
|
482
|
-
|
985
|
+
/** @ignore */
|
986
|
+
setPosition(position, arrowDimensions) {
|
987
|
+
this.setAnchorOrTriggerRect();
|
988
|
+
const posParams = getArrowPositionParams(getSideAndAlignFromAllPossibleConnectedPositions(position.connectionPair), { width: arrowDimensions.width, height: arrowDimensions.height }, { width: this.anchorOrTriggerRect.width, height: this.anchorOrTriggerRect.height });
|
989
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'top', posParams.top);
|
990
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'bottom', '');
|
991
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'left', posParams.left);
|
992
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'right', '');
|
993
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'transform', posParams.transform);
|
994
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'transformOrigin', posParams.transformOrigin);
|
995
|
+
}
|
996
|
+
/** @ignore */
|
997
|
+
onArrowSvgElementChangeEffect() {
|
998
|
+
effect(() => {
|
999
|
+
const arrowElement = this.arrowSvgElement();
|
1000
|
+
untracked(() => {
|
1001
|
+
const currentArrowSvgElement = this.currentArrowSvgElement();
|
1002
|
+
if (currentArrowSvgElement) {
|
1003
|
+
this.renderer.removeChild(this.elementRef.nativeElement, currentArrowSvgElement);
|
1004
|
+
}
|
1005
|
+
this.currentArrowSvgElement.set(arrowElement);
|
1006
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'width', `${this.width()}px`);
|
1007
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'height', `${this.height()}px`);
|
1008
|
+
this.renderer.appendChild(this.elementRef.nativeElement, this.currentArrowSvgElement());
|
1009
|
+
});
|
1010
|
+
});
|
1011
|
+
}
|
1012
|
+
/** @ignore */
|
1013
|
+
onContentPositionAndArrowDimensionsChangeEffect() {
|
1014
|
+
effect(() => {
|
1015
|
+
const position = this.position();
|
1016
|
+
const arrowDimensions = { width: this.width(), height: this.height() };
|
1017
|
+
untracked(() => {
|
1018
|
+
if (!position) {
|
1019
|
+
return;
|
1020
|
+
}
|
1021
|
+
this.setPosition(position, arrowDimensions);
|
1022
|
+
});
|
1023
|
+
});
|
1024
|
+
}
|
1025
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipArrowDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
1026
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "19.0.5", type: RdxTooltipArrowDirective, isStandalone: true, selector: "[rdxTooltipArrow]", inputs: { width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null } }, providers: [
|
1027
|
+
{
|
1028
|
+
provide: RdxTooltipArrowToken,
|
1029
|
+
useExisting: forwardRef(() => RdxTooltipArrowDirective)
|
1030
|
+
}
|
1031
|
+
], ngImport: i0 }); }
|
483
1032
|
}
|
484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1033
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipArrowDirective, decorators: [{
|
485
1034
|
type: Directive,
|
486
1035
|
args: [{
|
487
|
-
selector: '[
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
1036
|
+
selector: '[rdxTooltipArrow]',
|
1037
|
+
providers: [
|
1038
|
+
{
|
1039
|
+
provide: RdxTooltipArrowToken,
|
1040
|
+
useExisting: forwardRef(() => RdxTooltipArrowDirective)
|
1041
|
+
}
|
1042
|
+
]
|
493
1043
|
}]
|
494
|
-
}] });
|
495
|
-
|
496
|
-
const TOOLTIP_POSITIONS = {
|
497
|
-
[RdxTooltipSide.Top]: {
|
498
|
-
[RdxTooltipAlign.Center]: {
|
499
|
-
originX: 'center',
|
500
|
-
originY: 'top',
|
501
|
-
overlayX: 'center',
|
502
|
-
overlayY: 'bottom'
|
503
|
-
},
|
504
|
-
[RdxTooltipAlign.Start]: {
|
505
|
-
originX: 'start',
|
506
|
-
originY: 'top',
|
507
|
-
overlayX: 'start',
|
508
|
-
overlayY: 'bottom'
|
509
|
-
},
|
510
|
-
[RdxTooltipAlign.End]: {
|
511
|
-
originX: 'end',
|
512
|
-
originY: 'top',
|
513
|
-
overlayX: 'end',
|
514
|
-
overlayY: 'bottom'
|
515
|
-
}
|
516
|
-
},
|
517
|
-
[RdxTooltipSide.Right]: {
|
518
|
-
[RdxTooltipAlign.Center]: {
|
519
|
-
originX: 'end',
|
520
|
-
originY: 'center',
|
521
|
-
overlayX: 'start',
|
522
|
-
overlayY: 'center'
|
523
|
-
},
|
524
|
-
[RdxTooltipAlign.Start]: {
|
525
|
-
originX: 'end',
|
526
|
-
originY: 'top',
|
527
|
-
overlayX: 'start',
|
528
|
-
overlayY: 'top'
|
529
|
-
},
|
530
|
-
[RdxTooltipAlign.End]: {
|
531
|
-
originX: 'end',
|
532
|
-
originY: 'bottom',
|
533
|
-
overlayX: 'start',
|
534
|
-
overlayY: 'bottom'
|
535
|
-
}
|
536
|
-
},
|
537
|
-
[RdxTooltipSide.Bottom]: {
|
538
|
-
[RdxTooltipAlign.Center]: {
|
539
|
-
originX: 'center',
|
540
|
-
originY: 'bottom',
|
541
|
-
overlayX: 'center',
|
542
|
-
overlayY: 'top'
|
543
|
-
},
|
544
|
-
[RdxTooltipAlign.Start]: {
|
545
|
-
originX: 'start',
|
546
|
-
originY: 'bottom',
|
547
|
-
overlayX: 'start',
|
548
|
-
overlayY: 'top'
|
549
|
-
},
|
550
|
-
[RdxTooltipAlign.End]: {
|
551
|
-
originX: 'end',
|
552
|
-
originY: 'bottom',
|
553
|
-
overlayX: 'end',
|
554
|
-
overlayY: 'top'
|
555
|
-
}
|
556
|
-
},
|
557
|
-
[RdxTooltipSide.Left]: {
|
558
|
-
[RdxTooltipAlign.Center]: {
|
559
|
-
originX: 'start',
|
560
|
-
originY: 'center',
|
561
|
-
overlayX: 'end',
|
562
|
-
overlayY: 'center'
|
563
|
-
},
|
564
|
-
[RdxTooltipAlign.Start]: {
|
565
|
-
originX: 'start',
|
566
|
-
originY: 'top',
|
567
|
-
overlayX: 'end',
|
568
|
-
overlayY: 'top'
|
569
|
-
},
|
570
|
-
[RdxTooltipAlign.End]: {
|
571
|
-
originX: 'start',
|
572
|
-
originY: 'bottom',
|
573
|
-
overlayX: 'end',
|
574
|
-
overlayY: 'bottom'
|
575
|
-
}
|
576
|
-
}
|
577
|
-
};
|
1044
|
+
}], ctorParameters: () => [] });
|
578
1045
|
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
case RdxTooltipSide.Left:
|
592
|
-
xFactor = -1;
|
593
|
-
break;
|
594
|
-
case RdxTooltipSide.Right:
|
595
|
-
xFactor = 1;
|
596
|
-
break;
|
597
|
-
}
|
598
|
-
position.offsetX = xFactor * sideOffset;
|
599
|
-
position.offsetY = yFactor * sideOffset;
|
1046
|
+
/**
|
1047
|
+
* TODO: to be removed? But it seems to be useful when controlled from outside
|
1048
|
+
*/
|
1049
|
+
class RdxTooltipCloseDirective {
|
1050
|
+
constructor() {
|
1051
|
+
/** @ignore */
|
1052
|
+
this.rootDirective = injectTooltipRoot();
|
1053
|
+
/** @ignore */
|
1054
|
+
this.elementRef = inject(ElementRef);
|
1055
|
+
/** @ignore */
|
1056
|
+
this.renderer = inject(Renderer2);
|
1057
|
+
this.onIsControlledExternallyEffect();
|
600
1058
|
}
|
601
|
-
|
602
|
-
|
603
|
-
|
1059
|
+
/** @ignore */
|
1060
|
+
onIsControlledExternallyEffect() {
|
1061
|
+
effect(() => {
|
1062
|
+
const isControlledExternally = this.rootDirective.controlledExternally()();
|
1063
|
+
untracked(() => {
|
1064
|
+
this.renderer.setStyle(this.elementRef.nativeElement, 'display', isControlledExternally ? null : 'none');
|
1065
|
+
});
|
1066
|
+
});
|
604
1067
|
}
|
605
|
-
|
1068
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipCloseDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
|
1069
|
+
static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.0.5", type: RdxTooltipCloseDirective, isStandalone: true, selector: "[rdxTooltipClose]", host: { attributes: { "type": "button" }, listeners: { "click": "rootDirective.handleClose(true)" } }, providers: [
|
1070
|
+
{
|
1071
|
+
provide: RdxTooltipCloseToken,
|
1072
|
+
useExisting: forwardRef(() => RdxTooltipCloseDirective)
|
1073
|
+
}
|
1074
|
+
], ngImport: i0 }); }
|
606
1075
|
}
|
1076
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipCloseDirective, decorators: [{
|
1077
|
+
type: Directive,
|
1078
|
+
args: [{
|
1079
|
+
selector: '[rdxTooltipClose]',
|
1080
|
+
host: {
|
1081
|
+
type: 'button',
|
1082
|
+
'(click)': 'rootDirective.handleClose(true)'
|
1083
|
+
},
|
1084
|
+
providers: [
|
1085
|
+
{
|
1086
|
+
provide: RdxTooltipCloseToken,
|
1087
|
+
useExisting: forwardRef(() => RdxTooltipCloseDirective)
|
1088
|
+
}
|
1089
|
+
]
|
1090
|
+
}]
|
1091
|
+
}], ctorParameters: () => [] });
|
607
1092
|
|
608
|
-
class
|
1093
|
+
class RdxTooltipContentAttributesComponent {
|
609
1094
|
constructor() {
|
610
1095
|
/** @ignore */
|
611
|
-
this.
|
612
|
-
/**
|
613
|
-
|
614
|
-
|
615
|
-
this.
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
this.
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
/**
|
635
|
-
* Event handler called when a pointer event occurs outside the bounds of the component. It can be prevented by calling event.preventDefault.
|
636
|
-
*/
|
637
|
-
this.onPointerDownOutside = output();
|
1096
|
+
this.rootDirective = injectTooltipRoot();
|
1097
|
+
/** @ignore */
|
1098
|
+
this.name = computed(() => `rdx-tooltip-content-attributes-${this.rootDirective.uniqueId()}`);
|
1099
|
+
/** @ignore */
|
1100
|
+
this.disableAnimation = computed(() => !this.canAnimate());
|
1101
|
+
}
|
1102
|
+
/** @ignore */
|
1103
|
+
onAnimationStart(_) {
|
1104
|
+
this.rootDirective.cssAnimationStatus.set(this.rootDirective.state() === RdxTooltipState.OPEN
|
1105
|
+
? RdxTooltipAnimationStatus.OPEN_STARTED
|
1106
|
+
: RdxTooltipAnimationStatus.CLOSED_STARTED);
|
1107
|
+
}
|
1108
|
+
/** @ignore */
|
1109
|
+
onAnimationEnd(_) {
|
1110
|
+
this.rootDirective.cssAnimationStatus.set(this.rootDirective.state() === RdxTooltipState.OPEN
|
1111
|
+
? RdxTooltipAnimationStatus.OPEN_ENDED
|
1112
|
+
: RdxTooltipAnimationStatus.CLOSED_ENDED);
|
1113
|
+
}
|
1114
|
+
/** @ignore */
|
1115
|
+
canAnimate() {
|
1116
|
+
return (this.rootDirective.cssAnimation() &&
|
1117
|
+
((this.rootDirective.cssOpeningAnimation() && this.rootDirective.state() === RdxTooltipState.OPEN) ||
|
1118
|
+
(this.rootDirective.cssClosingAnimation() && this.rootDirective.state() === RdxTooltipState.CLOSED)));
|
638
1119
|
}
|
639
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
640
|
-
static { this.ɵ
|
1120
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipContentAttributesComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
|
1121
|
+
static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.0.5", type: RdxTooltipContentAttributesComponent, isStandalone: true, selector: "[rdxTooltipContentAttributes]", host: { listeners: { "animationstart": "onAnimationStart($event)", "animationend": "onAnimationEnd($event)" }, properties: { "attr.role": "\"dialog\"", "attr.id": "name()", "attr.data-state": "rootDirective.state()", "attr.data-side": "rootDirective.contentDirective().side()", "attr.data-align": "rootDirective.contentDirective().align()", "style": "disableAnimation() ? {animation: \"none !important\"} : null" } }, providers: [
|
1122
|
+
{
|
1123
|
+
provide: RdxTooltipContentAttributesToken,
|
1124
|
+
useExisting: forwardRef(() => RdxTooltipContentAttributesComponent)
|
1125
|
+
}
|
1126
|
+
], ngImport: i0, template: `
|
1127
|
+
<ng-content />
|
1128
|
+
`, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush }); }
|
641
1129
|
}
|
642
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
643
|
-
type:
|
1130
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipContentAttributesComponent, decorators: [{
|
1131
|
+
type: Component,
|
644
1132
|
args: [{
|
645
|
-
selector: '[
|
646
|
-
|
647
|
-
|
1133
|
+
selector: '[rdxTooltipContentAttributes]',
|
1134
|
+
template: `
|
1135
|
+
<ng-content />
|
1136
|
+
`,
|
1137
|
+
host: {
|
1138
|
+
'[attr.role]': '"dialog"',
|
1139
|
+
'[attr.id]': 'name()',
|
1140
|
+
'[attr.data-state]': 'rootDirective.state()',
|
1141
|
+
'[attr.data-side]': 'rootDirective.contentDirective().side()',
|
1142
|
+
'[attr.data-align]': 'rootDirective.contentDirective().align()',
|
1143
|
+
'[style]': 'disableAnimation() ? {animation: "none !important"} : null',
|
1144
|
+
'(animationstart)': 'onAnimationStart($event)',
|
1145
|
+
'(animationend)': 'onAnimationEnd($event)'
|
1146
|
+
},
|
1147
|
+
providers: [
|
1148
|
+
{
|
1149
|
+
provide: RdxTooltipContentAttributesToken,
|
1150
|
+
useExisting: forwardRef(() => RdxTooltipContentAttributesComponent)
|
1151
|
+
}
|
1152
|
+
],
|
1153
|
+
changeDetection: ChangeDetectionStrategy.OnPush
|
648
1154
|
}]
|
649
1155
|
}] });
|
650
1156
|
|
651
1157
|
const _imports = [
|
652
1158
|
RdxTooltipArrowDirective,
|
1159
|
+
RdxTooltipCloseDirective,
|
653
1160
|
RdxTooltipContentDirective,
|
654
1161
|
RdxTooltipTriggerDirective,
|
655
|
-
|
656
|
-
|
1162
|
+
RdxTooltipRootDirective,
|
1163
|
+
RdxTooltipAnchorDirective,
|
1164
|
+
RdxTooltipContentAttributesComponent
|
657
1165
|
];
|
658
1166
|
class RdxTooltipModule {
|
659
|
-
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
660
|
-
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "
|
1167
|
+
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
|
1168
|
+
static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipModule, imports: [RdxTooltipArrowDirective,
|
1169
|
+
RdxTooltipCloseDirective,
|
661
1170
|
RdxTooltipContentDirective,
|
662
1171
|
RdxTooltipTriggerDirective,
|
663
|
-
|
664
|
-
|
1172
|
+
RdxTooltipRootDirective,
|
1173
|
+
RdxTooltipAnchorDirective,
|
1174
|
+
RdxTooltipContentAttributesComponent], exports: [RdxTooltipArrowDirective,
|
1175
|
+
RdxTooltipCloseDirective,
|
665
1176
|
RdxTooltipContentDirective,
|
666
1177
|
RdxTooltipTriggerDirective,
|
667
|
-
|
668
|
-
|
669
|
-
|
1178
|
+
RdxTooltipRootDirective,
|
1179
|
+
RdxTooltipAnchorDirective,
|
1180
|
+
RdxTooltipContentAttributesComponent] }); }
|
1181
|
+
static { this.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipModule }); }
|
670
1182
|
}
|
671
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
1183
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.0.5", ngImport: i0, type: RdxTooltipModule, decorators: [{
|
672
1184
|
type: NgModule,
|
673
1185
|
args: [{
|
674
1186
|
imports: [..._imports],
|
@@ -680,5 +1192,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.11", ngImpo
|
|
680
1192
|
* Generated bundle index. Do not edit.
|
681
1193
|
*/
|
682
1194
|
|
683
|
-
export {
|
1195
|
+
export { RdxTooltipAnchorDirective, RdxTooltipArrowDirective, RdxTooltipCloseDirective, RdxTooltipContentAttributesComponent, RdxTooltipContentDirective, RdxTooltipModule, RdxTooltipRootDirective, RdxTooltipTriggerDirective };
|
684
1196
|
//# sourceMappingURL=radix-ng-primitives-tooltip.mjs.map
|