@instructure/ui-position 8.11.2-snapshot.7 → 8.12.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.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,10 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.12.0](https://github.com/instructure/instructure-ui/compare/v8.11.1...v8.12.0) (2021-11-17)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-position
9
+
6
10
  ## [8.11.1](https://github.com/instructure/instructure-ui/compare/v8.11.0...v8.11.1) (2021-10-19)
7
11
 
8
12
  **Note:** Version bump only for package @instructure/ui-position
@@ -0,0 +1 @@
1
+ {"type":"module"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-position",
3
- "version": "8.11.2-snapshot.7+2681e145a",
3
+ "version": "8.12.0",
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.7+2681e145a",
29
- "@instructure/emotion": "8.11.2-snapshot.7+2681e145a",
30
- "@instructure/shared-types": "8.11.2-snapshot.7+2681e145a",
31
- "@instructure/ui-dom-utils": "8.11.2-snapshot.7+2681e145a",
32
- "@instructure/ui-portal": "8.11.2-snapshot.7+2681e145a",
33
- "@instructure/ui-prop-types": "8.11.2-snapshot.7+2681e145a",
34
- "@instructure/ui-react-utils": "8.11.2-snapshot.7+2681e145a",
35
- "@instructure/ui-testable": "8.11.2-snapshot.7+2681e145a",
36
- "@instructure/ui-utils": "8.11.2-snapshot.7+2681e145a",
37
- "@instructure/uid": "8.11.2-snapshot.7+2681e145a",
28
+ "@instructure/debounce": "8.12.0",
29
+ "@instructure/emotion": "8.12.0",
30
+ "@instructure/shared-types": "8.12.0",
31
+ "@instructure/ui-dom-utils": "8.12.0",
32
+ "@instructure/ui-portal": "8.12.0",
33
+ "@instructure/ui-prop-types": "8.12.0",
34
+ "@instructure/ui-react-utils": "8.12.0",
35
+ "@instructure/ui-testable": "8.12.0",
36
+ "@instructure/ui-utils": "8.12.0",
37
+ "@instructure/uid": "8.12.0",
38
38
  "prop-types": "^15"
39
39
  },
40
40
  "devDependencies": {
41
- "@instructure/ui-babel-preset": "8.11.2-snapshot.7+2681e145a",
42
- "@instructure/ui-color-utils": "8.11.2-snapshot.7+2681e145a",
43
- "@instructure/ui-test-locator": "8.11.2-snapshot.7+2681e145a",
44
- "@instructure/ui-test-utils": "8.11.2-snapshot.7+2681e145a",
45
- "@instructure/ui-themes": "8.11.2-snapshot.7+2681e145a"
41
+ "@instructure/ui-babel-preset": "8.12.0",
42
+ "@instructure/ui-color-utils": "8.12.0",
43
+ "@instructure/ui-test-locator": "8.12.0",
44
+ "@instructure/ui-test-utils": "8.12.0",
45
+ "@instructure/ui-themes": "8.12.0"
46
46
  },
47
47
  "peerDependencies": {
48
48
  "react": ">=16.8 <=17"
@@ -50,6 +50,5 @@
50
50
  "publishConfig": {
51
51
  "access": "public"
52
52
  },
53
- "sideEffects": false,
54
- "gitHead": "2681e145ad469e1396536d3e9eed75a19995eb8a"
53
+ "sideEffects": false
55
54
  }
@@ -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 [ApplyTextDirection](#ApplyTextDirection)
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
- <ApplyTextDirection>
88
- {(dir, rtl) => (
89
- <Position
90
- placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
91
- offsetX={offset.x}
92
- offsetY={offset.y}
93
- onPositionChanged={this.handlePositionChanged}
94
- renderTarget={
95
- <Button color="primary" onClick={this.handleButtonClick}>
96
- Change Placement
97
- </Button>
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
- <ContextView
101
- placement={rtl ? mirrorHorizontalPlacement(adjusted, ' ') : adjusted}
102
- maxWidth="22rem" padding="small"
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
- <ApplyTextDirection>
192
- {(dir, rtl) => (
193
- <Position
194
- placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
195
- offsetX={offsetX}
196
- offsetY={offsetY}
197
- mountNode={() => this._mountNode}
198
- onPositionChanged={this.handlePositionChanged}
199
- renderTarget={
200
- <Button color="primary" onClick={this.handleButtonClick}>
201
- Change Placement
202
- </Button>
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
- <ContextView
206
- placement={rtl ? mirrorHorizontalPlacement(adjusted, ' ') : adjusted}
207
- maxWidth="20rem"
208
- padding="small"
209
- >
210
- <Heading level="h3">{placement}</Heading>
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
- <ApplyTextDirection>
273
- {(dir, rtl) => (
274
- <Position
275
- placement={rtl ? mirrorHorizontalPlacement(placement, ' ') : placement}
276
- shouldPositionOverTarget
277
- insertAt="top"
278
- mountNode={() => this._mountNode}
279
- renderTarget={
280
- <div
281
- ref={(c) => { this._mountNode = c }}
282
- style={{
283
- overflowY: 'auto',
284
- maxHeight: '10rem',
285
- marginBottom: '1rem',
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
- <div
294
- style={{
295
- backgroundColor: 'white',
296
- padding: '1rem'
297
- }}
298
- >
299
- <Heading level="h3">{placement}</Heading>
300
- </div>
301
- </Position>
302
- )}
303
- </ApplyTextDirection>
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>
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.