@phcdevworks/spectre-components 1.18.0 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1710,7 +1710,7 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
1710
1710
  }
1711
1711
  updated(changedProperties) {
1712
1712
  super.updated(changedProperties);
1713
- if ((changedProperties.has("checked") || changedProperties.has("name")) && this.checked && this.name) {
1713
+ if ((changedProperties.has("checked") || changedProperties.has("name") || changedProperties.has("form")) && this.checked && this.name) {
1714
1714
  this.syncGroup();
1715
1715
  }
1716
1716
  }
@@ -1722,8 +1722,9 @@ var SpectreRadioElement = class extends SpectreProjectableElement {
1722
1722
  const radios = root.querySelectorAll(
1723
1723
  "sp-radio"
1724
1724
  );
1725
+ const form = this.nativeInput?.form;
1725
1726
  radios.forEach((radio) => {
1726
- if (radio !== this && radio.name === this.name && radio.checked) {
1727
+ if (radio !== this && radio.name === this.name && radio.nativeInput?.form === form && radio.checked) {
1727
1728
  radio.checked = false;
1728
1729
  }
1729
1730
  });
@@ -3408,13 +3409,20 @@ var SpectreDropdownElement = class extends SpectreBaseElement {
3408
3409
  return false;
3409
3410
  }
3410
3411
  const el = node;
3411
- return el.hasAttribute("data-sp-dropdown-menu") || el.hasAttribute("data-sp-dropdown-trigger");
3412
+ return el.hasAttribute("data-sp-dropdown-native") || el.hasAttribute("data-sp-dropdown-menu") || el.hasAttribute("data-sp-dropdown-trigger");
3412
3413
  }
3413
3414
  syncProjectedContent() {
3414
3415
  const nextTriggerContent = [];
3415
3416
  const nextMenuContent = [];
3416
- this.childNodes.forEach((node) => {
3417
- if (this.isInternalNode(node)) {
3417
+ const sourceNodes = [
3418
+ ...this.triggerContent.filter((node) => this.contains(node)),
3419
+ ...this.menuContent.filter((node) => this.contains(node)),
3420
+ ...Array.from(this.childNodes).filter(
3421
+ (node) => !this.hasUpdated || node.nodeType !== Node.TEXT_NODE || node.textContent?.trim()
3422
+ )
3423
+ ];
3424
+ new Set(sourceNodes).forEach((node) => {
3425
+ if (node.nodeType === Node.COMMENT_NODE || this.isInternalNode(node)) {
3418
3426
  return;
3419
3427
  }
3420
3428
  const isTriggerSlot = node.nodeType === Node.ELEMENT_NODE && node.getAttribute("slot") === "trigger";
@@ -3527,6 +3535,7 @@ var SpectreDropdownElement = class extends SpectreBaseElement {
3527
3535
  render() {
3528
3536
  return html`<div
3529
3537
  class="${this.dropdownClasses}"
3538
+ data-sp-dropdown-native
3530
3539
  id="${ifDefined(this.id || void 0)}"
3531
3540
  title="${ifDefined(this.title || void 0)}"
3532
3541
  >
@@ -4757,8 +4766,15 @@ var SpectreTooltipElement = class extends SpectreBaseElement {
4757
4766
  syncProjectedContent() {
4758
4767
  const nextTooltipContent = [];
4759
4768
  const nextTriggerContent = [];
4760
- this.childNodes.forEach((node) => {
4761
- if (this.isInternalNode(node)) {
4769
+ const sourceNodes = [
4770
+ ...this.triggerContent.filter((node) => this.contains(node)),
4771
+ ...this.tooltipContent.filter((node) => this.contains(node)),
4772
+ ...Array.from(this.childNodes).filter(
4773
+ (node) => !this.hasUpdated || node.nodeType !== Node.TEXT_NODE || node.textContent?.trim()
4774
+ )
4775
+ ];
4776
+ new Set(sourceNodes).forEach((node) => {
4777
+ if (node.nodeType === Node.COMMENT_NODE || this.isInternalNode(node)) {
4762
4778
  return;
4763
4779
  }
4764
4780
  const isTooltipSlot = node.nodeType === Node.ELEMENT_NODE && node.getAttribute("slot") === "tooltip";