@stateglyph/transitions 0.1.0 → 0.2.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 CHANGED
@@ -1,23 +1,19 @@
1
1
  # @stateglyph/transitions
2
2
 
3
- Optional, accessible CSS transitions for StateGlyph React icons.
3
+ Optional CSS timing presets for StateGlyph's built-in animated state changes.
4
4
 
5
5
  ```bash
6
6
  npm install @stateglyph/react @stateglyph/transitions
7
7
  ```
8
8
 
9
- Import the stylesheet once near the root of your application:
10
-
11
9
  ```ts
12
10
  import "@stateglyph/transitions/styles.css";
13
11
  ```
14
12
 
15
- StateGlyph components expose their definition's transition through a
16
- `data-transition` attribute, so no wrapper or per-icon class is required. The
17
- stylesheet implements `crossfade`, `scale-fade`, `rotate`, `slide`, and
18
- `morph`, plus continuous rotation for loading states.
19
-
20
- You can customize timing with CSS custom properties:
13
+ React components and CLI-generated components animate without this stylesheet.
14
+ The renderer retains the outgoing glyph while the incoming glyph enters, using
15
+ `crossfade`, `scale-fade`, `rotate`, `slide`, or a blur blend named `morph`.
16
+ The optional stylesheet sets timing defaults using `data-transition`.
21
17
 
22
18
  ```css
23
19
  .status-icon {
@@ -27,4 +23,7 @@ You can customize timing with CSS custom properties:
27
23
  }
28
24
  ```
29
25
 
30
- All animation is disabled when the user enables reduced motion.
26
+ Set a custom duration on a class or parent scope. Explicit React `duration` and
27
+ `spinDuration` props take precedence over CSS variables. Use `animated={false}`
28
+ to disable animation on one component. Live reduced-motion preferences disable
29
+ both state transitions and continuous rotation.
package/dist/styles.css CHANGED
@@ -1,82 +1,32 @@
1
1
  :where([data-state-icon][data-transition]) {
2
- transform-box: fill-box;
3
- transform-origin: center;
2
+ --stateglyph-preset-spin-duration: 900ms;
3
+ --stateglyph-preset-easing: cubic-bezier(0.22, 1, 0.36, 1);
4
4
  }
5
5
 
6
6
  [data-state-icon][data-transition="crossfade"] {
7
- animation: stateglyph-crossfade var(--stateglyph-duration, 180ms)
8
- var(--stateglyph-easing, ease-out) both;
7
+ --stateglyph-preset-duration: 180ms;
9
8
  }
10
-
11
9
  [data-state-icon][data-transition="scale-fade"] {
12
- animation: stateglyph-scale-fade var(--stateglyph-duration, 200ms)
13
- var(--stateglyph-easing, cubic-bezier(0.22, 1, 0.36, 1)) both;
10
+ --stateglyph-preset-duration: 200ms;
14
11
  }
15
-
16
12
  [data-state-icon][data-transition="rotate"] {
17
- animation: stateglyph-rotate var(--stateglyph-duration, 240ms)
18
- var(--stateglyph-easing, cubic-bezier(0.22, 1, 0.36, 1)) both;
13
+ --stateglyph-preset-duration: 240ms;
19
14
  }
20
-
21
15
  [data-state-icon][data-transition="slide"] {
22
- animation: stateglyph-slide var(--stateglyph-duration, 220ms)
23
- var(--stateglyph-easing, cubic-bezier(0.22, 1, 0.36, 1)) both;
16
+ --stateglyph-preset-duration: 220ms;
24
17
  }
25
-
26
18
  [data-state-icon][data-transition="morph"] {
27
- animation: stateglyph-morph var(--stateglyph-duration, 240ms)
28
- var(--stateglyph-easing, cubic-bezier(0.22, 1, 0.36, 1)) both;
29
- }
30
-
31
- [data-state-icon][data-state-continuous="true"] {
32
- animation: stateglyph-spin var(--stateglyph-spin-duration, 900ms) linear
33
- infinite;
34
- }
35
-
36
- @keyframes stateglyph-crossfade {
37
- from {
38
- opacity: 0;
39
- }
40
- }
41
-
42
- @keyframes stateglyph-scale-fade {
43
- from {
44
- opacity: 0;
45
- transform: scale(0.82);
46
- }
47
- }
48
-
49
- @keyframes stateglyph-rotate {
50
- from {
51
- opacity: 0;
52
- transform: rotate(-35deg) scale(0.9);
53
- }
54
- }
55
-
56
- @keyframes stateglyph-slide {
57
- from {
58
- opacity: 0;
59
- transform: translateY(18%);
60
- }
61
- }
62
-
63
- @keyframes stateglyph-morph {
64
- from {
65
- opacity: 0;
66
- filter: blur(2px);
67
- transform: scale(0.9) rotate(-8deg);
68
- }
19
+ --stateglyph-preset-duration: 240ms;
69
20
  }
70
21
 
71
- @keyframes stateglyph-spin {
72
- to {
73
- transform: rotate(360deg);
74
- }
22
+ [data-state-layer] {
23
+ transform-box: view-box;
24
+ transform-origin: center;
75
25
  }
76
26
 
77
27
  @media (prefers-reduced-motion: reduce) {
78
- [data-state-icon][data-transition],
79
- [data-state-icon][data-state-continuous="true"] {
80
- animation: none;
28
+ [data-state-icon][data-transition] {
29
+ --stateglyph-preset-duration: 0ms;
30
+ --stateglyph-preset-spin-duration: 0ms;
81
31
  }
82
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stateglyph/transitions",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "CSS transitions for StateGlyph React icons.",
5
5
  "license": "MIT",
6
6
  "author": "Kamalveer Singh",