@spectrum-web-components/icon 0.34.0 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -117,9 +117,10 @@
117
117
  "kind": "field",
118
118
  "name": "label",
119
119
  "type": {
120
- "text": "string | undefined"
120
+ "text": "string"
121
121
  },
122
122
  "privacy": "public",
123
+ "default": "''",
123
124
  "attribute": "label",
124
125
  "inheritedFrom": {
125
126
  "name": "IconBase",
@@ -167,8 +168,9 @@
167
168
  {
168
169
  "name": "label",
169
170
  "type": {
170
- "text": "string | undefined"
171
+ "text": "string"
171
172
  },
173
+ "default": "''",
172
174
  "fieldName": "label",
173
175
  "inheritedFrom": {
174
176
  "name": "IconBase",
@@ -219,9 +221,10 @@
219
221
  "kind": "field",
220
222
  "name": "label",
221
223
  "type": {
222
- "text": "string | undefined"
224
+ "text": "string"
223
225
  },
224
226
  "privacy": "public",
227
+ "default": "''",
225
228
  "attribute": "label"
226
229
  },
227
230
  {
@@ -239,8 +242,9 @@
239
242
  {
240
243
  "name": "label",
241
244
  "type": {
242
- "text": "string | undefined"
245
+ "text": "string"
243
246
  },
247
+ "default": "''",
244
248
  "fieldName": "label"
245
249
  },
246
250
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spectrum-web-components/icon",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -71,11 +71,11 @@
71
71
  "lit-html"
72
72
  ],
73
73
  "dependencies": {
74
- "@spectrum-web-components/base": "^0.34.0",
75
- "@spectrum-web-components/iconset": "^0.34.0"
74
+ "@spectrum-web-components/base": "^0.35.0",
75
+ "@spectrum-web-components/iconset": "^0.35.0"
76
76
  },
77
77
  "devDependencies": {
78
- "@spectrum-css/icon": "^3.0.48"
78
+ "@spectrum-css/icon": "^3.0.49"
79
79
  },
80
80
  "types": "./src/index.d.ts",
81
81
  "customElements": "custom-elements.json",
@@ -83,5 +83,5 @@
83
83
  "./sp-*.js",
84
84
  "./**/*.dev.js"
85
85
  ],
86
- "gitHead": "f9b3294d67cdd52b2c36897cdc1c20ceaeb019cf"
86
+ "gitHead": "1ee5a6c92838cdf48321276d97f61c20f8476ac1"
87
87
  }
package/src/IconBase.d.ts CHANGED
@@ -1,7 +1,8 @@
1
- import { CSSResultArray, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
1
+ import { CSSResultArray, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
2
2
  export declare class IconBase extends SpectrumElement {
3
3
  static get styles(): CSSResultArray;
4
- label?: string;
4
+ label: string;
5
5
  size?: 's' | 'm' | 'l' | 'xl' | 'xxl';
6
+ protected update(changes: PropertyValues): void;
6
7
  protected render(): TemplateResult;
7
8
  }
@@ -17,9 +17,23 @@ import {
17
17
  import { property } from "@spectrum-web-components/base/src/decorators.js";
18
18
  import iconStyles from "./icon.css.js";
19
19
  export class IconBase extends SpectrumElement {
20
+ constructor() {
21
+ super(...arguments);
22
+ this.label = "";
23
+ }
20
24
  static get styles() {
21
25
  return [iconStyles];
22
26
  }
27
+ update(changes) {
28
+ if (changes.has("label")) {
29
+ if (this.label) {
30
+ this.removeAttribute("aria-hidden");
31
+ } else {
32
+ this.setAttribute("aria-hidden", "true");
33
+ }
34
+ }
35
+ super.update(changes);
36
+ }
23
37
  render() {
24
38
  return html`
25
39
  <slot></slot>
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["IconBase.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 SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport iconStyles from './icon.css.js';\n\nexport class IconBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [iconStyles];\n }\n\n @property()\n public label?: string;\n\n @property({ reflect: true })\n public size?: 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n}\n"],
5
- "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EACA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,gBAAgB;AAEhB,aAAM,iBAAiB,gBAAgB;AAAA,EAC1C,WAA2B,SAAyB;AAChD,WAAO,CAAC,UAAU;AAAA,EACtB;AAAA,EAQmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,EAGX;AACJ;AAVW;AAAA,EADN,SAAS;AAAA,GALD,SAMF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GARlB,SASF;",
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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport iconStyles from './icon.css.js';\n\nexport class IconBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [iconStyles];\n }\n\n @property()\n public label = '';\n\n @property({ reflect: true })\n public size?: 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n protected override update(changes: PropertyValues): void {\n if (changes.has('label')) {\n if (this.label) {\n this.removeAttribute('aria-hidden');\n } else {\n this.setAttribute('aria-hidden', 'true');\n }\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n}\n"],
5
+ "mappings": ";;;;;;;;;;;;AAYA;AAAA,EAEI;AAAA,EAEA;AAAA,OAEG;AACP,SAAS,gBAAgB;AAEzB,OAAO,gBAAgB;AAEhB,aAAM,iBAAiB,gBAAgB;AAAA,EAAvC;AAAA;AAMH,SAAO,QAAQ;AAAA;AAAA,EALf,WAA2B,SAAyB;AAChD,WAAO,CAAC,UAAU;AAAA,EACtB;AAAA,EAQmB,OAAO,SAA+B;AACrD,QAAI,QAAQ,IAAI,OAAO,GAAG;AACtB,UAAI,KAAK,OAAO;AACZ,aAAK,gBAAgB,aAAa;AAAA,MACtC,OAAO;AACH,aAAK,aAAa,eAAe,MAAM;AAAA,MAC3C;AAAA,IACJ;AACA,UAAM,OAAO,OAAO;AAAA,EACxB;AAAA,EAEmB,SAAyB;AACxC,WAAO;AAAA;AAAA;AAAA,EAGX;AACJ;AArBW;AAAA,EADN,SAAS;AAAA,GALD,SAMF;AAGA;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GARlB,SASF;",
6
6
  "names": []
7
7
  }
package/src/IconBase.js CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=(l,t,s,r)=>{for(var e=r>1?void 0:r?c(t,s):t,o=l.length-1,p;o>=0;o--)(p=l[o])&&(e=(r?p(t,s,e):p(e))||e);return r&&e&&u(t,s,e),e};import{html as a,SpectrumElement as n}from"@spectrum-web-components/base";import{property as m}from"@spectrum-web-components/base/src/decorators.js";import S from"./icon.css.js";export class IconBase extends n{static get styles(){return[S]}render(){return a`
1
+ "use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var p=(i,r,t,l)=>{for(var e=l>1?void 0:l?d(r,t):r,s=i.length-1,o;s>=0;s--)(o=i[s])&&(e=(l?o(r,t,e):o(e))||e);return l&&e&&a(r,t,e),e};import{html as m,SpectrumElement as b}from"@spectrum-web-components/base";import{property as u}from"@spectrum-web-components/base/src/decorators.js";import c from"./icon.css.js";export class IconBase extends b{constructor(){super(...arguments);this.label=""}static get styles(){return[c]}update(t){t.has("label")&&(this.label?this.removeAttribute("aria-hidden"):this.setAttribute("aria-hidden","true")),super.update(t)}render(){return m`
2
2
  <slot></slot>
3
- `}}i([m()],IconBase.prototype,"label",2),i([m({reflect:!0})],IconBase.prototype,"size",2);
3
+ `}}p([u()],IconBase.prototype,"label",2),p([u({reflect:!0})],IconBase.prototype,"size",2);
4
4
  //# sourceMappingURL=IconBase.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["IconBase.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 SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport iconStyles from './icon.css.js';\n\nexport class IconBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [iconStyles];\n }\n\n @property()\n public label?: string;\n\n @property({ reflect: true })\n public size?: 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n}\n"],
5
- "mappings": "qNAYA,OAEI,QAAAA,EACA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAgB,gBAEhB,aAAM,iBAAiBF,CAAgB,CAC1C,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAU,CACtB,CAQmB,QAAyB,CACxC,OAAOH;AAAA;AAAA,SAGX,CACJ,CAVWI,EAAA,CADNF,EAAS,GALD,SAMF,qBAGAE,EAAA,CADNF,EAAS,CAAE,QAAS,EAAK,CAAC,GARlB,SASF",
6
- "names": ["html", "SpectrumElement", "property", "iconStyles", "__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 PropertyValues,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport { property } from '@spectrum-web-components/base/src/decorators.js';\n\nimport iconStyles from './icon.css.js';\n\nexport class IconBase extends SpectrumElement {\n public static override get styles(): CSSResultArray {\n return [iconStyles];\n }\n\n @property()\n public label = '';\n\n @property({ reflect: true })\n public size?: 's' | 'm' | 'l' | 'xl' | 'xxl';\n\n protected override update(changes: PropertyValues): void {\n if (changes.has('label')) {\n if (this.label) {\n this.removeAttribute('aria-hidden');\n } else {\n this.setAttribute('aria-hidden', 'true');\n }\n }\n super.update(changes);\n }\n\n protected override render(): TemplateResult {\n return html`\n <slot></slot>\n `;\n }\n}\n"],
5
+ "mappings": "qNAYA,OAEI,QAAAA,EAEA,mBAAAC,MAEG,gCACP,OAAS,YAAAC,MAAgB,kDAEzB,OAAOC,MAAgB,gBAEhB,aAAM,iBAAiBF,CAAgB,CAAvC,kCAMH,KAAO,MAAQ,GALf,WAA2B,QAAyB,CAChD,MAAO,CAACE,CAAU,CACtB,CAQmB,OAAOC,EAA+B,CACjDA,EAAQ,IAAI,OAAO,IACf,KAAK,MACL,KAAK,gBAAgB,aAAa,EAElC,KAAK,aAAa,cAAe,MAAM,GAG/C,MAAM,OAAOA,CAAO,CACxB,CAEmB,QAAyB,CACxC,OAAOJ;AAAA;AAAA,SAGX,CACJ,CArBWK,EAAA,CADNH,EAAS,GALD,SAMF,qBAGAG,EAAA,CADNH,EAAS,CAAE,QAAS,EAAK,CAAC,GARlB,SASF",
6
+ "names": ["html", "SpectrumElement", "property", "iconStyles", "changes", "__decorateClass"]
7
7
  }