@spectrum-web-components/picker 1.7.0 → 1.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/picker",
3
- "version": "1.7.0",
3
+ "version": "1.8.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -88,20 +88,20 @@
88
88
  "css"
89
89
  ],
90
90
  "dependencies": {
91
- "@spectrum-web-components/base": "1.7.0",
92
- "@spectrum-web-components/button": "1.7.0",
93
- "@spectrum-web-components/field-label": "1.7.0",
94
- "@spectrum-web-components/icon": "1.7.0",
95
- "@spectrum-web-components/icons-ui": "1.7.0",
96
- "@spectrum-web-components/icons-workflow": "1.7.0",
97
- "@spectrum-web-components/menu": "1.7.0",
98
- "@spectrum-web-components/overlay": "1.7.0",
99
- "@spectrum-web-components/popover": "1.7.0",
100
- "@spectrum-web-components/progress-circle": "1.7.0",
101
- "@spectrum-web-components/reactive-controllers": "1.7.0",
102
- "@spectrum-web-components/shared": "1.7.0",
103
- "@spectrum-web-components/tooltip": "1.7.0",
104
- "@spectrum-web-components/tray": "1.7.0"
91
+ "@spectrum-web-components/base": "1.8.0",
92
+ "@spectrum-web-components/button": "1.8.0",
93
+ "@spectrum-web-components/field-label": "1.8.0",
94
+ "@spectrum-web-components/icon": "1.8.0",
95
+ "@spectrum-web-components/icons-ui": "1.8.0",
96
+ "@spectrum-web-components/icons-workflow": "1.8.0",
97
+ "@spectrum-web-components/menu": "1.8.0",
98
+ "@spectrum-web-components/overlay": "1.8.0",
99
+ "@spectrum-web-components/popover": "1.8.0",
100
+ "@spectrum-web-components/progress-circle": "1.8.0",
101
+ "@spectrum-web-components/reactive-controllers": "1.8.0",
102
+ "@spectrum-web-components/shared": "1.8.0",
103
+ "@spectrum-web-components/tooltip": "1.8.0",
104
+ "@spectrum-web-components/tray": "1.8.0"
105
105
  },
106
106
  "types": "./src/index.d.ts",
107
107
  "customElements": "custom-elements.json",
package/sp-picker.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { Picker } from './src/Picker.js';
2
13
  declare global {
3
14
  interface HTMLElementTagNameMap {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-picker.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 { Picker } from './src/Picker.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-picker', Picker);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-picker': Picker;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Picker } from './src/Picker.dev.js'\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-picker', Picker);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-picker': Picker;\n }\n}\n"],
5
5
  "mappings": ";AAYA,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAE9B,cAAc,aAAa,MAAM;",
6
6
  "names": []
7
7
  }
package/sp-picker.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["sp-picker.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 { Picker } from './src/Picker.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-picker', Picker);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-picker': Picker;\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport { Picker } from './src/Picker.js';\nimport { defineElement } from '@spectrum-web-components/base/src/define-element.js';\n\ndefineElement('sp-picker', Picker);\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'sp-picker': Picker;\n }\n}\n"],
5
5
  "mappings": "aAYA,OAAS,UAAAA,MAAc,kBACvB,OAAS,iBAAAC,MAAqB,sDAE9BA,EAAc,YAAaD,CAAM",
6
6
  "names": ["Picker", "defineElement"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { InteractionController, InteractionTypes } from './InteractionController.js';
2
13
  export declare class DesktopController extends InteractionController {
3
14
  type: InteractionTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["DesktopController.ts"],
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*/\n\nimport {\n InteractionController,\n InteractionTypes,\n} from './InteractionController.dev.js'\n\nexport class DesktopController extends InteractionController {\n override type = InteractionTypes.desktop;\n\n public override handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0 || event.pointerType === 'touch') {\n return;\n }\n this.pointerdownState = this.open;\n this.preventNextToggle = 'maybe';\n let cleanupAction = 0;\n const cleanup = (): void => {\n cancelAnimationFrame(cleanupAction);\n cleanupAction = requestAnimationFrame(async () => {\n document.removeEventListener('pointerup', cleanup);\n document.removeEventListener('pointercancel', cleanup);\n this.target.removeEventListener('click', cleanup);\n requestAnimationFrame(() => {\n // Complete cleanup on the second animation frame so that `click` can go first.\n this.preventNextToggle = 'no';\n });\n });\n };\n // Ensure that however the pointer goes up we do `cleanup()`.\n document.addEventListener('pointerup', cleanup);\n document.addEventListener('pointercancel', cleanup);\n this.target.addEventListener('click', cleanup);\n this.handleActivate();\n }\n\n public override handleActivate(event?: Event): void {\n if (this.enterKeydownOn && this.enterKeydownOn !== this.target) {\n return;\n }\n if (this.preventNextToggle === 'yes') {\n return;\n }\n if (event?.type === 'click' && this.open !== this.pointerdownState) {\n // When activation comes from a `click` event ensure that the `pointerup`\n // event didn't already toggle the Picker state before doing so.\n return;\n }\n this.host.toggle();\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener(\n 'click',\n (event: Event) => this.handleActivate(event),\n {\n signal,\n }\n );\n this.target.addEventListener(\n 'pointerdown',\n (event: PointerEvent) => this.handlePointerdown(event),\n { signal }\n );\n this.target.addEventListener(\n 'focus',\n (event: FocusEvent) => this.handleButtonFocus(event),\n {\n signal,\n }\n );\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n InteractionController,\n InteractionTypes,\n} from './InteractionController.dev.js'\n\nexport class DesktopController extends InteractionController {\n override type = InteractionTypes.desktop;\n\n public override handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0 || event.pointerType === 'touch') {\n return;\n }\n this.pointerdownState = this.open;\n this.preventNextToggle = 'maybe';\n let cleanupAction = 0;\n const cleanup = (): void => {\n cancelAnimationFrame(cleanupAction);\n cleanupAction = requestAnimationFrame(async () => {\n document.removeEventListener('pointerup', cleanup);\n document.removeEventListener('pointercancel', cleanup);\n this.target.removeEventListener('click', cleanup);\n requestAnimationFrame(() => {\n // Complete cleanup on the second animation frame so that `click` can go first.\n this.preventNextToggle = 'no';\n });\n });\n };\n // Ensure that however the pointer goes up we do `cleanup()`.\n document.addEventListener('pointerup', cleanup);\n document.addEventListener('pointercancel', cleanup);\n this.target.addEventListener('click', cleanup);\n this.handleActivate();\n }\n\n public override handleActivate(event?: Event): void {\n if (this.enterKeydownOn && this.enterKeydownOn !== this.target) {\n return;\n }\n if (this.preventNextToggle === 'yes') {\n return;\n }\n if (event?.type === 'click' && this.open !== this.pointerdownState) {\n // When activation comes from a `click` event ensure that the `pointerup`\n // event didn't already toggle the Picker state before doing so.\n return;\n }\n this.host.toggle();\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener(\n 'click',\n (event: Event) => this.handleActivate(event),\n {\n signal,\n }\n );\n this.target.addEventListener(\n 'pointerdown',\n (event: PointerEvent) => this.handlePointerdown(event),\n { signal }\n );\n this.target.addEventListener(\n 'focus',\n (event: FocusEvent) => this.handleButtonFocus(event),\n {\n signal,\n }\n );\n }\n}\n"],
5
5
  "mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,OACG;AAEA,aAAM,0BAA0B,sBAAsB;AAAA,EAAtD;AAAA;AACH,SAAS,OAAO,iBAAiB;AAAA;AAAA,EAEjB,kBAAkB,OAA2B;AACzD,QAAI,MAAM,WAAW,KAAK,MAAM,gBAAgB,SAAS;AACrD;AAAA,IACJ;AACA,SAAK,mBAAmB,KAAK;AAC7B,SAAK,oBAAoB;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
2
  "version": 3,
3
3
  "sources": ["DesktopController.ts"],
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*/\n\nimport {\n InteractionController,\n InteractionTypes,\n} from './InteractionController.js';\n\nexport class DesktopController extends InteractionController {\n override type = InteractionTypes.desktop;\n\n public override handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0 || event.pointerType === 'touch') {\n return;\n }\n this.pointerdownState = this.open;\n this.preventNextToggle = 'maybe';\n let cleanupAction = 0;\n const cleanup = (): void => {\n cancelAnimationFrame(cleanupAction);\n cleanupAction = requestAnimationFrame(async () => {\n document.removeEventListener('pointerup', cleanup);\n document.removeEventListener('pointercancel', cleanup);\n this.target.removeEventListener('click', cleanup);\n requestAnimationFrame(() => {\n // Complete cleanup on the second animation frame so that `click` can go first.\n this.preventNextToggle = 'no';\n });\n });\n };\n // Ensure that however the pointer goes up we do `cleanup()`.\n document.addEventListener('pointerup', cleanup);\n document.addEventListener('pointercancel', cleanup);\n this.target.addEventListener('click', cleanup);\n this.handleActivate();\n }\n\n public override handleActivate(event?: Event): void {\n if (this.enterKeydownOn && this.enterKeydownOn !== this.target) {\n return;\n }\n if (this.preventNextToggle === 'yes') {\n return;\n }\n if (event?.type === 'click' && this.open !== this.pointerdownState) {\n // When activation comes from a `click` event ensure that the `pointerup`\n // event didn't already toggle the Picker state before doing so.\n return;\n }\n this.host.toggle();\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener(\n 'click',\n (event: Event) => this.handleActivate(event),\n {\n signal,\n }\n );\n this.target.addEventListener(\n 'pointerdown',\n (event: PointerEvent) => this.handlePointerdown(event),\n { signal }\n );\n this.target.addEventListener(\n 'focus',\n (event: FocusEvent) => this.handleButtonFocus(event),\n {\n signal,\n }\n );\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n InteractionController,\n InteractionTypes,\n} from './InteractionController.js';\n\nexport class DesktopController extends InteractionController {\n override type = InteractionTypes.desktop;\n\n public override handlePointerdown(event: PointerEvent): void {\n if (event.button !== 0 || event.pointerType === 'touch') {\n return;\n }\n this.pointerdownState = this.open;\n this.preventNextToggle = 'maybe';\n let cleanupAction = 0;\n const cleanup = (): void => {\n cancelAnimationFrame(cleanupAction);\n cleanupAction = requestAnimationFrame(async () => {\n document.removeEventListener('pointerup', cleanup);\n document.removeEventListener('pointercancel', cleanup);\n this.target.removeEventListener('click', cleanup);\n requestAnimationFrame(() => {\n // Complete cleanup on the second animation frame so that `click` can go first.\n this.preventNextToggle = 'no';\n });\n });\n };\n // Ensure that however the pointer goes up we do `cleanup()`.\n document.addEventListener('pointerup', cleanup);\n document.addEventListener('pointercancel', cleanup);\n this.target.addEventListener('click', cleanup);\n this.handleActivate();\n }\n\n public override handleActivate(event?: Event): void {\n if (this.enterKeydownOn && this.enterKeydownOn !== this.target) {\n return;\n }\n if (this.preventNextToggle === 'yes') {\n return;\n }\n if (event?.type === 'click' && this.open !== this.pointerdownState) {\n // When activation comes from a `click` event ensure that the `pointerup`\n // event didn't already toggle the Picker state before doing so.\n return;\n }\n this.host.toggle();\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener(\n 'click',\n (event: Event) => this.handleActivate(event),\n {\n signal,\n }\n );\n this.target.addEventListener(\n 'pointerdown',\n (event: PointerEvent) => this.handlePointerdown(event),\n { signal }\n );\n this.target.addEventListener(\n 'focus',\n (event: FocusEvent) => this.handleButtonFocus(event),\n {\n signal,\n }\n );\n }\n}\n"],
5
5
  "mappings": "aAYA,OACI,yBAAAA,EACA,oBAAAC,MACG,6BAEA,aAAM,0BAA0BD,CAAsB,CAAtD,kCACH,KAAS,KAAOC,EAAiB,QAEjB,kBAAkBC,EAA2B,CACzD,GAAIA,EAAM,SAAW,GAAKA,EAAM,cAAgB,QAC5C,OAEJ,KAAK,iBAAmB,KAAK,KAC7B,KAAK,kBAAoB,QACzB,IAAIC,EAAgB,EACpB,MAAMC,EAAU,IAAY,CACxB,qBAAqBD,CAAa,EAClCA,EAAgB,sBAAsB,SAAY,CAC9C,SAAS,oBAAoB,YAAaC,CAAO,EACjD,SAAS,oBAAoB,gBAAiBA,CAAO,EACrD,KAAK,OAAO,oBAAoB,QAASA,CAAO,EAChD,sBAAsB,IAAM,CAExB,KAAK,kBAAoB,IAC7B,CAAC,CACL,CAAC,CACL,EAEA,SAAS,iBAAiB,YAAaA,CAAO,EAC9C,SAAS,iBAAiB,gBAAiBA,CAAO,EAClD,KAAK,OAAO,iBAAiB,QAASA,CAAO,EAC7C,KAAK,eAAe,CACxB,CAEgB,eAAeF,EAAqB,CAC5C,KAAK,gBAAkB,KAAK,iBAAmB,KAAK,QAGpD,KAAK,oBAAsB,SAG3BA,GAAA,YAAAA,EAAO,QAAS,SAAW,KAAK,OAAS,KAAK,kBAKlD,KAAK,KAAK,OAAO,EACrB,CAES,MAAa,CA7D1B,IAAAG,GA+DQA,EAAA,KAAK,kBAAL,MAAAA,EAAsB,QACtB,KAAK,gBAAkB,IAAI,gBAC3B,KAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,gBACxB,KAAK,OAAO,iBACR,QACCJ,GAAiB,KAAK,eAAeA,CAAK,EAC3C,CACI,OAAAI,CACJ,CACJ,EACA,KAAK,OAAO,iBACR,cACCJ,GAAwB,KAAK,kBAAkBA,CAAK,EACrD,CAAE,OAAAI,CAAO,CACb,EACA,KAAK,OAAO,iBACR,QACCJ,GAAsB,KAAK,kBAAkBA,CAAK,EACnD,CACI,OAAAI,CACJ,CACJ,CACJ,CACJ",
6
6
  "names": ["InteractionController", "InteractionTypes", "event", "cleanupAction", "cleanup", "_a", "signal"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { ReactiveController, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { AbstractOverlay } from '@spectrum-web-components/overlay/src/AbstractOverlay';
3
14
  import { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["InteractionController.ts"],
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*/\n\nimport {\n ReactiveController,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AbstractOverlay } from '@spectrum-web-components/overlay/src/AbstractOverlay';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport { PickerBase } from './Picker.dev.js'\n\nexport enum InteractionTypes {\n 'desktop',\n 'mobile',\n}\nexport const SAFARI_FOCUS_RING_CLASS = 'remove-focus-ring-safari-hack';\n\nexport class InteractionController implements ReactiveController {\n abortController!: AbortController;\n\n public preventNextToggle: 'no' | 'maybe' | 'yes' = 'no';\n public pointerdownState = false;\n public enterKeydownOn: EventTarget | null = null;\n\n public container!: TemplateResult;\n\n get activelyOpening(): boolean {\n return false;\n }\n\n private _open = false;\n\n public get open(): boolean {\n return this._open;\n }\n\n /**\n * Set `open`\n */\n public set open(open: boolean) {\n if (this._open === open) return;\n this._open = open;\n\n if (this.overlay) {\n this.host.open = open;\n return;\n }\n\n // When there is no Overlay and `open` is moving to `true`, lazily import/create\n // an Overlay and apply that state to it.\n customElements\n .whenDefined('sp-overlay')\n .then(async (): Promise<void> => {\n const { Overlay } = await import(\n '@spectrum-web-components/overlay/src/Overlay.js'\n );\n this.overlay = new Overlay();\n this.host.open = true;\n this.host.requestUpdate();\n });\n import('@spectrum-web-components/overlay/sp-overlay.js');\n }\n\n private _overlay!: AbstractOverlay;\n\n public get overlay(): AbstractOverlay {\n return this._overlay;\n }\n\n public set overlay(overlay: AbstractOverlay | undefined) {\n if (!overlay) return;\n if (this.overlay === overlay) return;\n this._overlay = overlay;\n this.initOverlay();\n }\n\n type!: InteractionTypes;\n\n constructor(\n public target: HTMLElement,\n public host: PickerBase\n ) {\n this.target = target;\n this.host = host;\n this.host.addController(this);\n this.init();\n }\n\n releaseDescription(): void {}\n\n protected handleBeforetoggle(\n event: Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n ): void {\n if (event.composedPath()[0] !== event.target) {\n return;\n }\n if (event.newState === 'closed') {\n if (this.preventNextToggle === 'no') {\n this.open = false;\n } else if (!this.pointerdownState) {\n // Prevent browser driven closure while opening the Picker\n // and the expected event series has not completed.\n this.overlay?.manuallyKeepOpen();\n }\n }\n if (!this.open) {\n this.host.optionsMenu.updateSelectedItemIndex();\n this.host.optionsMenu.closeDescendentOverlays();\n }\n }\n\n initOverlay(): void {\n if (this.overlay) {\n this.overlay.addEventListener('beforetoggle', (event: Event) => {\n this.handleBeforetoggle(\n event as Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n );\n });\n this.overlay.type =\n this.host.isMobile.matches && !this.host.forcePopover\n ? 'modal'\n : 'auto';\n this.overlay.triggerElement = this.host as HTMLElement;\n this.overlay.placement =\n this.host.isMobile.matches && !this.host.forcePopover\n ? undefined\n : this.host.placement;\n // We should not be applying open is set programmatically via the picker's open.property.\n // Focus should only be applied if a user action causes the menu to open. Otherwise,\n // we could be pulling focus from a user when an picker with an open menu loads.\n this.overlay.receivesFocus = 'false';\n this.overlay.willPreventClose =\n this.preventNextToggle !== 'no' && this.open;\n this.overlay.addEventListener(\n 'slottable-request',\n this.host.handleSlottableRequest\n );\n }\n }\n\n public handlePointerdown(_event: PointerEvent): void {}\n\n public handleButtonFocus(event: FocusEvent): void {\n // When focus comes from a pointer event, and the related target is the Menu,\n // we don't want to reopen the Menu.\n if (\n this.preventNextToggle === 'maybe' &&\n event.relatedTarget === this.host.optionsMenu\n ) {\n this.preventNextToggle = 'yes';\n }\n if (this.preventNextToggle === 'no') this.host.close();\n }\n\n public handleActivate(_event: Event): void {}\n\n /* c8 ignore next 3 */\n init(): void {}\n\n abort(): void {\n this.releaseDescription();\n this.abortController?.abort();\n }\n\n hostConnected(): void {\n this.init();\n this.host.addEventListener('sp-opened', () => {\n /**\n * set shouldSupportDragAndSelect to false for mobile\n * to prevent click event being captured behind the menu-tray\n * we do this here because the menu gets reinitialized on overlay open\n */\n this.host.optionsMenu.shouldSupportDragAndSelect =\n !this.host.isMobile.matches;\n });\n this.host.addEventListener('sp-closed', () => {\n if (\n !this.open &&\n this.host.optionsMenu.matches(':focus-within') &&\n !this.host.button.matches(':focus')\n ) {\n this.host.button.focus();\n }\n });\n }\n\n hostDisconnected(): void {\n this.abortController?.abort();\n }\n\n public hostUpdated(): void {\n if (\n this.overlay &&\n this.host.dependencyManager.loaded &&\n this.host.open !== this.overlay.open\n ) {\n this.overlay.willPreventClose = this.preventNextToggle !== 'no';\n this.overlay.open = this.host.open;\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n ReactiveController,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AbstractOverlay } from '@spectrum-web-components/overlay/src/AbstractOverlay';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport { PickerBase } from './Picker.dev.js'\n\nexport enum InteractionTypes {\n 'desktop',\n 'mobile',\n}\nexport const SAFARI_FOCUS_RING_CLASS = 'remove-focus-ring-safari-hack';\n\nexport class InteractionController implements ReactiveController {\n abortController!: AbortController;\n\n public preventNextToggle: 'no' | 'maybe' | 'yes' = 'no';\n public pointerdownState = false;\n public enterKeydownOn: EventTarget | null = null;\n\n public container!: TemplateResult;\n\n get activelyOpening(): boolean {\n return false;\n }\n\n private _open = false;\n\n public get open(): boolean {\n return this._open;\n }\n\n /**\n * Set `open`\n */\n public set open(open: boolean) {\n if (this._open === open) return;\n this._open = open;\n\n if (this.overlay) {\n this.host.open = open;\n return;\n }\n\n // When there is no Overlay and `open` is moving to `true`, lazily import/create\n // an Overlay and apply that state to it.\n customElements\n .whenDefined('sp-overlay')\n .then(async (): Promise<void> => {\n const { Overlay } = await import(\n '@spectrum-web-components/overlay/src/Overlay.js'\n );\n this.overlay = new Overlay();\n this.host.open = true;\n this.host.requestUpdate();\n });\n import('@spectrum-web-components/overlay/sp-overlay.js');\n }\n\n private _overlay!: AbstractOverlay;\n\n public get overlay(): AbstractOverlay {\n return this._overlay;\n }\n\n public set overlay(overlay: AbstractOverlay | undefined) {\n if (!overlay) return;\n if (this.overlay === overlay) return;\n this._overlay = overlay;\n this.initOverlay();\n }\n\n type!: InteractionTypes;\n\n constructor(\n public target: HTMLElement,\n public host: PickerBase\n ) {\n this.target = target;\n this.host = host;\n this.host.addController(this);\n this.init();\n }\n\n releaseDescription(): void {}\n\n protected handleBeforetoggle(\n event: Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n ): void {\n if (event.composedPath()[0] !== event.target) {\n return;\n }\n if (event.newState === 'closed') {\n if (this.preventNextToggle === 'no') {\n this.open = false;\n } else if (!this.pointerdownState) {\n // Prevent browser driven closure while opening the Picker\n // and the expected event series has not completed.\n this.overlay?.manuallyKeepOpen();\n }\n }\n if (!this.open) {\n this.host.optionsMenu.updateSelectedItemIndex();\n this.host.optionsMenu.closeDescendentOverlays();\n }\n }\n\n initOverlay(): void {\n if (this.overlay) {\n this.overlay.addEventListener('beforetoggle', (event: Event) => {\n this.handleBeforetoggle(\n event as Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n );\n });\n this.overlay.type =\n this.host.isMobile.matches && !this.host.forcePopover\n ? 'modal'\n : 'auto';\n this.overlay.triggerElement = this.host as HTMLElement;\n this.overlay.placement =\n this.host.isMobile.matches && !this.host.forcePopover\n ? undefined\n : this.host.placement;\n // We should not be applying open is set programmatically via the picker's open.property.\n // Focus should only be applied if a user action causes the menu to open. Otherwise,\n // we could be pulling focus from a user when an picker with an open menu loads.\n this.overlay.receivesFocus = 'false';\n this.overlay.willPreventClose =\n this.preventNextToggle !== 'no' && this.open;\n this.overlay.addEventListener(\n 'slottable-request',\n this.host.handleSlottableRequest\n );\n }\n }\n\n public handlePointerdown(_event: PointerEvent): void {}\n\n public handleButtonFocus(event: FocusEvent): void {\n // When focus comes from a pointer event, and the related target is the Menu,\n // we don't want to reopen the Menu.\n if (\n this.preventNextToggle === 'maybe' &&\n event.relatedTarget === this.host.optionsMenu\n ) {\n this.preventNextToggle = 'yes';\n }\n if (this.preventNextToggle === 'no') this.host.close();\n }\n\n public handleActivate(_event: Event): void {}\n\n /* c8 ignore next 3 */\n init(): void {}\n\n abort(): void {\n this.releaseDescription();\n this.abortController?.abort();\n }\n\n hostConnected(): void {\n this.init();\n this.host.addEventListener('sp-opened', () => {\n /**\n * set shouldSupportDragAndSelect to false for mobile\n * to prevent click event being captured behind the menu-tray\n * we do this here because the menu gets reinitialized on overlay open\n */\n this.host.optionsMenu.shouldSupportDragAndSelect =\n !this.host.isMobile.matches;\n });\n this.host.addEventListener('sp-closed', () => {\n if (\n !this.open &&\n this.host.optionsMenu.matches(':focus-within') &&\n !this.host.button.matches(':focus')\n ) {\n this.host.button.focus();\n }\n });\n }\n\n hostDisconnected(): void {\n this.abortController?.abort();\n }\n\n public hostUpdated(): void {\n if (\n this.overlay &&\n this.host.dependencyManager.loaded &&\n this.host.open !== this.overlay.open\n ) {\n this.overlay.willPreventClose = this.preventNextToggle !== 'no';\n this.overlay.open = this.host.open;\n }\n }\n}\n"],
5
5
  "mappings": ";AAoBO,WAAK,mBAAL,kBAAKA,sBAAL;AACH,EAAAA,oCAAA;AACA,EAAAA,oCAAA;AAFQ,SAAAA;AAAA,GAAA;AAIL,aAAM,0BAA0B;AAEhC,aAAM,sBAAoD;AAAA,EA6D7D,YACW,QACA,MACT;AAFS;AACA;AA5DX,SAAO,oBAA4C;AACnD,SAAO,mBAAmB;AAC1B,SAAO,iBAAqC;AAQ5C,SAAQ,QAAQ;AAoDZ,SAAK,SAAS;AACd,SAAK,OAAO;AACZ,SAAK,KAAK,cAAc,IAAI;AAC5B,SAAK,KAAK;AAAA,EACd;AA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AAAA,EAC1B;AAAA,EAEO,cAAoB;AACvB,QACI,KAAK,WACL,KAAK,KAAK,kBAAkB,UAC5B,KAAK,KAAK,SAAS,KAAK,QAAQ,MAClC;AACE,WAAK,QAAQ,mBAAmB,KAAK,sBAAsB;AAC3D,WAAK,QAAQ,OAAO,KAAK,KAAK;AAAA,IAClC;AAAA,EACJ;AACJ;",
6
6
  "names": ["InteractionTypes", "Overlay"]
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["InteractionController.ts"],
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*/\n\nimport {\n ReactiveController,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AbstractOverlay } from '@spectrum-web-components/overlay/src/AbstractOverlay';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport { PickerBase } from './Picker.js';\n\nexport enum InteractionTypes {\n 'desktop',\n 'mobile',\n}\nexport const SAFARI_FOCUS_RING_CLASS = 'remove-focus-ring-safari-hack';\n\nexport class InteractionController implements ReactiveController {\n abortController!: AbortController;\n\n public preventNextToggle: 'no' | 'maybe' | 'yes' = 'no';\n public pointerdownState = false;\n public enterKeydownOn: EventTarget | null = null;\n\n public container!: TemplateResult;\n\n get activelyOpening(): boolean {\n return false;\n }\n\n private _open = false;\n\n public get open(): boolean {\n return this._open;\n }\n\n /**\n * Set `open`\n */\n public set open(open: boolean) {\n if (this._open === open) return;\n this._open = open;\n\n if (this.overlay) {\n this.host.open = open;\n return;\n }\n\n // When there is no Overlay and `open` is moving to `true`, lazily import/create\n // an Overlay and apply that state to it.\n customElements\n .whenDefined('sp-overlay')\n .then(async (): Promise<void> => {\n const { Overlay } = await import(\n '@spectrum-web-components/overlay/src/Overlay.js'\n );\n this.overlay = new Overlay();\n this.host.open = true;\n this.host.requestUpdate();\n });\n import('@spectrum-web-components/overlay/sp-overlay.js');\n }\n\n private _overlay!: AbstractOverlay;\n\n public get overlay(): AbstractOverlay {\n return this._overlay;\n }\n\n public set overlay(overlay: AbstractOverlay | undefined) {\n if (!overlay) return;\n if (this.overlay === overlay) return;\n this._overlay = overlay;\n this.initOverlay();\n }\n\n type!: InteractionTypes;\n\n constructor(\n public target: HTMLElement,\n public host: PickerBase\n ) {\n this.target = target;\n this.host = host;\n this.host.addController(this);\n this.init();\n }\n\n releaseDescription(): void {}\n\n protected handleBeforetoggle(\n event: Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n ): void {\n if (event.composedPath()[0] !== event.target) {\n return;\n }\n if (event.newState === 'closed') {\n if (this.preventNextToggle === 'no') {\n this.open = false;\n } else if (!this.pointerdownState) {\n // Prevent browser driven closure while opening the Picker\n // and the expected event series has not completed.\n this.overlay?.manuallyKeepOpen();\n }\n }\n if (!this.open) {\n this.host.optionsMenu.updateSelectedItemIndex();\n this.host.optionsMenu.closeDescendentOverlays();\n }\n }\n\n initOverlay(): void {\n if (this.overlay) {\n this.overlay.addEventListener('beforetoggle', (event: Event) => {\n this.handleBeforetoggle(\n event as Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n );\n });\n this.overlay.type =\n this.host.isMobile.matches && !this.host.forcePopover\n ? 'modal'\n : 'auto';\n this.overlay.triggerElement = this.host as HTMLElement;\n this.overlay.placement =\n this.host.isMobile.matches && !this.host.forcePopover\n ? undefined\n : this.host.placement;\n // We should not be applying open is set programmatically via the picker's open.property.\n // Focus should only be applied if a user action causes the menu to open. Otherwise,\n // we could be pulling focus from a user when an picker with an open menu loads.\n this.overlay.receivesFocus = 'false';\n this.overlay.willPreventClose =\n this.preventNextToggle !== 'no' && this.open;\n this.overlay.addEventListener(\n 'slottable-request',\n this.host.handleSlottableRequest\n );\n }\n }\n\n public handlePointerdown(_event: PointerEvent): void {}\n\n public handleButtonFocus(event: FocusEvent): void {\n // When focus comes from a pointer event, and the related target is the Menu,\n // we don't want to reopen the Menu.\n if (\n this.preventNextToggle === 'maybe' &&\n event.relatedTarget === this.host.optionsMenu\n ) {\n this.preventNextToggle = 'yes';\n }\n if (this.preventNextToggle === 'no') this.host.close();\n }\n\n public handleActivate(_event: Event): void {}\n\n /* c8 ignore next 3 */\n init(): void {}\n\n abort(): void {\n this.releaseDescription();\n this.abortController?.abort();\n }\n\n hostConnected(): void {\n this.init();\n this.host.addEventListener('sp-opened', () => {\n /**\n * set shouldSupportDragAndSelect to false for mobile\n * to prevent click event being captured behind the menu-tray\n * we do this here because the menu gets reinitialized on overlay open\n */\n this.host.optionsMenu.shouldSupportDragAndSelect =\n !this.host.isMobile.matches;\n });\n this.host.addEventListener('sp-closed', () => {\n if (\n !this.open &&\n this.host.optionsMenu.matches(':focus-within') &&\n !this.host.button.matches(':focus')\n ) {\n this.host.button.focus();\n }\n });\n }\n\n hostDisconnected(): void {\n this.abortController?.abort();\n }\n\n public hostUpdated(): void {\n if (\n this.overlay &&\n this.host.dependencyManager.loaded &&\n this.host.open !== this.overlay.open\n ) {\n this.overlay.willPreventClose = this.preventNextToggle !== 'no';\n this.overlay.open = this.host.open;\n }\n }\n}\n"],
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n ReactiveController,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { AbstractOverlay } from '@spectrum-web-components/overlay/src/AbstractOverlay';\nimport { Overlay } from '@spectrum-web-components/overlay/src/Overlay.js';\nimport { PickerBase } from './Picker.js';\n\nexport enum InteractionTypes {\n 'desktop',\n 'mobile',\n}\nexport const SAFARI_FOCUS_RING_CLASS = 'remove-focus-ring-safari-hack';\n\nexport class InteractionController implements ReactiveController {\n abortController!: AbortController;\n\n public preventNextToggle: 'no' | 'maybe' | 'yes' = 'no';\n public pointerdownState = false;\n public enterKeydownOn: EventTarget | null = null;\n\n public container!: TemplateResult;\n\n get activelyOpening(): boolean {\n return false;\n }\n\n private _open = false;\n\n public get open(): boolean {\n return this._open;\n }\n\n /**\n * Set `open`\n */\n public set open(open: boolean) {\n if (this._open === open) return;\n this._open = open;\n\n if (this.overlay) {\n this.host.open = open;\n return;\n }\n\n // When there is no Overlay and `open` is moving to `true`, lazily import/create\n // an Overlay and apply that state to it.\n customElements\n .whenDefined('sp-overlay')\n .then(async (): Promise<void> => {\n const { Overlay } = await import(\n '@spectrum-web-components/overlay/src/Overlay.js'\n );\n this.overlay = new Overlay();\n this.host.open = true;\n this.host.requestUpdate();\n });\n import('@spectrum-web-components/overlay/sp-overlay.js');\n }\n\n private _overlay!: AbstractOverlay;\n\n public get overlay(): AbstractOverlay {\n return this._overlay;\n }\n\n public set overlay(overlay: AbstractOverlay | undefined) {\n if (!overlay) return;\n if (this.overlay === overlay) return;\n this._overlay = overlay;\n this.initOverlay();\n }\n\n type!: InteractionTypes;\n\n constructor(\n public target: HTMLElement,\n public host: PickerBase\n ) {\n this.target = target;\n this.host = host;\n this.host.addController(this);\n this.init();\n }\n\n releaseDescription(): void {}\n\n protected handleBeforetoggle(\n event: Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n ): void {\n if (event.composedPath()[0] !== event.target) {\n return;\n }\n if (event.newState === 'closed') {\n if (this.preventNextToggle === 'no') {\n this.open = false;\n } else if (!this.pointerdownState) {\n // Prevent browser driven closure while opening the Picker\n // and the expected event series has not completed.\n this.overlay?.manuallyKeepOpen();\n }\n }\n if (!this.open) {\n this.host.optionsMenu.updateSelectedItemIndex();\n this.host.optionsMenu.closeDescendentOverlays();\n }\n }\n\n initOverlay(): void {\n if (this.overlay) {\n this.overlay.addEventListener('beforetoggle', (event: Event) => {\n this.handleBeforetoggle(\n event as Event & {\n target: Overlay;\n newState: 'open' | 'closed';\n }\n );\n });\n this.overlay.type =\n this.host.isMobile.matches && !this.host.forcePopover\n ? 'modal'\n : 'auto';\n this.overlay.triggerElement = this.host as HTMLElement;\n this.overlay.placement =\n this.host.isMobile.matches && !this.host.forcePopover\n ? undefined\n : this.host.placement;\n // We should not be applying open is set programmatically via the picker's open.property.\n // Focus should only be applied if a user action causes the menu to open. Otherwise,\n // we could be pulling focus from a user when an picker with an open menu loads.\n this.overlay.receivesFocus = 'false';\n this.overlay.willPreventClose =\n this.preventNextToggle !== 'no' && this.open;\n this.overlay.addEventListener(\n 'slottable-request',\n this.host.handleSlottableRequest\n );\n }\n }\n\n public handlePointerdown(_event: PointerEvent): void {}\n\n public handleButtonFocus(event: FocusEvent): void {\n // When focus comes from a pointer event, and the related target is the Menu,\n // we don't want to reopen the Menu.\n if (\n this.preventNextToggle === 'maybe' &&\n event.relatedTarget === this.host.optionsMenu\n ) {\n this.preventNextToggle = 'yes';\n }\n if (this.preventNextToggle === 'no') this.host.close();\n }\n\n public handleActivate(_event: Event): void {}\n\n /* c8 ignore next 3 */\n init(): void {}\n\n abort(): void {\n this.releaseDescription();\n this.abortController?.abort();\n }\n\n hostConnected(): void {\n this.init();\n this.host.addEventListener('sp-opened', () => {\n /**\n * set shouldSupportDragAndSelect to false for mobile\n * to prevent click event being captured behind the menu-tray\n * we do this here because the menu gets reinitialized on overlay open\n */\n this.host.optionsMenu.shouldSupportDragAndSelect =\n !this.host.isMobile.matches;\n });\n this.host.addEventListener('sp-closed', () => {\n if (\n !this.open &&\n this.host.optionsMenu.matches(':focus-within') &&\n !this.host.button.matches(':focus')\n ) {\n this.host.button.focus();\n }\n });\n }\n\n hostDisconnected(): void {\n this.abortController?.abort();\n }\n\n public hostUpdated(): void {\n if (\n this.overlay &&\n this.host.dependencyManager.loaded &&\n this.host.open !== this.overlay.open\n ) {\n this.overlay.willPreventClose = this.preventNextToggle !== 'no';\n this.overlay.open = this.host.open;\n }\n }\n}\n"],
5
5
  "mappings": "aAoBO,WAAK,kBAAAA,IACRA,IAAA,qBACAA,IAAA,mBAFQA,IAAA,sBAIL,aAAM,wBAA0B,gCAEhC,aAAM,qBAAoD,CA6D7D,YACWC,EACAC,EACT,CAFS,YAAAD,EACA,UAAAC,EA5DX,KAAO,kBAA4C,KACnD,KAAO,iBAAmB,GAC1B,KAAO,eAAqC,KAQ5C,KAAQ,MAAQ,GAoDZ,KAAK,OAASD,EACd,KAAK,KAAOC,EACZ,KAAK,KAAK,cAAc,IAAI,EAC5B,KAAK,KAAK,CACd,CA5DA,IAAI,iBAA2B,CAC3B,MAAO,EACX,CAIA,IAAW,MAAgB,CACvB,OAAO,KAAK,KAChB,CAKA,IAAW,KAAKC,EAAe,CAC3B,GAAI,KAAK,QAAUA,EAGnB,IAFA,KAAK,MAAQA,EAET,KAAK,QAAS,CACd,KAAK,KAAK,KAAOA,EACjB,MACJ,CAIA,eACK,YAAY,YAAY,EACxB,KAAK,SAA2B,CAC7B,KAAM,CAAE,QAAAC,CAAQ,EAAI,KAAM,QACtB,iDACJ,EACA,KAAK,QAAU,IAAIA,EACnB,KAAK,KAAK,KAAO,GACjB,KAAK,KAAK,cAAc,CAC5B,CAAC,EACL,OAAO,gDAAgD,EAC3D,CAIA,IAAW,SAA2B,CAClC,OAAO,KAAK,QAChB,CAEA,IAAW,QAAQC,EAAsC,CAChDA,GACD,KAAK,UAAYA,IACrB,KAAK,SAAWA,EAChB,KAAK,YAAY,EACrB,CAcA,oBAA2B,CAAC,CAElB,mBACNC,EAII,CAxGZ,IAAAC,EAyGYD,EAAM,aAAa,EAAE,CA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AAK,OAAO,QAAQ,QAAQ,GAElC,KAAK,KAAK,OAAO,MAAM,CAE/B,CAAC,CACL,CAEA,kBAAyB,CAzM7B,IAAAA,GA0MQA,EAAA,KAAK,kBAAL,MAAAA,EAAsB,OAC1B,CAEO,aAAoB,CAEnB,KAAK,SACL,KAAK,KAAK,kBAAkB,QAC5B,KAAK,KAAK,OAAS,KAAK,QAAQ,OAEhC,KAAK,QAAQ,iBAAmB,KAAK,oBAAsB,KAC3D,KAAK,QAAQ,KAAO,KAAK,KAAK,KAEtC,CACJ",
6
6
  "names": ["InteractionTypes", "target", "host", "open", "Overlay", "overlay", "event", "_a", "_event"]
7
7
  }
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { InteractionController, InteractionTypes } from './InteractionController.js';
2
13
  export declare class MobileController extends InteractionController {
3
14
  type: InteractionTypes;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["MobileController.ts"],
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\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 {\n InteractionController,\n InteractionTypes,\n SAFARI_FOCUS_RING_CLASS,\n} from './InteractionController.dev.js'\nimport { isWebKit } from '@spectrum-web-components/shared';\n\nexport class MobileController extends InteractionController {\n override type = InteractionTypes.mobile;\n\n handleClick(): void {\n if (this.host.disabled) {\n return;\n }\n if (this.preventNextToggle == 'no') {\n\n this.host.toggle();\n }\n this.preventNextToggle = 'no';\n }\n\n public override handlePointerdown(): void {\n this.preventNextToggle = this.open ? 'yes' : 'no';\n if (isWebKit()) {\n this.target.classList.add(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n private handleFocusOut(): void {\n if (this.host.open) {\n return;\n }\n if (\n isWebKit() &&\n this.target.classList.contains(SAFARI_FOCUS_RING_CLASS)\n ) {\n this.target.classList.remove(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener('click', () => this.handleClick(), {\n signal,\n });\n this.target.addEventListener(\n 'pointerdown',\n () => this.handlePointerdown(),\n { signal }\n );\n this.target.addEventListener('focusout', () => this.handleFocusOut(), {\n signal,\n });\n }\n}\n"],
5
- "mappings": ";AAWA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AAElB,aAAM,yBAAyB,sBAAsB;AAAA,EAArD;AAAA;AACH,SAAS,OAAO,iBAAiB;AAAA;AAAA,EAEjC,cAAoB;AAChB,QAAI,KAAK,KAAK,UAAU;AACpB;AAAA,IACJ;AACA,QAAI,KAAK,qBAAqB,MAAM;AAEhC,WAAK,KAAK,OAAO;AAAA,IACrB;AACA,SAAK,oBAAoB;AAAA,EAC7B;AAAA,EAEgB,oBAA0B;AACtC,SAAK,oBAAoB,KAAK,OAAO,QAAQ;AAC7C,QAAI,SAAS,GAAG;AACZ,WAAK,OAAO,UAAU,IAAI,uBAAuB;AAAA,IACrD;AAAA,EACJ;AAAA,EAEQ,iBAAuB;AAC3B,QAAI,KAAK,KAAK,MAAM;AAChB;AAAA,IACJ;AACA,QACI,SAAS,KACT,KAAK,OAAO,UAAU,SAAS,uBAAuB,GACxD;AACE,WAAK,OAAO,UAAU,OAAO,uBAAuB;AAAA,IACxD;AAAA,EACJ;AAAA,EAES,OAAa;AAnD1B;AAqDQ,eAAK,oBAAL,mBAAsB;AACtB,SAAK,kBAAkB,IAAI,gBAAgB;AAC3C,UAAM,EAAE,OAAO,IAAI,KAAK;AACxB,SAAK,OAAO,iBAAiB,SAAS,MAAM,KAAK,YAAY,GAAG;AAAA,MAC5D;AAAA,IACJ,CAAC;AACD,SAAK,OAAO;AAAA,MACR;AAAA,MACA,MAAM,KAAK,kBAAkB;AAAA,MAC7B,EAAE,OAAO;AAAA,IACb;AACA,SAAK,OAAO,iBAAiB,YAAY,MAAM,KAAK,eAAe,GAAG;AAAA,MAClE;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;",
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n InteractionController,\n InteractionTypes,\n SAFARI_FOCUS_RING_CLASS,\n} from './InteractionController.dev.js'\nimport { isWebKit } from '@spectrum-web-components/shared';\n\nexport class MobileController extends InteractionController {\n override type = InteractionTypes.mobile;\n\n handleClick(): void {\n if (this.host.disabled) {\n return;\n }\n if (this.preventNextToggle == 'no') {\n\n this.host.toggle();\n }\n this.preventNextToggle = 'no';\n }\n\n public override handlePointerdown(): void {\n this.preventNextToggle = this.open ? 'yes' : 'no';\n if (isWebKit()) {\n this.target.classList.add(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n private handleFocusOut(): void {\n if (this.host.open) {\n return;\n }\n if (\n isWebKit() &&\n this.target.classList.contains(SAFARI_FOCUS_RING_CLASS)\n ) {\n this.target.classList.remove(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener('click', () => this.handleClick(), {\n signal,\n });\n this.target.addEventListener(\n 'pointerdown',\n () => this.handlePointerdown(),\n { signal }\n );\n this.target.addEventListener('focusout', () => this.handleFocusOut(), {\n signal,\n });\n }\n}\n"],
5
+ "mappings": ";AAYA;AAAA,EACI;AAAA,EACA;AAAA,EACA;AAAA,OACG;AACP,SAAS,gBAAgB;AAElB,aAAM,yBAAyB,sBAAsB;AAAA,EAArD;AAAA;AACH,SAAS,OAAO,iBAAiB;AAAA;AAAA,EAEjC,cAAoB;AAChB,QAAI,KAAK,KAAK,UAAU;AACpB;AAAA,IACJ;AACA,QAAI,KAAK,qBAAqB,MAAM;AAEhC,WAAK,KAAK,OAAO;AAAA,IACrB;AACA,SAAK,oBAAoB;AAAA,EAC7B;AAAA,EAEgB,oBAA0B;AACtC,SAAK,oBAAoB,KAAK,OAAO,QAAQ;AAC7C,QAAI,SAAS,GAAG;AACZ,WAAK,OAAO,UAAU,IAAI,uBAAuB;AAAA,IACrD;AAAA,EACJ;AAAA,EAEQ,iBAAuB;AAC3B,QAAI,KAAK,KAAK,MAAM;AAChB;AAAA,IACJ;AACA,QACI,SAAS,KACT,KAAK,OAAO,UAAU,SAAS,uBAAuB,GACxD;AACE,WAAK,OAAO,UAAU,OAAO,uBAAuB;AAAA,IACxD;AAAA,EACJ;AAAA,EAES,OAAa;AApD1B;AAsDQ,eAAK,oBAAL,mBAAsB;AACtB,SAAK,kBAAkB,IAAI,gBAAgB;AAC3C,UAAM,EAAE,OAAO,IAAI,KAAK;AACxB,SAAK,OAAO,iBAAiB,SAAS,MAAM,KAAK,YAAY,GAAG;AAAA,MAC5D;AAAA,IACJ,CAAC;AACD,SAAK,OAAO;AAAA,MACR;AAAA,MACA,MAAM,KAAK,kBAAkB;AAAA,MAC7B,EAAE,OAAO;AAAA,IACb;AACA,SAAK,OAAO,iBAAiB,YAAY,MAAM,KAAK,eAAe,GAAG;AAAA,MAClE;AAAA,IACJ,CAAC;AAAA,EACL;AACJ;",
6
6
  "names": []
7
7
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["MobileController.ts"],
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\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 {\n InteractionController,\n InteractionTypes,\n SAFARI_FOCUS_RING_CLASS,\n} from './InteractionController.js';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\nexport class MobileController extends InteractionController {\n override type = InteractionTypes.mobile;\n\n handleClick(): void {\n if (this.host.disabled) {\n return;\n }\n if (this.preventNextToggle == 'no') {\n\n this.host.toggle();\n }\n this.preventNextToggle = 'no';\n }\n\n public override handlePointerdown(): void {\n this.preventNextToggle = this.open ? 'yes' : 'no';\n if (isWebKit()) {\n this.target.classList.add(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n private handleFocusOut(): void {\n if (this.host.open) {\n return;\n }\n if (\n isWebKit() &&\n this.target.classList.contains(SAFARI_FOCUS_RING_CLASS)\n ) {\n this.target.classList.remove(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener('click', () => this.handleClick(), {\n signal,\n });\n this.target.addEventListener(\n 'pointerdown',\n () => this.handlePointerdown(),\n { signal }\n );\n this.target.addEventListener('focusout', () => this.handleFocusOut(), {\n signal,\n });\n }\n}\n"],
5
- "mappings": "aAWA,OACI,yBAAAA,EACA,oBAAAC,EACA,2BAAAC,MACG,6BACP,OAAS,YAAAC,MAAgB,kCAElB,aAAM,yBAAyBH,CAAsB,CAArD,kCACH,KAAS,KAAOC,EAAiB,OAEjC,aAAoB,CACZ,KAAK,KAAK,WAGV,KAAK,mBAAqB,MAE1B,KAAK,KAAK,OAAO,EAErB,KAAK,kBAAoB,KAC7B,CAEgB,mBAA0B,CACtC,KAAK,kBAAoB,KAAK,KAAO,MAAQ,KACzCE,EAAS,GACT,KAAK,OAAO,UAAU,IAAID,CAAuB,CAEzD,CAEQ,gBAAuB,CACvB,KAAK,KAAK,MAIVC,EAAS,GACT,KAAK,OAAO,UAAU,SAASD,CAAuB,GAEtD,KAAK,OAAO,UAAU,OAAOA,CAAuB,CAE5D,CAES,MAAa,CAnD1B,IAAAE,GAqDQA,EAAA,KAAK,kBAAL,MAAAA,EAAsB,QACtB,KAAK,gBAAkB,IAAI,gBAC3B,KAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,gBACxB,KAAK,OAAO,iBAAiB,QAAS,IAAM,KAAK,YAAY,EAAG,CAC5D,OAAAA,CACJ,CAAC,EACD,KAAK,OAAO,iBACR,cACA,IAAM,KAAK,kBAAkB,EAC7B,CAAE,OAAAA,CAAO,CACb,EACA,KAAK,OAAO,iBAAiB,WAAY,IAAM,KAAK,eAAe,EAAG,CAClE,OAAAA,CACJ,CAAC,CACL,CACJ",
4
+ "sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n InteractionController,\n InteractionTypes,\n SAFARI_FOCUS_RING_CLASS,\n} from './InteractionController.js';\nimport { isWebKit } from '@spectrum-web-components/shared';\n\nexport class MobileController extends InteractionController {\n override type = InteractionTypes.mobile;\n\n handleClick(): void {\n if (this.host.disabled) {\n return;\n }\n if (this.preventNextToggle == 'no') {\n\n this.host.toggle();\n }\n this.preventNextToggle = 'no';\n }\n\n public override handlePointerdown(): void {\n this.preventNextToggle = this.open ? 'yes' : 'no';\n if (isWebKit()) {\n this.target.classList.add(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n private handleFocusOut(): void {\n if (this.host.open) {\n return;\n }\n if (\n isWebKit() &&\n this.target.classList.contains(SAFARI_FOCUS_RING_CLASS)\n ) {\n this.target.classList.remove(SAFARI_FOCUS_RING_CLASS);\n }\n }\n\n override init(): void {\n // Clean up listeners if they've already been bound\n this.abortController?.abort();\n this.abortController = new AbortController();\n const { signal } = this.abortController;\n this.target.addEventListener('click', () => this.handleClick(), {\n signal,\n });\n this.target.addEventListener(\n 'pointerdown',\n () => this.handlePointerdown(),\n { signal }\n );\n this.target.addEventListener('focusout', () => this.handleFocusOut(), {\n signal,\n });\n }\n}\n"],
5
+ "mappings": "aAYA,OACI,yBAAAA,EACA,oBAAAC,EACA,2BAAAC,MACG,6BACP,OAAS,YAAAC,MAAgB,kCAElB,aAAM,yBAAyBH,CAAsB,CAArD,kCACH,KAAS,KAAOC,EAAiB,OAEjC,aAAoB,CACZ,KAAK,KAAK,WAGV,KAAK,mBAAqB,MAE1B,KAAK,KAAK,OAAO,EAErB,KAAK,kBAAoB,KAC7B,CAEgB,mBAA0B,CACtC,KAAK,kBAAoB,KAAK,KAAO,MAAQ,KACzCE,EAAS,GACT,KAAK,OAAO,UAAU,IAAID,CAAuB,CAEzD,CAEQ,gBAAuB,CACvB,KAAK,KAAK,MAIVC,EAAS,GACT,KAAK,OAAO,UAAU,SAASD,CAAuB,GAEtD,KAAK,OAAO,UAAU,OAAOA,CAAuB,CAE5D,CAES,MAAa,CApD1B,IAAAE,GAsDQA,EAAA,KAAK,kBAAL,MAAAA,EAAsB,QACtB,KAAK,gBAAkB,IAAI,gBAC3B,KAAM,CAAE,OAAAC,CAAO,EAAI,KAAK,gBACxB,KAAK,OAAO,iBAAiB,QAAS,IAAM,KAAK,YAAY,EAAG,CAC5D,OAAAA,CACJ,CAAC,EACD,KAAK,OAAO,iBACR,cACA,IAAM,KAAK,kBAAkB,EAC7B,CAAE,OAAAA,CAAO,CACb,EACA,KAAK,OAAO,iBAAiB,WAAY,IAAM,KAAK,eAAe,EAAG,CAClE,OAAAA,CACJ,CAAC,CACL,CACJ",
6
6
  "names": ["InteractionController", "InteractionTypes", "SAFARI_FOCUS_RING_CLASS", "isWebKit", "_a", "signal"]
7
7
  }
package/src/Picker.d.ts CHANGED
@@ -1,3 +1,14 @@
1
+ /**
2
+ * Copyright 2025 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
1
12
  import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
13
  import { StyleInfo } from '@spectrum-web-components/base/src/directives.js';
3
14
  import type { Tooltip } from '@spectrum-web-components/tooltip';
package/src/Picker.dev.js CHANGED
@@ -72,7 +72,7 @@ export class PickerBase extends SizedMixin(SpectrumElement, {
72
72
  this.listRole = "listbox";
73
73
  this.itemRole = "option";
74
74
  this.handleEscape = (event) => {
75
- if (event.key === "Escape") {
75
+ if (event.key === "Escape" && this.open) {
76
76
  event.stopPropagation();
77
77
  event.preventDefault();
78
78
  this.toggle(false);