@fluentui/react-textarea 0.0.0-nightly-20220412-0417.1

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.
Files changed (57) hide show
  1. package/CHANGELOG.json +82 -0
  2. package/CHANGELOG.md +35 -0
  3. package/LICENSE +15 -0
  4. package/MIGRATION.md +22 -0
  5. package/README.md +30 -0
  6. package/Spec.md +166 -0
  7. package/dist/react-textarea.d.ts +101 -0
  8. package/lib/Textarea.d.ts +1 -0
  9. package/lib/Textarea.js +2 -0
  10. package/lib/Textarea.js.map +1 -0
  11. package/lib/components/Textarea/Textarea.d.ts +6 -0
  12. package/lib/components/Textarea/Textarea.js +15 -0
  13. package/lib/components/Textarea/Textarea.js.map +1 -0
  14. package/lib/components/Textarea/Textarea.types.d.ts +63 -0
  15. package/lib/components/Textarea/Textarea.types.js +2 -0
  16. package/lib/components/Textarea/Textarea.types.js.map +1 -0
  17. package/lib/components/Textarea/index.d.ts +5 -0
  18. package/lib/components/Textarea/index.js +6 -0
  19. package/lib/components/Textarea/index.js.map +1 -0
  20. package/lib/components/Textarea/renderTextarea.d.ts +5 -0
  21. package/lib/components/Textarea/renderTextarea.js +16 -0
  22. package/lib/components/Textarea/renderTextarea.js.map +1 -0
  23. package/lib/components/Textarea/useTextarea.d.ts +12 -0
  24. package/lib/components/Textarea/useTextarea.js +59 -0
  25. package/lib/components/Textarea/useTextarea.js.map +1 -0
  26. package/lib/components/Textarea/useTextareaStyles.d.ts +7 -0
  27. package/lib/components/Textarea/useTextareaStyles.js +293 -0
  28. package/lib/components/Textarea/useTextareaStyles.js.map +1 -0
  29. package/lib/index.d.ts +2 -0
  30. package/lib/index.js +2 -0
  31. package/lib/index.js.map +1 -0
  32. package/lib/tsdoc-metadata.json +11 -0
  33. package/lib-commonjs/Textarea.d.ts +1 -0
  34. package/lib-commonjs/Textarea.js +10 -0
  35. package/lib-commonjs/Textarea.js.map +1 -0
  36. package/lib-commonjs/components/Textarea/Textarea.d.ts +6 -0
  37. package/lib-commonjs/components/Textarea/Textarea.js +26 -0
  38. package/lib-commonjs/components/Textarea/Textarea.js.map +1 -0
  39. package/lib-commonjs/components/Textarea/Textarea.types.d.ts +63 -0
  40. package/lib-commonjs/components/Textarea/Textarea.types.js +6 -0
  41. package/lib-commonjs/components/Textarea/Textarea.types.js.map +1 -0
  42. package/lib-commonjs/components/Textarea/index.d.ts +5 -0
  43. package/lib-commonjs/components/Textarea/index.js +18 -0
  44. package/lib-commonjs/components/Textarea/index.js.map +1 -0
  45. package/lib-commonjs/components/Textarea/renderTextarea.d.ts +5 -0
  46. package/lib-commonjs/components/Textarea/renderTextarea.js +27 -0
  47. package/lib-commonjs/components/Textarea/renderTextarea.js.map +1 -0
  48. package/lib-commonjs/components/Textarea/useTextarea.d.ts +12 -0
  49. package/lib-commonjs/components/Textarea/useTextarea.js +69 -0
  50. package/lib-commonjs/components/Textarea/useTextarea.js.map +1 -0
  51. package/lib-commonjs/components/Textarea/useTextareaStyles.d.ts +7 -0
  52. package/lib-commonjs/components/Textarea/useTextareaStyles.js +304 -0
  53. package/lib-commonjs/components/Textarea/useTextareaStyles.js.map +1 -0
  54. package/lib-commonjs/index.d.ts +2 -0
  55. package/lib-commonjs/index.js +40 -0
  56. package/lib-commonjs/index.js.map +1 -0
  57. package/package.json +53 -0
package/CHANGELOG.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@fluentui/react-textarea",
3
+ "entries": [
4
+ {
5
+ "date": "Tue, 12 Apr 2022 04:26:08 GMT",
6
+ "tag": "@fluentui/react-textarea_v0.0.0-nightly-20220412-0417.1",
7
+ "version": "0.0.0-nightly-20220412-0417.1",
8
+ "comments": {
9
+ "prerelease": [
10
+ {
11
+ "author": "email not defined",
12
+ "package": "@fluentui/react-textarea",
13
+ "commit": "not available",
14
+ "comment": "Release nightly v9"
15
+ },
16
+ {
17
+ "author": "beachball",
18
+ "package": "@fluentui/react-textarea",
19
+ "comment": "Bump @fluentui/react-theme to v0.0.0-nightly-20220412-0417.1",
20
+ "commit": "b4913156db971c5e4b4b42858815db4ae2ed55e6"
21
+ },
22
+ {
23
+ "author": "beachball",
24
+ "package": "@fluentui/react-textarea",
25
+ "comment": "Bump @fluentui/react-utilities to v0.0.0-nightly-20220412-0417.1",
26
+ "commit": "b4913156db971c5e4b4b42858815db4ae2ed55e6"
27
+ },
28
+ {
29
+ "author": "beachball",
30
+ "package": "@fluentui/react-textarea",
31
+ "comment": "Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220412-0417.1",
32
+ "commit": "b4913156db971c5e4b4b42858815db4ae2ed55e6"
33
+ }
34
+ ],
35
+ "none": [
36
+ {
37
+ "author": "email not defined",
38
+ "package": "@fluentui/react-textarea",
39
+ "commit": "98042e9b8eb9d4dd78f1e42e79db6a2e33404b9d",
40
+ "comment": "Adding label to Default story and making package public."
41
+ }
42
+ ]
43
+ }
44
+ },
45
+ {
46
+ "date": "Fri, 04 Mar 2022 05:17:40 GMT",
47
+ "tag": "@fluentui/react-textarea_v9.0.0-alpha.0",
48
+ "version": "9.0.0-alpha.0",
49
+ "comments": {
50
+ "prerelease": [
51
+ {
52
+ "author": "beachball",
53
+ "package": "@fluentui/react-textarea",
54
+ "comment": "Bump @fluentui/react-theme to v9.0.0-rc.4",
55
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
56
+ },
57
+ {
58
+ "author": "beachball",
59
+ "package": "@fluentui/react-textarea",
60
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.5",
61
+ "commit": "1494f0b620f6d5aae7f0aef33fc9e8f6eb7f8749"
62
+ }
63
+ ]
64
+ }
65
+ },
66
+ {
67
+ "date": "Tue, 01 Mar 2022 02:17:40 GMT",
68
+ "tag": "@fluentui/react-textarea_v9.0.0-alpha.0",
69
+ "version": "9.0.0-alpha.0",
70
+ "comments": {
71
+ "prerelease": [
72
+ {
73
+ "author": "beachball",
74
+ "package": "@fluentui/react-textarea",
75
+ "comment": "Bump @fluentui/react-utilities to v9.0.0-rc.4",
76
+ "commit": "0bc1e755543ed69443d5d03e1976c630583242f7"
77
+ }
78
+ ]
79
+ }
80
+ }
81
+ ]
82
+ }
package/CHANGELOG.md ADDED
@@ -0,0 +1,35 @@
1
+ # Change Log - @fluentui/react-textarea
2
+
3
+ This log was last generated on Tue, 12 Apr 2022 04:26:08 GMT and should not be manually modified.
4
+
5
+ <!-- Start content -->
6
+
7
+ ## [0.0.0-nightly-20220412-0417.1](https://github.com/microsoft/fluentui/tree/@fluentui/react-textarea_v0.0.0-nightly-20220412-0417.1)
8
+
9
+ Tue, 12 Apr 2022 04:26:08 GMT
10
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-textarea_v9.0.0-alpha.0..@fluentui/react-textarea_v0.0.0-nightly-20220412-0417.1)
11
+
12
+ ### Changes
13
+
14
+ - Release nightly v9 ([commit](https://github.com/microsoft/fluentui/commit/not available) by email not defined)
15
+ - Bump @fluentui/react-theme to v0.0.0-nightly-20220412-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/b4913156db971c5e4b4b42858815db4ae2ed55e6) by beachball)
16
+ - Bump @fluentui/react-utilities to v0.0.0-nightly-20220412-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/b4913156db971c5e4b4b42858815db4ae2ed55e6) by beachball)
17
+ - Bump @fluentui/react-conformance-griffel to v0.0.0-nightly-20220412-0417.1 ([commit](https://github.com/microsoft/fluentui/commit/b4913156db971c5e4b4b42858815db4ae2ed55e6) by beachball)
18
+
19
+ ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-textarea_v9.0.0-alpha.0)
20
+
21
+ Fri, 04 Mar 2022 05:17:40 GMT
22
+ [Compare changes](https://github.com/microsoft/fluentui/compare/@fluentui/react-textarea_v9.0.0-alpha.0..@fluentui/react-textarea_v9.0.0-alpha.0)
23
+
24
+ ### Changes
25
+
26
+ - Bump @fluentui/react-theme to v9.0.0-rc.4 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
27
+ - Bump @fluentui/react-utilities to v9.0.0-rc.5 ([PR #21947](https://github.com/microsoft/fluentui/pull/21947) by beachball)
28
+
29
+ ## [9.0.0-alpha.0](https://github.com/microsoft/fluentui/tree/@fluentui/react-textarea_v9.0.0-alpha.0)
30
+
31
+ Tue, 01 Mar 2022 02:17:40 GMT
32
+
33
+ ### Changes
34
+
35
+ - Bump @fluentui/react-utilities to v9.0.0-rc.4 ([PR #21884](https://github.com/microsoft/fluentui/pull/21884) by beachball)
package/LICENSE ADDED
@@ -0,0 +1,15 @@
1
+ @fluentui/react-textarea
2
+
3
+ Copyright (c) Microsoft Corporation
4
+
5
+ All rights reserved.
6
+
7
+ MIT License
8
+
9
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14
+
15
+ Note: Usage of the fonts and icons referenced in Fluent UI React is subject to the terms listed at https://aka.ms/fluentui-assets-license
package/MIGRATION.md ADDED
@@ -0,0 +1,22 @@
1
+ # TextArea Migration
2
+
3
+ ## STATUS: WIP
4
+
5
+ This Migration guide is a work in progress and is not yet ready for use.
6
+
7
+ ## Migration from v0
8
+
9
+ - `TextArea`
10
+ - `fluid` => `display`.
11
+ - `inverted` => `appearance`.
12
+
13
+ ## Migration from v8
14
+
15
+ - `TextArea`
16
+ - `autoAdjustHeight` => `autoResize`.
17
+ - `borderless` => `appearance`.
18
+ - `deferredValidationTime` => Not supported.
19
+ - `description` => Not supported.
20
+ - `errorMessage` => Not supported.
21
+ - `invalid` => Not supported.
22
+ - `underlined` => `appearance`.
package/README.md ADDED
@@ -0,0 +1,30 @@
1
+ # @fluentui/react-textarea
2
+
3
+ **React Textarea components for [Fluent UI React](https://developer.microsoft.com/en-us/fluentui)**
4
+
5
+ The Textarea component is a multiline text input that allows the user to enter
6
+
7
+ ## STATUS: WIP 🚧
8
+
9
+ These are not production-ready components and **should never be used in product**. This space is useful for testing new components whose APIs might change before final release.
10
+
11
+ ## Usage
12
+
13
+ To import Textarea:
14
+
15
+ ```js
16
+ import { Textarea } from '@fluentui/react-textarea';
17
+ ```
18
+
19
+ Once the Textarea component is ready for production use, the component will be available at:
20
+
21
+ ```js
22
+ import { Textarea } from '@fluentui/react-components';
23
+ ```
24
+
25
+ ### Examples
26
+
27
+ ```js
28
+ <Textarea placeholder="Enter text here..." />
29
+ <Textarea defaultValue="Lorem ipsum dolor" />
30
+ ```
package/Spec.md ADDED
@@ -0,0 +1,166 @@
1
+ # @fluentui/react-textarea Spec
2
+
3
+ ## Background
4
+
5
+ `TextArea` is a multi-line text input field that uses the `<textarea>` element.
6
+
7
+ It is usually used when the user will use more than one line of text, such as a review in a website.
8
+
9
+ In some libraries, `TextArea` is a variant of `TextField` or `Input`.
10
+
11
+ ## Prior Art
12
+
13
+ | Component Library | Name |
14
+ | -------------------------------------------------------------------------------- | ------------------------------- |
15
+ | v8 | `TextField` variant `Multiline` |
16
+ | v0 | `TextArea` |
17
+ | [Ant Design](https://ant.design/components/input/) | `Input.TextArea` |
18
+ | [Material UI](https://v4.mui.com/components/text-fields/) | `TextField` variant `Multiline` |
19
+ | [React Spectrum](https://react-spectrum.adobe.com/react-spectrum/TextArea.html) | `TextArea` |
20
+ | [React Bootstrap](https://react-bootstrap.github.io/forms/input-group/) | `FormControl` as `textarea` |
21
+ | [Blueprint](https://blueprintjs.com/docs/#core/components/text-inputs.text-area) | `TextArea` |
22
+ | [Grommet](https://v2.grommet.io/textarea) | `TextArea` |
23
+
24
+ - Most libraries have their own `TextArea` component while others make it a variant of another component.
25
+ - `React Bootstrap` uses as with `FormControl` as follows: `<FormControl as="textarea" />`
26
+ - `Material UI` and `v8` use the `TextField` control and added a variant `multiline` as follows: `<TextField multiline defaultValue="Default Value" />`
27
+ - `Ant Design` uses the `TextArea` subcomponent as follows: `<Input.TextArea placeholder="Text Area" />`
28
+
29
+ #### TextArea in v8
30
+
31
+ - `Textfield` component with `multiline` property. When the `multiline` property is set to true, it is rendered as a `textarea`.
32
+ - Has descriptions, label, error message, and handles maximum character count.
33
+
34
+ #### TextArea in v0
35
+
36
+ - Doesn't have `label` prop.
37
+ - Handles maximum character count.
38
+
39
+ ## Sample Code
40
+
41
+ ```tsx
42
+ <TextArea
43
+ className="textAreaClassName"
44
+ id="textarea-1"
45
+ defaultValue="This is a TextArea"
46
+ onChange={(ev, data) => console.log(data.value)}
47
+ />
48
+ ```
49
+
50
+ ## Variants
51
+
52
+ - Visual variants
53
+ - `Filled Darker`: TextArea has a gray background and no outline.
54
+ - `Filled Lighter`: TextArea has a white background and no outline.
55
+ - `Outline`: TextArea has a white background, outline, and a line on the bottom.
56
+ - Behavior variants
57
+ - `Disabled`: TextArea has a gray background, gray text, outline, and interaction is disabled.
58
+ - `Read Only`: TextArea has a gray background, gray outline, and typing is disabled.
59
+
60
+ Note: These colors are based on the design spec, therefore they come from the default theme.
61
+
62
+ ## API
63
+
64
+ ### Component props:
65
+
66
+ ```ts
67
+ type TextAreaProps = {
68
+ /**
69
+ * Which direction the TextArea is allowed to be resized.
70
+ *
71
+ * @defaultvalue none
72
+ */
73
+ resize?: 'none' | 'horizontal' | 'vertical' | 'both';
74
+
75
+ /**
76
+ * Size of the TextArea.
77
+ *
78
+ * @defaultvalue medium
79
+ */
80
+ size?: 'small' | 'medium' | 'large';
81
+
82
+ /**
83
+ * Styling the TextArea should use.
84
+ *
85
+ * @defaultvalue outline
86
+ */
87
+ appearance?: 'outline' | 'filledDarker' | 'filledLighter';
88
+
89
+ /**
90
+ * The value of the TextArea. Used when the component is controlled.
91
+ */
92
+ value?: string;
93
+
94
+ /**
95
+ * The default value of the TextArea. Used when the component is uncontrolled.
96
+ */
97
+ defaultValue?: string;
98
+
99
+ /**
100
+ * Callback for when the user changes the value.
101
+ */
102
+ onChange?: (ev: React.ChangeEvent<HTMLTextAreaElement>, data: TextAreaOnChangeData) => void;
103
+ };
104
+
105
+ /**
106
+ * Data passed to the `onChange` callback when the textarea's value changes.
107
+ */
108
+ type TextAreaOnChangeData = {
109
+ value: string;
110
+ };
111
+ ```
112
+
113
+ The auto-resize feature is known to be unstable from v8 and tricky to implement. [As mentioned by ecraig12345](https://github.com/microsoft/fluentui/pull/21898#discussion_r816418917), we've been trying to prioritize getting the components ready for production and may have to leave out some features for the initial version.
114
+
115
+ `TextArea` has two slots:
116
+
117
+ - `textarea` the primary slot that handles all `TextArea` behavior, except the focus indicator.
118
+ - `root` acts as a wrapper to allow a pseudo-element for the focus indicator. This wrapper is needed since textarea cannot have children, therefore `::after` cannot be used.
119
+
120
+ The design spec mentions a character count, error message, and label which will be left out until further discussion.
121
+
122
+ ## Structure
123
+
124
+ **Public**
125
+
126
+ ```tsx
127
+ <TextArea id="textarea-1" onChange={(ev, data) => console.log(data.value)}>
128
+ This is a TextArea
129
+ </TextArea>
130
+ ```
131
+
132
+ **Internal**
133
+
134
+ ```tsx
135
+ <slots.root {...slotProps.root}></slots.root>
136
+ ```
137
+
138
+ **DOM** - how the component will be rendered as HTML elements
139
+
140
+ ```html
141
+ <div className="fui-TextArea">
142
+ <textarea id="textarea-1" className="fui-TextArea__textarea">This is a TextArea</textarea>
143
+ </div>
144
+ ```
145
+
146
+ ## Migration
147
+
148
+ See [MIGRATION.md](MIGRATION.md).
149
+
150
+ ## Behaviors
151
+
152
+ TODO: Until the upcoming design review, behavior hasn't been set and will be updated when approved.
153
+
154
+ - Component States
155
+ - Rest
156
+ - Hover
157
+ - Pressed: Apply focus border animation.
158
+ - Focussed: Apply thick blue line on the bottom border.
159
+
160
+ Interaction will be handled by native element.
161
+
162
+ ## Accessibility
163
+
164
+ - User should provide a label since there is no built-in label for TextArea.
165
+ - If no label is used, `aria-label` or `aria-labelledby` should be provided by the user.
166
+ - Screen reader behavior will be handled by using the native `<textarea>` element.
@@ -0,0 +1,101 @@
1
+ import type { ComponentProps } from '@fluentui/react-utilities';
2
+ import type { ComponentState } from '@fluentui/react-utilities';
3
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
4
+ import * as React_2 from 'react';
5
+ import type { Slot } from '@fluentui/react-utilities';
6
+ import { SlotClassNames } from '@fluentui/react-utilities';
7
+
8
+ /**
9
+ * Render the final JSX of Textarea
10
+ */
11
+ export declare const renderTextarea_unstable: (state: TextareaState) => JSX.Element;
12
+
13
+ /**
14
+ * The Textarea component allows the user to enter and edit text in multiple lines.
15
+ */
16
+ export declare const Textarea: ForwardRefComponent<TextareaProps>;
17
+
18
+ export declare const textareaClassNames: SlotClassNames<TextareaSlots>;
19
+
20
+ declare type TextareaCommons = {
21
+ /**
22
+ * Which direction the Textarea is allowed to be resized.
23
+ *
24
+ * @default none
25
+ */
26
+ resize: 'none' | 'horizontal' | 'vertical' | 'both';
27
+ /**
28
+ * Size of the Textarea.
29
+ *
30
+ * @default medium
31
+ */
32
+ size: 'small' | 'medium' | 'large';
33
+ /**
34
+ * Styling the Textarea should use.
35
+ *
36
+ * @default outline
37
+ */
38
+ appearance: 'outline' | 'filledDarker' | 'filledLighter';
39
+ };
40
+
41
+ /**
42
+ * Data passed to the `onChange` callback when the textarea's value changes.
43
+ */
44
+ declare type TextareaOnChangeData = {
45
+ value: string;
46
+ };
47
+
48
+ /**
49
+ * Textarea Props
50
+ */
51
+ export declare type TextareaProps = Omit<ComponentProps<Partial<TextareaSlots>, 'textarea'>, 'value' | 'defaultValue' | 'onChange' | 'size'> & Partial<TextareaCommons> & {
52
+ /**
53
+ * The value of the Textarea.
54
+ */
55
+ value?: string;
56
+ /**
57
+ * The default value of the Textarea.
58
+ */
59
+ defaultValue?: string;
60
+ /**
61
+ * Callback for when the user changes the value.
62
+ */
63
+ onChange?: (ev: React_2.ChangeEvent<HTMLTextAreaElement>, data: TextareaOnChangeData) => void;
64
+ };
65
+
66
+ export declare type TextareaSlots = {
67
+ /**
68
+ * Wrapper element used for displaying the borders for Textarea. This wrapper is needed due to the focus
69
+ * indicator border animation. For more information, see Spec.md
70
+ *
71
+ * The root only receives `className` and `style`. All other props are applied to the `textarea` slot.
72
+ */
73
+ root: NonNullable<Slot<'span'>>;
74
+ /**
75
+ * The `<textarea>` element. This is the primary slot, all native props and ref are applied to this slot.
76
+ */
77
+ textarea: NonNullable<Slot<'textarea'>>;
78
+ };
79
+
80
+ /**
81
+ * State used in rendering Textarea
82
+ */
83
+ export declare type TextareaState = ComponentState<TextareaSlots> & TextareaCommons;
84
+
85
+ /**
86
+ * Create the state required to render Textarea.
87
+ *
88
+ * The returned state can be modified with hooks such as useTextareaStyles_unstable,
89
+ * before being passed to renderTextarea_unstable.
90
+ *
91
+ * @param props - props from this instance of Textarea
92
+ * @param ref - reference to root HTMLElement of Textarea
93
+ */
94
+ export declare const useTextarea_unstable: (props: TextareaProps, ref: React_2.Ref<HTMLTextAreaElement>) => TextareaState;
95
+
96
+ /**
97
+ * Apply styling to the Textarea slots based on the state
98
+ */
99
+ export declare const useTextareaStyles_unstable: (state: TextareaState) => TextareaState;
100
+
101
+ export { }
@@ -0,0 +1 @@
1
+ export * from './components/Textarea/index';
@@ -0,0 +1,2 @@
1
+ export * from './components/Textarea/index';
2
+ //# sourceMappingURL=Textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.js","sourceRoot":"../src/","sources":["Textarea.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './components/Textarea/index';\n"]}
@@ -0,0 +1,6 @@
1
+ import type { ForwardRefComponent } from '@fluentui/react-utilities';
2
+ import type { TextareaProps } from './Textarea.types';
3
+ /**
4
+ * The Textarea component allows the user to enter and edit text in multiple lines.
5
+ */
6
+ export declare const Textarea: ForwardRefComponent<TextareaProps>;
@@ -0,0 +1,15 @@
1
+ import * as React from 'react';
2
+ import { renderTextarea_unstable } from './renderTextarea';
3
+ import { useTextarea_unstable } from './useTextarea';
4
+ import { useTextareaStyles_unstable } from './useTextareaStyles';
5
+ /**
6
+ * The Textarea component allows the user to enter and edit text in multiple lines.
7
+ */
8
+
9
+ export const Textarea = /*#__PURE__*/React.forwardRef((props, ref) => {
10
+ const state = useTextarea_unstable(props, ref);
11
+ useTextareaStyles_unstable(state);
12
+ return renderTextarea_unstable(state);
13
+ });
14
+ Textarea.displayName = 'Textarea';
15
+ //# sourceMappingURL=Textarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Textarea/Textarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,uBAAT,QAAwC,kBAAxC;AACA,SAAS,oBAAT,QAAqC,eAArC;AACA,SAAS,0BAAT,QAA2C,qBAA3C;AAIA;;AAEG;;AACH,OAAO,MAAM,QAAQ,gBAAuC,KAAK,CAAC,UAAN,CAAiB,CAAC,KAAD,EAAQ,GAAR,KAAe;AAC1F,QAAM,KAAK,GAAG,oBAAoB,CAAC,KAAD,EAAQ,GAAR,CAAlC;AAEA,EAAA,0BAA0B,CAAC,KAAD,CAA1B;AACA,SAAO,uBAAuB,CAAC,KAAD,CAA9B;AACD,CAL2D,CAArD;AAOP,QAAQ,CAAC,WAAT,GAAuB,UAAvB","sourcesContent":["import * as React from 'react';\nimport { renderTextarea_unstable } from './renderTextarea';\nimport { useTextarea_unstable } from './useTextarea';\nimport { useTextareaStyles_unstable } from './useTextareaStyles';\nimport type { ForwardRefComponent } from '@fluentui/react-utilities';\nimport type { TextareaProps } from './Textarea.types';\n\n/**\n * The Textarea component allows the user to enter and edit text in multiple lines.\n */\nexport const Textarea: ForwardRefComponent<TextareaProps> = React.forwardRef((props, ref) => {\n const state = useTextarea_unstable(props, ref);\n\n useTextareaStyles_unstable(state);\n return renderTextarea_unstable(state);\n});\n\nTextarea.displayName = 'Textarea';\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,63 @@
1
+ import * as React from 'react';
2
+ import type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';
3
+ export declare type TextareaSlots = {
4
+ /**
5
+ * Wrapper element used for displaying the borders for Textarea. This wrapper is needed due to the focus
6
+ * indicator border animation. For more information, see Spec.md
7
+ *
8
+ * The root only receives `className` and `style`. All other props are applied to the `textarea` slot.
9
+ */
10
+ root: NonNullable<Slot<'span'>>;
11
+ /**
12
+ * The `<textarea>` element. This is the primary slot, all native props and ref are applied to this slot.
13
+ */
14
+ textarea: NonNullable<Slot<'textarea'>>;
15
+ };
16
+ declare type TextareaCommons = {
17
+ /**
18
+ * Which direction the Textarea is allowed to be resized.
19
+ *
20
+ * @default none
21
+ */
22
+ resize: 'none' | 'horizontal' | 'vertical' | 'both';
23
+ /**
24
+ * Size of the Textarea.
25
+ *
26
+ * @default medium
27
+ */
28
+ size: 'small' | 'medium' | 'large';
29
+ /**
30
+ * Styling the Textarea should use.
31
+ *
32
+ * @default outline
33
+ */
34
+ appearance: 'outline' | 'filledDarker' | 'filledLighter';
35
+ };
36
+ /**
37
+ * Textarea Props
38
+ */
39
+ export declare type TextareaProps = Omit<ComponentProps<Partial<TextareaSlots>, 'textarea'>, 'value' | 'defaultValue' | 'onChange' | 'size'> & Partial<TextareaCommons> & {
40
+ /**
41
+ * The value of the Textarea.
42
+ */
43
+ value?: string;
44
+ /**
45
+ * The default value of the Textarea.
46
+ */
47
+ defaultValue?: string;
48
+ /**
49
+ * Callback for when the user changes the value.
50
+ */
51
+ onChange?: (ev: React.ChangeEvent<HTMLTextAreaElement>, data: TextareaOnChangeData) => void;
52
+ };
53
+ /**
54
+ * State used in rendering Textarea
55
+ */
56
+ export declare type TextareaState = ComponentState<TextareaSlots> & TextareaCommons;
57
+ /**
58
+ * Data passed to the `onChange` callback when the textarea's value changes.
59
+ */
60
+ declare type TextareaOnChangeData = {
61
+ value: string;
62
+ };
63
+ export {};
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=Textarea.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Textarea.types.js","sourceRoot":"../src/","sources":["components/Textarea/Textarea.types.ts"],"names":[],"mappings":"","sourcesContent":["import * as React from 'react';\nimport type { ComponentProps, ComponentState, Slot } from '@fluentui/react-utilities';\n\nexport type TextareaSlots = {\n /**\n * Wrapper element used for displaying the borders for Textarea. This wrapper is needed due to the focus\n * indicator border animation. For more information, see Spec.md\n *\n * The root only receives `className` and `style`. All other props are applied to the `textarea` slot.\n */\n root: NonNullable<Slot<'span'>>;\n\n /**\n * The `<textarea>` element. This is the primary slot, all native props and ref are applied to this slot.\n */\n textarea: NonNullable<Slot<'textarea'>>;\n};\n\ntype TextareaCommons = {\n /**\n * Which direction the Textarea is allowed to be resized.\n *\n * @default none\n */\n resize: 'none' | 'horizontal' | 'vertical' | 'both';\n\n /**\n * Size of the Textarea.\n *\n * @default medium\n */\n size: 'small' | 'medium' | 'large';\n\n /**\n * Styling the Textarea should use.\n *\n * @default outline\n */\n appearance: 'outline' | 'filledDarker' | 'filledLighter';\n};\n\n/**\n * Textarea Props\n */\nexport type TextareaProps = Omit<\n ComponentProps<Partial<TextareaSlots>, 'textarea'>,\n 'value' | 'defaultValue' | 'onChange' | 'size'\n> &\n Partial<TextareaCommons> & {\n /**\n * The value of the Textarea.\n */\n value?: string;\n\n /**\n * The default value of the Textarea.\n */\n defaultValue?: string;\n\n /**\n * Callback for when the user changes the value.\n */\n onChange?: (ev: React.ChangeEvent<HTMLTextAreaElement>, data: TextareaOnChangeData) => void;\n };\n\n/**\n * State used in rendering Textarea\n */\nexport type TextareaState = ComponentState<TextareaSlots> & TextareaCommons;\n\n/**\n * Data passed to the `onChange` callback when the textarea's value changes.\n */\ntype TextareaOnChangeData = {\n value: string;\n};\n"]}
@@ -0,0 +1,5 @@
1
+ export * from './Textarea';
2
+ export * from './Textarea.types';
3
+ export * from './renderTextarea';
4
+ export * from './useTextarea';
5
+ export * from './useTextareaStyles';
@@ -0,0 +1,6 @@
1
+ export * from './Textarea';
2
+ export * from './Textarea.types';
3
+ export * from './renderTextarea';
4
+ export * from './useTextarea';
5
+ export * from './useTextareaStyles';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"../src/","sources":["components/Textarea/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC","sourcesContent":["export * from './Textarea';\nexport * from './Textarea.types';\nexport * from './renderTextarea';\nexport * from './useTextarea';\nexport * from './useTextareaStyles';\n"]}
@@ -0,0 +1,5 @@
1
+ import type { TextareaState } from './Textarea.types';
2
+ /**
3
+ * Render the final JSX of Textarea
4
+ */
5
+ export declare const renderTextarea_unstable: (state: TextareaState) => JSX.Element;
@@ -0,0 +1,16 @@
1
+ import * as React from 'react';
2
+ import { getSlots } from '@fluentui/react-utilities';
3
+ /**
4
+ * Render the final JSX of Textarea
5
+ */
6
+
7
+ export const renderTextarea_unstable = state => {
8
+ const {
9
+ slots,
10
+ slotProps
11
+ } = getSlots(state);
12
+ return /*#__PURE__*/React.createElement(slots.root, { ...slotProps.root
13
+ }, /*#__PURE__*/React.createElement(slots.textarea, { ...slotProps.textarea
14
+ }));
15
+ };
16
+ //# sourceMappingURL=renderTextarea.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["components/Textarea/renderTextarea.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAZ,MAAuB,OAAvB;AACA,SAAS,QAAT,QAAyB,2BAAzB;AAGA;;AAEG;;AACH,OAAO,MAAM,uBAAuB,GAAI,KAAD,IAAyB;AAC9D,QAAM;AAAE,IAAA,KAAF;AAAS,IAAA;AAAT,MAAuB,QAAQ,CAAgB,KAAhB,CAArC;AAEA,sBACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,IAAP,EAAW,EAAA,GAAK,SAAS,CAAC;AAAf,GAAX,eACE,KAAA,CAAA,aAAA,CAAC,KAAK,CAAC,QAAP,EAAe,EAAA,GAAK,SAAS,CAAC;AAAf,GAAf,CADF,CADF;AAKD,CARM","sourcesContent":["import * as React from 'react';\nimport { getSlots } from '@fluentui/react-utilities';\nimport type { TextareaState, TextareaSlots } from './Textarea.types';\n\n/**\n * Render the final JSX of Textarea\n */\nexport const renderTextarea_unstable = (state: TextareaState) => {\n const { slots, slotProps } = getSlots<TextareaSlots>(state);\n\n return (\n <slots.root {...slotProps.root}>\n <slots.textarea {...slotProps.textarea} />\n </slots.root>\n );\n};\n"],"sourceRoot":"../src/"}
@@ -0,0 +1,12 @@
1
+ import * as React from 'react';
2
+ import type { TextareaProps, TextareaState } from './Textarea.types';
3
+ /**
4
+ * Create the state required to render Textarea.
5
+ *
6
+ * The returned state can be modified with hooks such as useTextareaStyles_unstable,
7
+ * before being passed to renderTextarea_unstable.
8
+ *
9
+ * @param props - props from this instance of Textarea
10
+ * @param ref - reference to root HTMLElement of Textarea
11
+ */
12
+ export declare const useTextarea_unstable: (props: TextareaProps, ref: React.Ref<HTMLTextAreaElement>) => TextareaState;