@momentum-design/components 0.16.4 → 0.16.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -136,8 +136,8 @@ class Icon extends Component {
136
136
  var _a;
137
137
  if (this.computedIconSize && (this.lengthUnit || this.lengthUnitFromContext)) {
138
138
  const value = `${this.computedIconSize}${(_a = this.lengthUnit) !== null && _a !== void 0 ? _a : this.lengthUnitFromContext}`;
139
- this.style.width = value;
140
- this.style.height = value;
139
+ // set the computed icon size as a css variable to be used in the icon styles
140
+ this.style.setProperty('--computed-icon-size', value);
141
141
  }
142
142
  }
143
143
  setRoleOnIcon() {
@@ -5,6 +5,10 @@ const styles = [
5
5
  css `
6
6
  :host {
7
7
  --mdc-icon-fill-color: currentColor;
8
+ --mdc-icon-computed-size: var(--computed-icon-size);
9
+
10
+ height: var(--mdc-icon-computed-size);
11
+ width: var(--mdc-icon-computed-size);
8
12
  }
9
13
  :host::part(icon) {
10
14
  height: 100%;
@@ -3089,6 +3089,70 @@
3089
3089
  }
3090
3090
  ]
3091
3091
  },
3092
+ {
3093
+ "kind": "javascript-module",
3094
+ "path": "utils/mixins/LabelMixin.js",
3095
+ "declarations": [
3096
+ {
3097
+ "kind": "mixin",
3098
+ "description": "",
3099
+ "name": "LabelMixin",
3100
+ "members": [
3101
+ {
3102
+ "kind": "field",
3103
+ "name": "label",
3104
+ "type": {
3105
+ "text": "string"
3106
+ },
3107
+ "default": "''",
3108
+ "description": "The label of the input field. It is linked to the input field using the `for` attribute.",
3109
+ "attribute": "label",
3110
+ "reflects": true
3111
+ },
3112
+ {
3113
+ "kind": "method",
3114
+ "name": "renderLabel",
3115
+ "privacy": "public",
3116
+ "description": "creates the label element when the label property is set.\nid is used to link the label with the input field.",
3117
+ "return": {
3118
+ "type": {
3119
+ "text": ""
3120
+ }
3121
+ }
3122
+ }
3123
+ ],
3124
+ "attributes": [
3125
+ {
3126
+ "name": "label",
3127
+ "type": {
3128
+ "text": "string"
3129
+ },
3130
+ "default": "''",
3131
+ "description": "The label of the input field. It is linked to the input field using the `for` attribute.",
3132
+ "fieldName": "label"
3133
+ }
3134
+ ],
3135
+ "parameters": [
3136
+ {
3137
+ "name": "superClass",
3138
+ "type": {
3139
+ "text": "T"
3140
+ }
3141
+ }
3142
+ ]
3143
+ }
3144
+ ],
3145
+ "exports": [
3146
+ {
3147
+ "kind": "js",
3148
+ "name": "LabelMixin",
3149
+ "declaration": {
3150
+ "name": "LabelMixin",
3151
+ "module": "utils/mixins/LabelMixin.js"
3152
+ }
3153
+ }
3154
+ ]
3155
+ },
3092
3156
  {
3093
3157
  "kind": "javascript-module",
3094
3158
  "path": "utils/mixins/TabIndexMixin.js",
@@ -0,0 +1,7 @@
1
+ import { LitElement } from 'lit';
2
+ import type { Constructor } from './index.types';
3
+ export interface LabelMixinInterface {
4
+ label: string;
5
+ renderLabel(): void;
6
+ }
7
+ export declare const LabelMixin: <T extends Constructor<LitElement>>(superClass: T) => Constructor<LabelMixinInterface> & T;
@@ -0,0 +1,39 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { nothing, html } from 'lit';
11
+ import { property } from 'lit/decorators.js';
12
+ export const LabelMixin = (superClass) => {
13
+ class InnerMixinClass extends superClass {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ * The label of the input field. It is linked to the input field using the `for` attribute.
18
+ */
19
+ this.label = '';
20
+ }
21
+ /**
22
+ * creates the label element when the label property is set.
23
+ * id is used to link the label with the input field.
24
+ * @returns void
25
+ */
26
+ renderLabel() {
27
+ if (!this.label) {
28
+ return nothing;
29
+ }
30
+ return html `<label for="${this.id}" class='mdc-label'>${this.label}</label>`;
31
+ }
32
+ }
33
+ __decorate([
34
+ property({ reflect: true, type: String }),
35
+ __metadata("design:type", Object)
36
+ ], InnerMixinClass.prototype, "label", void 0);
37
+ // Cast return type to your mixin's interface intersected with the superClass type
38
+ return InnerMixinClass;
39
+ };
package/package.json CHANGED
@@ -35,5 +35,5 @@
35
35
  "@momentum-design/tokens": "*",
36
36
  "lit": "^3.2.0"
37
37
  },
38
- "version": "0.16.4"
38
+ "version": "0.16.6"
39
39
  }