@carbon/motion 10.12.0 → 10.14.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/README.md +0 -6
- package/es/index.js +8 -1
- package/index.scss +56 -0
- package/lib/index.js +14 -0
- package/package.json +4 -4
- package/scss/motion.scss +24 -0
- package/src/index.js +16 -0
- package/umd/index.js +14 -0
- package/docs/sass.md +0 -110
package/README.md
CHANGED
|
@@ -69,12 +69,6 @@ import { easings, motion } from '@carbon/motion';
|
|
|
69
69
|
motion('standard', 'productive'); // Returns a string `cubic-bezier()` function
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
## 📖 API Documentation
|
|
73
|
-
|
|
74
|
-
If you're looking for `@carbon/motion` API documentation, check out:
|
|
75
|
-
|
|
76
|
-
- [Sass](./docs/sass.md)
|
|
77
|
-
|
|
78
72
|
## 🙌 Contributing
|
|
79
73
|
|
|
80
74
|
We're always looking for contributors to help us fix bugs, build new features,
|
package/es/index.js
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
var fast01 = '70ms';
|
|
8
|
+
var fast02 = '110ms';
|
|
9
|
+
var moderate01 = '150ms';
|
|
10
|
+
var moderate02 = '240ms';
|
|
11
|
+
var slow01 = '400ms';
|
|
12
|
+
var slow02 = '700ms';
|
|
13
|
+
var unstable_tokens = ['fast01', 'fast02', 'moderate01', 'moderate02', 'slow01', 'slow02'];
|
|
7
14
|
var easings = {
|
|
8
15
|
standard: {
|
|
9
16
|
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
|
|
@@ -32,4 +39,4 @@ function motion(name, mode) {
|
|
|
32
39
|
return easing[mode];
|
|
33
40
|
}
|
|
34
41
|
|
|
35
|
-
export { easings, motion };
|
|
42
|
+
export { easings, fast01, fast02, moderate01, moderate02, motion, slow01, slow02, unstable_tokens };
|
package/index.scss
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright IBM Corp. 2018, 2018
|
|
3
|
+
//
|
|
4
|
+
// This source code is licensed under the Apache-2.0 license found in the
|
|
5
|
+
// LICENSE file in the root directory of this source tree.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
@use 'sass:map';
|
|
9
|
+
|
|
10
|
+
/// Common component easings
|
|
11
|
+
/// @type Map
|
|
12
|
+
/// @access public
|
|
13
|
+
/// @group @carbon/motion
|
|
14
|
+
$easings: (
|
|
15
|
+
standard: (
|
|
16
|
+
productive: cubic-bezier(0.2, 0, 0.38, 0.9),
|
|
17
|
+
expressive: cubic-bezier(0.4, 0.14, 0.3, 1),
|
|
18
|
+
),
|
|
19
|
+
entrance: (
|
|
20
|
+
productive: cubic-bezier(0, 0, 0.38, 0.9),
|
|
21
|
+
expressive: cubic-bezier(0, 0, 0.3, 1),
|
|
22
|
+
),
|
|
23
|
+
exit: (
|
|
24
|
+
productive: cubic-bezier(0.2, 0, 1, 0.9),
|
|
25
|
+
expressive: cubic-bezier(0.4, 0.14, 1, 1),
|
|
26
|
+
),
|
|
27
|
+
);
|
|
28
|
+
|
|
29
|
+
/// Get the transition-timing-function for a given easing and motion mode
|
|
30
|
+
/// @param {String} $name - Can be `standard`, `entrance`, or `exit`
|
|
31
|
+
/// @param {String} $mode [productive] - Can be `productive` or `expressive`
|
|
32
|
+
/// @param {Map} $easings [$carbon--easings] - Easings map
|
|
33
|
+
/// @access public
|
|
34
|
+
/// @group @carbon/motion
|
|
35
|
+
/// @return {Function} CSS `cubic-bezier()` function
|
|
36
|
+
@function motion($name, $mode: productive, $easings: $easings) {
|
|
37
|
+
@if map.has-key($easings, $name) {
|
|
38
|
+
$easing: map.get($easings, $name);
|
|
39
|
+
@if map.has-key($easing, $mode) {
|
|
40
|
+
@return map.get($easing, $mode);
|
|
41
|
+
} @else {
|
|
42
|
+
@error 'Unable to find a mode for the easing #{$easing} called: #{$mode}.';
|
|
43
|
+
}
|
|
44
|
+
} @else {
|
|
45
|
+
@error 'Unable to find an easing named #{$name} in our supported easings.';
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/// Set the transition-timing-function for a given easing and motion mode
|
|
50
|
+
/// @param {String} $name - The name of the easing curve to apply
|
|
51
|
+
/// @param {String} $mode - The mode for the easing curve to use
|
|
52
|
+
/// @access public
|
|
53
|
+
/// @group @carbon/motion
|
|
54
|
+
@mixin motion($name, $mode) {
|
|
55
|
+
transition-timing-function: motion($name, $mode);
|
|
56
|
+
}
|
package/lib/index.js
CHANGED
|
@@ -8,6 +8,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
8
8
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
9
9
|
* LICENSE file in the root directory of this source tree.
|
|
10
10
|
*/
|
|
11
|
+
var fast01 = '70ms';
|
|
12
|
+
var fast02 = '110ms';
|
|
13
|
+
var moderate01 = '150ms';
|
|
14
|
+
var moderate02 = '240ms';
|
|
15
|
+
var slow01 = '400ms';
|
|
16
|
+
var slow02 = '700ms';
|
|
17
|
+
var unstable_tokens = ['fast01', 'fast02', 'moderate01', 'moderate02', 'slow01', 'slow02'];
|
|
11
18
|
var easings = {
|
|
12
19
|
standard: {
|
|
13
20
|
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
|
|
@@ -37,4 +44,11 @@ function motion(name, mode) {
|
|
|
37
44
|
}
|
|
38
45
|
|
|
39
46
|
exports.easings = easings;
|
|
47
|
+
exports.fast01 = fast01;
|
|
48
|
+
exports.fast02 = fast02;
|
|
49
|
+
exports.moderate01 = moderate01;
|
|
50
|
+
exports.moderate02 = moderate02;
|
|
40
51
|
exports.motion = motion;
|
|
52
|
+
exports.slow01 = slow01;
|
|
53
|
+
exports.slow02 = slow02;
|
|
54
|
+
exports.unstable_tokens = unstable_tokens;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@carbon/motion",
|
|
3
3
|
"description": "Motion helpers for digital and software products using the Carbon Design System",
|
|
4
|
-
"version": "10.
|
|
4
|
+
"version": "10.14.0",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"module": "es/index.js",
|
|
@@ -25,11 +25,11 @@
|
|
|
25
25
|
"access": "public"
|
|
26
26
|
},
|
|
27
27
|
"scripts": {
|
|
28
|
-
"build": "yarn clean && carbon-cli bundle src/index.js --name CarbonMotion
|
|
28
|
+
"build": "yarn clean && carbon-cli bundle src/index.js --name CarbonMotion",
|
|
29
29
|
"clean": "rimraf es lib umd"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@carbon/cli": "^10.
|
|
32
|
+
"@carbon/cli": "^10.20.0",
|
|
33
33
|
"rimraf": "^3.0.0"
|
|
34
34
|
},
|
|
35
35
|
"eyeglass": {
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"sassDir": "scss",
|
|
39
39
|
"needs": "^1.3.0"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "f4f5ac5a33f77b799d9e4533287db8912e40cd1b"
|
|
42
42
|
}
|
package/scss/motion.scss
CHANGED
|
@@ -5,6 +5,30 @@
|
|
|
5
5
|
// LICENSE file in the root directory of this source tree.
|
|
6
6
|
//
|
|
7
7
|
|
|
8
|
+
/// @access public
|
|
9
|
+
/// @group @carbon/motion
|
|
10
|
+
$fast-01: 70ms !default;
|
|
11
|
+
|
|
12
|
+
/// @access public
|
|
13
|
+
/// @group @carbon/motion
|
|
14
|
+
$fast-02: 110ms !default;
|
|
15
|
+
|
|
16
|
+
/// @access public
|
|
17
|
+
/// @group @carbon/motion
|
|
18
|
+
$moderate-01: 150ms !default;
|
|
19
|
+
|
|
20
|
+
/// @access public
|
|
21
|
+
/// @group @carbon/motion
|
|
22
|
+
$moderate-02: 240ms !default;
|
|
23
|
+
|
|
24
|
+
/// @access public
|
|
25
|
+
/// @group @carbon/motion
|
|
26
|
+
$slow-01: 400ms !default;
|
|
27
|
+
|
|
28
|
+
/// @access public
|
|
29
|
+
/// @group @carbon/motion
|
|
30
|
+
$slow-02: 700ms !default;
|
|
31
|
+
|
|
8
32
|
/// Common component easings
|
|
9
33
|
/// @type Map
|
|
10
34
|
/// @access public
|
package/src/index.js
CHANGED
|
@@ -5,6 +5,22 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
export const fast01 = '70ms';
|
|
9
|
+
export const fast02 = '110ms';
|
|
10
|
+
export const moderate01 = '150ms';
|
|
11
|
+
export const moderate02 = '240ms';
|
|
12
|
+
export const slow01 = '400ms';
|
|
13
|
+
export const slow02 = '700ms';
|
|
14
|
+
|
|
15
|
+
export const unstable_tokens = [
|
|
16
|
+
'fast01',
|
|
17
|
+
'fast02',
|
|
18
|
+
'moderate01',
|
|
19
|
+
'moderate02',
|
|
20
|
+
'slow01',
|
|
21
|
+
'slow02',
|
|
22
|
+
];
|
|
23
|
+
|
|
8
24
|
export const easings = {
|
|
9
25
|
standard: {
|
|
10
26
|
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
|
package/umd/index.js
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
* This source code is licensed under the Apache-2.0 license found in the
|
|
11
11
|
* LICENSE file in the root directory of this source tree.
|
|
12
12
|
*/
|
|
13
|
+
var fast01 = '70ms';
|
|
14
|
+
var fast02 = '110ms';
|
|
15
|
+
var moderate01 = '150ms';
|
|
16
|
+
var moderate02 = '240ms';
|
|
17
|
+
var slow01 = '400ms';
|
|
18
|
+
var slow02 = '700ms';
|
|
19
|
+
var unstable_tokens = ['fast01', 'fast02', 'moderate01', 'moderate02', 'slow01', 'slow02'];
|
|
13
20
|
var easings = {
|
|
14
21
|
standard: {
|
|
15
22
|
productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
|
|
@@ -39,7 +46,14 @@
|
|
|
39
46
|
}
|
|
40
47
|
|
|
41
48
|
exports.easings = easings;
|
|
49
|
+
exports.fast01 = fast01;
|
|
50
|
+
exports.fast02 = fast02;
|
|
51
|
+
exports.moderate01 = moderate01;
|
|
52
|
+
exports.moderate02 = moderate02;
|
|
42
53
|
exports.motion = motion;
|
|
54
|
+
exports.slow01 = slow01;
|
|
55
|
+
exports.slow02 = slow02;
|
|
56
|
+
exports.unstable_tokens = unstable_tokens;
|
|
43
57
|
|
|
44
58
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
45
59
|
|
package/docs/sass.md
DELETED
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# Sass API
|
|
2
|
-
|
|
3
|
-
| Mark | Description |
|
|
4
|
-
| ---- | ---------------------------------------------------------- |
|
|
5
|
-
| ✅ | Public functions, mixins, placeholders, and variables |
|
|
6
|
-
| ❌ | Private items - not supported outside package's build |
|
|
7
|
-
| ⚠️ | Deprecated items - may not be available in future releases |
|
|
8
|
-
|
|
9
|
-
<!-- toc -->
|
|
10
|
-
|
|
11
|
-
- [@carbon/motion](#carbonmotion)
|
|
12
|
-
- [✅carbon--easings [variable]](#carbon--easings-variable)
|
|
13
|
-
- [✅carbon--motion [function]](#carbon--motion-function)
|
|
14
|
-
- [✅carbon--motion [mixin]](#carbon--motion-mixin)
|
|
15
|
-
|
|
16
|
-
<!-- tocstop -->
|
|
17
|
-
|
|
18
|
-
## @carbon/motion
|
|
19
|
-
|
|
20
|
-
### ✅carbon--easings [variable]
|
|
21
|
-
|
|
22
|
-
Common component easings
|
|
23
|
-
|
|
24
|
-
<details>
|
|
25
|
-
<summary>Source code</summary>
|
|
26
|
-
|
|
27
|
-
```scss
|
|
28
|
-
$carbon--easings: (
|
|
29
|
-
standard: (
|
|
30
|
-
productive: cubic-bezier(0.2, 0, 0.38, 0.9),
|
|
31
|
-
expressive: cubic-bezier(0.4, 0.14, 0.3, 1),
|
|
32
|
-
),
|
|
33
|
-
entrance: (
|
|
34
|
-
productive: cubic-bezier(0, 0, 0.38, 0.9),
|
|
35
|
-
expressive: cubic-bezier(0, 0, 0.3, 1),
|
|
36
|
-
),
|
|
37
|
-
exit: (
|
|
38
|
-
productive: cubic-bezier(0.2, 0, 1, 0.9),
|
|
39
|
-
expressive: cubic-bezier(0.4, 0.14, 1, 1),
|
|
40
|
-
),
|
|
41
|
-
);
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
</details>
|
|
45
|
-
|
|
46
|
-
- **Group**: [@carbon/motion](#carbonmotion)
|
|
47
|
-
- **Type**: `Map`
|
|
48
|
-
|
|
49
|
-
### ✅carbon--motion [function]
|
|
50
|
-
|
|
51
|
-
Get the transition-timing-function for a given easing and motion mode
|
|
52
|
-
|
|
53
|
-
<details>
|
|
54
|
-
<summary>Source code</summary>
|
|
55
|
-
|
|
56
|
-
```scss
|
|
57
|
-
@function carbon--motion($name, $mode: productive, $easings: $carbon--easings) {
|
|
58
|
-
@if map-has-key($easings, $name) {
|
|
59
|
-
$easing: map-get($easings, $name);
|
|
60
|
-
@if map-has-key($easing, $mode) {
|
|
61
|
-
@return map-get($easing, $mode);
|
|
62
|
-
} @else {
|
|
63
|
-
@error 'Unable to find a mode for the easing #{$easing} called: #{$mode}.';
|
|
64
|
-
}
|
|
65
|
-
} @else {
|
|
66
|
-
@error 'Unable to find an easing named #{$name} in our supported easings.';
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
</details>
|
|
72
|
-
|
|
73
|
-
- **Parameters**:
|
|
74
|
-
|
|
75
|
-
| Name | Description | Type | Default value |
|
|
76
|
-
| ---------- | ---------------------------------------- | -------- | ------------------ |
|
|
77
|
-
| `$name` | Can be `standard`, `entrance`, or `exit` | `String` | — |
|
|
78
|
-
| `$mode` | Can be `productive` or `expressive` | `String` | `productive` |
|
|
79
|
-
| `$easings` | Easings map | `Map` | `$carbon--easings` |
|
|
80
|
-
|
|
81
|
-
- **Group**: [@carbon/motion](#carbonmotion)
|
|
82
|
-
- **Returns**: `Function` CSS `cubic-bezier()` function
|
|
83
|
-
- **Used by**:
|
|
84
|
-
- [carbon--motion [mixin]](#carbon--motion-mixin)
|
|
85
|
-
|
|
86
|
-
### ✅carbon--motion [mixin]
|
|
87
|
-
|
|
88
|
-
Set the transition-timing-function for a given easing and motion mode
|
|
89
|
-
|
|
90
|
-
<details>
|
|
91
|
-
<summary>Source code</summary>
|
|
92
|
-
|
|
93
|
-
```scss
|
|
94
|
-
@mixin carbon--motion($name, $mode) {
|
|
95
|
-
transition-timing-function: carbon--motion($name, $mode);
|
|
96
|
-
}
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
</details>
|
|
100
|
-
|
|
101
|
-
- **Parameters**:
|
|
102
|
-
|
|
103
|
-
| Name | Description | Type | Default value |
|
|
104
|
-
| ------- | ------------------------------------- | -------- | ------------- |
|
|
105
|
-
| `$name` | The name of the easing curve to apply | `String` | — |
|
|
106
|
-
| `$mode` | The mode for the easing curve to use | `String` | — |
|
|
107
|
-
|
|
108
|
-
- **Group**: [@carbon/motion](#carbonmotion)
|
|
109
|
-
- **Requires**:
|
|
110
|
-
- [carbon--motion [function]](#carbon--motion-function)
|