@nvidia-elements/forms 2.0.13 → 2.0.14

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/CHANGELOG.md CHANGED
@@ -1,3 +1,33 @@
1
+ ## [2.0.14](https://github.com/NVIDIA/elements/compare/@nvidia-elements/forms-v2.0.13...@nvidia-elements/forms-v2.0.14) (2026-11-16)
2
+
3
+ ### Features
4
+
5
+ * **core:** add dashboard ([83e5ced](https://github.com/NVIDIA/elements/commit/83e5ced893821ab74cad106473c92ecb04443949))
6
+ * **core:** iframe sandbox options ([849eb85](https://github.com/NVIDIA/elements/commit/849eb854b9f96692d2607f2db4aee62b7487b05f))
7
+ * **core:** support for grid virtual-list ([32fd01e](https://github.com/NVIDIA/elements/commit/32fd01e61b004bb07c0a54ce7cb6c747b09eaa55))
8
+ * **foundations:** add placement translation keys ([a3d4d53](https://github.com/NVIDIA/elements/commit/a3d4d5386df3c71e3d273c1175b140fab04efc9d))
9
+ * **foundations:** virtual-list ([aa4ef9e](https://github.com/NVIDIA/elements/commit/aa4ef9e20dd0ec9e4ce8a4be69c6678f11c86b12))
10
+ * **styles:** add text shimmer support ([c96b621](https://github.com/NVIDIA/elements/commit/c96b6215099331152632805a18d9638230cb3da6))
11
+
12
+ ### Bug Fixes
13
+
14
+ * **core:** drop obsolete panel transition prefix ([dead5e0](https://github.com/NVIDIA/elements/commit/dead5e0cc7cb0202e83f64cd8242755e06ac91db))
15
+ * **core:** drop obsolete progress appearance prefixes ([2192b3c](https://github.com/NVIDIA/elements/commit/2192b3c42e09842685e90c2ce5440b2005c9f7bb))
16
+ * **core:** drop obsolete scoped registry polyfill ([520e03b](https://github.com/NVIDIA/elements/commit/520e03b0244592f100edcfedc45ea2871d1cecc5))
17
+ * **core:** improve icon registry bundling performance ([64db7b9](https://github.com/NVIDIA/elements/commit/64db7b972645a624e11dd97249c49a6b0b2d60f7))
18
+ * **core:** improve workspace performance ([3a580b8](https://github.com/NVIDIA/elements/commit/3a580b889927a3df365f149b19a4de07bd69bc10))
19
+ * **core:** refactor to use foundations internals ([6405764](https://github.com/NVIDIA/elements/commit/6405764abcd16224406fdc57a811cd745ec54971))
20
+ * **core:** size overlays with the dynamic viewport ([3458d95](https://github.com/NVIDIA/elements/commit/3458d9566cbf6740ced6cdf9650296e0cadfe336))
21
+ * **forms:** use keydown for button active state ([486875c](https://github.com/NVIDIA/elements/commit/486875c082a15f2bc7a72a091759a93cfa3f8a2b))
22
+ * **foundations:** add shared decorator ([fa642a4](https://github.com/NVIDIA/elements/commit/fa642a4c81c7e0ec2f00d646452bcd7d595b1e34))
23
+ * **lint:** add new nve-text values ([80c106e](https://github.com/NVIDIA/elements/commit/80c106e33b4d057d2f5907882b490b4a46890742))
24
+ * **markdown:** update to use foundations internals ([33f1490](https://github.com/NVIDIA/elements/commit/33f149046c791aad70e35b439869fd4d05efe6ed))
25
+ * **media:** update icon imports ([7d95c48](https://github.com/NVIDIA/elements/commit/7d95c485bfbdaa180d858fc1ecf51941342e2cdf))
26
+ * **media:** update to use foundations internals ([24d2296](https://github.com/NVIDIA/elements/commit/24d2296596c18955cfe8723f0e1c67ccc53cbfeb))
27
+ * **pi:** update typebox to 1.4.6 ([e2635d1](https://github.com/NVIDIA/elements/commit/e2635d17980a706b044d9a3d814334de489aa72a))
28
+ * **starters:** update [@angular](https://github.com/angular) packages to 22.2.6 ([39be6b3](https://github.com/NVIDIA/elements/commit/39be6b3fbef2498f8898210bdc58d94ba2eb42d7))
29
+ * **viewport:** update to use foundations internals ([a5510ec](https://github.com/NVIDIA/elements/commit/a5510ec63d0933d0d8b245c6160e0b3bf2e1f1bc))
30
+
1
31
  ## [2.0.13](https://github.com/NVIDIA/elements/compare/@nvidia-elements/forms-v2.0.12...@nvidia-elements/forms-v2.0.13) (2026-11-07)
2
32
 
3
33
  ### Features
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/index.ts
2
- var e = "2.0.13";
2
+ var e = "2.0.14";
3
3
  export { e as VERSION };
4
4
 
5
5
  //# sourceMappingURL=index.js.map
@@ -5,10 +5,10 @@ var t = class {
5
5
  this.host = e, this.host.addController(this);
6
6
  }
7
7
  hostConnected() {
8
- e(this.host), this.host.addEventListener("keypress", this.#e), this.host.addEventListener("mousedown", this.#e), this.host.addEventListener("keyup", this.#t), this.host.addEventListener("blur", this.#t), this.host.addEventListener("mouseup", this.#t);
8
+ e(this.host), this.host.addEventListener("keydown", this.#e), this.host.addEventListener("mousedown", this.#e), this.host.addEventListener("keyup", this.#t), this.host.addEventListener("blur", this.#t), this.host.addEventListener("mouseup", this.#t);
9
9
  }
10
10
  hostDisconnected() {
11
- this.host.removeEventListener("keypress", this.#e), this.host.removeEventListener("mousedown", this.#e), this.host.removeEventListener("keyup", this.#t), this.host.removeEventListener("blur", this.#t), this.host.removeEventListener("mouseup", this.#t);
11
+ this.host.removeEventListener("keydown", this.#e), this.host.removeEventListener("mousedown", this.#e), this.host.removeEventListener("keyup", this.#t), this.host.removeEventListener("blur", this.#t), this.host.removeEventListener("mouseup", this.#t);
12
12
  }
13
13
  #e = (e) => {
14
14
  !this.host.disabled && this.#n(e) && this.host._internals.states.add("active"), e instanceof KeyboardEvent && e.code === "Space" && e.target === this.host && e.preventDefault();
@@ -1 +1 @@
1
- {"version":3,"file":"state-active.controller.js","names":["StateActiveController","host","attachInternals","#onActive","#onInactive","#isValidActiveEvent","event"],"sources":["../../../src/internal/controllers/state-active.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { attachInternals } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype Active = ReactiveElement & { disabled: boolean; _internals?: ElementInternals };\n\nexport class StateActiveController<T extends Active> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n this.host.addEventListener('keypress', this.#onActive as EventListener);\n this.host.addEventListener('mousedown', this.#onActive as EventListener);\n this.host.addEventListener('keyup', this.#onInactive);\n this.host.addEventListener('blur', this.#onInactive);\n this.host.addEventListener('mouseup', this.#onInactive);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keypress', this.#onActive as EventListener);\n this.host.removeEventListener('mousedown', this.#onActive as EventListener);\n this.host.removeEventListener('keyup', this.#onInactive);\n this.host.removeEventListener('blur', this.#onInactive);\n this.host.removeEventListener('mouseup', this.#onInactive);\n }\n\n #onActive = (event: KeyboardEvent | PointerEvent) => {\n if (!this.host.disabled && this.#isValidActiveEvent(event)) {\n this.host._internals!.states.add('active');\n }\n\n if (event instanceof KeyboardEvent && event.code === 'Space' && event.target === this.host) {\n event.preventDefault();\n }\n };\n\n #onInactive = () => {\n this.host._internals!.states.delete('active');\n };\n\n #isValidActiveEvent(event: KeyboardEvent | PointerEvent) {\n return event instanceof KeyboardEvent ? event.code === 'Space' || event.code === 'Enter' : true;\n }\n}\n"],"mappings":";;AAQA,IAAaA,IAAb,MAAmF;CACjF,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAMd,AALAC,EAAgB,KAAK,IAAI,GACzB,KAAK,KAAK,iBAAiB,YAAY,KAAKC,EAA0B,GACtE,KAAK,KAAK,iBAAiB,aAAa,KAAKA,EAA0B,GACvE,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAW,GACpD,KAAK,KAAK,iBAAiB,QAAQ,KAAKA,EAAW,GACnD,KAAK,KAAK,iBAAiB,WAAW,KAAKA,EAAW;CACxD;CAEA,mBAAmB;EAKjB,AAJA,KAAK,KAAK,oBAAoB,YAAY,KAAKD,EAA0B,GACzE,KAAK,KAAK,oBAAoB,aAAa,KAAKA,EAA0B,GAC1E,KAAK,KAAK,oBAAoB,SAAS,KAAKC,EAAW,GACvD,KAAK,KAAK,oBAAoB,QAAQ,KAAKA,EAAW,GACtD,KAAK,KAAK,oBAAoB,WAAW,KAAKA,EAAW;CAC3D;CAEA,MAAa,MAAwC;EAKnD,AAJI,CAAC,KAAK,KAAK,YAAY,KAAKC,GAAoBC,CAAK,KACvD,KAAK,KAAK,WAAY,OAAO,IAAI,QAAQ,GAGvCA,aAAiB,iBAAiBA,EAAM,SAAS,WAAWA,EAAM,WAAW,KAAK,QACpFA,EAAM,eAAe;CAEzB;CAEA,WAAoB;EAClB,KAAK,KAAK,WAAY,OAAO,OAAO,QAAQ;CAC9C;CAEA,GAAoB,GAAqC;EACvD,OAAOA,aAAiB,gBAAgBA,EAAM,SAAS,WAAWA,EAAM,SAAS,UAAU;CAC7F;AACF"}
1
+ {"version":3,"file":"state-active.controller.js","names":["StateActiveController","host","attachInternals","#onActive","#onInactive","#isValidActiveEvent","event"],"sources":["../../../src/internal/controllers/state-active.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport { attachInternals } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype Active = ReactiveElement & { disabled: boolean; _internals?: ElementInternals };\n\nexport class StateActiveController<T extends Active> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n attachInternals(this.host);\n this.host.addEventListener('keydown', this.#onActive as EventListener);\n this.host.addEventListener('mousedown', this.#onActive as EventListener);\n this.host.addEventListener('keyup', this.#onInactive);\n this.host.addEventListener('blur', this.#onInactive);\n this.host.addEventListener('mouseup', this.#onInactive);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('keydown', this.#onActive as EventListener);\n this.host.removeEventListener('mousedown', this.#onActive as EventListener);\n this.host.removeEventListener('keyup', this.#onInactive);\n this.host.removeEventListener('blur', this.#onInactive);\n this.host.removeEventListener('mouseup', this.#onInactive);\n }\n\n #onActive = (event: KeyboardEvent | PointerEvent) => {\n if (!this.host.disabled && this.#isValidActiveEvent(event)) {\n this.host._internals!.states.add('active');\n }\n\n if (event instanceof KeyboardEvent && event.code === 'Space' && event.target === this.host) {\n event.preventDefault();\n }\n };\n\n #onInactive = () => {\n this.host._internals!.states.delete('active');\n };\n\n #isValidActiveEvent(event: KeyboardEvent | PointerEvent) {\n return event instanceof KeyboardEvent ? event.code === 'Space' || event.code === 'Enter' : true;\n }\n}\n"],"mappings":";;AAQA,IAAaA,IAAb,MAAmF;CACjF,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EAMd,AALAC,EAAgB,KAAK,IAAI,GACzB,KAAK,KAAK,iBAAiB,WAAW,KAAKC,EAA0B,GACrE,KAAK,KAAK,iBAAiB,aAAa,KAAKA,EAA0B,GACvE,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAW,GACpD,KAAK,KAAK,iBAAiB,QAAQ,KAAKA,EAAW,GACnD,KAAK,KAAK,iBAAiB,WAAW,KAAKA,EAAW;CACxD;CAEA,mBAAmB;EAKjB,AAJA,KAAK,KAAK,oBAAoB,WAAW,KAAKD,EAA0B,GACxE,KAAK,KAAK,oBAAoB,aAAa,KAAKA,EAA0B,GAC1E,KAAK,KAAK,oBAAoB,SAAS,KAAKC,EAAW,GACvD,KAAK,KAAK,oBAAoB,QAAQ,KAAKA,EAAW,GACtD,KAAK,KAAK,oBAAoB,WAAW,KAAKA,EAAW;CAC3D;CAEA,MAAa,MAAwC;EAKnD,AAJI,CAAC,KAAK,KAAK,YAAY,KAAKC,GAAoBC,CAAK,KACvD,KAAK,KAAK,WAAY,OAAO,IAAI,QAAQ,GAGvCA,aAAiB,iBAAiBA,EAAM,SAAS,WAAWA,EAAM,WAAW,KAAK,QACpFA,EAAM,eAAe;CAEzB;CAEA,WAAoB;EAClB,KAAK,KAAK,WAAY,OAAO,OAAO,QAAQ;CAC9C;CAEA,GAAoB,GAAqC;EACvD,OAAOA,aAAiB,gBAAgBA,EAAM,SAAS,WAAWA,EAAM,SAAS,UAAU;CAC7F;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"type-popover-trigger.controller.js","names":["TypePopoverTriggerController","host","#onClick","popoverTargetElement","controllerResolvedTarget","#resolvedPopoverTarget","resolvedPopoverTarget","getFlattenedDOMTree","element","event","#resolvePopoverTarget","#invokePopover","#handoverInterest","getHostAnchor","source","#getPopoverSource","loseInterest"],"sources":["../../../src/internal/controllers/type-popover-trigger.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PopoverTargetAction } from '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('click', this.#onClick);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('click', this.#onClick);\n }\n\n #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement as PopoverAnchorElement);\n }\n\n return this.host as HTMLElement;\n }\n\n #invokePopover(popoverTargetElement: HTMLElement) {\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n return false;\n }\n\n const source = this.#getPopoverSource(popoverTargetElement);\n if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n\n return popoverTargetElement.matches(':popover-open');\n }\n\n #handoverInterest() {\n if (this.host.interestForElement) {\n const loseInterest = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n loseInterest.source = this.host;\n this.host.interestForElement.dispatchEvent(loseInterest);\n }\n }\n}\n"],"mappings":";;AAiBA,IAAaA,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAQ;CACnD;CAEA,mBAAmB;EACjB,KAAK,KAAK,oBAAoB,SAAS,KAAKA,EAAQ;CACtD;CAEA;CAEA,KAAwB;EACtB,IAAMC,IAAuB,KAAK,KAAK,sBACjCC,IAA2BD,MAAyB,KAAKE;EAE/D,IAAI,CAAC,KAAK,KAAK,aAAa,eAAe,GAOzC,OANA,KAAKA,KAAyB,KAAA,GAC1BD,KACF,KAAK,KAAK,uBAAuB,MAC1B,QAGFD;EAGT,IAAIA,KAAwB,CAACC,GAC3B,OAAOD;EAGT,IAAMG,IACJC,EAAoB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAC3C,MAAWC,EAAQ,OAAO,KAAK,KAAK,aAAa,eAAe,CAClE,KAAK;EAMP,OALIF,MAA0BH,MAC5B,KAAK,KAAK,uBAAuBG,IAEnC,KAAKD,KAAyBC,GAEvBA;CACT;CAEA,MAAY,MAAsB;EAChC,IAAIG,EAAM,oBAAoB,KAAK,KAAK,UACtC;EAGF,IAAMN,IAAuB,KAAKO,GAAsB;EACxD,AAAKP,KAID,KAAKQ,GAAeR,CAAoB,KAC1C,KAAKS,GAAkB;CAE3B;CAEA,GAAkB,GAAmC;EAKnD,OAJKT,EAA8C,SAC1CU,EAAcV,CAA4C,IAG5D,KAAK;CACd;CAEA,GAAe,GAAmC;EAChD,IAAI,KAAK,KAAK,wBAAwB,QAEpC,OADAA,EAAqB,YAAY,GAC1B;EAGT,IAAMW,IAAS,KAAKC,GAAkBZ,CAAoB;EAO1D,OANI,KAAK,KAAK,wBAAwB,SACpCA,EAAqB,YAAY,EAAE,UAAO,CAAC,IAE3CA,EAAqB,cAAc,EAAE,UAAO,CAAC,GAGxCA,EAAqB,QAAQ,eAAe;CACrD;CAEA,KAAoB;EAClB,IAAI,KAAK,KAAK,oBAAoB;GAChC,IAAMa,IAAe,IAAI,MAAM,gBAAgB,EAAE,YAAY,GAAK,CAAC;GAEnE,AADA,EAAa,SAAS,KAAK,MAC3B,KAAK,KAAK,mBAAmB,cAAcA,CAAY;EACzD;CACF;AACF"}
1
+ {"version":3,"file":"type-popover-trigger.controller.js","names":["TypePopoverTriggerController","host","#onClick","popoverTargetElement","controllerResolvedTarget","#resolvedPopoverTarget","resolvedPopoverTarget","getFlattenedDOMTree","element","event","#resolvePopoverTarget","#invokePopover","#handoverInterest","getHostAnchor","source","#getPopoverSource","loseInterest"],"sources":["../../../src/internal/controllers/type-popover-trigger.controller.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nimport type { PopoverTargetAction } from '../types/button.js';\nimport { getFlattenedDOMTree, getHostAnchor } from '../utils.js';\nimport type { PopoverAnchorElement } from '../utils.js';\nimport type { ReactiveController, ReactiveElement } from './types.js';\n\ntype InterestEvent = Event & { source: HTMLElement };\n\ntype PopoverTriggerHost = ReactiveElement & {\n disabled: boolean;\n interestForElement: HTMLElement | null;\n popoverTargetAction?: PopoverTargetAction;\n popoverTargetElement: HTMLElement | null;\n};\n\nexport class TypePopoverTriggerController<T extends PopoverTriggerHost> implements ReactiveController {\n constructor(private host: T) {\n this.host.addController(this);\n }\n\n hostConnected() {\n this.host.addEventListener('click', this.#onClick);\n }\n\n hostDisconnected() {\n this.host.removeEventListener('click', this.#onClick);\n }\n\n #resolvedPopoverTarget: HTMLElement | null | undefined;\n\n #resolvePopoverTarget() {\n const popoverTargetElement = this.host.popoverTargetElement;\n const controllerResolvedTarget = popoverTargetElement === this.#resolvedPopoverTarget;\n\n if (!this.host.getAttribute('popovertarget')) {\n this.#resolvedPopoverTarget = undefined;\n if (controllerResolvedTarget) {\n this.host.popoverTargetElement = null;\n return null;\n }\n\n return popoverTargetElement;\n }\n\n if (popoverTargetElement && !controllerResolvedTarget) {\n return popoverTargetElement;\n }\n\n const resolvedPopoverTarget =\n getFlattenedDOMTree(this.host.getRootNode()).find(\n element => element.id === this.host.getAttribute('popovertarget')\n ) ?? null;\n if (resolvedPopoverTarget !== popoverTargetElement) {\n this.host.popoverTargetElement = resolvedPopoverTarget;\n }\n this.#resolvedPopoverTarget = resolvedPopoverTarget;\n\n return resolvedPopoverTarget;\n }\n\n #onClick = (event: MouseEvent) => {\n if (event.defaultPrevented || this.host.disabled) {\n return;\n }\n\n const popoverTargetElement = this.#resolvePopoverTarget();\n if (!popoverTargetElement) {\n return;\n }\n\n if (this.#invokePopover(popoverTargetElement)) {\n this.#handoverInterest();\n }\n };\n\n #getPopoverSource(popoverTargetElement: HTMLElement) {\n if ((popoverTargetElement as PopoverAnchorElement).anchor) {\n return getHostAnchor(popoverTargetElement);\n }\n\n return this.host as HTMLElement;\n }\n\n #invokePopover(popoverTargetElement: HTMLElement) {\n if (this.host.popoverTargetAction === 'hide') {\n popoverTargetElement.hidePopover();\n return false;\n }\n\n const source = this.#getPopoverSource(popoverTargetElement);\n if (this.host.popoverTargetAction === 'show') {\n popoverTargetElement.showPopover({ source });\n } else {\n popoverTargetElement.togglePopover({ source });\n }\n\n return popoverTargetElement.matches(':popover-open');\n }\n\n #handoverInterest() {\n if (this.host.interestForElement) {\n const loseInterest = new Event('loseinterest', { cancelable: true }) as InterestEvent;\n loseInterest.source = this.host;\n this.host.interestForElement.dispatchEvent(loseInterest);\n }\n }\n}\n"],"mappings":";;AAiBA,IAAaA,IAAb,MAAsG;CACpG,YAAY,GAAiB;EAC3B,AADkB,KAAA,OAAAC,GAClB,KAAK,KAAK,cAAc,IAAI;CAC9B;CAEA,gBAAgB;EACd,KAAK,KAAK,iBAAiB,SAAS,KAAKC,EAAQ;CACnD;CAEA,mBAAmB;EACjB,KAAK,KAAK,oBAAoB,SAAS,KAAKA,EAAQ;CACtD;CAEA;CAEA,KAAwB;EACtB,IAAMC,IAAuB,KAAK,KAAK,sBACjCC,IAA2BD,MAAyB,KAAKE;EAE/D,IAAI,CAAC,KAAK,KAAK,aAAa,eAAe,GAOzC,OANA,KAAKA,KAAyB,KAAA,GAC1BD,KACF,KAAK,KAAK,uBAAuB,MAC1B,QAGFD;EAGT,IAAIA,KAAwB,CAACC,GAC3B,OAAOD;EAGT,IAAMG,IACJC,EAAoB,KAAK,KAAK,YAAY,CAAC,CAAC,CAAC,MAC3C,MAAWC,EAAQ,OAAO,KAAK,KAAK,aAAa,eAAe,CAClE,KAAK;EAMP,OALIF,MAA0BH,MAC5B,KAAK,KAAK,uBAAuBG,IAEnC,KAAKD,KAAyBC,GAEvBA;CACT;CAEA,MAAY,MAAsB;EAChC,IAAIG,EAAM,oBAAoB,KAAK,KAAK,UACtC;EAGF,IAAMN,IAAuB,KAAKO,GAAsB;EACxD,AAAKP,KAID,KAAKQ,GAAeR,CAAoB,KAC1C,KAAKS,GAAkB;CAE3B;CAEA,GAAkB,GAAmC;EAKnD,OAJKT,EAA8C,SAC1CU,EAAcV,CAAoB,IAGpC,KAAK;CACd;CAEA,GAAe,GAAmC;EAChD,IAAI,KAAK,KAAK,wBAAwB,QAEpC,OADAA,EAAqB,YAAY,GAC1B;EAGT,IAAMW,IAAS,KAAKC,GAAkBZ,CAAoB;EAO1D,OANI,KAAK,KAAK,wBAAwB,SACpCA,EAAqB,YAAY,EAAE,UAAO,CAAC,IAE3CA,EAAqB,cAAc,EAAE,UAAO,CAAC,GAGxCA,EAAqB,QAAQ,eAAe;CACrD;CAEA,KAAoB;EAClB,IAAI,KAAK,KAAK,oBAAoB;GAChC,IAAMa,IAAe,IAAI,MAAM,gBAAgB,EAAE,YAAY,GAAK,CAAC;GAEnE,AADA,EAAa,SAAS,KAAK,MAC3B,KAAK,KAAK,mBAAmB,cAAcA,CAAY;EACzD;CACF;AACF"}
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","names":["isObjectLiteral","item","proto","attachInternals","element","toggleState","force","internals","state","getFlattenedDOMTree","getChildren","node","p","i","depth","getHostAnchor","anchor","host","getStringValue","value","hasAttributeValue","attribute","isFormElement","removeEmptyTextNode","setAttributeValue","stopEvent","event","isDocumentNode","isElementWithShadowRoot","isSlotElement","slotted"],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals() as unknown as ElementInternals;\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgBA,EAAgB,GAAe;CAC7C,IAAI,CAACC,KAAQ,OAAOA,KAAS,YAAY,MAAM,QAAQA,CAAI,GACzD,OAAO;CAET,IAAMC,IAAQ,OAAO,eAAeD,CAAI;CACxC,OAAOC,MAAU,QAAQA,MAAU,OAAO;AAC5C;AAEA,SAAgBC,EAAgB,GAA0D;CAKxF,OAJIC,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAaA,EAAQ,gBAAgB,IAGxCA,EAAQ;AACjB;AAEA,SAAgBC,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAIC,IACFC,EAAU,OAAO,IAAIC,CAAK,IAE1BD,EAAU,OAAO,OAAOC,CAAK;AAEjC;AAIA,SAAgBC,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAKC,EAAYC,CAAI,CAAC,CAAC,CAAC,QAC3B,GAAc,MAAY,CACzB,GAAGC,GACH,CAAC,GAAG,CAAC,GAAG,MAAM,KAAKF,EAAY,CAAC,CAAC,CAAC,CAAC,KAAI,MAAK,CAACG,GAAGJ,E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B,EAAclB,CAAI,GAAG;EACvB,IAAMmB,IAAUnB,EAAK,iBAAiB;EACtC,OAAOmB,EAAQ,SAASA,IAAU,MAAM,KAAKnB,EAAK,QAAQ;CAC5D;CAEA,OAAO,MAAM,KAAMA,EAAqB,YAAY,CAAC,CAAC;AACxD;AAEA,SAASgB,EAAe,GAA8B;CACpD,OAAO,OAAO,WAAa,OAAehB,aAAgB,YAAY,EAAQA,EAAK;AACrF;AAEA,SAASiB,EAAwB,GAA8D;CAC7F,OAAO,OAAO,cAAgB,OAAejB,aAAgB,eAAe,EAAQA,EAAK;AAC3F;AAEA,SAASkB,EAAc,GAAqC;CAC1D,OAAO,OAAO,kBAAoB,OAAelB,aAAgB,mBAAmB,EAAQA,EAAK;AACnG"}
1
+ {"version":3,"file":"utils.js","names":["isObjectLiteral","item","proto","attachInternals","element","toggleState","force","internals","state","getFlattenedDOMTree","getChildren","node","p","i","depth","getHostAnchor","anchor","host","getStringValue","value","hasAttributeValue","attribute","isFormElement","removeEmptyTextNode","setAttributeValue","stopEvent","event","isDocumentNode","isElementWithShadowRoot","isSlotElement","slotted"],"sources":["../../src/internal/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\n// SPDX-License-Identifier: Apache-2.0\n\nexport function isObjectLiteral(item: unknown) {\n if (!item || typeof item !== 'object' || Array.isArray(item)) {\n return false;\n }\n const proto = Object.getPrototypeOf(item);\n return proto === null || proto === Object.prototype;\n}\n\nexport function attachInternals(element: HTMLElement & { _internals?: ElementInternals }) {\n if (element._internals === undefined) {\n element._internals = element.attachInternals();\n }\n\n return element._internals;\n}\n\nexport function toggleState(internals: ElementInternals, state: string, force: boolean) {\n if (force) {\n internals.states.add(state);\n } else {\n internals.states.delete(state);\n }\n}\n\nexport type PopoverAnchorElement = HTMLElement & { anchor?: HTMLElement | string };\n\nexport function getFlattenedDOMTree(node: Node, depth = 10): HTMLElement[] {\n return (\n Array.from(getChildren(node)).reduce(\n (p: unknown[], n: Node) => [\n ...p,\n [n, [...Array.from(getChildren(n)).map(i => [i, getFlattenedDOMTree(i, depth)])]]\n ],\n []\n ) as unknown as HTMLElement[]\n ).flat(depth);\n}\n\nexport function getHostAnchor(host: PopoverAnchorElement) {\n const anchor = host.anchor;\n\n if (typeof anchor === 'string' && anchor.length) {\n if (!host.parentNode) {\n return globalThis.document.body;\n }\n\n return (\n getFlattenedDOMTree(host.parentNode as Node).find(element => element.id === anchor) ?? globalThis.document.body\n );\n }\n\n if (anchor instanceof HTMLElement && anchor !== globalThis.document.body) {\n return anchor;\n }\n\n return globalThis.document.body;\n}\n\nexport function getStringValue(value: unknown) {\n if (typeof value === 'string' && value.length) {\n return value;\n }\n\n return value === '' ? '' : null;\n}\n\nexport function hasAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n return value === null ? !element.hasAttribute(attribute) : element.getAttribute(attribute) === value;\n}\n\nexport function isFormElement(value: unknown): value is HTMLFormElement {\n return typeof HTMLFormElement !== 'undefined' && value instanceof HTMLFormElement;\n}\n\nexport function removeEmptyTextNode(node: Node) {\n if ((node as Text)?.wholeText?.trim() === '') {\n node.parentNode?.removeChild(node);\n }\n}\n\nexport function setAttributeValue(element: HTMLElement, attribute: string, value: string | null) {\n if (value === null) {\n element.removeAttribute(attribute);\n } else {\n element.setAttribute(attribute, value);\n }\n}\n\nexport function stopEvent(event: Event) {\n event.preventDefault();\n event.stopPropagation();\n}\n\nfunction getChildren(node: Node): Element[] {\n if (isDocumentNode(node)) {\n return Array.from(node.documentElement.children);\n }\n\n if (isElementWithShadowRoot(node)) {\n return Array.from(node.shadowRoot.children);\n }\n\n if (isSlotElement(node)) {\n const slotted = node.assignedElements();\n return slotted.length ? slotted : Array.from(node.children);\n }\n\n return Array.from((node as HTMLElement).children ?? []);\n}\n\nfunction isDocumentNode(node: Node): node is Document {\n return typeof Document !== 'undefined' && node instanceof Document && Boolean(node.documentElement);\n}\n\nfunction isElementWithShadowRoot(node: Node): node is HTMLElement & { shadowRoot: ShadowRoot } {\n return typeof HTMLElement !== 'undefined' && node instanceof HTMLElement && Boolean(node.shadowRoot);\n}\n\nfunction isSlotElement(node: Node): node is HTMLSlotElement {\n return typeof HTMLSlotElement !== 'undefined' && node instanceof HTMLSlotElement && Boolean(node.assignedElements);\n}\n"],"mappings":";AAGA,SAAgBA,EAAgB,GAAe;CAC7C,IAAI,CAACC,KAAQ,OAAOA,KAAS,YAAY,MAAM,QAAQA,CAAI,GACzD,OAAO;CAET,IAAMC,IAAQ,OAAO,eAAeD,CAAI;CACxC,OAAOC,MAAU,QAAQA,MAAU,OAAO;AAC5C;AAEA,SAAgBC,EAAgB,GAA0D;CAKxF,OAJIC,EAAQ,eAAe,KAAA,MACzB,EAAQ,aAAaA,EAAQ,gBAAgB,IAGxCA,EAAQ;AACjB;AAEA,SAAgBC,EAAY,GAA6B,GAAe,GAAgB;CACtF,AAAIC,IACFC,EAAU,OAAO,IAAIC,CAAK,IAE1BD,EAAU,OAAO,OAAOC,CAAK;AAEjC;AAIA,SAAgBC,EAAoB,GAAY,IAAQ,IAAmB;CACzE,OACE,MAAM,KAAKC,EAAYC,CAAI,CAAC,CAAC,CAAC,QAC3B,GAAc,MAAY,CACzB,GAAGC,GACH,CAAC,GAAG,CAAC,GAAG,MAAM,KAAKF,EAAY,CAAC,CAAC,CAAC,CAAC,KAAI,MAAK,CAACG,GAAGJ,EAAoBI,GAAGC,CAAK,CAAC,CAAC,CAAC,CAAC,CAClF,GACA,CAAC,CACH,CAAC,CACD,KAAKA,CAAK;AACd;AAEA,SAAgBC,EAAc,GAA4B;CACxD,IAAMC,IAASC,EAAK;CAgBpB,OAdI,OAAOD,KAAW,YAAYA,EAAO,SAClCC,EAAK,aAKRR,EAAoBQ,EAAK,UAAkB,CAAC,CAAC,MAAK,MAAWb,EAAQ,OAAOY,CAAM,KAAK,WAAW,SAAS,OAJpG,WAAW,SAAS,OAQ3BA,aAAkB,eAAeA,MAAW,WAAW,SAA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,EAAK;AAC3F;AAEA,SAASkB,EAAc,GAAqC;CAC1D,OAAO,OAAO,kBAAoB,OAAelB,aAAgB,mBAAmB,EAAQA,EAAK;AACnG"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nvidia-elements/forms",
3
- "version": "2.0.13",
3
+ "version": "2.0.14",
4
4
  "release": {
5
5
  "extends": "../../release.config.js"
6
6
  },
@@ -85,16 +85,16 @@
85
85
  "sideEffects": [],
86
86
  "devDependencies": {
87
87
  "@eslint/js": "10.0.1",
88
- "@nvidia-elements/styles": "2.1.3",
88
+ "@nvidia-elements/styles": "2.2.0",
89
89
  "@internals/testing": "0.0.0",
90
90
  "@internals/eslint": "0.0.0",
91
91
  "@internals/vite": "0.0.0",
92
- "@nvidia-elements/lint": "2.9.1",
92
+ "@nvidia-elements/lint": "2.9.2",
93
93
  "@typescript/lib-dom": "npm:@types/web@0.0.312",
94
94
  "@vitest/browser": "5.1.0",
95
95
  "@vitest/coverage-istanbul": "5.1.0",
96
96
  "axe-core": "4.14.0",
97
- "eslint": "10.13.0",
97
+ "eslint": "10.14.0",
98
98
  "lit": "3.3.3",
99
99
  "publint": "0.3.25",
100
100
  "typescript": "6.0.3",