@octaviaflow/motion 1.0.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 ADDED
@@ -0,0 +1,89 @@
1
+ # @octaviaflow/motion
2
+
3
+ > Motion helpers for digital and software products using the Carbon Design
4
+ > System
5
+
6
+ ## Getting started
7
+
8
+ To install `@octaviaflow/motion` in your project, you will need to run the following
9
+ command using [npm](https://www.npmjs.com/):
10
+
11
+ ```bash
12
+ npm install -S @octaviaflow/motion
13
+ ```
14
+
15
+ If you prefer [Yarn](https://yarnpkg.com/en/), use the following command
16
+ instead:
17
+
18
+ ```bash
19
+ yarn add @octaviaflow/motion
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ `@octaviaflow/motion` supports standard, entrance, and exit easing curves in two
25
+ motion modes: productive and expressive. You can access these curves using
26
+ either Sass or JavaScript.
27
+
28
+ ### Sass
29
+
30
+ `@octaviaflow/motion` exports a `carbon--motion` function and `carbon--motion` mixin
31
+ that you can use to access the value of a motion curve or include that curve as
32
+ the `transition-timing-function` for a selector. To use these helpers, you can
33
+ do the following in your project:
34
+
35
+ ```scss
36
+ @import '@octaviaflow/motion/scss/motion.scss';
37
+
38
+ .my-custom-selector {
39
+ // Supplies the standard easing curve, using the productive mode by default
40
+ transition-timing-function: carbon--motion(standard);
41
+ }
42
+
43
+ .my-custom-selector-v2 {
44
+ // Supplies the standard easing curve, but with the expressive mode, on the
45
+ // transition-timing-function property for this selector
46
+ @include carbon--motion(standard, expressive);
47
+ }
48
+ ```
49
+
50
+ Both the `motion` function and mixin support passing in the name of the motion
51
+ curve and the mode you want to work in.
52
+
53
+ ### JavaScript
54
+
55
+ If you're using `@octaviaflow/motion` as a JavaScript dependency, we export our
56
+ easings and a function called `motion` that you can use. For example:
57
+
58
+ ```js
59
+ // CommonJS
60
+ const { easings, motion } = require('@octaviaflow/motion');
61
+ ```
62
+
63
+ You can also include this as a JavaScript module:
64
+
65
+ ```js
66
+ // ESM
67
+ import { easings, motion } from '@octaviaflow/motion';
68
+
69
+ motion('standard', 'productive'); // Returns a string `cubic-bezier()` function
70
+ ```
71
+
72
+ ## 🙌 Contributing
73
+
74
+ We're always looking for contributors to help us fix bugs, build new features,
75
+ or help us improve the project documentation. If you're interested, definitely
76
+ check out our [Contributing Guide](/.github/CONTRIBUTING.md)! 👀
77
+
78
+ ## 📝 License
79
+
80
+ Licensed under the [Apache 2.0 License](/LICENSE).
81
+
82
+ ## <picture><source height="20" width="20" media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-dark.svg"><source height="20" width="20" media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"><img height="20" width="20" alt="IBM Telemetry" src="https://raw.githubusercontent.com/ibm-telemetry/telemetry-js/main/docs/images/ibm-telemetry-light.svg"></picture> IBM Telemetry
83
+
84
+ This package uses IBM Telemetry to collect de-identified and anonymized metrics
85
+ data. By installing this package as a dependency you are agreeing to telemetry
86
+ collection. To opt out, see
87
+ [Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
88
+ For more information on the data being collected, please see the
89
+ [IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
package/docs/sass.md ADDED
@@ -0,0 +1,38 @@
1
+ # Sass
2
+
3
+ > Sass documentation for `@octaviaflow/motion`
4
+
5
+ ## Usage
6
+
7
+ The `@octaviaflow/motion` package enables you to access motion curves and durations
8
+ built for the IBM Design Language in Sass. You can access these values directly
9
+ from the package by writing the following:
10
+
11
+ ```scss
12
+ @use '@octaviaflow/motion';
13
+
14
+ .selector {
15
+ // Set `transition-timing-function` directly
16
+ @include motion.motion(standard, productive);
17
+
18
+ // Alternatively
19
+ transition: opacity motion.motion(standard, productive);
20
+
21
+ // Or use a duration
22
+ transition: opacity motion.$duration-fast-01;
23
+ }
24
+ ```
25
+
26
+ ## API
27
+
28
+ | Name | Type |
29
+ | :---------------------- | :------- |
30
+ | `$duration-fast-01` | Duration |
31
+ | `$duration-fast-02` | Duration |
32
+ | `$duration-moderate-01` | Duration |
33
+ | `$duration-moderate-02` | Duration |
34
+ | `$duration-slow-01` | Duration |
35
+ | `$duration-slow-02` | Duration |
36
+ | `$easings` | Map |
37
+ | `@mixin motion` | Mixin |
38
+ | `@function motion` | Mixin |
package/index.scss ADDED
@@ -0,0 +1,123 @@
1
+ //
2
+ // Copyright OctaviaFlow. 2025
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 @octaviaflow/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 @octaviaflow/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 @octaviaflow/motion
54
+ @mixin motion($name, $mode) {
55
+ transition-timing-function: motion($name, $mode);
56
+ }
57
+
58
+ /// @access public
59
+ /// @type Duration
60
+ /// @group @octaviaflow/motion
61
+ $duration-fast-01: 70ms;
62
+
63
+ /// @access public
64
+ /// @type Duration
65
+ /// @group @octaviaflow/motion
66
+ $duration-fast-02: 110ms;
67
+
68
+ /// @access public
69
+ /// @type Duration
70
+ /// @group @octaviaflow/motion
71
+ $duration-moderate-01: 150ms;
72
+
73
+ /// @access public
74
+ /// @type Duration
75
+ /// @group @octaviaflow/motion
76
+ $duration-moderate-02: 240ms;
77
+
78
+ /// @access public
79
+ /// @type Duration
80
+ /// @group @octaviaflow/motion
81
+ $duration-slow-01: 400ms;
82
+
83
+ /// @access public
84
+ /// @type Duration
85
+ /// @group @octaviaflow/motion
86
+ $duration-slow-02: 700ms;
87
+
88
+ /// V10 backwards compatibility tokens
89
+ /// @access public
90
+ /// @deprecated
91
+ /// @type Duration
92
+ /// @group @octaviaflow/motion
93
+ $fast-01: $duration-fast-01;
94
+
95
+ /// @access public
96
+ /// @deprecated
97
+ /// @type Duration
98
+ /// @group @octaviaflow/motion
99
+ $fast-02: $duration-fast-02;
100
+
101
+ /// @access public
102
+ /// @deprecated
103
+ /// @type Duration
104
+ /// @group @octaviaflow/motion
105
+ $moderate-01: $duration-moderate-01;
106
+
107
+ /// @access public
108
+ /// @deprecated
109
+ /// @type Duration
110
+ /// @group @octaviaflow/motion
111
+ $moderate-02: $duration-moderate-02;
112
+
113
+ /// @access public
114
+ /// @deprecated
115
+ /// @type Duration
116
+ /// @group @octaviaflow/motion
117
+ $slow-01: $duration-slow-01;
118
+
119
+ /// @access public
120
+ /// @deprecated
121
+ /// @type Duration
122
+ /// @group @octaviaflow/motion
123
+ $slow-02: $duration-slow-02;
package/lib/index.js ADDED
@@ -0,0 +1,67 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ /**
6
+ * Copyright OctaviaFlow
7
+ * Author: Vishal Kumar
8
+ * Created: 11/November/2025
9
+ *
10
+ * This source code is licensed under the Apache-2.0 license found in the
11
+ * LICENSE file in the root directory of this source tree.
12
+ */
13
+
14
+ var fast01 = '70ms';
15
+ var fast02 = '110ms';
16
+ var moderate01 = '150ms';
17
+ var moderate02 = '240ms';
18
+ var slow01 = '400ms';
19
+ var slow02 = '700ms';
20
+ // V11 Tokens
21
+ var durationFast01 = fast01;
22
+ var durationFast02 = fast02;
23
+ var durationModerate01 = moderate01;
24
+ var durationModerate02 = moderate02;
25
+ var durationSlow01 = slow01;
26
+ var durationSlow02 = slow02;
27
+ var unstable_tokens = ['fast01', 'fast02', 'moderate01', 'moderate02', 'slow01', 'slow02', 'durationFast01', 'durationFast02', 'durationModerate01', 'durationModerate02', 'durationSlow01', 'durationSlow02'];
28
+ var 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
+ function motion(name, mode) {
43
+ if (!easings[name]) {
44
+ throw new Error("Unable to find easing `".concat(name, "` in our supported easings. Expected ") + "One of: ".concat(Object.keys(easings).join(', ')));
45
+ }
46
+ var easing = easings[name];
47
+ if (!easing[mode]) {
48
+ throw new Error("Unable to find a mode for the easing `".concat(name, "` called: `").concat(mode, "`"));
49
+ }
50
+ return easing[mode];
51
+ }
52
+
53
+ exports.durationFast01 = durationFast01;
54
+ exports.durationFast02 = durationFast02;
55
+ exports.durationModerate01 = durationModerate01;
56
+ exports.durationModerate02 = durationModerate02;
57
+ exports.durationSlow01 = durationSlow01;
58
+ exports.durationSlow02 = durationSlow02;
59
+ exports.easings = easings;
60
+ exports.fast01 = fast01;
61
+ exports.fast02 = fast02;
62
+ exports.moderate01 = moderate01;
63
+ exports.moderate02 = moderate02;
64
+ exports.motion = motion;
65
+ exports.slow01 = slow01;
66
+ exports.slow02 = slow02;
67
+ exports.unstable_tokens = unstable_tokens;
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@octaviaflow/motion",
3
+ "description": "Motion helpers for digital and software products using the OctaviaFlow Design System",
4
+ "version": "1.0.0",
5
+ "license": "Apache-2.0",
6
+ "main": "lib/index.js",
7
+ "module": "es/index.js",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/octaviaflow-design-system.git",
11
+ "directory": "packages/motion"
12
+ },
13
+ "bugs": "https://github.com/octaviaflow-design-system/issues",
14
+ "keywords": [
15
+ "octaviaflow",
16
+ "motion",
17
+ "components",
18
+ "react"
19
+ ],
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "dependencies": {
24
+ "@babel/runtime": "^7.25.0"
25
+ },
26
+ "scripts": {
27
+ "build": "bun run clean && octaviaflow-cli bundle src/index.js --name OctaviaFlowMotion",
28
+ "clean": "rimraf es lib umd"
29
+ },
30
+ "devDependencies": {
31
+ "@babel/core": "^7.28.6",
32
+ "@babel/preset-env": "^7.28.6",
33
+ "@octaviaflow/cli": "^1.0.0",
34
+ "rimraf": "^6.0.0"
35
+ }
36
+ }
package/project.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@octaviaflow/motion",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/motion/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build": {
8
+ "executor": "nx:run-commands",
9
+ "outputs": [
10
+ "{projectRoot}/es",
11
+ "{projectRoot}/lib",
12
+ "{projectRoot}/umd"
13
+ ],
14
+ "options": {
15
+ "command": "octaviaflow-cli bundle src/index.js --name OctaviaFlowMotion",
16
+ "cwd": "packages/motion"
17
+ },
18
+ "dependsOn": [
19
+ "clean",
20
+ "^build"
21
+ ]
22
+ },
23
+ "clean": {
24
+ "executor": "nx:run-commands",
25
+ "options": {
26
+ "command": "rimraf es lib umd",
27
+ "cwd": "packages/motion"
28
+ }
29
+ },
30
+ "lint": {
31
+ "executor": "@nx/eslint:lint",
32
+ "outputs": ["{options.outputFile}"],
33
+ "options": {
34
+ "lintFilePatterns": ["packages/motion/**/*.{js,jsx,ts,tsx}"]
35
+ }
36
+ }
37
+ },
38
+ "tags": ["scope:motion", "type:library"]
39
+ }
package/src/index.js ADDED
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Copyright OctaviaFlow
3
+ * Author: Vishal Kumar
4
+ * Created: 11/November/2025
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+
11
+ export const fast01 = '70ms';
12
+ export const fast02 = '110ms';
13
+ export const moderate01 = '150ms';
14
+ export const moderate02 = '240ms';
15
+ export const slow01 = '400ms';
16
+ export const slow02 = '700ms';
17
+ // V11 Tokens
18
+ export const durationFast01 = fast01;
19
+ export const durationFast02 = fast02;
20
+ export const durationModerate01 = moderate01;
21
+ export const durationModerate02 = moderate02;
22
+ export const durationSlow01 = slow01;
23
+ export const durationSlow02 = slow02;
24
+
25
+ export const unstable_tokens = [
26
+ 'fast01',
27
+ 'fast02',
28
+ 'moderate01',
29
+ 'moderate02',
30
+ 'slow01',
31
+ 'slow02',
32
+ 'durationFast01',
33
+ 'durationFast02',
34
+ 'durationModerate01',
35
+ 'durationModerate02',
36
+ 'durationSlow01',
37
+ 'durationSlow02',
38
+ ];
39
+
40
+ export const easings = {
41
+ standard: {
42
+ productive: 'cubic-bezier(0.2, 0, 0.38, 0.9)',
43
+ expressive: 'cubic-bezier(0.4, 0.14, 0.3, 1)',
44
+ },
45
+ entrance: {
46
+ productive: 'cubic-bezier(0, 0, 0.38, 0.9)',
47
+ expressive: 'cubic-bezier(0, 0, 0.3, 1)',
48
+ },
49
+ exit: {
50
+ productive: 'cubic-bezier(0.2, 0, 1, 0.9)',
51
+ expressive: 'cubic-bezier(0.4, 0.14, 1, 1)',
52
+ },
53
+ };
54
+
55
+ export function motion(name, mode) {
56
+ if (!easings[name]) {
57
+ throw new Error(
58
+ `Unable to find easing \`${name}\` in our supported easings. Expected ` +
59
+ `One of: ${Object.keys(easings).join(', ')}`
60
+ );
61
+ }
62
+
63
+ const easing = easings[name];
64
+ if (!easing[mode]) {
65
+ throw new Error(
66
+ `Unable to find a mode for the easing \`${name}\` called: \`${mode}\``
67
+ );
68
+ }
69
+
70
+ return easing[mode];
71
+ }
package/telemetry.yml ADDED
@@ -0,0 +1,17 @@
1
+ # yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@v1.0.0/dist/config.schema.json
2
+ version: 1
3
+ projectId: 'd323f4a9-0470-4cdf-b653-a7e47b908c90'
4
+ name: 'octaviaflow-motion'
5
+ storage:
6
+ type: 'file'
7
+ file:
8
+ directory: '/Volumes/Main/Projects/OctaviaFlow-Design-System/telemetry-logs'
9
+ fileNamePattern: 'octaviaflow-motion-{timestamp}.json'
10
+ maxFileSizeMB: 10
11
+ compress: false
12
+ collect:
13
+ npm:
14
+ dependencies: null
15
+ js:
16
+ functions: {}
17
+ tokens: null