trepur_components 2.3.3 → 2.3.5

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 (254) hide show
  1. package/.eslintrc.cjs +43 -0
  2. package/.husky/pre-commit +4 -0
  3. package/.prettierrc.json +22 -0
  4. package/archive/Breadcrumbs/Breadcrumbs.stories.tsx +46 -0
  5. package/archive/Breadcrumbs/index.tsx +42 -0
  6. package/archive/BreadcrumbsBordered/BreadcrumbsBordered.stories.tsx +52 -0
  7. package/archive/BreadcrumbsBordered/index.tsx +44 -0
  8. package/archive/BreadcrumbsItem/BreadcrumbsItem.stories.tsx +40 -0
  9. package/archive/BreadcrumbsItem/index.tsx +149 -0
  10. package/archive/Button/Button.stories.tsx +150 -0
  11. package/archive/Button/index.tsx +111 -0
  12. package/archive/Button/style.module.css +76 -0
  13. package/archive/Calendar/Calendar.stories.tsx +82 -0
  14. package/archive/Calendar/index.tsx +76 -0
  15. package/archive/Calendar/style.css +233 -0
  16. package/archive/Card/Card.stories.tsx +75 -0
  17. package/archive/Card/index.tsx +102 -0
  18. package/archive/Card/style.module.css +75 -0
  19. package/archive/CardWithTopImage/CardWithTopImage.stories.tsx +50 -0
  20. package/archive/CardWithTopImage/index.tsx +39 -0
  21. package/archive/CardWithTopImage/style.module.css +11 -0
  22. package/archive/Carousel/Carousel.stories.tsx +451 -0
  23. package/archive/Carousel/index.tsx +388 -0
  24. package/archive/Carousel/style.module.css +99 -0
  25. package/archive/CarouselThumbnail/CarouselThumbnail.stories.tsx +350 -0
  26. package/archive/CarouselThumbnail/index.tsx +302 -0
  27. package/archive/CarouselThumbnail/style.module.css +67 -0
  28. package/archive/Checkbox/Checkbox.mdx +33 -0
  29. package/archive/Checkbox/Checkbox.stories.tsx +34 -0
  30. package/archive/Checkbox/index.tsx +51 -0
  31. package/archive/Checkbox/style.module.css +15 -0
  32. package/archive/Collapsible/Collapsible.stories.tsx +67 -0
  33. package/archive/Collapsible/index.tsx +116 -0
  34. package/archive/Collapsible/style.module.css +47 -0
  35. package/archive/Column/Column.stories.tsx +89 -0
  36. package/archive/Column/index.tsx +119 -0
  37. package/archive/Column/style.module.css +151 -0
  38. package/archive/ComponentWrapper/ComponentWrapper.stories.tsx +40 -0
  39. package/archive/ComponentWrapper/index.tsx +55 -0
  40. package/archive/ComponentWrapper/style.module.css +40 -0
  41. package/archive/Container/Container.stories.tsx +40 -0
  42. package/archive/Container/index.tsx +24 -0
  43. package/archive/Container/style.module.css +4 -0
  44. package/archive/Counter/Counter.stories.tsx +19 -0
  45. package/archive/Counter/index.tsx +66 -0
  46. package/archive/Counter/style.module.css +19 -0
  47. package/archive/DetailUpdater/DetailUpdater.stories.tsx +96 -0
  48. package/archive/DetailUpdater/index.tsx +112 -0
  49. package/archive/DetailUpdater/style.module.css +31 -0
  50. package/archive/Dialog/Dialog.stories.tsx +131 -0
  51. package/archive/Dialog/index.tsx +91 -0
  52. package/archive/Dialog/style.module.css +44 -0
  53. package/archive/DropdownMenu/DropdownMenu.stories.tsx +59 -0
  54. package/archive/DropdownMenu/index.tsx +51 -0
  55. package/archive/DropdownMenu/style.module.css +38 -0
  56. package/archive/DynamicTextSection/DynamicTextSection.stories.tsx +74 -0
  57. package/archive/DynamicTextSection/index.tsx +36 -0
  58. package/archive/DynamicTextSection/style.module.css +0 -0
  59. package/archive/FileUploader/FilePreview.tsx +48 -0
  60. package/archive/FileUploader/FileUploader.stories.tsx +28 -0
  61. package/archive/FileUploader/index.tsx +135 -0
  62. package/archive/FileUploader/style.module.css +54 -0
  63. package/archive/FilterItem/FilterItem.stories.tsx +33 -0
  64. package/archive/FilterItem/index.tsx +101 -0
  65. package/archive/FilterItem/style.module.css +27 -0
  66. package/archive/Footer/Footer.stories.tsx +59 -0
  67. package/archive/Footer/index.tsx +50 -0
  68. package/archive/Footer/style.module.css +19 -0
  69. package/archive/FooterNav/FooterNav.stories.tsx +125 -0
  70. package/archive/FooterNav/index.tsx +57 -0
  71. package/archive/FooterNav/style.module.css +32 -0
  72. package/archive/FooterNavItem/FooterNavItem.stories.tsx +53 -0
  73. package/archive/FooterNavItem/index.tsx +80 -0
  74. package/archive/FooterNavItem/style.module.css +139 -0
  75. package/archive/Form/Form.stories.tsx +86 -0
  76. package/archive/Form/index.tsx +61 -0
  77. package/archive/Form/style.module.css +0 -0
  78. package/archive/FyreCard/FyreCard.stories.tsx +31 -0
  79. package/archive/FyreCard/index.tsx +52 -0
  80. package/archive/FyreCard/style.module.css +19 -0
  81. package/archive/Greeting/Greeting.stories.tsx +41 -0
  82. package/archive/Greeting/index.tsx +32 -0
  83. package/archive/HamburgerIcon/HamburgerIcon.stories.tsx +32 -0
  84. package/archive/HamburgerIcon/index.tsx +103 -0
  85. package/archive/HamburgerIcon/style.module.css +85 -0
  86. package/archive/HorizontalLine/HorizontalLine.stories.tsx +54 -0
  87. package/archive/HorizontalLine/index.tsx +40 -0
  88. package/archive/HorizontalLine/style.module.css +55 -0
  89. package/archive/Icon/Icon.stories.tsx +164 -0
  90. package/archive/Icon/index.tsx +115 -0
  91. package/archive/Icon/style.module.css +253 -0
  92. package/archive/IconCard/IconCard.stories.tsx +46 -0
  93. package/archive/IconCard/index.tsx +57 -0
  94. package/archive/IconCard/style.module.css +18 -0
  95. package/archive/Image/Image.stories.tsx +87 -0
  96. package/archive/Image/index.tsx +132 -0
  97. package/archive/Image/style.module.css +109 -0
  98. package/archive/ImageInfo/ImageInfo.stories.tsx +39 -0
  99. package/archive/ImageInfo/index.tsx +95 -0
  100. package/archive/ImageInfo/style.module.css +47 -0
  101. package/archive/ImageLink/ImageLink.stories.tsx +37 -0
  102. package/archive/ImageLink/index.tsx +49 -0
  103. package/archive/ImageLink/style.module.css +23 -0
  104. package/archive/ImageLinkList/ImageLinkList.stories.tsx +34 -0
  105. package/archive/ImageLinkList/index.tsx +33 -0
  106. package/archive/ImageLinkList/style.module.css +3 -0
  107. package/archive/InformationIcon/InformationIcon.stories.tsx +83 -0
  108. package/archive/InformationIcon/index.tsx +128 -0
  109. package/archive/InformationIcon/style.module.css +71 -0
  110. package/archive/InformationIconBlock/InformationIconBlock.stories.tsx +32 -0
  111. package/archive/InformationIconBlock/index.tsx +63 -0
  112. package/archive/InformationIconBlock/style.module.css +7 -0
  113. package/archive/Input/Input.stories.tsx +84 -0
  114. package/archive/Input/index.tsx +131 -0
  115. package/archive/Input/style.module.css +60 -0
  116. package/archive/Jumbotron/Jumbotron.stories.tsx +21 -0
  117. package/archive/Jumbotron/index.tsx +31 -0
  118. package/archive/Jumbotron/style.module.css +8 -0
  119. package/archive/MenuButton/MenuButton.stories.tsx +46 -0
  120. package/archive/MenuButton/index.tsx +82 -0
  121. package/archive/MenuButton/style.module.css +45 -0
  122. package/archive/Modal/Modal.stories.tsx +86 -0
  123. package/archive/Modal/index.tsx +74 -0
  124. package/archive/Modal/style.module.css +35 -0
  125. package/archive/NavItem/NavItem.stories.tsx +90 -0
  126. package/archive/NavItem/index.tsx +65 -0
  127. package/archive/NavItem/style.module.css +71 -0
  128. package/archive/NavOld/NavOld.stories.tsx +193 -0
  129. package/archive/NavOld/StickyNav.tsx +191 -0
  130. package/archive/NavOld/index.tsx +273 -0
  131. package/archive/NavOld/style.module.css +156 -0
  132. package/archive/NavTwo/Dropdown.tsx +35 -0
  133. package/archive/NavTwo/Nav.stories.tsx +38 -0
  134. package/archive/NavTwo/Sidebar.tsx +34 -0
  135. package/archive/NavTwo/StickyNav.tsx +34 -0
  136. package/archive/NavTwo/index.tsx +45 -0
  137. package/archive/NavTwo/style.module.css +35 -0
  138. package/archive/NewsCard/NewsCard.stories.tsx +72 -0
  139. package/archive/NewsCard/index.tsx +57 -0
  140. package/archive/NewsCard/style.module.css +15 -0
  141. package/archive/Pill/Pill.stories.tsx +44 -0
  142. package/archive/Pill/index.tsx +64 -0
  143. package/archive/Pill/style.module.css +32 -0
  144. package/archive/ProductCard/ProductCard.stories.tsx +61 -0
  145. package/archive/ProductCard/index.tsx +111 -0
  146. package/archive/ProductCard/style.module.css +53 -0
  147. package/archive/ProductCardV2/ProductCardV2.stories.tsx +50 -0
  148. package/archive/ProductCardV2/index.tsx +119 -0
  149. package/archive/ProductCardV2/style.module.css +59 -0
  150. package/archive/Proficiencies/Proficiencies.stories.tsx +50 -0
  151. package/archive/Proficiencies/index.tsx +63 -0
  152. package/archive/Proficiencies/style.module.css +31 -0
  153. package/archive/Profile/Profile.stories.tsx +49 -0
  154. package/archive/Profile/index.tsx +103 -0
  155. package/archive/Profile/style.module.css +47 -0
  156. package/archive/Row/Row.stories.tsx +53 -0
  157. package/archive/Row/index.tsx +23 -0
  158. package/archive/Row/style.module.css +3 -0
  159. package/archive/Search/Search.stories.tsx +63 -0
  160. package/archive/Search/index.tsx +68 -0
  161. package/archive/Search/style.module.css +23 -0
  162. package/archive/Select/Select.stories.tsx +56 -0
  163. package/archive/Select/index.tsx +106 -0
  164. package/archive/Select/style.module.css +52 -0
  165. package/archive/Showcase/Showcase.stories.tsx +30 -0
  166. package/archive/Showcase/index.tsx +75 -0
  167. package/archive/Showcase/style.module.css +47 -0
  168. package/archive/SideNav/SideNav.stories.tsx +50 -0
  169. package/archive/SideNav/index.tsx +46 -0
  170. package/archive/SideNav/style.module.css +43 -0
  171. package/archive/SocialBlock/SocialBlock.stories.tsx +58 -0
  172. package/archive/SocialBlock/index.tsx +63 -0
  173. package/archive/SocialButton/SocialButton.stories.tsx +88 -0
  174. package/archive/SocialButton/index.tsx +71 -0
  175. package/archive/SocialButton/style.module.css +77 -0
  176. package/archive/StarRating/StarRating.stories.tsx +23 -0
  177. package/archive/StarRating/index.tsx +71 -0
  178. package/archive/Testimonial/Testimonial.stories.tsx +110 -0
  179. package/archive/Testimonial/index.tsx +61 -0
  180. package/archive/Testimonial/style.module.css +27 -0
  181. package/archive/TextAndTitle/TextAndTitle.stories.tsx +70 -0
  182. package/archive/TextAndTitle/index.tsx +123 -0
  183. package/archive/TextAndTitle/style.module.css +75 -0
  184. package/archive/TextArea/TextArea.stories.tsx +55 -0
  185. package/archive/TextArea/index.tsx +125 -0
  186. package/archive/TextArea/style.module.css +60 -0
  187. package/archive/Timeline/Timeline.stories.tsx +92 -0
  188. package/archive/Timeline/index.tsx +254 -0
  189. package/archive/Timeline/style.module.css +134 -0
  190. package/archive/TimelineV2/TimelineV2.stories.tsx +95 -0
  191. package/archive/TimelineV2/index.tsx +70 -0
  192. package/archive/TimelineV2/style.module.css +28 -0
  193. package/archive/Tubestops/Tubestops.stories.tsx +42 -0
  194. package/archive/Tubestops/index.tsx +58 -0
  195. package/archive/Tubestops/style.module.css +54 -0
  196. package/archive/UserIcon/UserIcon.stories.tsx +52 -0
  197. package/archive/UserIcon/index.tsx +46 -0
  198. package/archive/UserIcon/style.module.css +19 -0
  199. package/archive/Video/Video.stories.tsx +23 -0
  200. package/archive/Video/index.tsx +47 -0
  201. package/archive/fonts/Sora/OFL.txt +93 -0
  202. package/archive/fonts/Sora/README.txt +70 -0
  203. package/archive/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
  204. package/archive/fonts/Sora/static/Sora-Bold.ttf +0 -0
  205. package/archive/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
  206. package/archive/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
  207. package/archive/fonts/Sora/static/Sora-Light.ttf +0 -0
  208. package/archive/fonts/Sora/static/Sora-Medium.ttf +0 -0
  209. package/archive/fonts/Sora/static/Sora-Regular.ttf +0 -0
  210. package/archive/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
  211. package/archive/fonts/Sora/static/Sora-Thin.ttf +0 -0
  212. package/archive/theme.ts +39 -0
  213. package/archive/typography/Fonts/Fonts.stories.tsx +14 -0
  214. package/archive/typography/Fonts/Fonts.tsx +181 -0
  215. package/lib/components/Accordion/index.js +10 -10
  216. package/lib/components/AlertBar/index.js +10 -10
  217. package/lib/components/index.d.ts +4 -0
  218. package/lib/index.js +1 -7
  219. package/lib/styles/base.css +1 -0
  220. package/package.json +6 -8
  221. package/postcss.config.js +8 -0
  222. package/src/components/Accordion/Accordion.stories.tsx +116 -0
  223. package/src/components/Accordion/index.tsx +30 -0
  224. package/src/components/AlertBar/AlertBar.stories.tsx +95 -0
  225. package/src/components/AlertBar/index.tsx +115 -0
  226. package/src/components/Avatar/Avatar.stories.tsx +19 -0
  227. package/src/components/Avatar/index.tsx +495 -0
  228. package/src/components/index.ts +119 -0
  229. package/src/documentation/Colours.mdx +192 -0
  230. package/src/documentation/Introduction.mdx +9 -0
  231. package/src/index.ts +1 -0
  232. package/src/styles/base.css +117 -0
  233. package/src/utils/controls.ts +44 -0
  234. package/src/utils/matchMedia.ts +9 -0
  235. package/src/utils/screens.ts +7 -0
  236. package/svg.d.ts +4 -0
  237. package/tailwind.config.ts +81 -0
  238. package/tsconfig.json +43 -0
  239. package/tsconfig.node.json +12 -0
  240. package/vite.config.mjs +64 -0
  241. package/lib/archive/Breadcrumbs/index.js +0 -12
  242. package/lib/archive/BreadcrumbsBordered/index.js +0 -25
  243. package/lib/archive/BreadcrumbsItem/index.js +0 -117
  244. package/lib/src/components/index.d.ts +0 -7
  245. /package/lib/{src/components → components}/Accordion/Accordion.stories.d.ts +0 -0
  246. /package/lib/{src/components → components}/Accordion/index.d.ts +0 -0
  247. /package/lib/{src/components → components}/AlertBar/AlertBar.stories.d.ts +0 -0
  248. /package/lib/{src/components → components}/AlertBar/index.d.ts +0 -0
  249. /package/lib/{src/components → components}/Avatar/Avatar.stories.d.ts +0 -0
  250. /package/lib/{src/components → components}/Avatar/index.d.ts +0 -0
  251. /package/lib/{src/index.d.ts → index.d.ts} +0 -0
  252. /package/lib/{src/utils → utils}/controls.d.ts +0 -0
  253. /package/lib/{src/utils → utils}/matchMedia.d.ts +0 -0
  254. /package/lib/{src/utils → utils}/screens.d.ts +0 -0
@@ -0,0 +1,495 @@
1
+ import React, { useEffect, useState } from 'react';
2
+
3
+ let Snap: any;
4
+ if (typeof window !== 'undefined') {
5
+ Snap = require('snapsvg-cjs');
6
+ }
7
+ const Avatar: React.FC = (): any => {
8
+ const [s, setS] = useState(null);
9
+
10
+ let rightEyeWhite: any,
11
+ rightEyePupil: any,
12
+ leftEyeWhite: any,
13
+ leftEyePupil: any,
14
+ avatar: any,
15
+ armless: any,
16
+ torso: any,
17
+ face: any,
18
+ legs: any,
19
+ rightArm: any,
20
+ leftArm: any,
21
+ rightHand: any,
22
+ leftHand: any,
23
+ arms: any,
24
+ straps: any,
25
+ hands: any,
26
+ leftThigh: any,
27
+ rightThigh: any,
28
+ leftShoe: any,
29
+ rightShoe: any;
30
+
31
+ const leftShoulderRotationPoints = '175, 202';
32
+ const rightShoulderRotationPoints = '94, 202';
33
+ const svgContainerHeight = 400;
34
+ const svgContainerWidth = 265;
35
+ const skinColour = '#FFCC9A';
36
+ const zipColour = '#315107';
37
+ const eyeColour = '#1389BF';
38
+ const hairColour = '#F1B452';
39
+ const beardColour = '#F1B452';
40
+ const rucksackColour = '#072765';
41
+ const trouserColour = '#D3D3D3';
42
+ const jacketColour = '#416E0A';
43
+ const mouthColour = '#DC7144';
44
+ const shoeColour = '#000000';
45
+ const eyebrowColour = '#F1B452';
46
+ const noseColour = '#F1B452';
47
+
48
+ const createAvatar = (s: any, callBack: any): void => {
49
+ if (typeof window === 'undefined') return;
50
+ const head = s?.rect(103, 90, 68, 87, 50).attr({ fill: skinColour });
51
+
52
+ const leftEyebrow = s?.rect(146, 122, 12, 3, 2);
53
+ const rightEyebrow = s?.rect(115, 122, 12, 3, 2);
54
+
55
+ leftEyeWhite = s?.ellipse(152, 132, 6, 4);
56
+ rightEyeWhite = s?.ellipse(121, 132, 6, 4);
57
+ leftEyePupil = s?.ellipse(152, 132, 3, 3).attr({ fill: eyeColour });
58
+ rightEyePupil = s?.ellipse(121, 132, 3, 3).attr({ fill: eyeColour });
59
+
60
+ const leftEye = s?.group(leftEyeWhite, leftEyePupil);
61
+ const rightEye = s?.group(rightEyeWhite, rightEyePupil);
62
+
63
+ const outerBeard = s?.rect(103, 90, 68, 87, 50).attr({ fill: 'white' });
64
+ const innerBeard = s?.rect(106, 105, 62, 62, 50);
65
+ const beardGroup = s?.group(outerBeard, innerBeard);
66
+ const beard = s?.rect(103, 140, 68, 60).attr({
67
+ mask: beardGroup,
68
+ fill: beardColour,
69
+ opacity: 0.6,
70
+ });
71
+
72
+ const outerHair = s?.rect(103, 90, 68, 60, 25).attr({ fill: 'white' });
73
+ const innerHair = s?.rect(109, 105, 56, 40, 10);
74
+ const hairGroup = s?.group(outerHair, innerHair);
75
+ const baseHair = s?.rect(103, 90, 68, 40).attr({
76
+ mask: hairGroup,
77
+ fill: hairColour,
78
+ });
79
+ const hairLevel1 = s
80
+ ?.rect(113, 88, 50, 16, 10)
81
+ .attr({ fill: hairColour })
82
+ .transform('r0');
83
+ const hair = s?.group(baseHair, hairLevel1);
84
+
85
+ const outerNose = s?.rect(129, 140, 12, 10, 30)?.attr({ fill: 'white' });
86
+ const innerNose = s?.rect(130, 142, 10, 12, 30);
87
+ const noseGroup = s?.group(outerNose, innerNose);
88
+ const nose = s?.rect(129, 140, 12, 10)?.attr({
89
+ mask: noseGroup,
90
+ fill: noseColour,
91
+ });
92
+
93
+ const leftEar = s?.circle(103, 135, 5)?.attr({ fill: 'white' });
94
+ const leftEarMask = s
95
+ ?.rect(89, 120, 15, 30)
96
+ .attr({
97
+ mask: leftEar,
98
+ fill: skinColour,
99
+ })
100
+ .transform('r-2');
101
+
102
+ const rightEar = s?.circle(171, 135, 5)?.attr({ fill: 'white' });
103
+ const rightEarMask = s
104
+ ?.rect(170, 120, 15, 30)
105
+ .attr({
106
+ mask: rightEar,
107
+ fill: skinColour,
108
+ })
109
+ .transform('r2');
110
+
111
+ const body = s
112
+ ?.rect(100, 188, 73, 105, 16, 16)
113
+ .attr({ fill: jacketColour });
114
+ const hood = s?.ellipse(136, 182, 24, 10).attr({ fill: jacketColour });
115
+
116
+ const rightShoulder = s?.rect(87, 190, 27, 14, 10);
117
+ rightArm = s?.rect(84, 195, 16, 90, 10, 10);
118
+
119
+ const leftShoulder = s?.rect(155, 190, 27, 14, 10);
120
+ leftArm = s?.rect(170, 195, 16, 90, 10, 10);
121
+
122
+ leftHand = s?.circle(178, 278, 8);
123
+ rightHand = s?.circle(92, 278, 8);
124
+
125
+ const wasteBand = s?.rect(98, 277, 74, 33, 0, 0);
126
+ leftThigh = s?.rect(142, 300, 30, 90, 0, 0);
127
+ rightThigh = s?.rect(98, 300, 30, 90, 0, 0);
128
+
129
+ const bag = s?.rect(99, 180, 74, 78, 10);
130
+ const rightStrap = s?.rect(101, 185, 5, 100, 10).transform('r4.5');
131
+ const leftStrap = s?.rect(163, 185, 5, 100, 10).transform('r-4.5');
132
+
133
+ const mouth = s?.circle(136, 155, 10).attr({ fill: 'white' });
134
+ const mouthCutOff = s?.rect(120, 155, 30, 15).attr({ fill: mouthColour });
135
+
136
+ const leftShoeTop = s?.rect(142, 370, 30, 20, 10);
137
+ const leftShoeSole = s?.rect(142, 378, 30, 12);
138
+
139
+ const rightShoeTop = s?.rect(98, 370, 30, 20, 10);
140
+ const rightShoeSole = s?.rect(98, 378, 30, 12);
141
+
142
+ const mainZip = s?.rect(135, 199, 3, 94);
143
+ const leftZip = s?.rect(141, 188, 2, 15).transform('r44.5');
144
+ const rightZip = s?.rect(130, 188, 2, 15).transform('r-44.5');
145
+
146
+ const centerNeck = s?.rect(128, 170, 17, 21);
147
+ const leftNeck = s?.rect(139, 181, 10, 10).transform('r-33');
148
+ const rightNeck = s?.rect(124, 181, 10, 10).transform('r33');
149
+ const frontNeck = s?.rect(129, 182, 15, 15).transform('r45');
150
+
151
+ const neck = s
152
+ ?.group(centerNeck, leftNeck, rightNeck, frontNeck)
153
+ .attr({ fill: skinColour });
154
+ const zip = s?.group(mainZip, leftZip, rightZip).attr({ fill: zipColour });
155
+ leftShoe = s?.group(leftShoeTop, leftShoeSole);
156
+ rightShoe = s?.group(rightShoeTop, rightShoeSole);
157
+ const rucksack = s
158
+ ?.group(leftStrap, rightStrap, bag)
159
+ .attr({ fill: rucksackColour });
160
+ const eyes = s?.group(leftEye, rightEye).attr({ fill: 'white' });
161
+ const eyebrows = s
162
+ ?.group(leftEyebrow, rightEyebrow)
163
+ .attr({ fill: eyebrowColour });
164
+ const shoes = s?.group(leftShoe, rightShoe).attr({ fill: shoeColour });
165
+ const ears = s?.group(leftEarMask, rightEarMask);
166
+
167
+ arms = s
168
+ ?.group(rightShoulder, leftShoulder, leftArm, rightArm)
169
+ .attr({ fill: jacketColour });
170
+ hands = s?.group(leftHand, rightHand).attr({ fill: skinColour });
171
+ straps = s?.group(leftStrap, rightStrap).attr({ fill: rucksackColour });
172
+
173
+ face = s?.group(
174
+ head,
175
+ eyes,
176
+ eyebrows,
177
+ nose,
178
+ mouth,
179
+ mouthCutOff,
180
+ ears,
181
+ hair,
182
+ beard,
183
+ );
184
+ torso = s?.group(rucksack, hood, body, neck, zip);
185
+ legs = s
186
+ ?.group(leftThigh, rightThigh, wasteBand, shoes)
187
+ .attr({ fill: trouserColour });
188
+
189
+ armless = s?.group(legs, torso, face);
190
+ avatar = s?.group(armless, arms, straps, hands);
191
+
192
+ mouthCutOff?.attr({
193
+ mask: mouth,
194
+ });
195
+
196
+ callBack(avatar);
197
+ };
198
+
199
+ const nextFrame = (s: any, frameArray: any, frame: number): void => {
200
+ if (frame >= frameArray.length) {
201
+ return;
202
+ }
203
+
204
+ Snap.animate(
205
+ frameArray[frame].from,
206
+ frameArray[frame].to,
207
+ frameArray[frame].funct,
208
+ frameArray[frame].dur,
209
+ null,
210
+ nextFrame.bind(null, Snap, frameArray, frame + 1),
211
+ );
212
+ };
213
+
214
+ const rightWave = [
215
+ {
216
+ funct: function (val: number) {
217
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
218
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
219
+ },
220
+ from: 0,
221
+ to: 170,
222
+ dur: 100,
223
+ },
224
+ {
225
+ funct: function (val: number) {
226
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
227
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
228
+ },
229
+ from: 170,
230
+ to: 120,
231
+ dur: 100,
232
+ },
233
+ {
234
+ funct: function (val: number) {
235
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
236
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
237
+ },
238
+ from: 120,
239
+ to: 170,
240
+ dur: 100,
241
+ },
242
+ {
243
+ funct: function (val: number) {
244
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
245
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
246
+ },
247
+ from: 170,
248
+ to: 120,
249
+ dur: 100,
250
+ },
251
+ {
252
+ funct: function (val: number) {
253
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
254
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
255
+ },
256
+ from: 120,
257
+ to: 170,
258
+ dur: 100,
259
+ },
260
+ {
261
+ funct: function (val: number) {
262
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
263
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
264
+ },
265
+ from: 170,
266
+ to: 120,
267
+ dur: 100,
268
+ },
269
+ {
270
+ funct: function (val: number) {
271
+ rightArm.transform(`r${val},${rightShoulderRotationPoints}`);
272
+ rightHand.transform(`r${val},${rightShoulderRotationPoints}`);
273
+ },
274
+ from: 120,
275
+ to: 0,
276
+ dur: 100,
277
+ },
278
+ ];
279
+
280
+ const leftWave = [
281
+ {
282
+ funct: function (val: number) {
283
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
284
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
285
+ },
286
+ from: 0,
287
+ to: -150,
288
+ dur: 100,
289
+ },
290
+ {
291
+ funct: function (val: number) {
292
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
293
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
294
+ },
295
+ from: -150,
296
+ to: -120,
297
+ dur: 100,
298
+ },
299
+ {
300
+ funct: function (val: number) {
301
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
302
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
303
+ },
304
+ from: -120,
305
+ to: -150,
306
+ dur: 100,
307
+ },
308
+ {
309
+ funct: function (val: number) {
310
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
311
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
312
+ },
313
+ from: -150,
314
+ to: -120,
315
+ dur: 100,
316
+ },
317
+ {
318
+ funct: function (val: number) {
319
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
320
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
321
+ },
322
+ from: -120,
323
+ to: -150,
324
+ dur: 100,
325
+ },
326
+ {
327
+ funct: function (val: number) {
328
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
329
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
330
+ },
331
+ from: -150,
332
+ to: -120,
333
+ dur: 100,
334
+ },
335
+ {
336
+ funct: function (val: number) {
337
+ leftArm.transform(`r${val},${leftShoulderRotationPoints}`);
338
+ leftHand.transform(`r${val},${leftShoulderRotationPoints}`);
339
+ },
340
+ from: -120,
341
+ to: 0,
342
+ dur: 100,
343
+ },
344
+ ];
345
+
346
+ const jump = (): void => {
347
+ torso.animate({ transform: 't0,20' }, 500);
348
+ arms.animate({ transform: 't0,20' }, 500);
349
+ straps.animate({ transform: 't0,20' }, 500);
350
+ hands.animate({ transform: 't0,20' }, 500);
351
+ face.animate({ transform: 't0,20' }, 500, function () {
352
+ face.animate({ transform: 't0,-70' }, 200);
353
+ torso.animate({ transform: 't0,-70' }, 200);
354
+ arms.animate({ transform: 't0,-70' }, 200);
355
+ straps.animate({ transform: 't0,-70' }, 200);
356
+ hands.animate({ transform: 't0,-70' }, 200);
357
+ legs.animate({ transform: 't0,-70' }, 200, function () {
358
+ face.animate({ transform: 't0,0' }, 200);
359
+ torso.animate({ transform: 't0,0' }, 200);
360
+ arms.animate({ transform: 't0,0' }, 200);
361
+ straps.animate({ transform: 't0,0' }, 200);
362
+ hands.animate({ transform: 't0,0' }, 200);
363
+ legs.animate({ transform: 't0,0' }, 200);
364
+ });
365
+ });
366
+ };
367
+
368
+ const eyesLeft = (duration: any): void => {
369
+ leftEyePupil.animate({ transform: 't2,0' }, duration);
370
+ rightEyePupil.animate({ transform: 't2,0' }, duration);
371
+ };
372
+
373
+ const eyesRight = (duration: any): void => {
374
+ leftEyePupil.animate({ transform: 't-2,0' }, duration);
375
+ rightEyePupil.animate({ transform: 't-2,0' }, duration);
376
+ };
377
+
378
+ const eyesCenter = (duration: any): void => {
379
+ leftEyePupil.animate({ transform: 't0,0' }, duration);
380
+ rightEyePupil.animate({ transform: 't0,0' }, duration);
381
+ };
382
+
383
+ const blink = (times: number): void => {
384
+ if (times < 1) return;
385
+ [...Array(times)].forEach((_) => {
386
+ leftEyeWhite?.animate({ ry: 0 }, 120);
387
+ leftEyePupil.animate({ ry: 0 }, 120);
388
+ rightEyeWhite?.animate({ ry: 0 }, 120);
389
+ rightEyePupil.animate({ ry: 0 }, 120, function () {
390
+ leftEyeWhite?.animate({ ry: 4 }, 200);
391
+ leftEyePupil?.animate({ ry: 3 }, 200);
392
+ rightEyeWhite?.animate({ ry: 4 }, 200);
393
+ rightEyePupil?.animate({ ry: 3 }, 200, () => {
394
+ blink(times - 1);
395
+ });
396
+ });
397
+ });
398
+ };
399
+
400
+ const animate = (s: any, animation: any): any => {
401
+ nextFrame(s, animation, 0);
402
+ };
403
+
404
+ // const drawPath = (s: any): void => {
405
+ // const linePath =
406
+ // "M46.5,433 q3.5,-153 7,-356 q59,-51 116,-5 q60,96 1,159 q-58,26 -116,2 q108,57 119,202 q26,-166 41,-371 q99,1 186,3 q28,108 -21,187 q-66,23 -160,-9 q154,79 133,143 q-82,59 -175,42";
407
+ // const lineLength: number = Snap.path.getTotalLength(linePath);
408
+ // const lineDraw = s?.path(linePath);
409
+ // lineDraw.attr({
410
+ // fill: "none",
411
+ // stroke: "#009FE3",
412
+ // "stroke-dasharray": `${lineLength} ${lineLength}`,
413
+ // "stroke-dashoffset": lineLength,
414
+ // "stroke-width": 6,
415
+ // "stroke-linecap": "round",
416
+ // "stroke-linejoin": "round",
417
+ // "stroke-miterlimit": 10,
418
+ // });
419
+ // lineDraw.animate(
420
+ // {
421
+ // strokeDashoffset: 0,
422
+ // },
423
+ // 3000,
424
+ // null
425
+ // );
426
+ // };
427
+
428
+ useEffect(() => {
429
+ if (typeof window === 'undefined') return;
430
+ if (Snap) {
431
+ setS(Snap('#svg'));
432
+ }
433
+
434
+ const makeBlinkHappen = (): void => {
435
+ const randNum = Math.floor(Math.random() * 2) + 1;
436
+ blink(randNum);
437
+ };
438
+
439
+ const loadActions = (): void => {
440
+ if (!avatar) return;
441
+
442
+ setTimeout(() => {
443
+ animate(s, leftWave);
444
+ }, 1000);
445
+
446
+ // drawPath(s)
447
+ setInterval(makeBlinkHappen, 3500);
448
+
449
+ rightArm?.click(() => animate(s, rightWave));
450
+ rightHand?.click(() => animate(s, rightWave));
451
+
452
+ leftArm?.click(() => animate(s, leftWave));
453
+ leftHand?.click(() => animate(s, leftWave));
454
+ armless?.click(jump);
455
+ leftArm?.hover(() => {
456
+ eyesLeft(200);
457
+ });
458
+ leftThigh?.hover(() => {
459
+ eyesLeft(200);
460
+ });
461
+ leftShoe?.hover(() => {
462
+ eyesLeft(200);
463
+ });
464
+
465
+ torso?.hover(() => {
466
+ eyesCenter(200);
467
+ });
468
+
469
+ rightArm?.hover(() => {
470
+ eyesRight(200);
471
+ });
472
+ rightThigh?.hover(() => {
473
+ eyesRight(200);
474
+ });
475
+ rightShoe?.hover(() => {
476
+ eyesRight(200);
477
+ });
478
+ };
479
+
480
+ createAvatar(s, loadActions);
481
+ }, [s]);
482
+
483
+ return (
484
+ <svg
485
+ id="svg"
486
+ className="mx-auto"
487
+ height={`${svgContainerHeight.toString()}px`}
488
+ width={`${svgContainerWidth.toString()}px`}
489
+ version="1.1"
490
+ xmlns="http://www.w3.org/2000/svg"
491
+ />
492
+ );
493
+ };
494
+
495
+ export default Avatar;
@@ -0,0 +1,119 @@
1
+ import Accordion from './Accordion';
2
+ import AlertBar from './AlertBar';
3
+ // import Breadcrumbs from '../../archive/Breadcrumbs';
4
+ // import BreadcrumbsBordered from '../../archive/BreadcrumbsBordered';
5
+ // import BreadcrumbsItem from '../../archive/BreadcrumbsItem';
6
+ // import Button from './Button';
7
+ // import Calendar from './Calendar';
8
+ // import Card from './Card';
9
+ // import CardWithTopImage from './CardWithTopImage';
10
+ // import Carousel from './Carousel';
11
+ // import CarouselThumbnail from './CarouselThumbnail';
12
+ // import Checkbox from './Checkbox';
13
+ // import Collapsible from './Collapsible';
14
+ // import Column from './Column';
15
+ // import Container from './Container';
16
+ // import Counter from './Counter';
17
+ // import DetailUpdater from './DetailUpdater';
18
+ // import Dialog from './Dialog';
19
+ // import DropdownMenu from './DropdownMenu';
20
+ // import DynamicTextSection from './DynamicTextSection';
21
+ // import FilterItem from './FilterItem';
22
+ // import FooterBar from './Footer';
23
+ // import FooterNav from './FooterNav';
24
+ // import FooterNavItem from './FooterNavItem';
25
+ // import Form from './Form';
26
+ // import FyreCard from './FyreCard';
27
+ // import Greeting from './Greeting';
28
+ // import HorizontalLine from './HorizontalLine';
29
+ // import Icon from './Icon';
30
+ // import IconCard from './IconCard';
31
+ // import Image from './Image';
32
+ // import ImageLink from './ImageLink';
33
+ // import ImageLinkList from './ImageLinkList';
34
+ // import InformationIcon from './InformationIcon';
35
+ // import Input from './Input';
36
+ // import Jumbotron from './Jumbotron';
37
+ // import MenuButton from './MenuButton';
38
+ // import Modal from './Modal';
39
+ // import NavItem from './NavItem';
40
+ // import NavOld from './NavOld';
41
+ // import Nav from './NavTwo';
42
+ // import NewsCard from './NewsCard';
43
+ // import Pill from './Pill';
44
+ // import ProductCard from './ProductCard';
45
+ // import ProductCardV2 from './ProductCardV2';
46
+ // import Profile from './Profile';
47
+ // import Row from './Row';
48
+ // import Search from './Search';
49
+ // import Select from './Select';
50
+ // import SocialBlock from './SocialBlock';
51
+ // import StarRating from './StarRating';
52
+ // import Testimonial from './Testimonial';
53
+ // import TextAndTitle from './TextAndTitle';
54
+ // import TextArea from './TextArea';
55
+ // import Timeline from './Timeline';
56
+ // import Tubestops from './Tubestops';
57
+ // import UserIcon from './UserIcon';
58
+ // import Video from '../../archive/Video';
59
+
60
+ export {
61
+ Accordion,
62
+ AlertBar,
63
+ // Breadcrumbs,
64
+ // BreadcrumbsBordered,
65
+ // BreadcrumbsItem,
66
+ // Button,
67
+ // Calendar,
68
+ // Card,
69
+ // CardWithTopImage,
70
+ // Checkbox,
71
+ // Carousel,
72
+ // CarouselThumbnail,
73
+ // Collapsible,
74
+ // Column,
75
+ // Counter,
76
+ // Container,
77
+ // DetailUpdater,
78
+ // DynamicTextSection,
79
+ // Dialog,
80
+ // DropdownMenu,
81
+ // FilterItem,
82
+ // Form,
83
+ // FooterBar,
84
+ // FooterNav,
85
+ // FooterNavItem,
86
+ // FyreCard,
87
+ // Greeting,
88
+ // HorizontalLine,
89
+ // Icon,
90
+ // IconCard,
91
+ // Image,
92
+ // ImageLink,
93
+ // ImageLinkList,
94
+ // InformationIcon,
95
+ // Input,
96
+ // Jumbotron,
97
+ // MenuButton,
98
+ // Modal,
99
+ // NavOld,
100
+ // Nav,
101
+ // NavItem,
102
+ // NewsCard,
103
+ // Pill,
104
+ // ProductCard,
105
+ // ProductCardV2,
106
+ // Profile,
107
+ // Row,
108
+ // Search,
109
+ // Select,
110
+ // SocialBlock,
111
+ // StarRating,
112
+ // Testimonial,
113
+ // TextAndTitle,
114
+ // TextArea,
115
+ // Timeline,
116
+ // Tubestops,
117
+ // UserIcon,
118
+ // Video,
119
+ };