@instructure/ui-text-area 8.13.1-snapshot.9 → 8.14.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.
@@ -1,12 +1,12 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import type { RequestAnimationFrameType } from '@instructure/ui-dom-utils';
4
3
  import { jsx } from '@instructure/emotion';
5
4
  import type { TextAreaProps } from './props';
6
5
  /**
7
6
  ---
8
7
  category: components
9
8
  ---
9
+ @tsProps
10
10
  **/
11
11
  declare class TextArea extends Component<TextAreaProps> {
12
12
  static readonly componentId = "TextArea";
@@ -26,10 +26,10 @@ declare class TextArea extends Component<TextAreaProps> {
26
26
  disabled?: boolean | undefined;
27
27
  readOnly?: boolean | undefined;
28
28
  required?: boolean | undefined;
29
- textareaRef?: ((...args: any[]) => any) | undefined;
29
+ textareaRef?: ((textarea: HTMLTextAreaElement | null) => void) | undefined;
30
30
  defaultValue?: string | undefined;
31
- value?: any;
32
- onChange?: ((...args: any[]) => any) | undefined;
31
+ value?: string | undefined;
32
+ onChange?: ((event: import("react").ChangeEvent<HTMLTextAreaElement>) => void) | undefined;
33
33
  })[];
34
34
  static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
35
35
  label: import("react").ReactNode;
@@ -47,10 +47,10 @@ declare class TextArea extends Component<TextAreaProps> {
47
47
  disabled?: boolean | undefined;
48
48
  readOnly?: boolean | undefined;
49
49
  required?: boolean | undefined;
50
- textareaRef?: ((...args: any[]) => any) | undefined;
50
+ textareaRef?: ((textarea: HTMLTextAreaElement | null) => void) | undefined;
51
51
  defaultValue?: string | undefined;
52
- value?: any;
53
- onChange?: ((...args: any[]) => any) | undefined;
52
+ value?: string | undefined;
53
+ onChange?: ((event: import("react").ChangeEvent<HTMLTextAreaElement>) => void) | undefined;
54
54
  }>;
55
55
  static defaultProps: {
56
56
  size: string;
@@ -60,29 +60,33 @@ declare class TextArea extends Component<TextAreaProps> {
60
60
  messages: never[];
61
61
  disabled: boolean;
62
62
  readOnly: boolean;
63
- textareaRef: (textarea: any) => void;
64
63
  layout: string;
65
64
  required: boolean;
66
65
  };
67
- _listener: {
68
- remove(): void;
69
- } | null;
70
- _request: RequestAnimationFrameType | undefined;
71
- constructor();
66
+ private _listener?;
67
+ private _request?;
68
+ private _defaultId;
69
+ private _textareaResizeListener?;
70
+ private _debounced?;
71
+ private _textarea;
72
+ private _container;
73
+ private _height?;
74
+ private _manuallyResized;
75
+ constructor(props: TextAreaProps);
72
76
  componentDidMount(): void;
73
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
77
+ componentDidUpdate(): void;
74
78
  componentWillUnmount(): void;
75
- _textareaResize: (evt: any) => void;
79
+ _textareaResize: () => void;
76
80
  autoGrow(): void;
77
- grow: (evt: any) => void;
81
+ grow: () => void;
78
82
  focus(): void;
79
- handleChange: (event: any) => void;
80
- handleContainerRef: (node: any) => void;
81
- get minHeight(): any;
83
+ handleChange: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
84
+ handleContainerRef: (node: HTMLDivElement | null) => void;
85
+ get minHeight(): string;
82
86
  get invalid(): boolean | undefined;
83
- get id(): any;
87
+ get id(): string;
84
88
  get focused(): boolean;
85
- get value(): any;
89
+ get value(): string;
86
90
  render(): jsx.JSX.Element;
87
91
  }
88
92
  export default TextArea;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/TextArea/index.tsx"],"names":[],"mappings":"AAwBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAA;AAE1E,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAQrD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAG5C;;;;GAIG;AACH,cAEM,QAAS,SAAQ,SAAS,CAAC,aAAa,CAAC;IAC7C,MAA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AS,CAAC,CAAoB;IACtC,OAAO,CAAC,QAAQ,CAAC,CAA2B;IAC5C,OAAO,CAAC,UAAU,CAAQ;IAC1B,OAAO,CAAC,uBAAuB,CAAC,CAAgB;IAChD,OAAO,CAAC,UAAU,CAAC,CAAW;IAC9B,OAAO,CAAC,SAAS,CAAmC;IACpD,OAAO,CAAC,UAAU,CAA8B;IAChD,OAAO,CAAC,OAAO,CAAC,CAAQ;IACxB,OAAO,CAAC,gBAAgB,CAAQ;gBAEpB,KAAK,EAAE,aAAa;IAMhC,iBAAiB;IAKjB,kBAAkB;IAKlB,oBAAoB;IAkBpB,eAAe,aASd;IAED,QAAQ;IAgCR,IAAI,aA4CH;IAED,KAAK;IAIL,YAAY,UAAW,MAAM,WAAW,CAAC,mBAAmB,CAAC,UAgB5D;IAED,kBAAkB,SAAU,cAAc,GAAG,IAAI,UAEhD;IAED,IAAI,SAAS,WAEZ;IAED,IAAI,OAAO,wBAOV;IAED,IAAI,EAAE,WAEL;IAED,IAAI,OAAO,YAEV;IAED,IAAI,KAAK,WAER;IAED,MAAM;CAuEP;AAED,eAAe,QAAQ,CAAA;AACvB,OAAO,EAAE,QAAQ,EAAE,CAAA"}
@@ -1,31 +1,83 @@
1
+ import React from 'react';
2
+ import type { TextareaHTMLAttributes } from 'react';
1
3
  import type { OtherHTMLAttributes, PropValidators, TextAreaTheme } from '@instructure/shared-types';
2
- import type { FormMessage } from '@instructure/ui-form-field';
4
+ import type { FormMessage, FormFieldOwnProps } from '@instructure/ui-form-field';
3
5
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion';
4
- import { TextareaHTMLAttributes } from 'react';
5
6
  declare type TextAreaOwnProps = {
6
7
  label: React.ReactNode;
7
8
  id?: string;
9
+ /**
10
+ * sets the font-size for the textarea
11
+ */
8
12
  size?: 'small' | 'medium' | 'large';
9
13
  layout?: 'stacked' | 'inline';
14
+ /**
15
+ * the textarea will expand vertically to fit the height of the content,
16
+ * unless its content exceeds `maxHeight`
17
+ */
10
18
  autoGrow?: boolean;
19
+ /**
20
+ * is the textarea resizable (in supported browsers)
21
+ */
11
22
  resize?: 'none' | 'both' | 'horizontal' | 'vertical';
23
+ /**
24
+ * a fixed width for the textarea
25
+ */
12
26
  width?: string;
27
+ /**
28
+ * Initial height for the textarea (if autoGrow is true it will grow vertically)
29
+ * Accepts CSS units, e.g. '55px'
30
+ */
13
31
  height?: string;
32
+ /**
33
+ * when autoGrow is true, the textarea will never grow beyond this value
34
+ */
14
35
  maxHeight?: number | string;
36
+ /**
37
+ * Array of objects with shape: `{
38
+ * text: React.ReactNode,
39
+ * type: One of: ['error', 'hint', 'success', 'screenreader-only']
40
+ * }`
41
+ */
15
42
  messages?: FormMessage[];
16
43
  inline?: boolean;
44
+ /**
45
+ * Html placeholder text to display when the input has no value. This should be hint text, not a label
46
+ * replacement.
47
+ */
17
48
  placeholder?: string;
49
+ /**
50
+ * Whether or not to disable the textarea
51
+ */
18
52
  disabled?: boolean;
53
+ /**
54
+ * Works just like disabled but keeps the same styles as if it were active
55
+ */
19
56
  readOnly?: boolean;
57
+ /**
58
+ * Sets the required property on the underlying native textArea
59
+ */
20
60
  required?: boolean;
21
- textareaRef?: (...args: any[]) => any;
61
+ /**
62
+ * a function that provides a reference to the actual textarea element
63
+ */
64
+ textareaRef?: (textarea: HTMLTextAreaElement | null) => void;
65
+ /**
66
+ * value to set on initial render
67
+ */
22
68
  defaultValue?: string;
23
- value?: any;
24
- onChange?: (...args: any[]) => any;
69
+ /**
70
+ * the selected value (must be accompanied by an `onChange` prop)
71
+ */
72
+ value?: string;
73
+ /**
74
+ * when used with the `value` prop, the component will not control its own state
75
+ */
76
+ onChange?: (event: React.ChangeEvent<HTMLTextAreaElement>) => void;
25
77
  };
26
78
  declare type PropKeys = keyof TextAreaOwnProps;
27
79
  declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
28
- declare type TextAreaProps = TextAreaOwnProps & WithStyleProps<TextAreaTheme, TextAreaStyle> & OtherHTMLAttributes<TextAreaOwnProps, TextareaHTMLAttributes<TextAreaOwnProps>>;
80
+ declare type TextAreaProps = Omit<FormFieldOwnProps, 'label' | 'inline' | 'id' | 'elementRef'> & TextAreaOwnProps & WithStyleProps<TextAreaTheme, TextAreaStyle> & OtherHTMLAttributes<TextAreaOwnProps, TextareaHTMLAttributes<TextAreaOwnProps>>;
29
81
  declare type TextAreaStyle = ComponentStyle<'textArea' | 'textAreaLayout' | 'textAreaOutline'>;
30
82
  declare const propTypes: PropValidators<PropKeys>;
31
83
  declare const allowedProps: AllowedPropKeys;
@@ -1 +1 @@
1
- {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/TextArea/props.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,aAAa,EACd,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAE9C,aAAK,gBAAgB,GAAG;IACtB,KAAK,EAAE,KAAK,CAAC,SAAS,CAAA;IACtB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IACnC,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAA;IACpD,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IAC3B,QAAQ,CAAC,EAAE,WAAW,EAAE,CAAA;IACxB,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,WAAW,CAAC,EAAE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AAM,gBAAgB,CAAA;AAEtC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,aAAa,GAEhB,IAAI,CAAC,iBAAiB,EAAE,OAAO,GAAG,QAAQ,GAAG,IAAI,GAAG,YAAY,CAAC,GAC/D,gBAAgB,GAChB,cAAc,CAAC,aAAa,EAAE,aAAa,CAAC,GAC5C,mBAAmB,CACjB,gBAAgB,EAChB,sBAAsB,CAAC,gBAAgB,CAAC,CACzC,CAAA;AAEL,aAAK,aAAa,GAAG,cAAc,CACjC,UAAU,GAAG,gBAAgB,GAAG,iBAAiB,CAClD,CAAA;AAED,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAoBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAoBnB,CAAA;AAED,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,CAAA;AAC5C,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.