@spectrum-web-components/overlay 0.40.2 → 0.40.3
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 +13 -1
- package/custom-elements.json +36 -5
- package/package.json +7 -7
- package/src/AbstractOverlay.d.ts +19 -1
- package/src/AbstractOverlay.dev.js +17 -0
- package/src/AbstractOverlay.dev.js.map +2 -2
- package/src/AbstractOverlay.js +1 -1
- package/src/AbstractOverlay.js.map +3 -3
- package/src/Overlay.dev.js +1 -2
- package/src/Overlay.dev.js.map +2 -2
- package/src/Overlay.js +1 -1
- package/src/Overlay.js.map +2 -2
- package/src/OverlayDialog.dev.js +14 -15
- package/src/OverlayDialog.dev.js.map +2 -2
- package/src/OverlayDialog.js +1 -1
- package/src/OverlayDialog.js.map +3 -3
- package/src/OverlayNoPopover.dev.js +9 -11
- package/src/OverlayNoPopover.dev.js.map +2 -2
- package/src/OverlayNoPopover.js +1 -1
- package/src/OverlayNoPopover.js.map +3 -3
- package/src/OverlayPopover.dev.js +14 -19
- package/src/OverlayPopover.dev.js.map +2 -2
- package/src/OverlayPopover.js +1 -1
- package/src/OverlayPopover.js.map +3 -3
- package/src/OverlayStack.d.ts +1 -0
- package/src/OverlayStack.dev.js +12 -4
- package/src/OverlayStack.dev.js.map +2 -2
- package/src/OverlayStack.js +1 -1
- package/src/OverlayStack.js.map +3 -3
- package/src/OverlayTrigger.dev.js +1 -1
- package/src/OverlayTrigger.dev.js.map +2 -2
- package/src/OverlayTrigger.js +1 -1
- package/src/OverlayTrigger.js.map +2 -2
- package/src/PlacementController.d.ts +1 -0
- package/src/PlacementController.dev.js +24 -12
- package/src/PlacementController.dev.js.map +2 -2
- package/src/PlacementController.js +1 -1
- package/src/PlacementController.js.map +3 -3
- package/src/overlay-trigger.css.dev.js.map +1 -1
- package/src/overlay-trigger.css.js.map +1 -1
- package/src/overlay-types.d.ts +0 -6
- package/src/overlay-types.dev.js.map +1 -1
- package/src/overlay-types.js.map +1 -1
- package/src/overlay.css.dev.js +1 -1
- package/src/overlay.css.dev.js.map +1 -1
- package/src/overlay.css.js +1 -1
- package/src/overlay.css.js.map +1 -1
- package/src/topLayerOverTransforms.dev.js +8 -1
- package/src/topLayerOverTransforms.dev.js.map +2 -2
- package/src/topLayerOverTransforms.js +1 -1
- package/src/topLayerOverTransforms.js.map +2 -2
- package/stories/overlay-element.stories.js +75 -22
- package/stories/overlay-element.stories.js.map +2 -2
- package/stories/overlay.stories.js +79 -3
- package/stories/overlay.stories.js.map +3 -3
- package/test/index.js +20 -12
- package/test/index.js.map +2 -2
- package/test/overlay-element.test.js +4 -2
- package/test/overlay-element.test.js.map +2 -2
- package/test/overlay-trigger-longpress.test.js +27 -9
- package/test/overlay-trigger-longpress.test.js.map +2 -2
- package/test/overlay-update.test.js +5 -5
- package/test/overlay-update.test.js.map +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["PlacementController.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type {\n ReactiveController,\n ReactiveElement,\n} from '@spectrum-web-components/base';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n Placement,\n shift,\n size,\n} from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { topLayerOverTransforms } from './topLayerOverTransforms.js';\nimport type { OpenableElement } from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\n\ntype OverlayOptionsV1 = {\n abortPromise?: Promise<boolean>;\n delayed?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement: Placement;\n notImmediatelyClosable?: boolean; // rename or place behind other API options\n receivesFocus?: 'auto';\n root?: HTMLElement;\n tipPadding?: number;\n trigger: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nfunction roundByDPR(num?: number): number {\n if (typeof num === 'undefined') return 0;\n const dpr = window.devicePixelRatio || 1;\n return Math.round(num * dpr) / dpr ?? -10000;\n}\n\n// See: https://spectrum.adobe.com/page/popover/#Container-padding\nconst REQUIRED_DISTANCE_TO_EDGE = 8;\n// See: https://github.com/adobe/spectrum-web-components/issues/910\nconst MIN_OVERLAY_HEIGHT = 100;\n\nconst getFallbackPlacements = (placement: Placement): Placement[] => {\n const fallbacks: Record<Placement, Placement[]> = {\n left: ['right', 'bottom', 'top'],\n 'left-start': ['right-start', 'bottom', 'top'],\n 'left-end': ['right-end', 'bottom', 'top'],\n right: ['left', 'bottom', 'top'],\n 'right-start': ['left-start', 'bottom', 'top'],\n 'right-end': ['left-end', 'bottom', 'top'],\n top: ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left', 'right'],\n 'top-end': ['bottom-end', 'left', 'right'],\n bottom: ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left', 'right'],\n 'bottom-end': ['top-end', 'left', 'right'],\n };\n return fallbacks[placement] ?? [placement];\n};\n\nexport const placementUpdatedSymbol = Symbol('placement updated');\n\nexport class PlacementController implements ReactiveController {\n private cleanup?: () => void;\n\n initialHeight?: number;\n\n isConstrained?: boolean;\n\n private host!: ReactiveElement & { elements: OpenableElement[] };\n\n private options!: OverlayOptionsV1;\n\n private originalPlacements = new WeakMap<HTMLElement, Placement>();\n\n private target!: HTMLElement;\n\n constructor(host: ReactiveElement & { elements: OpenableElement[] }) {\n this.host = host;\n // Add the controller after the MutationObserver has been created in preparation\n // for the `hostConnected`/`hostDisconnected` callbacks to be run.\n this.host.addController(this);\n }\n\n public async placeOverlay(\n target: HTMLElement = this.target,\n options: OverlayOptionsV1 = this.options\n ): Promise<void> {\n this.target = target;\n this.options = options;\n if (!target || !options) return;\n\n const cleanup = autoUpdate(\n options.trigger,\n target,\n this.updatePlacement,\n {\n elementResize: false,\n layoutShift: false,\n }\n );\n this.cleanup = () => {\n this.host.elements?.forEach((element) => {\n element.addEventListener(\n 'sp-closed',\n () => {\n const placement = this.originalPlacements.get(element);\n if (placement) {\n element.setAttribute('placement', placement);\n }\n this.originalPlacements.delete(element);\n },\n { once: true }\n );\n });\n cleanup();\n };\n }\n\n allowPlacementUpdate = false;\n\n updatePlacement = (): void => {\n if (\n !this.allowPlacementUpdate &&\n this.options.type !== 'modal' &&\n this.cleanup\n ) {\n this.target.dispatchEvent(new Event('close', { bubbles: true }));\n return;\n }\n this.computePlacement();\n this.allowPlacementUpdate = false;\n };\n\n async computePlacement(): Promise<void> {\n const { options, target } = this;\n\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n\n const flipMiddleware = !(options.trigger instanceof HTMLElement)\n ? flip({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n fallbackPlacements: getFallbackPlacements(options.placement),\n })\n : flip();\n\n const [mainAxis = 0, crossAxis = 0] = Array.isArray(options?.offset)\n ? options.offset\n : [options.offset, 0];\n\n const tipElement = this.host.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n const middleware = [\n offset({\n mainAxis,\n crossAxis,\n }),\n shift({ padding: REQUIRED_DISTANCE_TO_EDGE }),\n flipMiddleware,\n size({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n apply: ({\n availableWidth,\n availableHeight,\n rects: { floating },\n }) => {\n const maxHeight = Math.max(\n MIN_OVERLAY_HEIGHT,\n Math.floor(availableHeight)\n );\n const actualHeight = floating.height;\n this.initialHeight = !this.isConstrained // && !this.virtualTrigger\n ? actualHeight\n : this.initialHeight || actualHeight;\n this.isConstrained =\n actualHeight < this.initialHeight ||\n maxHeight <= actualHeight;\n const appliedHeight = this.isConstrained\n ? `${maxHeight}px`\n : '';\n Object.assign(target.style, {\n maxWidth: `${Math.floor(availableWidth)}px`,\n maxHeight: appliedHeight,\n height: appliedHeight,\n });\n },\n }),\n ...(tipElement\n ? [\n arrow({\n element: tipElement,\n padding:\n options.tipPadding || REQUIRED_DISTANCE_TO_EDGE,\n }),\n ]\n : []),\n topLayerOverTransforms(),\n ];\n const { x, y, placement, middlewareData } = await computePosition(\n options.trigger,\n target,\n {\n placement: options.placement,\n middleware,\n strategy: 'fixed',\n }\n );\n Object.assign(target.style, {\n top: '0px',\n left: '0px',\n translate: `${roundByDPR(x)}px ${roundByDPR(y)}px`,\n });\n\n target.setAttribute('actual-placement', placement);\n this.host.elements?.forEach((element) => {\n this.originalPlacements.set(\n element,\n element.getAttribute('placement') as Placement\n );\n element.setAttribute('placement', placement);\n });\n\n if (tipElement && middlewareData.arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(tipElement.style, {\n top:\n placement.startsWith('right') ||\n placement.startsWith('left')\n ? '0px'\n : '',\n left:\n placement.startsWith('bottom') ||\n placement.startsWith('top')\n ? '0px'\n : '',\n translate: `${roundByDPR(arrowX)}px ${roundByDPR(arrowY)}px`,\n });\n }\n }\n\n public resetOverlayPosition = (): void => {\n if (!this.target || !this.options) return;\n\n this.target.style.removeProperty('max-height');\n this.target.style.removeProperty('height');\n this.initialHeight = undefined;\n this.isConstrained = false;\n // force paint\n this.host.offsetHeight;\n this.computePlacement();\n };\n\n hostConnected(): void {\n document.addEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n\n hostUpdated(): void {\n if (!(this.host as Overlay).open) {\n this.cleanup?.();\n this.cleanup = undefined;\n }\n }\n\n hostDisconnected(): void {\n this.cleanup?.();\n this.cleanup = undefined;\n document.removeEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n}\n"],
|
|
5
|
-
"mappings": "aAgBA,OACI,SAAAA,EACA,cAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,UAAAC,EAEA,SAAAC,EACA,QAAAC,MACG,mBAEP,OAAS,0BAAAC,MAA8B,8BAiBvC,SAASC,EAAWC,EAAsB,CACtC,GAAI,OAAOA,GAAQ,YAAa,MAAO,GACvC,MAAMC,EAAM,OAAO,kBAAoB,EACvC,OAAO,KAAK,MAAMD,EAAMC,CAAG,EAAIA,CACnC,CAGA,MAAMC,EAA4B,EAE5BC,EAAqB,IAErBC,EAAyBC,GAAsC,CAvDrE,IAAAC,EAsEI,OAAOA,EAd2C,CAC9C,KAAM,CAAC,QAAS,SAAU,KAAK,EAC/B,aAAc,CAAC,cAAe,SAAU,KAAK,EAC7C,WAAY,CAAC,YAAa,SAAU,KAAK,EACzC,MAAO,CAAC,OAAQ,SAAU,KAAK,EAC/B,cAAe,CAAC,aAAc,SAAU,KAAK,EAC7C,YAAa,CAAC,WAAY,SAAU,KAAK,EACzC,IAAK,CAAC,SAAU,OAAQ,OAAO,EAC/B,YAAa,CAAC,eAAgB,OAAQ,OAAO,EAC7C,UAAW,CAAC,aAAc,OAAQ,OAAO,EACzC,OAAQ,CAAC,MAAO,OAAQ,OAAO,EAC/B,eAAgB,CAAC,YAAa,OAAQ,OAAO,EAC7C,aAAc,CAAC,UAAW,OAAQ,OAAO,CAC7C,EACiBD,CAAS,IAAnB,KAAAC,EAAwB,CAACD,CAAS,CAC7C,EAEO,aAAM,uBAAyB,OAAO,mBAAmB,EAEzD,aAAM,mBAAkD,CAe3D,YAAYE,EAAyD,CAJrE,KAAQ,mBAAqB,IAAI,
|
|
6
|
-
"names": ["arrow", "autoUpdate", "computePosition", "flip", "offset", "shift", "size", "topLayerOverTransforms", "roundByDPR", "num", "dpr", "REQUIRED_DISTANCE_TO_EDGE", "MIN_OVERLAY_HEIGHT", "getFallbackPlacements", "placement", "_a", "host", "target", "options", "
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type {\n ReactiveController,\n ReactiveElement,\n} from '@spectrum-web-components/base';\nimport {\n arrow,\n autoUpdate,\n computePosition,\n flip,\n offset,\n Placement,\n shift,\n size,\n} from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\nimport { topLayerOverTransforms } from './topLayerOverTransforms.js';\nimport type { OpenableElement } from './overlay-types.js';\nimport type { Overlay } from './Overlay.js';\n\ntype OverlayOptionsV1 = {\n abortPromise?: Promise<boolean>;\n delayed?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement: Placement;\n notImmediatelyClosable?: boolean; // rename or place behind other API options\n receivesFocus?: 'auto';\n root?: HTMLElement;\n tipPadding?: number;\n trigger: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nfunction roundByDPR(num?: number): number {\n if (typeof num === 'undefined') return 0;\n const dpr = window.devicePixelRatio || 1;\n return Math.round(num * dpr) / dpr ?? -10000;\n}\n\n// See: https://spectrum.adobe.com/page/popover/#Container-padding\nconst REQUIRED_DISTANCE_TO_EDGE = 8;\n// See: https://github.com/adobe/spectrum-web-components/issues/910\nconst MIN_OVERLAY_HEIGHT = 100;\n\nconst getFallbackPlacements = (placement: Placement): Placement[] => {\n const fallbacks: Record<Placement, Placement[]> = {\n left: ['right', 'bottom', 'top'],\n 'left-start': ['right-start', 'bottom', 'top'],\n 'left-end': ['right-end', 'bottom', 'top'],\n right: ['left', 'bottom', 'top'],\n 'right-start': ['left-start', 'bottom', 'top'],\n 'right-end': ['left-end', 'bottom', 'top'],\n top: ['bottom', 'left', 'right'],\n 'top-start': ['bottom-start', 'left', 'right'],\n 'top-end': ['bottom-end', 'left', 'right'],\n bottom: ['top', 'left', 'right'],\n 'bottom-start': ['top-start', 'left', 'right'],\n 'bottom-end': ['top-end', 'left', 'right'],\n };\n return fallbacks[placement] ?? [placement];\n};\n\nexport const placementUpdatedSymbol = Symbol('placement updated');\n\nexport class PlacementController implements ReactiveController {\n private cleanup?: () => void;\n\n initialHeight?: number;\n\n isConstrained?: boolean;\n\n private host!: ReactiveElement & { elements: OpenableElement[] };\n\n private options!: OverlayOptionsV1;\n\n private originalPlacements = new WeakMap<HTMLElement, Placement>();\n\n private target!: HTMLElement;\n\n constructor(host: ReactiveElement & { elements: OpenableElement[] }) {\n this.host = host;\n // Add the controller after the MutationObserver has been created in preparation\n // for the `hostConnected`/`hostDisconnected` callbacks to be run.\n this.host.addController(this);\n }\n\n public async placeOverlay(\n target: HTMLElement = this.target,\n options: OverlayOptionsV1 = this.options\n ): Promise<void> {\n this.target = target;\n this.options = options;\n if (!target || !options) return;\n\n const cleanupAncestorResize = autoUpdate(\n options.trigger,\n target,\n this.closeForAncestorUpdate,\n {\n ancestorResize: false,\n elementResize: false,\n layoutShift: false,\n }\n );\n const cleanupElementResize = autoUpdate(\n options.trigger,\n target,\n this.updatePlacement,\n {\n ancestorScroll: false,\n }\n );\n this.cleanup = () => {\n this.host.elements?.forEach((element) => {\n element.addEventListener(\n 'sp-closed',\n () => {\n const placement = this.originalPlacements.get(element);\n if (placement) {\n element.setAttribute('placement', placement);\n }\n this.originalPlacements.delete(element);\n },\n { once: true }\n );\n });\n cleanupAncestorResize();\n cleanupElementResize();\n };\n }\n\n allowPlacementUpdate = false;\n\n closeForAncestorUpdate = (): void => {\n if (\n !this.allowPlacementUpdate &&\n this.options.type !== 'modal' &&\n this.cleanup\n ) {\n this.target.dispatchEvent(new Event('close', { bubbles: true }));\n }\n this.allowPlacementUpdate = false;\n };\n\n updatePlacement = (): void => {\n this.computePlacement();\n };\n\n async computePlacement(): Promise<void> {\n const { options, target } = this;\n\n await (document.fonts ? document.fonts.ready : Promise.resolve());\n\n const flipMiddleware = !(options.trigger instanceof HTMLElement)\n ? flip({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n fallbackPlacements: getFallbackPlacements(options.placement),\n })\n : flip();\n\n const [mainAxis = 0, crossAxis = 0] = Array.isArray(options?.offset)\n ? options.offset\n : [options.offset, 0];\n\n const tipElement = this.host.elements.find(\n (el) => el.tipElement\n )?.tipElement;\n\n const middleware = [\n offset({\n mainAxis,\n crossAxis,\n }),\n shift({ padding: REQUIRED_DISTANCE_TO_EDGE }),\n flipMiddleware,\n size({\n padding: REQUIRED_DISTANCE_TO_EDGE,\n apply: ({\n availableWidth,\n availableHeight,\n rects: { floating },\n }) => {\n const maxHeight = Math.max(\n MIN_OVERLAY_HEIGHT,\n Math.floor(availableHeight)\n );\n const actualHeight = floating.height;\n this.initialHeight = !this.isConstrained // && !this.virtualTrigger\n ? actualHeight\n : this.initialHeight || actualHeight;\n this.isConstrained =\n actualHeight < this.initialHeight ||\n maxHeight <= actualHeight;\n const appliedHeight = this.isConstrained\n ? `${maxHeight}px`\n : '';\n Object.assign(target.style, {\n maxWidth: `${Math.floor(availableWidth)}px`,\n maxHeight: appliedHeight,\n });\n },\n }),\n ...(tipElement\n ? [\n arrow({\n element: tipElement,\n padding:\n options.tipPadding || REQUIRED_DISTANCE_TO_EDGE,\n }),\n ]\n : []),\n topLayerOverTransforms(),\n ];\n const { x, y, placement, middlewareData } = await computePosition(\n options.trigger,\n target,\n {\n placement: options.placement,\n middleware,\n strategy: 'fixed',\n }\n );\n Object.assign(target.style, {\n top: '0px',\n left: '0px',\n translate: `${roundByDPR(x)}px ${roundByDPR(y)}px`,\n });\n\n target.setAttribute('actual-placement', placement);\n this.host.elements?.forEach((element) => {\n if (!this.originalPlacements.has(element)) {\n this.originalPlacements.set(\n element,\n element.getAttribute('placement') as Placement\n );\n }\n element.setAttribute('placement', placement);\n });\n\n if (tipElement && middlewareData.arrow) {\n const { x: arrowX, y: arrowY } = middlewareData.arrow;\n\n Object.assign(tipElement.style, {\n top:\n placement.startsWith('right') ||\n placement.startsWith('left')\n ? '0px'\n : '',\n left:\n placement.startsWith('bottom') ||\n placement.startsWith('top')\n ? '0px'\n : '',\n translate: `${roundByDPR(arrowX)}px ${roundByDPR(arrowY)}px`,\n });\n }\n }\n\n public resetOverlayPosition = (): void => {\n if (!this.target || !this.options) return;\n\n this.target.style.removeProperty('max-height');\n this.target.style.removeProperty('height');\n this.initialHeight = undefined;\n this.isConstrained = false;\n // force paint\n this.host.offsetHeight;\n this.computePlacement();\n };\n\n hostConnected(): void {\n document.addEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n\n hostUpdated(): void {\n if (!(this.host as Overlay).open) {\n this.cleanup?.();\n this.cleanup = undefined;\n }\n }\n\n hostDisconnected(): void {\n this.cleanup?.();\n this.cleanup = undefined;\n document.removeEventListener(\n 'sp-update-overlays',\n this.resetOverlayPosition\n );\n }\n}\n"],
|
|
5
|
+
"mappings": "aAgBA,OACI,SAAAA,EACA,cAAAC,EACA,mBAAAC,EACA,QAAAC,EACA,UAAAC,EAEA,SAAAC,EACA,QAAAC,MACG,mBAEP,OAAS,0BAAAC,MAA8B,8BAiBvC,SAASC,EAAWC,EAAsB,CACtC,GAAI,OAAOA,GAAQ,YAAa,MAAO,GACvC,MAAMC,EAAM,OAAO,kBAAoB,EACvC,OAAO,KAAK,MAAMD,EAAMC,CAAG,EAAIA,CACnC,CAGA,MAAMC,EAA4B,EAE5BC,EAAqB,IAErBC,EAAyBC,GAAsC,CAvDrE,IAAAC,EAsEI,OAAOA,EAd2C,CAC9C,KAAM,CAAC,QAAS,SAAU,KAAK,EAC/B,aAAc,CAAC,cAAe,SAAU,KAAK,EAC7C,WAAY,CAAC,YAAa,SAAU,KAAK,EACzC,MAAO,CAAC,OAAQ,SAAU,KAAK,EAC/B,cAAe,CAAC,aAAc,SAAU,KAAK,EAC7C,YAAa,CAAC,WAAY,SAAU,KAAK,EACzC,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EA,aAAoB,CAhSxB,IAAAxB,EAiSc,KAAK,KAAiB,QACxBA,EAAA,KAAK,UAAL,MAAAA,EAAA,WACA,KAAK,QAAU,OAEvB,CAEA,kBAAyB,CAvS7B,IAAAA,GAwSQA,EAAA,KAAK,UAAL,MAAAA,EAAA,WACA,KAAK,QAAU,OACf,SAAS,oBACL,qBACA,KAAK,oBACT,CACJ,CACJ",
|
|
6
|
+
"names": ["arrow", "autoUpdate", "computePosition", "flip", "offset", "shift", "size", "topLayerOverTransforms", "roundByDPR", "num", "dpr", "REQUIRED_DISTANCE_TO_EDGE", "MIN_OVERLAY_HEIGHT", "getFallbackPlacements", "placement", "_a", "host", "target", "options", "cleanupAncestorResize", "cleanupElementResize", "element", "_b", "flipMiddleware", "mainAxis", "crossAxis", "tipElement", "el", "middleware", "availableWidth", "availableHeight", "floating", "maxHeight", "actualHeight", "appliedHeight", "x", "y", "middlewareData", "arrowX", "arrowY"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-trigger.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-trigger.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host([disabled]) ::slotted([slot=trigger]){pointer-events:none}slot[name=longpress-describedby-descriptor]{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
package/src/overlay-types.d.ts
CHANGED
|
@@ -35,12 +35,6 @@ export declare type OverlayOptionsV1 = {
|
|
|
35
35
|
abortPromise?: Promise<boolean>;
|
|
36
36
|
virtualTrigger?: VirtualTrigger;
|
|
37
37
|
};
|
|
38
|
-
declare global {
|
|
39
|
-
interface GlobalEventHandlersEventMap {
|
|
40
|
-
'sp-open': CustomEvent<OverlayOpenCloseDetail>;
|
|
41
|
-
'sp-close': CustomEvent<OverlayOpenCloseDetail>;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
38
|
export declare type OpenableElement = HTMLElement & {
|
|
45
39
|
open: boolean;
|
|
46
40
|
tipElement?: HTMLElement;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-types.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport type Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport type Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nexport type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';\n"],
|
|
5
5
|
"mappings": ";AAqBA;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/overlay-types.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay-types.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\n\nexport type Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport type { Placement } from '@floating-ui/dom';\nimport type { VirtualTrigger } from './VirtualTrigger.js';\n\nexport type Constructor<T = Record<string, unknown>> = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n new (...args: any[]): T;\n prototype: T;\n};\n\nexport { Placement };\n\nexport type OverlayTypes = 'auto' | 'hint' | 'manual' | 'modal' | 'page';\n\nexport type TriggerInteractions = OverlayTypes;\n\nexport type TriggerInteractionsV1 =\n | 'click'\n | 'longpress'\n | 'hover'\n | 'custom'\n | 'replace'\n | 'inline'\n | 'modal';\n\nexport type OverlayTriggerInteractions = Extract<\n TriggerInteractions,\n 'inline' | 'modal' | 'replace'\n>;\n\nexport interface OverlayOpenCloseDetail {\n interaction: TriggerInteractions;\n reason?: 'external-click';\n}\n\nexport interface OverlayCloseReasonDetail {\n reason?: 'external-click';\n}\n\nexport type OverlayOptions = {\n delayed?: boolean;\n notImmediatelyClosable?: boolean;\n offset?: number | [number, number]; // supporting multi-axis\n placement?: Placement;\n receivesFocus?: 'auto' | 'true' | 'false';\n trigger?: HTMLElement | VirtualTrigger;\n type?: 'modal' | 'page' | 'hint' | 'auto' | 'manual';\n};\n\nexport type OverlayOptionsV1 = {\n root?: HTMLElement;\n delayed?: boolean;\n placement?: Placement;\n offset?: number;\n receivesFocus?: 'true' | 'false' | 'auto';\n notImmediatelyClosable?: boolean;\n abortPromise?: Promise<boolean>;\n virtualTrigger?: VirtualTrigger;\n};\n\nexport type OpenableElement = HTMLElement & {\n open: boolean;\n tipElement?: HTMLElement;\n updateComplete?: Promise<void>;\n};\n\nexport type OverlayState = 'closed' | 'opening' | 'opened' | 'closing';\n"],
|
|
5
5
|
"mappings": "aAqBA",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/overlay.css.dev.js
CHANGED
|
@@ -3,7 +3,7 @@ import { css } from "@spectrum-web-components/base";
|
|
|
3
3
|
const styles = css`
|
|
4
4
|
:host{--swc-overlay-animation-distance:var(
|
|
5
5
|
--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)
|
|
6
|
-
);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){
|
|
6
|
+
);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
|
|
7
7
|
`;
|
|
8
8
|
export default styles;
|
|
9
9
|
//# sourceMappingURL=overlay.css.dev.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAAA;AAAA;AAKf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/overlay.css.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";import{css as a}from"@spectrum-web-components/base";const o=a`
|
|
2
2
|
:host{--swc-overlay-animation-distance:var(
|
|
3
3
|
--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)
|
|
4
|
-
);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){
|
|
4
|
+
);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:"";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}
|
|
5
5
|
`;export default o;
|
|
6
6
|
//# sourceMappingURL=overlay.css.js.map
|
package/src/overlay.css.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["overlay.css.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2024 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n:host{--swc-overlay-animation-distance:var(\n--spectrum-picker-m-texticon-popover-offset-y,var(--spectrum-global-dimension-size-75)\n);display:contents;pointer-events:none}.dialog{--sp-overlay-open:true;background:none;border:0;box-sizing:border-box;display:flex;height:auto;inset:auto;left:0;margin:0;max-height:calc(100vh - 16px);max-height:calc(100dvh - 16px);max-width:calc(100vw - 16px);opacity:1!important;overflow:visible;padding:0;position:fixed;top:0}.dialog:not([is-visible]){display:none}.dialog:focus{outline:none}dialog:modal{--mod-popover-filter:var(--spectrum-popover-filter)}:host(:not([open])) .dialog{--sp-overlay-open:false}.dialog::backdrop{display:none}.dialog:before{content:\"\";inset:-999em;pointer-events:auto!important;position:absolute}.dialog:not(.not-immediately-closable):before{display:none}.dialog>div{width:100%}::slotted(*){pointer-events:auto;visibility:visible!important}::slotted(sp-popover){position:static}.dialog:not([actual-placement])[placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog:not([actual-placement])[placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=top]{margin-top:var(--swc-overlay-animation-distance);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=right]{margin-left:calc(var(--swc-overlay-animation-distance)*-1);padding-inline:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=bottom]{margin-top:calc(var(--swc-overlay-animation-distance)*-1);padding-block:var(--swc-overlay-animation-distance)}.dialog[actual-placement*=left]{margin-left:var(--swc-overlay-animation-distance);padding-inline:var(--swc-overlay-animation-distance)}slot[name=longpress-describedby-descriptor]{display:none}@supports selector(:open){.dialog{opacity:0}.dialog:open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports selector(:popover-open){.dialog{opacity:0}.dialog:popover-open{--mod-popover-filter:var(--spectrum-popover-filter);opacity:1}}@supports (not selector(:open)) and (not selector(:popover-open)){:host:not([open]) .dialog{pointer-events:none}.dialog[actual-placement]{z-index:calc(var(--swc-overlay-z-index-base, 1000) + var(--swc-overlay-open-count))}}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA;AAAA;AAAA,EAKf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -62,7 +62,14 @@ export const topLayerOverTransforms = () => ({
|
|
|
62
62
|
css = getComputedStyle(containingBlock);
|
|
63
63
|
overTransforms = // the `transform` property
|
|
64
64
|
css.transform !== "none" || // the `translate` property
|
|
65
|
-
css.translate !== "none" || // the `
|
|
65
|
+
css.translate !== "none" || // the `containerType` property
|
|
66
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
67
|
+
// @ts-ignore
|
|
68
|
+
(css.containerType ? (
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
70
|
+
// @ts-ignore
|
|
71
|
+
css.containerType !== "normal"
|
|
72
|
+
) : false) || // the `backdropFilter` property
|
|
66
73
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
67
74
|
// @ts-ignore
|
|
68
75
|
(css.backdropFilter ? (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["topLayerOverTransforms.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCo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is file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.dev.js'\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `containerType` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.containerType\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.containerType !== 'normal'\n : false) ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCoords,\n };\n }\n\n return {\n x: x - diffCoords.x,\n y: y - diffCoords.y,\n data: diffCoords,\n };\n },\n});\n"],
|
|
5
|
+
"mappings": ";AAYA;AAAA,EACI;AAAA,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,isContainingBlock as x}from"@floating-ui/utils/dom";import{VirtualTrigger as k}from"./VirtualTrigger.js";export const topLayerOverTransforms=()=>({name:"topLayer",async fn(g){const{x:
|
|
1
|
+
"use strict";import{getContainingBlock as h,getWindow as w,isContainingBlock as x}from"@floating-ui/utils/dom";import{VirtualTrigger as k}from"./VirtualTrigger.js";export const topLayerOverTransforms=()=>({name:"topLayer",async fn(g){const{x:l,y:s,elements:{reference:c,floating:o}}=g;let t=!1,f=!1,d=!1;const a={x:0,y:0};try{t=t||o.matches(":popover-open")}catch(r){}try{t=t||o.matches(":open")}catch(r){}try{t=t||o.matches(":modal")}catch(r){}f=t;const p=new Event("floating-ui-dialog-test",{composed:!0,bubbles:!0});o.addEventListener("floating-ui-dialog-test",r=>{r.composedPath().forEach(n=>{if(d=d||n===c,!(n===o||n.localName!=="dialog"))try{t=t||n.matches(":modal")}catch(e){}})},{once:!0}),o.dispatchEvent(p);let m=!1;if(!(c instanceof k)){const r=d?c:o,n=x(r)?r:h(r);let e={};if(n!==null&&w(n)!==n&&(e=getComputedStyle(n),m=e.transform!=="none"||e.translate!=="none"||(e.containerType?e.containerType!=="normal":!1)||(e.backdropFilter?e.backdropFilter!=="none":!1)||(e.filter?e.filter!=="none":!1)||e.willChange.search("transform")>-1||e.willChange.search("translate")>-1||["paint","layout","strict","content"].some(i=>(e.contain||"").includes(i))),t&&m&&n){const i=n.getBoundingClientRect(),{marginInlineStart:y="0",marginBlockStart:u="0"}=e;a.x=i.x+parseFloat(y),a.y=i.y+parseFloat(u)}}return t&&f?{x:l+a.x,y:s+a.y,data:a}:t?{x:l,y:s,data:a}:{x:l-a.x,y:s-a.y,data:a}}});
|
|
2
2
|
//# sourceMappingURL=topLayerOverTransforms.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["topLayerOverTransforms.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.js';\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCoords,\n };\n }\n\n return {\n x: x - diffCoords.x,\n y: y - diffCoords.y,\n data: diffCoords,\n };\n },\n});\n"],
|
|
5
|
-
"mappings": "aAYA,OACI,sBAAAA,EACA,aAAAC,EACA,qBAAAC,MACG,yBACP,OAAS,kBAAAC,MAAsB,sBAExB,aAAM,uBAAyB,KAAmB,CACrD,KAAM,WACN,MAAM,GAAGC,EAAsC,CAC3C,KAAM,CACF,EAAAC,EACA,EAAAC,EACA,SAAU,CAAE,UAAAC,EAAW,SAAAC,CAAS,CACpC,EAAIJ,EACJ,IAAIK,EAAa,GACbC,EAAqB,GACrBC,EAAkB,GACtB,MAAMC,EAAa,CACf,EAAG,EACH,EAAG,CACP,EACA,GAAI,CACAH,EAAaA,GAAcD,EAAS,QAAQ,eAAe,CAE/D,OAASK,EAAO,CAAC,CACjB,GAAI,CACAJ,EAAaA,GAAcD,EAAS,QAAQ,OAAO,CAEvD,OAASK,EAAO,CAAC,CACjB,GAAI,CACAJ,EAAaA,GAAcD,EAAS,QAAQ,QAAQ,CAGxD,OAASK,EAAO,CAAC,CACjBH,EAAqBD,EACrB,MAAMK,EAA2B,IAAI,MAAM,0BAA2B,CAClE,SAAU,GACV,QAAS,EACb,CAAC,EACDN,EAAS,iBACL,0BACCO,GAAiB,CACbA,EAAM,aAAa,EAA2B,QAASC,GAAO,CAE3D,GADAL,EAAkBA,GAAmBK,IAAOT,EACxC,EAAAS,IAAOR,GAAYQ,EAAG,YAAc,UACxC,GAAI,CACAP,EAAaA,GAAcO,EAAG,QAAQ,QAAQ,CAGlD,OAASH,EAAO,CAAC,CACrB,CAAC,CACL,EACA,CAAE,KAAM,EAAK,CACjB,EACAL,EAAS,cAAcM,CAAwB,EAC/C,IAAIG,EAAiB,GACrB,GAAI,EAAEV,aAAqBJ,GAAiB,CACxC,MAAMe,EAAQP,EAAkBJ,EAAYC,EACtCW,EAAkBjB,EAAkBgB,CAAI,EACxCA,EACAlB,EAAmBkB,CAAI,EAC7B,IAAIE,EAAoD,CAAC,
|
|
4
|
+
"sourcesContent": ["/*\nCopyright 2022 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\nimport type { Middleware, MiddlewareState } from '@floating-ui/dom';\nimport {\n getContainingBlock,\n getWindow,\n isContainingBlock,\n} from '@floating-ui/utils/dom';\nimport { VirtualTrigger } from './VirtualTrigger.js';\n\nexport const topLayerOverTransforms = (): Middleware => ({\n name: 'topLayer',\n async fn(middlewareArguments: MiddlewareState) {\n const {\n x,\n y,\n elements: { reference, floating },\n } = middlewareArguments;\n let onTopLayer = false;\n let topLayerIsFloating = false;\n let withinReference = false;\n const diffCoords = {\n x: 0,\n y: 0,\n };\n try {\n onTopLayer = onTopLayer || floating.matches(':popover-open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':open');\n // eslint-disable-next-line no-empty\n } catch (error) {}\n try {\n onTopLayer = onTopLayer || floating.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next 3 */\n } catch (error) {}\n topLayerIsFloating = onTopLayer;\n const dialogAncestorQueryEvent = new Event('floating-ui-dialog-test', {\n composed: true,\n bubbles: true,\n });\n floating.addEventListener(\n 'floating-ui-dialog-test',\n (event: Event) => {\n (event.composedPath() as unknown as Element[]).forEach((el) => {\n withinReference = withinReference || el === reference;\n if (el === floating || el.localName !== 'dialog') return;\n try {\n onTopLayer = onTopLayer || el.matches(':modal');\n // eslint-disable-next-line no-empty\n /* c8 ignore next */\n } catch (error) {}\n });\n },\n { once: true }\n );\n floating.dispatchEvent(dialogAncestorQueryEvent);\n let overTransforms = false;\n if (!(reference instanceof VirtualTrigger)) {\n const root = (withinReference ? reference : floating) as Element;\n const containingBlock = isContainingBlock(root)\n ? root\n : getContainingBlock(root);\n let css: CSSStyleDeclaration | Record<string, string> = {};\n if (\n containingBlock !== null &&\n getWindow(containingBlock) !==\n (containingBlock as unknown as Window)\n ) {\n css = getComputedStyle(containingBlock);\n // The overlay is \"over transforms\" when the containing block uses specific CSS...\n overTransforms =\n // the `transform` property\n css.transform !== 'none' ||\n // the `translate` property\n css.translate !== 'none' ||\n // the `containerType` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.containerType\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.containerType !== 'normal'\n : false) ||\n // the `backdropFilter` property\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n (css.backdropFilter\n ? // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore\n css.backdropFilter !== 'none'\n : false) ||\n // the `filter` property for anything other than \"none\"\n (css.filter ? css.filter !== 'none' : false) ||\n // the `transform` property \"will-change\"\n css.willChange.search('transform') > -1 ||\n // the `transform` property \"will-change\"\n css.willChange.search('translate') > -1 ||\n // a value of \"paint\", \"layout\", \"strict\", or \"content\" for `contain`\n ['paint', 'layout', 'strict', 'content'].some((value) =>\n (css.contain || '').includes(value)\n );\n }\n\n if (onTopLayer && overTransforms && containingBlock) {\n const rect = containingBlock.getBoundingClientRect();\n // Margins are not included in the bounding client rect and need to be handled separately.\n const { marginInlineStart = '0', marginBlockStart = '0' } = css;\n diffCoords.x = rect.x + parseFloat(marginInlineStart);\n diffCoords.y = rect.y + parseFloat(marginBlockStart);\n }\n }\n\n if (onTopLayer && topLayerIsFloating) {\n return {\n x: x + diffCoords.x,\n y: y + diffCoords.y,\n data: diffCoords,\n };\n }\n\n if (onTopLayer) {\n return {\n x,\n y,\n data: diffCoords,\n };\n }\n\n return {\n x: x - diffCoords.x,\n y: y - diffCoords.y,\n data: diffCoords,\n };\n },\n});\n"],
|
|
5
|
+
"mappings": "aAYA,OACI,sBAAAA,EACA,aAAAC,EACA,qBAAAC,MACG,yBACP,OAAS,kBAAAC,MAAsB,sBAExB,aAAM,uBAAyB,KAAmB,CACrD,KAAM,WACN,MAAM,GAAGC,EAAsC,CAC3C,KAAM,CACF,EAAAC,EACA,EAAAC,EACA,SAAU,CAAE,UAAAC,EAAW,SAAAC,CAAS,CACpC,EAAIJ,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,QAAS,SAAU,SAAU,SAAS,EAAE,KAAMC,IAC1CD,EAAI,SAAW,IAAI,SAASC,CAAK,CACtC,GAGJZ,GAAcQ,GAAkBE,EAAiB,CACjD,MAAMG,EAAOH,EAAgB,sBAAsB,EAE7C,CAAE,kBAAAI,EAAoB,IAAK,iBAAAC,EAAmB,GAAI,EAAIJ,EAC5DR,EAAW,EAAIU,EAAK,EAAI,WAAWC,CAAiB,EACpDX,EAAW,EAAIU,EAAK,EAAI,WAAWE,CAAgB,CACvD,CACJ,CAEA,OAAIf,GAAcC,EACP,CACH,EAAGL,EAAIO,EAAW,EAClB,EAAGN,EAAIM,EAAW,EAClB,KAAMA,CACV,EAGAH,EACO,CACH,EAAAJ,EACA,EAAAC,EACA,KAAMM,CACV,EAGG,CACH,EAAGP,EAAIO,EAAW,EAClB,EAAGN,EAAIM,EAAW,EAClB,KAAMA,CACV,CACJ,CACJ",
|
|
6
6
|
"names": ["getContainingBlock", "getWindow", "isContainingBlock", "VirtualTrigger", "middlewareArguments", "x", "y", "reference", "floating", "onTopLayer", "topLayerIsFloating", "withinReference", "diffCoords", "error", "dialogAncestorQueryEvent", "event", "el", "overTransforms", "root", "containingBlock", "css", "value", "rect", "marginInlineStart", "marginBlockStart"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
import { html } from "@spectrum-web-components/base";
|
|
3
3
|
import { ifDefined } from "@spectrum-web-components/base/src/directives.js";
|
|
4
|
+
import "@spectrum-web-components/dialog/sp-dialog.js";
|
|
4
5
|
import "@spectrum-web-components/overlay/sp-overlay.js";
|
|
5
6
|
import "@spectrum-web-components/action-button/sp-action-button.js";
|
|
6
7
|
import "@spectrum-web-components/action-menu/sp-action-menu.js";
|
|
@@ -9,6 +10,7 @@ import "@spectrum-web-components/popover/sp-popover.js";
|
|
|
9
10
|
import "@spectrum-web-components/menu/sp-menu-group.js";
|
|
10
11
|
import "@spectrum-web-components/menu/sp-menu-item.js";
|
|
11
12
|
import "@spectrum-web-components/menu/sp-menu-divider.js";
|
|
13
|
+
import "@spectrum-web-components/link/sp-link.js";
|
|
12
14
|
import "@spectrum-web-components/tooltip/sp-tooltip.js";
|
|
13
15
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-anchor-select.js";
|
|
14
16
|
import "@spectrum-web-components/icons-workflow/icons/sp-icon-polygon-select.js";
|
|
@@ -54,13 +56,22 @@ const Template = ({
|
|
|
54
56
|
open,
|
|
55
57
|
placement,
|
|
56
58
|
type,
|
|
57
|
-
delayed
|
|
59
|
+
delayed,
|
|
60
|
+
style
|
|
58
61
|
}) => html`
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
62
|
+
${style === "will-change" ? html`
|
|
63
|
+
<style>
|
|
64
|
+
.wrapper {
|
|
65
|
+
will-change: transform;
|
|
66
|
+
}
|
|
67
|
+
</style>
|
|
68
|
+
` : html`
|
|
69
|
+
<style>
|
|
70
|
+
.wrapper {
|
|
71
|
+
container-type: size;
|
|
72
|
+
}
|
|
73
|
+
</style>
|
|
74
|
+
`}
|
|
64
75
|
<div class="wrapper">
|
|
65
76
|
<sp-action-button id="trigger">Open the overlay</sp-action-button>
|
|
66
77
|
<sp-overlay
|
|
@@ -70,19 +81,21 @@ const Template = ({
|
|
|
70
81
|
placement=${ifDefined(placement)}
|
|
71
82
|
offset="-10"
|
|
72
83
|
>
|
|
73
|
-
<sp-popover
|
|
74
|
-
<
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
<sp-popover ?delayed=${delayed}>
|
|
85
|
+
<sp-dialog size="s" no-divider>
|
|
86
|
+
<p>
|
|
87
|
+
Content goes here.
|
|
88
|
+
${type === "modal" || type === "page" ? html`
|
|
89
|
+
Or, a link,
|
|
90
|
+
<sp-link
|
|
91
|
+
href="https://opensource.adobe.com/spectrum-web-components"
|
|
92
|
+
>
|
|
93
|
+
Spectrum Web Components
|
|
94
|
+
</sp-link>
|
|
95
|
+
.
|
|
96
|
+
` : ""}
|
|
97
|
+
</p>
|
|
98
|
+
</sp-dialog>
|
|
86
99
|
</sp-popover>
|
|
87
100
|
</sp-overlay>
|
|
88
101
|
</div>
|
|
@@ -91,6 +104,7 @@ export const modal = (args) => Template(args);
|
|
|
91
104
|
modal.args = {
|
|
92
105
|
interaction: "click",
|
|
93
106
|
placement: "right",
|
|
107
|
+
style: "will-change",
|
|
94
108
|
type: "modal"
|
|
95
109
|
};
|
|
96
110
|
export const page = ({
|
|
@@ -118,10 +132,40 @@ export const click = (args) => Template(args);
|
|
|
118
132
|
click.args = {
|
|
119
133
|
interaction: "click",
|
|
120
134
|
placement: "right",
|
|
135
|
+
style: "container-type",
|
|
121
136
|
type: "auto"
|
|
122
137
|
};
|
|
123
138
|
export const hover = (args) => Template(args);
|
|
124
139
|
hover.args = {
|
|
140
|
+
interaction: "hover",
|
|
141
|
+
placement: "right",
|
|
142
|
+
style: "will-change"
|
|
143
|
+
};
|
|
144
|
+
export const hoverTooltip = ({
|
|
145
|
+
interaction,
|
|
146
|
+
open,
|
|
147
|
+
placement,
|
|
148
|
+
type
|
|
149
|
+
}) => html`
|
|
150
|
+
<style>
|
|
151
|
+
.wrapper {
|
|
152
|
+
will-change: transform;
|
|
153
|
+
}
|
|
154
|
+
</style>
|
|
155
|
+
<div class="wrapper">
|
|
156
|
+
<sp-action-button id="trigger">Open the overlay</sp-action-button>
|
|
157
|
+
<sp-overlay
|
|
158
|
+
?open=${open}
|
|
159
|
+
trigger="trigger@${interaction}"
|
|
160
|
+
type=${ifDefined(type)}
|
|
161
|
+
placement=${ifDefined(placement)}
|
|
162
|
+
offset="-10"
|
|
163
|
+
>
|
|
164
|
+
<sp-tooltip>Tooltip goes here.</sp-tooltip>
|
|
165
|
+
</sp-overlay>
|
|
166
|
+
</div>
|
|
167
|
+
`;
|
|
168
|
+
hoverTooltip.args = {
|
|
125
169
|
interaction: "hover",
|
|
126
170
|
placement: "right"
|
|
127
171
|
};
|
|
@@ -129,6 +173,7 @@ export const longpress = (args) => Template(args);
|
|
|
129
173
|
longpress.args = {
|
|
130
174
|
interaction: "longpress",
|
|
131
175
|
placement: "right",
|
|
176
|
+
style: "container-type",
|
|
132
177
|
type: "auto"
|
|
133
178
|
};
|
|
134
179
|
export const receivesFocus = ({
|
|
@@ -148,7 +193,11 @@ export const receivesFocus = ({
|
|
|
148
193
|
placement=${ifDefined(placement)}
|
|
149
194
|
.receivesFocus=${receivesFocus2}
|
|
150
195
|
>
|
|
151
|
-
<
|
|
196
|
+
<sp-popover>
|
|
197
|
+
<sp-dialog size="s" no-divider>
|
|
198
|
+
<a href="https://example.com">Click Content</a>
|
|
199
|
+
</sp-dialog>
|
|
200
|
+
</sp-popover>
|
|
152
201
|
</sp-overlay>
|
|
153
202
|
`;
|
|
154
203
|
receivesFocus.args = {
|
|
@@ -202,13 +251,17 @@ export const all = ({ delayed }) => html`
|
|
|
202
251
|
Open the overlay
|
|
203
252
|
</sp-action-button>
|
|
204
253
|
<sp-overlay trigger="trigger@click" type="auto" placement="right">
|
|
205
|
-
<sp-popover
|
|
254
|
+
<sp-popover>
|
|
255
|
+
<sp-dialog size="s" no-divider>Click content</sp-dialog>
|
|
256
|
+
</sp-popover>
|
|
206
257
|
</sp-overlay>
|
|
207
258
|
<sp-overlay ?delayed=${delayed} trigger="trigger@hover" type="hint">
|
|
208
259
|
<sp-tooltip>Hover content</sp-tooltip>
|
|
209
260
|
</sp-overlay>
|
|
210
261
|
<sp-overlay trigger="trigger@longpress" type="auto" placement="right">
|
|
211
|
-
<sp-popover
|
|
262
|
+
<sp-popover>
|
|
263
|
+
<sp-dialog size="s" no-divider>Longpress content</sp-dialog>
|
|
264
|
+
</sp-popover>
|
|
212
265
|
</sp-overlay>
|
|
213
266
|
`;
|
|
214
267
|
export const actionGroup = ({ delayed }) => {
|