@muonic/muon 0.0.2-beta.26 → 0.0.2-beta.27

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/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [0.0.2-beta.27](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.26...v0.0.2-beta.27) (2023-07-12)
6
+
7
+
8
+ ### Features
9
+
10
+ * inputter wrapper max-width ([194e0f0](https://github.com/centrica-engineering/muon/commit/194e0f0ee326188fb7041c3d7b59661b78fc7112))
11
+
5
12
  ### [0.0.2-beta.26](https://github.com/centrica-engineering/muon/compare/v0.0.2-beta.25...v0.0.2-beta.26) (2023-07-10)
6
13
 
7
14
 
@@ -48,6 +48,9 @@ export class Inputter extends ScopedElementsMixin(ValidationMixin(MaskMixin(Muon
48
48
  }
49
49
 
50
50
  get classes() {
51
+ const type = this._isSingle && this.querySelector('input').type;
52
+ const autocomplete = this._isSingle && this.querySelector('input').autocomplete || undefined;
53
+
51
54
  return {
52
55
  inputter: true,
53
56
  select: this._isSelect,
@@ -56,7 +59,9 @@ export class Inputter extends ScopedElementsMixin(ValidationMixin(MaskMixin(Muon
56
59
  checkbox: this._inputType === this._inputTypes.CHECKBOX,
57
60
  search: this._inputType === this._inputTypes.SEARCH,
58
61
  date: this._inputType === this._inputTypes.DATE,
59
- 'has-disabled': this._hasDisabled
62
+ 'has-disabled': this._hasDisabled,
63
+ [`type-${type}`]: !!type,
64
+ [`autocomplete-${autocomplete}`]: !!autocomplete
60
65
  };
61
66
  }
62
67
 
@@ -25,6 +25,7 @@
25
25
  border-color: $INPUTTER_FIELD_BORDER_COLOR;
26
26
  border-radius: $INPUTTER_FIELD_BORDER_RADIUS;
27
27
  font-family: $INPUTTER_FIELD_FONT_FAMILY;
28
+ width: 100%; /* NOTE: @drew - 2023-07-06 - rely on the width of `.wrapper` to contain the width. */
28
29
  }
29
30
 
30
31
  %input-hover {
@@ -8,8 +8,10 @@
8
8
  @extend %label;
9
9
  }
10
10
 
11
- & ::slotted(*)::placeholder {
12
- @extend %placeholder;
11
+ & ::slotted(*){
12
+ &::placeholder {
13
+ @extend %placeholder;
14
+ }
13
15
  }
14
16
 
15
17
  & ::slotted(:is(
@@ -74,6 +76,22 @@
74
76
 
75
77
  & .wrapper {
76
78
  position: relative;
79
+
80
+ /* NOTE: this calc will take the `ch` value in the `inputter.field.xxxx.max.width` token
81
+ * and add the inline padding and border width to produce the `max-width` value. This allows the token value
82
+ * to be equal to the amount of characters that will fit in the field.
83
+ * The `ch` unit is equal to the width of the `0` charachter in the font.
84
+ * Consider using a monospace font if accurate spacing is required (as we do in the masked inputter).
85
+ * This could benefit from the `tnum` OpenType feature of a font file.
86
+ * With a fallback to $THEME_FONT_LINE_LENGTH if the variable is not defined.
87
+ */
88
+ max-width: calc(
89
+ var(--inputter-field-max-width, $THEME_FONT_LINE_LENGTH)
90
+ + $INPUTTER_FIELD_PADDING_INLINE_START
91
+ + $INPUTTER_FIELD_PADDING_INLINE_END
92
+ + $INPUTTER_FIELD_BORDER_WIDTH
93
+ + $INPUTTER_FIELD_BORDER_WIDTH
94
+ );
77
95
  }
78
96
 
79
97
  & .checkbox,
@@ -197,15 +215,6 @@
197
215
  input[type="tel"],
198
216
  input[type="text"])) {
199
217
  @extend %input-mask;
200
-
201
- width: calc(
202
- (var(--maxlength))
203
- * 1ch
204
- + $INPUTTER_FIELD_PADDING_INLINE_START
205
- + $INPUTTER_FIELD_PADDING_INLINE_END
206
- + $INPUTTER_FIELD_BORDER_WIDTH
207
- + $INPUTTER_FIELD_BORDER_WIDTH
208
- );
209
218
  }
210
219
 
211
220
  & .input-mask {
@@ -229,6 +238,17 @@
229
238
  text-align: start;
230
239
  }
231
240
 
241
+ & .wrapper {
242
+ max-width: calc(
243
+ (var(--maxlength))
244
+ * 1ch
245
+ + $INPUTTER_FIELD_PADDING_INLINE_START
246
+ + $INPUTTER_FIELD_PADDING_INLINE_END
247
+ + $INPUTTER_FIELD_BORDER_WIDTH
248
+ + $INPUTTER_FIELD_BORDER_WIDTH
249
+ );
250
+ }
251
+
232
252
  & ::slotted(input[type="text"]) {
233
253
  @extend %input-mask-text;
234
254
  }
@@ -68,8 +68,10 @@ light-dom {
68
68
  @extend %label;
69
69
  }
70
70
 
71
- & *::placeholder {
72
- @extend %placeholder;
71
+ & * {
72
+ &::placeholder {
73
+ @extend %placeholder;
74
+ }
73
75
  }
74
76
 
75
77
  & :is(
@@ -121,8 +123,7 @@ light-dom {
121
123
  input[type="tel"]:disabled,
122
124
  input[type="text"]:disabled,
123
125
  select:disabled,
124
- textarea:disabled
125
- ) {
126
+ textarea:disabled) {
126
127
  @extend %input-disabled;
127
128
  }
128
129
 
@@ -132,30 +133,26 @@ light-dom {
132
133
 
133
134
  & :is(
134
135
  input[type="checkbox"],
135
- input[type="radio"]
136
- ) {
136
+ input[type="radio"]) {
137
137
  @extend %input-multiple;
138
138
  }
139
139
 
140
140
  & :is(
141
141
  input[type="checkbox"]:hover,
142
- input[type="radio"]:hover
143
- ) {
142
+ input[type="radio"]:hover) {
144
143
  @extend %input-multiple-hover;
145
144
  }
146
145
 
147
146
  & :is(
148
147
  input[type="checkbox"]:focus-visible,
149
- input[type="radio"]:focus-visible
150
- ) {
148
+ input[type="radio"]:focus-visible) {
151
149
  @extend %input-multiple-focus;
152
150
  }
153
151
 
154
152
  /* @TODO: configure how to remove if disable off */
155
153
  & :is(
156
154
  input[type="checkbox"]:disabled,
157
- input[type="radio"]:disabled
158
- ) {
155
+ input[type="radio"]:disabled) {
159
156
  @extend %input-multiple-disabled;
160
157
  }
161
158
 
@@ -185,8 +182,7 @@ light-dom {
185
182
 
186
183
  & :is(
187
184
  select,
188
- input[type="date"]
189
- ) {
185
+ input[type="date"]) {
190
186
  @extend %input-select;
191
187
  }
192
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@muonic/muon",
3
- "version": "0.0.2-beta.26",
3
+ "version": "0.0.2-beta.27",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {