@justeattakeaway/pie-textarea 0.0.0 → 0.2.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 +4 -4
- package/custom-elements.json +30 -1
- package/dist/index.d.ts +10 -0
- package/dist/index.js +27 -9
- package/dist/react.d.ts +11 -1
- package/dist/react.js +7 -6
- package/package.json +1 -1
- package/src/defs-react.ts +2 -7
- package/src/defs.ts +6 -3
- package/src/index.ts +16 -1
- package/src/react.ts +1 -1
package/README.md
CHANGED
|
@@ -72,9 +72,9 @@ import { PieTextarea } from '@justeattakeaway/pie-textarea/dist/react';
|
|
|
72
72
|
|
|
73
73
|
## Props
|
|
74
74
|
|
|
75
|
-
| Property | Type | Default | Description
|
|
76
|
-
|
|
77
|
-
|
|
|
75
|
+
| Property | Type | Default | Description |
|
|
76
|
+
|--|--|--|----------------------------------------------------|
|
|
77
|
+
| `disabled` | `boolean` | `false` | Indicates whether or not the textarea is disabled. |
|
|
78
78
|
|
|
79
79
|
In your markup or JSX, you can then use these to set the properties for the `pie-textarea` component:
|
|
80
80
|
|
|
@@ -88,4 +88,4 @@ In your markup or JSX, you can then use these to set the properties for the `pie
|
|
|
88
88
|
|
|
89
89
|
## Contributing
|
|
90
90
|
|
|
91
|
-
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
|
91
|
+
Check out our [contributing guide](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide) for more information on [local development](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#local-development) and how to run specific [component tests](https://github.com/justeattakeaway/pie/wiki/Contributing-Guide#testing).
|
package/custom-elements.json
CHANGED
|
@@ -22,7 +22,36 @@
|
|
|
22
22
|
"kind": "class",
|
|
23
23
|
"description": "",
|
|
24
24
|
"name": "PieTextarea",
|
|
25
|
-
"members": [
|
|
25
|
+
"members": [
|
|
26
|
+
{
|
|
27
|
+
"kind": "field",
|
|
28
|
+
"name": "shadowRootOptions",
|
|
29
|
+
"type": {
|
|
30
|
+
"text": "object"
|
|
31
|
+
},
|
|
32
|
+
"static": true,
|
|
33
|
+
"default": "{ ...LitElement.shadowRootOptions, delegatesFocus: true }"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"kind": "field",
|
|
37
|
+
"name": "disabled",
|
|
38
|
+
"type": {
|
|
39
|
+
"text": "TextareaProps['disabled'] | undefined"
|
|
40
|
+
},
|
|
41
|
+
"privacy": "public",
|
|
42
|
+
"attribute": "disabled",
|
|
43
|
+
"reflects": true
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"attributes": [
|
|
47
|
+
{
|
|
48
|
+
"name": "disabled",
|
|
49
|
+
"type": {
|
|
50
|
+
"text": "TextareaProps['disabled'] | undefined"
|
|
51
|
+
},
|
|
52
|
+
"fieldName": "disabled"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
26
55
|
"mixins": [
|
|
27
56
|
{
|
|
28
57
|
"name": "RtlMixin",
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ import type { TemplateResult } from 'lit-html';
|
|
|
8
8
|
* @tagname pie-textarea
|
|
9
9
|
*/
|
|
10
10
|
export declare class PieTextarea extends PieTextarea_base implements TextareaProps {
|
|
11
|
+
static shadowRootOptions: {
|
|
12
|
+
delegatesFocus: boolean;
|
|
13
|
+
mode: ShadowRootMode;
|
|
14
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
15
|
+
};
|
|
16
|
+
disabled?: TextareaProps['disabled'];
|
|
11
17
|
render(): TemplateResult<1>;
|
|
12
18
|
static styles: CSSResult;
|
|
13
19
|
}
|
|
@@ -15,6 +21,10 @@ export declare class PieTextarea extends PieTextarea_base implements TextareaPro
|
|
|
15
21
|
declare const PieTextarea_base: GenericConstructor<RTLInterface> & typeof LitElement;
|
|
16
22
|
|
|
17
23
|
export declare interface TextareaProps {
|
|
24
|
+
/**
|
|
25
|
+
* Same as the HTML disabled attribute - indicates whether the textarea is disabled.
|
|
26
|
+
*/
|
|
27
|
+
disabled?: boolean;
|
|
18
28
|
}
|
|
19
29
|
|
|
20
30
|
export { }
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,32 @@
|
|
|
1
|
-
import { LitElement as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { LitElement as p, html as l, unsafeCSS as f } from "lit";
|
|
2
|
+
import { property as d } from "lit/decorators.js";
|
|
3
|
+
import { RtlMixin as m, defineCustomElement as c } from "@justeattakeaway/pie-webc-core";
|
|
4
|
+
const u = `*,*:after,*:before{box-sizing:inherit}
|
|
5
|
+
`;
|
|
6
|
+
var x = Object.defineProperty, b = Object.getOwnPropertyDescriptor, h = (s, t, a, r) => {
|
|
7
|
+
for (var e = r > 1 ? void 0 : r ? b(t, a) : t, i = s.length - 1, n; i >= 0; i--)
|
|
8
|
+
(n = s[i]) && (e = (r ? n(t, a, e) : n(e)) || e);
|
|
9
|
+
return r && e && x(t, a, e), e;
|
|
10
|
+
};
|
|
11
|
+
const v = "pie-textarea";
|
|
12
|
+
class o extends m(p) {
|
|
6
13
|
render() {
|
|
7
|
-
|
|
14
|
+
const {
|
|
15
|
+
disabled: t
|
|
16
|
+
} = this;
|
|
17
|
+
return l`
|
|
18
|
+
<textarea
|
|
19
|
+
data-test-id="pie-textarea"
|
|
20
|
+
?disabled=${t}
|
|
21
|
+
/>`;
|
|
8
22
|
}
|
|
9
23
|
}
|
|
10
|
-
|
|
11
|
-
|
|
24
|
+
o.shadowRootOptions = { ...p.shadowRootOptions, delegatesFocus: !0 };
|
|
25
|
+
o.styles = f(u);
|
|
26
|
+
h([
|
|
27
|
+
d({ type: Boolean, reflect: !0 })
|
|
28
|
+
], o.prototype, "disabled", 2);
|
|
29
|
+
c(v, o);
|
|
12
30
|
export {
|
|
13
|
-
|
|
31
|
+
o as PieTextarea
|
|
14
32
|
};
|
package/dist/react.d.ts
CHANGED
|
@@ -11,15 +11,25 @@ export declare const PieTextarea: React_2.ForwardRefExoticComponent<TextareaProp
|
|
|
11
11
|
* @tagname pie-textarea
|
|
12
12
|
*/
|
|
13
13
|
declare class PieTextarea_2 extends PieTextarea_base implements TextareaProps {
|
|
14
|
+
static shadowRootOptions: {
|
|
15
|
+
delegatesFocus: boolean;
|
|
16
|
+
mode: ShadowRootMode;
|
|
17
|
+
slotAssignment?: SlotAssignmentMode | undefined;
|
|
18
|
+
};
|
|
19
|
+
disabled?: TextareaProps['disabled'];
|
|
14
20
|
render(): TemplateResult<1>;
|
|
15
21
|
static styles: CSSResult;
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
declare const PieTextarea_base: GenericConstructor<RTLInterface> & typeof LitElement;
|
|
19
25
|
|
|
20
|
-
declare type ReactBaseType = React_2.HTMLAttributes<
|
|
26
|
+
declare type ReactBaseType = React_2.HTMLAttributes<HTMLTextAreaElement>;
|
|
21
27
|
|
|
22
28
|
export declare interface TextareaProps {
|
|
29
|
+
/**
|
|
30
|
+
* Same as the HTML disabled attribute - indicates whether the textarea is disabled.
|
|
31
|
+
*/
|
|
32
|
+
disabled?: boolean;
|
|
23
33
|
}
|
|
24
34
|
|
|
25
35
|
export { }
|
package/dist/react.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
|
-
import { createComponent as
|
|
3
|
-
import { PieTextarea as
|
|
2
|
+
import { createComponent as t } from "@lit/react";
|
|
3
|
+
import { PieTextarea as a } from "./index.js";
|
|
4
4
|
import "lit";
|
|
5
|
+
import "lit/decorators.js";
|
|
5
6
|
import "@justeattakeaway/pie-webc-core";
|
|
6
|
-
const r =
|
|
7
|
+
const r = t({
|
|
7
8
|
displayName: "PieTextarea",
|
|
8
|
-
elementClass:
|
|
9
|
+
elementClass: a,
|
|
9
10
|
react: e,
|
|
10
11
|
tagName: "pie-textarea",
|
|
11
12
|
events: {}
|
|
12
|
-
}),
|
|
13
|
+
}), x = r;
|
|
13
14
|
export {
|
|
14
|
-
|
|
15
|
+
x as PieTextarea
|
|
15
16
|
};
|
package/package.json
CHANGED
package/src/defs-react.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* Use the React IntrinsicElements interface to find how to map standard HTML elements to existing React Interfaces
|
|
5
|
-
* Example: an HTML button maps to `React.ButtonHTMLAttributes<HTMLButtonElement>`
|
|
6
|
-
* https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0bb210867d16170c4a08d9ce5d132817651a0f80/types/react/index.d.ts#L2829
|
|
7
|
-
*/
|
|
8
|
-
export type ReactBaseType = React.HTMLAttributes<HTMLElement>
|
|
2
|
+
|
|
3
|
+
export type ReactBaseType = React.HTMLAttributes<HTMLTextAreaElement>
|
package/src/defs.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export interface TextareaProps {
|
|
2
|
+
/**
|
|
3
|
+
* Same as the HTML disabled attribute - indicates whether the textarea is disabled.
|
|
4
|
+
*/
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LitElement, html, unsafeCSS } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
|
|
2
4
|
import { RtlMixin, defineCustomElement } from '@justeattakeaway/pie-webc-core';
|
|
3
5
|
|
|
4
6
|
import styles from './textarea.scss?inline';
|
|
@@ -13,8 +15,21 @@ const componentSelector = 'pie-textarea';
|
|
|
13
15
|
* @tagname pie-textarea
|
|
14
16
|
*/
|
|
15
17
|
export class PieTextarea extends RtlMixin(LitElement) implements TextareaProps {
|
|
18
|
+
static shadowRootOptions = { ...LitElement.shadowRootOptions, delegatesFocus: true };
|
|
19
|
+
|
|
20
|
+
@property({ type: Boolean, reflect: true })
|
|
21
|
+
public disabled?: TextareaProps['disabled'];
|
|
22
|
+
|
|
16
23
|
render () {
|
|
17
|
-
|
|
24
|
+
const {
|
|
25
|
+
disabled,
|
|
26
|
+
} = this;
|
|
27
|
+
|
|
28
|
+
return html`
|
|
29
|
+
<textarea
|
|
30
|
+
data-test-id="pie-textarea"
|
|
31
|
+
?disabled=${disabled}
|
|
32
|
+
/>`;
|
|
18
33
|
}
|
|
19
34
|
|
|
20
35
|
// Renders a `CSSResult` generated from SCSS by Vite
|
package/src/react.ts
CHANGED
|
@@ -13,7 +13,7 @@ const PieTextareaReact = createComponent({
|
|
|
13
13
|
events: {},
|
|
14
14
|
});
|
|
15
15
|
|
|
16
|
-
type ReactBaseType = React.HTMLAttributes<
|
|
16
|
+
type ReactBaseType = React.HTMLAttributes<HTMLTextAreaElement>
|
|
17
17
|
|
|
18
18
|
export const PieTextarea = PieTextareaReact as React.ForwardRefExoticComponent<React.PropsWithoutRef<TextareaProps>
|
|
19
19
|
& React.RefAttributes<PieTextareaLit> & ReactBaseType>;
|