@momentum-design/components 0.37.1 → 0.37.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.
@@ -69,7 +69,7 @@ class Avatar extends AvatarComponentMixin(IconNameMixin(Component)) {
69
69
  */
70
70
  getPresenceTemplateBasedOnType(type) {
71
71
  // avatar type of counter should not have presence
72
- if (type === AVATAR_TYPE.COUNTER && (this.counter || this.counter === 0)) {
72
+ if ((type === AVATAR_TYPE.COUNTER && (this.counter || this.counter === 0)) || this.isTyping) {
73
73
  return nothing;
74
74
  }
75
75
  if (this.presence) {
@@ -11,8 +11,6 @@ declare const Textarea_base: import("../../utils/mixins/index.types").Constructo
11
11
  * - Textarea: It is the multi-line text input field.
12
12
  * - helper-text: It is the text that provides additional information about the textarea field.
13
13
  * - max-character-limit: It is the text that shows the character count of the textarea field.
14
- * - clear-button: A boolean value when marked to true represents a button that can
15
- * clear the text value within the textarea field.
16
14
  * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information
17
15
  * about the textarea field based on the validation state.
18
16
  * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.
@@ -106,16 +104,6 @@ declare class Textarea extends Textarea_base {
106
104
  * The minimum number of characters that the textarea field can accept.
107
105
  */
108
106
  minlength?: number;
109
- /**
110
- * The clear button when set to true, shows a clear button that clears the textarea field.
111
- * @default false
112
- */
113
- clearButton: boolean;
114
- /**
115
- * Aria label for the clear button. If clear button is set to true, this label is used for the clear button.
116
- * @default ''
117
- */
118
- clearAriaLabel: string;
119
107
  /**
120
108
  * maximum character limit for the textarea field for character counter.
121
109
  */
@@ -178,23 +166,6 @@ declare class Textarea extends Textarea_base {
178
166
  * @param event - Event which contains information about the value change.
179
167
  */
180
168
  private onChange;
181
- /**
182
- * Handles the keydown event of the textarea field.
183
- * Clears the textarea field when the 'Enter' key is pressed.
184
- * @param event - Keyboard event
185
- * @returns void
186
- */
187
- private handleKeyDown;
188
- /**
189
- * Clears the textarea field.
190
- * @returns void
191
- */
192
- private clearInputText;
193
- /**
194
- * Renders the clear button to clear the textarea field if the clearButton is set to true.
195
- * @returns void
196
- */
197
- protected renderClearButton(): import("lit-html").TemplateResult<1> | typeof nothing;
198
169
  protected renderCharacterCounter(): import("lit-html").TemplateResult<1> | typeof nothing;
199
170
  protected renderTextareaFooter(): import("lit-html").TemplateResult<1> | typeof nothing;
200
171
  render(): import("lit-html").TemplateResult<1>;
@@ -25,8 +25,6 @@ import { FormInternalsMixin } from '../../utils/mixins/FormInternalsMixin';
25
25
  * - Textarea: It is the multi-line text input field.
26
26
  * - helper-text: It is the text that provides additional information about the textarea field.
27
27
  * - max-character-limit: It is the text that shows the character count of the textarea field.
28
- * - clear-button: A boolean value when marked to true represents a button that can
29
- * clear the text value within the textarea field.
30
28
  * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information
31
29
  * about the textarea field based on the validation state.
32
30
  * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.
@@ -110,16 +108,6 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
110
108
  * @default false
111
109
  */
112
110
  this.autofocus = false;
113
- /**
114
- * The clear button when set to true, shows a clear button that clears the textarea field.
115
- * @default false
116
- */
117
- this.clearButton = false;
118
- /**
119
- * Aria label for the clear button. If clear button is set to true, this label is used for the clear button.
120
- * @default ''
121
- */
122
- this.clearAriaLabel = '';
123
111
  this.characterLimitExceedingFired = false;
124
112
  // Set the default value to the textarea field if the value is set through the text content directly
125
113
  this.value = ((_a = this.textContent) === null || _a === void 0 ? void 0 : _a.trim()) || this.value;
@@ -266,48 +254,6 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
266
254
  const EventConstructor = event.constructor;
267
255
  this.dispatchEvent(new EventConstructor(event.type, event));
268
256
  }
269
- /**
270
- * Handles the keydown event of the textarea field.
271
- * Clears the textarea field when the 'Enter' key is pressed.
272
- * @param event - Keyboard event
273
- * @returns void
274
- */
275
- handleKeyDown(event) {
276
- if (['Enter'].includes(event.key)) {
277
- event.preventDefault();
278
- this.clearInputText();
279
- }
280
- }
281
- /**
282
- * Clears the textarea field.
283
- * @returns void
284
- */
285
- clearInputText() {
286
- this.value = '';
287
- this.textarea.focus();
288
- }
289
- /**
290
- * Renders the clear button to clear the textarea field if the clearButton is set to true.
291
- * @returns void
292
- */
293
- renderClearButton() {
294
- if (!this.clearButton) {
295
- return nothing;
296
- }
297
- return html `
298
- <mdc-button
299
- part='clear-button'
300
- class='own-focus-ring ${!this.value ? 'hidden' : ''}'
301
- prefix-icon='${DEFAULTS.CLEAR_BUTTON_ICON}'
302
- variant='${DEFAULTS.CLEAR_BUTTON_VARIANT}'
303
- size="${DEFAULTS.CLEAR_BUTTON_SIZE}"
304
- aria-label="${this.clearAriaLabel}"
305
- ?disabled=${this.disabled || this.readonly || !this.value}
306
- @click=${this.clearInputText}
307
- @keydown=${this.handleKeyDown}
308
- ></mdc-button>
309
- `;
310
- }
311
257
  renderCharacterCounter() {
312
258
  if (!this.maxCharacterLimit) {
313
259
  return nothing;
@@ -362,7 +308,6 @@ class Textarea extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper))
362
308
  aria-describedby="${ifDefined(this.helpText ? FORMFIELD_DEFAULTS.HELPER_TEXT_ID : '')}"
363
309
  aria-invalid="${this.helpTextType === 'error' ? 'true' : 'false'}"
364
310
  ></textarea>
365
- ${this.renderClearButton()}
366
311
  </div>
367
312
  ${this.renderTextareaFooter()}
368
313
  `;
@@ -413,14 +358,6 @@ __decorate([
413
358
  property({ type: Number }),
414
359
  __metadata("design:type", Number)
415
360
  ], Textarea.prototype, "minlength", void 0);
416
- __decorate([
417
- property({ type: Boolean, attribute: 'clear-button' }),
418
- __metadata("design:type", Object)
419
- ], Textarea.prototype, "clearButton", void 0);
420
- __decorate([
421
- property({ type: String, attribute: 'clear-aria-label' }),
422
- __metadata("design:type", Object)
423
- ], Textarea.prototype, "clearAriaLabel", void 0);
424
361
  __decorate([
425
362
  property({ type: Number, attribute: 'max-character-limit' }),
426
363
  __metadata("design:type", Number)
@@ -8,11 +8,6 @@ declare const AUTO_COMPLETE: {
8
8
  readonly ON: "on";
9
9
  };
10
10
  declare const DEFAULTS: {
11
- ICON_SIZE_VALUE: number;
12
- ICON_SIZE_UNIT: string;
13
- CLEAR_BUTTON_ICON: "cancel-bold";
14
- CLEAR_BUTTON_VARIANT: "tertiary";
15
- CLEAR_BUTTON_SIZE: 20;
16
11
  CHARACTER_COUNTER_TYPE: "body-midsize-regular";
17
12
  ROWS: number;
18
13
  COLS: number;
@@ -1,8 +1,6 @@
1
1
  import utils from '../../utils/tag-name';
2
2
  import { TYPE as FONT_TYPE } from '../text/text.constants';
3
- import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
4
3
  const TAG_NAME = utils.constructTagName('textarea');
5
- const CLEAR_BUTTON_ICON = 'cancel-bold';
6
4
  const WRAP = {
7
5
  HARD: 'hard',
8
6
  SOFT: 'soft',
@@ -12,11 +10,6 @@ const AUTO_COMPLETE = {
12
10
  ON: 'on',
13
11
  };
14
12
  const DEFAULTS = {
15
- ICON_SIZE_VALUE: 1,
16
- ICON_SIZE_UNIT: 'rem',
17
- CLEAR_BUTTON_ICON,
18
- CLEAR_BUTTON_VARIANT: BUTTON_VARIANTS.TERTIARY,
19
- CLEAR_BUTTON_SIZE: ICON_BUTTON_SIZES[20],
20
13
  CHARACTER_COUNTER_TYPE: FONT_TYPE.BODY_MIDSIZE_REGULAR,
21
14
  ROWS: 5,
22
15
  COLS: 40,
@@ -55,13 +55,16 @@ const styles = [css `
55
55
 
56
56
  :host::part(textarea-container) {
57
57
  display: flex;
58
- gap: 0.5rem;
59
58
  border-radius: 0.5rem;
60
59
  border: 0.0625rem solid var(--mdc-textarea-border-color);
61
60
  overflow: hidden;
62
61
  padding: 0.375rem 0.25rem 0.25rem 0.75rem;
63
62
  }
64
63
 
64
+ :host(:dir(rtl))::part(textarea-container){
65
+ padding: 0.375rem 0.75rem 0.25rem 0.25rem;
66
+ }
67
+
65
68
  :host(:not([disabled]))::part(textarea-container):hover{
66
69
  background-color: var(--mdc-textarea-hover-background-color);
67
70
  }