You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,7 +45,7 @@ import {Text} from 'react-aria-components';
45
45
46
46
function Example() {
47
47
let [isFilled, setIsFilled] =React.useState(false);
48
-
48
+
49
49
return (
50
50
<>
51
51
<Draggable />
@@ -57,16 +57,11 @@ function Example() {
57
57
<Upload />
58
58
<Heading>
59
59
<Textslot="label">
60
-
Drag and drop your file
60
+
{isFilled?'You dropped something!':'Drag and drop your file'}
61
61
</Text>
62
62
</Heading>
63
63
</IllustratedMessage>
64
64
</DropZone>
65
-
{isFilled&&
66
-
<divclassName="dropped">
67
-
You dropped something!
68
-
</div>
69
-
}
70
65
</>
71
66
)
72
67
}
@@ -96,7 +91,6 @@ function Draggable() {
96
91
);
97
92
}
98
93
```
99
-
</details>
100
94
101
95
<details>
102
96
<summarystyle={{fontWeight: 'bold'}}><ChevronRightsize="S" /> Show CSS</summary>
@@ -116,18 +110,14 @@ function Draggable() {
116
110
.draggable.dragging {
117
111
opacity: 0.5;
118
112
}
119
-
120
-
.dropped {
121
-
margin-top: 20px;
122
-
}
123
113
```
124
114
</details>
125
-
115
+
</details>
126
116
127
117
128
118
## Content
129
119
130
-
A drop zone accepts an [IllustratedMessage](IllustratedMessage.html) as a child which is comprised of three areas: an illustration, a title, and a body. Each of these sections can be populated by providing the following components to the IllustratedMessage as children: a SVG, a [Heading](Heading.html) (title), and a [Content](Content.html) (body). A [FileTrigger](../react-aria/FileTrigger.html) is commonly paired with a DropZone to allow a user to choose files from their device.
120
+
A DropZone accepts an [IllustratedMessage](IllustratedMessage.html) as a child which is comprised of three areas: an illustration, a title, and a body. Each of these sections can be populated by providing the following components to the IllustratedMessage as children: a SVG, a [Heading](Heading.html) (title), and a [Content](Content.html) (body). A [FileTrigger](../react-aria/FileTrigger.html) is commonly paired with a DropZone to allow a user to choose files from their device.
131
121
132
122
```tsx example
133
123
import {FileTrigger} from'react-aria-components';
@@ -147,7 +137,7 @@ function Example() {
147
137
<Upload />
148
138
<Heading>
149
139
<Textslot="label">
150
-
Drag and drop here
140
+
{isFilled?'You dropped something!':'Drag and drop here'}
151
141
</Text>
152
142
</Heading>
153
143
<Content>
@@ -158,70 +148,67 @@ function Example() {
158
148
</Content>
159
149
</IllustratedMessage>
160
150
</DropZone>
161
-
{isFilled&&
162
-
<divclassName="dropped">
163
-
You dropped something!
164
-
</div>
165
-
}
166
151
</>
167
152
)
168
153
}
169
154
```
170
155
171
156
### Accessibility
172
157
173
-
A visual label should be provided to `DropZone` using a `Text` element with a `label` slot. If it is not provided, then an `aria-label` or `aria-labelledby` prop must be passed to identify the visually hidden button to assistive technology.
158
+
A visual label should be provided to `DropZone` using a `Text` element with a `label` slot. If it is not provided, then an `aria-label` or `aria-labelledby` prop must be passed to identify the visually hidden button to assistive technology.
174
159
175
160
### Internationalization
176
161
177
-
In order to internationalize a drop zone, a localized string should be passed to the `Text` element with a `label` slot or to the `aria-label` prop, in addition to the `replaceMessage` prop.
162
+
In order to internationalize a DropZone, a localized string should be passed to the `Text` element with a `label` slot or to the `aria-label` prop, in addition to the `replaceMessage` prop.
178
163
179
164
## Events
180
165
181
-
`DropZone` supports drop operations via mouse, keyboard, and touch. You can handle all of these via the `onDrop` prop. In addition, the `onDropEnter`, `onDropMove`, and `onDropExit` events are fired as the user enter and exists the dropzone during a drag operation.
166
+
`DropZone` supports drop operations via mouse, keyboard, and touch. You can handle all of these via the `onDrop` prop. In addition, the `onDropEnter`, `onDropMove`, and `onDropExit` events are fired as the user enter and exists the dropzone during a drag operation.
182
167
183
168
The following example uses an `onDrop` handler to update the filled status stored in React state.
The user is responsible for both managing the filled state of a drop zone and handling the associated styling. To set the drop zone to a filled state, the user must pass the `isFilled` prop.
226
+
The user is responsible for both managing the filled state of a DropZone and handling the associated styling. To set the DropZone to a filled state, the user must pass the `isFilled` prop.
240
227
241
228
The example below demonstrates one way of styling the filled state.
242
229
@@ -245,13 +232,12 @@ import {Text} from 'react-aria-components';
245
232
246
233
function Example() {
247
234
let [filledSrc, setFilledSrc] =React.useState(null);
248
-
let [isFilled, setIsFilled] =React.useState(false);
When a drop zone is in a filled state and has an object dragged over it, a message will appear in front of the drop zone. By default, this message will say "Drop file to replace". However, users can choose to customize this message through the `replaceMessage` prop. This message should describe the interaction that will occur when the object is dropped. It should also be internationalized if needed.
325
+
When a DropZone is in a filled state and has an object dragged over it, a message will appear in front of the DropZone. By default, this message will say "Drop file to replace". However, users can choose to customize this message through the `replaceMessage` prop. This message should describe the interaction that will occur when the object is dropped. It should also be internationalized if needed.
339
326
340
327
341
328
```tsx example
@@ -356,80 +343,66 @@ function Example() {
356
343
<Upload />
357
344
<Heading>
358
345
<Textslot="label">
359
-
Drag and drop here
346
+
{isFilled?'You dropped something!':'Drag and drop here'}
360
347
</Text>
361
348
</Heading>
362
349
</IllustratedMessage>
363
350
</DropZone>
364
-
{isFilled&&
365
-
<divclassName="dropped">
366
-
You dropped something!
367
-
</div>
368
-
}
369
351
</>
370
352
);
371
353
}
372
354
```
373
355
374
356
### Visual feedback
375
357
376
-
A drop zone displays visual feedback to the user when a drag hovers over the drop target by passing the `getDropOperation` function. If a drop target only supports data of specific types (e.g. images, videos, text, etc.), then it should implement the `getDropOperation` prop and return `cancel` for types that aren't supported. This will prevent visual feedback indicating that the drop target accepts the dragged data when this is not true. [Read more about getDropOperation.](../react-aria/useDrop.html#getdropoperation)
358
+
A DropZone displays visual feedback to the user when a drag hovers over the drop target by passing the `getDropOperation` function. If a drop target only supports data of specific types (e.g. images, videos, text, etc.), then it should implement the `getDropOperation` prop and return `'cancel'` for types that aren't supported. This will prevent visual feedback indicating that the drop target accepts the dragged data when this is not true. [Read more about getDropOperation.](../react-aria/useDrop.html#getdropoperation)
377
359
378
360
```tsx example
379
361
import {FileTrigger} from'react-aria-components';
380
362
import {Text} from'react-aria-components';
381
363
import {FileDropItem} from'react-aria';
382
364
383
365
function Example() {
384
-
let [isFilled, setIsFilled] =React.useState(false);
385
366
let [filledSrc, setFilledSrc] =React.useState(null);
0 commit comments