@instructure/ui-position 8.11.2-snapshot.53 → 8.11.2-snapshot.67
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/package.json +17 -17
- package/src/Position/README.md +80 -88
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-position",
|
|
3
|
-
"version": "8.11.2-snapshot.
|
|
3
|
+
"version": "8.11.2-snapshot.67+e6665c159",
|
|
4
4
|
"description": "A component for positioning content with respect to a designated target.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -25,24 +25,24 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/runtime": "^7.13.10",
|
|
28
|
-
"@instructure/debounce": "8.11.2-snapshot.
|
|
29
|
-
"@instructure/emotion": "8.11.2-snapshot.
|
|
30
|
-
"@instructure/shared-types": "8.11.2-snapshot.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.11.2-snapshot.
|
|
32
|
-
"@instructure/ui-portal": "8.11.2-snapshot.
|
|
33
|
-
"@instructure/ui-prop-types": "8.11.2-snapshot.
|
|
34
|
-
"@instructure/ui-react-utils": "8.11.2-snapshot.
|
|
35
|
-
"@instructure/ui-testable": "8.11.2-snapshot.
|
|
36
|
-
"@instructure/ui-utils": "8.11.2-snapshot.
|
|
37
|
-
"@instructure/uid": "8.11.2-snapshot.
|
|
28
|
+
"@instructure/debounce": "8.11.2-snapshot.67+e6665c159",
|
|
29
|
+
"@instructure/emotion": "8.11.2-snapshot.67+e6665c159",
|
|
30
|
+
"@instructure/shared-types": "8.11.2-snapshot.67+e6665c159",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.11.2-snapshot.67+e6665c159",
|
|
32
|
+
"@instructure/ui-portal": "8.11.2-snapshot.67+e6665c159",
|
|
33
|
+
"@instructure/ui-prop-types": "8.11.2-snapshot.67+e6665c159",
|
|
34
|
+
"@instructure/ui-react-utils": "8.11.2-snapshot.67+e6665c159",
|
|
35
|
+
"@instructure/ui-testable": "8.11.2-snapshot.67+e6665c159",
|
|
36
|
+
"@instructure/ui-utils": "8.11.2-snapshot.67+e6665c159",
|
|
37
|
+
"@instructure/uid": "8.11.2-snapshot.67+e6665c159",
|
|
38
38
|
"prop-types": "^15"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@instructure/ui-babel-preset": "8.11.2-snapshot.
|
|
42
|
-
"@instructure/ui-color-utils": "8.11.2-snapshot.
|
|
43
|
-
"@instructure/ui-test-locator": "8.11.2-snapshot.
|
|
44
|
-
"@instructure/ui-test-utils": "8.11.2-snapshot.
|
|
45
|
-
"@instructure/ui-themes": "8.11.2-snapshot.
|
|
41
|
+
"@instructure/ui-babel-preset": "8.11.2-snapshot.67+e6665c159",
|
|
42
|
+
"@instructure/ui-color-utils": "8.11.2-snapshot.67+e6665c159",
|
|
43
|
+
"@instructure/ui-test-locator": "8.11.2-snapshot.67+e6665c159",
|
|
44
|
+
"@instructure/ui-test-utils": "8.11.2-snapshot.67+e6665c159",
|
|
45
|
+
"@instructure/ui-themes": "8.11.2-snapshot.67+e6665c159"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8 <=17"
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"access": "public"
|
|
52
52
|
},
|
|
53
53
|
"sideEffects": false,
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "e6665c159832d0020d7da263be0e959c41589135"
|
|
55
55
|
}
|
package/src/Position/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Codemods are available to automatically update any props that have changed. Howe
|
|
|
13
13
|
### Internationalization
|
|
14
14
|
|
|
15
15
|
`Position` placement can be internationalized for right to left languages. The
|
|
16
|
-
following examples are configured utilizing the [
|
|
16
|
+
following examples are configured utilizing the [TextDirectionContext](#TextDirectionContext)
|
|
17
17
|
component in conjunction with the [mirrorHorizontalPlacement](#mirrorPlacement)
|
|
18
18
|
utility function.
|
|
19
19
|
|
|
@@ -24,9 +24,11 @@ example: true
|
|
|
24
24
|
---
|
|
25
25
|
const fpo = lorem.sentence()
|
|
26
26
|
class Example extends React.Component {
|
|
27
|
+
|
|
28
|
+
static contextType = TextDirectionContext
|
|
29
|
+
|
|
27
30
|
constructor (props) {
|
|
28
31
|
super(props)
|
|
29
|
-
|
|
30
32
|
this.state = { placement: 'end', adjusted: 'end' }
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -51,11 +53,8 @@ handleButtonClick = () => {
|
|
|
51
53
|
'center end',
|
|
52
54
|
'center start'
|
|
53
55
|
]
|
|
54
|
-
|
|
55
56
|
let { placement } = this.state
|
|
56
|
-
|
|
57
57
|
placement = placements[placements.indexOf(placement) + 1] || placements[0]
|
|
58
|
-
|
|
59
58
|
this.setState({ placement })
|
|
60
59
|
};
|
|
61
60
|
|
|
@@ -76,7 +75,7 @@ render () {
|
|
|
76
75
|
} else {
|
|
77
76
|
offset.x = 16
|
|
78
77
|
}
|
|
79
|
-
|
|
78
|
+
const rtl = this.context === 'rtl'
|
|
80
79
|
return (
|
|
81
80
|
<View
|
|
82
81
|
as="div"
|
|
@@ -84,30 +83,25 @@ render () {
|
|
|
84
83
|
padding="x-large"
|
|
85
84
|
textAlign="center"
|
|
86
85
|
>
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
86
|
+
<Position
|
|
87
|
+
placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
|
|
88
|
+
offsetX={offset.x}
|
|
89
|
+
offsetY={offset.y}
|
|
90
|
+
onPositionChanged={this.handlePositionChanged}
|
|
91
|
+
renderTarget={
|
|
92
|
+
<Button color="primary" onClick={this.handleButtonClick}>
|
|
93
|
+
Change Placement
|
|
94
|
+
</Button>
|
|
95
|
+
}
|
|
96
|
+
>
|
|
97
|
+
<ContextView
|
|
98
|
+
placement={rtl ? mirrorHorizontalPlacement(adjusted, ' ') : adjusted}
|
|
99
|
+
maxWidth="22rem" padding="small"
|
|
99
100
|
>
|
|
100
|
-
<
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
<Heading level="h3">{placement}</Heading>
|
|
105
|
-
<p>{fpo}</p>
|
|
106
|
-
</ContextView>
|
|
107
|
-
</Position>
|
|
108
|
-
)
|
|
109
|
-
}
|
|
110
|
-
</ApplyTextDirection>
|
|
101
|
+
<Heading level="h3">{placement}</Heading>
|
|
102
|
+
<p>{fpo}</p>
|
|
103
|
+
</ContextView>
|
|
104
|
+
</Position>
|
|
111
105
|
</View>
|
|
112
106
|
)
|
|
113
107
|
}
|
|
@@ -126,6 +120,9 @@ example: true
|
|
|
126
120
|
|
|
127
121
|
const fpo = lorem.sentence()
|
|
128
122
|
class Example extends React.Component {
|
|
123
|
+
|
|
124
|
+
static contextType = TextDirectionContext
|
|
125
|
+
|
|
129
126
|
constructor (props) {
|
|
130
127
|
super(props)
|
|
131
128
|
|
|
@@ -179,6 +176,7 @@ class Example extends React.Component {
|
|
|
179
176
|
} else {
|
|
180
177
|
offsetX = 16
|
|
181
178
|
}
|
|
179
|
+
const rtl = this.context === 'rtl'
|
|
182
180
|
|
|
183
181
|
return (
|
|
184
182
|
<span>
|
|
@@ -188,33 +186,29 @@ class Example extends React.Component {
|
|
|
188
186
|
padding="x-large"
|
|
189
187
|
textAlign="center"
|
|
190
188
|
>
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
189
|
+
<Position
|
|
190
|
+
placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
|
|
191
|
+
offsetX={offsetX}
|
|
192
|
+
offsetY={offsetY}
|
|
193
|
+
mountNode={() => this._mountNode}
|
|
194
|
+
onPositionChanged={this.handlePositionChanged}
|
|
195
|
+
renderTarget={
|
|
196
|
+
<Button color="primary" onClick={this.handleButtonClick}>
|
|
197
|
+
Change Placement
|
|
198
|
+
</Button>
|
|
199
|
+
}
|
|
200
|
+
>
|
|
201
|
+
<ContextView
|
|
202
|
+
placement={rtl ? mirrorHorizontalPlacement(adjusted, ' ') : adjusted}
|
|
203
|
+
maxWidth="20rem"
|
|
204
|
+
padding="small"
|
|
204
205
|
>
|
|
205
|
-
<
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
<p>
|
|
212
|
-
{fpo}
|
|
213
|
-
</p>
|
|
214
|
-
</ContextView>
|
|
215
|
-
</Position>
|
|
216
|
-
)}
|
|
217
|
-
</ApplyTextDirection>
|
|
206
|
+
<Heading level="h3">{placement}</Heading>
|
|
207
|
+
<p>
|
|
208
|
+
{fpo}
|
|
209
|
+
</p>
|
|
210
|
+
</ContextView>
|
|
211
|
+
</Position>
|
|
218
212
|
</View>
|
|
219
213
|
<div
|
|
220
214
|
style={{
|
|
@@ -241,9 +235,11 @@ example: true
|
|
|
241
235
|
const fpo = lorem.paragraphs(7)
|
|
242
236
|
|
|
243
237
|
class Example extends React.Component {
|
|
238
|
+
|
|
239
|
+
static contextType = TextDirectionContext
|
|
240
|
+
|
|
244
241
|
constructor (props) {
|
|
245
242
|
super(props)
|
|
246
|
-
|
|
247
243
|
this.state = {
|
|
248
244
|
placement: 'top stretch'
|
|
249
245
|
}
|
|
@@ -266,41 +262,37 @@ class Example extends React.Component {
|
|
|
266
262
|
|
|
267
263
|
render () {
|
|
268
264
|
const { placement } = this.state
|
|
269
|
-
|
|
265
|
+
const rtl = this.context === 'rtl'
|
|
270
266
|
return (
|
|
271
267
|
<div>
|
|
272
|
-
<
|
|
273
|
-
{(
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
padding: '0.5rem'
|
|
287
|
-
}}
|
|
288
|
-
>
|
|
289
|
-
{fpo}
|
|
290
|
-
</div>
|
|
291
|
-
}
|
|
268
|
+
<Position
|
|
269
|
+
placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
|
|
270
|
+
shouldPositionOverTarget
|
|
271
|
+
insertAt="top"
|
|
272
|
+
mountNode={() => this._mountNode}
|
|
273
|
+
renderTarget={
|
|
274
|
+
<div
|
|
275
|
+
ref={(c) => { this._mountNode = c }}
|
|
276
|
+
style={{
|
|
277
|
+
overflowY: 'auto',
|
|
278
|
+
maxHeight: '10rem',
|
|
279
|
+
marginBottom: '1rem',
|
|
280
|
+
padding: '0.5rem'
|
|
281
|
+
}}
|
|
292
282
|
>
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
283
|
+
{fpo}
|
|
284
|
+
</div>
|
|
285
|
+
}
|
|
286
|
+
>
|
|
287
|
+
<div
|
|
288
|
+
style={{
|
|
289
|
+
backgroundColor: 'white',
|
|
290
|
+
padding: '1rem'
|
|
291
|
+
}}
|
|
292
|
+
>
|
|
293
|
+
<Heading level="h3">{placement}</Heading>
|
|
294
|
+
</div>
|
|
295
|
+
</Position>
|
|
304
296
|
<Button color="primary" onClick={this.handleButtonClick}>
|
|
305
297
|
Change Placement
|
|
306
298
|
</Button>
|