@momentum-design/components 0.37.0 → 0.37.2

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.
@@ -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
  }
@@ -13489,7 +13489,7 @@
13489
13489
  "declarations": [
13490
13490
  {
13491
13491
  "kind": "class",
13492
- "description": "mdc-textarea component, which is used to get the multi-line text input from the user.\nIt contains:\n- label: It is the title of the textarea field.\n- required-label: A string depicting that the textarea field is required.\n- Textarea: It is the multi-line text input field.\n- helper-text: It is the text that provides additional information about the textarea field.\n- max-character-limit: It is the text that shows the character count of the textarea field.\n- clear-button: A boolean value when marked to true represents a button that can\n clear the text value within the textarea field.\n- Error, Warning, Success, Priority Help Text type: It is the text that provides additional information\n about the textarea field based on the validation state.\n- limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.\n This event exposes 3 properties:\n - currentCharacterCount - the current number of characters in the textarea field,\n - maxCharacterLimit - the maximum number of characters allowed in the textarea field,\n - value - the current value of the textarea field,\n\n**Note**: Consumers must set the help-text-type with 'error' and\nhelp-text attribute with the error message using limitexceeded event.\nThe same help-text value will be used for the validation message to be displayed.",
13492
+ "description": "mdc-textarea component, which is used to get the multi-line text input from the user.\nIt contains:\n- label: It is the title of the textarea field.\n- required-label: A string depicting that the textarea field is required.\n- Textarea: It is the multi-line text input field.\n- helper-text: It is the text that provides additional information about the textarea field.\n- max-character-limit: It is the text that shows the character count of the textarea field.\n- Error, Warning, Success, Priority Help Text type: It is the text that provides additional information\n about the textarea field based on the validation state.\n- limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.\n This event exposes 3 properties:\n - currentCharacterCount - the current number of characters in the textarea field,\n - maxCharacterLimit - the maximum number of characters allowed in the textarea field,\n - value - the current value of the textarea field,\n\n**Note**: Consumers must set the help-text-type with 'error' and\nhelp-text attribute with the error message using limitexceeded event.\nThe same help-text value will be used for the validation message to be displayed.",
13493
13493
  "name": "Textarea",
13494
13494
  "cssProperties": [
13495
13495
  {
@@ -13650,26 +13650,6 @@
13650
13650
  "description": "The minimum number of characters that the textarea field can accept.",
13651
13651
  "attribute": "minlength"
13652
13652
  },
13653
- {
13654
- "kind": "field",
13655
- "name": "clearButton",
13656
- "type": {
13657
- "text": "boolean"
13658
- },
13659
- "default": "false",
13660
- "description": "The clear button when set to true, shows a clear button that clears the textarea field.",
13661
- "attribute": "clear-button"
13662
- },
13663
- {
13664
- "kind": "field",
13665
- "name": "clearAriaLabel",
13666
- "type": {
13667
- "text": "string"
13668
- },
13669
- "default": "''",
13670
- "description": "Aria label for the clear button. If clear button is set to true, this label is used for the clear button.",
13671
- "attribute": "clear-aria-label"
13672
- },
13673
13653
  {
13674
13654
  "kind": "field",
13675
13655
  "name": "maxCharacterLimit",
@@ -13760,48 +13740,6 @@
13760
13740
  ],
13761
13741
  "description": "Handles the change event of the textarea field.\nUpdates the value and sets the validity of the textarea field.\n\nThe 'change' event does not bubble up through the shadow DOM as it was not composed.\nTherefore, we need to re-dispatch the same event to ensure it is propagated correctly.\nRead more: https://developer.mozilla.org/en-US/docs/Web/API/Event/composed"
13762
13742
  },
13763
- {
13764
- "kind": "method",
13765
- "name": "handleKeyDown",
13766
- "privacy": "private",
13767
- "parameters": [
13768
- {
13769
- "name": "event",
13770
- "type": {
13771
- "text": "KeyboardEvent"
13772
- },
13773
- "description": "Keyboard event"
13774
- }
13775
- ],
13776
- "description": "Handles the keydown event of the textarea field.\nClears the textarea field when the 'Enter' key is pressed.",
13777
- "return": {
13778
- "type": {
13779
- "text": ""
13780
- }
13781
- }
13782
- },
13783
- {
13784
- "kind": "method",
13785
- "name": "clearInputText",
13786
- "privacy": "private",
13787
- "description": "Clears the textarea field.",
13788
- "return": {
13789
- "type": {
13790
- "text": ""
13791
- }
13792
- }
13793
- },
13794
- {
13795
- "kind": "method",
13796
- "name": "renderClearButton",
13797
- "privacy": "protected",
13798
- "description": "Renders the clear button to clear the textarea field if the clearButton is set to true.",
13799
- "return": {
13800
- "type": {
13801
- "text": ""
13802
- }
13803
- }
13804
- },
13805
13743
  {
13806
13744
  "kind": "method",
13807
13745
  "name": "renderCharacterCounter",
@@ -14227,24 +14165,6 @@
14227
14165
  "description": "The minimum number of characters that the textarea field can accept.",
14228
14166
  "fieldName": "minlength"
14229
14167
  },
14230
- {
14231
- "name": "clear-button",
14232
- "type": {
14233
- "text": "boolean"
14234
- },
14235
- "default": "false",
14236
- "description": "The clear button when set to true, shows a clear button that clears the textarea field.",
14237
- "fieldName": "clearButton"
14238
- },
14239
- {
14240
- "name": "clear-aria-label",
14241
- "type": {
14242
- "text": "string"
14243
- },
14244
- "default": "''",
14245
- "description": "Aria label for the clear button. If clear button is set to true, this label is used for the clear button.",
14246
- "fieldName": "clearAriaLabel"
14247
- },
14248
14168
  {
14249
14169
  "name": "max-character-limit",
14250
14170
  "type": {
@@ -14394,7 +14314,7 @@
14394
14314
  "module": "/src/components/formfieldwrapper"
14395
14315
  },
14396
14316
  "tagName": "mdc-textarea",
14397
- "jsDoc": "/**\n * mdc-textarea component, which is used to get the multi-line text input from the user.\n * It contains:\n * - label: It is the title of the textarea field.\n * - required-label: A string depicting that the textarea field is required.\n * - Textarea: It is the multi-line text input field.\n * - helper-text: It is the text that provides additional information about the textarea field.\n * - max-character-limit: It is the text that shows the character count of the textarea field.\n * - clear-button: A boolean value when marked to true represents a button that can\n * clear the text value within the textarea field.\n * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information\n * about the textarea field based on the validation state.\n * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.\n * This event exposes 3 properties:\n * - currentCharacterCount - the current number of characters in the textarea field,\n * - maxCharacterLimit - the maximum number of characters allowed in the textarea field,\n * - value - the current value of the textarea field,\n *\n * **Note**: Consumers must set the help-text-type with 'error' and\n * help-text attribute with the error message using limitexceeded event.\n * The same help-text value will be used for the validation message to be displayed.\n *\n * @tagname mdc-textarea\n *\n * @event input - (React: onInput) This event is dispatched when the value of the textarea field changes (every press).\n * @event change - (React: onChange) This event is dispatched when the value of the textarea field changes (on blur).\n * @event focus - (React: onFocus) This event is dispatched when the textarea receives focus.\n * @event blur - (React: onBlur) This event is dispatched when the textarea loses focus.\n * @event limitexceeded - (React: onLimitExceeded) This event is dispatched once when the character limit\n * exceeds or restored.\n *\n *\n * @dependency mdc-icon\n * @dependency mdc-text\n * @dependency mdc-button\n *\n * @cssproperty --mdc-textarea-disabled-border-color - Border color for the textarea container when disabled\n * @cssproperty --mdc-textarea-disabled-text-color - Text color for the textarea field when disabled\n * @cssproperty --mdc-textarea-disabled-background-color - Background color for the textarea field when disabled\n * @cssproperty --mdc-textarea-text-color - Text color for the textarea field\n * @cssproperty --mdc-textarea-background-color - Background color for the textarea field\n * @cssproperty --mdc-textarea-border-color - Border color for the textarea field\n * @cssproperty --mdc-textarea-text-secondary-normal - Text color for the character counter\n * @cssproperty --mdc-textarea-error-border-color - Border color for the error related help text\n * @cssproperty --mdc-textarea-warning-border-color - Border color for the warning related help text\n * @cssproperty --mdc-textarea-success-border-color - Border color for the success related help text\n * @cssproperty --mdc-textarea-primary-border-color - Border color for the priority related help text\n * @cssproperty --mdc-textarea-hover-background-color - Background color for the textarea container when hover\n * @cssproperty --mdc-textarea-focused-background-color - Background color for the textarea container when focused\n * @cssproperty --mdc-textarea-focused-border-color - Border color for the textarea container when focused\n */",
14317
+ "jsDoc": "/**\n * mdc-textarea component, which is used to get the multi-line text input from the user.\n * It contains:\n * - label: It is the title of the textarea field.\n * - required-label: A string depicting that the textarea field is required.\n * - Textarea: It is the multi-line text input field.\n * - helper-text: It is the text that provides additional information about the textarea field.\n * - max-character-limit: It is the text that shows the character count of the textarea field.\n * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information\n * about the textarea field based on the validation state.\n * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.\n * This event exposes 3 properties:\n * - currentCharacterCount - the current number of characters in the textarea field,\n * - maxCharacterLimit - the maximum number of characters allowed in the textarea field,\n * - value - the current value of the textarea field,\n *\n * **Note**: Consumers must set the help-text-type with 'error' and\n * help-text attribute with the error message using limitexceeded event.\n * The same help-text value will be used for the validation message to be displayed.\n *\n * @tagname mdc-textarea\n *\n * @event input - (React: onInput) This event is dispatched when the value of the textarea field changes (every press).\n * @event change - (React: onChange) This event is dispatched when the value of the textarea field changes (on blur).\n * @event focus - (React: onFocus) This event is dispatched when the textarea receives focus.\n * @event blur - (React: onBlur) This event is dispatched when the textarea loses focus.\n * @event limitexceeded - (React: onLimitExceeded) This event is dispatched once when the character limit\n * exceeds or restored.\n *\n *\n * @dependency mdc-icon\n * @dependency mdc-text\n * @dependency mdc-button\n *\n * @cssproperty --mdc-textarea-disabled-border-color - Border color for the textarea container when disabled\n * @cssproperty --mdc-textarea-disabled-text-color - Text color for the textarea field when disabled\n * @cssproperty --mdc-textarea-disabled-background-color - Background color for the textarea field when disabled\n * @cssproperty --mdc-textarea-text-color - Text color for the textarea field\n * @cssproperty --mdc-textarea-background-color - Background color for the textarea field\n * @cssproperty --mdc-textarea-border-color - Border color for the textarea field\n * @cssproperty --mdc-textarea-text-secondary-normal - Text color for the character counter\n * @cssproperty --mdc-textarea-error-border-color - Border color for the error related help text\n * @cssproperty --mdc-textarea-warning-border-color - Border color for the warning related help text\n * @cssproperty --mdc-textarea-success-border-color - Border color for the success related help text\n * @cssproperty --mdc-textarea-primary-border-color - Border color for the priority related help text\n * @cssproperty --mdc-textarea-hover-background-color - Background color for the textarea container when hover\n * @cssproperty --mdc-textarea-focused-background-color - Background color for the textarea container when focused\n * @cssproperty --mdc-textarea-focused-border-color - Border color for the textarea container when focused\n */",
14398
14318
  "customElement": true,
14399
14319
  "slots": [
14400
14320
  {
@@ -7,8 +7,6 @@ import Component from '../../components/textarea';
7
7
  * - Textarea: It is the multi-line text input field.
8
8
  * - helper-text: It is the text that provides additional information about the textarea field.
9
9
  * - max-character-limit: It is the text that shows the character count of the textarea field.
10
- * - clear-button: A boolean value when marked to true represents a button that can
11
- * clear the text value within the textarea field.
12
10
  * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information
13
11
  * about the textarea field based on the validation state.
14
12
  * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.
@@ -10,8 +10,6 @@ import { TAG_NAME } from '../../components/textarea/textarea.constants';
10
10
  * - Textarea: It is the multi-line text input field.
11
11
  * - helper-text: It is the text that provides additional information about the textarea field.
12
12
  * - max-character-limit: It is the text that shows the character count of the textarea field.
13
- * - clear-button: A boolean value when marked to true represents a button that can
14
- * clear the text value within the textarea field.
15
13
  * - Error, Warning, Success, Priority Help Text type: It is the text that provides additional information
16
14
  * about the textarea field based on the validation state.
17
15
  * - limitexceeded: It is the event that is dispatched when the character limit exceeds or restored.
package/package.json CHANGED
@@ -38,5 +38,5 @@
38
38
  "lit": "^3.2.0",
39
39
  "uuid": "^11.0.5"
40
40
  },
41
- "version": "0.37.0"
41
+ "version": "0.37.2"
42
42
  }