@nice2dev/icons 1.3.15 → 1.3.17

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  4. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  5. package/dist/cjs/NiceIconPicker.js +788 -508
  6. package/dist/cjs/NiceIconPreview.js +246 -188
  7. package/dist/cjs/NiceIconSetCreator.js +683 -552
  8. package/dist/cjs/NiceIconStacker.js +547 -171
  9. package/dist/cjs/NiceIconValue.js +27 -35
  10. package/dist/cjs/NtdIconBadge.js +384 -360
  11. package/dist/cjs/NtdIconMorph.js +419 -354
  12. package/dist/cjs/NtdStateMorph.js +150 -147
  13. package/dist/cjs/advancedIconSearch.js +373 -510
  14. package/dist/cjs/animationControls.js +518 -642
  15. package/dist/cjs/animationSpeed.js +69 -0
  16. package/dist/cjs/client.js +12 -15
  17. package/dist/cjs/createIcon.js +374 -252
  18. package/dist/cjs/design-tokens.js +324 -390
  19. package/dist/cjs/figmaExport.js +162 -257
  20. package/dist/cjs/figmaSync.js +234 -316
  21. package/dist/cjs/headless-ui.js +240 -368
  22. package/dist/cjs/iconAnalytics.js +337 -393
  23. package/dist/cjs/iconHtml.js +64 -86
  24. package/dist/cjs/iconMetadata.js +392 -472
  25. package/dist/cjs/iconParts.js +120 -90
  26. package/dist/cjs/iconStack.js +136 -155
  27. package/dist/cjs/iconStyles.js +1670 -509
  28. package/dist/cjs/iconValue.js +359 -430
  29. package/dist/cjs/icons/accessibility.js +1119 -134
  30. package/dist/cjs/icons/actions.js +1290 -330
  31. package/dist/cjs/icons/ai.js +1424 -144
  32. package/dist/cjs/icons/brand.js +613 -184
  33. package/dist/cjs/icons/business.js +938 -192
  34. package/dist/cjs/icons/devtech.js +1656 -227
  35. package/dist/cjs/icons/ecommerce.js +802 -111
  36. package/dist/cjs/icons/education.js +1345 -199
  37. package/dist/cjs/icons/files.js +1597 -328
  38. package/dist/cjs/icons/fintech.js +793 -104
  39. package/dist/cjs/icons/food.js +1028 -156
  40. package/dist/cjs/icons/fun.js +804 -109
  41. package/dist/cjs/icons/gaming.js +916 -170
  42. package/dist/cjs/icons/health.js +623 -112
  43. package/dist/cjs/icons/index.js +32 -42
  44. package/dist/cjs/icons/input.js +282 -83
  45. package/dist/cjs/icons/legal.js +1065 -122
  46. package/dist/cjs/icons/media.js +1061 -267
  47. package/dist/cjs/icons/navigation.js +407 -123
  48. package/dist/cjs/icons/omniverk.js +523 -93
  49. package/dist/cjs/icons/realestate.js +1520 -193
  50. package/dist/cjs/icons/saas.js +867 -98
  51. package/dist/cjs/icons/science.js +1344 -202
  52. package/dist/cjs/icons/shapes.js +1316 -308
  53. package/dist/cjs/icons/smarthome.js +786 -90
  54. package/dist/cjs/icons/social.js +591 -59
  55. package/dist/cjs/icons/sports.js +1133 -133
  56. package/dist/cjs/icons/sustainability.js +1211 -139
  57. package/dist/cjs/icons/travel.js +1470 -148
  58. package/dist/cjs/icons/ui.js +1508 -315
  59. package/dist/cjs/icons/weather.js +1160 -173
  60. package/dist/cjs/index.js +559 -568
  61. package/dist/cjs/lottieIntegration.js +261 -266
  62. package/dist/cjs/nicetodev-icons.css +1 -1
  63. package/dist/cjs/particleEffects.js +270 -251
  64. package/dist/cjs/resolver.js +229 -284
  65. package/dist/cjs/rsc.js +175 -193
  66. package/dist/cjs/sharpen.js +73 -130
  67. package/dist/cjs/smilAnimations.js +380 -165
  68. package/dist/cjs/stacking.js +87 -122
  69. package/dist/cjs/tailwind-plugin.js +280 -320
  70. package/dist/cjs/types.js +46 -72
  71. package/dist/cjs/utilities.js +163 -324
  72. package/dist/cjs/variantProps.js +12 -52
  73. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  74. package/dist/esm/NiceFaviconGenerator.js +583 -416
  75. package/dist/esm/NiceIconPicker.js +789 -507
  76. package/dist/esm/NiceIconPreview.js +247 -187
  77. package/dist/esm/NiceIconSetCreator.js +685 -551
  78. package/dist/esm/NiceIconStacker.js +549 -170
  79. package/dist/esm/NiceIconValue.js +29 -34
  80. package/dist/esm/NtdIconBadge.js +388 -359
  81. package/dist/esm/NtdIconMorph.js +423 -353
  82. package/dist/esm/NtdStateMorph.js +152 -146
  83. package/dist/esm/advancedIconSearch.js +391 -509
  84. package/dist/esm/animationControls.js +527 -641
  85. package/dist/esm/animationSpeed.js +69 -0
  86. package/dist/esm/client.js +48 -10
  87. package/dist/esm/createIcon.js +375 -251
  88. package/dist/esm/design-tokens.js +334 -387
  89. package/dist/esm/figmaExport.js +170 -256
  90. package/dist/esm/figmaSync.js +237 -315
  91. package/dist/esm/headless-ui.js +254 -365
  92. package/dist/esm/iconAnalytics.js +342 -392
  93. package/dist/esm/iconHtml.js +67 -85
  94. package/dist/esm/iconMetadata.js +404 -471
  95. package/dist/esm/iconParts.js +125 -89
  96. package/dist/esm/iconStack.js +145 -154
  97. package/dist/esm/iconStyles.js +1681 -508
  98. package/dist/esm/iconValue.js +361 -429
  99. package/dist/esm/icons/accessibility.js +1133 -133
  100. package/dist/esm/icons/actions.js +1320 -329
  101. package/dist/esm/icons/ai.js +1441 -143
  102. package/dist/esm/icons/brand.js +616 -179
  103. package/dist/esm/icons/business.js +957 -191
  104. package/dist/esm/icons/devtech.js +1687 -226
  105. package/dist/esm/icons/ecommerce.js +816 -110
  106. package/dist/esm/icons/education.js +1364 -198
  107. package/dist/esm/icons/files.js +1628 -327
  108. package/dist/esm/icons/fintech.js +807 -103
  109. package/dist/esm/icons/food.js +1043 -153
  110. package/dist/esm/icons/fun.js +819 -108
  111. package/dist/esm/icons/gaming.js +933 -169
  112. package/dist/esm/icons/health.js +636 -111
  113. package/dist/esm/icons/index.js +589 -32
  114. package/dist/esm/icons/input.js +326 -82
  115. package/dist/esm/icons/legal.js +1079 -121
  116. package/dist/esm/icons/media.js +1086 -266
  117. package/dist/esm/icons/navigation.js +421 -122
  118. package/dist/esm/icons/omniverk.js +534 -91
  119. package/dist/esm/icons/realestate.js +1544 -198
  120. package/dist/esm/icons/saas.js +880 -97
  121. package/dist/esm/icons/science.js +1370 -208
  122. package/dist/esm/icons/shapes.js +1343 -307
  123. package/dist/esm/icons/smarthome.js +799 -89
  124. package/dist/esm/icons/social.js +599 -58
  125. package/dist/esm/icons/sports.js +1148 -132
  126. package/dist/esm/icons/sustainability.js +1226 -138
  127. package/dist/esm/icons/travel.js +1486 -147
  128. package/dist/esm/icons/ui.js +1540 -314
  129. package/dist/esm/icons/weather.js +1181 -172
  130. package/dist/esm/index.js +749 -58
  131. package/dist/esm/lottieIntegration.js +264 -265
  132. package/dist/esm/nicetodev-icons.css +1 -1
  133. package/dist/esm/particleEffects.js +271 -250
  134. package/dist/esm/resolver.js +231 -283
  135. package/dist/esm/rsc.js +182 -192
  136. package/dist/esm/sharpen.js +78 -129
  137. package/dist/esm/smilAnimations.js +385 -164
  138. package/dist/esm/stacking.js +99 -121
  139. package/dist/esm/tailwind-plugin.js +282 -319
  140. package/dist/esm/types.js +50 -71
  141. package/dist/esm/utilities.js +177 -321
  142. package/dist/esm/variantProps.js +23 -52
  143. package/dist/types/animationSpeed.d.ts +19 -0
  144. package/dist/types/createIcon.d.ts +6 -0
  145. package/dist/types/iconStyles.d.ts +6 -1
  146. package/dist/types/icons/brand.d.ts +0 -4
  147. package/dist/types/icons/food.d.ts +0 -3
  148. package/dist/types/icons/index.d.ts +3 -3
  149. package/dist/types/icons/omniverk.d.ts +0 -3
  150. package/dist/types/icons/science.d.ts +1 -1
  151. package/dist/types/smilAnimations.d.ts +4 -2
  152. package/dist/types/types.d.ts +7 -0
  153. package/package.json +15 -22
@@ -1,406 +1,471 @@
1
- 'use strict';
2
-
3
- var jsxRuntime = require('react/jsx-runtime');
4
- var uiCore = require('@nice2dev/ui-core');
5
- var React = require('react');
6
- var actions = require('./icons/actions.js');
7
- var media = require('./icons/media.js');
8
- var navigation = require('./icons/navigation.js');
9
- var ui = require('./icons/ui.js');
10
- var types = require('./types.js');
11
-
12
- /* ────────────────────────────────────────────────────────────────────────────
13
- EASING FUNCTIONS
14
- ───────────────────────────────────────────────────────────────────────────── */
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const uiCore = require("@nice2dev/ui-core");
5
+ const React = require("react");
6
+ const actions = require("./icons/actions.js");
7
+ const media = require("./icons/media.js");
8
+ const navigation = require("./icons/navigation.js");
9
+ const ui = require("./icons/ui.js");
10
+ const types = require("./types.js");
15
11
  const EASING_MAP = {
16
- linear: 'linear',
17
- ease: 'ease',
18
- 'ease-in': 'ease-in',
19
- 'ease-out': 'ease-out',
20
- 'ease-in-out': 'ease-in-out',
21
- spring: 'cubic-bezier(0.175, 0.885, 0.32, 1.275)',
22
- bounce: 'cubic-bezier(0.68, -0.55, 0.265, 1.55)',
12
+ linear: "linear",
13
+ ease: "ease",
14
+ "ease-in": "ease-in",
15
+ "ease-out": "ease-out",
16
+ "ease-in-out": "ease-in-out",
17
+ spring: "cubic-bezier(0.175, 0.885, 0.32, 1.275)",
18
+ bounce: "cubic-bezier(0.68, -0.55, 0.265, 1.55)"
23
19
  };
24
20
  const MORPH_PATHS = {
25
- 'menu-close': {
26
- from: 'M3 6h18M3 12h18M3 18h18', // hamburger
27
- to: 'M6 6l12 12M6 18L18 6', // X
28
- viewBox: '0 0 24 24',
29
- },
30
- 'play-pause': {
31
- from: 'M5 3l14 9-14 9V3z', // play triangle
32
- to: 'M6 4h4v16H6zM14 4h4v16h-4z', // pause bars
33
- viewBox: '0 0 24 24',
34
- },
35
- 'plus-minus': {
36
- from: 'M12 5v14M5 12h14', // plus
37
- to: 'M5 12h14', // minus
38
- viewBox: '0 0 24 24',
39
- },
40
- 'check-cross': {
41
- from: 'M5 12l5 5L20 7', // check
42
- to: 'M6 6l12 12M6 18L18 6', // cross
43
- viewBox: '0 0 24 24',
44
- },
45
- 'chevron-up-down': {
46
- from: 'M6 15l6-6 6 6', // chevron up
47
- to: 'M6 9l6 6 6-6', // chevron down
48
- viewBox: '0 0 24 24',
49
- },
50
- 'expand-collapse': {
51
- from: 'M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7', // expand
52
- to: 'M4 4h6v6M20 20h-6v-6M10 10L3 3M14 14l7 7', // collapse
53
- viewBox: '0 0 24 24',
54
- },
55
- 'sun-moon': {
56
- from: 'M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41M12 6a6 6 0 100 12 6 6 0 000-12z', // sun
57
- to: 'M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z', // moon
58
- viewBox: '0 0 24 24',
59
- },
60
- 'volume-mute': {
61
- from: 'M11 5L6 9H2v6h4l5 4V5zM19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07', // volume high
62
- to: 'M11 5L6 9H2v6h4l5 4V5zM23 9l-6 6M17 9l6 6', // muted
63
- viewBox: '0 0 24 24',
64
- },
65
- 'lock-unlock': {
66
- from: 'M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4', // locked
67
- to: 'M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 019.9-1', // unlocked
68
- viewBox: '0 0 24 24',
69
- },
70
- 'eye-hidden': {
71
- from: 'M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zM12 9a3 3 0 100 6 3 3 0 000-6z', // eye open
72
- to: 'M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24M1 1l22 22', // eye hidden
73
- viewBox: '0 0 24 24',
74
- },
75
- 'heart-broken': {
76
- from: 'M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z', // heart full
77
- to: 'M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78zM12 5.67l-2 6 4-2-2 6', // heart broken
78
- viewBox: '0 0 24 24',
79
- },
80
- 'star-empty': {
81
- from: 'M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z', // star filled
82
- to: 'M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z', // same path, different fill
83
- viewBox: '0 0 24 24',
84
- },
21
+ "menu-close": {
22
+ from: "M3 6h18M3 12h18M3 18h18",
23
+ // hamburger
24
+ to: "M6 6l12 12M6 18L18 6",
25
+ // X
26
+ viewBox: "0 0 24 24"
27
+ },
28
+ "play-pause": {
29
+ from: "M5 3l14 9-14 9V3z",
30
+ // play triangle
31
+ to: "M6 4h4v16H6zM14 4h4v16h-4z",
32
+ // pause bars
33
+ viewBox: "0 0 24 24"
34
+ },
35
+ "plus-minus": {
36
+ from: "M12 5v14M5 12h14",
37
+ // plus
38
+ to: "M5 12h14",
39
+ // minus
40
+ viewBox: "0 0 24 24"
41
+ },
42
+ "check-cross": {
43
+ from: "M5 12l5 5L20 7",
44
+ // check
45
+ to: "M6 6l12 12M6 18L18 6",
46
+ // cross
47
+ viewBox: "0 0 24 24"
48
+ },
49
+ "chevron-up-down": {
50
+ from: "M6 15l6-6 6 6",
51
+ // chevron up
52
+ to: "M6 9l6 6 6-6",
53
+ // chevron down
54
+ viewBox: "0 0 24 24"
55
+ },
56
+ "expand-collapse": {
57
+ from: "M4 14h6v6M20 10h-6V4M14 10l7-7M3 21l7-7",
58
+ // expand
59
+ to: "M4 4h6v6M20 20h-6v-6M10 10L3 3M14 14l7 7",
60
+ // collapse
61
+ viewBox: "0 0 24 24"
62
+ },
63
+ "sun-moon": {
64
+ from: "M12 2v2m0 16v2M4.93 4.93l1.41 1.41m11.32 11.32l1.41 1.41M2 12h2m16 0h2M6.34 17.66l-1.41 1.41M19.07 4.93l-1.41 1.41M12 6a6 6 0 100 12 6 6 0 000-12z",
65
+ // sun
66
+ to: "M21 12.79A9 9 0 1111.21 3 7 7 0 0021 12.79z",
67
+ // moon
68
+ viewBox: "0 0 24 24"
69
+ },
70
+ "volume-mute": {
71
+ from: "M11 5L6 9H2v6h4l5 4V5zM19.07 4.93a10 10 0 010 14.14M15.54 8.46a5 5 0 010 7.07",
72
+ // volume high
73
+ to: "M11 5L6 9H2v6h4l5 4V5zM23 9l-6 6M17 9l6 6",
74
+ // muted
75
+ viewBox: "0 0 24 24"
76
+ },
77
+ "lock-unlock": {
78
+ from: "M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 0110 0v4",
79
+ // locked
80
+ to: "M19 11H5a2 2 0 00-2 2v7a2 2 0 002 2h14a2 2 0 002-2v-7a2 2 0 00-2-2zM7 11V7a5 5 0 019.9-1",
81
+ // unlocked
82
+ viewBox: "0 0 24 24"
83
+ },
84
+ "eye-hidden": {
85
+ from: "M1 12s4-8 11-8 11 8 11 8-4 8-11 8-11-8-11-8zM12 9a3 3 0 100 6 3 3 0 000-6z",
86
+ // eye open
87
+ to: "M17.94 17.94A10.07 10.07 0 0112 20c-7 0-11-8-11-8a18.45 18.45 0 015.06-5.94M9.9 4.24A9.12 9.12 0 0112 4c7 0 11 8 11 8a18.5 18.5 0 01-2.16 3.19m-6.72-1.07a3 3 0 11-4.24-4.24M1 1l22 22",
88
+ // eye hidden
89
+ viewBox: "0 0 24 24"
90
+ },
91
+ "heart-broken": {
92
+ from: "M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 000-7.78z",
93
+ // heart full
94
+ to: "M20.84 4.61a5.5 5.5 0 00-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 00-7.78 7.78L12 21.23l8.84-8.84a5.5 5.5 0 000-7.78zM12 5.67l-2 6 4-2-2 6",
95
+ // heart broken
96
+ viewBox: "0 0 24 24"
97
+ },
98
+ "star-empty": {
99
+ from: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
100
+ // star filled
101
+ to: "M12 2l3.09 6.26L22 9.27l-5 4.87 1.18 6.88L12 17.77l-6.18 3.25L7 14.14 2 9.27l6.91-1.01L12 2z",
102
+ // same path, different fill
103
+ viewBox: "0 0 24 24"
104
+ }
85
105
  };
86
- /* ────────────────────────────────────────────────────────────────────────────
87
- STYLES
88
- ───────────────────────────────────────────────────────────────────────────── */
89
- const morphStyles = `
90
- .ntd-morph-container {
91
- display: inline-flex;
92
- align-items: center;
93
- justify-content: center;
94
- position: relative;
95
- }
96
-
97
- .ntd-morph-icon {
98
- position: absolute;
99
- top: 0;
100
- left: 0;
101
- transition-property: opacity, transform;
102
- }
103
-
104
- .ntd-morph-icon--active {
105
- opacity: 1;
106
- transform: scale(1) rotate(0deg);
107
- }
108
-
109
- .ntd-morph-icon--inactive {
110
- opacity: 0;
111
- transform: scale(0.8) rotate(-15deg);
112
- }
113
-
114
- .ntd-morph-path {
115
- transition-property: d, fill, stroke;
116
- }
117
-
118
- @keyframes ntd-morph-spin {
119
- from { transform: rotate(0deg); }
120
- to { transform: rotate(180deg); }
121
- }
122
-
123
- .ntd-morph-spinning .ntd-morph-icon {
124
- animation: ntd-morph-spin 0.3s ease-in-out;
125
- }
106
+ const morphStyles = `
107
+ .ntd-morph-container {
108
+ display: inline-flex;
109
+ align-items: center;
110
+ justify-content: center;
111
+ position: relative;
112
+ }
113
+
114
+ .ntd-morph-icon {
115
+ position: absolute;
116
+ top: 0;
117
+ left: 0;
118
+ transition-property: opacity, transform;
119
+ }
120
+
121
+ .ntd-morph-icon--active {
122
+ opacity: 1;
123
+ transform: scale(1) rotate(0deg);
124
+ }
125
+
126
+ .ntd-morph-icon--inactive {
127
+ opacity: 0;
128
+ transform: scale(0.8) rotate(-15deg);
129
+ }
130
+
131
+ .ntd-morph-path {
132
+ transition-property: d, fill, stroke;
133
+ }
134
+
135
+ @keyframes ntd-morph-spin {
136
+ from { transform: rotate(0deg); }
137
+ to { transform: rotate(180deg); }
138
+ }
139
+
140
+ .ntd-morph-spinning .ntd-morph-icon {
141
+ animation: ntd-morph-spin 0.3s ease-in-out;
142
+ }
126
143
  `;
127
- /* ────────────────────────────────────────────────────────────────────────────
128
- MAIN COMPONENT
129
- ───────────────────────────────────────────────────────────────────────────── */
130
- /**
131
- * Icon morphing component for smooth transitions between two icons.
132
- *
133
- * @example
134
- * ```tsx
135
- * // Controlled state
136
- * <NtdIconMorph
137
- * from={NtdMenu}
138
- * to={NtdClose}
139
- * morphed={isOpen}
140
- * duration={300}
141
- * />
142
- *
143
- * // Self-managed with trigger
144
- * <NtdIconMorph
145
- * from={NtdPlay}
146
- * to={NtdPause}
147
- * trigger="click"
148
- * />
149
- * ```
150
- */
151
144
  const NtdIconMorph = /* @__PURE__ */ Object.assign(
152
- /* @__PURE__ */ React.forwardRef(({ from: FromIcon, to: ToIcon, morphed: controlledMorphed, trigger = 'none', duration = 300, easing = 'ease-in-out', size = 'md', variant = 'solid', primaryColor = 'currentColor', secondaryColor, onMorphStart, onMorphEnd, className, style, 'aria-label': ariaLabel, }, ref) => {
153
- var _a, _b;
154
- // Internal state for self-managed triggers
155
- const [internalMorphed, setInternalMorphed] = React.useState(false);
156
- const morphed = controlledMorphed !== null && controlledMorphed !== void 0 ? controlledMorphed : internalMorphed;
157
- const [isAnimating, setIsAnimating] = React.useState(false);
158
- const timeoutRef = React.useRef(undefined);
159
- const stylesInjectedRef = React.useRef(false);
160
- // Resolve size
161
- const resolvedSize = typeof size === 'number' ? size : ((_a = types.SIZE_MAP[size]) !== null && _a !== void 0 ? _a : 24);
162
- // Resolve easing
163
- const resolvedEasing = (_b = EASING_MAP[easing]) !== null && _b !== void 0 ? _b : easing;
164
- // Inject styles once
165
- React.useEffect(() => {
145
+ /* @__PURE__ */ React.forwardRef(
146
+ ({
147
+ from: FromIcon,
148
+ to: ToIcon,
149
+ morphed: controlledMorphed,
150
+ trigger = "none",
151
+ duration = 300,
152
+ easing = "ease-in-out",
153
+ size = "md",
154
+ variant = "solid",
155
+ primaryColor = "currentColor",
156
+ secondaryColor,
157
+ onMorphStart,
158
+ onMorphEnd,
159
+ className,
160
+ style,
161
+ "aria-label": ariaLabel
162
+ }, ref) => {
163
+ const [internalMorphed, setInternalMorphed] = React.useState(false);
164
+ const morphed = controlledMorphed ?? internalMorphed;
165
+ const [isAnimating, setIsAnimating] = React.useState(false);
166
+ const timeoutRef = React.useRef(void 0);
167
+ const stylesInjectedRef = React.useRef(false);
168
+ const resolvedSize = typeof size === "number" ? size : types.SIZE_MAP[size] ?? 24;
169
+ const resolvedEasing = EASING_MAP[easing] ?? easing;
170
+ React.useEffect(() => {
166
171
  if (stylesInjectedRef.current) {
167
- return;
172
+ return;
168
173
  }
169
- if (typeof document === 'undefined') {
170
- return;
174
+ if (typeof document === "undefined") {
175
+ return;
171
176
  }
172
- const styleId = 'ntd-morph-styles';
177
+ const styleId = "ntd-morph-styles";
173
178
  if (!document.getElementById(styleId)) {
174
- const styleEl = document.createElement('style');
175
- styleEl.id = styleId;
176
- styleEl.textContent = morphStyles;
177
- document.head.appendChild(styleEl);
179
+ const styleEl = document.createElement("style");
180
+ styleEl.id = styleId;
181
+ styleEl.textContent = morphStyles;
182
+ document.head.appendChild(styleEl);
178
183
  }
179
184
  stylesInjectedRef.current = true;
180
- }, []);
181
- // Handle animation timing
182
- React.useEffect(() => {
185
+ }, []);
186
+ React.useEffect(() => {
183
187
  return () => {
184
- if (timeoutRef.current) {
185
- clearTimeout(timeoutRef.current);
186
- }
188
+ if (timeoutRef.current) {
189
+ clearTimeout(timeoutRef.current);
190
+ }
187
191
  };
188
- }, []);
189
- const startMorph = React.useCallback((toMorphed) => {
190
- if (isAnimating) {
192
+ }, []);
193
+ const startMorph = React.useCallback(
194
+ (toMorphed) => {
195
+ if (isAnimating) {
191
196
  return;
192
- }
193
- setIsAnimating(true);
194
- onMorphStart === null || onMorphStart === void 0 ? void 0 : onMorphStart(toMorphed);
195
- if (controlledMorphed === undefined) {
197
+ }
198
+ setIsAnimating(true);
199
+ onMorphStart?.(toMorphed);
200
+ if (controlledMorphed === void 0) {
196
201
  setInternalMorphed(toMorphed);
197
- }
198
- timeoutRef.current = setTimeout(() => {
202
+ }
203
+ timeoutRef.current = setTimeout(() => {
199
204
  setIsAnimating(false);
200
- onMorphEnd === null || onMorphEnd === void 0 ? void 0 : onMorphEnd(toMorphed);
201
- }, duration);
202
- }, [isAnimating, duration, onMorphStart, onMorphEnd, controlledMorphed]);
203
- // Event handlers for triggers
204
- const handleClick = React.useCallback(() => {
205
- if (trigger === 'click') {
206
- startMorph(!morphed);
205
+ onMorphEnd?.(toMorphed);
206
+ }, duration);
207
+ },
208
+ [isAnimating, duration, onMorphStart, onMorphEnd, controlledMorphed]
209
+ );
210
+ const handleClick = React.useCallback(() => {
211
+ if (trigger === "click") {
212
+ startMorph(!morphed);
207
213
  }
208
- }, [trigger, morphed, startMorph]);
209
- const handleMouseEnter = React.useCallback(() => {
210
- if (trigger === 'hover') {
211
- startMorph(true);
214
+ }, [trigger, morphed, startMorph]);
215
+ const handleMouseEnter = React.useCallback(() => {
216
+ if (trigger === "hover") {
217
+ startMorph(true);
212
218
  }
213
- }, [trigger, startMorph]);
214
- const handleMouseLeave = React.useCallback(() => {
215
- if (trigger === 'hover') {
216
- startMorph(false);
219
+ }, [trigger, startMorph]);
220
+ const handleMouseLeave = React.useCallback(() => {
221
+ if (trigger === "hover") {
222
+ startMorph(false);
217
223
  }
218
- }, [trigger, startMorph]);
219
- const handleFocus = React.useCallback(() => {
220
- if (trigger === 'focus') {
221
- startMorph(true);
224
+ }, [trigger, startMorph]);
225
+ const handleFocus = React.useCallback(() => {
226
+ if (trigger === "focus") {
227
+ startMorph(true);
222
228
  }
223
- }, [trigger, startMorph]);
224
- const handleBlur = React.useCallback(() => {
225
- if (trigger === 'focus') {
226
- startMorph(false);
229
+ }, [trigger, startMorph]);
230
+ const handleBlur = React.useCallback(() => {
231
+ if (trigger === "focus") {
232
+ startMorph(false);
227
233
  }
228
- }, [trigger, startMorph]);
229
- const transitionStyle = {
234
+ }, [trigger, startMorph]);
235
+ const transitionStyle = {
230
236
  transitionDuration: `${duration}ms`,
231
- transitionTimingFunction: resolvedEasing,
232
- };
233
- const iconProps = {
237
+ transitionTimingFunction: resolvedEasing
238
+ };
239
+ const iconProps = {
234
240
  size: resolvedSize,
235
241
  variant,
236
242
  primaryColor,
237
- secondaryColor,
238
- };
239
- return (jsxRuntime.jsxs("div", { ref: ref, className: `ntd-morph-container ${className !== null && className !== void 0 ? className : ''}`, style: {
243
+ secondaryColor
244
+ };
245
+ return /* @__PURE__ */ jsxRuntime.jsxs(
246
+ "div",
247
+ {
248
+ ref,
249
+ className: `ntd-morph-container ${className ?? ""}`,
250
+ style: {
240
251
  width: resolvedSize,
241
252
  height: resolvedSize,
242
- cursor: trigger !== 'none' ? 'pointer' : undefined,
243
- ...style,
244
- }, onClick: handleClick, onKeyDown: (e) => {
245
- if (trigger === 'click' && (e.key === 'Enter' || e.key === ' ')) {
246
- e.preventDefault();
247
- handleClick();
253
+ cursor: trigger !== "none" ? "pointer" : void 0,
254
+ ...style
255
+ },
256
+ onClick: handleClick,
257
+ onKeyDown: (e) => {
258
+ if (trigger === "click" && (e.key === "Enter" || e.key === " ")) {
259
+ e.preventDefault();
260
+ handleClick();
248
261
  }
249
- }, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, onFocus: handleFocus, onBlur: handleBlur, tabIndex: trigger === 'focus' || trigger === 'click' ? 0 : undefined, role: trigger !== 'none' ? 'button' : undefined, "aria-label": ariaLabel, "aria-pressed": trigger !== 'none' ? morphed : undefined, children: [jsxRuntime.jsx("div", { className: `ntd-morph-icon ${morphed ? 'ntd-morph-icon--inactive' : 'ntd-morph-icon--active'}`, style: transitionStyle, "aria-hidden": morphed, children: jsxRuntime.jsx(FromIcon, { ...iconProps }) }), jsxRuntime.jsx("div", { className: `ntd-morph-icon ${morphed ? 'ntd-morph-icon--active' : 'ntd-morph-icon--inactive'}`, style: transitionStyle, "aria-hidden": !morphed, children: jsxRuntime.jsx(ToIcon, { ...iconProps }) })] }));
250
- }), { displayName: 'NtdIconMorph' });
251
- /**
252
- * Path-based morphing using CSS transitions on SVG path data.
253
- * Requires browser support for CSS `d` property transitions (modern browsers).
254
- *
255
- * @example
256
- * ```tsx
257
- * <NtdPathMorph
258
- * pair="menu-close"
259
- * morphed={isOpen}
260
- * duration={250}
261
- * color="#333"
262
- * />
263
- * ```
264
- */
262
+ },
263
+ onMouseEnter: handleMouseEnter,
264
+ onMouseLeave: handleMouseLeave,
265
+ onFocus: handleFocus,
266
+ onBlur: handleBlur,
267
+ tabIndex: trigger === "focus" || trigger === "click" ? 0 : void 0,
268
+ role: trigger !== "none" ? "button" : void 0,
269
+ "aria-label": ariaLabel,
270
+ "aria-pressed": trigger !== "none" ? morphed : void 0,
271
+ children: [
272
+ /* @__PURE__ */ jsxRuntime.jsx(
273
+ "div",
274
+ {
275
+ className: `ntd-morph-icon ${morphed ? "ntd-morph-icon--inactive" : "ntd-morph-icon--active"}`,
276
+ style: transitionStyle,
277
+ "aria-hidden": morphed,
278
+ children: /* @__PURE__ */ jsxRuntime.jsx(FromIcon, { ...iconProps })
279
+ }
280
+ ),
281
+ /* @__PURE__ */ jsxRuntime.jsx(
282
+ "div",
283
+ {
284
+ className: `ntd-morph-icon ${morphed ? "ntd-morph-icon--active" : "ntd-morph-icon--inactive"}`,
285
+ style: transitionStyle,
286
+ "aria-hidden": !morphed,
287
+ children: /* @__PURE__ */ jsxRuntime.jsx(ToIcon, { ...iconProps })
288
+ }
289
+ )
290
+ ]
291
+ }
292
+ );
293
+ }
294
+ ),
295
+ { displayName: "NtdIconMorph" }
296
+ );
265
297
  const NtdPathMorph = /* @__PURE__ */ Object.assign(
266
- /* @__PURE__ */ React.forwardRef(({ pair, morphed: controlledMorphed, trigger = 'none', duration = 300, easing = 'ease-in-out', size = 'md', color = 'currentColor', strokeWidth = 2, filled = false, onMorphStart, onMorphEnd, className, style, 'aria-label': ariaLabel, }, ref) => {
267
- var _a, _b;
268
- const { t } = uiCore.useNiceTranslation();
269
- const [internalMorphed, setInternalMorphed] = React.useState(false);
270
- const morphed = controlledMorphed !== null && controlledMorphed !== void 0 ? controlledMorphed : internalMorphed;
271
- const [isAnimating, setIsAnimating] = React.useState(false);
272
- const timeoutRef = React.useRef(undefined);
273
- const pathData = MORPH_PATHS[pair];
274
- const resolvedSize = typeof size === 'number' ? size : ((_a = types.SIZE_MAP[size]) !== null && _a !== void 0 ? _a : 24);
275
- const resolvedEasing = (_b = EASING_MAP[easing]) !== null && _b !== void 0 ? _b : easing;
276
- React.useEffect(() => {
298
+ /* @__PURE__ */ React.forwardRef(
299
+ ({
300
+ pair,
301
+ morphed: controlledMorphed,
302
+ trigger = "none",
303
+ duration = 300,
304
+ easing = "ease-in-out",
305
+ size = "md",
306
+ color = "currentColor",
307
+ strokeWidth = 2,
308
+ filled = false,
309
+ onMorphStart,
310
+ onMorphEnd,
311
+ className,
312
+ style,
313
+ "aria-label": ariaLabel
314
+ }, ref) => {
315
+ const { t } = uiCore.useNiceTranslation();
316
+ const [internalMorphed, setInternalMorphed] = React.useState(false);
317
+ const morphed = controlledMorphed ?? internalMorphed;
318
+ const [isAnimating, setIsAnimating] = React.useState(false);
319
+ const timeoutRef = React.useRef(void 0);
320
+ const pathData = MORPH_PATHS[pair];
321
+ const resolvedSize = typeof size === "number" ? size : types.SIZE_MAP[size] ?? 24;
322
+ const resolvedEasing = EASING_MAP[easing] ?? easing;
323
+ React.useEffect(() => {
277
324
  return () => {
278
- if (timeoutRef.current) {
279
- clearTimeout(timeoutRef.current);
280
- }
325
+ if (timeoutRef.current) {
326
+ clearTimeout(timeoutRef.current);
327
+ }
281
328
  };
282
- }, []);
283
- const startMorph = React.useCallback((toMorphed) => {
284
- if (isAnimating) {
329
+ }, []);
330
+ const startMorph = React.useCallback(
331
+ (toMorphed) => {
332
+ if (isAnimating) {
285
333
  return;
286
- }
287
- setIsAnimating(true);
288
- onMorphStart === null || onMorphStart === void 0 ? void 0 : onMorphStart(toMorphed);
289
- if (controlledMorphed === undefined) {
334
+ }
335
+ setIsAnimating(true);
336
+ onMorphStart?.(toMorphed);
337
+ if (controlledMorphed === void 0) {
290
338
  setInternalMorphed(toMorphed);
291
- }
292
- timeoutRef.current = setTimeout(() => {
339
+ }
340
+ timeoutRef.current = setTimeout(() => {
293
341
  setIsAnimating(false);
294
- onMorphEnd === null || onMorphEnd === void 0 ? void 0 : onMorphEnd(toMorphed);
295
- }, duration);
296
- }, [isAnimating, duration, onMorphStart, onMorphEnd, controlledMorphed]);
297
- const handleClick = React.useCallback(() => {
298
- if (trigger === 'click') {
299
- startMorph(!morphed);
342
+ onMorphEnd?.(toMorphed);
343
+ }, duration);
344
+ },
345
+ [isAnimating, duration, onMorphStart, onMorphEnd, controlledMorphed]
346
+ );
347
+ const handleClick = React.useCallback(() => {
348
+ if (trigger === "click") {
349
+ startMorph(!morphed);
300
350
  }
301
- }, [trigger, morphed, startMorph]);
302
- const handleMouseEnter = React.useCallback(() => {
303
- if (trigger === 'hover') {
304
- startMorph(true);
351
+ }, [trigger, morphed, startMorph]);
352
+ const handleMouseEnter = React.useCallback(() => {
353
+ if (trigger === "hover") {
354
+ startMorph(true);
305
355
  }
306
- }, [trigger, startMorph]);
307
- const handleMouseLeave = React.useCallback(() => {
308
- if (trigger === 'hover') {
309
- startMorph(false);
356
+ }, [trigger, startMorph]);
357
+ const handleMouseLeave = React.useCallback(() => {
358
+ if (trigger === "hover") {
359
+ startMorph(false);
310
360
  }
311
- }, [trigger, startMorph]);
312
- if (!pathData) {
361
+ }, [trigger, startMorph]);
362
+ if (!pathData) {
313
363
  console.warn(`NtdPathMorph: Unknown pair "${pair}"`);
314
364
  return null;
365
+ }
366
+ const currentPath = morphed ? pathData.to : pathData.from;
367
+ return /* @__PURE__ */ jsxRuntime.jsx(
368
+ "svg",
369
+ {
370
+ ref,
371
+ xmlns: "http://www.w3.org/2000/svg",
372
+ viewBox: pathData.viewBox,
373
+ width: resolvedSize,
374
+ height: resolvedSize,
375
+ className: `ntd-path-morph ${className ?? ""}`,
376
+ style: {
377
+ cursor: trigger !== "none" ? "pointer" : void 0,
378
+ ...style
379
+ },
380
+ onClick: handleClick,
381
+ onMouseEnter: handleMouseEnter,
382
+ onMouseLeave: handleMouseLeave,
383
+ role: trigger !== "none" ? "button" : "img",
384
+ "aria-label": ariaLabel ?? t("ntdIconMorph.icon", "{pair} icon").replace("{pair}", String(pair)),
385
+ "aria-pressed": trigger !== "none" ? morphed : void 0,
386
+ children: /* @__PURE__ */ jsxRuntime.jsx(
387
+ "path",
388
+ {
389
+ d: currentPath,
390
+ fill: filled ? color : "none",
391
+ stroke: filled ? "none" : color,
392
+ strokeWidth: filled ? 0 : strokeWidth,
393
+ strokeLinecap: "round",
394
+ strokeLinejoin: "round",
395
+ style: {
396
+ transition: `d ${duration}ms ${resolvedEasing}, fill ${duration}ms ${resolvedEasing}, stroke ${duration}ms ${resolvedEasing}`
397
+ }
398
+ }
399
+ )
400
+ }
401
+ );
315
402
  }
316
- const currentPath = morphed ? pathData.to : pathData.from;
317
- return (jsxRuntime.jsx("svg", { ref: ref, xmlns: "http://www.w3.org/2000/svg", viewBox: pathData.viewBox, width: resolvedSize, height: resolvedSize, className: `ntd-path-morph ${className !== null && className !== void 0 ? className : ''}`, style: {
318
- cursor: trigger !== 'none' ? 'pointer' : undefined,
319
- ...style,
320
- }, onClick: handleClick, onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, role: trigger !== 'none' ? 'button' : 'img', "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : t('ntdIconMorph.icon', '{pair} icon').replace('{pair}', String(pair)), "aria-pressed": trigger !== 'none' ? morphed : undefined, children: jsxRuntime.jsx("path", { d: currentPath, fill: filled ? color : 'none', stroke: filled ? 'none' : color, strokeWidth: filled ? 0 : strokeWidth, strokeLinecap: "round", strokeLinejoin: "round", style: {
321
- transition: `d ${duration}ms ${resolvedEasing}, fill ${duration}ms ${resolvedEasing}, stroke ${duration}ms ${resolvedEasing}`,
322
- } }) }));
323
- }), { displayName: 'NtdPathMorph' });
324
- /* ────────────────────────────────────────────────────────────────────────────
325
- PREDEFINED MORPH PAIR COMPONENT
326
- Convenience wrapper for common morphing patterns
327
- ───────────────────────────────────────────────────────────────────────────── */
328
- // Import icons lazily for predefined pairs
403
+ ),
404
+ { displayName: "NtdPathMorph" }
405
+ );
329
406
  const ICON_PAIRS = {
330
- 'menu-close': { from: navigation.NtdMenu, to: navigation.NtdClose },
331
- 'play-pause': { from: media.NtdPlay, to: media.NtdPause },
332
- 'plus-minus': { from: actions.NtdPlus, to: actions.NtdMinus },
333
- 'check-cross': { from: actions.NtdCheck, to: navigation.NtdClose }, // Using Close as X
334
- 'chevron-up-down': { from: navigation.NtdChevronUp, to: navigation.NtdChevronDown },
335
- 'expand-collapse': { from: actions.NtdPlus, to: actions.NtdMinus }, // simplified
336
- 'sun-moon': { from: ui.NtdSun, to: ui.NtdMoon },
337
- 'volume-mute': { from: media.NtdPlay, to: media.NtdPause }, // placeholder
338
- 'lock-unlock': { from: actions.NtdCheck, to: navigation.NtdClose }, // placeholder
339
- 'eye-hidden': { from: actions.NtdCheck, to: navigation.NtdClose }, // placeholder
340
- 'heart-broken': { from: actions.NtdCheck, to: navigation.NtdClose }, // placeholder
341
- 'star-empty': { from: actions.NtdCheck, to: navigation.NtdClose }, // placeholder
407
+ "menu-close": { from: navigation.NtdMenu, to: navigation.NtdClose },
408
+ "play-pause": { from: media.NtdPlay, to: media.NtdPause },
409
+ "plus-minus": { from: actions.NtdPlus, to: actions.NtdMinus },
410
+ "check-cross": { from: actions.NtdCheck, to: navigation.NtdClose },
411
+ // Using Close as X
412
+ "chevron-up-down": { from: navigation.NtdChevronUp, to: navigation.NtdChevronDown },
413
+ "expand-collapse": { from: actions.NtdPlus, to: actions.NtdMinus },
414
+ // simplified
415
+ "sun-moon": { from: ui.NtdSun, to: ui.NtdMoon },
416
+ "volume-mute": { from: media.NtdPlay, to: media.NtdPause },
417
+ // placeholder
418
+ "lock-unlock": { from: actions.NtdCheck, to: navigation.NtdClose },
419
+ // placeholder
420
+ "eye-hidden": { from: actions.NtdCheck, to: navigation.NtdClose },
421
+ // placeholder
422
+ "heart-broken": { from: actions.NtdCheck, to: navigation.NtdClose },
423
+ // placeholder
424
+ "star-empty": { from: actions.NtdCheck, to: navigation.NtdClose }
425
+ // placeholder
342
426
  };
343
- /**
344
- * Convenience component for predefined icon morph pairs.
345
- *
346
- * @example
347
- * ```tsx
348
- * <NtdMorphPair pair="menu-close" morphed={isMenuOpen} />
349
- * <NtdMorphPair pair="sun-moon" trigger="click" />
350
- * ```
351
- */
352
427
  const NtdMorphPair = /* @__PURE__ */ Object.assign(
353
- /* @__PURE__ */ React.forwardRef(({ pair, ...props }, ref) => {
428
+ /* @__PURE__ */ React.forwardRef(({ pair, ...props }, ref) => {
354
429
  const iconPair = ICON_PAIRS[pair];
355
430
  if (!iconPair) {
356
- console.warn(`NtdMorphPair: Unknown pair "${pair}"`);
357
- return null;
431
+ console.warn(`NtdMorphPair: Unknown pair "${pair}"`);
432
+ return null;
358
433
  }
359
- return jsxRuntime.jsx(NtdIconMorph, { ref: ref, from: iconPair.from, to: iconPair.to, ...props });
360
- }), { displayName: 'NtdMorphPair' });
361
- /**
362
- * Hook for managing morph state with animation awareness.
363
- *
364
- * @example
365
- * ```tsx
366
- * const { morphed, toggle, isAnimating } = useMorphState({ duration: 300 });
367
- *
368
- * return (
369
- * <button onClick={toggle} disabled={isAnimating}>
370
- * <NtdIconMorph from={NtdMenu} to={NtdClose} morphed={morphed} />
371
- * </button>
372
- * );
373
- * ```
374
- */
434
+ return /* @__PURE__ */ jsxRuntime.jsx(NtdIconMorph, { ref, from: iconPair.from, to: iconPair.to, ...props });
435
+ }),
436
+ { displayName: "NtdMorphPair" }
437
+ );
375
438
  function useMorphState(options = {}) {
376
- const { initial = false, duration = 300, onChange } = options;
377
- const [morphed, setMorphedState] = React.useState(initial);
378
- const [isAnimating, setIsAnimating] = React.useState(false);
379
- const timeoutRef = React.useRef(undefined);
380
- React.useEffect(() => {
381
- return () => {
382
- if (timeoutRef.current) {
383
- clearTimeout(timeoutRef.current);
384
- }
385
- };
386
- }, []);
387
- const setMorphed = React.useCallback((value) => {
388
- if (morphed === value || isAnimating) {
389
- return;
390
- }
391
- setIsAnimating(true);
392
- setMorphedState(value);
393
- onChange === null || onChange === void 0 ? void 0 : onChange(value);
394
- timeoutRef.current = setTimeout(() => {
395
- setIsAnimating(false);
396
- }, duration);
397
- }, [morphed, isAnimating, duration, onChange]);
398
- const toggle = React.useCallback(() => setMorphed(!morphed), [morphed, setMorphed]);
399
- const morph = React.useCallback(() => setMorphed(true), [setMorphed]);
400
- const unmorph = React.useCallback(() => setMorphed(false), [setMorphed]);
401
- return { morphed, toggle, morph, unmorph, setMorphed, isAnimating };
439
+ const { initial = false, duration = 300, onChange } = options;
440
+ const [morphed, setMorphedState] = React.useState(initial);
441
+ const [isAnimating, setIsAnimating] = React.useState(false);
442
+ const timeoutRef = React.useRef(void 0);
443
+ React.useEffect(() => {
444
+ return () => {
445
+ if (timeoutRef.current) {
446
+ clearTimeout(timeoutRef.current);
447
+ }
448
+ };
449
+ }, []);
450
+ const setMorphed = React.useCallback(
451
+ (value) => {
452
+ if (morphed === value || isAnimating) {
453
+ return;
454
+ }
455
+ setIsAnimating(true);
456
+ setMorphedState(value);
457
+ onChange?.(value);
458
+ timeoutRef.current = setTimeout(() => {
459
+ setIsAnimating(false);
460
+ }, duration);
461
+ },
462
+ [morphed, isAnimating, duration, onChange]
463
+ );
464
+ const toggle = React.useCallback(() => setMorphed(!morphed), [morphed, setMorphed]);
465
+ const morph = React.useCallback(() => setMorphed(true), [setMorphed]);
466
+ const unmorph = React.useCallback(() => setMorphed(false), [setMorphed]);
467
+ return { morphed, toggle, morph, unmorph, setMorphed, isAnimating };
402
468
  }
403
-
404
469
  exports.NtdIconMorph = NtdIconMorph;
405
470
  exports.NtdMorphPair = NtdMorphPair;
406
471
  exports.NtdPathMorph = NtdPathMorph;