@instructure/ui-motion 8.11.2-snapshot.52 → 8.11.2-snapshot.64
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 +12 -12
- package/src/Transition/README.md +44 -47
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-motion",
|
|
3
|
-
"version": "8.11.2-snapshot.
|
|
3
|
+
"version": "8.11.2-snapshot.64+fa07135b5",
|
|
4
4
|
"description": "A UI component library made by Instructure Inc.",
|
|
5
5
|
"author": "Instructure, Inc. Engineering and Product Design",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -24,19 +24,19 @@
|
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"@instructure/ui-babel-preset": "8.11.2-snapshot.
|
|
28
|
-
"@instructure/ui-test-locator": "8.11.2-snapshot.
|
|
29
|
-
"@instructure/ui-test-utils": "8.11.2-snapshot.
|
|
30
|
-
"@instructure/ui-themes": "8.11.2-snapshot.
|
|
27
|
+
"@instructure/ui-babel-preset": "8.11.2-snapshot.64+fa07135b5",
|
|
28
|
+
"@instructure/ui-test-locator": "8.11.2-snapshot.64+fa07135b5",
|
|
29
|
+
"@instructure/ui-test-utils": "8.11.2-snapshot.64+fa07135b5",
|
|
30
|
+
"@instructure/ui-themes": "8.11.2-snapshot.64+fa07135b5"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.13.10",
|
|
34
|
-
"@instructure/emotion": "8.11.2-snapshot.
|
|
35
|
-
"@instructure/shared-types": "8.11.2-snapshot.
|
|
36
|
-
"@instructure/ui-dom-utils": "8.11.2-snapshot.
|
|
37
|
-
"@instructure/ui-react-utils": "8.11.2-snapshot.
|
|
38
|
-
"@instructure/ui-testable": "8.11.2-snapshot.
|
|
39
|
-
"@instructure/ui-utils": "8.11.2-snapshot.
|
|
34
|
+
"@instructure/emotion": "8.11.2-snapshot.64+fa07135b5",
|
|
35
|
+
"@instructure/shared-types": "8.11.2-snapshot.64+fa07135b5",
|
|
36
|
+
"@instructure/ui-dom-utils": "8.11.2-snapshot.64+fa07135b5",
|
|
37
|
+
"@instructure/ui-react-utils": "8.11.2-snapshot.64+fa07135b5",
|
|
38
|
+
"@instructure/ui-testable": "8.11.2-snapshot.64+fa07135b5",
|
|
39
|
+
"@instructure/ui-utils": "8.11.2-snapshot.64+fa07135b5",
|
|
40
40
|
"prop-types": "^15"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"sideEffects": false,
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "fa07135b5601d3268295e5747f5950721a574d4f"
|
|
50
50
|
}
|
package/src/Transition/README.md
CHANGED
|
@@ -98,7 +98,7 @@ render(<Example />)
|
|
|
98
98
|
|
|
99
99
|
`slide` transitions the horizontal or vertical position of the element. The slide direction can be
|
|
100
100
|
internationalized for right to left (rtl) languages. The following example uses the
|
|
101
|
-
[
|
|
101
|
+
[TextDirectionContext](#TextDirectionContext) util to mirror the slide direction for rtl.
|
|
102
102
|
|
|
103
103
|
```js
|
|
104
104
|
---
|
|
@@ -106,6 +106,9 @@ render: false
|
|
|
106
106
|
example: true
|
|
107
107
|
---
|
|
108
108
|
class Example extends React.Component {
|
|
109
|
+
|
|
110
|
+
static contextType = TextDirectionContext
|
|
111
|
+
|
|
109
112
|
constructor (props) {
|
|
110
113
|
super(props)
|
|
111
114
|
this.state = {
|
|
@@ -136,57 +139,51 @@ class Example extends React.Component {
|
|
|
136
139
|
up: 'up',
|
|
137
140
|
down: 'down'
|
|
138
141
|
}
|
|
139
|
-
|
|
140
142
|
return mirror[direction]
|
|
141
143
|
};
|
|
142
144
|
|
|
143
145
|
render () {
|
|
146
|
+
const rtl = this.context === 'rtl'
|
|
147
|
+
const direction = rtl ? this.mirrorDirection(this.state.direction) : this.state.direction
|
|
148
|
+
const directionVariants = [
|
|
149
|
+
{value: 'left', label: 'Start'},
|
|
150
|
+
{value: 'right', label: 'End'},
|
|
151
|
+
{value: 'down', label: 'Down'},
|
|
152
|
+
{value: 'up', label: 'Up'}
|
|
153
|
+
]
|
|
144
154
|
return (
|
|
145
|
-
<
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
{
|
|
151
|
-
{
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
<Transition
|
|
178
|
-
transitionOnMount
|
|
179
|
-
unmountOnExit
|
|
180
|
-
in={this.state.in}
|
|
181
|
-
type={`slide-${direction}`}
|
|
182
|
-
>
|
|
183
|
-
<Avatar name="Slide" />
|
|
184
|
-
</Transition>
|
|
185
|
-
</div>
|
|
186
|
-
</div>
|
|
187
|
-
)
|
|
188
|
-
}}
|
|
189
|
-
</ApplyTextDirection>
|
|
155
|
+
<div>
|
|
156
|
+
<div>
|
|
157
|
+
<RadioInputGroup
|
|
158
|
+
onChange={this.handleDirectionChange}
|
|
159
|
+
name="slideExample"
|
|
160
|
+
description={<ScreenReaderContent>Select a direction</ScreenReaderContent>}
|
|
161
|
+
value={direction}
|
|
162
|
+
variant="toggle"
|
|
163
|
+
>
|
|
164
|
+
{directionVariants.map(dir => <RadioInput key={dir.value} value={dir.value} label={dir.label} />)}
|
|
165
|
+
</RadioInputGroup>
|
|
166
|
+
<Button size="small" margin="medium none small" onClick={this.handleButtonClick}>
|
|
167
|
+
Slide {this.state.in ? 'Out' : 'In'}
|
|
168
|
+
</Button>
|
|
169
|
+
</div>
|
|
170
|
+
<div style={{
|
|
171
|
+
position: 'relative',
|
|
172
|
+
overflow: 'hidden',
|
|
173
|
+
height: '15rem',
|
|
174
|
+
display: 'flex',
|
|
175
|
+
justifyContent: (this.state.direction === 'right') ? 'flex-end' : 'flex-start'
|
|
176
|
+
}}>
|
|
177
|
+
<Transition
|
|
178
|
+
transitionOnMount
|
|
179
|
+
unmountOnExit
|
|
180
|
+
in={this.state.in}
|
|
181
|
+
type={`slide-${direction}`}
|
|
182
|
+
>
|
|
183
|
+
<Avatar name="Slide" />
|
|
184
|
+
</Transition>
|
|
185
|
+
</div>
|
|
186
|
+
</div>
|
|
190
187
|
)
|
|
191
188
|
}
|
|
192
189
|
}
|