@adobe/spectrum-wc-core 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (157) hide show
  1. package/README.md +1 -1
  2. package/dist/components/accordion/Accordion.base.js +28 -22
  3. package/dist/components/accordion/Accordion.base.js.map +1 -1
  4. package/dist/components/accordion/AccordionItem.base.d.ts +16 -6
  5. package/dist/components/accordion/AccordionItem.base.js +6 -3
  6. package/dist/components/accordion/AccordionItem.base.js.map +1 -1
  7. package/dist/components/action-group/ActionGroup.base.d.ts +108 -0
  8. package/dist/components/action-group/ActionGroup.base.js +53 -0
  9. package/dist/components/action-group/ActionGroup.base.js.map +1 -0
  10. package/dist/components/action-group/ActionGroup.types.d.ts +17 -0
  11. package/dist/components/action-group/ActionGroup.types.js +12 -0
  12. package/dist/components/action-group/ActionGroup.types.js.map +1 -0
  13. package/dist/components/action-group/index.d.ts +13 -0
  14. package/dist/components/action-group/index.js +3 -0
  15. package/dist/components/alert-banner/AlertBanner.base.js +11 -10
  16. package/dist/components/alert-banner/AlertBanner.base.js.map +1 -1
  17. package/dist/components/asset/Asset.base.d.ts +89 -10
  18. package/dist/components/asset/Asset.base.js +117 -12
  19. package/dist/components/asset/Asset.base.js.map +1 -1
  20. package/dist/components/asset/Asset.types.d.ts +20 -2
  21. package/dist/components/asset/Asset.types.js +10 -2
  22. package/dist/components/asset/Asset.types.js.map +1 -1
  23. package/dist/components/asset/index.js +3 -3
  24. package/dist/components/avatar/Avatar.base.js +18 -22
  25. package/dist/components/avatar/Avatar.base.js.map +1 -1
  26. package/dist/components/badge/Badge.base.d.ts +24 -8
  27. package/dist/components/badge/Badge.base.js +22 -17
  28. package/dist/components/badge/Badge.base.js.map +1 -1
  29. package/dist/components/button/Button.base.d.ts +20 -10
  30. package/dist/components/button/Button.base.js +17 -12
  31. package/dist/components/button/Button.base.js.map +1 -1
  32. package/dist/components/button-group/ButtonGroup.base.js +19 -12
  33. package/dist/components/button-group/ButtonGroup.base.js.map +1 -1
  34. package/dist/components/card/Card.base.d.ts +95 -46
  35. package/dist/components/card/Card.base.js +71 -23
  36. package/dist/components/card/Card.base.js.map +1 -1
  37. package/dist/components/card/Card.types.d.ts +1 -0
  38. package/dist/components/card/Card.types.js +2 -2
  39. package/dist/components/card/Card.types.js.map +1 -1
  40. package/dist/components/card/index.js +3 -3
  41. package/dist/components/divider/Divider.base.js +13 -8
  42. package/dist/components/divider/Divider.base.js.map +1 -1
  43. package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
  44. package/dist/components/dropzone/Dropzone.base.js +82 -0
  45. package/dist/components/dropzone/Dropzone.base.js.map +1 -0
  46. package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
  47. package/dist/components/dropzone/Dropzone.types.js +15 -0
  48. package/dist/components/dropzone/Dropzone.types.js.map +1 -0
  49. package/dist/components/dropzone/index.d.ts +13 -0
  50. package/dist/components/dropzone/index.js +3 -0
  51. package/dist/components/icon/Icon.base.d.ts +11 -7
  52. package/dist/components/icon/Icon.base.js +13 -20
  53. package/dist/components/icon/Icon.base.js.map +1 -1
  54. package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +22 -8
  55. package/dist/components/illustrated-message/IllustratedMessage.base.js +33 -20
  56. package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -1
  57. package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
  58. package/dist/components/infield-button/InfieldButton.base.js +22 -0
  59. package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
  60. package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
  61. package/dist/components/infield-button/InfieldButton.types.js +11 -0
  62. package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
  63. package/dist/components/infield-button/index.d.ts +13 -0
  64. package/dist/components/infield-button/index.js +3 -0
  65. package/dist/components/meter/Meter.base.js +11 -9
  66. package/dist/components/meter/Meter.base.js.map +1 -1
  67. package/dist/components/popover/Popover.base.d.ts +1 -21
  68. package/dist/components/popover/Popover.base.js +57 -77
  69. package/dist/components/popover/Popover.base.js.map +1 -1
  70. package/dist/components/progress-circle/ProgressCircle.base.d.ts +0 -1
  71. package/dist/components/progress-circle/ProgressCircle.base.js +26 -22
  72. package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -1
  73. package/dist/components/status-light/StatusLight.base.d.ts +1 -1
  74. package/dist/components/status-light/StatusLight.base.js +12 -9
  75. package/dist/components/status-light/StatusLight.base.js.map +1 -1
  76. package/dist/components/tabs/TabPanel.base.d.ts +1 -1
  77. package/dist/components/tabs/TabPanel.base.js.map +1 -1
  78. package/dist/components/tabs/Tabs.base.js +44 -32
  79. package/dist/components/tabs/Tabs.base.js.map +1 -1
  80. package/dist/components/tooltip/Tooltip.base.js +57 -22
  81. package/dist/components/tooltip/Tooltip.base.js.map +1 -1
  82. package/dist/controllers/color-controller/src/color-controller.js +45 -44
  83. package/dist/controllers/color-controller/src/color-controller.js.map +1 -1
  84. package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
  85. package/dist/controllers/drag-and-drop-controller/index.js +2 -0
  86. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
  87. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
  88. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
  89. package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.d.ts +1 -1
  90. package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js.map +1 -1
  91. package/dist/controllers/index.d.ts +6 -2
  92. package/dist/controllers/index.js +15 -11
  93. package/dist/controllers/language-resolution.d.ts +1 -1
  94. package/dist/controllers/language-resolution.js.map +1 -1
  95. package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
  96. package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
  97. package/dist/controllers/{page-scroll-lock.js → page-scroll-lock-controller/src/page-scroll-lock.js} +1 -1
  98. package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
  99. package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
  100. package/dist/controllers/slot-presence-controller/index.js +2 -0
  101. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
  102. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
  103. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
  104. package/dist/controllers/slot-text-controller/index.d.ts +12 -0
  105. package/dist/controllers/slot-text-controller/index.js +2 -0
  106. package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
  107. package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
  108. package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
  109. package/dist/controllers/trigger-press-controller/index.d.ts +12 -0
  110. package/dist/controllers/trigger-press-controller/index.js +2 -0
  111. package/dist/controllers/trigger-press-controller/src/trigger-press-controller.d.ts +149 -0
  112. package/dist/controllers/trigger-press-controller/src/trigger-press-controller.js +43 -0
  113. package/dist/controllers/trigger-press-controller/src/trigger-press-controller.js.map +1 -0
  114. package/dist/directives/index.d.ts +1 -1
  115. package/dist/element/define-element.js +1 -1
  116. package/dist/element/define-element.js.map +1 -1
  117. package/dist/element/index.d.ts +1 -1
  118. package/dist/element/index.js +2 -2
  119. package/dist/element/spectrum-element.d.ts +58 -15
  120. package/dist/element/spectrum-element.js +56 -37
  121. package/dist/element/spectrum-element.js.map +1 -1
  122. package/dist/element/version.d.ts +3 -3
  123. package/dist/element/version.js +1 -1
  124. package/dist/element/version.js.map +1 -1
  125. package/dist/mixins/index.d.ts +0 -2
  126. package/dist/mixins/index.js +4 -6
  127. package/dist/mixins/linear-progress-mixin.d.ts +1 -2
  128. package/dist/mixins/linear-progress-mixin.js +35 -34
  129. package/dist/mixins/linear-progress-mixin.js.map +1 -1
  130. package/dist/mixins/pending-mixin.js +12 -11
  131. package/dist/mixins/pending-mixin.js.map +1 -1
  132. package/dist/mixins/sized-mixin.d.ts +28 -0
  133. package/dist/mixins/sized-mixin.js +6 -6
  134. package/dist/mixins/sized-mixin.js.map +1 -1
  135. package/dist/utils/dev-validation.d.ts +88 -0
  136. package/dist/utils/dev-validation.js +33 -0
  137. package/dist/utils/dev-validation.js.map +1 -0
  138. package/dist/utils/index.d.ts +2 -0
  139. package/dist/utils/index.js +12 -10
  140. package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
  141. package/dist/utils/is-focus-visible-in-tree.js +11 -0
  142. package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
  143. package/dist/utils/resolve-trigger.js.map +1 -1
  144. package/package.json +213 -18
  145. package/CHANGELOG.md +0 -125
  146. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/defineProperty.js +0 -12
  147. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPrimitive.js +0 -14
  148. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPropertyKey.js +0 -9
  149. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/typeof.js +0 -11
  150. package/dist/controllers/page-scroll-lock.js.map +0 -1
  151. package/dist/mixins/observe-slot-presence.d.ts +0 -12
  152. package/dist/mixins/observe-slot-presence.js +0 -40
  153. package/dist/mixins/observe-slot-presence.js.map +0 -1
  154. package/dist/mixins/observe-slot-text.d.ts +0 -11
  155. package/dist/mixins/observe-slot-text.js +0 -60
  156. package/dist/mixins/observe-slot-text.js.map +0 -1
  157. /package/dist/controllers/{page-scroll-lock.d.ts → page-scroll-lock-controller/src/page-scroll-lock.d.ts} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"Badge.base.js","names":[],"sources":["../../../components/badge/Badge.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { ObserveSlotPresence } from '@adobe/spectrum-wc-core/mixins/observe-slot-presence.js';\nimport { ObserveSlotText } from '@adobe/spectrum-wc-core/mixins/observe-slot-text.js';\n\nimport {\n BADGE_VALID_SIZES,\n BADGE_VARIANTS_SEMANTIC,\n type BadgeSize,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.js';\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n *\n * @todo review the mixin composition here. We currently have 3 levels of mixins on this class, but the mixin composition guide recommends a maximum of 2.\n */\nexport abstract class BadgeBase extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n {\n validSizes: BADGE_VALID_SIZES,\n defaultSize: 's',\n }\n) {\n /**\n * The size of the badge.\n *\n * @default s\n */\n declare public size: BadgeSize;\n\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different color variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n *\n * This is a public property, but its valid values vary between S1 and S2,\n * so the property (and its docs) need to be redefined in each subclass.\n *\n * The type declared here is a union of the valid values for S1 and S2,\n * and should be narrowed in each subclass.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'neutral';\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ type: String, reflect: true })\n public fixed?: FixedValues;\n\n /**\n * Whether the badge is subtle.\n */\n @property({ type: Boolean, reflect: true })\n public subtle: boolean = false;\n\n /**\n * Whether the badge is outlined.\n *\n * Can only be used with semantic variants.\n */\n @property({ type: Boolean, reflect: true })\n public outline: boolean = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n *\n * Used for rendering gap when the badge has an icon.\n */\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof BadgeBase;\n if (!constructor.VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS],\n }\n );\n }\n // Check outline property if it exists (S2 only)\n if (\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant)\n ) {\n window.__swc.warn(\n this,\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...constructor.VARIANTS_SEMANTIC],\n }\n );\n }\n }\n super.update(changedProperties);\n }\n}\n"],"mappings":";;;;;;;;OAuCsB,IAAtB,cAAwC,EACtC,EAAgB,EAAoB,GAAiB,kBAAgB,EAAE,GAAG,EAC1E;CACE,YAAY;CACZ,aAAa;CACd,CACF,CAAC;;8BAkD+B,yBA2BN,mBAQC;;CAW1B,IAAc,UAAmB;AAC/B,SAAO,KAAK;;CAGd,OAA0B,GAAyC;;AACjE,OAAA,IAAI,OAAO,UAAA,QAAA,EAAO,OAAO;GACvB,IAAM,IAAc,KAAK;AAYzB,GAXK,EAAY,SAAS,SAAS,KAAK,QAAQ,IAC9C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,wEACnB,mFACA,EACE,QAAQ,CAAC,GAAG,EAAY,SAAS,EAClC,CACF,EAID,aAAa,QACZ,KAA8B,YAAY,MAC3C,CAAC,EAAY,kBAAkB,SAAS,KAAK,QAAQ,IAErD,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,0FACnB,mFACA,EACE,QAAQ,CAAC,GAAG,EAAY,kBAAkB,EAC3C,CACF;;AAGL,QAAM,OAAO,EAAkB;;;wBAtEiB,yBAMhD,MAhBD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAqBzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAMzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,UAAA,KAAA,EAAA,KAQ1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"Badge.base.js","names":[],"sources":["../../../components/badge/Badge.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 */\nimport { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { validateEnum, warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n BADGE_VALID_SIZES,\n BADGE_VARIANTS_SEMANTIC,\n type BadgeSize,\n type BadgeVariant,\n FIXED_VALUES,\n type FixedValues,\n} from './Badge.types.js';\n\n/**\n * A badge component that displays short, descriptive information about an element.\n * Badges are typically used to indicate status, categories, or provide supplementary information.\n *\n * @attribute {ElementSize} size - The size of the badge.\n *\n * @slot - Text label of the badge.\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport abstract class BadgeBase extends SizedMixin(SpectrumElement, {\n validSizes: BADGE_VALID_SIZES,\n defaultSize: 's',\n}) {\n /**\n * The size of the badge.\n *\n * @default s\n */\n declare public size: BadgeSize;\n\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of the valid color variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different color variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS_COLOR: readonly string[];\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the badge.\n *\n * This is an actual internal property, intended not for customer use\n * but for use in internal validation logic, stories, tests, etc.\n *\n * Because S1 and S2 support different variants, the value of this\n * property must be set in each subclass.\n */\n static readonly VARIANTS: readonly string[];\n\n /**\n * @internal\n *\n * The variant of the badge.\n *\n * This is a public property, but its valid values vary between S1 and S2,\n * so the property (and its docs) need to be redefined in each subclass.\n *\n * The type declared here is a union of the valid values for S1 and S2,\n * and should be narrowed in each subclass.\n */\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'neutral';\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n */\n static readonly FIXED_VALUES: readonly string[] = FIXED_VALUES;\n\n /**\n * @internal\n */\n static readonly VARIANTS_SEMANTIC: readonly string[] =\n BADGE_VARIANTS_SEMANTIC;\n\n /**\n * The fixed position of the badge.\n */\n @property({ type: String, reflect: true })\n public fixed?: FixedValues;\n\n /**\n * Whether the badge is subtle.\n */\n @property({ type: Boolean, reflect: true })\n public subtle: boolean = false;\n\n /**\n * Whether the badge is outlined.\n *\n * Can only be used with semantic variants.\n */\n @property({ type: Boolean, reflect: true })\n public outline: boolean = false;\n\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether an icon is slotted into `[slot=\"icon\"]`.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"icon\"]');\n\n /**\n * Observes whether the default slot has meaningful text content. The default\n * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes\n * after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * @internal\n *\n * Used for rendering gap when the badge has an icon.\n */\n protected get hasIcon(): boolean {\n return this.slotPresence.isPresent;\n }\n\n /**\n * Whether the default slot has meaningful text content. Consumed by the\n * concrete element's `render()` to toggle icon-only presentation (the\n * `swc-Badge--no-label` class and its icon-only padding tokens).\n *\n * @internal\n */\n protected get slotHasContent(): boolean {\n return this.slotText.hasContent;\n }\n\n protected override update(changedProperties: PropertyValues): void {\n const constructor = this.constructor as typeof BadgeBase;\n validateEnum(this, {\n prop: 'variant',\n value: this.variant,\n valid: constructor.VARIANTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',\n });\n // Check outline property if it exists (S2 only)\n warnIf(\n this,\n 'outline' in this &&\n (this as { outline: boolean }).outline === true &&\n !constructor.VARIANTS_SEMANTIC.includes(this.variant),\n `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs',\n { issues: [...constructor.VARIANTS_SEMANTIC] }\n );\n super.update(changedProperties);\n }\n}\n"],"mappings":";;;;;;;;;OAsCsB,IAAtB,cAAwC,EAAW,GAAiB;CAClE,YAAY;CACZ,aAAa;CACd,CAAC,CAAC;;8BAkD8B,yBA2BN,mBAQC,wBAWD,IAAI,EAAuB,MAAM,kBAAgB,kBASrD,IAAI,EAAmB,KAAK;;CAWjD,IAAc,UAAmB;AAC/B,SAAO,KAAK,aAAa;;CAU3B,IAAc,iBAA0B;AACtC,SAAO,KAAK,SAAS;;CAGvB,OAA0B,GAAyC;EACjE,IAAM,IAAc,KAAK;AAiBzB,EAhBA,EAAa,MAAM;GACjB,MAAM;GACN,OAAO,KAAK;GACZ,OAAO,EAAY;GACnB,KAAK;GACN,CAAC,EAEF,EACE,MACA,aAAa,QACV,KAA8B,YAAY,MAC3C,CAAC,EAAY,kBAAkB,SAAS,KAAK,QAAQ,EACvD,IAAI,KAAK,UAAU,0FACnB,gFACA,EAAE,QAAQ,CAAC,GAAG,EAAY,kBAAkB,EAAE,CAC/C,EACD,MAAM,OAAO,EAAkB;;;wBA1FiB,yBAMhD,MAhBD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAqBzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAMzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,UAAA,KAAA,EAAA,KAQ1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
@@ -1,13 +1,9 @@
1
1
  import { PropertyValues } from 'lit';
2
+ import { SlotPresenceController } from '../../controllers/slot-presence-controller/index.js';
3
+ import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
2
4
  import { SpectrumElement } from '../../element/index.js';
3
5
  import { ButtonSize } from './Button.types.js';
4
6
  declare const ButtonBase_base: typeof SpectrumElement & {
5
- new (...args: any[]): import('../../mixins/index.js').SlotPresenceObservingInterface;
6
- prototype: import('../../mixins/index.js').SlotPresenceObservingInterface;
7
- } & {
8
- new (...args: any[]): import('../../mixins/index.js').SlotTextObservingInterface;
9
- prototype: import('../../mixins/index.js').SlotTextObservingInterface;
10
- } & {
11
7
  new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
12
8
  prototype: import('../../mixins/index.js').SizedElementInterface;
13
9
  } & import('../../mixins/index.js').SizedElementConstructor;
@@ -22,9 +18,6 @@ declare const ButtonBase_base: typeof SpectrumElement & {
22
18
  * the `swc-button` visual surface.
23
19
  *
24
20
  * @attribute {ElementSize} size - The size of the button.
25
- *
26
- * @todo We currently have 3 levels of mixins on this class, but the mixin
27
- * composition guide recommends a maximum of 2. Explore reducing after milestone 2.
28
21
  */
29
22
  export declare abstract class ButtonBase extends ButtonBase_base {
30
23
  static shadowRootOptions: ShadowRootInit;
@@ -44,6 +37,20 @@ export declare abstract class ButtonBase extends ButtonBase_base {
44
37
  * `aria-label`. Required for icon-only buttons, which have no visible text.
45
38
  */
46
39
  accessibleLabel?: string;
40
+ /**
41
+ * Observes whether an icon is slotted into `[slot="icon"]`.
42
+ *
43
+ * @internal
44
+ */
45
+ protected slotPresence: SlotPresenceController;
46
+ /**
47
+ * Observes whether the default slot has a meaningful text label. The default
48
+ * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes
49
+ * after the first render to be tracked.
50
+ *
51
+ * @internal
52
+ */
53
+ protected slotText: SlotTextController;
47
54
  protected get hasIcon(): boolean;
48
55
  protected get hasLabel(): boolean;
49
56
  /**
@@ -56,7 +63,10 @@ export declare abstract class ButtonBase extends ButtonBase_base {
56
63
  connectedCallback(): void;
57
64
  disconnectedCallback(): void;
58
65
  /**
59
- * Suppresses click activation while the button is `disabled`.
66
+ * Suppresses click activation while the button is `disabled`, or externally
67
+ * marked `aria-disabled` (e.g. by a disabled parent `swc-action-group`,
68
+ * which uses `aria-disabled` instead of native `disabled` so children
69
+ * remain keyboard-reachable).
60
70
  *
61
71
  * Slotted icon content lives in the light DOM, so pointer clicks on icons
62
72
  * bypass the disabled inner `<button>` and bubble on the host. The host
@@ -2,19 +2,22 @@ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/he
2
2
  import { BUTTON_VALID_SIZES as t } from "./Button.types.js";
3
3
  import { property as n } from "lit/decorators.js";
4
4
  import { SpectrumElement as r } from "@adobe/spectrum-wc-core/element/index.js";
5
- import { ObserveSlotPresence as i, ObserveSlotText as a, SizedMixin as o } from "@adobe/spectrum-wc-core/mixins/index.js";
5
+ import { SizedMixin as i } from "@adobe/spectrum-wc-core/mixins/index.js";
6
+ import { warnIf as a } from "@adobe/spectrum-wc-core/utils/index.js";
7
+ import { SlotPresenceController as o } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
8
+ import { SlotTextController as s } from "@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js";
6
9
  //#region components/button/Button.base.ts
7
- var s, c = class extends o(a(i(r, "[slot=\"icon\"]"), ""), { validSizes: t }) {
10
+ var c, l = class extends i(r, { validSizes: t }) {
8
11
  constructor(...e) {
9
- super(...e), this.disabled = !1, this.handleClick = (e) => {
10
- this.disabled && (e.preventDefault(), e.stopImmediatePropagation());
12
+ super(...e), this.disabled = !1, this.slotPresence = new o(this, "[slot=\"icon\"]"), this.slotText = new s(this), this.handleClick = (e) => {
13
+ (this.disabled || this.getAttribute("aria-disabled") === "true") && (e.preventDefault(), e.stopImmediatePropagation());
11
14
  };
12
15
  }
13
16
  get hasIcon() {
14
- return this.slotContentIsPresent;
17
+ return this.slotPresence.isPresent;
15
18
  }
16
19
  get hasLabel() {
17
- return this.slotHasContent;
20
+ return this.slotText.hasContent;
18
21
  }
19
22
  getForwardedButtonAttributes() {
20
23
  return { disabled: this.disabled };
@@ -26,21 +29,23 @@ var s, c = class extends o(a(i(r, "[slot=\"icon\"]"), ""), { validSizes: t }) {
26
29
  this.removeEventListener("click", this.handleClick, !0), super.disconnectedCallback();
27
30
  }
28
31
  update(e) {
29
- var t;
30
- super.update(e), (t = window.__swc) != null && t.DEBUG && this.hasIcon && !this.hasLabel && !this.accessibleLabel && window.__swc.warn(this, `<${this.localName}> with an icon and no label must have an "accessible-label" attribute to be accessible.`, "https://opensource.adobe.com/spectrum-web-components/components/button/#icon-only", { issues: ["accessible-label"] });
32
+ super.update(e), a(this, this.hasIcon && !this.hasLabel && !this.accessibleLabel, `<${this.localName}> with an icon and no label must have an "accessible-label" attribute to be accessible.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-button--docs", {
33
+ type: "accessibility",
34
+ issues: ["accessible-label"]
35
+ });
31
36
  }
32
37
  };
33
- s = c, s.shadowRootOptions = {
38
+ c = l, c.shadowRootOptions = {
34
39
  ...r.shadowRootOptions,
35
40
  delegatesFocus: !0
36
41
  }, e([n({
37
42
  type: Boolean,
38
43
  reflect: !0
39
- })], c.prototype, "disabled", void 0), e([n({
44
+ })], l.prototype, "disabled", void 0), e([n({
40
45
  type: String,
41
46
  attribute: "accessible-label"
42
- })], c.prototype, "accessibleLabel", void 0);
47
+ })], l.prototype, "accessibleLabel", void 0);
43
48
  //#endregion
44
- export { c as ButtonBase };
49
+ export { l as ButtonBase };
45
50
 
46
51
  //# sourceMappingURL=Button.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Button.base.js","names":[],"sources":["../../../components/button/Button.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport {\n ObserveSlotPresence,\n ObserveSlotText,\n SizedMixin,\n} from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport { BUTTON_VALID_SIZES, type ButtonSize } from './Button.types.js';\n\n/**\n * Abstract base class for all button-like components. Owns shared semantic\n * concerns: interaction state, sizing, slot-derived icon/label state,\n * accessible-name resolution, and host-to-internal-button attribute forwarding.\n *\n * Visual API specific to `sp-button` (`variant`, `fill-style`, `static-color`)\n * is intentionally absent so that ActionButton, ClearButton, CloseButton,\n * PickerButton, and InfieldButton can extend this base without inheriting\n * the `swc-button` visual surface.\n *\n * @attribute {ElementSize} size - The size of the button.\n *\n * @todo We currently have 3 levels of mixins on this class, but the mixin\n * composition guide recommends a maximum of 2. Explore reducing after milestone 2.\n */\nexport abstract class ButtonBase extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n { validSizes: BUTTON_VALID_SIZES }\n) {\n static override shadowRootOptions: ShadowRootInit = {\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * The size of the button.\n *\n * @default m\n */\n declare public size: ButtonSize;\n\n /**\n * Whether the button is disabled. Removes focusability and prevents\n * interaction.\n */\n @property({ type: Boolean, reflect: true })\n public disabled: boolean = false;\n\n /**\n * Accessible label forwarded to the internal `<button>` element as\n * `aria-label`. Required for icon-only buttons, which have no visible text.\n */\n @property({ type: String, attribute: 'accessible-label' })\n public accessibleLabel?: string;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected get hasLabel(): boolean {\n return this.slotHasContent;\n }\n\n /**\n * Returns the set of attributes that should be forwarded to the internal\n * semantic `<button>` element, if not otherwise directly managed.\n *\n * @internal\n */\n protected getForwardedButtonAttributes(): Record<\n string,\n string | boolean | undefined\n > {\n return {\n disabled: this.disabled,\n };\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // Capture phase so slotted light-DOM clicks are suppressed before host\n // listeners (e.g. Storybook actions) run.\n this.addEventListener('click', this.handleClick, true);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.handleClick, true);\n super.disconnectedCallback();\n }\n\n /**\n * Suppresses click activation while the button is `disabled`.\n *\n * Slotted icon content lives in the light DOM, so pointer clicks on icons\n * bypass the disabled inner `<button>` and bubble on the host. The host\n * listener (capture) and inner `@click` binding both call this handler.\n */\n protected readonly handleClick = (event: Event): void => {\n if (this.disabled) {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n protected override update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n if (window.__swc?.DEBUG) {\n if (this.hasIcon && !this.hasLabel && !this.accessibleLabel) {\n window.__swc.warn(\n this,\n `<${this.localName}> with an icon and no label must have an \"accessible-label\" attribute to be accessible.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button/#icon-only',\n { issues: ['accessible-label'] }\n );\n }\n }\n }\n}\n"],"mappings":";;;;;;OAuCsB,IAAtB,cAAyC,EACvC,EAAgB,EAAoB,GAAiB,kBAAgB,EAAE,GAAG,EAC1E,EAAE,YAAY,GAAoB,CACnC,CAAC;;+BAsB2B,wBAuDO,MAAuB;AACvD,GAAI,KAAK,aACP,EAAM,gBAAgB,EACtB,EAAM,0BAA0B;;;CA7CpC,IAAc,UAAmB;AAC/B,SAAO,KAAK;;CAGd,IAAc,WAAoB;AAChC,SAAO,KAAK;;CASd,+BAGE;AACA,SAAO,EACL,UAAU,KAAK,UAChB;;CAGH,oBAA0C;AAIxC,EAHA,MAAM,mBAAmB,EAGzB,KAAK,iBAAiB,SAAS,KAAK,aAAa,GAAK;;CAGxD,uBAA6C;AAE3C,EADA,KAAK,oBAAoB,SAAS,KAAK,aAAa,GAAK,EACzD,MAAM,sBAAsB;;CAiB9B,OAA0B,GAAyC;;AAEjE,EADA,MAAM,OAAO,EAAkB,GAC/B,IAAI,OAAO,UAAA,QAAA,EAAO,SACZ,KAAK,WAAW,CAAC,KAAK,YAAY,CAAC,KAAK,mBAC1C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,0FACnB,qFACA,EAAE,QAAQ,CAAC,mBAAmB,EAAE,CACjC;;;6BA5F6C;CAClD,GAAG,EAAgB;CACnB,gBAAgB;CACjB,KAiBA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAO1C,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAoB,CAAC,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"Button.base.js","names":[],"sources":["../../../components/button/Button.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SlotPresenceController } from '@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js';\nimport { SlotTextController } from '@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport { BUTTON_VALID_SIZES, type ButtonSize } from './Button.types.js';\n\n/**\n * Abstract base class for all button-like components. Owns shared semantic\n * concerns: interaction state, sizing, slot-derived icon/label state,\n * accessible-name resolution, and host-to-internal-button attribute forwarding.\n *\n * Visual API specific to `sp-button` (`variant`, `fill-style`, `static-color`)\n * is intentionally absent so that ActionButton, ClearButton, CloseButton,\n * PickerButton, and InfieldButton can extend this base without inheriting\n * the `swc-button` visual surface.\n *\n * @attribute {ElementSize} size - The size of the button.\n */\nexport abstract class ButtonBase extends SizedMixin(SpectrumElement, {\n validSizes: BUTTON_VALID_SIZES,\n}) {\n static override shadowRootOptions: ShadowRootInit = {\n ...SpectrumElement.shadowRootOptions,\n delegatesFocus: true,\n };\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * The size of the button.\n *\n * @default m\n */\n declare public size: ButtonSize;\n\n /**\n * Whether the button is disabled. Removes focusability and prevents\n * interaction.\n */\n @property({ type: Boolean, reflect: true })\n public disabled: boolean = false;\n\n /**\n * Accessible label forwarded to the internal `<button>` element as\n * `aria-label`. Required for icon-only buttons, which have no visible text.\n */\n @property({ type: String, attribute: 'accessible-label' })\n public accessibleLabel?: string;\n\n // ──────────────────────\n // CONTROLLERS\n // ──────────────────────\n\n /**\n * Observes whether an icon is slotted into `[slot=\"icon\"]`.\n *\n * @internal\n */\n protected slotPresence = new SlotPresenceController(this, '[slot=\"icon\"]');\n\n /**\n * Observes whether the default slot has a meaningful text label. The default\n * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes\n * after the first render to be tracked.\n *\n * @internal\n */\n protected slotText = new SlotTextController(this);\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected get hasIcon(): boolean {\n return this.slotPresence.isPresent;\n }\n\n protected get hasLabel(): boolean {\n return this.slotText.hasContent;\n }\n\n /**\n * Returns the set of attributes that should be forwarded to the internal\n * semantic `<button>` element, if not otherwise directly managed.\n *\n * @internal\n */\n protected getForwardedButtonAttributes(): Record<\n string,\n string | boolean | undefined\n > {\n return {\n disabled: this.disabled,\n };\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n // Capture phase so slotted light-DOM clicks are suppressed before host\n // listeners (e.g. Storybook actions) run.\n this.addEventListener('click', this.handleClick, true);\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener('click', this.handleClick, true);\n super.disconnectedCallback();\n }\n\n /**\n * Suppresses click activation while the button is `disabled`, or externally\n * marked `aria-disabled` (e.g. by a disabled parent `swc-action-group`,\n * which uses `aria-disabled` instead of native `disabled` so children\n * remain keyboard-reachable).\n *\n * Slotted icon content lives in the light DOM, so pointer clicks on icons\n * bypass the disabled inner `<button>` and bubble on the host. The host\n * listener (capture) and inner `@click` binding both call this handler.\n */\n protected readonly handleClick = (event: Event): void => {\n if (this.disabled || this.getAttribute('aria-disabled') === 'true') {\n event.preventDefault();\n event.stopImmediatePropagation();\n }\n };\n\n protected override update(changedProperties: PropertyValues): void {\n super.update(changedProperties);\n warnIf(\n this,\n this.hasIcon && !this.hasLabel && !this.accessibleLabel,\n `<${this.localName}> with an icon and no label must have an \"accessible-label\" attribute to be accessible.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-button--docs',\n { type: 'accessibility', issues: ['accessible-label'] }\n );\n }\n}\n"],"mappings":";;;;;;;;;OAmCsB,IAAtB,cAAyC,EAAW,GAAiB,EACnE,YAAY,GACb,CAAC,CAAC;;+BAsB0B,wBAkBF,IAAI,EAAuB,MAAM,kBAAgB,kBASrD,IAAI,EAAmB,KAAK,sBAmDf,MAAuB;AACvD,IAAI,KAAK,YAAY,KAAK,aAAa,gBAAgB,KAAK,YAC1D,EAAM,gBAAgB,EACtB,EAAM,0BAA0B;;;CAhDpC,IAAc,UAAmB;AAC/B,SAAO,KAAK,aAAa;;CAG3B,IAAc,WAAoB;AAChC,SAAO,KAAK,SAAS;;CASvB,+BAGE;AACA,SAAO,EACL,UAAU,KAAK,UAChB;;CAGH,oBAA0C;AAIxC,EAHA,MAAM,mBAAmB,EAGzB,KAAK,iBAAiB,SAAS,KAAK,aAAa,GAAK;;CAGxD,uBAA6C;AAE3C,EADA,KAAK,oBAAoB,SAAS,KAAK,aAAa,GAAK,EACzD,MAAM,sBAAsB;;CAoB9B,OAA0B,GAAyC;AAEjE,EADA,MAAM,OAAO,EAAkB,EAC/B,EACE,MACA,KAAK,WAAW,CAAC,KAAK,YAAY,CAAC,KAAK,iBACxC,IAAI,KAAK,UAAU,0FACnB,iFACA;GAAE,MAAM;GAAiB,QAAQ,CAAC,mBAAmB;GAAE,CACxD;;;6BAlHiD;CAClD,GAAG,EAAgB;CACnB,gBAAgB;CACjB,KAiBA,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAO1C,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAoB,CAAC,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA"}
@@ -4,8 +4,9 @@ import { BUTTON_GROUP_ALIGNMENTS as n, BUTTON_GROUP_ORIENTATIONS as r, BUTTON_GR
4
4
  import { property as a, queryAssignedElements as o } from "lit/decorators.js";
5
5
  import { SpectrumElement as s } from "@adobe/spectrum-wc-core/element/index.js";
6
6
  import { SizedMixin as c } from "@adobe/spectrum-wc-core/mixins/index.js";
7
+ import { validateEnum as l } from "@adobe/spectrum-wc-core/utils/index.js";
7
8
  //#region components/button-group/ButtonGroup.base.ts
8
- var l, u = class extends c(s, { validSizes: i }) {
9
+ var u, d = class extends c(s, { validSizes: i }) {
9
10
  constructor(...e) {
10
11
  super(...e), this.orientation = "horizontal", this.disabled = !1, this.align = "start", this.individuallyDisabled = /* @__PURE__ */ new WeakSet(), this._sizePropagation = new t(this, {
11
12
  attribute: "size",
@@ -16,12 +17,18 @@ var l, u = class extends c(s, { validSizes: i }) {
16
17
  super.firstUpdated(e), this.setAttribute("role", "group");
17
18
  }
18
19
  update(e) {
19
- var t;
20
- if ((t = window.__swc) != null && t.DEBUG) {
21
- let e = this.constructor;
22
- e.ORIENTATIONS.includes(this.orientation) || window.__swc.warn(this, `<${this.localName}> element expects the "orientation" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/button-group/", { issues: [...e.ORIENTATIONS] }), e.ALIGNMENTS.includes(this.align) || window.__swc.warn(this, `<${this.localName}> element expects the "align" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/button-group/", { issues: [...e.ALIGNMENTS] });
23
- }
24
- super.update(e);
20
+ let t = this.constructor;
21
+ l(this, {
22
+ prop: "orientation",
23
+ value: this.orientation,
24
+ valid: t.ORIENTATIONS,
25
+ url: "https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs"
26
+ }), l(this, {
27
+ prop: "align",
28
+ value: this.align,
29
+ valid: t.ALIGNMENTS,
30
+ url: "https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs"
31
+ }), super.update(e);
25
32
  }
26
33
  updated(e) {
27
34
  if (super.updated(e), e.has("disabled")) {
@@ -37,17 +44,17 @@ var l, u = class extends c(s, { validSizes: i }) {
37
44
  this.disabled || (this.individuallyDisabled = /* @__PURE__ */ new WeakSet());
38
45
  }
39
46
  };
40
- l = u, l.ORIENTATIONS = r, l.ALIGNMENTS = n, e([a({
47
+ u = d, u.ORIENTATIONS = r, u.ALIGNMENTS = n, e([a({
41
48
  type: String,
42
49
  reflect: !0
43
- })], u.prototype, "orientation", void 0), e([a({
50
+ })], d.prototype, "orientation", void 0), e([a({
44
51
  type: Boolean,
45
52
  reflect: !0
46
- })], u.prototype, "disabled", void 0), e([a({
53
+ })], d.prototype, "disabled", void 0), e([a({
47
54
  type: String,
48
55
  reflect: !0
49
- })], u.prototype, "align", void 0), e([o({ flatten: !0 })], u.prototype, "buttons", void 0);
56
+ })], d.prototype, "align", void 0), e([o({ flatten: !0 })], d.prototype, "buttons", void 0);
50
57
  //#endregion
51
- export { u as ButtonGroupBase };
58
+ export { d as ButtonGroupBase };
52
59
 
53
60
  //# sourceMappingURL=ButtonGroup.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtonGroup.base.js","names":[],"sources":["../../../components/button-group/ButtonGroup.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\n\nimport type { ButtonBase } from '@adobe/spectrum-wc-core/components/button';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\n\nimport { SlotAttributePropagationController } from '../../controllers/slot-attribute-propagation-controller/index.js';\nimport {\n BUTTON_GROUP_ALIGNMENTS,\n BUTTON_GROUP_ORIENTATIONS,\n BUTTON_GROUP_SIZES,\n type ButtonGroupAlignment,\n type ButtonGroupOrientation,\n type ButtonGroupSize,\n} from './ButtonGroup.types.js';\n\n/**\n * A button group clusters related actions together, providing consistent\n * spacing, sizing, and orientation. The host exposes `role=\"group\"` and\n * propagates `size` and `disabled` to slotted button children.\n *\n * This base class owns shared logic and accessibility semantics. Rendering\n * and styling live in the concrete SWC subclass.\n *\n * @slot - One or more `swc-button` elements.\n *\n * @attribute {ElementSize} size - The size of the button group and its children.\n */\nexport abstract class ButtonGroupBase extends SizedMixin(SpectrumElement, {\n validSizes: BUTTON_GROUP_SIZES,\n}) {\n /**\n * The size of the button group. Propagated to all slotted button children.\n *\n * @default m\n */\n declare public size: ButtonGroupSize;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n *\n * Valid orientation values for validation.\n */\n static readonly ORIENTATIONS: readonly string[] = BUTTON_GROUP_ORIENTATIONS;\n\n /**\n * @internal\n *\n * Valid alignment values for validation.\n */\n static readonly ALIGNMENTS: readonly string[] = BUTTON_GROUP_ALIGNMENTS;\n\n /**\n * The layout direction of the button group.\n *\n * Note: this property does NOT set `aria-orientation` on the host because\n * `aria-orientation` is only meaningful for roles that manage arrow-key\n * navigation (e.g. `toolbar`, `listbox`). Since button-group uses\n * sequential Tab navigation (not roving tabindex), the attribute would\n * be invalid.\n */\n @property({ type: String, reflect: true })\n public orientation: ButtonGroupOrientation = 'horizontal';\n\n /**\n * Whether all buttons in the group are disabled. When `true`, forces\n * every slotted button child to `disabled`. When `false`, children\n * retain their individual disabled state — a button slotted with\n * `disabled` remains disabled even when the group is enabled.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * The alignment of buttons within the group along the main axis.\n */\n @property({ type: String, reflect: true })\n public align: ButtonGroupAlignment = 'start';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n @queryAssignedElements({ flatten: true })\n private buttons!: ButtonBase[];\n\n /**\n * Tracks buttons that were individually disabled before the group\n * forced all children disabled. Used to restore their state when\n * the group becomes enabled again.\n */\n private individuallyDisabled = new WeakSet<ButtonBase>();\n\n private readonly _sizePropagation = new SlotAttributePropagationController(\n this,\n {\n attribute: 'size',\n getValue: () => this.size,\n }\n );\n\n protected override firstUpdated(changed: PropertyValues<this>): void {\n super.firstUpdated(changed);\n this.setAttribute('role', 'group');\n }\n\n protected override update(changedProperties: PropertyValues): void {\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof ButtonGroupBase;\n if (!constructor.ORIENTATIONS.includes(this.orientation)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"orientation\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button-group/',\n { issues: [...constructor.ORIENTATIONS] }\n );\n }\n if (!constructor.ALIGNMENTS.includes(this.align)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expects the \"align\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/button-group/',\n { issues: [...constructor.ALIGNMENTS] }\n );\n }\n }\n super.update(changedProperties);\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n\n if (changed.has('disabled')) {\n const wasDisabled = changed.get('disabled');\n if (this.disabled || wasDisabled) {\n this.propagateDisabledToChildren();\n }\n }\n }\n\n /**\n * Handles slotchange events from the default slot. Ensures newly slotted\n * children receive the current size and disabled state.\n */\n protected handleSlotchange(): void {\n this._sizePropagation.propagate();\n\n if (this.disabled) {\n this.propagateDisabledToChildren();\n }\n }\n\n /**\n * Propagates disabled state to slotted button children.\n *\n * Uses a one-directional model: when the group is disabled, all children\n * are forced disabled (tracking which were already individually disabled).\n * When the group is enabled, children are restored to their individual\n * disabled state — a button slotted with `disabled` remains disabled.\n *\n * On slotchange when the group is enabled, buttons are not touched so\n * their declarative `disabled` attribute is preserved.\n */\n private propagateDisabledToChildren(): void {\n for (const button of this.buttons) {\n if (this.disabled) {\n if (button.disabled) {\n this.individuallyDisabled.add(button);\n }\n button.disabled = true;\n } else {\n button.disabled = this.individuallyDisabled.has(button);\n }\n }\n\n if (!this.disabled) {\n this.individuallyDisabled = new WeakSet();\n }\n }\n}\n"],"mappings":";;;;;;;OAyCsB,IAAtB,cAA8C,EAAW,GAAiB,EACxE,YAAY,GACb,CAAC,CAAC;;kCAoC4C,8BAS3B,iBAMmB,qDAcN,IAAI,SAAqB,0BAEpB,IAAI,EACtC,MACA;GACE,WAAW;GACX,gBAAgB,KAAK;GACtB,CACF;;CAED,aAAgC,GAAqC;AAEnE,EADA,MAAM,aAAa,EAAQ,EAC3B,KAAK,aAAa,QAAQ,QAAQ;;CAGpC,OAA0B,GAAyC;;AACjE,OAAA,IAAI,OAAO,UAAA,QAAA,EAAO,OAAO;GACvB,IAAM,IAAc,KAAK;AASzB,GARK,EAAY,aAAa,SAAS,KAAK,YAAY,IACtD,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,4EACnB,iFACA,EAAE,QAAQ,CAAC,GAAG,EAAY,aAAa,EAAE,CAC1C,EAEE,EAAY,WAAW,SAAS,KAAK,MAAM,IAC9C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,sEACnB,iFACA,EAAE,QAAQ,CAAC,GAAG,EAAY,WAAW,EAAE,CACxC;;AAGL,QAAM,OAAO,EAAkB;;CAGjC,QAA2B,GAAqC;AAG9D,MAFA,MAAM,QAAQ,EAAQ,EAElB,EAAQ,IAAI,WAAW,EAAE;GAC3B,IAAM,IAAc,EAAQ,IAAI,WAAW;AAC3C,IAAI,KAAK,YAAY,MACnB,KAAK,6BAA6B;;;CASxC,mBAAmC;AAGjC,EAFA,KAAK,iBAAiB,WAAW,EAE7B,KAAK,YACP,KAAK,6BAA6B;;CAetC,8BAA4C;AAC1C,OAAK,IAAM,KAAU,KAAK,QACxB,CAAI,KAAK,YACH,EAAO,YACT,KAAK,qBAAqB,IAAI,EAAO,EAEvC,EAAO,WAAW,MAElB,EAAO,WAAW,KAAK,qBAAqB,IAAI,EAAO;AAI3D,EAAK,KAAK,aACR,KAAK,uCAAuB,IAAI,SAAS;;;wBArIK,kBAOF,MAW/C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KASzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAOzC,EAAsB,EAAE,SAAS,IAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"ButtonGroup.base.js","names":[],"sources":["../../../components/button-group/ButtonGroup.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property, queryAssignedElements } from 'lit/decorators.js';\n\nimport type { ButtonBase } from '@adobe/spectrum-wc-core/components/button';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { SizedMixin } from '@adobe/spectrum-wc-core/mixins/index.js';\nimport { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport { SlotAttributePropagationController } from '../../controllers/slot-attribute-propagation-controller/index.js';\nimport {\n BUTTON_GROUP_ALIGNMENTS,\n BUTTON_GROUP_ORIENTATIONS,\n BUTTON_GROUP_SIZES,\n type ButtonGroupAlignment,\n type ButtonGroupOrientation,\n type ButtonGroupSize,\n} from './ButtonGroup.types.js';\n\n/**\n * A button group clusters related actions together, providing consistent\n * spacing, sizing, and orientation. The host exposes `role=\"group\"` and\n * propagates `size` and `disabled` to slotted button children.\n *\n * This base class owns shared logic and accessibility semantics. Rendering\n * and styling live in the concrete SWC subclass.\n *\n * @slot - One or more `swc-button` elements.\n *\n * @attribute {ElementSize} size - The size of the button group and its children.\n */\nexport abstract class ButtonGroupBase extends SizedMixin(SpectrumElement, {\n validSizes: BUTTON_GROUP_SIZES,\n}) {\n /**\n * The size of the button group. Propagated to all slotted button children.\n *\n * @default m\n */\n declare public size: ButtonGroupSize;\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * @internal\n *\n * Valid orientation values for validation.\n */\n static readonly ORIENTATIONS: readonly string[] = BUTTON_GROUP_ORIENTATIONS;\n\n /**\n * @internal\n *\n * Valid alignment values for validation.\n */\n static readonly ALIGNMENTS: readonly string[] = BUTTON_GROUP_ALIGNMENTS;\n\n /**\n * The layout direction of the button group.\n *\n * Note: this property does NOT set `aria-orientation` on the host because\n * `aria-orientation` is only meaningful for roles that manage arrow-key\n * navigation (e.g. `toolbar`, `listbox`). Since button-group uses\n * sequential Tab navigation (not roving tabindex), the attribute would\n * be invalid.\n */\n @property({ type: String, reflect: true })\n public orientation: ButtonGroupOrientation = 'horizontal';\n\n /**\n * Whether all buttons in the group are disabled. When `true`, forces\n * every slotted button child to `disabled`. When `false`, children\n * retain their individual disabled state — a button slotted with\n * `disabled` remains disabled even when the group is enabled.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * The alignment of buttons within the group along the main axis.\n */\n @property({ type: String, reflect: true })\n public align: ButtonGroupAlignment = 'start';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n @queryAssignedElements({ flatten: true })\n private buttons!: ButtonBase[];\n\n /**\n * Tracks buttons that were individually disabled before the group\n * forced all children disabled. Used to restore their state when\n * the group becomes enabled again.\n */\n private individuallyDisabled = new WeakSet<ButtonBase>();\n\n private readonly _sizePropagation = new SlotAttributePropagationController(\n this,\n {\n attribute: 'size',\n getValue: () => this.size,\n }\n );\n\n protected override firstUpdated(changed: PropertyValues<this>): void {\n super.firstUpdated(changed);\n this.setAttribute('role', 'group');\n }\n\n protected override update(changedProperties: PropertyValues): void {\n const constructor = this.constructor as typeof ButtonGroupBase;\n validateEnum(this, {\n prop: 'orientation',\n value: this.orientation,\n valid: constructor.ORIENTATIONS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs',\n });\n validateEnum(this, {\n prop: 'align',\n value: this.align,\n valid: constructor.ALIGNMENTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-button-group--docs',\n });\n super.update(changedProperties);\n }\n\n protected override updated(changed: PropertyValues<this>): void {\n super.updated(changed);\n\n if (changed.has('disabled')) {\n const wasDisabled = changed.get('disabled');\n if (this.disabled || wasDisabled) {\n this.propagateDisabledToChildren();\n }\n }\n }\n\n /**\n * Handles slotchange events from the default slot. Ensures newly slotted\n * children receive the current size and disabled state.\n */\n protected handleSlotchange(): void {\n this._sizePropagation.propagate();\n\n if (this.disabled) {\n this.propagateDisabledToChildren();\n }\n }\n\n /**\n * Propagates disabled state to slotted button children.\n *\n * Uses a one-directional model: when the group is disabled, all children\n * are forced disabled (tracking which were already individually disabled).\n * When the group is enabled, children are restored to their individual\n * disabled state — a button slotted with `disabled` remains disabled.\n *\n * On slotchange when the group is enabled, buttons are not touched so\n * their declarative `disabled` attribute is preserved.\n */\n private propagateDisabledToChildren(): void {\n for (const button of this.buttons) {\n if (this.disabled) {\n if (button.disabled) {\n this.individuallyDisabled.add(button);\n }\n button.disabled = true;\n } else {\n button.disabled = this.individuallyDisabled.has(button);\n }\n }\n\n if (!this.disabled) {\n this.individuallyDisabled = new WeakSet();\n }\n }\n}\n"],"mappings":";;;;;;;;OA0CsB,IAAtB,cAA8C,EAAW,GAAiB,EACxE,YAAY,GACb,CAAC,CAAC;;kCAoC4C,8BAS3B,iBAMmB,qDAcN,IAAI,SAAqB,0BAEpB,IAAI,EACtC,MACA;GACE,WAAW;GACX,gBAAgB,KAAK;GACtB,CACF;;CAED,aAAgC,GAAqC;AAEnE,EADA,MAAM,aAAa,EAAQ,EAC3B,KAAK,aAAa,QAAQ,QAAQ;;CAGpC,OAA0B,GAAyC;EACjE,IAAM,IAAc,KAAK;AAazB,EAZA,EAAa,MAAM;GACjB,MAAM;GACN,OAAO,KAAK;GACZ,OAAO,EAAY;GACnB,KAAK;GACN,CAAC,EACF,EAAa,MAAM;GACjB,MAAM;GACN,OAAO,KAAK;GACZ,OAAO,EAAY;GACnB,KAAK;GACN,CAAC,EACF,MAAM,OAAO,EAAkB;;CAGjC,QAA2B,GAAqC;AAG9D,MAFA,MAAM,QAAQ,EAAQ,EAElB,EAAQ,IAAI,WAAW,EAAE;GAC3B,IAAM,IAAc,EAAQ,IAAI,WAAW;AAC3C,IAAI,KAAK,YAAY,MACnB,KAAK,6BAA6B;;;CASxC,mBAAmC;AAGjC,EAFA,KAAK,iBAAiB,WAAW,EAE7B,KAAK,YACP,KAAK,6BAA6B;;CAetC,8BAA4C;AAC1C,OAAK,IAAM,KAAU,KAAK,QACxB,CAAI,KAAK,YACH,EAAO,YACT,KAAK,qBAAqB,IAAI,EAAO,EAEvC,EAAO,WAAW,MAElB,EAAO,WAAW,KAAK,qBAAqB,IAAI,EAAO;AAI3D,EAAK,KAAK,aACR,KAAK,uCAAuB,IAAI,SAAS;;;wBA/HK,kBAOF,MAW/C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KASzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA,KAOzC,EAAsB,EAAE,SAAS,IAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA"}
@@ -1,5 +1,6 @@
1
1
  import { PropertyValues } from 'lit';
2
2
  import { SpectrumElement } from '../../element/index.js';
3
+ import { SlotTextController } from '../../controllers/slot-text-controller/index.js';
3
4
  import { CardDensity, CardVariant } from './Card.types.js';
4
5
  declare const CardBase_base: typeof SpectrumElement & {
5
6
  new (...args: any[]): import('../../mixins/index.js').SizedElementInterface;
@@ -9,20 +10,31 @@ declare const CardBase_base: typeof SpectrumElement & {
9
10
  * Abstract base class for all card-family components. Owns the semantics
10
11
  * shared across every card type: sizing, visual variant, and density.
11
12
  *
12
- * `swc-card`, `swc-user-card`, and `swc-product-card` each extend this base
13
- * directly and render the shared anatomy via `renderCardTemplate()` in
14
- * `swc/components/card/card-template.ts`. That template also carries a
15
- * collection placeholder and an avatar/thumbnail glyph, each supplied
16
- * per-component via `renderCollection`/`renderGlyph`.
17
- *
18
13
  * @attribute {ElementSize} size - The size of the card.
19
14
  *
15
+ * @fires swc-card-click - Dispatched when a `selectable` card is activated (click, Enter, or Space).
16
+ *
20
17
  * @slot preview - Primary preview content
21
18
  * @slot title - Card title
22
19
  * @slot actions - Optional action controls
23
20
  * @slot description - Supporting description text
24
21
  * @slot footer - Optional footer content
25
22
  * @slot - Additional body content
23
+ *
24
+ * @cssprop --swc-card-base-max-inline-size - Maximum inline size of the card. Defaults to 280px, overridden per size.
25
+ * @cssprop --swc-card-base-border-radius - Corner radius of the card. Defaults to the extra-large corner-radius token, overridden per size.
26
+ * @cssprop --swc-card-base-box-shadow - Box shadow (elevation) of the card. Defaults to the emphasized drop-shadow token; overridden by the tertiary variant, selectable focus, and title-as-link/selectable hover.
27
+ * @cssprop --swc-card-base-background-color - Background color of the card. Defaults to the layer-2 background token; overridden by the secondary, tertiary, and quiet variants.
28
+ * @cssprop --swc-card-base-preview-aspect-ratio - Aspect ratio of the preview slot. Defaults to 3/2.
29
+ * @cssprop --swc-card-base-title-font-size - Font size of the title slot. Defaults to the medium font-size token, overridden per size.
30
+ * @cssprop --swc-card-base-title-line-height - Line height of the title slot. Defaults to the medium line-height token, overridden per size.
31
+ * @cssprop --swc-card-base-description-font-size - Font size of the description slot and default slot content. Defaults to a smaller font-size token, overridden per size.
32
+ * @cssprop --swc-card-base-action-component-height - Height used to vertically balance slotted actions content. Defaults to the smallest component-height token, overridden per size.
33
+ * @cssprop --swc-card-base-content-header-gap - Column gap between the title and actions slots. Defaults to the medium base-gap token, overridden per size.
34
+ * @cssprop --swc-card-base-content-padding - Padding of the content region. Defaults to the medium container-padding token; overridden by density.
35
+ * @cssprop --swc-card-base-content-padding-regular - Content padding used at the default (regular) density, per size.
36
+ * @cssprop --swc-card-base-content-padding-compact - Content padding used at compact density, per size.
37
+ * @cssprop --swc-card-base-content-padding-spacious - Content padding used at spacious density, per size.
26
38
  */
27
39
  export declare abstract class CardBase extends CardBase_base {
28
40
  /**
@@ -48,75 +60,112 @@ export declare abstract class CardBase extends CardBase_base {
48
60
  /**
49
61
  * Indicates the consumer has wrapped their `title` slot content in a real
50
62
  * link. Extends that link's hit area to cover the card surface while
51
- * leaving navigation entirely consumer-owned — Card accepts no `href`.
52
- *
53
- * @todo Naming, and the `::slotted(a)::after` vs. click-proxy mechanism,
54
- * are still open. See the card family plan, A11y-3 / Q2.
63
+ * leaving navigation entirely consumer-owned; Card accepts no `href`.
55
64
  */
56
65
  titleAsLink: boolean;
57
66
  /**
58
67
  * Makes the card focusable and captures surface clicks (excluding nested
59
68
  * interactive targets) to dispatch a `swc-card-click` event, independent
60
- * of `titleAsLink`. Lays groundwork for a future `CardView` selection
61
- * model without Card owning selected-state UI itself.
69
+ * of `titleAsLink`.
62
70
  *
63
- * @todo Event name and `tabindex` management details are still open. See
64
- * the card family plan, A11y-3 / Q3.
65
- * @todo No `role` is set when `selectable` is true — deferred rather than
66
- * defaulting to `role="button"`, since the eventual `CardView` selection
67
- * model may call for a different role (e.g. `option`/`gridcell`) that
68
- * `role="button"` would be wrong to have committed to today. See the card
69
- * family plan, A11y-3 / Q8.
71
+ * @todo No ARIA role is set yet; deferred until a future `CardView`
72
+ * selection model determines the appropriate role.
70
73
  */
71
74
  selectable: boolean;
75
+ /**
76
+ * Keeps a slotted action control's `size` one step smaller than the
77
+ * card's own `size`.
78
+ */
79
+ private readonly _sizePropagation;
80
+ /**
81
+ * Observes whether the default slot has meaningful content. Each concrete
82
+ * card's `render()` must bind `@slotchange=${this.slotText.handleSlotChange}`
83
+ * on the default slot (via `renderCardTemplate`'s `onDefaultSlotChange`) for
84
+ * changes after the first render to be tracked.
85
+ *
86
+ * @internal
87
+ */
88
+ protected slotText: SlotTextController;
89
+ /**
90
+ * Whether the default slot has meaningful content. Consumed by each concrete
91
+ * card's `render()` (through `renderCardTemplate`'s `hasDefaultSlotContent`)
92
+ * to toggle the `--hasDefault` class.
93
+ *
94
+ * @internal
95
+ */
96
+ protected get slotHasContent(): boolean;
72
97
  connectedCallback(): void;
73
98
  disconnectedCallback(): void;
99
+ protected firstUpdated(changedProperties: PropertyValues): void;
100
+ protected update(changedProperties: PropertyValues): void;
74
101
  protected updated(changedProperties: PropertyValues): void;
75
102
  /**
76
103
  * @internal
77
- * The card's own `title` slot element, or `null` before the concrete
78
- * class's `renderCardTemplate()` call has rendered.
104
+ *
105
+ * The card's own `title` slot element.
79
106
  */
80
107
  protected getTitleSlotElement(): HTMLSlotElement | null;
81
108
  /**
82
109
  * @internal
83
- * The `title` slot's link, supporting both forms consumers reasonably
84
- * use: the assigned element itself is the anchor (`<a slot="title"
85
- * href="...">`), or the anchor is nested inside a wrapper (`<span
86
- * slot="title"><a href="...">`). Requires `href` — a link with no
87
- * destination can't usefully be clicked-through.
110
+ *
111
+ * The card's own `actions` slot element.
112
+ */
113
+ protected getActionsSlotElement(): HTMLSlotElement | null;
114
+ /**
115
+ * Whether the `actions` slot is supported for this card's current state.
116
+ * `xs` cards don't have room for it. Concrete classes may override this
117
+ * to exclude the slot for other reasons, independent of size.
118
+ */
119
+ protected get actionsSupported(): boolean;
120
+ /**
121
+ * @internal
122
+ *
123
+ * Warns in dev mode when the `actions` slot has content but isn't
124
+ * supported for the current state. Visual suppression is handled in
125
+ * CSS, not here.
126
+ */
127
+ private checkActionsSupport;
128
+ /**
129
+ * @internal
130
+ *
131
+ * The `title` slot's link: either the assigned element itself
132
+ * (`<a slot="title" href="...">`) or an anchor nested inside a wrapper
133
+ * (`<span slot="title"><a href="...">`). Requires `href`.
88
134
  */
89
135
  protected getTitleLinkElement(): HTMLAnchorElement | null;
90
136
  /**
91
137
  * @internal
92
- * Whether `node` provides its own interaction/focus semantics. Checking
93
- * the `tabIndex` IDL property (rather than the `tabindex` attribute or a
94
- * tag-name list) correctly covers natively-interactive elements
95
- * (`button`, `input`, `select`, `textarea`, `a[href]`) with no explicit
96
- * attribute, excludes `tabindex="-1"` (focusable for scripting, not a
97
- * click target) and disabled controls, and works for a custom element's
98
- * internal shadow-DOM control too — `composedPath()` already traverses
99
- * into other elements' shadow roots for composed events like `click`, so
100
- * an internal `<button>` inside e.g. `<swc-button>` is inspected directly
101
- * regardless of which shadow tree it belongs to.
138
+ *
139
+ * Whether `node` has its own interaction/focus semantics, via the
140
+ * `tabIndex` IDL property rather than the `tabindex` attribute; this
141
+ * also correctly excludes `tabindex="-1"` and disabled controls.
102
142
  */
103
143
  private static isFocusable;
144
+ /**
145
+ * @internal
146
+ *
147
+ * The size one step below `size` in `CARD_VALID_SIZES`, clamped at the
148
+ * smallest size.
149
+ */
150
+ private static getSmallerSize;
151
+ /**
152
+ * Re-propagates the `actions` slot's `size` for elements assigned after
153
+ * the initial render, wired to the slot's `slotchange` in
154
+ * `firstUpdated()`.
155
+ */
156
+ protected readonly handleActionsSlotChange: () => void;
104
157
  /**
105
158
  * Proxies a qualifying surface click to `titleAsLink`'s link and/or
106
159
  * dispatches `swc-card-click` for `selectable`, after filtering out
107
- * clicks that landed on a nested interactive target (see `isFocusable()`
108
- * and the `actions`-slot exclusion above).
160
+ * clicks that landed on a nested interactive target or followed a
161
+ * text-selection drag.
109
162
  */
110
163
  protected readonly handleSurfaceClick: (event: Event) => void;
111
164
  /**
112
- * `tabindex` is only ever added alongside this listener (see `updated()`)
113
- * and removed alongside its removal — a focusable card is never left
114
- * without keyboard activation. Enter and Space are treated identically
115
- * and both proxy to `titleAsLink`'s link when set, even though a bare
116
- * link conventionally responds to Enter only: the card's own activation
117
- * contract (Enter+Space, more button-like) is authoritative once
118
- * `selectable` makes the card itself the focused target, regardless of
119
- * what that activation happens to proxy to.
165
+ * Enter and Space both activate the card, even though a bare link
166
+ * conventionally responds to Enter only; the card's own activation
167
+ * contract takes precedence once `selectable` makes it the focused
168
+ * target.
120
169
  */
121
170
  protected readonly handleSelectableKeydown: (event: KeyboardEvent) => void;
122
171
  }