@spectrum-web-components/badge 0.36.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/badge",
3
- "version": "0.36.0",
3
+ "version": "0.38.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -57,8 +57,8 @@
57
57
  "lit-html"
58
58
  ],
59
59
  "dependencies": {
60
- "@spectrum-web-components/base": "^0.36.0",
61
- "@spectrum-web-components/shared": "^0.36.0"
60
+ "@spectrum-web-components/base": "^0.38.0",
61
+ "@spectrum-web-components/shared": "^0.38.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@spectrum-css/badge": "^3.1.0"
@@ -69,5 +69,5 @@
69
69
  "./sp-*.js",
70
70
  "./**/*.dev.js"
71
71
  ],
72
- "gitHead": "a532ff8a410abeefb54d9638a2316ae82570566e"
72
+ "gitHead": "9a099b7543672f2fd4030833ab813b16c2cad62e"
73
73
  }
package/src/Badge.dev.js CHANGED
@@ -12,6 +12,7 @@ var __decorateClass = (decorators, target, key, kind) => {
12
12
  };
13
13
  import {
14
14
  html,
15
+ nothing,
15
16
  SizedMixin,
16
17
  SpectrumElement
17
18
  } from "@spectrum-web-components/base";
@@ -40,7 +41,10 @@ export const FIXED_VALUES = [
40
41
  "block-end"
41
42
  ];
42
43
  export class Badge extends SizedMixin(
43
- ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot="icon"]'), "")
44
+ ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot="icon"]'), ""),
45
+ {
46
+ noDefaultSize: true
47
+ }
44
48
  ) {
45
49
  constructor() {
46
50
  super(...arguments);
@@ -98,7 +102,7 @@ export class Badge extends SizedMixin(
98
102
  name="icon"
99
103
  ?icon-only=${!this.slotHasContent}
100
104
  ></slot>
101
- ` : html``}
105
+ ` : nothing}
102
106
  <div class="label">
103
107
  <slot></slot>
104
108
  </div>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Badge.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'accent',\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\nexport const FIXED_VALUES_DEPRECATED = ['top', 'bottom', 'left', 'right'];\nexport const FIXED_VALUES = [\n 'inline-start',\n 'inline-end',\n 'block-start',\n 'block-end',\n] as const;\nexport type FixedValues =\n | typeof FIXED_VALUES[number]\n | typeof FIXED_VALUES_DEPRECATED[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), '')\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) return;\n const oldValue = this.fixed;\n if (window.__swc.DEBUG) {\n if (fixed && FIXED_VALUES_DEPRECATED.includes(fixed)) {\n window.__swc.warn(\n this,\n `The following values for \"fixed\" in <${this.localName}> have been deprecated. They will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n {\n issues: [...FIXED_VALUES_DEPRECATED],\n }\n );\n }\n }\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS],\n }\n );\n }\n }\n return html`\n ${this.hasIcon\n ? html`\n <slot\n name=\"icon\"\n ?icon-only=${!this.slotHasContent}\n ></slot>\n `\n : html``}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,OAAO,YAAY;AAEZ,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEO,aAAM,0BAA0B,CAAC,OAAO,UAAU,QAAQ,OAAO;AACjE,aAAM,eAAe;AAAA,EACxB;AAAA,EACA;AAAA,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S,EAAE,SAAS,KAAK,CAAC;AAAA,GAPlB,MAQE;AA+BJ;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAtChC,MAuCF;",
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'accent',\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\nexport const FIXED_VALUES_DEPRECATED = ['top', 'bottom', 'left', 'right'];\nexport const FIXED_VALUES = [\n 'inline-start',\n 'inline-end',\n 'block-start',\n 'block-end',\n] as const;\nexport type FixedValues =\n | typeof FIXED_VALUES[number]\n | typeof FIXED_VALUES_DEPRECATED[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) return;\n const oldValue = this.fixed;\n if (window.__swc.DEBUG) {\n if (fixed && FIXED_VALUES_DEPRECATED.includes(fixed)) {\n window.__swc.warn(\n this,\n `The following values for \"fixed\" in <${this.localName}> have been deprecated. They will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n {\n issues: [...FIXED_VALUES_DEPRECATED],\n }\n );\n }\n }\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS],\n }\n );\n }\n }\n return html`\n ${this.hasIcon\n ? html`\n <slot\n name=\"icon\"\n ?icon-only=${!this.slotHasContent}\n ></slot>\n `\n : nothing}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,OAAO,YAAY;AAEZ,aAAM,iBAAiB;AAAA,EAC1B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AAEO,aAA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AA;AAAA,uCAGqB,CAAC,KAAK,cAAc;AAAA;AAAA,sBAGzC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKrB;AACJ;AAhEe;AAAA,EADV,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAVlB,MAWE;AA+BJ;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,SAAS,KAAK,CAAC;AAAA,GAzChC,MA0CF;",
6
6
  "names": []
7
7
  }
package/src/Badge.js CHANGED
@@ -1,10 +1,10 @@
1
- "use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var a=(s,o,e,i)=>{for(var t=i>1?void 0:i?p(o,e):o,r=s.length-1,n;r>=0;r--)(n=s[r])&&(t=(i?n(o,e,t):n(t))||t);return i&&t&&d(o,e,t),t};import{html as l,SizedMixin as u,SpectrumElement as f}from"@spectrum-web-components/base";import{property as c}from"@spectrum-web-components/base/src/decorators.js";import{ObserveSlotText as m}from"@spectrum-web-components/shared/src/observe-slot-text.js";import{ObserveSlotPresence as E}from"@spectrum-web-components/shared/src/observe-slot-presence.js";import h from"./badge.css.js";export const BADGE_VARIANTS=["accent","neutral","informative","positive","negative","fuchsia","indigo","magenta","purple","seafoam","yellow"],FIXED_VALUES_DEPRECATED=["top","bottom","left","right"],FIXED_VALUES=["inline-start","inline-end","block-start","block-end"];export class Badge extends u(m(E(f,'[slot="icon"]'),"")){constructor(){super(...arguments);this.variant="informative"}static get styles(){return[h]}get fixed(){return this._fixed}set fixed(e){if(e===this.fixed)return;const i=this.fixed;this._fixed=e,e?this.setAttribute("fixed",e):this.removeAttribute("fixed"),this.requestUpdate("fixed",i)}get hasIcon(){return this.slotContentIsPresent}render(){return l`
1
+ "use strict";var d=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var a=(s,o,e,i)=>{for(var t=i>1?void 0:i?p(o,e):o,n=s.length-1,r;n>=0;n--)(r=s[n])&&(t=(i?r(o,e,t):r(t))||t);return i&&t&&d(o,e,t),t};import{html as l,nothing as u,SizedMixin as f,SpectrumElement as m}from"@spectrum-web-components/base";import{property as c}from"@spectrum-web-components/base/src/decorators.js";import{ObserveSlotText as E}from"@spectrum-web-components/shared/src/observe-slot-text.js";import{ObserveSlotPresence as h}from"@spectrum-web-components/shared/src/observe-slot-presence.js";import b from"./badge.css.js";export const BADGE_VARIANTS=["accent","neutral","informative","positive","negative","fuchsia","indigo","magenta","purple","seafoam","yellow"],FIXED_VALUES_DEPRECATED=["top","bottom","left","right"],FIXED_VALUES=["inline-start","inline-end","block-start","block-end"];export class Badge extends f(E(h(m,'[slot="icon"]'),""),{noDefaultSize:!0}){constructor(){super(...arguments);this.variant="informative"}static get styles(){return[b]}get fixed(){return this._fixed}set fixed(e){if(e===this.fixed)return;const i=this.fixed;this._fixed=e,e?this.setAttribute("fixed",e):this.removeAttribute("fixed"),this.requestUpdate("fixed",i)}get hasIcon(){return this.slotContentIsPresent}render(){return l`
2
2
  ${this.hasIcon?l`
3
3
  <slot
4
4
  name="icon"
5
5
  ?icon-only=${!this.slotHasContent}
6
6
  ></slot>
7
- `:l``}
7
+ `:u}
8
8
  <div class="label">
9
9
  <slot></slot>
10
10
  </div>
package/src/Badge.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["Badge.ts"],
4
- "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'accent',\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\nexport const FIXED_VALUES_DEPRECATED = ['top', 'bottom', 'left', 'right'];\nexport const FIXED_VALUES = [\n 'inline-start',\n 'inline-end',\n 'block-start',\n 'block-end',\n] as const;\nexport type FixedValues =\n | typeof FIXED_VALUES[number]\n | typeof FIXED_VALUES_DEPRECATED[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), '')\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) return;\n const oldValue = this.fixed;\n if (window.__swc.DEBUG) {\n if (fixed && FIXED_VALUES_DEPRECATED.includes(fixed)) {\n window.__swc.warn(\n this,\n `The following values for \"fixed\" in <${this.localName}> have been deprecated. They will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n {\n issues: [...FIXED_VALUES_DEPRECATED],\n }\n );\n }\n }\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS],\n }\n );\n }\n }\n return html`\n ${this.hasIcon\n ? html`\n <slot\n name=\"icon\"\n ?icon-only=${!this.slotHasContent}\n ></slot>\n `\n : html``}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAS,mBAAAC,MAAuB,2DAChC,OAAS,uBAAAC,MAA2B,+DACpC,OAAOC,MAAY,iBAEZ,aAAM,eAAiB,CAC1B,SACA,UACA,cACA,WACA,WACA,UACA,SACA,UACA,SACA,UACA,QACJ,EAEa,wBAA0B,CAAC,MAAO,SAAU,OAAQ,OAAO,EAC3D,aAAe,CACxB,eACA,aACA,cACA,WACJ,EAWO,aAAM,cAAcL,EACvBG,EAAgBC,EAAoBH,EAAiB,eAAe,EAAG,EAAE,CAC7E,CAAE,CAFK,kCAuCH,KAAO,QAAwB,cApC/B,WAA2B,QAAyB,CAChD,MAAO,CAACI,CAAM,CAClB,CAGA,IAAW,OAAiC,CACxC,OAAO,KAAK,MAChB,CAEA,IAAW,MAAMC,EAAgC,CAC7C,GAAIA,IAAU,KAAK,MAAO,OAC1B,MAAMC,EAAW,KAAK,MAatB,KAAK,OAASD,EACVA,EACA,KAAK,aAAa,QAASA,CAAK,EAEhC,KAAK,gBAAgB,OAAO,EAEhC,KAAK,cAAc,QAASC,CAAQ,CACxC,CAOA,IAAc,SAAmB,CAC7B,OAAO,KAAK,oBAChB,CAEmB,QAAyB,CAaxC,OAAOR;AAAA,cACD,KAAK,QACDA;AAAA;AAAA;AAAA,uCAGqB,CAAC,KAAK,cAAc;AAAA;AAAA,oBAGzCA,GAAM;AAAA;AAAA;AAAA;AAAA,SAKpB,CACJ,CAhEeS,EAAA,CADVN,EAAS,CAAE,QAAS,EAAK,CAAC,GAPlB,MAQE,qBA+BJM,EAAA,CADNN,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAtChC,MAuCF",
6
- "names": ["html", "SizedMixin", "SpectrumElement", "property", "ObserveSlotText", "ObserveSlotPresence", "styles", "fixed", "oldValue", "__decorateClass"]
4
+ "sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n CSSResultArray,\n html,\n nothing,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport { ObserveSlotText } from '@spectrum-web-components/shared/src/observe-slot-text.js';\nimport { ObserveSlotPresence } from '@spectrum-web-components/shared/src/observe-slot-presence.js';\nimport styles from './badge.css.js';\n\nexport const BADGE_VARIANTS = [\n 'accent',\n 'neutral',\n 'informative',\n 'positive',\n 'negative',\n 'fuchsia',\n 'indigo',\n 'magenta',\n 'purple',\n 'seafoam',\n 'yellow',\n] as const;\nexport type BadgeVariant = typeof BADGE_VARIANTS[number];\nexport const FIXED_VALUES_DEPRECATED = ['top', 'bottom', 'left', 'right'];\nexport const FIXED_VALUES = [\n 'inline-start',\n 'inline-end',\n 'block-start',\n 'block-end',\n] as const;\nexport type FixedValues =\n | typeof FIXED_VALUES[number]\n | typeof FIXED_VALUES_DEPRECATED[number];\n\n/**\n * @element sp-badge\n *\n * @slot - Text label of the badge\n * @slot icon - Optional icon that appears to the left of the label\n */\nexport class Badge extends SizedMixin(\n ObserveSlotText(ObserveSlotPresence(SpectrumElement, '[slot=\"icon\"]'), ''),\n {\n noDefaultSize: true,\n }\n) {\n public static override get styles(): CSSResultArray {\n return [styles];\n }\n\n @property({ reflect: true })\n public get fixed(): FixedValues | undefined {\n return this._fixed;\n }\n\n public set fixed(fixed: FixedValues | undefined) {\n if (fixed === this.fixed) return;\n const oldValue = this.fixed;\n if (window.__swc.DEBUG) {\n if (fixed && FIXED_VALUES_DEPRECATED.includes(fixed)) {\n window.__swc.warn(\n this,\n `The following values for \"fixed\" in <${this.localName}> have been deprecated. They will be removed in a future release.`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#fixed',\n {\n issues: [...FIXED_VALUES_DEPRECATED],\n }\n );\n }\n }\n this._fixed = fixed;\n if (fixed) {\n this.setAttribute('fixed', fixed);\n } else {\n this.removeAttribute('fixed');\n }\n this.requestUpdate('fixed', oldValue);\n }\n\n private _fixed?: FixedValues;\n\n @property({ type: String, reflect: true })\n public variant: BadgeVariant = 'informative';\n\n protected get hasIcon(): boolean {\n return this.slotContentIsPresent;\n }\n\n protected override render(): TemplateResult {\n if (window.__swc.DEBUG) {\n if (!BADGE_VARIANTS.includes(this.variant)) {\n window.__swc.warn(\n this,\n `<${this.localName}> element expect the \"variant\" attribute to be one of the following:`,\n 'https://opensource.adobe.com/spectrum-web-components/components/badge/#variants',\n {\n issues: [...BADGE_VARIANTS],\n }\n );\n }\n }\n return html`\n ${this.hasIcon\n ? html`\n <slot\n name=\"icon\"\n ?icon-only=${!this.slotHasContent}\n ></slot>\n `\n : nothing}\n <div class=\"label\">\n <slot></slot>\n </div>\n `;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EACA,WAAAC,EACA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAS,mBAAAC,MAAuB,2DAChC,OAAS,uBAAAC,MAA2B,+DACpC,OAAOC,MAAY,iBAEZ,aAAM,eAAiB,CAC1B,SACA,UACA,cACA,WACA,WACA,UACA,SACA,UACA,SACA,UACA,QACJ,EAEa,wBAA0B,CAAC,MAAO,SAAU,OAAQ,OAAO,EAC3D,aAAe,CACxB,eACA,aACA,cACA,WACJ,EAWO,aAAM,cAAcL,EACvBG,EAAgBC,EAAoBH,EAAiB,eAAe,EAAG,EAAE,EACzE,CACI,cAAe,EACnB,CACJ,CAAE,CALK,kCA0CH,KAAO,QAAwB,cApC/B,WAA2B,QAAyB,CAChD,MAAO,CAACI,CAAM,CAClB,CAGA,IAAW,OAAiC,CACxC,OAAO,KAAK,MAChB,CAEA,IAAW,MAAMC,EAAgC,CAC7C,GAAIA,IAAU,KAAK,MAAO,OAC1B,MAAMC,EAAW,KAAK,MAatB,KAAK,OAASD,EACVA,EACA,KAAK,aAAa,QAASA,CAAK,EAEhC,KAAK,gBAAgB,OAAO,EAEhC,KAAK,cAAc,QAASC,CAAQ,CACxC,CAOA,IAAc,SAAmB,CAC7B,OAAO,KAAK,oBAChB,CAEmB,QAAyB,CAaxC,OAAOT;AAAA,cACD,KAAK,QACDA;AAAA;AAAA;AAAA,uCAGqB,CAAC,KAAK,cAAc;AAAA;AAAA,oBAGzCC,CAAO;AAAA;AAAA;AAAA;AAAA,SAKrB,CACJ,CAhEeS,EAAA,CADVN,EAAS,CAAE,QAAS,EAAK,CAAC,GAVlB,MAWE,qBA+BJM,EAAA,CADNN,EAAS,CAAE,KAAM,OAAQ,QAAS,EAAK,CAAC,GAzChC,MA0CF",
6
+ "names": ["html", "nothing", "SizedMixin", "SpectrumElement", "property", "ObserveSlotText", "ObserveSlotPresence", "styles", "fixed", "oldValue", "__decorateClass"]
7
7
  }
@@ -32,10 +32,11 @@ const config = {
32
32
  ],
33
33
  components: [
34
34
  converter.classToHost(),
35
+ // Default to `size='m'` without needing the attribute
36
+ converter.classToHost('spectrum-Badge--sizeM'),
35
37
  ...converter.enumerateAttributes(
36
38
  [
37
39
  ['spectrum-Badge--sizeS', 's'],
38
- ['spectrum-Badge--sizeM', 'm'],
39
40
  ['spectrum-Badge--sizeL', 'l'],
40
41
  ['spectrum-Badge--sizeXL', 'xl'],
41
42
  ],