@@ -19,15 +19,17 @@ import * as React from "react";
19
19
import {
20
20
AnchorButton ,
21
21
ControlGroup ,
22
+ FormGroup ,
22
23
H5 ,
24
+ HTMLSelect ,
23
25
Intent ,
24
26
type Size ,
25
27
Switch ,
26
28
TextArea ,
27
29
type TextAreaProps ,
28
30
Tooltip ,
29
31
} from "@blueprintjs/core" ;
30
- import { Example , type ExampleProps , handleBooleanChange } from "@blueprintjs/docs-theme" ;
32
+ import { Example , type ExampleProps , handleBooleanChange , handleValueChange } from "@blueprintjs/docs-theme" ;
31
33
32
34
import { PropCodeTooltip } from "../../common/propCodeTooltip" ;
33
35
@@ -44,6 +46,7 @@ export const TextAreaExample: React.FC<ExampleProps> = props => {
44
46
const [ disabled , setDisabled ] = React . useState ( false ) ;
45
47
const [ intent , setIntent ] = React . useState < Intent > ( Intent . NONE ) ;
46
48
const [ readOnly , setReadOnly ] = React . useState ( false ) ;
49
+ const [ resize , setResize ] = React . useState < undefined | "none" | "vertical" | "horizontal" | "both" > ( undefined ) ;
47
50
const [ size , setSize ] = React . useState < Size > ( "medium" ) ;
48
51
const [ value , setValue ] = React . useState ( INTITIAL_CONTROLLED_TEXT ) ;
49
52
@@ -74,6 +77,7 @@ export const TextAreaExample: React.FC<ExampleProps> = props => {
74
77
< AnchorButton disabled = { ! controlled } icon = "reset" onClick = { resetControlledText } />
75
78
</ Tooltip >
76
79
</ ControlGroup >
80
+ < ResizeSelect label = "Resize" onChange = { setResize } value = { resize } />
77
81
</ >
78
82
) ;
79
83
@@ -82,6 +86,7 @@ export const TextAreaExample: React.FC<ExampleProps> = props => {
82
86
disabled,
83
87
intent,
84
88
readOnly,
89
+ resize,
85
90
size,
86
91
} ;
87
92
@@ -96,3 +101,28 @@ export const TextAreaExample: React.FC<ExampleProps> = props => {
96
101
</ Example >
97
102
) ;
98
103
} ;
104
+
105
+ const RESIZE_OPTIONS : Array < { label : string ; value : TextAreaProps [ "resize" ] } > = [
106
+ { label : "Default" , value : undefined } ,
107
+ { label : "None" , value : "none" } ,
108
+ { label : "Vertical" , value : "vertical" } ,
109
+ { label : "Horizontal" , value : "horizontal" } ,
110
+ { label : "Both" , value : "both" } ,
111
+ ] ;
112
+
113
+ export interface ResizeSelectProps {
114
+ label ?: React . ReactNode ;
115
+ onChange : ( resize : TextAreaProps [ "resize" ] ) => void ;
116
+ value : TextAreaProps [ "resize" ] ;
117
+ }
118
+
119
+ function ResizeSelect ( { label, onChange, value } : ResizeSelectProps ) {
120
+ const handleChange = handleValueChange ( onChange ) ;
121
+ return (
122
+ < FormGroup label = { label } >
123
+ < ControlGroup >
124
+ < HTMLSelect value = { value } onChange = { handleChange } options = { RESIZE_OPTIONS } fill = { true } />
125
+ </ ControlGroup >
126
+ </ FormGroup >
127
+ ) ;
128
+ }
0 commit comments