@aquera/nile-elements 2.0.4 → 2.0.6
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/README.md +9 -0
- package/demo/nxtgen-classes.css +609 -12
- package/demo/nxtgen-dark.css +254 -35
- package/demo/nxtgen-properties.css +27 -24
- package/demo/nxtgen-utilities.css +633 -36
- package/demo/nxtgen.css +70 -12
- package/demo/utilities.css +3 -0
- package/demo/variables.css +3 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1375 -358
- package/dist/internal/glyph.cjs.js +1 -1
- package/dist/internal/glyph.cjs.js.map +1 -1
- package/dist/internal/glyph.esm.js +6 -5
- package/dist/nile-app-shell/index.cjs.js +2 -0
- package/dist/nile-app-shell/index.cjs.js.map +1 -0
- package/dist/nile-app-shell/index.esm.js +1 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js +2 -0
- package/dist/nile-app-shell/nile-app-shell.css.cjs.js.map +1 -0
- package/dist/nile-app-shell/nile-app-shell.css.esm.js +554 -0
- package/dist/nile-app-shell/nile-app-shell.esm.js +155 -0
- package/dist/nile-app-shell/shell-controller.cjs.js +2 -0
- package/dist/nile-app-shell/shell-controller.cjs.js.map +1 -0
- package/dist/nile-app-shell/shell-controller.esm.js +1 -0
- package/dist/nile-app-shell-main/index.cjs.js +2 -0
- package/dist/nile-app-shell-main/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/index.esm.js +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js +2 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.css.esm.js +18 -0
- package/dist/nile-app-shell-main/nile-app-shell-main.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/index.esm.js +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js +2 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.esm.js +29 -0
- package/dist/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.esm.js +16 -0
- package/dist/nile-app-shell-panel/index.cjs.js +2 -0
- package/dist/nile-app-shell-panel/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/index.esm.js +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js +2 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.css.esm.js +103 -0
- package/dist/nile-app-shell-panel/nile-app-shell-panel.esm.js +33 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/index.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/index.esm.js +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js +2 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.cjs.js.map +1 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.css.esm.js +55 -0
- package/dist/nile-app-shell-side-nav/nile-app-shell-side-nav.esm.js +5 -0
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.css.cjs.js.map +1 -1
- package/dist/nile-combobox/nile-combobox.css.esm.js +28 -15
- package/dist/nile-combobox/nile-combobox.esm.js +11 -8
- package/dist/nile-combobox/portal-manager.cjs.js +1 -1
- package/dist/nile-combobox/portal-manager.cjs.js.map +1 -1
- package/dist/nile-combobox/portal-manager.esm.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js +1 -1
- package/dist/nile-combobox/renderer.cjs.js.map +1 -1
- package/dist/nile-combobox/renderer.esm.js +31 -43
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.cjs.js.map +1 -1
- package/dist/nile-floating-panel/nile-floating-panel.css.esm.js +46 -8
- package/dist/nile-floating-panel/nile-floating-panel.esm.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js +1 -1
- package/dist/nile-popover/nile-popover.css.cjs.js.map +1 -1
- package/dist/nile-popover/nile-popover.css.esm.js +32 -17
- package/dist/nile-popover/nile-popover.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-editor.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/index.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/nile-wysiwyg-toolbar/nile-wysiwyg-toolbar.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/bubble-menu.esm.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/embed-menu.esm.js +2 -2
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/image-menu.esm.js +4 -4
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.cjs.js.map +1 -1
- package/dist/nile-wysiwyg-editor/ui/table-menu.esm.js +1 -1
- package/dist/src/index.d.ts +7 -2
- package/dist/src/index.js +6 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/internal/glyph.d.ts +6 -1
- package/dist/src/internal/glyph.js +8 -1
- package/dist/src/internal/glyph.js.map +1 -1
- package/dist/src/nile-app-shell/index.d.ts +7 -0
- package/dist/src/nile-app-shell/index.js +8 -0
- package/dist/src/nile-app-shell/index.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.d.ts +4 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js +177 -0
- package/dist/src/nile-app-shell/nile-app-shell-regions.test.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.d.ts +18 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js +572 -0
- package/dist/src/nile-app-shell/nile-app-shell.css.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.d.ts +292 -0
- package/dist/src/nile-app-shell/nile-app-shell.js +796 -0
- package/dist/src/nile-app-shell/nile-app-shell.js.map +1 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.d.ts +3 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js +454 -0
- package/dist/src/nile-app-shell/nile-app-shell.test.js.map +1 -0
- package/dist/src/nile-app-shell/shell-controller.d.ts +34 -0
- package/dist/src/nile-app-shell/shell-controller.js +80 -0
- package/dist/src/nile-app-shell/shell-controller.js.map +1 -0
- package/dist/src/nile-app-shell-main/index.d.ts +7 -0
- package/dist/src/nile-app-shell-main/index.js +8 -0
- package/dist/src/nile-app-shell-main/index.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.d.ts +9 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js +27 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.css.js.map +1 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.d.ts +38 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js +51 -0
- package/dist/src/nile-app-shell-main/nile-app-shell-main.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/index.d.ts +7 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js +8 -0
- package/dist/src/nile-app-shell-nav-toggle/index.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.d.ts +13 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js +42 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.js.map +1 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.d.ts +56 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js +126 -0
- package/dist/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.js.map +1 -0
- package/dist/src/nile-app-shell-panel/index.d.ts +7 -0
- package/dist/src/nile-app-shell-panel/index.js +8 -0
- package/dist/src/nile-app-shell-panel/index.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.d.ts +9 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js +112 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.css.js.map +1 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.d.ts +73 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js +158 -0
- package/dist/src/nile-app-shell-panel/nile-app-shell-panel.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/index.d.ts +7 -0
- package/dist/src/nile-app-shell-side-nav/index.js +8 -0
- package/dist/src/nile-app-shell-side-nav/index.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.d.ts +13 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js +68 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.js.map +1 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.d.ts +54 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js +83 -0
- package/dist/src/nile-app-shell-side-nav/nile-app-shell-side-nav.js.map +1 -0
- package/dist/src/nile-combobox/nile-combobox.css.js +28 -15
- package/dist/src/nile-combobox/nile-combobox.css.js.map +1 -1
- package/dist/src/nile-combobox/nile-combobox.js +49 -10
- package/dist/src/nile-combobox/nile-combobox.js.map +1 -1
- package/dist/src/nile-combobox/portal-manager.js +2 -22
- package/dist/src/nile-combobox/portal-manager.js.map +1 -1
- package/dist/src/nile-combobox/renderer.d.ts +2 -3
- package/dist/src/nile-combobox/renderer.js +14 -45
- package/dist/src/nile-combobox/renderer.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js +46 -8
- package/dist/src/nile-floating-panel/nile-floating-panel.css.js.map +1 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js +13 -1
- package/dist/src/nile-floating-panel/nile-floating-panel.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.css.js +30 -15
- package/dist/src/nile-popover/nile-popover.css.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.js +1 -1
- package/dist/src/nile-popover/nile-popover.js.map +1 -1
- package/dist/src/nile-popover/nile-popover.test.js +1 -1
- package/dist/src/nile-popover/nile-popover.test.js.map +1 -1
- package/dist/src/version.d.ts +11 -1
- package/dist/src/version.js +56 -5
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/version.cjs.js +1 -1
- package/dist/version.cjs.js.map +1 -1
- package/dist/version.esm.js +1 -1
- package/package.json +8 -2
- package/scripts/replace-version.cjs +12 -10
- package/src/index.ts +16 -4
- package/src/internal/glyph.ts +12 -1
- package/src/nile-app-shell/index.ts +8 -0
- package/src/nile-app-shell/nile-app-shell-regions.test.ts +215 -0
- package/src/nile-app-shell/nile-app-shell.css.ts +574 -0
- package/src/nile-app-shell/nile-app-shell.test.ts +536 -0
- package/src/nile-app-shell/nile-app-shell.ts +838 -0
- package/src/nile-app-shell/shell-controller.ts +100 -0
- package/src/nile-app-shell-main/index.ts +8 -0
- package/src/nile-app-shell-main/nile-app-shell-main.css.ts +29 -0
- package/src/nile-app-shell-main/nile-app-shell-main.ts +52 -0
- package/src/nile-app-shell-nav-toggle/index.ts +8 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.css.ts +44 -0
- package/src/nile-app-shell-nav-toggle/nile-app-shell-nav-toggle.ts +138 -0
- package/src/nile-app-shell-panel/index.ts +8 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.css.ts +114 -0
- package/src/nile-app-shell-panel/nile-app-shell-panel.ts +161 -0
- package/src/nile-app-shell-side-nav/index.ts +8 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.css.ts +70 -0
- package/src/nile-app-shell-side-nav/nile-app-shell-side-nav.ts +86 -0
- package/src/nile-combobox/nile-combobox.css.ts +28 -15
- package/src/nile-combobox/nile-combobox.ts +61 -12
- package/src/nile-combobox/portal-manager.ts +4 -22
- package/src/nile-combobox/renderer.ts +26 -69
- package/src/nile-floating-panel/nile-floating-panel.css.ts +46 -8
- package/src/nile-floating-panel/nile-floating-panel.ts +19 -1
- package/src/nile-popover/nile-popover.css.ts +30 -15
- package/src/nile-popover/nile-popover.test.ts +1 -1
- package/src/nile-popover/nile-popover.ts +1 -1
- package/src/version.ts +61 -4
- package/vscode-html-custom-data.json +216 -5
|
@@ -190,28 +190,8 @@ export class ComboboxPortalManager {
|
|
|
190
190
|
}
|
|
191
191
|
if (!listbox || !listbox.isConnected)
|
|
192
192
|
return;
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
if (virtualized && virtualized.isConnected) {
|
|
196
|
-
const fewItems = this.component.filteredData?.length < 5;
|
|
197
|
-
if (fewItems) {
|
|
198
|
-
virtualized.style.overflowY = 'hidden';
|
|
199
|
-
virtualized.style.maxHeight = 'none';
|
|
200
|
-
listbox.style.overflowY = 'hidden';
|
|
201
|
-
listbox.style.maxHeight = 'fit-content';
|
|
202
|
-
}
|
|
203
|
-
else {
|
|
204
|
-
virtualized.style.overflowY = 'auto';
|
|
205
|
-
virtualized.style.maxHeight = '';
|
|
206
|
-
listbox.style.overflowY = 'auto';
|
|
207
|
-
listbox.style.maxHeight = '';
|
|
208
|
-
}
|
|
209
|
-
virtualized.scrollTop = 0;
|
|
210
|
-
}
|
|
211
|
-
const virtualizer = listbox.querySelector('lit-virtualizer');
|
|
212
|
-
if (virtualizer && virtualizer.isConnected) {
|
|
213
|
-
virtualizer.scrollTop = 0;
|
|
214
|
-
}
|
|
193
|
+
const scroller = listbox.querySelector('.combobox__options-scroll');
|
|
194
|
+
(scroller ?? listbox).scrollTop = 0;
|
|
215
195
|
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AAC,YAAY,EAAE,MAAM,GAAG,CAAC,CAAC;gBACzD,IAAI,QAAQ,EAAE,CAAC;oBACb,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;oBACvC,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;oBACrC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,QAAQ,CAAC;oBACnC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,aAAa,CAAC;gBAC1C,CAAC;qBAAM,CAAC;oBACN,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;oBACrC,WAAW,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;oBACjC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,MAAM,CAAC;oBACjC,OAAO,CAAC,KAAK,CAAC,SAAS,GAAG,EAAE,CAAC;gBAC/B,CAAC;gBACD,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC;YAC5B,CAAC;YAED,MAAM,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,iBAAiB,CAAgB,CAAC;YAC5E,IAAI,WAAW,IAAI,WAAW,CAAC,WAAW,EAAE,CAAC;gBAC3C,WAAW,CAAC,SAAS,GAAG,CAAC,CAAC;YAC5B,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;CACF","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n size,\n platform,\n type Placement,\n type MiddlewareData,\n type ComputePositionConfig,\n} from '@floating-ui/dom';\nimport { PortalUtils } from '../nile-select/portal-utils';\n\nexport class ComboboxPortalManager {\n private portalContainer: HTMLElement | null = null;\n private originalListboxParent: HTMLElement | null = null;\n private measuredPopupHeight: number | null = null;\n private component: any;\n private cleanupAutoUpdate: (() => void) | null = null;\n private currentPlacement: Placement = 'bottom';\n\n constructor(component: any) {\n this.component = component;\n }\n\n get portalContainerElement(): HTMLElement | null {\n return this.portalContainer;\n }\n\n private createPortalContainer(): HTMLElement {\n const container = document.createElement('div');\n container.style.position = 'absolute';\n container.style.zIndex = '9999';\n container.style.pointerEvents = 'none';\n container.className = 'nile-combobox-portal';\n return container;\n }\n\n private async computePosition(): Promise<void> {\n if (!this.portalContainer) return;\n\n const referenceElement = this.component.combobox || this.component;\n const floatingElement = this.portalContainer;\n\n try {\n const boundary = PortalUtils.findBoundaryElements(referenceElement);\n const initialPlacement = PortalUtils.getOptimalPlacement(referenceElement);\n\n const { x, y, placement } = await computePosition(\n referenceElement,\n floatingElement,\n {\n placement: initialPlacement,\n strategy: 'fixed',\n middleware: [\n offset(4),\n size({\n apply: ({ availableWidth, availableHeight, elements, rects }) => {\n const maxHeight = PortalUtils.calculateOptimalHeight(\n rects.reference,\n window.innerHeight,\n this.currentPlacement,\n );\n elements.floating.style.maxWidth = `${availableWidth}px`;\n elements.floating.style.maxHeight = `${maxHeight}px`;\n elements.floating.style.setProperty('--auto-size-available-width', `${availableWidth}px`);\n elements.floating.style.setProperty('--auto-size-available-height', `${maxHeight}px`);\n },\n padding: 10,\n boundary,\n }),\n flip({\n fallbackPlacements: ['bottom', 'top', 'bottom-start', 'top-start'],\n fallbackStrategy: 'bestFit',\n padding: 10,\n boundary,\n }),\n shift({ padding: 10, crossAxis: true, boundary }),\n ],\n platform,\n },\n );\n\n const referenceRect = referenceElement.getBoundingClientRect();\n Object.assign(floatingElement.style, {\n left: `${x}px`,\n top: `${y}px`,\n position: 'fixed',\n pointerEvents: 'auto',\n width: `${referenceRect.width}px`,\n });\n\n this.currentPlacement = placement;\n const placementClass = placement.split('-')[0];\n floatingElement.className = `nile-combobox-portal combobox__listbox--${placementClass}`;\n } catch {\n this.fallbackPositioning();\n }\n }\n\n private fallbackPositioning(): void {\n if (!this.portalContainer) return;\n\n const ref = this.component.combobox || this.component;\n const rect = ref.getBoundingClientRect();\n const vh = window.innerHeight;\n const spaceBelow = vh - rect.bottom;\n const spaceAbove = rect.top;\n\n let top: number;\n let maxH: number;\n let cls: string;\n\n if (spaceAbove > spaceBelow) {\n maxH = Math.max(spaceAbove - 20, 100);\n top = Math.max(rect.top - maxH - 4, 10);\n cls = 'top';\n } else {\n maxH = Math.max(spaceBelow - 20, 100);\n top = rect.bottom + 4;\n cls = 'bottom';\n }\n\n Object.assign(this.portalContainer.style, {\n left: `${rect.left}px`,\n top: `${top}px`,\n width: `${rect.width}px`,\n maxHeight: `${maxH}px`,\n pointerEvents: 'auto',\n });\n this.portalContainer.className = `nile-combobox-portal combobox__listbox--${cls}`;\n this.portalContainer.style.setProperty('--auto-size-available-height', `${maxH}px`);\n this.portalContainer.style.setProperty('--auto-size-available-width', `${rect.width}px`);\n }\n\n private extractStylesAsCSS(styles: any): string {\n if (typeof styles === 'string') return styles;\n if (Array.isArray(styles)) return styles.map(s => this.extractStylesAsCSS(s)).join('\\n');\n if (styles && typeof styles === 'object' && styles.cssText) return styles.cssText;\n return '';\n }\n\n private injectStyles(): void {\n if (!this.portalContainer) return;\n const styleId = `nile-combobox-styles-${Math.random().toString(36).substring(2, 11)}`;\n if (document.getElementById(styleId)) return;\n\n const componentStyles = (this.component.constructor as any).styles;\n if (!componentStyles) return;\n\n const el = document.createElement('style');\n el.id = styleId;\n el.textContent = this.extractStylesAsCSS(componentStyles);\n document.head.appendChild(el);\n (this.portalContainer as any).__injectedStyleId = styleId;\n }\n\n setupPortal(): void {\n if (!this.component.portal) return;\n\n this.component.updateComplete.then(() => {\n const listbox = this.component.shadowRoot?.querySelector('#listbox') as HTMLElement;\n if (!listbox) return;\n\n this.originalListboxParent = listbox.parentElement as HTMLElement;\n this.portalContainer = this.createPortalContainer();\n this.portalContainer.appendChild(listbox);\n document.body.appendChild(this.portalContainer);\n this.injectStyles();\n listbox.style.display = '';\n this.computePosition();\n\n this.cleanupAutoUpdate = autoUpdate(\n this.component,\n this.portalContainer,\n () => this.computePosition(),\n { ancestorScroll: true, ancestorResize: true, elementResize: true, layoutShift: true, animationFrame: true },\n );\n });\n }\n\n cleanupPortal(): void {\n if (this.cleanupAutoUpdate) {\n this.cleanupAutoUpdate();\n this.cleanupAutoUpdate = null;\n }\n\n if (this.portalContainer && this.portalContainer.parentNode) {\n const listbox = this.portalContainer.querySelector('#listbox') as HTMLElement;\n if (listbox && this.originalListboxParent) {\n this.originalListboxParent.appendChild(listbox);\n listbox.style.display = this.component.portal ? 'none' : '';\n }\n\n const sid = (this.portalContainer as any).__injectedStyleId;\n if (sid) document.getElementById(sid)?.remove();\n\n this.portalContainer.parentNode.removeChild(this.portalContainer);\n }\n\n this.portalContainer = null;\n this.originalListboxParent = null;\n this.measuredPopupHeight = null;\n this.currentPlacement = 'bottom';\n }\n\n updatePosition(): void {\n if (this.component.portal && this.portalContainer) {\n this.computePosition();\n }\n }\n\n resetMeasuredHeight(): void {\n this.measuredPopupHeight = null;\n }\n\n async resetScrollPosition(): Promise<void> {\n await this.component.updateComplete;\n\n requestAnimationFrame(() => {\n let listbox: HTMLElement | null = null;\n\n if (this.component.portal && this.portalContainer) {\n listbox = this.portalContainer.querySelector('#listbox') as HTMLElement;\n } else {\n listbox = this.component.shadowRoot?.querySelector('#listbox') as HTMLElement;\n }\n\n if (!listbox || !listbox.isConnected) return;\n listbox.scrollTop = 0;\n\n const virtualized = listbox.querySelector('.virtualized') as HTMLElement;\n if (virtualized && virtualized.isConnected) {\n const fewItems = this.component.filteredData?.length < 5;\n if (fewItems) {\n virtualized.style.overflowY = 'hidden';\n virtualized.style.maxHeight = 'none';\n listbox.style.overflowY = 'hidden';\n listbox.style.maxHeight = 'fit-content';\n } else {\n virtualized.style.overflowY = 'auto';\n virtualized.style.maxHeight = '';\n listbox.style.overflowY = 'auto';\n listbox.style.maxHeight = '';\n }\n virtualized.scrollTop = 0;\n }\n\n const virtualizer = listbox.querySelector('lit-virtualizer') as HTMLElement;\n if (virtualizer && virtualizer.isConnected) {\n virtualizer.scrollTop = 0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\n * LICENSE file in the root directory of this source tree.\n */\n\nimport {\n autoUpdate,\n computePosition,\n flip,\n offset,\n shift,\n size,\n platform,\n type Placement,\n type MiddlewareData,\n type ComputePositionConfig,\n} from '@floating-ui/dom';\nimport { PortalUtils } from '../nile-select/portal-utils';\n\nexport class ComboboxPortalManager {\n private portalContainer: HTMLElement | null = null;\n private originalListboxParent: HTMLElement | null = null;\n private measuredPopupHeight: number | null = null;\n private component: any;\n private cleanupAutoUpdate: (() => void) | null = null;\n private currentPlacement: Placement = 'bottom';\n\n constructor(component: any) {\n this.component = component;\n }\n\n get portalContainerElement(): HTMLElement | null {\n return this.portalContainer;\n }\n\n private createPortalContainer(): HTMLElement {\n const container = document.createElement('div');\n container.style.position = 'absolute';\n container.style.zIndex = '9999';\n container.style.pointerEvents = 'none';\n container.className = 'nile-combobox-portal';\n return container;\n }\n\n private async computePosition(): Promise<void> {\n if (!this.portalContainer) return;\n\n const referenceElement = this.component.combobox || this.component;\n const floatingElement = this.portalContainer;\n\n try {\n const boundary = PortalUtils.findBoundaryElements(referenceElement);\n const initialPlacement = PortalUtils.getOptimalPlacement(referenceElement);\n\n const { x, y, placement } = await computePosition(\n referenceElement,\n floatingElement,\n {\n placement: initialPlacement,\n strategy: 'fixed',\n middleware: [\n offset(4),\n size({\n apply: ({ availableWidth, availableHeight, elements, rects }) => {\n const maxHeight = PortalUtils.calculateOptimalHeight(\n rects.reference,\n window.innerHeight,\n this.currentPlacement,\n );\n elements.floating.style.maxWidth = `${availableWidth}px`;\n elements.floating.style.maxHeight = `${maxHeight}px`;\n elements.floating.style.setProperty('--auto-size-available-width', `${availableWidth}px`);\n elements.floating.style.setProperty('--auto-size-available-height', `${maxHeight}px`);\n },\n padding: 10,\n boundary,\n }),\n flip({\n fallbackPlacements: ['bottom', 'top', 'bottom-start', 'top-start'],\n fallbackStrategy: 'bestFit',\n padding: 10,\n boundary,\n }),\n shift({ padding: 10, crossAxis: true, boundary }),\n ],\n platform,\n },\n );\n\n const referenceRect = referenceElement.getBoundingClientRect();\n Object.assign(floatingElement.style, {\n left: `${x}px`,\n top: `${y}px`,\n position: 'fixed',\n pointerEvents: 'auto',\n width: `${referenceRect.width}px`,\n });\n\n this.currentPlacement = placement;\n const placementClass = placement.split('-')[0];\n floatingElement.className = `nile-combobox-portal combobox__listbox--${placementClass}`;\n } catch {\n this.fallbackPositioning();\n }\n }\n\n private fallbackPositioning(): void {\n if (!this.portalContainer) return;\n\n const ref = this.component.combobox || this.component;\n const rect = ref.getBoundingClientRect();\n const vh = window.innerHeight;\n const spaceBelow = vh - rect.bottom;\n const spaceAbove = rect.top;\n\n let top: number;\n let maxH: number;\n let cls: string;\n\n if (spaceAbove > spaceBelow) {\n maxH = Math.max(spaceAbove - 20, 100);\n top = Math.max(rect.top - maxH - 4, 10);\n cls = 'top';\n } else {\n maxH = Math.max(spaceBelow - 20, 100);\n top = rect.bottom + 4;\n cls = 'bottom';\n }\n\n Object.assign(this.portalContainer.style, {\n left: `${rect.left}px`,\n top: `${top}px`,\n width: `${rect.width}px`,\n maxHeight: `${maxH}px`,\n pointerEvents: 'auto',\n });\n this.portalContainer.className = `nile-combobox-portal combobox__listbox--${cls}`;\n this.portalContainer.style.setProperty('--auto-size-available-height', `${maxH}px`);\n this.portalContainer.style.setProperty('--auto-size-available-width', `${rect.width}px`);\n }\n\n private extractStylesAsCSS(styles: any): string {\n if (typeof styles === 'string') return styles;\n if (Array.isArray(styles)) return styles.map(s => this.extractStylesAsCSS(s)).join('\\n');\n if (styles && typeof styles === 'object' && styles.cssText) return styles.cssText;\n return '';\n }\n\n private injectStyles(): void {\n if (!this.portalContainer) return;\n const styleId = `nile-combobox-styles-${Math.random().toString(36).substring(2, 11)}`;\n if (document.getElementById(styleId)) return;\n\n const componentStyles = (this.component.constructor as any).styles;\n if (!componentStyles) return;\n\n const el = document.createElement('style');\n el.id = styleId;\n el.textContent = this.extractStylesAsCSS(componentStyles);\n document.head.appendChild(el);\n (this.portalContainer as any).__injectedStyleId = styleId;\n }\n\n setupPortal(): void {\n if (!this.component.portal) return;\n\n this.component.updateComplete.then(() => {\n const listbox = this.component.shadowRoot?.querySelector('#listbox') as HTMLElement;\n if (!listbox) return;\n\n this.originalListboxParent = listbox.parentElement as HTMLElement;\n this.portalContainer = this.createPortalContainer();\n this.portalContainer.appendChild(listbox);\n document.body.appendChild(this.portalContainer);\n this.injectStyles();\n listbox.style.display = '';\n this.computePosition();\n\n this.cleanupAutoUpdate = autoUpdate(\n this.component,\n this.portalContainer,\n () => this.computePosition(),\n { ancestorScroll: true, ancestorResize: true, elementResize: true, layoutShift: true, animationFrame: true },\n );\n });\n }\n\n cleanupPortal(): void {\n if (this.cleanupAutoUpdate) {\n this.cleanupAutoUpdate();\n this.cleanupAutoUpdate = null;\n }\n\n if (this.portalContainer && this.portalContainer.parentNode) {\n const listbox = this.portalContainer.querySelector('#listbox') as HTMLElement;\n if (listbox && this.originalListboxParent) {\n this.originalListboxParent.appendChild(listbox);\n listbox.style.display = this.component.portal ? 'none' : '';\n }\n\n const sid = (this.portalContainer as any).__injectedStyleId;\n if (sid) document.getElementById(sid)?.remove();\n\n this.portalContainer.parentNode.removeChild(this.portalContainer);\n }\n\n this.portalContainer = null;\n this.originalListboxParent = null;\n this.measuredPopupHeight = null;\n this.currentPlacement = 'bottom';\n }\n\n updatePosition(): void {\n if (this.component.portal && this.portalContainer) {\n this.computePosition();\n }\n }\n\n resetMeasuredHeight(): void {\n this.measuredPopupHeight = null;\n }\n\n async resetScrollPosition(): Promise<void> {\n await this.component.updateComplete;\n\n requestAnimationFrame(() => {\n let listbox: HTMLElement | null = null;\n\n if (this.component.portal && this.portalContainer) {\n listbox = this.portalContainer.querySelector('#listbox') as HTMLElement;\n } else {\n listbox = this.component.shadowRoot?.querySelector('#listbox') as HTMLElement;\n }\n\n if (!listbox || !listbox.isConnected) return;\n\n const scroller = listbox.querySelector(\n '.combobox__options-scroll',\n ) as HTMLElement | null;\n (scroller ?? listbox).scrollTop = 0;\n });\n }\n}\n"]}
|
|
@@ -10,12 +10,11 @@ import type { ComboboxRow, ComboboxHeaderRow } from './types';
|
|
|
10
10
|
export declare class ComboboxRenderer {
|
|
11
11
|
static renderGroupHeader(row: ComboboxHeaderRow): TemplateResult;
|
|
12
12
|
static renderRowsPlain(rows: ComboboxRow[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, showNoResults: boolean, noResultsMessage: string, isLoading: boolean, onScroll: (e: Event) => void, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean, noResultsSubtitle?: string): TemplateResult;
|
|
13
|
-
static renderRowsVirtualized(virtualItems: VirtualItem[], totalSize: number, rows: ComboboxRow[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean): TemplateResult;
|
|
14
|
-
static renderVirtualizedOptions(virtualItems: VirtualItem[], totalSize: number, data: any[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean,
|
|
13
|
+
static renderRowsVirtualized(virtualItems: VirtualItem[], totalSize: number, rows: ComboboxRow[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean, stickyOverlay?: TemplateResult, stickyIndex?: number): TemplateResult;
|
|
14
|
+
static renderVirtualizedOptions(virtualItems: VirtualItem[], totalSize: number, data: any[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean): TemplateResult;
|
|
15
15
|
static renderPlainOptions(data: any[], value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, showNoResults: boolean, noResultsMessage: string, isLoading: boolean, onScroll: (e: Event) => void, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean, noResultsSubtitle?: string): TemplateResult;
|
|
16
16
|
static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult;
|
|
17
17
|
static renderNoData(noDataMessage: string): TemplateResult;
|
|
18
|
-
private static renderMeasuredItem;
|
|
19
18
|
static renderItem(item: any, value: string | string[], multiple: boolean, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, enableDescription?: boolean): TemplateResult;
|
|
20
19
|
static renderVirtualizedGrid(virtualItems: VirtualItem[], totalSize: number, data: any[], value: string | string[], multiple: boolean, gridColumns: number, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string, gridColumnWidth?: number): TemplateResult;
|
|
21
20
|
static renderHorizontalGrid(virtualItems: VirtualItem[], totalSize: number, data: any[], value: string | string[], multiple: boolean, gridRows: number, gridColumnWidth: number, getDisplayText: (item: any) => string, getItemValue: (item: any) => string, isLoading: boolean, allowHtmlLabel: boolean, getItemDescription?: (item: any) => string, getItemPrefix?: (item: any) => string, getItemSuffix?: (item: any) => string): TemplateResult;
|
|
@@ -47,13 +47,14 @@ export class ComboboxRenderer {
|
|
|
47
47
|
</div>
|
|
48
48
|
`;
|
|
49
49
|
}
|
|
50
|
-
static renderRowsVirtualized(virtualItems, totalSize, rows, value, multiple, getDisplayText, getItemValue, isLoading, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription) {
|
|
50
|
+
static renderRowsVirtualized(virtualItems, totalSize, rows, value, multiple, getDisplayText, getItemValue, isLoading, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription, stickyOverlay, stickyIndex = -1) {
|
|
51
51
|
return html `
|
|
52
52
|
<div
|
|
53
53
|
part="select-options"
|
|
54
54
|
class="combobox__options ${isLoading ? 'loading' : ''}"
|
|
55
55
|
>
|
|
56
56
|
<div style="position:relative;height:${totalSize}px;width:100%;">
|
|
57
|
+
${stickyOverlay ?? ''}
|
|
57
58
|
${repeat(virtualItems, (vItem) => vItem.key, (vItem) => {
|
|
58
59
|
const row = rows[vItem.index];
|
|
59
60
|
if (!row)
|
|
@@ -62,8 +63,9 @@ export class ComboboxRenderer {
|
|
|
62
63
|
`transform:translateY(${vItem.start}px);` +
|
|
63
64
|
`height:${vItem.size}px;`;
|
|
64
65
|
if (row.kind === 'header') {
|
|
66
|
+
const headerStyle = vItem.index === stickyIndex ? `${posStyle}visibility:hidden;` : posStyle;
|
|
65
67
|
return html `
|
|
66
|
-
<div style=${
|
|
68
|
+
<div style=${headerStyle} class="combobox__group-header-slot">
|
|
67
69
|
${ComboboxRenderer.renderGroupHeader(row)}
|
|
68
70
|
</div>
|
|
69
71
|
`;
|
|
@@ -78,20 +80,24 @@ export class ComboboxRenderer {
|
|
|
78
80
|
</div>
|
|
79
81
|
`;
|
|
80
82
|
}
|
|
81
|
-
static renderVirtualizedOptions(virtualItems, totalSize, data, value, multiple, getDisplayText, getItemValue, isLoading, allowHtmlLabel,
|
|
82
|
-
const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;
|
|
83
|
+
static renderVirtualizedOptions(virtualItems, totalSize, data, value, multiple, getDisplayText, getItemValue, isLoading, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription) {
|
|
83
84
|
return html `
|
|
84
85
|
<div
|
|
85
86
|
part="select-options"
|
|
86
87
|
class="combobox__options ${isLoading ? 'loading' : ''}"
|
|
87
88
|
>
|
|
88
89
|
<div style="position:relative;height:${totalSize}px;width:100%;">
|
|
89
|
-
|
|
90
|
-
${repeat(virtualItems, (vItem) => vItem.key, (vItem) => {
|
|
90
|
+
${repeat(virtualItems, (vItem) => vItem.key, (vItem) => {
|
|
91
91
|
const item = data[vItem.index];
|
|
92
|
-
|
|
92
|
+
const posStyle = `position:absolute;top:0;left:0;right:0;` +
|
|
93
|
+
`transform:translateY(${vItem.start}px);` +
|
|
94
|
+
`height:${vItem.size}px;`;
|
|
95
|
+
return html `
|
|
96
|
+
<div style=${posStyle}>
|
|
97
|
+
${ComboboxRenderer.renderItem(item, value, multiple, getDisplayText, getItemValue, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription)}
|
|
98
|
+
</div>
|
|
99
|
+
`;
|
|
93
100
|
})}
|
|
94
|
-
</div>
|
|
95
101
|
</div>
|
|
96
102
|
</div>
|
|
97
103
|
`;
|
|
@@ -136,43 +142,6 @@ export class ComboboxRenderer {
|
|
|
136
142
|
</div>
|
|
137
143
|
`;
|
|
138
144
|
}
|
|
139
|
-
static renderMeasuredItem(item, index, value, multiple, getDisplayText, getItemValue, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription) {
|
|
140
|
-
if (!item)
|
|
141
|
-
return html ``;
|
|
142
|
-
const optionValue = getItemValue(item);
|
|
143
|
-
const displayText = getDisplayText(item);
|
|
144
|
-
const isDisabled = item?.disabled || false;
|
|
145
|
-
const className = item?.className;
|
|
146
|
-
const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');
|
|
147
|
-
const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');
|
|
148
|
-
const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');
|
|
149
|
-
let isSelected = false;
|
|
150
|
-
if (multiple) {
|
|
151
|
-
isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));
|
|
152
|
-
}
|
|
153
|
-
else {
|
|
154
|
-
isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);
|
|
155
|
-
}
|
|
156
|
-
return html `
|
|
157
|
-
<nile-option
|
|
158
|
-
data-index=${index}
|
|
159
|
-
value=${optionValue}
|
|
160
|
-
.selected=${isSelected}
|
|
161
|
-
.disabled=${isDisabled}
|
|
162
|
-
.showCheckbox=${multiple}
|
|
163
|
-
class=${classMap({
|
|
164
|
-
option: enableDescription ?? false,
|
|
165
|
-
[className ?? '']: !!className,
|
|
166
|
-
})}
|
|
167
|
-
.description=${description}
|
|
168
|
-
.isDescriptionEnabled=${enableDescription}
|
|
169
|
-
>
|
|
170
|
-
${unsafeHTML(prefix)}
|
|
171
|
-
${allowHtmlLabel ? unsafeHTML(displayText) : displayText}
|
|
172
|
-
${unsafeHTML(suffix)}
|
|
173
|
-
</nile-option>
|
|
174
|
-
`;
|
|
175
|
-
}
|
|
176
145
|
static renderItem(item, value, multiple, getDisplayText, getItemValue, allowHtmlLabel, getItemDescription, getItemPrefix, getItemSuffix, enableDescription) {
|
|
177
146
|
if (!item)
|
|
178
147
|
return html ``;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-combobox/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIlD,MAAM,OAAO,gBAAgB;IAE3B,MAAM,CAAC,iBAAiB,CAAC,GAAsB;QAC7C,OAAO,IAAI,CAAA;;;;;wBAKS,GAAG,CAAC,EAAE;gBACd,iBAAiB,GAAG,CAAC,KAAK,EAAE;;UAElC,GAAG,CAAC,MAAM;YACV,CAAC,CAAC,IAAI,CAAA;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AAC,CACF;;;;KAIR,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,qBAAqB,CAC1B,WAAmB,EACnB,QAAiB;QAEjB,OAAO,IAAI,CAAA;;gBAEC,WAAW;;wBAEH,QAAQ;;iBAEf,WAAW;;KAEvB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,IAAW,EAAE,WAAW,GAAG,CAAC;QACtD,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { VirtualItem } from '@tanstack/virtual-core';\nimport type { ComboboxRow, ComboboxHeaderRow } from './types';\n\nexport class ComboboxRenderer {\n\n static renderGroupHeader(row: ComboboxHeaderRow): TemplateResult {\n return html`\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=${row.id}\n style=${`--group-depth:${row.depth}`}\n >\n ${row.prefix\n ? html`<nile-icon\n class=\"combobox__group-prefix\"\n name=${row.prefix}\n size=\"14\"\n method=\"fill\"\n ></nile-icon>`\n : ''}\n <span class=\"combobox__group-label\">${row.label}</span>\n </div>\n `;\n }\n\n static renderRowsPlain(\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && rows.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${rows.map((row) =>\n row.kind === 'header'\n ? ComboboxRenderer.renderGroupHeader(row)\n : ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderRowsVirtualized(\n virtualItems: VirtualItem[],\n totalSize: number,\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const row = rows[vItem.index];\n if (!row) return html``;\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n if (row.kind === 'header') {\n return html`\n <div style=${posStyle} class=\"combobox__group-header-slot\">\n ${ComboboxRenderer.renderGroupHeader(row)}\n </div>\n `;\n }\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderVirtualizedOptions(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n measureElement: (el: Element | null) => void,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const item = data[vItem.index];\n return ComboboxRenderer.renderMeasuredItem(\n item, vItem.index, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n );\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderPlainOptions(\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && data.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${data.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ${noResultsMessage || 'No result found'}\n </div>\n ${noResultsSubtitle\n ? html`<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">${noResultsSubtitle}</div>`\n : ''}\n </div>\n </div>\n `;\n }\n\n static renderNoData(noDataMessage: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ${noDataMessage || 'No data available'}\n </div>\n </div>\n </div>\n `;\n }\n\n private static renderMeasuredItem(\n item: any,\n index: number,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n data-index=${index}\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderItem(\n item: any,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderVirtualizedGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridColumns: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n gridColumnWidth?: number,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const colTemplate = gridColumnWidth\n ? `repeat(${gridColumns}, ${gridColumnWidth}px)`\n : `repeat(${gridColumns}, 1fr)`;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const rowStart = vItem.index * gridColumns;\n const rowItems = data.slice(rowStart, rowStart + gridColumns);\n return html`\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:${colTemplate};gap:4px;\">\n ${rowItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderHorizontalGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridRows: number,\n gridColumnWidth: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n ): TemplateResult {\n const offsetLeft = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const rowHeight = 38;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;width:${totalSize}px;height:${rowHeight * gridRows}px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${offsetLeft}px);\">\n ${repeat(\n virtualItems,\n (vCol) => vCol.key,\n (vCol) => {\n const colStart = vCol.index * gridRows;\n const colItems = data.slice(colStart, colStart + gridRows);\n return html`\n <div class=\"combobox__grid-col\" style=\"width:${gridColumnWidth}px;flex-shrink:0;display:flex;flex-direction:column;\">\n ${colItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderAddCustomOption(\n searchValue: string,\n multiple: boolean,\n ): TemplateResult {\n return html`\n <nile-option\n value=${searchValue}\n class=\"combobox__add-option\"\n .showCheckbox=${multiple}\n >\n + Add \"${searchValue}\"\n </nile-option>\n `;\n }\n\n static shouldUseVirtualizer(data: any[], gridColumns = 1): boolean {\n if (gridColumns > 1) return true;\n return data.length >= 5;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"renderer.js","sourceRoot":"","sources":["../../../src/nile-combobox/renderer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAuB,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAIlD,MAAM,OAAO,gBAAgB;IAE3B,MAAM,CAAC,iBAAiB,CAAC,GAAsB;QAC7C,OAAO,IAAI,CAAA;;;;;wBAKS,GAAG,CAAC,EAAE;gBACd,iBAAiB,GAAG,CAAC,KAAK,EAAE;;UAElC,GAAG,CAAC,MAAM;YACV,CAAC,CAAC,IAAI,CAAA;;qBAEK,GAAG,CAAC,MAAM;;;0BAGL;YAChB,CAAC,CAAC,EAAE;8CACgC,GAAG,CAAC,KAAK;;KAElD,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,eAAe,CACpB,IAAmB,EACnB,KAAwB,EACxB,QAAiB,EACjB,cAAqC,EACrC,YAAmC,EACnC,aAAsB,EACtB,gBAAwB,EACxB,SAAkB,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GkD,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE;;8CAE7C,SAAS,aAAa,SAAS,GAAG,QAAQ;qGACa,UAAU;cACjG,MAAM,CACN,YAAY,EACZ,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,EAClB,CAAC,IAAI,EAAE,EAAE;YACP,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;YACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;YAC3D,OAAO,IAAI,CAAA;iEACsC,eAAe;sBAC1D,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAC3B,gBAAgB,CAAC,UAAU,CACzB,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,YAAY,EACnD,cAAc,EAAE,kBAAkB,EAAE,aAAa,EACjD,aAAa,CACd,CACF;;iBAEJ,CAAC;QACJ,CAAC,CACF;;;;KAIR,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,qBAAqB,CAC1B,WAAmB,EACnB,QAAiB;QAEjB,OAAO,IAAI,CAAA;;gBAEC,WAAW;;wBAEH,QAAQ;;iBAEf,WAAW;;KAEvB,CAAC;IACJ,CAAC;IAED,MAAM,CAAC,oBAAoB,CAAC,IAAW,EAAE,WAAW,GAAG,CAAC;QACtD,IAAI,WAAW,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QACjC,OAAO,IAAI,CAAC,MAAM,IAAI,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html, type TemplateResult } from 'lit';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport type { VirtualItem } from '@tanstack/virtual-core';\nimport type { ComboboxRow, ComboboxHeaderRow } from './types';\n\nexport class ComboboxRenderer {\n\n static renderGroupHeader(row: ComboboxHeaderRow): TemplateResult {\n return html`\n <div\n part=\"group-header\"\n class=\"combobox__group-header\"\n role=\"presentation\"\n data-group-id=${row.id}\n style=${`--group-depth:${row.depth}`}\n >\n ${row.prefix\n ? html`<nile-icon\n class=\"combobox__group-prefix\"\n name=${row.prefix}\n size=\"14\"\n method=\"fill\"\n ></nile-icon>`\n : ''}\n <span class=\"combobox__group-label\">${row.label}</span>\n </div>\n `;\n }\n\n static renderRowsPlain(\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && rows.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${rows.map((row) =>\n row.kind === 'header'\n ? ComboboxRenderer.renderGroupHeader(row)\n : ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderRowsVirtualized(\n virtualItems: VirtualItem[],\n totalSize: number,\n rows: ComboboxRow[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n stickyOverlay?: TemplateResult,\n stickyIndex = -1,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${stickyOverlay ?? ''}\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const row = rows[vItem.index];\n if (!row) return html``;\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n if (row.kind === 'header') {\n const headerStyle =\n vItem.index === stickyIndex ? `${posStyle}visibility:hidden;` : posStyle;\n return html`\n <div style=${headerStyle} class=\"combobox__group-header-slot\">\n ${ComboboxRenderer.renderGroupHeader(row)}\n </div>\n `;\n }\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n row.item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderVirtualizedOptions(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:100%;\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const item = data[vItem.index];\n const posStyle =\n `position:absolute;top:0;left:0;right:0;` +\n `transform:translateY(${vItem.start}px);` +\n `height:${vItem.size}px;`;\n return html`\n <div style=${posStyle}>\n ${ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n `;\n }\n\n static renderPlainOptions(\n data: any[],\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n showNoResults: boolean,\n noResultsMessage: string,\n isLoading: boolean,\n onScroll: (e: Event) => void,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n noResultsSubtitle?: string,\n ): TemplateResult {\n if (showNoResults && !isLoading && data.length === 0) {\n return ComboboxRenderer.renderNoResults(noResultsMessage, noResultsSubtitle);\n }\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div class=\"combobox__options-plain\" @scroll=${onScroll}>\n ${data.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix, enableDescription,\n ),\n )}\n </div>\n </div>\n `;\n }\n\n static renderNoResults(noResultsMessage: string, noResultsSubtitle?: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-results\" class=\"combobox__no-results\">\n <div part=\"no-results-title\" class=\"combobox__no-results-title\">\n ${noResultsMessage || 'No result found'}\n </div>\n ${noResultsSubtitle\n ? html`<div part=\"no-results-subtitle\" class=\"combobox__no-results-subtitle\">${noResultsSubtitle}</div>`\n : ''}\n </div>\n </div>\n `;\n }\n\n static renderNoData(noDataMessage: string): TemplateResult {\n return html`\n <div part=\"select-options\" class=\"combobox__options\">\n <div part=\"no-data\" class=\"combobox__no-results\">\n <div part=\"no-data-title\" class=\"combobox__no-results-title\">\n ${noDataMessage || 'No data available'}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderItem(\n item: any,\n value: string | string[],\n multiple: boolean,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n enableDescription?: boolean,\n ): TemplateResult {\n if (!item) return html``;\n\n const optionValue = getItemValue(item);\n const displayText = getDisplayText(item);\n const isDisabled = item?.disabled || false;\n const className = item?.className;\n const description = getItemDescription ? getItemDescription(item) : (item?.description ?? '');\n const prefix = getItemPrefix ? getItemPrefix(item) : (item?.prefix ?? '');\n const suffix = getItemSuffix ? getItemSuffix(item) : (item?.suffix ?? '');\n\n let isSelected = false;\n if (multiple) {\n isSelected = Array.isArray(value) && value.some(v => String(v) === String(optionValue));\n } else {\n isSelected = String(Array.isArray(value) ? value[0] : value) === String(optionValue);\n }\n\n return html`\n <nile-option\n value=${optionValue}\n .selected=${isSelected}\n .disabled=${isDisabled}\n .showCheckbox=${multiple}\n class=${classMap({\n option: enableDescription ?? false,\n [className ?? '']: !!className,\n })}\n .description=${description}\n .isDescriptionEnabled=${enableDescription}\n >\n ${unsafeHTML(prefix)}\n ${allowHtmlLabel ? unsafeHTML(displayText) : displayText}\n ${unsafeHTML(suffix)}\n </nile-option>\n `;\n }\n\n static renderVirtualizedGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridColumns: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n gridColumnWidth?: number,\n ): TemplateResult {\n const offsetTop = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const colTemplate = gridColumnWidth\n ? `repeat(${gridColumns}, ${gridColumnWidth}px)`\n : `repeat(${gridColumns}, 1fr)`;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;height:${totalSize}px;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;\">\n <div style=\"position:absolute;top:0;left:0;width:${gridColumnWidth ? 'max-content' : '100%'};min-width:100%;transform:translateY(${offsetTop}px);\">\n ${repeat(\n virtualItems,\n (vItem) => vItem.key,\n (vItem) => {\n const rowStart = vItem.index * gridColumns;\n const rowItems = data.slice(rowStart, rowStart + gridColumns);\n return html`\n <div class=\"combobox__grid-row\" style=\"display:grid;grid-template-columns:${colTemplate};gap:4px;\">\n ${rowItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderHorizontalGrid(\n virtualItems: VirtualItem[],\n totalSize: number,\n data: any[],\n value: string | string[],\n multiple: boolean,\n gridRows: number,\n gridColumnWidth: number,\n getDisplayText: (item: any) => string,\n getItemValue: (item: any) => string,\n isLoading: boolean,\n allowHtmlLabel: boolean,\n getItemDescription?: (item: any) => string,\n getItemPrefix?: (item: any) => string,\n getItemSuffix?: (item: any) => string,\n ): TemplateResult {\n const offsetLeft = virtualItems.length > 0 ? virtualItems[0].start : 0;\n const rowHeight = 38;\n\n return html`\n <div\n part=\"select-options\"\n class=\"combobox__options combobox__options--horizontal ${isLoading ? 'loading' : ''}\"\n >\n <div style=\"position:relative;width:${totalSize}px;height:${rowHeight * gridRows}px;\">\n <div style=\"position:absolute;top:0;left:0;height:100%;display:flex;transform:translateX(${offsetLeft}px);\">\n ${repeat(\n virtualItems,\n (vCol) => vCol.key,\n (vCol) => {\n const colStart = vCol.index * gridRows;\n const colItems = data.slice(colStart, colStart + gridRows);\n return html`\n <div class=\"combobox__grid-col\" style=\"width:${gridColumnWidth}px;flex-shrink:0;display:flex;flex-direction:column;\">\n ${colItems.map((item: any) =>\n ComboboxRenderer.renderItem(\n item, value, multiple, getDisplayText, getItemValue,\n allowHtmlLabel, getItemDescription, getItemPrefix,\n getItemSuffix,\n ),\n )}\n </div>\n `;\n },\n )}\n </div>\n </div>\n </div>\n `;\n }\n\n static renderAddCustomOption(\n searchValue: string,\n multiple: boolean,\n ): TemplateResult {\n return html`\n <nile-option\n value=${searchValue}\n class=\"combobox__add-option\"\n .showCheckbox=${multiple}\n >\n + Add \"${searchValue}\"\n </nile-option>\n `;\n }\n\n static shouldUseVirtualizer(data: any[], gridColumns = 1): boolean {\n if (gridColumns > 1) return true;\n return data.length >= 5;\n }\n}\n"]}
|
|
@@ -79,26 +79,24 @@ export const styles = css `
|
|
|
79
79
|
display: none;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
+
/* Offset arrow by 0.5px so its outline aligns with the panel border and its fill fully covers it. */
|
|
82
83
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow { bottom: 0; }
|
|
83
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow:after,
|
|
84
84
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow > svg {
|
|
85
|
-
top:
|
|
85
|
+
top: 15.5px;
|
|
86
86
|
transform: rotate(180deg);
|
|
87
87
|
}
|
|
88
88
|
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow { top: 0; }
|
|
89
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow > svg { bottom:
|
|
89
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow > svg { bottom: 15.5px; }
|
|
90
90
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow { right: 0; }
|
|
91
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow:after,
|
|
92
91
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow > svg {
|
|
93
92
|
transform: rotate(90deg);
|
|
94
|
-
top: calc(50% -
|
|
93
|
+
top: calc(50% - 3.5px);
|
|
95
94
|
left: 11px;
|
|
96
95
|
}
|
|
97
96
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow { left: 0; }
|
|
98
|
-
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow:after,
|
|
99
97
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow > svg {
|
|
100
98
|
transform: rotate(-90deg);
|
|
101
|
-
top: calc(50% -
|
|
99
|
+
top: calc(50% - 3.5px);
|
|
102
100
|
right: 11px;
|
|
103
101
|
}
|
|
104
102
|
|
|
@@ -111,6 +109,14 @@ export const styles = css `
|
|
|
111
109
|
|
|
112
110
|
.tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg {
|
|
113
111
|
position: absolute;
|
|
112
|
+
overflow: visible;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg > .nile-floating-panel__arrow-outline {
|
|
116
|
+
fill: none;
|
|
117
|
+
stroke: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
118
|
+
stroke-width: 1;
|
|
119
|
+
vector-effect: non-scaling-stroke;
|
|
114
120
|
}
|
|
115
121
|
|
|
116
122
|
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow {
|
|
@@ -121,6 +127,13 @@ export const styles = css `
|
|
|
121
127
|
border-width: 8px 8px 0;
|
|
122
128
|
border-top-color: initial;
|
|
123
129
|
}
|
|
130
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow:after {
|
|
131
|
+
bottom: -8px;
|
|
132
|
+
left: -1px;
|
|
133
|
+
border-width: 9px 9px 0;
|
|
134
|
+
border-top-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
135
|
+
clip-path: inset(2px 0 0 0);
|
|
136
|
+
}
|
|
124
137
|
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow {
|
|
125
138
|
top: 0;
|
|
126
139
|
}
|
|
@@ -129,6 +142,13 @@ export const styles = css `
|
|
|
129
142
|
border-width: 0 8px 8px;
|
|
130
143
|
border-bottom-color: initial;
|
|
131
144
|
}
|
|
145
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow:after {
|
|
146
|
+
top: -8px;
|
|
147
|
+
left: -1px;
|
|
148
|
+
border-width: 0 9px 9px;
|
|
149
|
+
border-bottom-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
150
|
+
clip-path: inset(0 0 2px 0);
|
|
151
|
+
}
|
|
132
152
|
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow {
|
|
133
153
|
right: 0;
|
|
134
154
|
}
|
|
@@ -137,6 +157,13 @@ export const styles = css `
|
|
|
137
157
|
border-width: 8px 0 8px 8px;
|
|
138
158
|
border-left-color: initial;
|
|
139
159
|
}
|
|
160
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow:after {
|
|
161
|
+
right: -8px;
|
|
162
|
+
top: -1px;
|
|
163
|
+
border-width: 9px 0 9px 9px;
|
|
164
|
+
border-left-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
165
|
+
clip-path: inset(0 0 0 2px);
|
|
166
|
+
}
|
|
140
167
|
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow {
|
|
141
168
|
left: 0;
|
|
142
169
|
}
|
|
@@ -145,18 +172,29 @@ export const styles = css `
|
|
|
145
172
|
border-width: 8px 8px 8px 0;
|
|
146
173
|
border-right-color: initial;
|
|
147
174
|
}
|
|
175
|
+
.tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow:after {
|
|
176
|
+
left: -8px;
|
|
177
|
+
top: -1px;
|
|
178
|
+
border-width: 9px 9px 9px 0;
|
|
179
|
+
border-right-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));
|
|
180
|
+
clip-path: inset(0 2px 0 0);
|
|
181
|
+
}
|
|
148
182
|
|
|
149
183
|
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow {
|
|
150
184
|
width: 16px;
|
|
151
185
|
height: 16px;
|
|
152
186
|
color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
|
|
153
187
|
}
|
|
154
|
-
|
|
188
|
+
/* :after is a 1px-larger triangle in the border colour, stacked behind :before, so the border continues around the arrow. */
|
|
189
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before,
|
|
190
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after {
|
|
155
191
|
content: '';
|
|
156
192
|
position: absolute;
|
|
157
193
|
border-color: transparent;
|
|
158
194
|
border-style: solid;
|
|
159
195
|
}
|
|
196
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before { z-index: 1; }
|
|
197
|
+
.tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after { z-index: 0; }
|
|
160
198
|
`;
|
|
161
199
|
export function injectGlobalFloatingPanelStyles() {
|
|
162
200
|
if (typeof document === 'undefined')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nile-floating-panel.css.js","sourceRoot":"","sources":["../../../src/nile-floating-panel/nile-floating-panel.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA
|
|
1
|
+
{"version":3,"file":"nile-floating-panel.css.js","sourceRoot":"","sources":["../../../src/nile-floating-panel/nile-floating-panel.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8LxB,CAAC;AAEF,MAAM,UAAU,+BAA+B;IAC7C,IAAI,OAAO,QAAQ,KAAK,WAAW;QAAE,OAAO;IAE5C,MAAM,QAAQ,GAAG,4BAA4B,CAAC;IAC9C,IAAI,QAAQ,CAAC,cAAc,CAAC,QAAQ,CAAC;QAAE,OAAO;IAE9C,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,GAAG,QAAQ,CAAC;IACpB,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC,OAAO,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,+BAA+B,EAAE,CAAC;AAElC,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2025\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\nexport const styles = css`\n nile-floating-panel {\n display: inline-block;\n }\n\n .tippy-box[data-theme~='floating-panel'] {\n background-color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n border: solid 1px var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n border-radius: var(--nile-radius-sm, var(--ng-radius-md));\n box-shadow: var(--nile-box-shadow-2, var(--ng-shadow-lg));\n padding: 0;\n font-size: var(--nile-type-scale-4, var(--ng-font-size-text-sm));\n line-height: 1.4;\n white-space: normal;\n outline: 0;\n transition-property: transform, visibility, opacity;\n }\n\n .tippy-box[data-theme~='floating-panel'][data-animation='fade'][data-state='hidden'] {\n opacity: 0;\n }\n\n .tippy-box[data-theme~='floating-panel'][data-inertia][data-state='visible'] {\n transition-timing-function: cubic-bezier(0.54, 1.5, 0.38, 1.11);\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-content {\n position: relative;\n z-index: 1;\n padding: 0;\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow {\n fill: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow {\n color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n }\n\n .nile-floating-panel__body {\n display: flex;\n flex-direction: column;\n height: auto;\n min-width: var(--nile-width-352px, var(--ng-width-80));\n gap: var(--nile-spacing-xl, var(--ng-spacing-xl));\n padding: var(--nile-spacing-xl, var(--ng-spacing-xl));\n }\n\n .nile-floating-panel__title {\n display: block;\n color: var(--nile-colors-dark-900, var(--ng-colors-text-primary-900));\n font-family: var(--nile-font-family-serif, var(--ng-font-family-body));\n font-size: var(--nile-type-scale-4, var(--ng-font-size-text-sm));\n font-style: normal;\n font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-semibold));\n line-height: var(--nile-line-height-xsmall, var(--ng-line-height-text-sm));\n letter-spacing: var(--nile-spacing-one-by-five-x, var(--ng-spacing-none));\n }\n\n .nile-floating-panel__title:empty {\n display: none;\n }\n\n .nile-floating-panel__action {\n align-self: end;\n display: inline;\n }\n\n .nile-floating-panel__action:empty {\n display: none;\n }\n\n /* Offset arrow by 0.5px so its outline aligns with the panel border and its fill fully covers it. */\n .tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow { bottom: 0; }\n .tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-svg-arrow > svg {\n top: 15.5px;\n transform: rotate(180deg);\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow { top: 0; }\n .tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-svg-arrow > svg { bottom: 15.5px; }\n .tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow { right: 0; }\n .tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-svg-arrow > svg {\n transform: rotate(90deg);\n top: calc(50% - 3.5px);\n left: 11px;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow { left: 0; }\n .tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-svg-arrow > svg {\n transform: rotate(-90deg);\n top: calc(50% - 3.5px);\n right: 11px;\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow {\n width: 16px;\n height: 16px;\n text-align: initial;\n position: absolute;\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg {\n position: absolute;\n overflow: visible;\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-svg-arrow > svg > .nile-floating-panel__arrow-outline {\n fill: none;\n stroke: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n stroke-width: 1;\n vector-effect: non-scaling-stroke;\n }\n\n .tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow {\n bottom: 0;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow:before {\n bottom: -7px;\n border-width: 8px 8px 0;\n border-top-color: initial;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='top'] > .tippy-arrow:after {\n bottom: -8px;\n left: -1px;\n border-width: 9px 9px 0;\n border-top-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n clip-path: inset(2px 0 0 0);\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow {\n top: 0;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow:before {\n top: -7px;\n border-width: 0 8px 8px;\n border-bottom-color: initial;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='bottom'] > .tippy-arrow:after {\n top: -8px;\n left: -1px;\n border-width: 0 9px 9px;\n border-bottom-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n clip-path: inset(0 0 2px 0);\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow {\n right: 0;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow:before {\n right: -7px;\n border-width: 8px 0 8px 8px;\n border-left-color: initial;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='left'] > .tippy-arrow:after {\n right: -8px;\n top: -1px;\n border-width: 9px 0 9px 9px;\n border-left-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n clip-path: inset(0 0 0 2px);\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow {\n left: 0;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow:before {\n left: -7px;\n border-width: 8px 8px 8px 0;\n border-right-color: initial;\n }\n .tippy-box[data-theme~='floating-panel'][data-placement^='right'] > .tippy-arrow:after {\n left: -8px;\n top: -1px;\n border-width: 9px 9px 9px 0;\n border-right-color: var(--nile-colors-dark-200, var(--ng-colors-border-secondary-alt));\n clip-path: inset(0 2px 0 0);\n }\n\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow {\n width: 16px;\n height: 16px;\n color: var(--nile-colors-white-base, var(--ng-colors-bg-primary));\n }\n /* :after is a 1px-larger triangle in the border colour, stacked behind :before, so the border continues around the arrow. */\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before,\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after {\n content: '';\n position: absolute;\n border-color: transparent;\n border-style: solid;\n }\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow:before { z-index: 1; }\n .tippy-box[data-theme~='floating-panel'] > .tippy-arrow:after { z-index: 0; }\n`;\n\nexport function injectGlobalFloatingPanelStyles(): void {\n if (typeof document === 'undefined') return;\n\n const STYLE_ID = 'nile-floating-panel-styles';\n if (document.getElementById(STYLE_ID)) return;\n\n const style = document.createElement('style');\n style.id = STYLE_ID;\n style.textContent = styles.cssText;\n document.head?.appendChild(style);\n}\n\ninjectGlobalFloatingPanelStyles();\n\nexport default [styles];\n"]}
|
|
@@ -12,6 +12,18 @@ import NileElement from '../internal/nile-element';
|
|
|
12
12
|
import tippy, { roundArrow, followCursor as followCursorPlugin, } from 'tippy.js';
|
|
13
13
|
import { parseFollowCursor, parseDuration, } from '../nile-lite-tooltip/utils';
|
|
14
14
|
import { VisibilityManager } from '../utilities/visibility-manager.js';
|
|
15
|
+
const TIPPY_ROUND_ARROW = /^<svg width="(\d+)" height="(\d+)"[^>]*><path d="(.+?)H0z"/.exec(roundArrow);
|
|
16
|
+
const NILE_ROUND_ARROW = (() => {
|
|
17
|
+
if (!TIPPY_ROUND_ARROW)
|
|
18
|
+
return roundArrow;
|
|
19
|
+
const [, rawWidth, rawHeight, curve] = TIPPY_ROUND_ARROW;
|
|
20
|
+
const width = Number(rawWidth);
|
|
21
|
+
const height = Number(rawHeight) + 1; // + the skirt that covers the border
|
|
22
|
+
return (`<svg width="${width}" height="${height}" viewBox="0 0 ${width} ${height}" aria-hidden="true" focusable="false" xmlns="http://www.w3.org/2000/svg">` +
|
|
23
|
+
`<path d="${curve}V${height}H0Z"></path>` +
|
|
24
|
+
`<path class="nile-floating-panel__arrow-outline" d="${curve}"></path>` +
|
|
25
|
+
`</svg>`);
|
|
26
|
+
})();
|
|
15
27
|
/**
|
|
16
28
|
* Nile floating-panel component.
|
|
17
29
|
*
|
|
@@ -363,7 +375,7 @@ let NileFloatingPanel = NileFloatingPanel_1 = class NileFloatingPanel extends Ni
|
|
|
363
375
|
// ─── Tippy management ───
|
|
364
376
|
_resolveArrow() {
|
|
365
377
|
switch (this.arrow) {
|
|
366
|
-
case 'round': return
|
|
378
|
+
case 'round': return NILE_ROUND_ARROW;
|
|
367
379
|
case 'none': return false;
|
|
368
380
|
default: return true;
|
|
369
381
|
}
|