@telesign/boreal-web-components 0.1.0-alpha.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/LICENSE +21 -0
- package/components-build/bds-banner.d.ts +11 -0
- package/components-build/bds-banner.js +1 -0
- package/components-build/bds-typography.d.ts +11 -0
- package/components-build/bds-typography.js +1 -0
- package/components-build/index.d.ts +35 -0
- package/components-build/index.js +1 -0
- package/components-build/my-component.d.ts +11 -0
- package/components-build/my-component.js +1 -0
- package/components-build/p-B9wshZ_4.js +1 -0
- package/components-build/p-noyWJ11s.js +1 -0
- package/custom-elements.json +764 -0
- package/dist/boreal-web-components/boreal-web-components.css +1 -0
- package/dist/boreal-web-components/boreal-web-components.esm.js +1 -0
- package/dist/boreal-web-components/boreal-web-components.js +127 -0
- package/dist/boreal-web-components/css/boreal.css +1594 -0
- package/dist/boreal-web-components/css/global.css +682 -0
- package/dist/boreal-web-components/css/theme-connect.css +227 -0
- package/dist/boreal-web-components/css/theme-engage.css +227 -0
- package/dist/boreal-web-components/css/theme-protect.css +227 -0
- package/dist/boreal-web-components/css/theme-proximus.css +227 -0
- package/dist/boreal-web-components/index.esm.js +0 -0
- package/dist/boreal-web-components/p-412d037b.system.entry.js +1 -0
- package/dist/boreal-web-components/p-527a761b.entry.js +1 -0
- package/dist/boreal-web-components/p-5666a22a.system.entry.js +1 -0
- package/dist/boreal-web-components/p-B-PpI2Xv.system.js +1 -0
- package/dist/boreal-web-components/p-B9wshZ_4.js +1 -0
- package/dist/boreal-web-components/p-BQdH0ijK.system.js +2 -0
- package/dist/boreal-web-components/p-BbPAtVJG.system.js +1 -0
- package/dist/boreal-web-components/p-CMd-Mv-5.system.js +1 -0
- package/dist/boreal-web-components/p-CaVEtaG3.system.js +1 -0
- package/dist/boreal-web-components/p-DQuL1Twl.js +1 -0
- package/dist/boreal-web-components/p-DgFiTd6X.js +2 -0
- package/dist/boreal-web-components/p-YWpyar7R.system.js +1 -0
- package/dist/boreal-web-components/p-b818618b.entry.js +1 -0
- package/dist/boreal-web-components/p-d596406b.entry.js +1 -0
- package/dist/boreal-web-components/p-e37e7dba.system.entry.js +1 -0
- package/dist/boreal-web-components/p-noyWJ11s.js +1 -0
- package/dist/boreal-web-components/scss/global/_fonts.scss +1 -0
- package/dist/boreal-web-components/scss/global/_index.scss +3 -0
- package/dist/boreal-web-components/scss/global/_reset.scss +50 -0
- package/dist/boreal-web-components/scss/global/_typography.scss +156 -0
- package/dist/boreal-web-components/scss/maps/_primitives.scss +461 -0
- package/dist/boreal-web-components/scss/maps/_theme-connect.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-engage.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-protect.scss +227 -0
- package/dist/boreal-web-components/scss/maps/_theme-proximus.scss +227 -0
- package/dist/boreal-web-components/scss/variables/_primitives.scss +459 -0
- package/dist/boreal-web-components/scss/variables/_theme-connect.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-engage.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-protect.scss +225 -0
- package/dist/boreal-web-components/scss/variables/_theme-proximus.scss +225 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js +5 -0
- package/dist/cjs/attributes-RPVEtBdj.js +90 -0
- package/dist/cjs/bds-banner.cjs.entry.js +130 -0
- package/dist/cjs/bds-typography.cjs.entry.js +167 -0
- package/dist/cjs/boreal-web-components.cjs.js +46 -0
- package/dist/cjs/index-CD9v53WJ.js +133 -0
- package/dist/cjs/index-Cdb66Tqj.js +2342 -0
- package/dist/cjs/index.cjs.js +2 -0
- package/dist/cjs/loader.cjs.js +13 -0
- package/dist/cjs/my-component.cjs.entry.js +29 -0
- package/dist/collection/collection-manifest.json +14 -0
- package/dist/collection/components/feedback/bds-banner/bds-banner.css +101 -0
- package/dist/collection/components/feedback/bds-banner/bds-banner.js +266 -0
- package/dist/collection/components/feedback/bds-banner/types/IBanner.js +1 -0
- package/dist/collection/components/my-component/my-component.css +3 -0
- package/dist/collection/components/my-component/my-component.js +95 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.css +183 -0
- package/dist/collection/components/titles-text/bds-typography/bds-typography.js +577 -0
- package/dist/collection/components/titles-text/bds-typography/types/ITypography.js +1 -0
- package/dist/collection/components/titles-text/bds-typography/types/enum.js +23 -0
- package/dist/collection/components/titles-text/bds-typography/types/types.js +1 -0
- package/dist/collection/components/titles-text/bds-typography/utils/bds-typography-utils.js +41 -0
- package/dist/collection/css/boreal.css +1594 -0
- package/dist/collection/css/global.css +682 -0
- package/dist/collection/css/theme-connect.css +227 -0
- package/dist/collection/css/theme-engage.css +227 -0
- package/dist/collection/css/theme-protect.css +227 -0
- package/dist/collection/css/theme-proximus.css +227 -0
- package/dist/collection/index.js +1 -0
- package/dist/collection/mixins/anchored.mixin.js +272 -0
- package/dist/collection/mixins/floating.mixin.js +181 -0
- package/dist/collection/mixins/form-associated.mixin.js +95 -0
- package/dist/collection/mixins/index.js +3 -0
- package/dist/collection/scss/global/_fonts.scss +1 -0
- package/dist/collection/scss/global/_index.scss +3 -0
- package/dist/collection/scss/global/_reset.scss +50 -0
- package/dist/collection/scss/global/_typography.scss +156 -0
- package/dist/collection/scss/maps/_primitives.scss +461 -0
- package/dist/collection/scss/maps/_theme-connect.scss +227 -0
- package/dist/collection/scss/maps/_theme-engage.scss +227 -0
- package/dist/collection/scss/maps/_theme-protect.scss +227 -0
- package/dist/collection/scss/maps/_theme-proximus.scss +227 -0
- package/dist/collection/scss/variables/_primitives.scss +459 -0
- package/dist/collection/scss/variables/_theme-connect.scss +225 -0
- package/dist/collection/scss/variables/_theme-engage.scss +225 -0
- package/dist/collection/scss/variables/_theme-protect.scss +225 -0
- package/dist/collection/scss/variables/_theme-proximus.scss +225 -0
- package/dist/collection/services/floating/interfaces/Floating.js +1 -0
- package/dist/collection/services/floating/interfaces/Positioning.js +1 -0
- package/dist/collection/services/floating/interfaces/Props.js +1 -0
- package/dist/collection/services/floating/positioning.service.js +71 -0
- package/dist/collection/services/floating/types/Arrow.js +1 -0
- package/dist/collection/services/logger/Logger.js +47 -0
- package/dist/collection/types/alignment.js +6 -0
- package/dist/collection/types/form.js +1 -0
- package/dist/collection/types/index.js +5 -0
- package/dist/collection/types/position.js +11 -0
- package/dist/collection/types/size.js +7 -0
- package/dist/collection/types/states.js +22 -0
- package/dist/collection/types/stylesMap.js +1 -0
- package/dist/collection/utils/a11y/attributes.js +80 -0
- package/dist/collection/utils/a11y/index.js +1 -0
- package/dist/collection/utils/constants/common/Events.js +10 -0
- package/dist/collection/utils/constants/common/Keys.js +16 -0
- package/dist/collection/utils/dom/elements.js +22 -0
- package/dist/collection/utils/dom/index.js +1 -0
- package/dist/collection/utils/form/index.js +1 -0
- package/dist/collection/utils/form/internals.js +79 -0
- package/dist/collection/utils/helpers/common/BaseAttributes.js +17 -0
- package/dist/collection/utils/index.js +3 -0
- package/dist/css/boreal.css +1594 -0
- package/dist/css/global.css +682 -0
- package/dist/css/theme-connect.css +227 -0
- package/dist/css/theme-engage.css +227 -0
- package/dist/css/theme-protect.css +227 -0
- package/dist/css/theme-proximus.css +227 -0
- package/dist/esm/app-globals-DQuL1Twl.js +3 -0
- package/dist/esm/attributes-B9wshZ_4.js +86 -0
- package/dist/esm/bds-banner.entry.js +128 -0
- package/dist/esm/bds-typography.entry.js +165 -0
- package/dist/esm/boreal-web-components.js +42 -0
- package/dist/esm/index-DgFiTd6X.js +2332 -0
- package/dist/esm/index-noyWJ11s.js +131 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/loader.js +11 -0
- package/dist/esm/my-component.entry.js +27 -0
- package/dist/esm/polyfills/core-js.js +11 -0
- package/dist/esm/polyfills/dom.js +79 -0
- package/dist/esm/polyfills/es5-html-element.js +1 -0
- package/dist/esm/polyfills/index.js +34 -0
- package/dist/esm/polyfills/system.js +6 -0
- package/dist/esm-es5/app-globals-DQuL1Twl.js +1 -0
- package/dist/esm-es5/attributes-B9wshZ_4.js +1 -0
- package/dist/esm-es5/bds-banner.entry.js +1 -0
- package/dist/esm-es5/bds-typography.entry.js +1 -0
- package/dist/esm-es5/boreal-web-components.js +1 -0
- package/dist/esm-es5/index-DgFiTd6X.js +2 -0
- package/dist/esm-es5/index-noyWJ11s.js +1 -0
- package/dist/esm-es5/index.js +0 -0
- package/dist/esm-es5/loader.js +1 -0
- package/dist/esm-es5/my-component.entry.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.js +1 -0
- package/dist/scss/global/_fonts.scss +1 -0
- package/dist/scss/global/_index.scss +3 -0
- package/dist/scss/global/_reset.scss +50 -0
- package/dist/scss/global/_typography.scss +156 -0
- package/dist/scss/maps/_primitives.scss +461 -0
- package/dist/scss/maps/_theme-connect.scss +227 -0
- package/dist/scss/maps/_theme-engage.scss +227 -0
- package/dist/scss/maps/_theme-protect.scss +227 -0
- package/dist/scss/maps/_theme-proximus.scss +227 -0
- package/dist/scss/variables/_primitives.scss +459 -0
- package/dist/scss/variables/_theme-connect.scss +225 -0
- package/dist/scss/variables/_theme-engage.scss +225 -0
- package/dist/scss/variables/_theme-protect.scss +225 -0
- package/dist/scss/variables/_theme-proximus.scss +225 -0
- package/dist/types/components/feedback/bds-banner/bds-banner.d.ts +71 -0
- package/dist/types/components/feedback/bds-banner/types/IBanner.d.ts +10 -0
- package/dist/types/components/my-component/my-component.d.ts +16 -0
- package/dist/types/components/titles-text/bds-typography/bds-typography.d.ts +99 -0
- package/dist/types/components/titles-text/bds-typography/types/ITypography.d.ts +22 -0
- package/dist/types/components/titles-text/bds-typography/types/enum.d.ts +24 -0
- package/dist/types/components/titles-text/bds-typography/types/types.d.ts +4 -0
- package/dist/types/components/titles-text/bds-typography/utils/bds-typography-utils.d.ts +15 -0
- package/dist/types/components.d.ts +565 -0
- package/dist/types/index.d.ts +11 -0
- package/dist/types/mixins/anchored.mixin.d.ts +228 -0
- package/dist/types/mixins/floating.mixin.d.ts +158 -0
- package/dist/types/mixins/form-associated.mixin.d.ts +127 -0
- package/dist/types/mixins/index.d.ts +4 -0
- package/dist/types/services/floating/interfaces/Floating.d.ts +38 -0
- package/dist/types/services/floating/interfaces/Positioning.d.ts +22 -0
- package/dist/types/services/floating/interfaces/Props.d.ts +35 -0
- package/dist/types/services/floating/positioning.service.d.ts +45 -0
- package/dist/types/services/floating/types/Arrow.d.ts +7 -0
- package/dist/types/services/logger/Logger.d.ts +50 -0
- package/dist/types/stencil-public-runtime.d.ts +1858 -0
- package/dist/types/types/alignment.d.ts +8 -0
- package/dist/types/types/form.d.ts +7 -0
- package/dist/types/types/index.d.ts +6 -0
- package/dist/types/types/position.d.ts +13 -0
- package/dist/types/types/size.d.ts +9 -0
- package/dist/types/types/states.d.ts +26 -0
- package/dist/types/types/stylesMap.d.ts +2 -0
- package/dist/types/utils/a11y/attributes.d.ts +13 -0
- package/dist/types/utils/a11y/index.d.ts +2 -0
- package/dist/types/utils/constants/common/Events.d.ts +14 -0
- package/dist/types/utils/constants/common/Keys.d.ts +18 -0
- package/dist/types/utils/dom/elements.d.ts +12 -0
- package/dist/types/utils/dom/index.d.ts +2 -0
- package/dist/types/utils/form/index.d.ts +2 -0
- package/dist/types/utils/form/internals.d.ts +66 -0
- package/dist/types/utils/helpers/common/BaseAttributes.d.ts +16 -0
- package/dist/types/utils/index.d.ts +4 -0
- package/loader/cdn.js +2 -0
- package/loader/index.cjs.js +2 -0
- package/loader/index.d.ts +24 -0
- package/loader/index.es2017.js +2 -0
- package/loader/index.js +3 -0
- package/package.json +96 -0
- package/readme.md +111 -0
- package/scripts/copy-styles.js +18 -0
- package/scripts/postbuild.js +21 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { IFloatingAdapter, PositioningEngine } from "../services/floating/positioning.service";
|
|
2
|
+
import { MixedInCtor } from '../stencil-public-runtime';
|
|
3
|
+
import { Logger } from "../services/logger/Logger";
|
|
4
|
+
import { FloatingMixinOptions } from "../services/floating/interfaces/Floating";
|
|
5
|
+
/**
|
|
6
|
+
* Positioning and trigger mixin for anchor-based floating elements.
|
|
7
|
+
*
|
|
8
|
+
* Extends `floatingMixin` with two additional responsibilities:
|
|
9
|
+
* - **Positioning** — computes and maintains the position of the floating element
|
|
10
|
+
* relative to a trigger element using `IFloatingAdapter` (wraps Floating UI).
|
|
11
|
+
* Position is kept in sync via `autoUpdate` while the element is visible.
|
|
12
|
+
* - **Triggers** — manages DOM event listeners on the trigger element
|
|
13
|
+
* (focus/blur, click) to show and hide the floating element.
|
|
14
|
+
*
|
|
15
|
+
* Use this mixin for components whose floating element must be anchored
|
|
16
|
+
* to a specific DOM element: `Tooltip`, `Popover`, `Dropdown`.
|
|
17
|
+
*
|
|
18
|
+
* For viewport-relative components (Dialog, Drawer, Toast),
|
|
19
|
+
* use `backdropMixin` instead.
|
|
20
|
+
*
|
|
21
|
+
* ## Lifecycle flow
|
|
22
|
+
* ```
|
|
23
|
+
* showElement() → showPopover() + startAutoUpdate()
|
|
24
|
+
* hideElement() → hidePopover() + stopAutoUpdate()
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* ## Required by the component
|
|
28
|
+
* - `triggerSlot` — must be assigned to the trigger element before `show()` is called.
|
|
29
|
+
* - `floatingContent` — must be assigned via `ref` in the render method.
|
|
30
|
+
* - `options` — override this getter to customize placement, offset and strategy.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { Component, Element, Mixin, Prop, h } from '../stencil-public-runtime';
|
|
35
|
+
* import { anchoredMixin } from '@/mixins/anchored.mixin';
|
|
36
|
+
* import { FloatingHooks, FloatingMixinOptions } from '@/services/floating/interfaces/Floating';
|
|
37
|
+
*
|
|
38
|
+
* @Component({ tag: 'bds-tooltip' })
|
|
39
|
+
* export class BdsTooltip extends Mixin(anchoredMixin) {
|
|
40
|
+
*
|
|
41
|
+
* get options(): FloatingMixinOptions {
|
|
42
|
+
* return { placement: 'bottom', offset: 8, strategy: 'fixed' };
|
|
43
|
+
* }
|
|
44
|
+
*
|
|
45
|
+
* get hooks(): FloatingHooks {
|
|
46
|
+
* return {
|
|
47
|
+
* onBeforeShow: () => !this.disabled,
|
|
48
|
+
* onPositionUpdate: result => this.handlePosition(result),
|
|
49
|
+
* };
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* componentDidLoad() {
|
|
53
|
+
* const trigger = document.getElementById(this.trigger);
|
|
54
|
+
* if (trigger) {
|
|
55
|
+
* this.triggerSlot = trigger;
|
|
56
|
+
* trigger.addEventListener('click', () => this.toggle());
|
|
57
|
+
* }
|
|
58
|
+
* }
|
|
59
|
+
*
|
|
60
|
+
* render() {
|
|
61
|
+
* return (
|
|
62
|
+
* <Host>
|
|
63
|
+
* <div
|
|
64
|
+
* popover="manual"
|
|
65
|
+
* ref={el => (this.floatingContent = el as HTMLElement)}
|
|
66
|
+
* />
|
|
67
|
+
* </Host>
|
|
68
|
+
* );
|
|
69
|
+
* }
|
|
70
|
+
* }
|
|
71
|
+
* ```
|
|
72
|
+
*
|
|
73
|
+
* @see floatingMixin - base lifecycle mixin
|
|
74
|
+
* @see IFloatingAdapter - positioning adapter interface
|
|
75
|
+
* @see FloatingMixinOptions - positioning configuration interface
|
|
76
|
+
* @see FloatingHooks - lifecycle hook interface, includes `onPositionUpdate`
|
|
77
|
+
*/
|
|
78
|
+
export declare const anchoredMixin: <B extends MixedInCtor>(Base: B) => {
|
|
79
|
+
new (...args: any[]): {
|
|
80
|
+
/**
|
|
81
|
+
* The previously registered trigger element.
|
|
82
|
+
* Used to detach listeners when the trigger changes.
|
|
83
|
+
*/
|
|
84
|
+
previousTrigger: HTMLElement | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Cleanup function returned by `autoUpdate`.
|
|
87
|
+
* Call to stop position syncing when the element is hidden or disconnected.
|
|
88
|
+
*/
|
|
89
|
+
cleanupAutoUpdate: (() => void) | undefined;
|
|
90
|
+
/**
|
|
91
|
+
* Adapter that wraps Floating UI to compute and apply positions.
|
|
92
|
+
* Initialized in `componentWillLoad`.
|
|
93
|
+
*/
|
|
94
|
+
positionEngine: IFloatingAdapter;
|
|
95
|
+
/**
|
|
96
|
+
* Logger instance for error reporting.
|
|
97
|
+
* Initialized in `componentWillLoad`.
|
|
98
|
+
*/
|
|
99
|
+
logger: Logger;
|
|
100
|
+
/**
|
|
101
|
+
* Default positioning options.
|
|
102
|
+
* Override this getter in the component to customize placement,
|
|
103
|
+
* offset, strategy, flip, shift, and arrow.
|
|
104
|
+
*/
|
|
105
|
+
readonly options: FloatingMixinOptions;
|
|
106
|
+
/**
|
|
107
|
+
* Reference to the DOM element that triggers the floating element.
|
|
108
|
+
* Must be assigned by the component before `show()` is called —
|
|
109
|
+
* either via slot change handler or `componentDidLoad`.
|
|
110
|
+
*/
|
|
111
|
+
triggerSlot: HTMLElement;
|
|
112
|
+
/**
|
|
113
|
+
* Shows the floating element using the Popover API
|
|
114
|
+
* and starts position auto-update relative to `triggerSlot`.
|
|
115
|
+
*
|
|
116
|
+
* @override floatingMixin.showElement
|
|
117
|
+
*/
|
|
118
|
+
showElement(): void;
|
|
119
|
+
/**
|
|
120
|
+
* Guards against showing without a valid trigger.
|
|
121
|
+
* Delegates to `floatingMixin.onBeforeShow` if the guard passes.
|
|
122
|
+
*
|
|
123
|
+
* @override floatingMixin.onBeforeShow
|
|
124
|
+
* @param target - Optional element that triggered the show action
|
|
125
|
+
* @returns `false` if `triggerSlot` is not set, otherwise delegates to super
|
|
126
|
+
*/
|
|
127
|
+
onBeforeShow(target?: HTMLElement): boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Hides the floating element using the Popover API
|
|
130
|
+
* and stops position auto-update.
|
|
131
|
+
*
|
|
132
|
+
* @override floatingMixin.hideElement
|
|
133
|
+
*/
|
|
134
|
+
hideElement(): void;
|
|
135
|
+
/**
|
|
136
|
+
* Handles slot change events to update the trigger element reference
|
|
137
|
+
* and re-attach event listeners to the new trigger.
|
|
138
|
+
*
|
|
139
|
+
* @param e - The slot change event
|
|
140
|
+
* @param showFn - Bound show function to attach as listener
|
|
141
|
+
* @param hideFn - Bound hide function to attach as listener
|
|
142
|
+
*/
|
|
143
|
+
handleSlotChange(e: Event, showFn: (this: void) => void, hideFn: (this: void) => void): void;
|
|
144
|
+
/**
|
|
145
|
+
* Handles keyboard events on the trigger element.
|
|
146
|
+
* - `Enter` / `Space` — shows the floating element
|
|
147
|
+
* - `Escape` — hides the floating element
|
|
148
|
+
*
|
|
149
|
+
* @param e - The keyboard event
|
|
150
|
+
* @param showFn - Bound show function
|
|
151
|
+
* @param hideFn - Bound hide function
|
|
152
|
+
*/
|
|
153
|
+
handleKeydown(e: KeyboardEvent, showFn: (this: void) => void, hideFn: (this: void) => void): void;
|
|
154
|
+
/**
|
|
155
|
+
* Computes the position of the floating element relative to the trigger
|
|
156
|
+
* using `IFloatingAdapter` and applies the result to the floating element's style.
|
|
157
|
+
*
|
|
158
|
+
* @param triggerElement - The anchor element
|
|
159
|
+
* @param floatingElement - The element to position
|
|
160
|
+
* @param options - Positioning options (placement, offset, flip, shift, arrow)
|
|
161
|
+
* @param onPositionUpdate - Optional callback invoked after each position update
|
|
162
|
+
*/
|
|
163
|
+
updatePosition(triggerElement: HTMLElement, floatingElement: HTMLElement, options: FloatingMixinOptions, onPositionUpdate?: (result: Awaited<ReturnType<PositioningEngine["computePosition"]>>) => void): Promise<import("../services/floating/interfaces/Positioning").PositioningResult>;
|
|
164
|
+
/**
|
|
165
|
+
* Starts automatic position synchronization between the trigger
|
|
166
|
+
* and the floating element. Runs `updatePosition` once immediately,
|
|
167
|
+
* then subscribes to DOM/scroll/resize changes via `autoUpdate`.
|
|
168
|
+
*
|
|
169
|
+
* @param triggerElement - The anchor element
|
|
170
|
+
* @param floatingElement - The element to keep in sync
|
|
171
|
+
* @param options - Positioning options
|
|
172
|
+
* @param onPositionUpdate - Optional callback after each position update
|
|
173
|
+
*/
|
|
174
|
+
startAutoUpdate(triggerElement: HTMLElement, floatingElement: HTMLElement, options: FloatingMixinOptions, onPositionUpdate?: Parameters<(triggerElement: HTMLElement, floatingElement: HTMLElement, options: FloatingMixinOptions, onPositionUpdate?: (result: Awaited<ReturnType<PositioningEngine["computePosition"]>>) => void) => Promise<import("../services/floating/interfaces/Positioning").PositioningResult>>[3]): void;
|
|
175
|
+
/**
|
|
176
|
+
* Stops automatic position synchronization and clears the cleanup reference.
|
|
177
|
+
*/
|
|
178
|
+
stopAutoUpdate(): void;
|
|
179
|
+
/**
|
|
180
|
+
* Attaches focus and blur listeners to the trigger element.
|
|
181
|
+
*
|
|
182
|
+
* @param trigger - The trigger element
|
|
183
|
+
* @param showFn - Bound show function
|
|
184
|
+
* @param hideFn - Bound hide function
|
|
185
|
+
*/
|
|
186
|
+
attachTriggerListeners(trigger: HTMLElement, showFn: (this: void) => void, hideFn: (this: void) => void): void;
|
|
187
|
+
/**
|
|
188
|
+
* Detaches focus and blur listeners from the trigger element.
|
|
189
|
+
*
|
|
190
|
+
* @param trigger - The trigger element
|
|
191
|
+
* @param showFn - Bound show function to remove
|
|
192
|
+
* @param hideFn - Bound hide function to remove
|
|
193
|
+
*/
|
|
194
|
+
detachTriggerListeners(trigger: HTMLElement, showFn: (this: void) => void, hideFn: (this: void) => void): void;
|
|
195
|
+
/**
|
|
196
|
+
* Detaches trigger listeners and stops auto-update.
|
|
197
|
+
* Call this when the component disconnects from the DOM.
|
|
198
|
+
*
|
|
199
|
+
* @param showFn - Bound show function to remove
|
|
200
|
+
* @param hideFn - Bound hide function to remove
|
|
201
|
+
*/
|
|
202
|
+
floatingDisconnect(showFn: (this: void) => void, hideFn: (this: void) => void): void;
|
|
203
|
+
/**
|
|
204
|
+
* Initializes the positioning engine, logger, and binds lifecycle methods
|
|
205
|
+
* so they can be safely passed as event listener callbacks.
|
|
206
|
+
*
|
|
207
|
+
* @remarks `show`, `hide`, and `toggle` are bound here — not in `floatingMixin` —
|
|
208
|
+
* to ensure they resolve to the `anchoredMixin` overrides at call time.
|
|
209
|
+
*/
|
|
210
|
+
componentWillLoad(): void;
|
|
211
|
+
/**
|
|
212
|
+
* Cleans up trigger listeners, stops auto-update, and hides the floating element
|
|
213
|
+
* when the component is removed from the DOM.
|
|
214
|
+
*/
|
|
215
|
+
disconnectedCallback(): void;
|
|
216
|
+
floatingOptions: import("../services/floating/interfaces/Props").FloatingAnchoredProp;
|
|
217
|
+
floatingContent: HTMLElement;
|
|
218
|
+
isVisible: boolean;
|
|
219
|
+
readonly hooks: import("@/services/floating/interfaces/Floating").FloatingHooks;
|
|
220
|
+
onBeforeHide(target?: HTMLElement): boolean;
|
|
221
|
+
show(target?: HTMLElement): void;
|
|
222
|
+
hide(target?: HTMLElement): void;
|
|
223
|
+
toggle(target?: HTMLElement): void;
|
|
224
|
+
onAfterShow(target?: HTMLElement): void;
|
|
225
|
+
onAfterHide(target?: HTMLElement): void;
|
|
226
|
+
};
|
|
227
|
+
} & B;
|
|
228
|
+
//# sourceMappingURL=anchored.mixin.d.ts.map
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { FloatingHooks } from "../services/floating/interfaces/Floating";
|
|
2
|
+
import { FloatingAnchoredProp } from "../services/floating/interfaces/Props";
|
|
3
|
+
import { MixedInCtor } from '../stencil-public-runtime';
|
|
4
|
+
/**
|
|
5
|
+
* Core lifecycle mixin for all floating elements in the design system.
|
|
6
|
+
*
|
|
7
|
+
* Provides a unified lifecycle contract (`show`, `hide`, `toggle`, `isVisible`)
|
|
8
|
+
* and an extension mechanism via `FloatingHooks` that allows each component
|
|
9
|
+
* to inject its own logic at specific lifecycle points without modifying the mixin.
|
|
10
|
+
*
|
|
11
|
+
* This mixin is the base for all floating components. It does not handle
|
|
12
|
+
* positioning or triggers — use `anchoredMixin` for components that need
|
|
13
|
+
* to be anchored to a DOM element (Tooltip, Popover),
|
|
14
|
+
* or `backdropMixin` for viewport-relative components (Dialog, Drawer, Toast).
|
|
15
|
+
*
|
|
16
|
+
* ## Extension points
|
|
17
|
+
*
|
|
18
|
+
* Override `showElement` / `hideElement` to control how the element
|
|
19
|
+
* mounts and unmounts (e.g. `showPopover()`, `showModal()`, CSS animations).
|
|
20
|
+
*
|
|
21
|
+
* Override `hooks` to inject logic at lifecycle points:
|
|
22
|
+
* - `onBeforeShow` / `onBeforeHide` — return `false` to cancel the action
|
|
23
|
+
* - `onAfterShow` / `onAfterHide` — side effects after the action completes
|
|
24
|
+
* - `mounted` / `unmounted` — called after the element is shown or hidden
|
|
25
|
+
*
|
|
26
|
+
* ## Lifecycle flow
|
|
27
|
+
* ```
|
|
28
|
+
* show(): onBeforeShow() → showElement() → onAfterShow()
|
|
29
|
+
* hide(): onBeforeHide() → hideElement() → onAfterHide()
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* import { Component, Mixin, Prop } from '../stencil-public-runtime';
|
|
35
|
+
* import { floatingMixin } from '@/mixins/floating.mixin';
|
|
36
|
+
* import { FloatingHooks } from '@/services/floating/interfaces/Floating';
|
|
37
|
+
*
|
|
38
|
+
* @Component({ tag: 'bds-dialog' })
|
|
39
|
+
* export class BdsDialog extends Mixin(floatingMixin) {
|
|
40
|
+
* private dialogElement!: HTMLDialogElement;
|
|
41
|
+
*
|
|
42
|
+
* // Override showElement/hideElement to use the native <dialog> API
|
|
43
|
+
* showElement(): void {
|
|
44
|
+
* this.dialogElement.showModal();
|
|
45
|
+
* this.isVisible = true;
|
|
46
|
+
* }
|
|
47
|
+
* hideElement(): void {
|
|
48
|
+
* this.dialogElement.close();
|
|
49
|
+
* this.isVisible = false;
|
|
50
|
+
* }
|
|
51
|
+
*
|
|
52
|
+
* // Inject component-specific logic via hooks
|
|
53
|
+
* get hooks(): FloatingHooks {
|
|
54
|
+
* return {
|
|
55
|
+
* onBeforeShow: () => !this.disabled,
|
|
56
|
+
* onAfterShow: () => this.lockScroll(),
|
|
57
|
+
* onAfterHide: () => this.unlockScroll(),
|
|
58
|
+
* };
|
|
59
|
+
* }
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
export declare const floatingMixin: <B extends MixedInCtor>(Base: B) => {
|
|
64
|
+
new (...args: any[]): {
|
|
65
|
+
/**
|
|
66
|
+
* Configuration prop passed by the consumer component.
|
|
67
|
+
* Allows external control over lifecycle hooks and floating behavior.
|
|
68
|
+
*/
|
|
69
|
+
floatingOptions: FloatingAnchoredProp;
|
|
70
|
+
/**
|
|
71
|
+
* Reference to the floating element in the DOM.
|
|
72
|
+
* Must be assigned via `ref` in the component's render method.
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```tsx
|
|
76
|
+
* <div ref={el => (this.floatingContent = el as HTMLElement)} />
|
|
77
|
+
* ```
|
|
78
|
+
*/
|
|
79
|
+
floatingContent: HTMLElement;
|
|
80
|
+
/**
|
|
81
|
+
* Tracks the visibility state of the floating element.
|
|
82
|
+
* Triggers a re-render when changed.
|
|
83
|
+
*/
|
|
84
|
+
isVisible: boolean;
|
|
85
|
+
/**
|
|
86
|
+
* Lifecycle hooks provided by the component.
|
|
87
|
+
* Override this getter to inject component-specific logic
|
|
88
|
+
* into the floating lifecycle without modifying the mixin.
|
|
89
|
+
*
|
|
90
|
+
* @returns FloatingHooks — an object with optional lifecycle callbacks
|
|
91
|
+
*/
|
|
92
|
+
readonly hooks: FloatingHooks;
|
|
93
|
+
/**
|
|
94
|
+
* Called before the element is shown.
|
|
95
|
+
* Aggregates both the component `hooks` and `floatingOptions` controls.
|
|
96
|
+
* If either returns `false`, the show action is cancelled.
|
|
97
|
+
*
|
|
98
|
+
* @param target - Optional element that triggered the show action
|
|
99
|
+
* @returns `true` if the element can be shown, `false` to cancel
|
|
100
|
+
*/
|
|
101
|
+
onBeforeShow(target?: HTMLElement): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* Called before the element is hidden.
|
|
104
|
+
* Aggregates both the component `hooks` and `floatingOptions` controls.
|
|
105
|
+
* If either returns `false`, the hide action is cancelled.
|
|
106
|
+
*
|
|
107
|
+
* @param target - Optional element the mouse moved to (used for stayOnHover logic)
|
|
108
|
+
* @returns `true` if the element can be hidden, `false` to cancel
|
|
109
|
+
*/
|
|
110
|
+
onBeforeHide(target?: HTMLElement): boolean;
|
|
111
|
+
/**
|
|
112
|
+
* Mounts the floating element into the visible DOM.
|
|
113
|
+
* Override in subclasses to use a different mount strategy
|
|
114
|
+
* (e.g. `showPopover()`, `showModal()`, CSS class toggle).
|
|
115
|
+
*/
|
|
116
|
+
showElement(): void;
|
|
117
|
+
/**
|
|
118
|
+
* Unmounts the floating element from the visible DOM.
|
|
119
|
+
* Override in subclasses to use a different unmount strategy.
|
|
120
|
+
*/
|
|
121
|
+
hideElement(): void;
|
|
122
|
+
/**
|
|
123
|
+
* Shows the floating element if not already visible.
|
|
124
|
+
* Runs the full lifecycle: `onBeforeShow` → `showElement` → `onAfterShow`.
|
|
125
|
+
*
|
|
126
|
+
* @param target - Optional element that triggered the action
|
|
127
|
+
*/
|
|
128
|
+
show(target?: HTMLElement): void;
|
|
129
|
+
/**
|
|
130
|
+
* Hides the floating element if currently visible.
|
|
131
|
+
* Runs the full lifecycle: `onBeforeHide` → `hideElement` → `onAfterHide`.
|
|
132
|
+
*
|
|
133
|
+
* @param target - Optional element the mouse moved to
|
|
134
|
+
*/
|
|
135
|
+
hide(target?: HTMLElement): void;
|
|
136
|
+
/**
|
|
137
|
+
* Toggles the floating element visibility.
|
|
138
|
+
*
|
|
139
|
+
* @param target - Optional element that triggered the action
|
|
140
|
+
*/
|
|
141
|
+
toggle(target?: HTMLElement): void;
|
|
142
|
+
/**
|
|
143
|
+
* Called after the element is shown.
|
|
144
|
+
* Notifies both `hooks` and `floatingOptions` consumers.
|
|
145
|
+
*
|
|
146
|
+
* @param target - Optional element that triggered the action
|
|
147
|
+
*/
|
|
148
|
+
onAfterShow(target?: HTMLElement): void;
|
|
149
|
+
/**
|
|
150
|
+
* Called after the element is hidden.
|
|
151
|
+
* Notifies both `hooks` and `floatingOptions` consumers.
|
|
152
|
+
*
|
|
153
|
+
* @param target - Optional element that triggered the action
|
|
154
|
+
*/
|
|
155
|
+
onAfterHide(target?: HTMLElement): void;
|
|
156
|
+
};
|
|
157
|
+
} & B;
|
|
158
|
+
//# sourceMappingURL=floating.mixin.d.ts.map
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { type EventEmitter, type MixedInCtor } from '../stencil-public-runtime';
|
|
2
|
+
/**
|
|
3
|
+
* Lifecycle callbacks that each Form-Associated Custom Element must implement.
|
|
4
|
+
*
|
|
5
|
+
* These callbacks stay outside `formAssociatedMixin` because value semantics
|
|
6
|
+
* differ per component (for example default value and restore behavior).
|
|
7
|
+
*
|
|
8
|
+
* Implement this interface on every component that extends `formAssociatedMixin`.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { AttachInternals, Component, Event, EventEmitter, Mixin, Prop } from '../stencil-public-runtime';
|
|
13
|
+
*
|
|
14
|
+
* import { setFormValue } from '@/utils/form';
|
|
15
|
+
* import { formAssociatedMixin, type IFormControl } from '@/mixins/form-associated.mixin';
|
|
16
|
+
*
|
|
17
|
+
* @Component({ tag: 'bds-text-field', formAssociated: true })
|
|
18
|
+
* export class BdsTextField extends Mixin(formAssociatedMixin) implements ITextField, IFormControl<string> {
|
|
19
|
+
* @AttachInternals() internals!: ElementInternals;
|
|
20
|
+
*
|
|
21
|
+
* @Prop({ mutable: true, reflect: true }) value: string = '';
|
|
22
|
+
*
|
|
23
|
+
* @Event() valueChange!: EventEmitter<string>;
|
|
24
|
+
*
|
|
25
|
+
* public formAssociatedCallback(): void {
|
|
26
|
+
* setFormValue(this.internals, this.value);
|
|
27
|
+
* }
|
|
28
|
+
*
|
|
29
|
+
* public formResetCallback(): void {
|
|
30
|
+
* this.value = '';
|
|
31
|
+
* setFormValue(this.internals, null);
|
|
32
|
+
* }
|
|
33
|
+
*
|
|
34
|
+
* public formStateRestoreCallback(state: unknown, _mode: string): void {
|
|
35
|
+
* this.value = typeof state === 'string' ? state : '';
|
|
36
|
+
* setFormValue(this.internals, this.value);
|
|
37
|
+
* }
|
|
38
|
+
* }
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export interface IFormAssociatedCallbacks {
|
|
42
|
+
/**
|
|
43
|
+
* Called when the component becomes associated with a form, or when its
|
|
44
|
+
* `form` attribute changes.
|
|
45
|
+
*/
|
|
46
|
+
formAssociatedCallback(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Called when the parent form is reset via `form.reset()`.
|
|
49
|
+
*/
|
|
50
|
+
formResetCallback(): void;
|
|
51
|
+
/**
|
|
52
|
+
* Called when the browser restores form state (e.g. back/forward navigation).
|
|
53
|
+
*
|
|
54
|
+
* @param state - The previously saved form value for this component.
|
|
55
|
+
* @param mode - Either `'restore'` (autofill) or `'autocomplete'`.
|
|
56
|
+
*/
|
|
57
|
+
formStateRestoreCallback(state: unknown, mode: string): void;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Contract for form controls that support 2-way binding.
|
|
61
|
+
*
|
|
62
|
+
* Implement this interface on every component that extends `formAssociatedMixin`
|
|
63
|
+
* and owns a `value` prop. The `valueChange` event name is the convention picked
|
|
64
|
+
* up by `@stencil/vue-output-target`'s `componentModels` config to generate
|
|
65
|
+
* `v-model` support automatically.
|
|
66
|
+
*
|
|
67
|
+
* @typeParam T - The type of the value emitted (e.g. `string`, `boolean`, `string[]`).
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* export class BdsTextField extends Mixin(formAssociatedMixin) implements IFormControl<string> {
|
|
72
|
+
* @Event() valueChange!: EventEmitter<string>;
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export interface IFormValueEmitter<T> {
|
|
77
|
+
/**
|
|
78
|
+
* Emitted whenever the component's value changes.
|
|
79
|
+
* Used by framework output targets to wire up 2-way binding (e.g. `v-model` in Vue).
|
|
80
|
+
*/
|
|
81
|
+
valueChange: EventEmitter<T>;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Composite contract for a fully-featured Boreal DS form control.
|
|
85
|
+
*
|
|
86
|
+
* Extends both `IFormAssociatedCallbacks` (lifecycle hooks) and
|
|
87
|
+
* `IFormValueEmitter<T>` (2-way binding event) into a single interface
|
|
88
|
+
* so component class declarations stay concise.
|
|
89
|
+
*
|
|
90
|
+
* @typeParam T - The type of the value this control works with.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```typescript
|
|
94
|
+
* export class BdsTextField extends Mixin(formAssociatedMixin) implements ITextField, IFormControl<string> {
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
export interface IFormControl<T> extends IFormAssociatedCallbacks, IFormValueEmitter<T> {
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Shared base mixin for Form-Associated Custom Elements in Boreal DS.
|
|
101
|
+
*
|
|
102
|
+
* Provides:
|
|
103
|
+
* - `name`, `disabled`, and `required` form props
|
|
104
|
+
* - `formDisabledCallback` with universal disabled sync behavior
|
|
105
|
+
*
|
|
106
|
+
* Each component must declare `@AttachInternals() internals!: ElementInternals`
|
|
107
|
+
* directly on its class body — Stencil's compiler requires this decorator to be
|
|
108
|
+
* statically visible on the component class, not inside a mixin factory.
|
|
109
|
+
*
|
|
110
|
+
* Components must also implement `IFormControl<T>` for value registration,
|
|
111
|
+
* reset, state restoration, and 2-way binding event emission.
|
|
112
|
+
*/
|
|
113
|
+
export declare const formAssociatedMixin: <B extends MixedInCtor>(Base: B) => {
|
|
114
|
+
new (...args: any[]): {
|
|
115
|
+
/** Name of the form control, submitted as a key in the form data. */
|
|
116
|
+
readonly name: string;
|
|
117
|
+
/** Disables the control. Synced automatically from a parent `<fieldset>` or `<form>` via `formDisabledCallback`. */
|
|
118
|
+
readonly disabled: boolean;
|
|
119
|
+
/** Marks the control as required for form submission. */
|
|
120
|
+
readonly required: boolean;
|
|
121
|
+
/**
|
|
122
|
+
* Sync component disabled state with parent form disabled state.
|
|
123
|
+
*/
|
|
124
|
+
formDisabledCallback(disabled: boolean): void;
|
|
125
|
+
};
|
|
126
|
+
} & B;
|
|
127
|
+
//# sourceMappingURL=form-associated.mixin.d.ts.map
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { Placement, Strategy } from '@floating-ui/dom';
|
|
2
|
+
import { PositioningResult } from './Positioning';
|
|
3
|
+
import { FloatingAnchoredProp } from './Props';
|
|
4
|
+
/**
|
|
5
|
+
* Add methods to the `onBeforeShow`, `onAfterShow`, `onBeforeHide`, and `onAfterHide` to add custom logic.
|
|
6
|
+
* Pass the element to the method to get the reference to the floating element.
|
|
7
|
+
*/
|
|
8
|
+
export interface FloatingHooks {
|
|
9
|
+
onAfterShow?: (el?: HTMLElement) => void;
|
|
10
|
+
onBeforeHide?: (el?: HTMLElement) => boolean;
|
|
11
|
+
onBeforeShow?: (el?: HTMLElement) => boolean;
|
|
12
|
+
onAfterHide?: (el?: HTMLElement) => void;
|
|
13
|
+
mounted?: (el?: HTMLElement) => void;
|
|
14
|
+
unmounted?: (el?: HTMLElement) => void;
|
|
15
|
+
onPositionUpdate?: (result: PositioningResult) => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Define the possible options for comunication with the Floating UI library.
|
|
19
|
+
* Could define how the floating element and arrow will be positioned.
|
|
20
|
+
*/
|
|
21
|
+
export interface FloatingMixinOptions {
|
|
22
|
+
offset?: number;
|
|
23
|
+
placement?: Placement;
|
|
24
|
+
flip?: boolean;
|
|
25
|
+
shift?: boolean;
|
|
26
|
+
arrow?: HTMLElement;
|
|
27
|
+
strategy?: Strategy;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Implements the hooks and expose the options and hooks to the mixin.
|
|
31
|
+
* The mixin could provide a getter to able the developer override values.
|
|
32
|
+
*/
|
|
33
|
+
export interface IFloatingMixin extends FloatingHooks {
|
|
34
|
+
floatingOptions: FloatingAnchoredProp;
|
|
35
|
+
get options(): FloatingMixinOptions;
|
|
36
|
+
get hooks(): FloatingHooks;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=Floating.d.ts.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { MiddlewareData, Placement, Strategy } from '@floating-ui/dom';
|
|
2
|
+
/**
|
|
3
|
+
* Define the possible options to communicate with Floating UI library.
|
|
4
|
+
*/
|
|
5
|
+
export interface PositioningOptions {
|
|
6
|
+
placement?: Placement;
|
|
7
|
+
offset?: number;
|
|
8
|
+
flip?: boolean;
|
|
9
|
+
shift?: boolean;
|
|
10
|
+
arrow?: HTMLElement | null;
|
|
11
|
+
strategy?: Strategy;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Define the result of the positioning engine. Have the position and the placemen and additional data to define it behavior.
|
|
15
|
+
*/
|
|
16
|
+
export interface PositioningResult {
|
|
17
|
+
x: number;
|
|
18
|
+
y: number;
|
|
19
|
+
placement: Placement;
|
|
20
|
+
middlewareData: MiddlewareData;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=Positioning.d.ts.map
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Position } from "../../../types/position";
|
|
2
|
+
import { Arrow } from '../types/Arrow';
|
|
3
|
+
import { FloatingHooks, FloatingMixinOptions } from './Floating';
|
|
4
|
+
/**
|
|
5
|
+
* Interface to define the possible options as props for the floating mixin.
|
|
6
|
+
* Each floating component extends this interface to add custom logic.
|
|
7
|
+
* Each of this attributes could be added in "floatingOptions" prop of each component.
|
|
8
|
+
*/
|
|
9
|
+
export interface FloatingProp extends FloatingHooks, FloatingMixinOptions {
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Interface to define the possible options for the anchored components.
|
|
13
|
+
* Extends the `FloatingProp` interface to able the developer to add custom logic.
|
|
14
|
+
* Add placement prop to define the position of the anchored element.
|
|
15
|
+
*/
|
|
16
|
+
export interface FloatingAnchoredProp extends FloatingProp, Arrow {
|
|
17
|
+
placement?: Position;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Interface to define the possible options for the tooltip components.
|
|
21
|
+
* Add stayOnHover prop to prevent the tooltip to hide when the mouse is not over the trigger element.
|
|
22
|
+
*/
|
|
23
|
+
export interface FloatingTooltipProp extends FloatingAnchoredProp {
|
|
24
|
+
stayOnHover?: boolean;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Interface to define the possible options for the popover components.
|
|
28
|
+
* add closeOnClick prop to close the popover when the trigger element is clicked.
|
|
29
|
+
* add clickOutside prop to close the popover when the user click outside the popover.
|
|
30
|
+
*/
|
|
31
|
+
export interface FloatingPopoverProp extends FloatingAnchoredProp {
|
|
32
|
+
closeOnClick?: boolean;
|
|
33
|
+
clickOutside?: boolean;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=Props.d.ts.map
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { PositioningOptions, PositioningResult } from './interfaces/Positioning';
|
|
2
|
+
import { ILogger } from '../logger/Logger';
|
|
3
|
+
/**
|
|
4
|
+
* Adapter class to handle the positioning logic.
|
|
5
|
+
* This class is responsible for computing the position of the floating element and connect with the Floating UI library.
|
|
6
|
+
*
|
|
7
|
+
* All logic refered to the Floating UI library is encapsulated in this class.
|
|
8
|
+
*
|
|
9
|
+
* If you need add some Floating UI logic you can add a new methods to this class.
|
|
10
|
+
*/
|
|
11
|
+
export interface IFloatingAdapter {
|
|
12
|
+
computePosition(reference: HTMLElement | null, floating: HTMLElement | null, options: PositioningOptions): Promise<PositioningResult>;
|
|
13
|
+
applyPosition(element: HTMLElement, result: PositioningResult): void;
|
|
14
|
+
}
|
|
15
|
+
declare class FloatingAdapter implements IFloatingAdapter {
|
|
16
|
+
private readonly logger;
|
|
17
|
+
/**
|
|
18
|
+
* Constructor of the adapter.
|
|
19
|
+
* @param logger Inject the logger service to normalize the error messages.
|
|
20
|
+
*/
|
|
21
|
+
constructor(logger: ILogger);
|
|
22
|
+
/**
|
|
23
|
+
* Compute the position of the floating element making it responsive to the reference element.
|
|
24
|
+
* @param {HTMLElement} reference The reference element to position the floating element. Could be a trigger element or a container.
|
|
25
|
+
* @param {HTMLElement} floating The floating element to position, Will be positioned relative to the reference element.
|
|
26
|
+
* @param {PositioningOptions} options Manage the logic of the positioning and some props that are own of the Floating UI library.
|
|
27
|
+
* @returns {Promise<PositioningResult>} The positioning result with the position and the placement.
|
|
28
|
+
*/
|
|
29
|
+
computePosition(reference: HTMLElement | null, floating: HTMLElement | null, options: PositioningOptions): Promise<PositioningResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Apply the position of the floating element to the element.
|
|
32
|
+
* @param {HTMLElement} element Is the floating element to apply the position.
|
|
33
|
+
* @param {PositioningResult} result Is the positioning result with the position and the placement.
|
|
34
|
+
*/
|
|
35
|
+
applyPosition(element: HTMLElement, result: PositioningResult): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Export a simple class to use the adapter.
|
|
39
|
+
* This class is responsible for handling the positioning logic exported to the mixin or some other floating logic.
|
|
40
|
+
*/
|
|
41
|
+
export declare class PositioningEngine extends FloatingAdapter {
|
|
42
|
+
constructor();
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=positioning.service.d.ts.map
|