@carbon/motion 11.49.0 → 11.50.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/umd/index.js CHANGED
@@ -2,39 +2,67 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.CarbonMotion = {}));
3
3
  })(this, function(exports) {
4
4
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
5
- //#region src/tokens.ts
6
- /**
7
- * Copyright IBM Corp. 2018, 2026
8
- *
9
- * This source code is licensed under the Apache-2.0 license found in the
10
- * LICENSE file in the root directory of this source tree.
11
- */
12
- const fast01 = "70ms";
13
- const fast02 = "110ms";
14
- const moderate01 = "150ms";
15
- const moderate02 = "240ms";
16
- const slow01 = "400ms";
17
- const slow02 = "700ms";
18
- const durationFast01 = fast01;
19
- const durationFast02 = fast02;
20
- const durationModerate01 = moderate01;
21
- const durationModerate02 = moderate02;
22
- const durationSlow01 = slow01;
23
- const durationSlow02 = slow02;
5
+ //#region js/generated/tokens.js
6
+ /** Micro-interactions such as button and toggle. Instant response to user action. */
7
+ const durationFast01 = "70ms";
8
+ /** Micro-interactions such as fade in. Subtle entrance or exit of small UI elements. */
9
+ const durationFast02 = "110ms";
10
+ /** Micro-interactions, small expansion, short distance movements. Default transition speed. */
11
+ const durationModerate01 = "150ms";
12
+ /** Expansion, system communication, toast. Slightly longer interactions with more visual weight. */
13
+ const durationModerate02 = "240ms";
14
+ /** Large expansion, important system notifications. Deliberate, prominent transitions. */
15
+ const durationSlow01 = "400ms";
16
+ /** Background dimming, large hero transitions. Slow, immersive motion for maximum emphasis. */
17
+ const durationSlow02 = "700ms";
18
+ /** @deprecated Use `durationFast01` instead */
19
+ const fast01 = durationFast01;
20
+ /** @deprecated Use `durationFast02` instead */
21
+ const fast02 = durationFast02;
22
+ /** @deprecated Use `durationModerate01` instead */
23
+ const moderate01 = durationModerate01;
24
+ /** @deprecated Use `durationModerate02` instead */
25
+ const moderate02 = durationModerate02;
26
+ /** @deprecated Use `durationSlow01` instead */
27
+ const slow01 = durationSlow01;
28
+ /** @deprecated Use `durationSlow02` instead */
29
+ const slow02 = durationSlow02;
30
+ const easings = {
31
+ standard: {
32
+ productive: "cubic-bezier(0.2, 0, 0.38, 0.9)",
33
+ expressive: "cubic-bezier(0.4, 0.14, 0.3, 1)"
34
+ },
35
+ entrance: {
36
+ productive: "cubic-bezier(0, 0, 0.38, 0.9)",
37
+ expressive: "cubic-bezier(0, 0, 0.3, 1)"
38
+ },
39
+ exit: {
40
+ productive: "cubic-bezier(0.2, 0, 1, 0.9)",
41
+ expressive: "cubic-bezier(0.4, 0.14, 1, 1)"
42
+ }
43
+ };
24
44
  const unstable_tokens = [
25
- "fast01",
26
- "fast02",
27
- "moderate01",
28
- "moderate02",
29
- "slow01",
30
- "slow02",
31
45
  "durationFast01",
32
46
  "durationFast02",
33
47
  "durationModerate01",
34
48
  "durationModerate02",
35
49
  "durationSlow01",
36
- "durationSlow02"
50
+ "durationSlow02",
51
+ "fast01",
52
+ "fast02",
53
+ "moderate01",
54
+ "moderate02",
55
+ "slow01",
56
+ "slow02"
37
57
  ];
58
+ //#endregion
59
+ //#region src/tokens.ts
60
+ /**
61
+ * Copyright IBM Corp. 2018, 2026
62
+ *
63
+ * This source code is licensed under the Apache-2.0 license found in the
64
+ * LICENSE file in the root directory of this source tree.
65
+ */
38
66
  const durations = {
39
67
  "fast-01": durationFast01,
40
68
  "fast-02": durationFast02,
@@ -87,24 +115,9 @@
87
115
  ]
88
116
  }
89
117
  };
90
- const formatEasing = (curve) => `cubic-bezier(${curve.join(", ")})`;
91
- const easings = {
92
- standard: {
93
- productive: formatEasing(easingCurves.standard.productive),
94
- expressive: formatEasing(easingCurves.standard.expressive)
95
- },
96
- entrance: {
97
- productive: formatEasing(easingCurves.entrance.productive),
98
- expressive: formatEasing(easingCurves.entrance.expressive)
99
- },
100
- exit: {
101
- productive: formatEasing(easingCurves.exit.productive),
102
- expressive: formatEasing(easingCurves.exit.expressive)
103
- }
104
- };
105
118
  const motion = (name, mode) => {
106
- if (!easings[name]) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected one of: ${Object.keys(easings).join(", ")}`);
107
119
  const easing = easings[name];
120
+ if (!easing) throw new Error(`Unable to find easing \`${name}\` in our supported easings. Expected one of: ${Object.keys(easings).join(", ")}`);
108
121
  if (!easing[mode]) throw new Error(`Unable to find a mode for the easing \`${name}\` called: \`${mode}\`. Expected one of: ${Object.keys(easing).join(", ")}`);
109
122
  return easing[mode];
110
123
  };
@@ -119,86 +132,76 @@
119
132
  if (!duration) throw new Error(`Unable to find duration \`${name}\` in our supported durations. Expected one of: ${Object.keys(durations).join(", ")}`);
120
133
  return duration;
121
134
  };
122
- //#endregion
123
- //#region src/surfaces.ts
124
- /**
125
- * Named motion intents. These definitions are engine and framework agnostic.
126
- *
127
- * `prefers-reduced-motion` is intentionally not represented here: surfaces
128
- * never animate when the users request reduced motion. Framework adapters
129
- * bail before running, and the Sass output is wrapped in a
130
- * `prefers-reduced-motion: no-preference` media query
131
- */
132
135
  const surfaces = {
133
136
  disclosure: {
134
- kind: "reveal",
135
- duration: "moderate-01",
136
- enter: {
137
- blockSize: "auto",
138
- opacity: 1
137
+ "kind": "reveal",
138
+ "duration": "moderate-01",
139
+ "enter": {
140
+ "blockSize": "auto",
141
+ "opacity": 1
139
142
  },
140
- exit: {
141
- blockSize: 0,
142
- opacity: 0
143
+ "exit": {
144
+ "blockSize": 0,
145
+ "opacity": 0
143
146
  },
144
- enterEasing: ["entrance", "productive"],
145
- exitEasing: ["exit", "productive"]
147
+ "enterEasing": ["entrance", "productive"],
148
+ "exitEasing": ["exit", "productive"]
146
149
  },
147
150
  contextual: {
148
- kind: "reveal",
149
- duration: "fast-02",
150
- enter: {
151
- opacity: 1,
152
- transform: "scale(1)"
151
+ "kind": "reveal",
152
+ "duration": "fast-02",
153
+ "enter": {
154
+ "opacity": 1,
155
+ "transform": "scale(1)"
153
156
  },
154
- exit: {
155
- opacity: 0,
156
- transform: "scale(0.96)"
157
+ "exit": {
158
+ "opacity": 0,
159
+ "transform": "scale(0.96)"
157
160
  },
158
- enterEasing: ["entrance", "expressive"],
159
- exitEasing: ["exit", "expressive"]
161
+ "enterEasing": ["entrance", "expressive"],
162
+ "exitEasing": ["exit", "expressive"]
160
163
  },
161
164
  stretch: {
162
- kind: "reveal",
163
- duration: "slow-01",
164
- enter: {
165
- opacity: 1,
166
- clipPath: "inset(0 0 0 0)"
165
+ "kind": "reveal",
166
+ "duration": "slow-01",
167
+ "enter": {
168
+ "opacity": 1,
169
+ "clipPath": "inset(0 0 0 0)"
167
170
  },
168
- exit: {
169
- opacity: 0,
170
- clipPath: "inset(50% 0 50% 0)"
171
+ "exit": {
172
+ "opacity": 0,
173
+ "clipPath": "inset(50% 0 50% 0)"
171
174
  },
172
- enterEasing: ["entrance", "expressive"],
173
- exitEasing: ["exit", "expressive"]
175
+ "enterEasing": ["entrance", "expressive"],
176
+ "exitEasing": ["exit", "expressive"]
174
177
  },
175
178
  expand: {
176
- kind: "shared-element",
177
- duration: "moderate-02",
178
- enter: {
179
- opacity: 1,
180
- transform: "scale(1)"
179
+ "kind": "shared-element",
180
+ "duration": "moderate-02",
181
+ "enter": {
182
+ "opacity": 1,
183
+ "transform": "scale(1)"
181
184
  },
182
- exit: {
183
- opacity: 0,
184
- transform: "scale(0.96)"
185
+ "exit": {
186
+ "opacity": 0,
187
+ "transform": "scale(0.96)"
185
188
  },
186
- enterEasing: ["standard", "productive"],
187
- exitEasing: ["standard", "productive"]
189
+ "enterEasing": ["standard", "productive"],
190
+ "exitEasing": ["standard", "productive"]
188
191
  },
189
192
  invoke: {
190
- kind: "shared-element",
191
- origin: "trigger",
192
- duration: "moderate-02",
193
- enterEasing: ["standard", "expressive"],
194
- exitEasing: ["standard", "expressive"]
193
+ "kind": "shared-element",
194
+ "origin": "trigger",
195
+ "duration": "moderate-02",
196
+ "enterEasing": ["standard", "expressive"],
197
+ "exitEasing": ["standard", "expressive"]
195
198
  }
196
199
  };
197
- const getMotionSurface = (name) => {
200
+ function getMotionSurface(name) {
198
201
  const surface = surfaces[name];
199
- if (!surface) throw new Error(`Unable to find motion surface \`${name}\`. Expected one of: ` + Object.keys(surfaces).join(", "));
202
+ if (!surface) throw new Error(`Unable to find motion surface \`${name}\`. Expected one of: ${Object.keys(surfaces).join(", ")}`);
200
203
  return surface;
201
- };
204
+ }
202
205
  //#endregion
203
206
  exports.durationFast01 = durationFast01;
204
207
  exports.durationFast02 = durationFast02;