snice 2.1.5 → 2.2.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/dist/components/accordion/snice-accordion-item.d.ts +25 -0
- package/dist/components/accordion/snice-accordion-item.js +255 -0
- package/dist/components/accordion/snice-accordion-item.js.map +1 -0
- package/dist/components/accordion/snice-accordion.d.ts +28 -0
- package/dist/components/accordion/snice-accordion.js +206 -0
- package/dist/components/accordion/snice-accordion.js.map +1 -0
- package/dist/components/accordion/snice-accordion.types.d.ts +29 -0
- package/dist/components/alert/snice-alert.d.ts +26 -0
- package/dist/components/alert/snice-alert.js +180 -0
- package/dist/components/alert/snice-alert.js.map +1 -0
- package/{components/alert/snice-alert.types.ts → dist/components/alert/snice-alert.types.d.ts} +8 -9
- package/dist/components/avatar/snice-avatar.d.ts +24 -0
- package/dist/components/avatar/snice-avatar.js +180 -0
- package/dist/components/avatar/snice-avatar.js.map +1 -0
- package/dist/components/avatar/snice-avatar.types.d.ts +12 -0
- package/dist/components/badge/snice-badge.d.ts +25 -0
- package/dist/components/badge/snice-badge.js +169 -0
- package/dist/components/badge/snice-badge.js.map +1 -0
- package/{components/badge/snice-badge.types.ts → dist/components/badge/snice-badge.types.d.ts} +11 -12
- package/dist/components/breadcrumbs/snice-breadcrumbs.d.ts +27 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js +214 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.js.map +1 -0
- package/dist/components/breadcrumbs/snice-breadcrumbs.types.d.ts +23 -0
- package/dist/components/breadcrumbs/snice-crumb.d.ts +9 -0
- package/dist/components/breadcrumbs/snice-crumb.js +63 -0
- package/dist/components/breadcrumbs/snice-crumb.js.map +1 -0
- package/dist/components/button/snice-button.d.ts +32 -0
- package/dist/components/button/snice-button.js +232 -0
- package/dist/components/button/snice-button.js.map +1 -0
- package/dist/components/button/snice-button.types.d.ts +23 -0
- package/dist/components/card/snice-card.d.ts +19 -0
- package/dist/components/card/snice-card.js +136 -0
- package/dist/components/card/snice-card.js.map +1 -0
- package/{components/card/snice-card.types.ts → dist/components/card/snice-card.types.d.ts} +6 -7
- package/dist/components/checkbox/snice-checkbox.d.ts +34 -0
- package/dist/components/checkbox/snice-checkbox.js +286 -0
- package/dist/components/checkbox/snice-checkbox.js.map +1 -0
- package/dist/components/checkbox/snice-checkbox.types.d.ts +20 -0
- package/dist/components/chip/snice-chip.d.ts +28 -0
- package/dist/components/chip/snice-chip.js +199 -0
- package/dist/components/chip/snice-chip.js.map +1 -0
- package/dist/components/chip/snice-chip.types.d.ts +14 -0
- package/dist/components/date-picker/snice-date-picker.d.ts +82 -0
- package/dist/components/date-picker/snice-date-picker.js +847 -0
- package/dist/components/date-picker/snice-date-picker.js.map +1 -0
- package/dist/components/date-picker/snice-date-picker.types.d.ts +71 -0
- package/dist/components/divider/snice-divider.d.ts +17 -0
- package/dist/components/divider/snice-divider.js +122 -0
- package/dist/components/divider/snice-divider.js.map +1 -0
- package/{components/divider/snice-divider.types.ts → dist/components/divider/snice-divider.types.d.ts} +9 -10
- package/dist/components/drawer/snice-drawer.d.ts +37 -0
- package/dist/components/drawer/snice-drawer.js +337 -0
- package/dist/components/drawer/snice-drawer.js.map +1 -0
- package/dist/components/drawer/snice-drawer.types.d.ts +16 -0
- package/dist/components/input/snice-input.d.ts +65 -0
- package/dist/components/input/snice-input.js +567 -0
- package/dist/components/input/snice-input.js.map +1 -0
- package/dist/components/input/snice-input.types.d.ts +53 -0
- package/dist/components/layout/snice-layout-blog.d.ts +4 -0
- package/dist/components/layout/snice-layout-blog.js +67 -0
- package/dist/components/layout/snice-layout-blog.js.map +1 -0
- package/dist/components/layout/snice-layout-card.d.ts +6 -0
- package/dist/components/layout/snice-layout-card.js +64 -0
- package/dist/components/layout/snice-layout-card.js.map +1 -0
- package/dist/components/layout/snice-layout-centered.d.ts +5 -0
- package/dist/components/layout/snice-layout-centered.js +48 -0
- package/dist/components/layout/snice-layout-centered.js.map +1 -0
- package/dist/components/layout/snice-layout-dashboard.d.ts +4 -0
- package/dist/components/layout/snice-layout-dashboard.js +64 -0
- package/dist/components/layout/snice-layout-dashboard.js.map +1 -0
- package/dist/components/layout/snice-layout-fullscreen.d.ts +5 -0
- package/dist/components/layout/snice-layout-fullscreen.js +60 -0
- package/dist/components/layout/snice-layout-fullscreen.js.map +1 -0
- package/dist/components/layout/snice-layout-landing.d.ts +4 -0
- package/dist/components/layout/snice-layout-landing.js +66 -0
- package/dist/components/layout/snice-layout-landing.js.map +1 -0
- package/dist/components/layout/snice-layout-minimal.d.ts +4 -0
- package/dist/components/layout/snice-layout-minimal.js +38 -0
- package/dist/components/layout/snice-layout-minimal.js.map +1 -0
- package/dist/components/layout/snice-layout-sidebar.d.ts +5 -0
- package/dist/components/layout/snice-layout-sidebar.js +74 -0
- package/dist/components/layout/snice-layout-sidebar.js.map +1 -0
- package/dist/components/layout/snice-layout-split.d.ts +6 -0
- package/dist/components/layout/snice-layout-split.js +58 -0
- package/dist/components/layout/snice-layout-split.js.map +1 -0
- package/dist/components/layout/snice-layout.d.ts +4 -0
- package/dist/components/layout/snice-layout.js +54 -0
- package/dist/components/layout/snice-layout.js.map +1 -0
- package/{components/layout/snice-layout.types.ts → dist/components/layout/snice-layout.types.d.ts} +1 -3
- package/dist/components/login/snice-login.d.ts +44 -0
- package/dist/components/login/snice-login.js +382 -0
- package/dist/components/login/snice-login.js.map +1 -0
- package/dist/components/login/snice-login.types.d.ts +26 -0
- package/dist/components/modal/snice-modal.d.ts +32 -0
- package/dist/components/modal/snice-modal.js +280 -0
- package/dist/components/modal/snice-modal.js.map +1 -0
- package/dist/components/modal/snice-modal.types.d.ts +18 -0
- package/dist/components/pagination/snice-pagination.d.ts +26 -0
- package/dist/components/pagination/snice-pagination.js +373 -0
- package/dist/components/pagination/snice-pagination.js.map +1 -0
- package/dist/components/pagination/snice-pagination.types.d.ts +18 -0
- package/dist/components/progress/snice-progress.d.ts +35 -0
- package/dist/components/progress/snice-progress.js +305 -0
- package/dist/components/progress/snice-progress.js.map +1 -0
- package/dist/components/progress/snice-progress.types.d.ts +18 -0
- package/dist/components/radio/snice-radio.d.ts +33 -0
- package/dist/components/radio/snice-radio.js +279 -0
- package/dist/components/radio/snice-radio.js.map +1 -0
- package/dist/components/radio/snice-radio.types.d.ts +19 -0
- package/dist/components/select/snice-option.d.ts +17 -0
- package/dist/components/select/snice-option.js +88 -0
- package/dist/components/select/snice-option.js.map +1 -0
- package/{components/select/snice-option.types.ts → dist/components/select/snice-option.types.d.ts} +8 -8
- package/dist/components/select/snice-select.d.ts +89 -0
- package/dist/components/select/snice-select.js +864 -0
- package/dist/components/select/snice-select.js.map +1 -0
- package/dist/components/select/snice-select.types.d.ts +49 -0
- package/dist/components/skeleton/snice-skeleton.d.ts +16 -0
- package/dist/components/skeleton/snice-skeleton.js +166 -0
- package/dist/components/skeleton/snice-skeleton.js.map +1 -0
- package/{components/skeleton/snice-skeleton.types.ts → dist/components/skeleton/snice-skeleton.types.d.ts} +7 -8
- package/dist/components/snice-cell-C8aBfN72.js +4 -0
- package/dist/components/snice-cell-C8aBfN72.js.map +1 -0
- package/dist/components/switch/snice-switch.d.ts +38 -0
- package/dist/components/switch/snice-switch.js +305 -0
- package/dist/components/switch/snice-switch.js.map +1 -0
- package/dist/components/switch/snice-switch.types.d.ts +21 -0
- package/dist/components/symbols.d.ts +1 -0
- package/dist/components/symbols.js +22 -0
- package/dist/components/symbols.js.map +1 -0
- package/dist/components/table/snice-cell-boolean.d.ts +21 -0
- package/dist/components/table/snice-cell-boolean.js +164 -0
- package/dist/components/table/snice-cell-boolean.js.map +1 -0
- package/dist/components/table/snice-cell-date.d.ts +24 -0
- package/dist/components/table/snice-cell-date.js +253 -0
- package/dist/components/table/snice-cell-date.js.map +1 -0
- package/dist/components/table/snice-cell-duration.d.ts +16 -0
- package/dist/components/table/snice-cell-duration.js +130 -0
- package/dist/components/table/snice-cell-duration.js.map +1 -0
- package/dist/components/table/snice-cell-filesize.d.ts +16 -0
- package/dist/components/table/snice-cell-filesize.js +126 -0
- package/dist/components/table/snice-cell-filesize.js.map +1 -0
- package/dist/components/table/snice-cell-number.d.ts +23 -0
- package/dist/components/table/snice-cell-number.js +215 -0
- package/dist/components/table/snice-cell-number.js.map +1 -0
- package/dist/components/table/snice-cell-progress.d.ts +17 -0
- package/dist/components/table/snice-cell-progress.js +121 -0
- package/dist/components/table/snice-cell-progress.js.map +1 -0
- package/dist/components/table/snice-cell-rating.d.ts +17 -0
- package/dist/components/table/snice-cell-rating.js +120 -0
- package/dist/components/table/snice-cell-rating.js.map +1 -0
- package/dist/components/table/snice-cell-sparkline.d.ts +29 -0
- package/dist/components/table/snice-cell-sparkline.js +306 -0
- package/dist/components/table/snice-cell-sparkline.js.map +1 -0
- package/dist/components/table/snice-cell-text.d.ts +19 -0
- package/dist/components/table/snice-cell-text.js +161 -0
- package/dist/components/table/snice-cell-text.js.map +1 -0
- package/dist/components/table/snice-cell.d.ts +32 -0
- package/dist/components/table/snice-cell.js +458 -0
- package/dist/components/table/snice-cell.js.map +1 -0
- package/dist/components/table/snice-column.d.ts +62 -0
- package/dist/components/table/snice-column.js +506 -0
- package/dist/components/table/snice-column.js.map +1 -0
- package/dist/components/table/snice-header.d.ts +33 -0
- package/dist/components/table/snice-header.js +289 -0
- package/dist/components/table/snice-header.js.map +1 -0
- package/dist/components/table/snice-progress.d.ts +10 -0
- package/dist/components/table/snice-progress.js +105 -0
- package/dist/components/table/snice-progress.js.map +1 -0
- package/dist/components/table/snice-rating.d.ts +9 -0
- package/dist/components/table/snice-rating.js +81 -0
- package/dist/components/table/snice-rating.js.map +1 -0
- package/dist/components/table/snice-row.d.ts +43 -0
- package/dist/components/table/snice-row.js +353 -0
- package/dist/components/table/snice-row.js.map +1 -0
- package/dist/components/table/snice-table.d.ts +69 -0
- package/dist/components/table/snice-table.js +792 -0
- package/dist/components/table/snice-table.js.map +1 -0
- package/dist/components/table/snice-table.types.d.ts +137 -0
- package/dist/components/tabs/snice-tab-panel.d.ts +12 -0
- package/dist/components/tabs/snice-tab-panel.js +87 -0
- package/dist/components/tabs/snice-tab-panel.js.map +1 -0
- package/dist/components/tabs/snice-tab.d.ts +13 -0
- package/dist/components/tabs/snice-tab.js +98 -0
- package/dist/components/tabs/snice-tab.js.map +1 -0
- package/dist/components/tabs/snice-tabs.d.ts +34 -0
- package/dist/components/tabs/snice-tabs.js +375 -0
- package/dist/components/tabs/snice-tabs.js.map +1 -0
- package/dist/components/tabs/snice-tabs.types.d.ts +23 -0
- package/dist/components/toast/snice-toast-container.d.ts +25 -0
- package/dist/components/toast/snice-toast-container.js +252 -0
- package/dist/components/toast/snice-toast-container.js.map +1 -0
- package/dist/components/toast/snice-toast.d.ts +23 -0
- package/dist/components/toast/snice-toast.js +321 -0
- package/dist/components/toast/snice-toast.js.map +1 -0
- package/dist/components/toast/snice-toast.types.d.ts +30 -0
- package/dist/components/tooltip/snice-tooltip.d.ts +50 -0
- package/dist/components/tooltip/snice-tooltip.js +644 -0
- package/dist/components/tooltip/snice-tooltip.js.map +1 -0
- package/dist/components/tooltip/snice-tooltip.types.d.ts +18 -0
- package/dist/components/transitions.d.ts +11 -0
- package/dist/components/transitions.js +72 -0
- package/dist/components/transitions.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +10 -6
- package/components/accordion/demo.html +0 -403
- package/components/accordion/snice-accordion-item.css +0 -85
- package/components/accordion/snice-accordion-item.ts +0 -226
- package/components/accordion/snice-accordion.css +0 -31
- package/components/accordion/snice-accordion.ts +0 -182
- package/components/accordion/snice-accordion.types.ts +0 -32
- package/components/alert/demo.html +0 -445
- package/components/alert/snice-alert.css +0 -195
- package/components/alert/snice-alert.ts +0 -141
- package/components/avatar/demo.html +0 -598
- package/components/avatar/snice-avatar.css +0 -131
- package/components/avatar/snice-avatar.ts +0 -136
- package/components/avatar/snice-avatar.types.ts +0 -13
- package/components/badge/demo.html +0 -523
- package/components/badge/snice-badge.css +0 -161
- package/components/badge/snice-badge.ts +0 -117
- package/components/breadcrumbs/demo.html +0 -404
- package/components/breadcrumbs/snice-breadcrumbs.css +0 -133
- package/components/breadcrumbs/snice-breadcrumbs.ts +0 -191
- package/components/breadcrumbs/snice-breadcrumbs.types.ts +0 -26
- package/components/breadcrumbs/snice-crumb.ts +0 -26
- package/components/button/demo.html +0 -42
- package/components/button/snice-button.css +0 -230
- package/components/button/snice-button.ts +0 -169
- package/components/button/snice-button.types.ts +0 -25
- package/components/card/demo.html +0 -525
- package/components/card/snice-card.css +0 -140
- package/components/card/snice-card.ts +0 -102
- package/components/checkbox/demo.html +0 -253
- package/components/checkbox/snice-checkbox.css +0 -164
- package/components/checkbox/snice-checkbox.ts +0 -223
- package/components/checkbox/snice-checkbox.types.ts +0 -22
- package/components/chip/demo.html +0 -383
- package/components/chip/snice-chip.css +0 -195
- package/components/chip/snice-chip.ts +0 -139
- package/components/chip/snice-chip.types.ts +0 -15
- package/components/date-picker/README.md +0 -233
- package/components/date-picker/demo.html +0 -191
- package/components/date-picker/snice-date-picker.css +0 -330
- package/components/date-picker/snice-date-picker.ts +0 -777
- package/components/date-picker/snice-date-picker.types.ts +0 -83
- package/components/divider/demo.html +0 -233
- package/components/divider/snice-divider.css +0 -155
- package/components/divider/snice-divider.ts +0 -69
- package/components/drawer/demo.html +0 -328
- package/components/drawer/snice-drawer.css +0 -476
- package/components/drawer/snice-drawer.ts +0 -287
- package/components/drawer/snice-drawer.types.ts +0 -17
- package/components/global.d.ts +0 -14
- package/components/input/demo.html +0 -303
- package/components/input/snice-input.css +0 -257
- package/components/input/snice-input.ts +0 -442
- package/components/input/snice-input.types.ts +0 -59
- package/components/input/test.html +0 -77
- package/components/layout/README.md +0 -260
- package/components/layout/demo.html +0 -538
- package/components/layout/snice-layout-blog.css +0 -129
- package/components/layout/snice-layout-blog.ts +0 -48
- package/components/layout/snice-layout-card.css +0 -104
- package/components/layout/snice-layout-card.ts +0 -35
- package/components/layout/snice-layout-centered.css +0 -51
- package/components/layout/snice-layout-centered.ts +0 -22
- package/components/layout/snice-layout-dashboard.css +0 -98
- package/components/layout/snice-layout-dashboard.ts +0 -45
- package/components/layout/snice-layout-fullscreen.css +0 -72
- package/components/layout/snice-layout-fullscreen.ts +0 -34
- package/components/layout/snice-layout-landing.css +0 -92
- package/components/layout/snice-layout-landing.ts +0 -47
- package/components/layout/snice-layout-minimal.css +0 -16
- package/components/layout/snice-layout-minimal.ts +0 -19
- package/components/layout/snice-layout-sidebar.css +0 -117
- package/components/layout/snice-layout-sidebar.ts +0 -48
- package/components/layout/snice-layout-split.css +0 -103
- package/components/layout/snice-layout-split.ts +0 -29
- package/components/layout/snice-layout.css +0 -72
- package/components/layout/snice-layout.ts +0 -35
- package/components/login/demo-auth-controller.ts +0 -185
- package/components/login/demo.html +0 -470
- package/components/login/snice-login.css +0 -204
- package/components/login/snice-login.ts +0 -326
- package/components/login/snice-login.types.ts +0 -29
- package/components/modal/demo.html +0 -291
- package/components/modal/snice-modal.css +0 -203
- package/components/modal/snice-modal.ts +0 -233
- package/components/modal/snice-modal.types.ts +0 -21
- package/components/pagination/demo.html +0 -395
- package/components/pagination/snice-pagination.ts +0 -333
- package/components/pagination/snice-pagination.types.ts +0 -21
- package/components/progress/demo.html +0 -510
- package/components/progress/snice-progress.css +0 -267
- package/components/progress/snice-progress.ts +0 -247
- package/components/progress/snice-progress.types.ts +0 -19
- package/components/radio/demo.html +0 -287
- package/components/radio/snice-radio.css +0 -171
- package/components/radio/snice-radio.ts +0 -218
- package/components/radio/snice-radio.types.ts +0 -21
- package/components/select/demo.html +0 -511
- package/components/select/snice-option.ts +0 -52
- package/components/select/snice-select.css +0 -392
- package/components/select/snice-select.ts +0 -796
- package/components/select/snice-select.types.ts +0 -55
- package/components/skeleton/demo.html +0 -514
- package/components/skeleton/snice-skeleton.css +0 -109
- package/components/skeleton/snice-skeleton.ts +0 -126
- package/components/switch/demo.html +0 -284
- package/components/switch/snice-switch.css +0 -221
- package/components/switch/snice-switch.ts +0 -229
- package/components/switch/snice-switch.types.ts +0 -23
- package/components/symbols.ts +0 -23
- package/components/table/demo-table-controller.ts +0 -100
- package/components/table/demo.html +0 -480
- package/components/table/snice-cell-boolean.ts +0 -112
- package/components/table/snice-cell-date.ts +0 -210
- package/components/table/snice-cell-duration.ts +0 -91
- package/components/table/snice-cell-filesize.ts +0 -90
- package/components/table/snice-cell-number.ts +0 -165
- package/components/table/snice-cell-progress.ts +0 -83
- package/components/table/snice-cell-rating.ts +0 -82
- package/components/table/snice-cell-sparkline.ts +0 -253
- package/components/table/snice-cell-text.ts +0 -125
- package/components/table/snice-cell.css +0 -296
- package/components/table/snice-cell.ts +0 -473
- package/components/table/snice-column.ts +0 -353
- package/components/table/snice-header.css +0 -243
- package/components/table/snice-header.ts +0 -261
- package/components/table/snice-progress.ts +0 -66
- package/components/table/snice-rating.ts +0 -45
- package/components/table/snice-row.css +0 -255
- package/components/table/snice-row.ts +0 -331
- package/components/table/snice-table.css +0 -241
- package/components/table/snice-table.ts +0 -737
- package/components/table/snice-table.types.ts +0 -158
- package/components/tabs/demo.html +0 -487
- package/components/tabs/snice-tab-panel.css +0 -264
- package/components/tabs/snice-tab-panel.ts +0 -47
- package/components/tabs/snice-tab.css +0 -96
- package/components/tabs/snice-tab.ts +0 -65
- package/components/tabs/snice-tabs.css +0 -189
- package/components/tabs/snice-tabs.ts +0 -332
- package/components/tabs/snice-tabs.types.ts +0 -28
- package/components/theme/theme.css +0 -234
- package/components/toast/demo.html +0 -329
- package/components/toast/snice-toast-container.ts +0 -256
- package/components/toast/snice-toast.css +0 -213
- package/components/toast/snice-toast.ts +0 -276
- package/components/toast/snice-toast.types.ts +0 -35
- package/components/tooltip/demo.html +0 -350
- package/components/tooltip/snice-tooltip-portal.css +0 -79
- package/components/tooltip/snice-tooltip.css +0 -117
- package/components/tooltip/snice-tooltip.ts +0 -612
- package/components/tooltip/snice-tooltip.types.ts +0 -32
- package/components/transitions.ts +0 -94
- package/components/tsconfig.json +0 -18
|
@@ -0,0 +1,644 @@
|
|
|
1
|
+
import { __runInitializers, __esDecorate } from 'tslib';
|
|
2
|
+
import { element, property, query, ready, dispose, watch, on } from 'snice';
|
|
3
|
+
|
|
4
|
+
var css = '';
|
|
5
|
+
|
|
6
|
+
var portalCss = '';
|
|
7
|
+
|
|
8
|
+
let SniceTooltip = (() => {
|
|
9
|
+
let _classDecorators = [element('snice-tooltip')];
|
|
10
|
+
let _classDescriptor;
|
|
11
|
+
let _classExtraInitializers = [];
|
|
12
|
+
let _classThis;
|
|
13
|
+
let _classSuper = HTMLElement;
|
|
14
|
+
let _instanceExtraInitializers = [];
|
|
15
|
+
let _content_decorators;
|
|
16
|
+
let _content_initializers = [];
|
|
17
|
+
let _content_extraInitializers = [];
|
|
18
|
+
let _position_decorators;
|
|
19
|
+
let _position_initializers = [];
|
|
20
|
+
let _position_extraInitializers = [];
|
|
21
|
+
let _trigger_decorators;
|
|
22
|
+
let _trigger_initializers = [];
|
|
23
|
+
let _trigger_extraInitializers = [];
|
|
24
|
+
let _delay_decorators;
|
|
25
|
+
let _delay_initializers = [];
|
|
26
|
+
let _delay_extraInitializers = [];
|
|
27
|
+
let _hideDelay_decorators;
|
|
28
|
+
let _hideDelay_initializers = [];
|
|
29
|
+
let _hideDelay_extraInitializers = [];
|
|
30
|
+
let _offset_decorators;
|
|
31
|
+
let _offset_initializers = [];
|
|
32
|
+
let _offset_extraInitializers = [];
|
|
33
|
+
let _arrow_decorators;
|
|
34
|
+
let _arrow_initializers = [];
|
|
35
|
+
let _arrow_extraInitializers = [];
|
|
36
|
+
let _open_decorators;
|
|
37
|
+
let _open_initializers = [];
|
|
38
|
+
let _open_extraInitializers = [];
|
|
39
|
+
let _maxWidth_decorators;
|
|
40
|
+
let _maxWidth_initializers = [];
|
|
41
|
+
let _maxWidth_extraInitializers = [];
|
|
42
|
+
let _zIndex_decorators;
|
|
43
|
+
let _zIndex_initializers = [];
|
|
44
|
+
let _zIndex_extraInitializers = [];
|
|
45
|
+
let _strictPositioning_decorators;
|
|
46
|
+
let _strictPositioning_initializers = [];
|
|
47
|
+
let _strictPositioning_extraInitializers = [];
|
|
48
|
+
let _tooltipElement_decorators;
|
|
49
|
+
let _tooltipElement_initializers = [];
|
|
50
|
+
let _tooltipElement_extraInitializers = [];
|
|
51
|
+
let _arrowElement_decorators;
|
|
52
|
+
let _arrowElement_initializers = [];
|
|
53
|
+
let _arrowElement_extraInitializers = [];
|
|
54
|
+
let _init_decorators;
|
|
55
|
+
let _cleanup_decorators;
|
|
56
|
+
let _updateContent_decorators;
|
|
57
|
+
let _updateArrow_decorators;
|
|
58
|
+
let _updateMaxWidth_decorators;
|
|
59
|
+
let _updateZIndex_decorators;
|
|
60
|
+
let _handleOpenChange_decorators;
|
|
61
|
+
let _handleMouseEnter_decorators;
|
|
62
|
+
let _handleMouseLeave_decorators;
|
|
63
|
+
let _handleFocusIn_decorators;
|
|
64
|
+
let _handleFocusOut_decorators;
|
|
65
|
+
let _handleClick_decorators;
|
|
66
|
+
var SniceTooltip = class extends _classSuper {
|
|
67
|
+
static { _classThis = this; }
|
|
68
|
+
constructor() {
|
|
69
|
+
super(...arguments);
|
|
70
|
+
this.content = (__runInitializers(this, _instanceExtraInitializers), __runInitializers(this, _content_initializers, ''));
|
|
71
|
+
this.position = (__runInitializers(this, _content_extraInitializers), __runInitializers(this, _position_initializers, 'top'));
|
|
72
|
+
this.trigger = (__runInitializers(this, _position_extraInitializers), __runInitializers(this, _trigger_initializers, 'hover'));
|
|
73
|
+
this.delay = (__runInitializers(this, _trigger_extraInitializers), __runInitializers(this, _delay_initializers, 0));
|
|
74
|
+
this.hideDelay = (__runInitializers(this, _delay_extraInitializers), __runInitializers(this, _hideDelay_initializers, 0));
|
|
75
|
+
this.offset = (__runInitializers(this, _hideDelay_extraInitializers), __runInitializers(this, _offset_initializers, 12));
|
|
76
|
+
this.arrow = (__runInitializers(this, _offset_extraInitializers), __runInitializers(this, _arrow_initializers, true));
|
|
77
|
+
this.open = (__runInitializers(this, _arrow_extraInitializers), __runInitializers(this, _open_initializers, false));
|
|
78
|
+
this.maxWidth = (__runInitializers(this, _open_extraInitializers), __runInitializers(this, _maxWidth_initializers, 250));
|
|
79
|
+
this.zIndex = (__runInitializers(this, _maxWidth_extraInitializers), __runInitializers(this, _zIndex_initializers, 10000));
|
|
80
|
+
this.strictPositioning = (__runInitializers(this, _zIndex_extraInitializers), __runInitializers(this, _strictPositioning_initializers, false));
|
|
81
|
+
this.tooltipElement = (__runInitializers(this, _strictPositioning_extraInitializers), __runInitializers(this, _tooltipElement_initializers, void 0));
|
|
82
|
+
this.arrowElement = (__runInitializers(this, _tooltipElement_extraInitializers), __runInitializers(this, _arrowElement_initializers, void 0));
|
|
83
|
+
this.showTimeout = __runInitializers(this, _arrowElement_extraInitializers);
|
|
84
|
+
this.activePosition = 'top';
|
|
85
|
+
this.handleClickOutside = (e) => {
|
|
86
|
+
if (!this.contains(e.target)) {
|
|
87
|
+
this.hide();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
static {
|
|
92
|
+
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
93
|
+
_content_decorators = [property({ reflect: true })];
|
|
94
|
+
_position_decorators = [property({ reflect: true })];
|
|
95
|
+
_trigger_decorators = [property({ reflect: true })];
|
|
96
|
+
_delay_decorators = [property({ type: Number, reflect: true })];
|
|
97
|
+
_hideDelay_decorators = [property({ type: Number, attribute: 'hide-delay', reflect: true })];
|
|
98
|
+
_offset_decorators = [property({ type: Number, reflect: true })];
|
|
99
|
+
_arrow_decorators = [property({ type: Boolean, reflect: true })];
|
|
100
|
+
_open_decorators = [property({ type: Boolean, reflect: true })];
|
|
101
|
+
_maxWidth_decorators = [property({ type: Number, attribute: 'max-width', reflect: true })];
|
|
102
|
+
_zIndex_decorators = [property({ type: Number, attribute: 'z-index', reflect: true })];
|
|
103
|
+
_strictPositioning_decorators = [property({ type: Boolean, attribute: 'strict-positioning', reflect: true })];
|
|
104
|
+
_tooltipElement_decorators = [query('.tooltip')];
|
|
105
|
+
_arrowElement_decorators = [query('.tooltip__arrow')];
|
|
106
|
+
_init_decorators = [ready()];
|
|
107
|
+
_cleanup_decorators = [dispose()];
|
|
108
|
+
_updateContent_decorators = [watch('content')];
|
|
109
|
+
_updateArrow_decorators = [watch('arrow')];
|
|
110
|
+
_updateMaxWidth_decorators = [watch('maxWidth')];
|
|
111
|
+
_updateZIndex_decorators = [watch('zIndex')];
|
|
112
|
+
_handleOpenChange_decorators = [watch('open')];
|
|
113
|
+
_handleMouseEnter_decorators = [on('mouseenter')];
|
|
114
|
+
_handleMouseLeave_decorators = [on('mouseleave')];
|
|
115
|
+
_handleFocusIn_decorators = [on('focusin')];
|
|
116
|
+
_handleFocusOut_decorators = [on('focusout')];
|
|
117
|
+
_handleClick_decorators = [on('click')];
|
|
118
|
+
__esDecorate(this, null, _init_decorators, { kind: "method", name: "init", static: false, private: false, access: { has: obj => "init" in obj, get: obj => obj.init }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
119
|
+
__esDecorate(this, null, _cleanup_decorators, { kind: "method", name: "cleanup", static: false, private: false, access: { has: obj => "cleanup" in obj, get: obj => obj.cleanup }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
120
|
+
__esDecorate(this, null, _updateContent_decorators, { kind: "method", name: "updateContent", static: false, private: false, access: { has: obj => "updateContent" in obj, get: obj => obj.updateContent }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
121
|
+
__esDecorate(this, null, _updateArrow_decorators, { kind: "method", name: "updateArrow", static: false, private: false, access: { has: obj => "updateArrow" in obj, get: obj => obj.updateArrow }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
122
|
+
__esDecorate(this, null, _updateMaxWidth_decorators, { kind: "method", name: "updateMaxWidth", static: false, private: false, access: { has: obj => "updateMaxWidth" in obj, get: obj => obj.updateMaxWidth }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
123
|
+
__esDecorate(this, null, _updateZIndex_decorators, { kind: "method", name: "updateZIndex", static: false, private: false, access: { has: obj => "updateZIndex" in obj, get: obj => obj.updateZIndex }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
124
|
+
__esDecorate(this, null, _handleOpenChange_decorators, { kind: "method", name: "handleOpenChange", static: false, private: false, access: { has: obj => "handleOpenChange" in obj, get: obj => obj.handleOpenChange }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
125
|
+
__esDecorate(this, null, _handleMouseEnter_decorators, { kind: "method", name: "handleMouseEnter", static: false, private: false, access: { has: obj => "handleMouseEnter" in obj, get: obj => obj.handleMouseEnter }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
126
|
+
__esDecorate(this, null, _handleMouseLeave_decorators, { kind: "method", name: "handleMouseLeave", static: false, private: false, access: { has: obj => "handleMouseLeave" in obj, get: obj => obj.handleMouseLeave }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
127
|
+
__esDecorate(this, null, _handleFocusIn_decorators, { kind: "method", name: "handleFocusIn", static: false, private: false, access: { has: obj => "handleFocusIn" in obj, get: obj => obj.handleFocusIn }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
128
|
+
__esDecorate(this, null, _handleFocusOut_decorators, { kind: "method", name: "handleFocusOut", static: false, private: false, access: { has: obj => "handleFocusOut" in obj, get: obj => obj.handleFocusOut }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
129
|
+
__esDecorate(this, null, _handleClick_decorators, { kind: "method", name: "handleClick", static: false, private: false, access: { has: obj => "handleClick" in obj, get: obj => obj.handleClick }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
130
|
+
__esDecorate(null, null, _content_decorators, { kind: "field", name: "content", static: false, private: false, access: { has: obj => "content" in obj, get: obj => obj.content, set: (obj, value) => { obj.content = value; } }, metadata: _metadata }, _content_initializers, _content_extraInitializers);
|
|
131
|
+
__esDecorate(null, null, _position_decorators, { kind: "field", name: "position", static: false, private: false, access: { has: obj => "position" in obj, get: obj => obj.position, set: (obj, value) => { obj.position = value; } }, metadata: _metadata }, _position_initializers, _position_extraInitializers);
|
|
132
|
+
__esDecorate(null, null, _trigger_decorators, { kind: "field", name: "trigger", static: false, private: false, access: { has: obj => "trigger" in obj, get: obj => obj.trigger, set: (obj, value) => { obj.trigger = value; } }, metadata: _metadata }, _trigger_initializers, _trigger_extraInitializers);
|
|
133
|
+
__esDecorate(null, null, _delay_decorators, { kind: "field", name: "delay", static: false, private: false, access: { has: obj => "delay" in obj, get: obj => obj.delay, set: (obj, value) => { obj.delay = value; } }, metadata: _metadata }, _delay_initializers, _delay_extraInitializers);
|
|
134
|
+
__esDecorate(null, null, _hideDelay_decorators, { kind: "field", name: "hideDelay", static: false, private: false, access: { has: obj => "hideDelay" in obj, get: obj => obj.hideDelay, set: (obj, value) => { obj.hideDelay = value; } }, metadata: _metadata }, _hideDelay_initializers, _hideDelay_extraInitializers);
|
|
135
|
+
__esDecorate(null, null, _offset_decorators, { kind: "field", name: "offset", static: false, private: false, access: { has: obj => "offset" in obj, get: obj => obj.offset, set: (obj, value) => { obj.offset = value; } }, metadata: _metadata }, _offset_initializers, _offset_extraInitializers);
|
|
136
|
+
__esDecorate(null, null, _arrow_decorators, { kind: "field", name: "arrow", static: false, private: false, access: { has: obj => "arrow" in obj, get: obj => obj.arrow, set: (obj, value) => { obj.arrow = value; } }, metadata: _metadata }, _arrow_initializers, _arrow_extraInitializers);
|
|
137
|
+
__esDecorate(null, null, _open_decorators, { kind: "field", name: "open", static: false, private: false, access: { has: obj => "open" in obj, get: obj => obj.open, set: (obj, value) => { obj.open = value; } }, metadata: _metadata }, _open_initializers, _open_extraInitializers);
|
|
138
|
+
__esDecorate(null, null, _maxWidth_decorators, { kind: "field", name: "maxWidth", static: false, private: false, access: { has: obj => "maxWidth" in obj, get: obj => obj.maxWidth, set: (obj, value) => { obj.maxWidth = value; } }, metadata: _metadata }, _maxWidth_initializers, _maxWidth_extraInitializers);
|
|
139
|
+
__esDecorate(null, null, _zIndex_decorators, { kind: "field", name: "zIndex", static: false, private: false, access: { has: obj => "zIndex" in obj, get: obj => obj.zIndex, set: (obj, value) => { obj.zIndex = value; } }, metadata: _metadata }, _zIndex_initializers, _zIndex_extraInitializers);
|
|
140
|
+
__esDecorate(null, null, _strictPositioning_decorators, { kind: "field", name: "strictPositioning", static: false, private: false, access: { has: obj => "strictPositioning" in obj, get: obj => obj.strictPositioning, set: (obj, value) => { obj.strictPositioning = value; } }, metadata: _metadata }, _strictPositioning_initializers, _strictPositioning_extraInitializers);
|
|
141
|
+
__esDecorate(null, null, _tooltipElement_decorators, { kind: "field", name: "tooltipElement", static: false, private: false, access: { has: obj => "tooltipElement" in obj, get: obj => obj.tooltipElement, set: (obj, value) => { obj.tooltipElement = value; } }, metadata: _metadata }, _tooltipElement_initializers, _tooltipElement_extraInitializers);
|
|
142
|
+
__esDecorate(null, null, _arrowElement_decorators, { kind: "field", name: "arrowElement", static: false, private: false, access: { has: obj => "arrowElement" in obj, get: obj => obj.arrowElement, set: (obj, value) => { obj.arrowElement = value; } }, metadata: _metadata }, _arrowElement_initializers, _arrowElement_extraInitializers);
|
|
143
|
+
__esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name, metadata: _metadata }, null, _classExtraInitializers);
|
|
144
|
+
SniceTooltip = _classThis = _classDescriptor.value;
|
|
145
|
+
if (_metadata) Object.defineProperty(_classThis, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
146
|
+
}
|
|
147
|
+
static { this.portalStylesInjected = false; }
|
|
148
|
+
static ensurePortalStyles() {
|
|
149
|
+
if (SniceTooltip.portalStylesInjected)
|
|
150
|
+
return;
|
|
151
|
+
try {
|
|
152
|
+
// Use Constructable Stylesheets if supported
|
|
153
|
+
if ('adoptedStyleSheets' in document && 'CSSStyleSheet' in window) {
|
|
154
|
+
const sheet = new CSSStyleSheet();
|
|
155
|
+
sheet.replaceSync(portalCss);
|
|
156
|
+
document.adoptedStyleSheets = [...document.adoptedStyleSheets, sheet];
|
|
157
|
+
}
|
|
158
|
+
else {
|
|
159
|
+
// Fallback for older browsers
|
|
160
|
+
const style = document.createElement('style');
|
|
161
|
+
style.textContent = portalCss;
|
|
162
|
+
document.head.appendChild(style);
|
|
163
|
+
}
|
|
164
|
+
SniceTooltip.portalStylesInjected = true;
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
console.warn('Failed to inject tooltip portal styles:', error);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
html() {
|
|
171
|
+
return /*html*/ `
|
|
172
|
+
<div class="tooltip-trigger">
|
|
173
|
+
<slot></slot>
|
|
174
|
+
</div>
|
|
175
|
+
<div class="tooltip tooltip--${this.position}" role="tooltip" hidden>
|
|
176
|
+
<div class="tooltip__content">${this.content}</div>
|
|
177
|
+
<div class="tooltip__arrow"></div>
|
|
178
|
+
</div>
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
css() {
|
|
182
|
+
return css;
|
|
183
|
+
}
|
|
184
|
+
init() {
|
|
185
|
+
if (this.tooltipElement) {
|
|
186
|
+
this.tooltipElement.style.setProperty('--tooltip-max-width', `${this.maxWidth}px`);
|
|
187
|
+
this.tooltipElement.style.setProperty('--tooltip-z-index', `${this.zIndex}`);
|
|
188
|
+
}
|
|
189
|
+
if (this.open && this.trigger === 'manual') {
|
|
190
|
+
this.show();
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
cleanup() {
|
|
194
|
+
this.clearTimeouts();
|
|
195
|
+
if (this.portalElement) {
|
|
196
|
+
this.portalElement.remove();
|
|
197
|
+
this.portalElement = undefined;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
updateContent() {
|
|
201
|
+
const contentEl = this.shadowRoot?.querySelector('.tooltip__content');
|
|
202
|
+
if (contentEl) {
|
|
203
|
+
contentEl.textContent = this.content;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
updateArrow() {
|
|
207
|
+
if (this.arrowElement) {
|
|
208
|
+
if (this.arrow) {
|
|
209
|
+
this.arrowElement.removeAttribute('hidden');
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
this.arrowElement.setAttribute('hidden', '');
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
updateMaxWidth() {
|
|
217
|
+
if (this.tooltipElement) {
|
|
218
|
+
this.tooltipElement.style.setProperty('--tooltip-max-width', `${this.maxWidth}px`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
updateZIndex() {
|
|
222
|
+
if (this.tooltipElement) {
|
|
223
|
+
this.tooltipElement.style.setProperty('--tooltip-z-index', `${this.zIndex}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
handleOpenChange() {
|
|
227
|
+
if (this.trigger === 'manual') {
|
|
228
|
+
if (this.open) {
|
|
229
|
+
this.show();
|
|
230
|
+
}
|
|
231
|
+
else {
|
|
232
|
+
this.hide();
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
handleMouseEnter() {
|
|
237
|
+
if (this.trigger === 'hover') {
|
|
238
|
+
this.scheduleShow();
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
handleMouseLeave() {
|
|
242
|
+
if (this.trigger === 'hover') {
|
|
243
|
+
this.scheduleHide();
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
handleFocusIn() {
|
|
247
|
+
if (this.trigger === 'focus') {
|
|
248
|
+
this.scheduleShow();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
handleFocusOut() {
|
|
252
|
+
if (this.trigger === 'focus') {
|
|
253
|
+
this.scheduleHide();
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
handleClick() {
|
|
257
|
+
if (this.trigger === 'click') {
|
|
258
|
+
this.toggle();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
scheduleShow() {
|
|
262
|
+
this.clearTimeouts();
|
|
263
|
+
if (this.delay > 0) {
|
|
264
|
+
this.showTimeout = window.setTimeout(() => this.show(), this.delay);
|
|
265
|
+
}
|
|
266
|
+
else {
|
|
267
|
+
this.show();
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
scheduleHide() {
|
|
271
|
+
this.clearTimeouts();
|
|
272
|
+
if (this.hideDelay > 0) {
|
|
273
|
+
this.hideTimeout = window.setTimeout(() => this.hide(), this.hideDelay);
|
|
274
|
+
}
|
|
275
|
+
else {
|
|
276
|
+
this.hide();
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
clearTimeouts() {
|
|
280
|
+
if (this.showTimeout) {
|
|
281
|
+
clearTimeout(this.showTimeout);
|
|
282
|
+
this.showTimeout = undefined;
|
|
283
|
+
}
|
|
284
|
+
if (this.hideTimeout) {
|
|
285
|
+
clearTimeout(this.hideTimeout);
|
|
286
|
+
this.hideTimeout = undefined;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
show() {
|
|
290
|
+
if (!this.content)
|
|
291
|
+
return;
|
|
292
|
+
// Ensure portal styles are injected
|
|
293
|
+
SniceTooltip.ensurePortalStyles();
|
|
294
|
+
// Create portal element if it doesn't exist
|
|
295
|
+
if (!this.portalElement) {
|
|
296
|
+
this.portalElement = this.createPortalElement();
|
|
297
|
+
this.updateArrowStyles(this.position);
|
|
298
|
+
}
|
|
299
|
+
this.portalElement.style.display = 'block';
|
|
300
|
+
this.updatePortalContent();
|
|
301
|
+
// Force reflow before adding visible class
|
|
302
|
+
void this.portalElement.offsetHeight;
|
|
303
|
+
this.updatePosition();
|
|
304
|
+
this.portalElement.classList.add('snice-tooltip--visible');
|
|
305
|
+
if (this.trigger === 'click') {
|
|
306
|
+
// Add click outside listener
|
|
307
|
+
setTimeout(() => {
|
|
308
|
+
document.addEventListener('click', this.handleClickOutside);
|
|
309
|
+
}, 0);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
hide() {
|
|
313
|
+
if (!this.portalElement)
|
|
314
|
+
return;
|
|
315
|
+
this.portalElement.classList.remove('snice-tooltip--visible');
|
|
316
|
+
setTimeout(() => {
|
|
317
|
+
if (this.portalElement) {
|
|
318
|
+
this.portalElement.style.display = 'none';
|
|
319
|
+
}
|
|
320
|
+
}, 200); // Match transition duration
|
|
321
|
+
if (this.trigger === 'click') {
|
|
322
|
+
document.removeEventListener('click', this.handleClickOutside);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
toggle() {
|
|
326
|
+
if (!this.portalElement || this.portalElement.style.display === 'none') {
|
|
327
|
+
this.show();
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
this.hide();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
updatePosition() {
|
|
334
|
+
if (!this.portalElement)
|
|
335
|
+
return;
|
|
336
|
+
// Make sure tooltip is visible but off-screen to get accurate dimensions
|
|
337
|
+
this.portalElement.style.visibility = 'hidden';
|
|
338
|
+
this.portalElement.style.left = '-9999px';
|
|
339
|
+
this.portalElement.style.top = '-9999px';
|
|
340
|
+
const triggerRect = this.getBoundingClientRect();
|
|
341
|
+
const tooltipRect = this.portalElement.getBoundingClientRect();
|
|
342
|
+
// Restore visibility
|
|
343
|
+
this.portalElement.style.visibility = '';
|
|
344
|
+
// Calculate position with smart viewport detection
|
|
345
|
+
const position = this.calculatePosition(triggerRect, tooltipRect);
|
|
346
|
+
// Update tooltip position class if it changed
|
|
347
|
+
if (position.adjustedPosition !== this.activePosition) {
|
|
348
|
+
this.portalElement.classList.remove(`snice-tooltip--${this.activePosition}`);
|
|
349
|
+
this.portalElement.classList.add(`snice-tooltip--${position.adjustedPosition}`);
|
|
350
|
+
this.activePosition = position.adjustedPosition;
|
|
351
|
+
// Update arrow styles for new position
|
|
352
|
+
this.updateArrowStyles(position.adjustedPosition);
|
|
353
|
+
}
|
|
354
|
+
// Apply calculated position
|
|
355
|
+
this.portalElement.style.left = `${position.left}px`;
|
|
356
|
+
this.portalElement.style.top = `${position.top}px`;
|
|
357
|
+
}
|
|
358
|
+
updateArrowStyles(position) {
|
|
359
|
+
if (!this.portalElement || !this.arrow)
|
|
360
|
+
return;
|
|
361
|
+
const arrow = this.portalElement.querySelector('.snice-tooltip__arrow');
|
|
362
|
+
if (!arrow)
|
|
363
|
+
return;
|
|
364
|
+
// Reset styles - set to explicit values instead of empty strings
|
|
365
|
+
arrow.style.top = 'auto';
|
|
366
|
+
arrow.style.bottom = 'auto';
|
|
367
|
+
arrow.style.left = 'auto';
|
|
368
|
+
arrow.style.right = 'auto';
|
|
369
|
+
arrow.style.transform = 'none';
|
|
370
|
+
arrow.style.borderTopColor = 'transparent';
|
|
371
|
+
arrow.style.borderBottomColor = 'transparent';
|
|
372
|
+
arrow.style.borderLeftColor = 'transparent';
|
|
373
|
+
arrow.style.borderRightColor = 'transparent';
|
|
374
|
+
// Apply position-specific styles
|
|
375
|
+
switch (position) {
|
|
376
|
+
case 'top':
|
|
377
|
+
case 'top-start':
|
|
378
|
+
case 'top-end':
|
|
379
|
+
arrow.style.bottom = '-6px';
|
|
380
|
+
arrow.style.borderWidth = '6px 6px 0';
|
|
381
|
+
arrow.style.borderTopColor = '#333';
|
|
382
|
+
arrow.style.borderLeftColor = 'transparent';
|
|
383
|
+
arrow.style.borderRightColor = 'transparent';
|
|
384
|
+
if (position === 'top') {
|
|
385
|
+
arrow.style.left = '50%';
|
|
386
|
+
arrow.style.transform = 'translateX(-50%)';
|
|
387
|
+
}
|
|
388
|
+
else if (position === 'top-start') {
|
|
389
|
+
arrow.style.left = '16px';
|
|
390
|
+
}
|
|
391
|
+
else {
|
|
392
|
+
arrow.style.right = '16px';
|
|
393
|
+
}
|
|
394
|
+
break;
|
|
395
|
+
case 'bottom':
|
|
396
|
+
case 'bottom-start':
|
|
397
|
+
case 'bottom-end':
|
|
398
|
+
arrow.style.top = '-6px';
|
|
399
|
+
arrow.style.borderWidth = '0 6px 6px';
|
|
400
|
+
arrow.style.borderBottomColor = '#333';
|
|
401
|
+
arrow.style.borderLeftColor = 'transparent';
|
|
402
|
+
arrow.style.borderRightColor = 'transparent';
|
|
403
|
+
if (position === 'bottom') {
|
|
404
|
+
arrow.style.left = '50%';
|
|
405
|
+
arrow.style.transform = 'translateX(-50%)';
|
|
406
|
+
}
|
|
407
|
+
else if (position === 'bottom-start') {
|
|
408
|
+
arrow.style.left = '16px';
|
|
409
|
+
}
|
|
410
|
+
else {
|
|
411
|
+
arrow.style.right = '16px';
|
|
412
|
+
}
|
|
413
|
+
break;
|
|
414
|
+
case 'left':
|
|
415
|
+
case 'left-start':
|
|
416
|
+
case 'left-end':
|
|
417
|
+
arrow.style.right = '-6px';
|
|
418
|
+
arrow.style.borderWidth = '6px 0 6px 6px';
|
|
419
|
+
arrow.style.borderLeftColor = '#333';
|
|
420
|
+
arrow.style.borderTopColor = 'transparent';
|
|
421
|
+
arrow.style.borderBottomColor = 'transparent';
|
|
422
|
+
if (position === 'left') {
|
|
423
|
+
arrow.style.top = '50%';
|
|
424
|
+
arrow.style.transform = 'translateY(-50%)';
|
|
425
|
+
}
|
|
426
|
+
else if (position === 'left-start') {
|
|
427
|
+
arrow.style.top = '16px';
|
|
428
|
+
}
|
|
429
|
+
else {
|
|
430
|
+
arrow.style.bottom = '16px';
|
|
431
|
+
}
|
|
432
|
+
break;
|
|
433
|
+
case 'right':
|
|
434
|
+
case 'right-start':
|
|
435
|
+
case 'right-end':
|
|
436
|
+
arrow.style.left = '-6px';
|
|
437
|
+
arrow.style.borderWidth = '6px 6px 6px 0';
|
|
438
|
+
arrow.style.borderRightColor = '#333';
|
|
439
|
+
arrow.style.borderTopColor = 'transparent';
|
|
440
|
+
arrow.style.borderBottomColor = 'transparent';
|
|
441
|
+
if (position === 'right') {
|
|
442
|
+
arrow.style.top = '50%';
|
|
443
|
+
arrow.style.transform = 'translateY(-50%)';
|
|
444
|
+
}
|
|
445
|
+
else if (position === 'right-start') {
|
|
446
|
+
arrow.style.top = '16px';
|
|
447
|
+
}
|
|
448
|
+
else {
|
|
449
|
+
arrow.style.bottom = '16px';
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
calculatePosition(triggerRect, tooltipRect) {
|
|
455
|
+
const viewport = {
|
|
456
|
+
width: window.innerWidth,
|
|
457
|
+
height: window.innerHeight};
|
|
458
|
+
let position = this.position;
|
|
459
|
+
let left = 0;
|
|
460
|
+
let top = 0;
|
|
461
|
+
// Calculate base position
|
|
462
|
+
const positions = this.getPositionCoordinates(triggerRect, tooltipRect, position);
|
|
463
|
+
left = positions.left;
|
|
464
|
+
top = positions.top;
|
|
465
|
+
// If strict positioning is disabled, check if tooltip fits in viewport
|
|
466
|
+
if (!this.strictPositioning) {
|
|
467
|
+
const fitsInViewport = left >= 0 &&
|
|
468
|
+
top >= 0 &&
|
|
469
|
+
left + tooltipRect.width <= viewport.width &&
|
|
470
|
+
top + tooltipRect.height <= viewport.height;
|
|
471
|
+
// If it doesn't fit, try alternative positions
|
|
472
|
+
if (!fitsInViewport) {
|
|
473
|
+
const alternativePositions = this.getAlternativePositions(position);
|
|
474
|
+
for (const altPosition of alternativePositions) {
|
|
475
|
+
const altCoords = this.getPositionCoordinates(triggerRect, tooltipRect, altPosition);
|
|
476
|
+
if (altCoords.left >= 0 &&
|
|
477
|
+
altCoords.top >= 0 &&
|
|
478
|
+
altCoords.left + tooltipRect.width <= viewport.width &&
|
|
479
|
+
altCoords.top + tooltipRect.height <= viewport.height) {
|
|
480
|
+
position = altPosition;
|
|
481
|
+
left = altCoords.left;
|
|
482
|
+
top = altCoords.top;
|
|
483
|
+
break;
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return { left, top, adjustedPosition: position };
|
|
489
|
+
}
|
|
490
|
+
getPositionCoordinates(triggerRect, tooltipRect, position) {
|
|
491
|
+
let left = 0;
|
|
492
|
+
let top = 0;
|
|
493
|
+
const centerX = triggerRect.left + triggerRect.width / 2;
|
|
494
|
+
const centerY = triggerRect.top + triggerRect.height / 2;
|
|
495
|
+
// Different offsets for different directions
|
|
496
|
+
// Left/right need more spacing, top/bottom need less
|
|
497
|
+
const arrowSize = this.arrow ? 6 : 0;
|
|
498
|
+
const verticalOffset = this.offset; // Just base offset for top/bottom
|
|
499
|
+
const horizontalOffset = this.offset + arrowSize; // More offset for left/right
|
|
500
|
+
switch (position) {
|
|
501
|
+
case 'top':
|
|
502
|
+
left = centerX - tooltipRect.width / 2;
|
|
503
|
+
top = triggerRect.top - tooltipRect.height - verticalOffset;
|
|
504
|
+
break;
|
|
505
|
+
case 'top-start':
|
|
506
|
+
left = triggerRect.left;
|
|
507
|
+
top = triggerRect.top - tooltipRect.height - verticalOffset;
|
|
508
|
+
break;
|
|
509
|
+
case 'top-end':
|
|
510
|
+
left = triggerRect.right - tooltipRect.width;
|
|
511
|
+
top = triggerRect.top - tooltipRect.height - verticalOffset;
|
|
512
|
+
break;
|
|
513
|
+
case 'bottom':
|
|
514
|
+
left = centerX - tooltipRect.width / 2;
|
|
515
|
+
top = triggerRect.bottom + verticalOffset;
|
|
516
|
+
break;
|
|
517
|
+
case 'bottom-start':
|
|
518
|
+
left = triggerRect.left;
|
|
519
|
+
top = triggerRect.bottom + verticalOffset;
|
|
520
|
+
break;
|
|
521
|
+
case 'bottom-end':
|
|
522
|
+
left = triggerRect.right - tooltipRect.width;
|
|
523
|
+
top = triggerRect.bottom + verticalOffset;
|
|
524
|
+
break;
|
|
525
|
+
case 'left':
|
|
526
|
+
left = triggerRect.left - tooltipRect.width - horizontalOffset;
|
|
527
|
+
top = centerY - tooltipRect.height / 2;
|
|
528
|
+
break;
|
|
529
|
+
case 'left-start':
|
|
530
|
+
left = triggerRect.left - tooltipRect.width - horizontalOffset;
|
|
531
|
+
top = triggerRect.top;
|
|
532
|
+
break;
|
|
533
|
+
case 'left-end':
|
|
534
|
+
left = triggerRect.left - tooltipRect.width - horizontalOffset;
|
|
535
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
536
|
+
break;
|
|
537
|
+
case 'right':
|
|
538
|
+
left = triggerRect.right + horizontalOffset;
|
|
539
|
+
top = centerY - tooltipRect.height / 2;
|
|
540
|
+
break;
|
|
541
|
+
case 'right-start':
|
|
542
|
+
left = triggerRect.right + horizontalOffset;
|
|
543
|
+
top = triggerRect.top;
|
|
544
|
+
break;
|
|
545
|
+
case 'right-end':
|
|
546
|
+
left = triggerRect.right + horizontalOffset;
|
|
547
|
+
top = triggerRect.bottom - tooltipRect.height;
|
|
548
|
+
break;
|
|
549
|
+
}
|
|
550
|
+
return { left, top };
|
|
551
|
+
}
|
|
552
|
+
getAlternativePositions(position) {
|
|
553
|
+
const opposites = {
|
|
554
|
+
'top': ['bottom', 'left', 'right'],
|
|
555
|
+
'top-start': ['bottom-start', 'left', 'right'],
|
|
556
|
+
'top-end': ['bottom-end', 'left', 'right'],
|
|
557
|
+
'bottom': ['top', 'left', 'right'],
|
|
558
|
+
'bottom-start': ['top-start', 'left', 'right'],
|
|
559
|
+
'bottom-end': ['top-end', 'left', 'right'],
|
|
560
|
+
'left': ['right', 'top', 'bottom'],
|
|
561
|
+
'left-start': ['right-start', 'top', 'bottom'],
|
|
562
|
+
'left-end': ['right-end', 'top', 'bottom'],
|
|
563
|
+
'right': ['left', 'top', 'bottom'],
|
|
564
|
+
'right-start': ['left-start', 'top', 'bottom'],
|
|
565
|
+
'right-end': ['left-end', 'top', 'bottom']
|
|
566
|
+
};
|
|
567
|
+
return opposites[position] || ['top', 'bottom', 'left', 'right'];
|
|
568
|
+
}
|
|
569
|
+
createPortalElement() {
|
|
570
|
+
const portal = document.createElement('div');
|
|
571
|
+
portal.className = `snice-tooltip snice-tooltip--${this.position}`;
|
|
572
|
+
portal.setAttribute('role', 'tooltip');
|
|
573
|
+
portal.style.cssText = `
|
|
574
|
+
position: fixed;
|
|
575
|
+
z-index: ${this.zIndex};
|
|
576
|
+
padding: 8px 12px;
|
|
577
|
+
background: #333;
|
|
578
|
+
color: white;
|
|
579
|
+
border-radius: 6px;
|
|
580
|
+
font-size: 14px;
|
|
581
|
+
line-height: 1.4;
|
|
582
|
+
max-width: ${this.maxWidth}px;
|
|
583
|
+
width: max-content;
|
|
584
|
+
pointer-events: none;
|
|
585
|
+
opacity: 0;
|
|
586
|
+
transform: scale(0.95);
|
|
587
|
+
transition: opacity 0.2s, transform 0.2s;
|
|
588
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
589
|
+
display: none;
|
|
590
|
+
`;
|
|
591
|
+
// Create content element
|
|
592
|
+
const content = document.createElement('div');
|
|
593
|
+
content.className = 'snice-tooltip__content';
|
|
594
|
+
portal.appendChild(content);
|
|
595
|
+
// Create arrow element if needed
|
|
596
|
+
if (this.arrow) {
|
|
597
|
+
const arrow = document.createElement('div');
|
|
598
|
+
arrow.className = 'snice-tooltip__arrow';
|
|
599
|
+
arrow.style.cssText = `
|
|
600
|
+
position: absolute;
|
|
601
|
+
width: 0;
|
|
602
|
+
height: 0;
|
|
603
|
+
border-style: solid;
|
|
604
|
+
`;
|
|
605
|
+
portal.appendChild(arrow);
|
|
606
|
+
}
|
|
607
|
+
// Add to body
|
|
608
|
+
document.body.appendChild(portal);
|
|
609
|
+
return portal;
|
|
610
|
+
}
|
|
611
|
+
updatePortalContent() {
|
|
612
|
+
if (!this.portalElement)
|
|
613
|
+
return;
|
|
614
|
+
const content = this.portalElement.querySelector('.snice-tooltip__content');
|
|
615
|
+
if (content) {
|
|
616
|
+
content.textContent = this.content;
|
|
617
|
+
}
|
|
618
|
+
// Update or create arrow if needed
|
|
619
|
+
let arrow = this.portalElement.querySelector('.snice-tooltip__arrow');
|
|
620
|
+
if (this.arrow && !arrow) {
|
|
621
|
+
// Create arrow if it doesn't exist but should
|
|
622
|
+
arrow = document.createElement('div');
|
|
623
|
+
arrow.className = 'snice-tooltip__arrow';
|
|
624
|
+
arrow.style.cssText = `
|
|
625
|
+
position: absolute;
|
|
626
|
+
width: 0;
|
|
627
|
+
height: 0;
|
|
628
|
+
border-style: solid;
|
|
629
|
+
`;
|
|
630
|
+
this.portalElement.appendChild(arrow);
|
|
631
|
+
}
|
|
632
|
+
else if (arrow) {
|
|
633
|
+
arrow.style.display = this.arrow ? '' : 'none';
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
static {
|
|
637
|
+
__runInitializers(_classThis, _classExtraInitializers);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
return SniceTooltip = _classThis;
|
|
641
|
+
})();
|
|
642
|
+
|
|
643
|
+
export { SniceTooltip };
|
|
644
|
+
//# sourceMappingURL=snice-tooltip.js.map
|