@justeattakeaway/pie-textarea 0.6.0 → 0.7.0

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/README.md CHANGED
@@ -8,15 +8,6 @@
8
8
  </a>
9
9
  </p>
10
10
 
11
- # Table of Contents
12
-
13
- 1. [Introduction](#pie-textarea)
14
- 2. [Installation](#installation)
15
- 3. [Importing the component](#importing-the-component)
16
- 4. [Peer Dependencies](#peer-dependencies)
17
- 5. [Props](#props)
18
- 6. [Contributing](#contributing)
19
-
20
11
  ## pie-textarea
21
12
 
22
13
  `pie-textarea` is a Web Component built using the Lit library.
@@ -29,70 +20,20 @@ This component can be easily integrated into various frontend frameworks and cus
29
20
  To install `pie-textarea` in your application, run the following on your command line:
30
21
 
31
22
  ```bash
32
- # npm
33
- $ npm i @justeattakeaway/pie-textarea
23
+ npm i @justeattakeaway/pie-textarea
34
24
 
35
- # yarn
36
- $ yarn add @justeattakeaway/pie-textarea
25
+ yarn add @justeattakeaway/pie-textarea
37
26
  ```
38
27
 
39
28
  For full information on using PIE components as part of an application, check out the [Getting Started Guide](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components).
40
29
 
30
+ ## Documentation
41
31
 
42
- ### Importing the component
43
-
44
- #### JavaScript
45
- ```js
46
- // Default – for Native JS Applications, Vue, Angular, Svelte, etc.
47
- import { PieTextarea } from '@justeattakeaway/pie-textarea';
48
-
49
- // If you don't need to reference the imported object, you can simply
50
- // import the module which registers the component as a custom element.
51
- import '@justeattakeaway/pie-textarea';
52
- ```
53
-
54
- #### React
55
- ```js
56
- // React
57
- // For React, you will need to import our React-specific component build
58
- // which wraps the web component using ​@lit/react
59
- import { PieTextarea } from '@justeattakeaway/pie-textarea/dist/react';
60
- ```
61
-
62
- > [!NOTE]
63
- > When using the React version of the component, please make sure to also
64
- > include React as a [peer dependency](#peer-dependencies) in your project.
65
-
66
-
67
- ## Peer Dependencies
68
-
69
- > [!IMPORTANT]
70
- > When using `pie-textarea`, you will also need to include a couple of dependencies to ensure the component renders as expected. See [the PIE Wiki](https://github.com/justeattakeaway/pie/wiki/Getting-started-with-PIE-Web-Components#expected-dependencies) for more information and how to include these in your application.
71
-
32
+ Visit [Textarea | PIE Design System](https://pie.design/components/textarea) to view more information on this component.
72
33
 
73
- ## Props
34
+ ## Questions
74
35
 
75
- | Property | Type | Default | Description |
76
- |---|---|---|---|
77
- | `disabled` | `boolean` | `false`| Indicates whether or not the textarea is disabled. |
78
- | `size` | `'small'`, `'medium'`, `'large'` | `'medium'` | The size of the textarea field. |
79
- | `resize` | `'auto'`, `'manual'` | `'auto'` | Controls the resizing behaviour of the textarea. |
80
- | `value` | `string` | `''` | The value of the textarea (used as a key/value pair in HTML forms with `name`). |
81
- | `name` | `string` | `''` | The name of the textarea (used as a key/value pair with `value`). This is required in order to work properly with forms. |
82
- | `autocomplete` | `string` | `''` | Allows the user to enable or disable autocomplete functionality on the textarea field. |
83
- | `autoFocus` | `boolean` | `false` | If true, the textarea will be focused on the first render. |
84
- | `readonly` | `boolean` | `false` | When true, the user cannot edit the control. Not the same as disabled. |
85
- | `required` | `boolean` | `false` | If true, the textarea is required to have a value before submitting the form. If there is no value, then the component validity state will be invalid. |
86
-
87
- In your markup or JSX, you can then use these to set the properties for the `pie-textarea` component:
88
-
89
- ```html
90
- <!-- Native HTML -->
91
- <pie-textarea></pie-textarea>
92
-
93
- <!-- JSX -->
94
- <PieTextarea></PieTextarea>
95
- ```
36
+ Please head to [FAQs | PIE Design System](https://pie.design/support/contact-us/) to see our FAQs and get in touch.
96
37
 
97
38
  ## Contributing
98
39
 
@@ -89,6 +89,15 @@
89
89
  "privacy": "public",
90
90
  "attribute": "value"
91
91
  },
92
+ {
93
+ "kind": "field",
94
+ "name": "defaultValue",
95
+ "type": {
96
+ "text": "TextareaProps['defaultValue']"
97
+ },
98
+ "privacy": "public",
99
+ "attribute": "defaultValue"
100
+ },
92
101
  {
93
102
  "kind": "field",
94
103
  "name": "disabled",
@@ -286,6 +295,13 @@
286
295
  "name": "value",
287
296
  "fieldName": "value"
288
297
  },
298
+ {
299
+ "name": "defaultValue",
300
+ "type": {
301
+ "text": "TextareaProps['defaultValue']"
302
+ },
303
+ "fieldName": "defaultValue"
304
+ },
289
305
  {
290
306
  "name": "disabled",
291
307
  "fieldName": "disabled"
package/dist/index.d.ts CHANGED
@@ -11,7 +11,7 @@ import type { TemplateResult } from 'lit-html';
11
11
  /**
12
12
  * The default values for the `TextareaProps` that are required (i.e. they have a fallback value in the component).
13
13
  */
14
- declare type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength'>>;
14
+ declare type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength' | 'defaultValue'>>;
15
15
 
16
16
  /**
17
17
  * Default values for optional properties that have default fallback values in the component.
@@ -30,6 +30,7 @@ export declare class PieTextarea extends PieTextarea_base implements TextareaPro
30
30
  slotAssignment?: SlotAssignmentMode | undefined;
31
31
  };
32
32
  value: string;
33
+ defaultValue: TextareaProps['defaultValue'];
33
34
  disabled: boolean;
34
35
  size: "small" | "medium" | "large";
35
36
  resize: "auto" | "manual";
@@ -101,6 +102,10 @@ export declare interface TextareaProps {
101
102
  * The value of the textarea (used as a key/value pair in HTML forms with `name`).
102
103
  */
103
104
  value: string;
105
+ /**
106
+ * An optional default value to use when the textarea is reset.
107
+ */
108
+ defaultValue?: string;
104
109
  /**
105
110
  * The name of the textarea (used as a key/value pair with `value`). This is required in order to work properly with forms.
106
111
  */
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { LitElement as w, html as I, nothing as B, unsafeCSS as N } from "lit";
2
- import { property as h, query as V } from "lit/decorators.js";
1
+ import { LitElement as w, html as I, nothing as q, unsafeCSS as B } from "lit";
2
+ import { property as c, query as N } from "lit/decorators.js";
3
3
  import { live as A } from "lit/directives/live.js";
4
4
  import { FormControlMixin as K, RtlMixin as G, wrapNativeEvent as H, validPropertyValues as F, defineCustomElement as U } from "@justeattakeaway/pie-webc-core";
5
5
  import { ifDefined as O } from "lit/directives/if-defined.js";
@@ -8,55 +8,55 @@ var z = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
8
8
  function X(t) {
9
9
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
10
10
  }
11
- var R = "Expected a function", C = 0 / 0, J = "[object Symbol]", Q = /^\s+|\s+$/g, Y = /^[-+]0x[0-9a-f]+$/i, Z = /^0b[01]+$/i, ee = /^0o[0-7]+$/i, te = parseInt, ae = typeof z == "object" && z && z.Object === Object && z, re = typeof self == "object" && self && self.Object === Object && self, ie = ae || re || Function("return this")(), ne = Object.prototype, oe = ne.toString, se = Math.max, le = Math.min, L = function() {
11
+ var R = "Expected a function", C = 0 / 0, J = "[object Symbol]", Q = /^\s+|\s+$/g, Y = /^[-+]0x[0-9a-f]+$/i, Z = /^0b[01]+$/i, ee = /^0o[0-7]+$/i, te = parseInt, ae = typeof z == "object" && z && z.Object === Object && z, re = typeof self == "object" && self && self.Object === Object && self, ie = ae || re || Function("return this")(), ne = Object.prototype, oe = ne.toString, se = Math.max, le = Math.min, S = function() {
12
12
  return ie.Date.now();
13
13
  };
14
14
  function de(t, e, a) {
15
- var r, i, u, l, s, p, g = 0, m = !1, v = !1, _ = !0;
15
+ var r, i, u, d, s, p, g = 0, m = !1, v = !1, _ = !0;
16
16
  if (typeof t != "function")
17
17
  throw new TypeError(R);
18
18
  e = W(e) || 0, k(a) && (m = !!a.leading, v = "maxWait" in a, u = v ? se(W(a.maxWait) || 0, e) : u, _ = "trailing" in a ? !!a.trailing : _);
19
19
  function $(n) {
20
20
  var f = r, b = i;
21
- return r = i = void 0, g = n, l = t.apply(b, f), l;
21
+ return r = i = void 0, g = n, d = t.apply(b, f), d;
22
22
  }
23
23
  function D(n) {
24
- return g = n, s = setTimeout(y, e), m ? $(n) : l;
24
+ return g = n, s = setTimeout(y, e), m ? $(n) : d;
25
25
  }
26
26
  function P(n) {
27
27
  var f = n - p, b = n - g, E = e - f;
28
28
  return v ? le(E, u - b) : E;
29
29
  }
30
- function S(n) {
30
+ function L(n) {
31
31
  var f = n - p, b = n - g;
32
32
  return p === void 0 || f >= e || f < 0 || v && b >= u;
33
33
  }
34
34
  function y() {
35
- var n = L();
36
- if (S(n))
35
+ var n = S();
36
+ if (L(n))
37
37
  return T(n);
38
38
  s = setTimeout(y, P(n));
39
39
  }
40
40
  function T(n) {
41
- return s = void 0, _ && r ? $(n) : (r = i = void 0, l);
41
+ return s = void 0, _ && r ? $(n) : (r = i = void 0, d);
42
42
  }
43
43
  function M() {
44
44
  s !== void 0 && clearTimeout(s), g = 0, r = p = i = s = void 0;
45
45
  }
46
- function q() {
47
- return s === void 0 ? l : T(L());
46
+ function V() {
47
+ return s === void 0 ? d : T(S());
48
48
  }
49
49
  function j() {
50
- var n = L(), f = S(n);
50
+ var n = S(), f = L(n);
51
51
  if (r = arguments, i = this, p = n, f) {
52
52
  if (s === void 0)
53
53
  return D(p);
54
54
  if (v)
55
55
  return s = setTimeout(y, e), $(p);
56
56
  }
57
- return s === void 0 && (s = setTimeout(y, e)), l;
57
+ return s === void 0 && (s = setTimeout(y, e)), d;
58
58
  }
59
- return j.cancel = M, j.flush = q, j;
59
+ return j.cancel = M, j.flush = V, j;
60
60
  }
61
61
  function ce(t, e, a) {
62
62
  var r = !0, i = !0;
@@ -95,7 +95,7 @@ function W(t) {
95
95
  }
96
96
  var pe = ce;
97
97
  const fe = /* @__PURE__ */ X(pe), ge = `*,*:after,*:before{box-sizing:inherit}.c-textareaWrapper{--textarea-line-height: calc(var(--dt-font-body-l-line-height) * 1px);--textarea-border-thickness: 1px;--textarea-resize: none;--textarea-padding-inline: var(--dt-spacing-d);--textarea-padding-block: var(--dt-spacing-c);--textarea-background-color: var(--dt-color-container-default);--textarea-border-color: var(--dt-color-interactive-form);--textarea-content-color: var(--dt-color-content-default);--textarea-height: calc((var(--textarea-line-height) * 2) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2));line-height:0}.c-textareaWrapper textarea{font-size:calc(var(--dt-font-body-l-size) * 1px);line-height:var(--textarea-line-height);font-family:var(--dt-font-body-l-family);resize:var(--textarea-resize);border:var(--textarea-border-thickness) solid var(--textarea-border-color);background-color:var(--textarea-background-color);color:var(--textarea-content-color);border-radius:var(--dt-radius-rounded-c);block-size:var(--textarea-height);max-block-size:var(--textarea-max-height);min-block-size:var(--textarea-min-height);padding-block-start:var(--textarea-padding-block);padding-block-end:var(--textarea-padding-block);padding-inline-start:var(--textarea-padding-inline);padding-inline-end:var(--textarea-padding-inline)}.c-textareaWrapper textarea[disabled]{--textarea-background-color: var(--dt-color-disabled-01);--textarea-border-color: var(--dt-color-disabled-01);--textarea-content-color: var(--dt-color-content-disabled)}@media (hover: hover){.c-textareaWrapper textarea:hover:not([disabled]){--textarea-background-color: hsl(var(--dt-color-container-default-h), var(--dt-color-container-default-s), calc(var(--dt-color-container-default-l) + calc(-1 * var(--dt-color-hover-01))))}}.c-textareaWrapper textarea:focus-visible{box-shadow:0 0 0 2px var(--dt-color-focus-inner),0 0 0 4px var(--dt-color-focus-outer);outline:none}.c-textareaWrapper[data-pie-size=large]{--textarea-padding-block: var(--dt-spacing-d)}.c-textareaWrapper[data-pie-size=small]{--textarea-padding-block: var(--dt-spacing-b)}.c-textareaWrapper[data-pie-resize=manual]{--textarea-resize: vertical;--textarea-min-height: calc((var(--textarea-line-height) * 1) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2))}@media (pointer: coarse){.c-textareaWrapper[data-pie-resize=manual]{--textarea-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2));--textarea-min-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2));--textarea-max-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2));--textarea-resize: none}}.c-textareaWrapper[data-pie-resize=auto]{--textarea-max-height: calc((var(--textarea-line-height) * 6) + (var(--textarea-padding-block) * 2) + (var(--textarea-border-thickness) * 2));--textarea-min-height: var(--textarea-height)}
98
- `, ve = ["small", "medium", "large"], xe = ["auto", "manual"], c = {
98
+ `, ve = ["small", "medium", "large"], xe = ["auto", "manual"], h = {
99
99
  disabled: !1,
100
100
  size: "medium",
101
101
  resize: "auto",
@@ -105,15 +105,15 @@ const fe = /* @__PURE__ */ X(pe), ge = `*,*:after,*:before{box-sizing:inherit}.c
105
105
  readonly: !1,
106
106
  required: !1
107
107
  };
108
- var be = Object.defineProperty, me = Object.getOwnPropertyDescriptor, d = (t, e, a, r) => {
109
- for (var i = r > 1 ? void 0 : r ? me(e, a) : e, u = t.length - 1, l; u >= 0; u--)
110
- (l = t[u]) && (i = (r ? l(e, a, i) : l(i)) || i);
108
+ var be = Object.defineProperty, me = Object.getOwnPropertyDescriptor, l = (t, e, a, r) => {
109
+ for (var i = r > 1 ? void 0 : r ? me(e, a) : e, u = t.length - 1, d; u >= 0; u--)
110
+ (d = t[u]) && (i = (r ? d(e, a, i) : d(i)) || i);
111
111
  return r && i && be(e, a, i), i;
112
112
  };
113
113
  const x = "pie-textarea";
114
114
  class o extends K(G(w)) {
115
115
  constructor() {
116
- super(...arguments), this.value = c.value, this.disabled = c.disabled, this.size = c.size, this.resize = c.resize, this.label = c.label, this.readonly = c.readonly, this.autoFocus = c.autoFocus, this.required = c.required, this._throttledResize = fe(() => {
116
+ super(...arguments), this.value = h.value, this.disabled = h.disabled, this.size = h.size, this.resize = h.resize, this.label = h.label, this.readonly = h.readonly, this.autoFocus = h.autoFocus, this.required = h.required, this._throttledResize = fe(() => {
117
117
  this.resize === "auto" && (this._textarea.style.height = "auto", this._textarea.style.height = `${this._textarea.scrollHeight + 2}px`);
118
118
  }, 100), this.handleInput = (e) => {
119
119
  this.value = e.target.value, this.restrictInputLength(), this._internals.setFormValue(this.value), this.handleResize();
@@ -145,7 +145,7 @@ class o extends K(G(w)) {
145
145
  * Resets the value to the default value.
146
146
  */
147
147
  formResetCallback() {
148
- this.value = c.value, this._internals.setFormValue(this.value);
148
+ this.value = this.defaultValue ?? h.value, this._internals.setFormValue(this.value);
149
149
  }
150
150
  firstUpdated() {
151
151
  this.restrictInputLength(), this._internals.setFormValue(this.value), this._textarea.addEventListener("keydown", this.handleKeyDown);
@@ -167,7 +167,7 @@ class o extends K(G(w)) {
167
167
  }
168
168
  renderLabel(e, a) {
169
169
  const r = a ? `${this.value.length}/${a}` : void 0;
170
- return e != null && e.length ? I`<pie-form-label for="${x}" trailing=${O(r)}>${e}</pie-form-label>` : B;
170
+ return e != null && e.length ? I`<pie-form-label for="${x}" trailing=${O(r)}>${e}</pie-form-label>` : q;
171
171
  }
172
172
  render() {
173
173
  const {
@@ -176,7 +176,7 @@ class o extends K(G(w)) {
176
176
  size: r,
177
177
  autocomplete: i,
178
178
  autoFocus: u,
179
- name: l,
179
+ name: d,
180
180
  readonly: s,
181
181
  value: p,
182
182
  required: g,
@@ -193,7 +193,7 @@ class o extends K(G(w)) {
193
193
  <textarea
194
194
  id="${x}"
195
195
  data-test-id="${x}"
196
- name=${O(l)}
196
+ name=${O(d)}
197
197
  autocomplete=${O(i)}
198
198
  .value=${A(p)}
199
199
  ?autofocus=${u}
@@ -207,49 +207,52 @@ class o extends K(G(w)) {
207
207
  }
208
208
  }
209
209
  o.shadowRootOptions = { ...w.shadowRootOptions, delegatesFocus: !0 };
210
- o.styles = N(ge);
211
- d([
212
- h({ type: String })
210
+ o.styles = B(ge);
211
+ l([
212
+ c({ type: String })
213
213
  ], o.prototype, "value", 2);
214
- d([
215
- h({ type: Boolean, reflect: !0 })
214
+ l([
215
+ c({ type: String })
216
+ ], o.prototype, "defaultValue", 2);
217
+ l([
218
+ c({ type: Boolean, reflect: !0 })
216
219
  ], o.prototype, "disabled", 2);
217
- d([
218
- h({ type: String }),
219
- F(x, ve, c.size)
220
+ l([
221
+ c({ type: String }),
222
+ F(x, ve, h.size)
220
223
  ], o.prototype, "size", 2);
221
- d([
222
- h({ type: String }),
223
- F(x, xe, c.resize)
224
+ l([
225
+ c({ type: String }),
226
+ F(x, xe, h.resize)
224
227
  ], o.prototype, "resize", 2);
225
- d([
226
- h({ type: String })
228
+ l([
229
+ c({ type: String })
227
230
  ], o.prototype, "label", 2);
228
- d([
229
- h({ type: Number })
231
+ l([
232
+ c({ type: Number })
230
233
  ], o.prototype, "maxLength", 2);
231
- d([
232
- h({ type: Boolean })
234
+ l([
235
+ c({ type: Boolean })
233
236
  ], o.prototype, "readonly", 2);
234
- d([
235
- h({ type: Boolean })
237
+ l([
238
+ c({ type: Boolean })
236
239
  ], o.prototype, "autoFocus", 2);
237
- d([
238
- h({ type: Boolean })
240
+ l([
241
+ c({ type: Boolean })
239
242
  ], o.prototype, "required", 2);
240
- d([
241
- h({ type: String })
243
+ l([
244
+ c({ type: String })
242
245
  ], o.prototype, "name", 2);
243
- d([
244
- h({ type: String })
246
+ l([
247
+ c({ type: String })
245
248
  ], o.prototype, "autocomplete", 2);
246
- d([
247
- V("textarea")
249
+ l([
250
+ N("textarea")
248
251
  ], o.prototype, "_textarea", 2);
249
252
  U(x, o);
250
253
  export {
251
254
  o as PieTextarea,
252
- c as defaultProps,
255
+ h as defaultProps,
253
256
  xe as resizeModes,
254
257
  ve as sizes
255
258
  };
package/dist/react.d.ts CHANGED
@@ -12,7 +12,7 @@ import type { TemplateResult } from 'lit-html';
12
12
  /**
13
13
  * The default values for the `TextareaProps` that are required (i.e. they have a fallback value in the component).
14
14
  */
15
- declare type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength'>>;
15
+ declare type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength' | 'defaultValue'>>;
16
16
 
17
17
  /**
18
18
  * Default values for optional properties that have default fallback values in the component.
@@ -33,6 +33,7 @@ declare class PieTextarea_2 extends PieTextarea_base implements TextareaProps {
33
33
  slotAssignment?: SlotAssignmentMode | undefined;
34
34
  };
35
35
  value: string;
36
+ defaultValue: TextareaProps['defaultValue'];
36
37
  disabled: boolean;
37
38
  size: "small" | "medium" | "large";
38
39
  resize: "auto" | "manual";
@@ -111,6 +112,10 @@ export declare interface TextareaProps {
111
112
  * The value of the textarea (used as a key/value pair in HTML forms with `name`).
112
113
  */
113
114
  value: string;
115
+ /**
116
+ * An optional default value to use when the textarea is reset.
117
+ */
118
+ defaultValue?: string;
114
119
  /**
115
120
  * The name of the textarea (used as a key/value pair with `value`). This is required in order to work properly with forms.
116
121
  */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justeattakeaway/pie-textarea",
3
3
  "description": "PIE Design System Textarea built using Web Components",
4
- "version": "0.6.0",
4
+ "version": "0.7.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -36,12 +36,13 @@
36
36
  "license": "Apache-2.0",
37
37
  "devDependencies": {
38
38
  "@custom-elements-manifest/analyzer": "0.9.0",
39
- "@justeattakeaway/pie-components-config": "0.16.0",
39
+ "@justeattakeaway/pie-components-config": "0.17.0",
40
+ "@justeattakeaway/pie-css": "0.12.1",
40
41
  "@types/lodash.throttle": "4.1.9",
41
42
  "cem-plugin-module-file-extensions": "0.0.5"
42
43
  },
43
44
  "dependencies": {
44
- "@justeattakeaway/pie-form-label": "0.14.0",
45
+ "@justeattakeaway/pie-form-label": "0.14.1",
45
46
  "@justeattakeaway/pie-webc-core": "0.24.0",
46
47
  "lodash.throttle": "4.1.1"
47
48
  },
package/src/defs.ts CHANGED
@@ -26,6 +26,11 @@ export interface TextareaProps {
26
26
  */
27
27
  value: string;
28
28
 
29
+ /**
30
+ * An optional default value to use when the textarea is reset.
31
+ */
32
+ defaultValue?: string;
33
+
29
34
  /**
30
35
  * The name of the textarea (used as a key/value pair with `value`). This is required in order to work properly with forms.
31
36
  */
@@ -70,7 +75,7 @@ export interface TextareaProps {
70
75
  /**
71
76
  * The default values for the `TextareaProps` that are required (i.e. they have a fallback value in the component).
72
77
  */
73
- type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength'>>;
78
+ type DefaultProps = ComponentDefaultProps<TextareaProps, keyof Omit<TextareaProps, 'name' | 'autocomplete' | 'maxLength' | 'defaultValue'>>;
74
79
 
75
80
  /**
76
81
  * Default values for optional properties that have default fallback values in the component.
package/src/index.ts CHANGED
@@ -34,6 +34,9 @@ export class PieTextarea extends FormControlMixin(RtlMixin(LitElement)) implemen
34
34
  @property({ type: String })
35
35
  public value = defaultProps.value;
36
36
 
37
+ @property({ type: String })
38
+ public defaultValue: TextareaProps['defaultValue'];
39
+
37
40
  @property({ type: Boolean, reflect: true })
38
41
  public disabled = defaultProps.disabled;
39
42
 
@@ -99,7 +102,7 @@ export class PieTextarea extends FormControlMixin(RtlMixin(LitElement)) implemen
99
102
  * Resets the value to the default value.
100
103
  */
101
104
  public formResetCallback (): void {
102
- this.value = defaultProps.value;
105
+ this.value = this.defaultValue ?? defaultProps.value;
103
106
 
104
107
  this._internals.setFormValue(this.value);
105
108
  }