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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +75 -9
  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 +1 -1
  18. package/dist/components/asset/Asset.base.js +14 -8
  19. package/dist/components/asset/Asset.base.js.map +1 -1
  20. package/dist/components/avatar/Avatar.base.js +18 -22
  21. package/dist/components/avatar/Avatar.base.js.map +1 -1
  22. package/dist/components/badge/Badge.base.d.ts +24 -8
  23. package/dist/components/badge/Badge.base.js +22 -17
  24. package/dist/components/badge/Badge.base.js.map +1 -1
  25. package/dist/components/button/Button.base.d.ts +20 -10
  26. package/dist/components/button/Button.base.js +17 -12
  27. package/dist/components/button/Button.base.js.map +1 -1
  28. package/dist/components/button-group/ButtonGroup.base.js +19 -12
  29. package/dist/components/button-group/ButtonGroup.base.js.map +1 -1
  30. package/dist/components/card/Card.base.d.ts +95 -46
  31. package/dist/components/card/Card.base.js +71 -23
  32. package/dist/components/card/Card.base.js.map +1 -1
  33. package/dist/components/card/Card.types.d.ts +1 -0
  34. package/dist/components/card/Card.types.js +2 -2
  35. package/dist/components/card/Card.types.js.map +1 -1
  36. package/dist/components/card/index.js +3 -3
  37. package/dist/components/divider/Divider.base.js +13 -8
  38. package/dist/components/divider/Divider.base.js.map +1 -1
  39. package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
  40. package/dist/components/dropzone/Dropzone.base.js +82 -0
  41. package/dist/components/dropzone/Dropzone.base.js.map +1 -0
  42. package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
  43. package/dist/components/dropzone/Dropzone.types.js +15 -0
  44. package/dist/components/dropzone/Dropzone.types.js.map +1 -0
  45. package/dist/components/dropzone/index.d.ts +13 -0
  46. package/dist/components/dropzone/index.js +3 -0
  47. package/dist/components/icon/Icon.base.d.ts +11 -7
  48. package/dist/components/icon/Icon.base.js +13 -20
  49. package/dist/components/icon/Icon.base.js.map +1 -1
  50. package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +22 -8
  51. package/dist/components/illustrated-message/IllustratedMessage.base.js +33 -20
  52. package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -1
  53. package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
  54. package/dist/components/infield-button/InfieldButton.base.js +22 -0
  55. package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
  56. package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
  57. package/dist/components/infield-button/InfieldButton.types.js +11 -0
  58. package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
  59. package/dist/components/infield-button/index.d.ts +13 -0
  60. package/dist/components/infield-button/index.js +3 -0
  61. package/dist/components/meter/Meter.base.js +11 -9
  62. package/dist/components/meter/Meter.base.js.map +1 -1
  63. package/dist/components/popover/Popover.base.js +46 -42
  64. package/dist/components/popover/Popover.base.js.map +1 -1
  65. package/dist/components/progress-circle/ProgressCircle.base.d.ts +0 -1
  66. package/dist/components/progress-circle/ProgressCircle.base.js +26 -22
  67. package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -1
  68. package/dist/components/status-light/StatusLight.base.d.ts +1 -1
  69. package/dist/components/status-light/StatusLight.base.js +12 -9
  70. package/dist/components/status-light/StatusLight.base.js.map +1 -1
  71. package/dist/components/tabs/Tabs.base.js +44 -32
  72. package/dist/components/tabs/Tabs.base.js.map +1 -1
  73. package/dist/components/tooltip/Tooltip.base.js +57 -22
  74. package/dist/components/tooltip/Tooltip.base.js.map +1 -1
  75. package/dist/controllers/color-controller/src/color-controller.js +45 -44
  76. package/dist/controllers/color-controller/src/color-controller.js.map +1 -1
  77. package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
  78. package/dist/controllers/drag-and-drop-controller/index.js +2 -0
  79. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
  80. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
  81. package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
  82. package/dist/controllers/index.d.ts +4 -1
  83. package/dist/controllers/index.js +14 -11
  84. package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
  85. package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
  86. package/dist/controllers/{page-scroll-lock.js → page-scroll-lock-controller/src/page-scroll-lock.js} +1 -1
  87. package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
  88. package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
  89. package/dist/controllers/slot-presence-controller/index.js +2 -0
  90. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
  91. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
  92. package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
  93. package/dist/controllers/slot-text-controller/index.d.ts +12 -0
  94. package/dist/controllers/slot-text-controller/index.js +2 -0
  95. package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
  96. package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
  97. package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
  98. package/dist/element/index.d.ts +1 -1
  99. package/dist/element/index.js +2 -2
  100. package/dist/element/spectrum-element.d.ts +58 -15
  101. package/dist/element/spectrum-element.js +55 -36
  102. package/dist/element/spectrum-element.js.map +1 -1
  103. package/dist/element/version.d.ts +2 -2
  104. package/dist/element/version.js +1 -1
  105. package/dist/element/version.js.map +1 -1
  106. package/dist/mixins/index.d.ts +0 -2
  107. package/dist/mixins/index.js +4 -6
  108. package/dist/mixins/linear-progress-mixin.d.ts +1 -2
  109. package/dist/mixins/linear-progress-mixin.js +35 -34
  110. package/dist/mixins/linear-progress-mixin.js.map +1 -1
  111. package/dist/mixins/pending-mixin.js +12 -11
  112. package/dist/mixins/pending-mixin.js.map +1 -1
  113. package/dist/mixins/sized-mixin.d.ts +28 -0
  114. package/dist/mixins/sized-mixin.js +6 -6
  115. package/dist/mixins/sized-mixin.js.map +1 -1
  116. package/dist/utils/dev-validation.d.ts +88 -0
  117. package/dist/utils/dev-validation.js +33 -0
  118. package/dist/utils/dev-validation.js.map +1 -0
  119. package/dist/utils/index.d.ts +2 -0
  120. package/dist/utils/index.js +12 -10
  121. package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
  122. package/dist/utils/is-focus-visible-in-tree.js +11 -0
  123. package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
  124. package/package.json +68 -15
  125. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/defineProperty.js +0 -12
  126. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPrimitive.js +0 -14
  127. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/toPropertyKey.js +0 -9
  128. package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/typeof.js +0 -11
  129. package/dist/controllers/page-scroll-lock.js.map +0 -1
  130. package/dist/mixins/observe-slot-presence.d.ts +0 -12
  131. package/dist/mixins/observe-slot-presence.js +0 -40
  132. package/dist/mixins/observe-slot-presence.js.map +0 -1
  133. package/dist/mixins/observe-slot-text.d.ts +0 -11
  134. package/dist/mixins/observe-slot-text.js +0 -60
  135. package/dist/mixins/observe-slot-text.js.map +0 -1
  136. /package/dist/controllers/{page-scroll-lock.d.ts → page-scroll-lock-controller/src/page-scroll-lock.d.ts} +0 -0
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Copyright 2026 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ export declare const ACTION_GROUP_VALID_SIZES: readonly ["xs", "s", "m", "l", "xl"];
13
+ export declare const ACTION_GROUP_ORIENTATIONS: readonly ["horizontal", "vertical"];
14
+ export declare const ACTION_GROUP_STATIC_COLORS: readonly ["white", "black"];
15
+ export type ActionGroupSize = (typeof ACTION_GROUP_VALID_SIZES)[number];
16
+ export type ActionGroupOrientation = (typeof ACTION_GROUP_ORIENTATIONS)[number];
17
+ export type ActionGroupStaticColor = (typeof ACTION_GROUP_STATIC_COLORS)[number];
@@ -0,0 +1,12 @@
1
+ //#region components/action-group/ActionGroup.types.ts
2
+ var e = [
3
+ "xs",
4
+ "s",
5
+ "m",
6
+ "l",
7
+ "xl"
8
+ ], t = ["horizontal", "vertical"], n = ["white", "black"];
9
+ //#endregion
10
+ export { t as ACTION_GROUP_ORIENTATIONS, n as ACTION_GROUP_STATIC_COLORS, e as ACTION_GROUP_VALID_SIZES };
11
+
12
+ //# sourceMappingURL=ActionGroup.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionGroup.types.js","names":[],"sources":["../../../components/action-group/ActionGroup.types.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 type { ElementSize } from '@adobe/spectrum-wc-core/mixins/index.js';\n\n// ──────────────────\n// SHARED\n// ──────────────────\n\nexport const ACTION_GROUP_VALID_SIZES = [\n 'xs',\n 's',\n 'm',\n 'l',\n 'xl',\n] as const satisfies readonly ElementSize[];\n\nexport const ACTION_GROUP_ORIENTATIONS = ['horizontal', 'vertical'] as const;\n\nexport const ACTION_GROUP_STATIC_COLORS = ['white', 'black'] as const;\n\n// ──────────────────\n// TYPES\n// ──────────────────\n\nexport type ActionGroupSize = (typeof ACTION_GROUP_VALID_SIZES)[number];\nexport type ActionGroupOrientation = (typeof ACTION_GROUP_ORIENTATIONS)[number];\nexport type ActionGroupStaticColor =\n (typeof ACTION_GROUP_STATIC_COLORS)[number];\n"],"mappings":";AAkBA,IAAa,IAA2B;CACtC;CACA;CACA;CACA;CACA;CACD,EAEY,IAA4B,CAAC,cAAc,WAAW,EAEtD,IAA6B,CAAC,SAAS,QAAQ"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright 2026 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ export * from './ActionGroup.base.js';
13
+ export * from './ActionGroup.types.js';
@@ -0,0 +1,3 @@
1
+ import { ACTION_GROUP_ORIENTATIONS as e, ACTION_GROUP_STATIC_COLORS as t, ACTION_GROUP_VALID_SIZES as n } from "./ActionGroup.types.js";
2
+ import { ActionGroupBase as r } from "./ActionGroup.base.js";
3
+ export { e as ACTION_GROUP_ORIENTATIONS, t as ACTION_GROUP_STATIC_COLORS, n as ACTION_GROUP_VALID_SIZES, r as ActionGroupBase };
@@ -2,8 +2,9 @@ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/he
2
2
  import { ALERT_BANNER_VALID_VARIANTS as t } from "./AlertBanner.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 { validateEnum as i } from "@adobe/spectrum-wc-core/utils/index.js";
5
6
  //#region components/alert-banner/AlertBanner.base.ts
6
- var i = class extends r {
7
+ var a = class extends r {
7
8
  constructor(...e) {
8
9
  super(...e), this.open = !1, this.dismissible = !1, this._variant = "";
9
10
  }
@@ -13,12 +14,12 @@ var i = class extends r {
13
14
  set variant(e) {
14
15
  if (e === this.variant) return;
15
16
  let n = this.variant;
16
- if (this.isValidVariant(e)) this.setAttribute("variant", e), this._variant = e;
17
- else {
18
- var r;
19
- this.removeAttribute("variant"), this._variant = "", (r = window.__swc) != null && r.DEBUG && window.__swc.warn(this, `<${this.localName}> element expects the "variant" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/alert-banner/#variants", { issues: [...t] });
20
- }
21
- this.requestUpdate("variant", n);
17
+ this.isValidVariant(e) ? (this.setAttribute("variant", e), this._variant = e) : (this.removeAttribute("variant"), this._variant = "", i(this, {
18
+ prop: "variant",
19
+ value: e,
20
+ valid: t,
21
+ url: "https://spectrum-web-components.adobe.com/?path=/docs/components-alert-banner--docs"
22
+ })), this.requestUpdate("variant", n);
22
23
  }
23
24
  get variant() {
24
25
  return this._variant;
@@ -46,11 +47,11 @@ var i = class extends r {
46
47
  e([n({
47
48
  type: Boolean,
48
49
  reflect: !0
49
- })], i.prototype, "open", void 0), e([n({
50
+ })], a.prototype, "open", void 0), e([n({
50
51
  type: Boolean,
51
52
  reflect: !0
52
- })], i.prototype, "dismissible", void 0), e([n({ type: String })], i.prototype, "variant", null);
53
+ })], a.prototype, "dismissible", void 0), e([n({ type: String })], a.prototype, "variant", null);
53
54
  //#endregion
54
- export { i as AlertBannerBase };
55
+ export { a as AlertBannerBase };
55
56
 
56
57
  //# sourceMappingURL=AlertBanner.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AlertBanner.base.js","names":[],"sources":["../../../components/alert-banner/AlertBanner.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 { CSSResultArray, PropertyValues, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\n\nimport {\n ALERT_BANNER_VALID_VARIANTS,\n type AlertBannerVariant,\n} from './AlertBanner.types.js';\n\n/**\n * An alert banner shows pressing and high-signal messages, such as system alerts.\n * It is meant to be noticed and prompt users to take action.\n *\n * @slot - The main content of the alert banner.\n * @slot action - An optional action button for the alert banner.\n *\n * @fires close - Dispatched when the alert banner is dismissed. Cancelable.\n */\nexport abstract class AlertBannerBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [];\n }\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * Controls the display of the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Whether to include an icon-only close button to dismiss the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public dismissible = false;\n\n /**\n * The variant applies specific styling when set to `negative` or `info`;\n * `variant` attribute is removed when it's passed an invalid variant.\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariant) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n if (this.isValidVariant(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n\n if (window.__swc?.DEBUG) {\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/alert-banner/#variants',\n {\n issues: [...ALERT_BANNER_VALID_VARIANTS],\n }\n );\n }\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariant {\n return this._variant;\n }\n\n private _variant: AlertBannerVariant = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected isValidVariant(variant: string): boolean {\n return (ALERT_BANNER_VALID_VARIANTS as readonly string[]).includes(variant);\n }\n\n protected abstract renderIcon(variant: string): TemplateResult;\n\n protected shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n\n if (changes.has('open')) {\n if (this.open) {\n this.addEventListener('keydown', this.handleKeydown);\n } else {\n this.removeEventListener('keydown', this.handleKeydown);\n }\n }\n }\n}\n"],"mappings":";;;;;AA8BA,IAAsB,IAAtB,cAA8C,EAAgB;;2BAa9C,uBAMO,oBAsCkB;;CAxDvC,WAA2B,SAAyB;AAClD,SAAO,EAAE;;CAuBX,IACW,QAAQ,GAA6B;AAC9C,MAAI,MAAY,KAAK,QACnB;EAEF,IAAM,IAAW,KAAK;AAEtB,MAAI,KAAK,eAAe,EAAQ,CAE9B,CADA,KAAK,aAAa,WAAW,EAAQ,EACrC,KAAK,WAAW;OACX;;AAIL,GAHA,KAAK,gBAAgB,UAAU,EAC/B,KAAK,WAAW,KAEhB,IAAI,OAAO,UAAA,QAAA,EAAO,SAChB,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,wEACnB,0FACA,EACE,QAAQ,CAAC,GAAG,EAA4B,EACzC,CACF;;AAGL,OAAK,cAAc,WAAW,EAAS;;CAGzC,IAAW,UAA8B;AACvC,SAAO,KAAK;;CASd,eAAyB,GAA0B;AACjD,SAAQ,EAAkD,SAAS,EAAQ;;CAK7E,cAA8B;AAQ5B,EAPqB,KAAK,cACxB,IAAI,YAAY,SAAS;GACvB,UAAU;GACV,SAAS;GACT,YAAY;GACb,CAAC,CACH,IAEC,KAAK,OAAO;;CAIhB,QAAqB;AACnB,OAAK,OAAO;;CAGd,cAAwB,GAA4B;AAClD,EAAI,EAAM,SAAS,YAAY,KAAK,eAClC,KAAK,aAAa;;CAItB,QAA2B,GAA+B;AAGxD,EAFA,MAAM,QAAQ,EAAQ,EAElB,EAAQ,IAAI,OAAO,KACjB,KAAK,OACP,KAAK,iBAAiB,WAAW,KAAK,cAAc,GAEpD,KAAK,oBAAoB,WAAW,KAAK,cAAc;;;GAvF5D,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAO1C,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA"}
1
+ {"version":3,"file":"AlertBanner.base.js","names":[],"sources":["../../../components/alert-banner/AlertBanner.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 { CSSResultArray, PropertyValues, TemplateResult } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n ALERT_BANNER_VALID_VARIANTS,\n type AlertBannerVariant,\n} from './AlertBanner.types.js';\n\n/**\n * An alert banner shows pressing and high-signal messages, such as system alerts.\n * It is meant to be noticed and prompt users to take action.\n *\n * @slot - The main content of the alert banner.\n * @slot action - An optional action button for the alert banner.\n *\n * @fires close - Dispatched when the alert banner is dismissed. Cancelable.\n */\nexport abstract class AlertBannerBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [];\n }\n\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * Controls the display of the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public open = false;\n\n /**\n * Whether to include an icon-only close button to dismiss the alert banner.\n */\n @property({ type: Boolean, reflect: true })\n public dismissible = false;\n\n /**\n * The variant applies specific styling when set to `negative` or `info`;\n * `variant` attribute is removed when it's passed an invalid variant.\n */\n @property({ type: String })\n public set variant(variant: AlertBannerVariant) {\n if (variant === this.variant) {\n return;\n }\n const oldValue = this.variant;\n\n if (this.isValidVariant(variant)) {\n this.setAttribute('variant', variant);\n this._variant = variant;\n } else {\n this.removeAttribute('variant');\n this._variant = '';\n\n validateEnum(this, {\n prop: 'variant',\n value: variant,\n valid: ALERT_BANNER_VALID_VARIANTS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-alert-banner--docs',\n });\n }\n this.requestUpdate('variant', oldValue);\n }\n\n public get variant(): AlertBannerVariant {\n return this._variant;\n }\n\n private _variant: AlertBannerVariant = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected isValidVariant(variant: string): boolean {\n return (ALERT_BANNER_VALID_VARIANTS as readonly string[]).includes(variant);\n }\n\n protected abstract renderIcon(variant: string): TemplateResult;\n\n protected shouldClose(): void {\n const applyDefault = this.dispatchEvent(\n new CustomEvent('close', {\n composed: true,\n bubbles: true,\n cancelable: true,\n })\n );\n if (applyDefault) {\n this.close();\n }\n }\n\n public close(): void {\n this.open = false;\n }\n\n protected handleKeydown(event: KeyboardEvent): void {\n if (event.code === 'Escape' && this.dismissible) {\n this.shouldClose();\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n\n if (changes.has('open')) {\n if (this.open) {\n this.addEventListener('keydown', this.handleKeydown);\n } else {\n this.removeEventListener('keydown', this.handleKeydown);\n }\n }\n }\n}\n"],"mappings":";;;;;;AA+BA,IAAsB,IAAtB,cAA8C,EAAgB;;2BAa9C,uBAMO,oBAkCkB;;CApDvC,WAA2B,SAAyB;AAClD,SAAO,EAAE;;CAuBX,IACW,QAAQ,GAA6B;AAC9C,MAAI,MAAY,KAAK,QACnB;EAEF,IAAM,IAAW,KAAK;AAgBtB,EAdI,KAAK,eAAe,EAAQ,IAC9B,KAAK,aAAa,WAAW,EAAQ,EACrC,KAAK,WAAW,MAEhB,KAAK,gBAAgB,UAAU,EAC/B,KAAK,WAAW,IAEhB,EAAa,MAAM;GACjB,MAAM;GACN,OAAO;GACP,OAAO;GACP,KAAK;GACN,CAAC,GAEJ,KAAK,cAAc,WAAW,EAAS;;CAGzC,IAAW,UAA8B;AACvC,SAAO,KAAK;;CASd,eAAyB,GAA0B;AACjD,SAAQ,EAAkD,SAAS,EAAQ;;CAK7E,cAA8B;AAQ5B,EAPqB,KAAK,cACxB,IAAI,YAAY,SAAS;GACvB,UAAU;GACV,SAAS;GACT,YAAY;GACb,CAAC,CACH,IAEC,KAAK,OAAO;;CAIhB,QAAqB;AACnB,OAAK,OAAO;;CAGd,cAAwB,GAA4B;AAClD,EAAI,EAAM,SAAS,YAAY,KAAK,eAClC,KAAK,aAAa;;CAItB,QAA2B,GAA+B;AAGxD,EAFA,MAAM,QAAQ,EAAQ,EAElB,EAAQ,IAAI,OAAO,KACjB,KAAK,OACP,KAAK,iBAAiB,WAAW,KAAK,cAAc,GAEpD,KAAK,oBAAoB,WAAW,KAAK,cAAc;;;GAnF5D,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,eAAA,KAAA,EAAA,KAO1C,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA"}
@@ -18,5 +18,5 @@ export declare abstract class AssetBase extends SpectrumElement {
18
18
  * Accessible label for the asset’s file or folder variant.
19
19
  */
20
20
  label: string;
21
- protected updated(changes: PropertyValues): void;
21
+ protected update(changes: PropertyValues): void;
22
22
  }
@@ -2,24 +2,30 @@ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/he
2
2
  import { ASSET_VARIANTS as t } from "./Asset.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 { validateEnum as i } from "@adobe/spectrum-wc-core/utils/index.js";
5
6
  //#region components/asset/Asset.base.ts
6
- var i, a = class extends r {
7
+ var a, o = class extends r {
7
8
  constructor(...e) {
8
9
  super(...e), this.label = "";
9
10
  }
10
- updated(e) {
11
- var t;
12
- if (super.updated(e), (t = window.__swc) != null && t.DEBUG) {
11
+ update(e) {
12
+ if (this.variant !== void 0) {
13
13
  let e = this.constructor;
14
- this.variant !== void 0 && !e.VARIANTS.includes(this.variant) && window.__swc.warn(this, `<${this.localName}> element expects the "variant" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/asset/", { issues: [...e.VARIANTS] });
14
+ i(this, {
15
+ prop: "variant",
16
+ value: this.variant,
17
+ valid: e.VARIANTS,
18
+ url: "https://spectrum-web-components.adobe.com/?path=/docs/components-asset--docs"
19
+ });
15
20
  }
21
+ super.update(e);
16
22
  }
17
23
  };
18
- i = a, i.VARIANTS = t, e([n({
24
+ a = o, a.VARIANTS = t, e([n({
19
25
  type: String,
20
26
  reflect: !0
21
- })], a.prototype, "variant", void 0), e([n({ type: String })], a.prototype, "label", void 0);
27
+ })], o.prototype, "variant", void 0), e([n({ type: String })], o.prototype, "label", void 0);
22
28
  //#endregion
23
- export { a as AssetBase };
29
+ export { o as AssetBase };
24
30
 
25
31
  //# sourceMappingURL=Asset.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Asset.base.js","names":[],"sources":["../../../components/asset/Asset.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';\n\nimport { ASSET_VARIANTS, type AssetVariant } from './Asset.types.js';\n\nexport abstract class AssetBase extends SpectrumElement {\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the asset.\n *\n * This is an actual internal property, intended not for customer use\n */\n static readonly VARIANTS: readonly AssetVariant[] = ASSET_VARIANTS;\n\n // ─────────────────\n // SHARED API\n // ─────────────────\n\n /**\n * The variant of the asset. When not provided, slot content is rendered (e.g., an image).\n */\n @property({ type: String, reflect: true })\n public variant: AssetVariant | undefined;\n\n /**\n * Accessible label for the asset’s file or folder variant.\n */\n @property({ type: String })\n public label = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (window.__swc?.DEBUG) {\n const constructor = this.constructor as typeof AssetBase;\n if (\n typeof this.variant !== 'undefined' &&\n !constructor.VARIANTS.includes(this.variant)\n ) {\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/asset/',\n {\n issues: [...constructor.VARIANTS],\n }\n );\n }\n }\n }\n}\n"],"mappings":";;;;;OAmBsB,IAAtB,cAAwC,EAAgB;;4BA4BvC;;CAMf,QAA2B,GAA+B;;AAExD,MADA,MAAM,QAAQ,EAAQ,GACtB,IAAI,OAAO,UAAA,QAAA,EAAO,OAAO;GACvB,IAAM,IAAc,KAAK;AACzB,GACS,KAAK,YAAY,UACxB,CAAC,EAAY,SAAS,SAAS,KAAK,QAAQ,IAE5C,OAAO,MAAM,KACX,MACA,IAAI,KAAK,UAAU,wEACnB,0EACA,EACE,QAAQ,CAAC,GAAG,EAAY,SAAS,EAClC,CACF;;;;oBArC6C,MASnD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAMzC,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"Asset.base.js","names":[],"sources":["../../../components/asset/Asset.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 { validateEnum } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport { ASSET_VARIANTS, type AssetVariant } from './Asset.types.js';\n\nexport abstract class AssetBase extends SpectrumElement {\n // ─────────────────────────\n // API TO OVERRIDE\n // ─────────────────────────\n\n /**\n * @internal\n *\n * A readonly array of all valid variants for the asset.\n *\n * This is an actual internal property, intended not for customer use\n */\n static readonly VARIANTS: readonly AssetVariant[] = ASSET_VARIANTS;\n\n // ─────────────────\n // SHARED API\n // ─────────────────\n\n /**\n * The variant of the asset. When not provided, slot content is rendered (e.g., an image).\n */\n @property({ type: String, reflect: true })\n public variant: AssetVariant | undefined;\n\n /**\n * Accessible label for the asset’s file or folder variant.\n */\n @property({ type: String })\n public label = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override update(changes: PropertyValues): void {\n if (typeof this.variant !== 'undefined') {\n const constructor = this.constructor as typeof AssetBase;\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-asset--docs',\n });\n }\n super.update(changes);\n }\n}\n"],"mappings":";;;;;;OAoBsB,IAAtB,cAAwC,EAAgB;;4BA4BvC;;CAMf,OAA0B,GAA+B;AACvD,MAAW,KAAK,YAAY,QAAa;GACvC,IAAM,IAAc,KAAK;AACzB,KAAa,MAAM;IACjB,MAAM;IACN,OAAO,KAAK;IACZ,OAAO,EAAY;IACnB,KAAK;IACN,CAAC;;AAEJ,QAAM,OAAO,EAAQ;;;oBAhC6B,MASnD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAMzC,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA"}
@@ -2,8 +2,9 @@ import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/he
2
2
  import { AVATAR_VALID_SIZES as t } from "./Avatar.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 { warnIf as i } from "@adobe/spectrum-wc-core/utils/index.js";
5
6
  //#region components/avatar/Avatar.base.ts
6
- var i, a = class extends r {
7
+ var a, o = class extends r {
7
8
  constructor(...e) {
8
9
  super(...e), this.src = "", this._size = 500, this.outline = !1, this.disabled = !1, this.decorative = !1;
9
10
  }
@@ -11,46 +12,41 @@ var i, a = class extends r {
11
12
  return this._size;
12
13
  }
13
14
  set size(e) {
14
- let n = t.includes(Number(e)) ? Number(e) : 500;
15
- if (this._size === n) return;
16
- let r = this._size;
17
- this._size = n, this.requestUpdate("size", r);
15
+ let n = t.includes(Number(e)), r = n ? Number(e) : 500;
16
+ if (i(this, !n, `<${this.localName}> expects "size" to be one of: ${t.join(", ")}. Received "${e}".`, "https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs", { issues: [`size="${e}"`] }), this._size === r) return;
17
+ let a = this._size;
18
+ this._size = r, this.requestUpdate("size", a);
18
19
  }
19
20
  firstUpdated(e) {
20
- var t;
21
- super.firstUpdated(e), this.hasAttribute("size") || this.setAttribute("size", String(this.size)), this._syncAriaHidden(), (t = window.__swc) != null && t.DEBUG && this._warnMissingAlt();
21
+ super.firstUpdated(e), this.hasAttribute("size") || this.setAttribute("size", String(this.size)), this._syncAriaHidden(), this._warnMissingAlt();
22
22
  }
23
23
  updated(e) {
24
- var t;
25
- super.updated(e), e.has("decorative") && this._syncAriaHidden(), e.has("alt") && (t = window.__swc) != null && t.DEBUG && this._warnMissingAlt();
24
+ super.updated(e), e.has("decorative") && this._syncAriaHidden(), e.has("alt") && this._warnMissingAlt();
26
25
  }
27
26
  _syncAriaHidden() {
28
27
  this.decorative ? this.setAttribute("aria-hidden", "true") : this.removeAttribute("aria-hidden");
29
28
  }
30
29
  _warnMissingAlt() {
31
- if (this.alt === void 0 && !this.decorative) {
32
- var e;
33
- (e = window.__swc) == null || e.warn(this, `<${this.localName}> is missing an \`alt\` attribute. Provide a text description or pass \`alt=""\` and mark it as \`decorative\`.`, "https://opensource.adobe.com/spectrum-web-components/components/avatar/#accessibility", {
34
- type: "accessibility",
35
- issues: ["Provide an `alt` attribute with meaningful alternative text, or", "Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers)."]
36
- });
37
- }
30
+ i(this, this.alt === void 0 && !this.decorative, `<${this.localName}> is missing an \`alt\` attribute. Provide a text description or pass \`alt=""\` and mark it as \`decorative\`.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs", {
31
+ type: "accessibility",
32
+ issues: ["Provide an `alt` attribute with meaningful alternative text, or", "Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers)."]
33
+ });
38
34
  }
39
35
  };
40
- i = a, i.VALID_SIZES = t, e([n({ type: String })], a.prototype, "src", void 0), e([n({ type: String })], a.prototype, "alt", void 0), e([n({
36
+ a = o, a.VALID_SIZES = t, e([n({ type: String })], o.prototype, "src", void 0), e([n({ type: String })], o.prototype, "alt", void 0), e([n({
41
37
  type: Number,
42
38
  reflect: !0
43
- })], a.prototype, "size", null), e([n({
39
+ })], o.prototype, "size", null), e([n({
44
40
  type: Boolean,
45
41
  reflect: !0
46
- })], a.prototype, "outline", void 0), e([n({
42
+ })], o.prototype, "outline", void 0), e([n({
47
43
  type: Boolean,
48
44
  reflect: !0
49
- })], a.prototype, "disabled", void 0), e([n({
45
+ })], o.prototype, "disabled", void 0), e([n({
50
46
  type: Boolean,
51
47
  reflect: !0
52
- })], a.prototype, "decorative", void 0);
48
+ })], o.prototype, "decorative", void 0);
53
49
  //#endregion
54
- export { a as AvatarBase };
50
+ export { o as AvatarBase };
55
51
 
56
52
  //# sourceMappingURL=Avatar.base.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Avatar.base.js","names":[],"sources":["../../../components/avatar/Avatar.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';\n\nimport {\n AVATAR_DEFAULT_SIZE,\n AVATAR_VALID_SIZES,\n type AvatarSize,\n} from './Avatar.types.js';\n\n/**\n * Base class for the avatar component.\n *\n * Provides the core API for displaying a circular profile image. Concrete\n * classes supply the stylesheet and render template.\n */\nexport abstract class AvatarBase extends SpectrumElement {\n // ─────────────────────────\n // STATIC\n // ─────────────────────────\n\n /**\n * @internal\n *\n * The set of valid numeric size values for the avatar.\n *\n * This is an internal property not intended for consumer use, but used in\n * internal validation logic, stories, and tests to keep them in sync with\n * the canonical type definition in `Avatar.types.ts`.\n */\n static readonly VALID_SIZES: readonly AvatarSize[] = AVATAR_VALID_SIZES;\n\n // ──────────────────\n // CORE API\n // ──────────────────\n\n /**\n * URL of the profile image to display.\n */\n @property({ type: String })\n public src = '';\n\n /**\n * Text description of the avatar image.\n */\n @property({ type: String })\n public alt: string | undefined;\n\n // ───────────────────\n // SIZE API\n // ───────────────────\n\n /**\n * The size of the avatar. Invalid values fall back to the default (500).\n *\n * @default 500\n */\n @property({ type: Number, reflect: true })\n public get size(): AvatarSize {\n return this._size;\n }\n\n public set size(value: AvatarSize) {\n const validSize = (AVATAR_VALID_SIZES as readonly number[]).includes(\n Number(value)\n )\n ? (Number(value) as AvatarSize)\n : AVATAR_DEFAULT_SIZE;\n\n if (this._size === validSize) {\n return;\n }\n\n const oldSize = this._size;\n this._size = validSize;\n this.requestUpdate('size', oldSize);\n }\n\n private _size: AvatarSize = AVATAR_DEFAULT_SIZE;\n\n // ───────────────────────\n // VISUAL API\n // ───────────────────────\n\n /**\n * Renders a visual outline around the avatar image.\n */\n @property({ type: Boolean, reflect: true })\n public outline = false;\n\n /**\n * Renders the avatar at reduced opacity, indicating the entity is inactive or unavailable.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n // ───────────────────────────\n // ACCESSIBILITY API\n // ───────────────────────────\n\n /**\n * Marks the avatar as decorative, hiding it from assistive technology.\n */\n @property({ type: Boolean, reflect: true })\n public decorative = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('size')) {\n this.setAttribute('size', String(this.size));\n }\n this._syncAriaHidden();\n if (window.__swc?.DEBUG) {\n this._warnMissingAlt();\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('decorative')) {\n this._syncAriaHidden();\n }\n if (changes.has('alt') && window.__swc?.DEBUG) {\n this._warnMissingAlt();\n }\n }\n\n private _syncAriaHidden(): void {\n if (this.decorative) {\n this.setAttribute('aria-hidden', 'true');\n } else {\n this.removeAttribute('aria-hidden');\n }\n }\n\n private _warnMissingAlt(): void {\n if (this.alt === undefined && !this.decorative) {\n window.__swc?.warn(\n this,\n `<${this.localName}> is missing an \\`alt\\` attribute. Provide a text description or pass \\`alt=\"\"\\` and mark it as \\`decorative\\`.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/avatar/#accessibility',\n {\n type: 'accessibility',\n issues: [\n 'Provide an `alt` attribute with meaningful alternative text, or',\n 'Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers).',\n ],\n }\n );\n }\n }\n}\n"],"mappings":";;;;;OA4BsB,IAAtB,cAAyC,EAAgB;;0BAwB1C,qCAgDI,oBAMC,sBAUE;;CA/CpB,IACW,OAAmB;AAC5B,SAAO,KAAK;;CAGd,IAAW,KAAK,GAAmB;EACjC,IAAM,IAAa,EAAyC,SAC1D,OAAO,EAAM,CACd,GACI,OAAO,EAAM,GAAA;AAGlB,MAAI,KAAK,UAAU,EACjB;EAGF,IAAM,IAAU,KAAK;AAErB,EADA,KAAK,QAAQ,GACb,KAAK,cAAc,QAAQ,EAAQ;;CAmCrC,aAAgC,GAA+B;;AAM7D,EALA,MAAM,aAAa,EAAQ,EACtB,KAAK,aAAa,OAAO,IAC5B,KAAK,aAAa,QAAQ,OAAO,KAAK,KAAK,CAAC,EAE9C,KAAK,iBAAiB,GACtB,IAAI,OAAO,UAAA,QAAA,EAAO,SAChB,KAAK,iBAAiB;;CAI1B,QAA2B,GAA+B;;AAKxD,EAJA,MAAM,QAAQ,EAAQ,EAClB,EAAQ,IAAI,aAAa,IAC3B,KAAK,iBAAiB,EAEpB,EAAQ,IAAI,MAAM,KAAA,IAAI,OAAO,UAAA,QAAA,EAAO,SACtC,KAAK,iBAAiB;;CAI1B,kBAAgC;AAC9B,EAAI,KAAK,aACP,KAAK,aAAa,eAAe,OAAO,GAExC,KAAK,gBAAgB,cAAc;;CAIvC,kBAAgC;AAC9B,MAAI,KAAK,QAAQ,KAAA,KAAa,CAAC,KAAK,YAAY;;AAC9C,IAAA,IAAA,OAAO,UAAA,QAAA,EAAO,KACZ,MACA,IAAI,KAAK,UAAU,kHACnB,yFACA;IACE,MAAM;IACN,QAAQ,CACN,mEACA,kFACD;IACF,CACF;;;;uBA1HgD,MASpD,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAM1B,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAY1B,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,KA8BzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAU1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,cAAA,KAAA,EAAA"}
1
+ {"version":3,"file":"Avatar.base.js","names":[],"sources":["../../../components/avatar/Avatar.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 { warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n AVATAR_DEFAULT_SIZE,\n AVATAR_VALID_SIZES,\n type AvatarSize,\n} from './Avatar.types.js';\n\n/**\n * Base class for the avatar component.\n *\n * Provides the core API for displaying a circular profile image. Concrete\n * classes supply the stylesheet and render template.\n */\nexport abstract class AvatarBase extends SpectrumElement {\n // ─────────────────────────\n // STATIC\n // ─────────────────────────\n\n /**\n * @internal\n *\n * The set of valid numeric size values for the avatar.\n *\n * This is an internal property not intended for consumer use, but used in\n * internal validation logic, stories, and tests to keep them in sync with\n * the canonical type definition in `Avatar.types.ts`.\n */\n static readonly VALID_SIZES: readonly AvatarSize[] = AVATAR_VALID_SIZES;\n\n // ──────────────────\n // CORE API\n // ──────────────────\n\n /**\n * URL of the profile image to display.\n */\n @property({ type: String })\n public src = '';\n\n /**\n * Text description of the avatar image.\n */\n @property({ type: String })\n public alt: string | undefined;\n\n // ───────────────────\n // SIZE API\n // ───────────────────\n\n /**\n * The size of the avatar. Invalid values fall back to the default (500).\n *\n * @default 500\n */\n @property({ type: Number, reflect: true })\n public get size(): AvatarSize {\n return this._size;\n }\n\n public set size(value: AvatarSize) {\n const isValid = (AVATAR_VALID_SIZES as readonly number[]).includes(\n Number(value)\n );\n const validSize = isValid\n ? (Number(value) as AvatarSize)\n : AVATAR_DEFAULT_SIZE;\n\n warnIf(\n this,\n !isValid,\n `<${this.localName}> expects \"size\" to be one of: ${AVATAR_VALID_SIZES.join(', ')}. Received \"${value}\".`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',\n { issues: [`size=\"${value}\"`] }\n );\n\n if (this._size === validSize) {\n return;\n }\n\n const oldSize = this._size;\n this._size = validSize;\n this.requestUpdate('size', oldSize);\n }\n\n private _size: AvatarSize = AVATAR_DEFAULT_SIZE;\n\n // ───────────────────────\n // VISUAL API\n // ───────────────────────\n\n /**\n * Renders a visual outline around the avatar image.\n */\n @property({ type: Boolean, reflect: true })\n public outline = false;\n\n /**\n * Renders the avatar at reduced opacity, indicating the entity is inactive or unavailable.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n // ───────────────────────────\n // ACCESSIBILITY API\n // ───────────────────────────\n\n /**\n * Marks the avatar as decorative, hiding it from assistive technology.\n */\n @property({ type: Boolean, reflect: true })\n public decorative = false;\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n if (!this.hasAttribute('size')) {\n this.setAttribute('size', String(this.size));\n }\n this._syncAriaHidden();\n this._warnMissingAlt();\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n if (changes.has('decorative')) {\n this._syncAriaHidden();\n }\n if (changes.has('alt')) {\n this._warnMissingAlt();\n }\n }\n\n private _syncAriaHidden(): void {\n if (this.decorative) {\n this.setAttribute('aria-hidden', 'true');\n } else {\n this.removeAttribute('aria-hidden');\n }\n }\n\n private _warnMissingAlt(): void {\n warnIf(\n this,\n this.alt === undefined && !this.decorative,\n `<${this.localName}> is missing an \\`alt\\` attribute. Provide a text description or pass \\`alt=\"\"\\` and mark it as \\`decorative\\`.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-avatar--docs',\n {\n type: 'accessibility',\n issues: [\n 'Provide an `alt` attribute with meaningful alternative text, or',\n 'Set `alt=\"\"` and mark the image as `decorative` (hidden from screen readers).',\n ],\n }\n );\n }\n}\n"],"mappings":";;;;;;OA6BsB,IAAtB,cAAyC,EAAgB;;0BAwB1C,qCAyDI,oBAMC,sBAUE;;CAxDpB,IACW,OAAmB;AAC5B,SAAO,KAAK;;CAGd,IAAW,KAAK,GAAmB;EACjC,IAAM,IAAW,EAAyC,SACxD,OAAO,EAAM,CACd,EACK,IAAY,IACb,OAAO,EAAM,GAAA;AAWlB,MARA,EACE,MACA,CAAC,GACD,IAAI,KAAK,UAAU,iCAAiC,EAAmB,KAAK,KAAK,CAAC,cAAc,EAAM,KACtG,iFACA,EAAE,QAAQ,CAAC,SAAS,EAAM,GAAG,EAAE,CAChC,EAEG,KAAK,UAAU,EACjB;EAGF,IAAM,IAAU,KAAK;AAErB,EADA,KAAK,QAAQ,GACb,KAAK,cAAc,QAAQ,EAAQ;;CAmCrC,aAAgC,GAA+B;AAM7D,EALA,MAAM,aAAa,EAAQ,EACtB,KAAK,aAAa,OAAO,IAC5B,KAAK,aAAa,QAAQ,OAAO,KAAK,KAAK,CAAC,EAE9C,KAAK,iBAAiB,EACtB,KAAK,iBAAiB;;CAGxB,QAA2B,GAA+B;AAKxD,EAJA,MAAM,QAAQ,EAAQ,EAClB,EAAQ,IAAI,aAAa,IAC3B,KAAK,iBAAiB,EAEpB,EAAQ,IAAI,MAAM,IACpB,KAAK,iBAAiB;;CAI1B,kBAAgC;AAC9B,EAAI,KAAK,aACP,KAAK,aAAa,eAAe,OAAO,GAExC,KAAK,gBAAgB,cAAc;;CAIvC,kBAAgC;AAC9B,IACE,MACA,KAAK,QAAQ,KAAA,KAAa,CAAC,KAAK,YAChC,IAAI,KAAK,UAAU,kHACnB,iFACA;GACE,MAAM;GACN,QAAQ,CACN,mEACA,kFACD;GACF,CACF;;;uBAjIkD,MASpD,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAM1B,EAAS,EAAE,MAAM,QAAQ,CAAC,CAAA,EAAA,EAAA,WAAA,OAAA,KAAA,EAAA,KAY1B,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,QAAA,KAAA,KAuCzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,EAAA,KAM1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAU1C,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,cAAA,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 { BadgeSize, BadgeVariant, FixedValues } from './Badge.types.js';
4
6
  declare const BadgeBase_base: typeof SpectrumElement & {
5
- new (...args: any[]): import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
6
- prototype: import('../../mixins/observe-slot-presence.js').SlotPresenceObservingInterface;
7
- } & {
8
- new (...args: any[]): import('../../mixins/observe-slot-text.js').SlotTextObservingInterface;
9
- prototype: import('../../mixins/observe-slot-text.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;
@@ -19,8 +15,6 @@ declare const BadgeBase_base: typeof SpectrumElement & {
19
15
  *
20
16
  * @slot - Text label of the badge.
21
17
  * @slot icon - Optional icon that appears to the left of the label
22
- *
23
- * @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.
24
18
  */
25
19
  export declare abstract class BadgeBase extends BadgeBase_base {
26
20
  /**
@@ -87,12 +81,34 @@ export declare abstract class BadgeBase extends BadgeBase_base {
87
81
  * Can only be used with semantic variants.
88
82
  */
89
83
  outline: boolean;
84
+ /**
85
+ * Observes whether an icon is slotted into `[slot="icon"]`.
86
+ *
87
+ * @internal
88
+ */
89
+ protected slotPresence: SlotPresenceController;
90
+ /**
91
+ * Observes whether the default slot has meaningful text content. The default
92
+ * slot must bind `@slotchange=${this.slotText.handleSlotChange}` for changes
93
+ * after the first render to be tracked.
94
+ *
95
+ * @internal
96
+ */
97
+ protected slotText: SlotTextController;
90
98
  /**
91
99
  * @internal
92
100
  *
93
101
  * Used for rendering gap when the badge has an icon.
94
102
  */
95
103
  protected get hasIcon(): boolean;
104
+ /**
105
+ * Whether the default slot has meaningful text content. Consumed by the
106
+ * concrete element's `render()` to toggle icon-only presentation (the
107
+ * `swc-Badge--no-label` class and its icon-only padding tokens).
108
+ *
109
+ * @internal
110
+ */
111
+ protected get slotHasContent(): boolean;
96
112
  protected update(changedProperties: PropertyValues): void;
97
113
  }
98
114
  export {};
@@ -3,42 +3,47 @@ import { BADGE_VALID_SIZES as t, BADGE_VARIANTS_SEMANTIC as n, FIXED_VALUES as r
3
3
  import { property as i } from "lit/decorators.js";
4
4
  import { SpectrumElement as a } from "@adobe/spectrum-wc-core/element/index.js";
5
5
  import { SizedMixin as o } from "@adobe/spectrum-wc-core/mixins/index.js";
6
- import { ObserveSlotPresence as s } from "@adobe/spectrum-wc-core/mixins/observe-slot-presence.js";
7
- import { ObserveSlotText as c } from "@adobe/spectrum-wc-core/mixins/observe-slot-text.js";
6
+ import { validateEnum as s, warnIf as c } from "@adobe/spectrum-wc-core/utils/index.js";
7
+ import { SlotPresenceController as l } from "@adobe/spectrum-wc-core/controllers/slot-presence-controller/index.js";
8
+ import { SlotTextController as u } from "@adobe/spectrum-wc-core/controllers/slot-text-controller/index.js";
8
9
  //#region components/badge/Badge.base.ts
9
- var l, u = class extends o(c(s(a, "[slot=\"icon\"]"), ""), {
10
+ var d, f = class extends o(a, {
10
11
  validSizes: t,
11
12
  defaultSize: "s"
12
13
  }) {
13
14
  constructor(...e) {
14
- super(...e), this.variant = "neutral", this.subtle = !1, this.outline = !1;
15
+ super(...e), this.variant = "neutral", this.subtle = !1, this.outline = !1, this.slotPresence = new l(this, "[slot=\"icon\"]"), this.slotText = new u(this);
15
16
  }
16
17
  get hasIcon() {
17
- return this.slotContentIsPresent;
18
+ return this.slotPresence.isPresent;
19
+ }
20
+ get slotHasContent() {
21
+ return this.slotText.hasContent;
18
22
  }
19
23
  update(e) {
20
- var t;
21
- if ((t = window.__swc) != null && t.DEBUG) {
22
- let e = this.constructor;
23
- e.VARIANTS.includes(this.variant) || window.__swc.warn(this, `<${this.localName}> element expects the "variant" attribute to be one of the following:`, "https://opensource.adobe.com/spectrum-web-components/components/badge/#variants", { issues: [...e.VARIANTS] }), "outline" in this && this.outline === !0 && !e.VARIANTS_SEMANTIC.includes(this.variant) && window.__swc.warn(this, `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`, "https://opensource.adobe.com/spectrum-web-components/components/badge/#variants", { issues: [...e.VARIANTS_SEMANTIC] });
24
- }
25
- super.update(e);
24
+ let t = this.constructor;
25
+ s(this, {
26
+ prop: "variant",
27
+ value: this.variant,
28
+ valid: t.VARIANTS,
29
+ url: "https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs"
30
+ }), c(this, "outline" in this && this.outline === !0 && !t.VARIANTS_SEMANTIC.includes(this.variant), `<${this.localName}> element only supports the outline styling if the variant is a semantic color variant.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-badge--docs", { issues: [...t.VARIANTS_SEMANTIC] }), super.update(e);
26
31
  }
27
32
  };
28
- l = u, l.FIXED_VALUES = r, l.VARIANTS_SEMANTIC = n, e([i({
33
+ d = f, d.FIXED_VALUES = r, d.VARIANTS_SEMANTIC = n, e([i({
29
34
  type: String,
30
35
  reflect: !0
31
- })], u.prototype, "variant", void 0), e([i({
36
+ })], f.prototype, "variant", void 0), e([i({
32
37
  type: String,
33
38
  reflect: !0
34
- })], u.prototype, "fixed", void 0), e([i({
39
+ })], f.prototype, "fixed", void 0), e([i({
35
40
  type: Boolean,
36
41
  reflect: !0
37
- })], u.prototype, "subtle", void 0), e([i({
42
+ })], f.prototype, "subtle", void 0), e([i({
38
43
  type: Boolean,
39
44
  reflect: !0
40
- })], u.prototype, "outline", void 0);
45
+ })], f.prototype, "outline", void 0);
41
46
  //#endregion
42
- export { u as BadgeBase };
47
+ export { f as BadgeBase };
43
48
 
44
49
  //# sourceMappingURL=Badge.base.js.map
@@ -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