@erpsquad/common 1.8.46 → 1.8.47

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 (255) hide show
  1. package/dist/_virtual/index/index.esm.js +4 -2
  2. package/dist/_virtual/index/index.esm.js.map +1 -1
  3. package/dist/_virtual/index/index.esm2.js +2 -4
  4. package/dist/_virtual/index/index.esm2.js.map +1 -1
  5. package/dist/_virtual/index/index.js +1 -1
  6. package/dist/_virtual/index/index2.js +1 -1
  7. package/dist/assets/index.d.ts +0 -1
  8. package/dist/components/charts/index.d.ts +3 -0
  9. package/dist/components/charts/line-chart/area-lineChart/index.esm.js +55 -0
  10. package/dist/components/charts/line-chart/area-lineChart/index.esm.js.map +1 -0
  11. package/dist/components/charts/line-chart/area-lineChart/index.js +2 -0
  12. package/dist/components/charts/line-chart/area-lineChart/index.js.map +1 -0
  13. package/dist/components/charts/{bar-chart/bar-chart → line-chart/line-chart}/index.esm.js +49 -27
  14. package/dist/components/charts/line-chart/line-chart/index.esm.js.map +1 -0
  15. package/dist/components/charts/line-chart/line-chart/index.js +2 -0
  16. package/dist/components/charts/line-chart/line-chart/index.js.map +1 -0
  17. package/dist/components/header/redux/reducer/index.esm.js +6 -1
  18. package/dist/components/header/redux/reducer/index.esm.js.map +1 -1
  19. package/dist/components/header/redux/reducer/index.js +1 -1
  20. package/dist/components/header/redux/reducer/index.js.map +1 -1
  21. package/dist/components/index.d.ts +9 -0
  22. package/dist/components/index.esm.js +273 -77
  23. package/dist/components/index.esm.js.map +1 -1
  24. package/dist/components/index.js +1 -1
  25. package/dist/components/material-table/aggregation-fns/index/index.esm.js +10 -0
  26. package/dist/components/material-table/aggregation-fns/index/index.esm.js.map +1 -1
  27. package/dist/components/material-table/aggregation-fns/index/index.js +1 -1
  28. package/dist/components/material-table/aggregation-fns/index/index.js.map +1 -1
  29. package/dist/components/material-table/components/number-aggregation/index.esm.js +134 -0
  30. package/dist/components/material-table/components/number-aggregation/index.esm.js.map +1 -0
  31. package/dist/components/material-table/components/number-aggregation/index.js +5 -0
  32. package/dist/components/material-table/components/number-aggregation/index.js.map +1 -0
  33. package/dist/components/reports-title-bar/redux/reducer/index.esm.js +2 -0
  34. package/dist/components/reports-title-bar/redux/reducer/index.esm.js.map +1 -1
  35. package/dist/components/reports-title-bar/redux/reducer/index.js +1 -1
  36. package/dist/components/reports-title-bar/redux/reducer/index.js.map +1 -1
  37. package/dist/components/reports-title-bar/report-buttons/report-buttons/index.esm.js +60 -0
  38. package/dist/components/reports-title-bar/report-buttons/report-buttons/index.esm.js.map +1 -0
  39. package/dist/components/reports-title-bar/report-buttons/report-buttons/index.js +2 -0
  40. package/dist/components/reports-title-bar/report-buttons/report-buttons/index.js.map +1 -0
  41. package/dist/components/reports-title-bar/reports-title-bar/index.esm.js +736 -0
  42. package/dist/components/reports-title-bar/reports-title-bar/index.esm.js.map +1 -0
  43. package/dist/components/reports-title-bar/reports-title-bar/index.js +39 -0
  44. package/dist/components/reports-title-bar/reports-title-bar/index.js.map +1 -0
  45. package/dist/components/select/controller/chip-or-placeholder/index.esm.js +25 -0
  46. package/dist/components/select/controller/chip-or-placeholder/index.esm.js.map +1 -0
  47. package/dist/components/select/controller/chip-or-placeholder/index.js +2 -0
  48. package/dist/components/select/controller/chip-or-placeholder/index.js.map +1 -0
  49. package/dist/components/select/controller/controller-select/index.esm.js +165 -0
  50. package/dist/components/select/controller/controller-select/index.esm.js.map +1 -0
  51. package/dist/components/select/controller/controller-select/index.js +10 -0
  52. package/dist/components/select/controller/controller-select/index.js.map +1 -0
  53. package/dist/components/share-modal/redux/reducer/index.esm.js +2 -0
  54. package/dist/components/share-modal/redux/reducer/index.esm.js.map +1 -1
  55. package/dist/components/share-modal/redux/reducer/index.js +1 -1
  56. package/dist/components/share-modal/redux/reducer/index.js.map +1 -1
  57. package/dist/index.esm.js +354 -136
  58. package/dist/index.esm.js.map +1 -1
  59. package/dist/index.js +1 -1
  60. package/dist/node_modules/@mui/icons-material/esm/Remove/index.esm.js +9 -0
  61. package/dist/node_modules/@mui/icons-material/esm/Remove/index.esm.js.map +1 -0
  62. package/dist/node_modules/@mui/icons-material/esm/Remove/index.js +2 -0
  63. package/dist/node_modules/@mui/icons-material/esm/Remove/index.js.map +1 -0
  64. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +1 -1
  65. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
  66. package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js.map +1 -1
  67. package/dist/node_modules/prop-types/index/index.esm.js +1 -1
  68. package/dist/node_modules/prop-types/index/index.js +1 -1
  69. package/dist/node_modules/prop-types/index/index.js.map +1 -1
  70. package/dist/src/assets/index.d.ts +0 -1
  71. package/dist/src/components/charts/index.d.ts +3 -0
  72. package/dist/src/components/index.d.ts +9 -1
  73. package/dist/src/views/afterAuth/index.d.ts +1 -0
  74. package/dist/src/views/beforeAuth/index.d.ts +0 -1
  75. package/dist/src/views/index.d.ts +1 -0
  76. package/dist/style.css +72 -72
  77. package/dist/views/afterAuth/dashboard/redux/reducer/index.esm.js +0 -6
  78. package/dist/views/afterAuth/dashboard/redux/reducer/index.esm.js.map +1 -1
  79. package/dist/views/afterAuth/dashboard/redux/reducer/index.js +1 -1
  80. package/dist/views/afterAuth/dashboard/redux/reducer/index.js.map +1 -1
  81. package/dist/views/afterAuth/index.d.ts +1 -0
  82. package/dist/views/afterAuth/page-view/page-view/index.esm.js +101 -0
  83. package/dist/views/afterAuth/page-view/page-view/index.esm.js.map +1 -0
  84. package/dist/views/afterAuth/page-view/page-view/index.js +6 -0
  85. package/dist/views/afterAuth/page-view/page-view/index.js.map +1 -0
  86. package/dist/views/afterAuth/page-view/redux/actionCreator/index.esm.js +13 -0
  87. package/dist/views/afterAuth/page-view/redux/actionCreator/index.esm.js.map +1 -0
  88. package/dist/views/afterAuth/page-view/redux/actionCreator/index.js +2 -0
  89. package/dist/views/afterAuth/page-view/redux/actionCreator/index.js.map +1 -0
  90. package/dist/views/afterAuth/page-view/redux/reducer/index.esm.js +63 -0
  91. package/dist/views/afterAuth/page-view/redux/reducer/index.esm.js.map +1 -0
  92. package/dist/views/afterAuth/page-view/redux/reducer/index.js +2 -0
  93. package/dist/views/afterAuth/page-view/redux/reducer/index.js.map +1 -0
  94. package/dist/views/afterAuth/page-view/redux/state/index.esm.js +31 -0
  95. package/dist/views/afterAuth/page-view/redux/state/index.esm.js.map +1 -0
  96. package/dist/views/afterAuth/page-view/redux/state/index.js +2 -0
  97. package/dist/views/afterAuth/page-view/redux/state/index.js.map +1 -0
  98. package/dist/views/afterAuth/page-view/utils/default-data/index.esm.js +137 -0
  99. package/dist/views/afterAuth/page-view/utils/default-data/index.esm.js.map +1 -0
  100. package/dist/views/afterAuth/page-view/utils/default-data/index.js +2 -0
  101. package/dist/views/afterAuth/page-view/utils/default-data/index.js.map +1 -0
  102. package/dist/views/afterAuth/page-view/utils/local-data/index.esm.js +137 -0
  103. package/dist/views/afterAuth/page-view/utils/local-data/index.esm.js.map +1 -0
  104. package/dist/views/afterAuth/page-view/utils/local-data/index.js +2 -0
  105. package/dist/views/afterAuth/page-view/utils/local-data/index.js.map +1 -0
  106. package/dist/views/beforeAuth/index.d.ts +0 -1
  107. package/dist/views/form-builder/custom-form/index.esm.js +1151 -0
  108. package/dist/views/form-builder/custom-form/index.esm.js.map +1 -0
  109. package/dist/views/form-builder/custom-form/index.js +30 -0
  110. package/dist/views/form-builder/custom-form/index.js.map +1 -0
  111. package/dist/views/form-builder/element-edit-forms/checkbox/index.esm.js +327 -0
  112. package/dist/views/form-builder/element-edit-forms/checkbox/index.esm.js.map +1 -0
  113. package/dist/views/form-builder/element-edit-forms/checkbox/index.js +30 -0
  114. package/dist/views/form-builder/element-edit-forms/checkbox/index.js.map +1 -0
  115. package/dist/views/form-builder/element-edit-forms/column-width/index.esm.js +92 -0
  116. package/dist/views/form-builder/element-edit-forms/column-width/index.esm.js.map +1 -0
  117. package/dist/views/form-builder/element-edit-forms/column-width/index.js +4 -0
  118. package/dist/views/form-builder/element-edit-forms/column-width/index.js.map +1 -0
  119. package/dist/views/form-builder/element-edit-forms/field-select/index.esm.js +89 -0
  120. package/dist/views/form-builder/element-edit-forms/field-select/index.esm.js.map +1 -0
  121. package/dist/views/form-builder/element-edit-forms/field-select/index.js +3 -0
  122. package/dist/views/form-builder/element-edit-forms/field-select/index.js.map +1 -0
  123. package/dist/views/form-builder/element-edit-forms/section/index.esm.js +222 -0
  124. package/dist/views/form-builder/element-edit-forms/section/index.esm.js.map +1 -0
  125. package/dist/views/form-builder/element-edit-forms/section/index.js +15 -0
  126. package/dist/views/form-builder/element-edit-forms/section/index.js.map +1 -0
  127. package/dist/views/form-builder/element-edit-forms/select/index.esm.js +318 -0
  128. package/dist/views/form-builder/element-edit-forms/select/index.esm.js.map +1 -0
  129. package/dist/views/form-builder/element-edit-forms/select/index.js +25 -0
  130. package/dist/views/form-builder/element-edit-forms/select/index.js.map +1 -0
  131. package/dist/views/form-builder/element-edit-forms/table-form/index.esm.js +111 -0
  132. package/dist/views/form-builder/element-edit-forms/table-form/index.esm.js.map +1 -0
  133. package/dist/views/form-builder/element-edit-forms/table-form/index.js +5 -0
  134. package/dist/views/form-builder/element-edit-forms/table-form/index.js.map +1 -0
  135. package/dist/views/form-builder/element-edit-forms/text/index.esm.js +559 -0
  136. package/dist/views/form-builder/element-edit-forms/text/index.esm.js.map +1 -0
  137. package/dist/views/form-builder/element-edit-forms/text/index.js +31 -0
  138. package/dist/views/form-builder/element-edit-forms/text/index.js.map +1 -0
  139. package/dist/views/form-builder/field_properties/index.esm.js +216 -0
  140. package/dist/views/form-builder/field_properties/index.esm.js.map +1 -0
  141. package/dist/views/form-builder/field_properties/index.js +2 -0
  142. package/dist/views/form-builder/field_properties/index.js.map +1 -0
  143. package/dist/views/form-builder/form-fields/index.esm.js +355 -0
  144. package/dist/views/form-builder/form-fields/index.esm.js.map +1 -0
  145. package/dist/views/form-builder/form-fields/index.js +24 -0
  146. package/dist/views/form-builder/form-fields/index.js.map +1 -0
  147. package/dist/views/form-builder/redux/actionCreator/index.esm.js +1 -1
  148. package/dist/views/form-builder/redux/reducer/index.esm.js +6 -1
  149. package/dist/views/form-builder/redux/reducer/index.esm.js.map +1 -1
  150. package/dist/views/form-builder/redux/reducer/index.js +1 -1
  151. package/dist/views/form-builder/redux/reducer/index.js.map +1 -1
  152. package/dist/views/form-builder/utils/common/index.esm.js +285 -0
  153. package/dist/views/form-builder/utils/common/index.esm.js.map +1 -0
  154. package/dist/views/form-builder/utils/common/index.js +2 -0
  155. package/dist/views/form-builder/utils/common/index.js.map +1 -0
  156. package/dist/views/index.d.ts +1 -0
  157. package/dist/views/index.esm.js +90 -45
  158. package/dist/views/index.esm.js.map +1 -1
  159. package/dist/views/index.js +1 -1
  160. package/package.json +2 -1
  161. package/dist/components/activity-tag/activity-tag/index.esm.js +0 -154
  162. package/dist/components/activity-tag/activity-tag/index.esm.js.map +0 -1
  163. package/dist/components/activity-tag/activity-tag/index.js +0 -15
  164. package/dist/components/activity-tag/activity-tag/index.js.map +0 -1
  165. package/dist/components/charts/bar-chart/bar-chart/index.esm.js.map +0 -1
  166. package/dist/components/charts/bar-chart/bar-chart/index.js +0 -2
  167. package/dist/components/charts/bar-chart/bar-chart/index.js.map +0 -1
  168. package/dist/components/charts/donut-chart/donut-chart/index.esm.js +0 -86
  169. package/dist/components/charts/donut-chart/donut-chart/index.esm.js.map +0 -1
  170. package/dist/components/charts/donut-chart/donut-chart/index.js +0 -6
  171. package/dist/components/charts/donut-chart/donut-chart/index.js.map +0 -1
  172. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js +0 -95
  173. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.esm.js.map +0 -1
  174. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js +0 -3
  175. package/dist/node_modules/@mui/lab/Timeline/Timeline/index.js.map +0 -1
  176. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js +0 -10
  177. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.esm.js.map +0 -1
  178. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js +0 -2
  179. package/dist/node_modules/@mui/lab/Timeline/TimelineContext/index.js.map +0 -1
  180. package/dist/node_modules/@mui/lab/Timeline/timelineClasses/index.esm.js +0 -10
  181. package/dist/node_modules/@mui/lab/Timeline/timelineClasses/index.esm.js.map +0 -1
  182. package/dist/node_modules/@mui/lab/Timeline/timelineClasses/index.js +0 -2
  183. package/dist/node_modules/@mui/lab/Timeline/timelineClasses/index.js.map +0 -1
  184. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js +0 -76
  185. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js.map +0 -1
  186. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js +0 -3
  187. package/dist/node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.js.map +0 -1
  188. package/dist/node_modules/@mui/lab/TimelineConnector/timelineConnectorClasses/index.esm.js +0 -10
  189. package/dist/node_modules/@mui/lab/TimelineConnector/timelineConnectorClasses/index.esm.js.map +0 -1
  190. package/dist/node_modules/@mui/lab/TimelineConnector/timelineConnectorClasses/index.js +0 -2
  191. package/dist/node_modules/@mui/lab/TimelineConnector/timelineConnectorClasses/index.js.map +0 -1
  192. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js +0 -91
  193. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js.map +0 -1
  194. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js +0 -3
  195. package/dist/node_modules/@mui/lab/TimelineContent/TimelineContent/index.js.map +0 -1
  196. package/dist/node_modules/@mui/lab/TimelineContent/timelineContentClasses/index.esm.js +0 -11
  197. package/dist/node_modules/@mui/lab/TimelineContent/timelineContentClasses/index.esm.js.map +0 -1
  198. package/dist/node_modules/@mui/lab/TimelineContent/timelineContentClasses/index.js +0 -2
  199. package/dist/node_modules/@mui/lab/TimelineContent/timelineContentClasses/index.js.map +0 -1
  200. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js +0 -118
  201. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js.map +0 -1
  202. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js +0 -3
  203. package/dist/node_modules/@mui/lab/TimelineDot/TimelineDot/index.js.map +0 -1
  204. package/dist/node_modules/@mui/lab/TimelineDot/timelineDotClasses/index.esm.js +0 -10
  205. package/dist/node_modules/@mui/lab/TimelineDot/timelineDotClasses/index.esm.js.map +0 -1
  206. package/dist/node_modules/@mui/lab/TimelineDot/timelineDotClasses/index.js +0 -2
  207. package/dist/node_modules/@mui/lab/TimelineDot/timelineDotClasses/index.js.map +0 -1
  208. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js +0 -128
  209. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js.map +0 -1
  210. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js +0 -3
  211. package/dist/node_modules/@mui/lab/TimelineItem/TimelineItem/index.js.map +0 -1
  212. package/dist/node_modules/@mui/lab/TimelineItem/timelineItemClasses/index.esm.js +0 -10
  213. package/dist/node_modules/@mui/lab/TimelineItem/timelineItemClasses/index.esm.js.map +0 -1
  214. package/dist/node_modules/@mui/lab/TimelineItem/timelineItemClasses/index.js +0 -2
  215. package/dist/node_modules/@mui/lab/TimelineItem/timelineItemClasses/index.js.map +0 -1
  216. package/dist/node_modules/@mui/lab/TimelineOppositeContent/timelineOppositeContentClasses/index.esm.js +0 -6
  217. package/dist/node_modules/@mui/lab/TimelineOppositeContent/timelineOppositeContentClasses/index.esm.js.map +0 -1
  218. package/dist/node_modules/@mui/lab/TimelineOppositeContent/timelineOppositeContentClasses/index.js +0 -2
  219. package/dist/node_modules/@mui/lab/TimelineOppositeContent/timelineOppositeContentClasses/index.js.map +0 -1
  220. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js +0 -73
  221. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js.map +0 -1
  222. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js +0 -3
  223. package/dist/node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.js.map +0 -1
  224. package/dist/node_modules/@mui/lab/TimelineSeparator/timelineSeparatorClasses/index.esm.js +0 -10
  225. package/dist/node_modules/@mui/lab/TimelineSeparator/timelineSeparatorClasses/index.esm.js.map +0 -1
  226. package/dist/node_modules/@mui/lab/TimelineSeparator/timelineSeparatorClasses/index.js +0 -2
  227. package/dist/node_modules/@mui/lab/TimelineSeparator/timelineSeparatorClasses/index.js.map +0 -1
  228. package/dist/node_modules/@mui/lab/internal/convertTimelinePositionToClass/index.esm.js +0 -8
  229. package/dist/node_modules/@mui/lab/internal/convertTimelinePositionToClass/index.esm.js.map +0 -1
  230. package/dist/node_modules/@mui/lab/internal/convertTimelinePositionToClass/index.js +0 -2
  231. package/dist/node_modules/@mui/lab/internal/convertTimelinePositionToClass/index.js.map +0 -1
  232. package/dist/node_modules/d3-shape/src/arc/index.esm.js +0 -134
  233. package/dist/node_modules/d3-shape/src/arc/index.esm.js.map +0 -1
  234. package/dist/node_modules/d3-shape/src/arc/index.js +0 -2
  235. package/dist/node_modules/d3-shape/src/arc/index.js.map +0 -1
  236. package/dist/node_modules/d3-shape/src/descending/index.esm.js +0 -7
  237. package/dist/node_modules/d3-shape/src/descending/index.esm.js.map +0 -1
  238. package/dist/node_modules/d3-shape/src/descending/index.js +0 -2
  239. package/dist/node_modules/d3-shape/src/descending/index.js.map +0 -1
  240. package/dist/node_modules/d3-shape/src/identity/index.esm.js +0 -7
  241. package/dist/node_modules/d3-shape/src/identity/index.esm.js.map +0 -1
  242. package/dist/node_modules/d3-shape/src/identity/index.js +0 -2
  243. package/dist/node_modules/d3-shape/src/identity/index.js.map +0 -1
  244. package/dist/node_modules/d3-shape/src/math/index.esm.js +0 -33
  245. package/dist/node_modules/d3-shape/src/math/index.esm.js.map +0 -1
  246. package/dist/node_modules/d3-shape/src/math/index.js +0 -2
  247. package/dist/node_modules/d3-shape/src/math/index.js.map +0 -1
  248. package/dist/node_modules/d3-shape/src/pie/index.esm.js +0 -56
  249. package/dist/node_modules/d3-shape/src/pie/index.esm.js.map +0 -1
  250. package/dist/node_modules/d3-shape/src/pie/index.js +0 -2
  251. package/dist/node_modules/d3-shape/src/pie/index.js.map +0 -1
  252. package/dist/views/beforeAuth/login/index/index.esm.js +0 -209
  253. package/dist/views/beforeAuth/login/index/index.esm.js.map +0 -1
  254. package/dist/views/beforeAuth/login/index/index.js +0 -20
  255. package/dist/views/beforeAuth/login/index/index.js.map +0 -1
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./404/index.js"),t=require("./privateRoute/index.js"),r=require("./afterAuth/dashboard/dashboard/index.js"),o=require("./afterAuth/dashboard/redux/state/index.js"),a=require("./beforeAuth/components/gantt-data/gantt-data/index.js"),s=require("./beforeAuth/components/grid-data/grid-data/index.js"),i=require("./beforeAuth/landing/landing/index.js"),n=require("./template-editor/templates/index.js"),d=require("./template-editor/add-template/add-template/index.js"),l=require("./template-editor/company-selection-modal/company-selection-modal/index.js"),p=require("./template-editor/components/EditorCanvas/index.js"),u=require("./template-editor/components/EditorHeader/index.js"),x=require("./template-editor/components/EditorSection/index.js"),m=require("./template-editor/components/EditorSidebar/index.js"),c=require("./template-editor/components/SectionFlowEditor/index.js"),h=require("./template-editor/components/SectionFormatPanel/index.js"),g=require("./template-editor/components/controllers/AlignmentControl/index.js"),j=require("./template-editor/components/controllers/border-control/index.js"),b=require("./template-editor/components/controllers/ButtonControls/index.js"),q=require("./template-editor/components/controllers/CodeControls/index.js"),f=require("./template-editor/components/controllers/DividerControls/index.js"),A=require("./template-editor/components/controllers/ImageControls/index.js"),P=require("./template-editor/components/controllers/SignatureControls/index.js"),C=require("./template-editor/components/controllers/TableControls/index.js"),D=require("./template-editor/edit-section-modal/edit-section-modal/index.js"),S=require("./template-editor/template-modal/html-thumbnail-preview/index.js"),E=require("./template-editor/template-modal/template-modal/index.js"),w=require("./template-editor/template-name-modal/template-name-modal/index.js"),v=require("./afterAuth/dashboard/redux/reducer/index.js"),T=require("./afterAuth/dashboard/redux/actionCreator/index.js"),y=require("./beforeAuth/change-password/change-password/index.js"),R=require("./beforeAuth/components/activity-tag-data/activity-tag-data/index.js"),F=require("./beforeAuth/components/calendar-data/calendar-data/index.js"),M=require("./beforeAuth/components/kanbann-content/kanbann-raw/index.js"),H=require("./beforeAuth/components/list-content/column-raw/index.js"),I=require("./beforeAuth/components/list-content/list-data/index.js"),L=require("./beforeAuth/components/multiline-data/multiline-data/index.js"),N=require("./beforeAuth/components/share-modal-data/share-modal-data/index.js"),U=require("./beforeAuth/components/shared-pages-data/shared-pages-data/index.js"),_=require("./beforeAuth/components/tabs-data/tabs-data/index.js"),B=require("./beforeAuth/components/user-dropdown-data/user-dropdown-data/index.js"),O=require("./beforeAuth/forgot-password/forgot-password/index.js"),k=require("./beforeAuth/login/index/index.js"),G=require("./beforeAuth/reset-password/reset-password/index.js"),K=require("./template-editor/routes/index.js"),z=require("./template-editor/components/controllers/TextControls/index.js"),J=require("./template-editor/utils/common/index.js"),Q=require("./template-editor/utils/constant/index.js"),V=require("./template-editor/utils/default-data/index.js"),W=require("./template-editor/utils/style-extractor/index.js");exports.NotFound=e.default,exports.PrivateRoute=t.PrivateRoute,exports.Dashboard=r.default,exports.state=o.state,exports.ganttData=a.default,exports.data=s.data,exports.Landing=i.Landing,exports.Templates=n.default,exports.AddTemplate=d.default,exports.CompanySelectionModal=l.default,exports.EditorCanvas=p.default,exports.EditorHeader=u.default,exports.EditorSection=x.default,exports.EditorSidebar=m.EditorSidebar,exports.SectionFlowEditor=c.default,exports.SectionFormatPanel=h.default,exports.AlignmentControl=g.default,exports.BorderControl=j.default,exports.ButtonControls=b.default,exports.CodeControls=q.default,exports.DividerControls=f.default,exports.ImageControls=A.default,exports.SignatureControls=P.default,exports.TableControls=C.default,exports.EditSectionModal=D.default,exports.HtmlThumbnailPreview=S.HtmlThumbnailPreview,exports.TemplateModal=E.TemplateModal,exports.TemplateNameModal=w.default,exports.changeCurrentPage=v.changeCurrentPage,exports.dashBoardDrive=v.dashBoardDrive,exports.dashboardSlice=v.default,exports.pinToDashboardList=v.pinToDashboardList,exports.setGrid=v.setGrid,exports.setPages=v.setPages,exports.setPaginationModel=v.setPaginationModel,exports.setSharedPage=v.setSharedPage,exports.setUserName=v.setUserName,exports.UsersFetchAction=T.UsersFetchAction,exports.pinToDashboardAction=T.pinToDashboardAction,exports.setPagesAction=T.setPagesAction,exports.setSharedPageAction=T.setSharedPageAction,exports.setUserNameAction=T.setUserNameAction,exports.setdashboardDriveData=T.setdashboardDriveData,exports.ChangePassword=y.ChangePassword,exports.activityTag=R.activityTag,exports.calendarData=F.calendarData,exports.board=M.board,exports.column=H.column,exports.tableData=I.tableData,exports.multilineData=L.multilineData,exports.userRoles=N.userRoles,exports.sharedPagesData=U.sharedPagesData,exports.tabsData=_.tabsData,exports.userData=B.userData,exports.ForgotPassword=O.ForgotPassword,exports.Login=k.Login,exports.ResetPassword=G.ResetPassword,exports.templateEditorRoutes=K.templateEditorRoutes,exports.React=z.default,exports.extractStyles=J.extractStyles,exports.generateEmailPreview=J.generateEmailPreview,exports.generateHeaderFooterPreview=J.generateHeaderFooterPreview,exports.generateInlineStyles=J.generateInlineStyles,exports.getInitialSectionData=J.getInitialSectionData,exports.templateRoutes=J.templateRoutes,exports.TEMPLATE_EDITOR_PATHS=Q.TEMPLATE_EDITOR_PATHS,exports.initialStyles=Q.initialStyles,exports.emailColumns=V.emailColumns,exports.textOptions=V.textOptions,exports.useCKEditorStyleExtractor=W.useCKEditorStyleExtractor;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./404/index.js"),t=require("./privateRoute/index.js"),r=require("./afterAuth/dashboard/dashboard/index.js"),o=require("./form-builder/redux/state/index.js"),a=require("./afterAuth/page-view/page-view/index.js"),s=require("./beforeAuth/components/gantt-data/gantt-data/index.js"),i=require("./beforeAuth/components/grid-data/grid-data/index.js"),d=require("./beforeAuth/landing/landing/index.js"),n=require("./form-builder/custom-form/index.js"),l=require("./form-builder/form-fields/index.js"),u=require("./form-builder/element-edit-forms/checkbox/index.js"),p=require("./form-builder/element-edit-forms/column-width/index.js"),m=require("./form-builder/element-edit-forms/field-select/index.js"),x=require("./form-builder/element-edit-forms/section/index.js"),c=require("./form-builder/element-edit-forms/select/index.js"),f=require("./form-builder/element-edit-forms/table-form/index.js"),b=require("./form-builder/element-edit-forms/text/index.js"),h=require("./template-editor/templates/index.js"),j=require("./template-editor/add-template/add-template/index.js"),q=require("./template-editor/company-selection-modal/company-selection-modal/index.js"),g=require("./template-editor/components/EditorCanvas/index.js"),D=require("./template-editor/components/EditorHeader/index.js"),F=require("./template-editor/components/EditorSection/index.js"),A=require("./template-editor/components/EditorSidebar/index.js"),C=require("./template-editor/components/SectionFlowEditor/index.js"),P=require("./template-editor/components/SectionFormatPanel/index.js"),S=require("./template-editor/components/controllers/AlignmentControl/index.js"),w=require("./template-editor/components/controllers/border-control/index.js"),E=require("./template-editor/components/controllers/ButtonControls/index.js"),T=require("./template-editor/components/controllers/CodeControls/index.js"),v=require("./template-editor/components/controllers/DividerControls/index.js"),y=require("./template-editor/components/controllers/ImageControls/index.js"),R=require("./template-editor/components/controllers/SignatureControls/index.js"),I=require("./template-editor/components/controllers/TableControls/index.js"),M=require("./template-editor/edit-section-modal/edit-section-modal/index.js"),B=require("./template-editor/template-modal/html-thumbnail-preview/index.js"),H=require("./template-editor/template-modal/template-modal/index.js"),L=require("./template-editor/template-name-modal/template-name-modal/index.js"),O=require("./afterAuth/dashboard/redux/reducer/index.js"),_=require("./afterAuth/dashboard/redux/actionCreator/index.js"),N=require("./form-builder/redux/reducer/index.js"),U=require("./afterAuth/page-view/redux/reducer/index.js"),k=require("./afterAuth/page-view/redux/actionCreator/index.js"),V=require("./afterAuth/page-view/utils/default-data/index.js"),G=require("./afterAuth/page-view/utils/local-data/index.js"),K=require("./beforeAuth/change-password/change-password/index.js"),W=require("./beforeAuth/components/activity-tag-data/activity-tag-data/index.js"),z=require("./beforeAuth/components/calendar-data/calendar-data/index.js"),J=require("./beforeAuth/components/kanbann-content/kanbann-raw/index.js"),Q=require("./beforeAuth/components/list-content/column-raw/index.js"),X=require("./beforeAuth/components/list-content/list-data/index.js"),Y=require("./beforeAuth/components/multiline-data/multiline-data/index.js"),Z=require("./beforeAuth/components/share-modal-data/share-modal-data/index.js"),$=require("./beforeAuth/components/shared-pages-data/shared-pages-data/index.js"),ee=require("./beforeAuth/components/tabs-data/tabs-data/index.js"),te=require("./beforeAuth/components/user-dropdown-data/user-dropdown-data/index.js"),re=require("./beforeAuth/forgot-password/forgot-password/index.js"),oe=require("./beforeAuth/reset-password/reset-password/index.js"),ae=require("./form-builder/field_properties/index.js"),se=require("./form-builder/redux/actionCreator/index.js"),ie=require("./form-builder/utils/common/index.js"),de=require("./template-editor/routes/index.js"),ne=require("./template-editor/components/controllers/TextControls/index.js"),le=require("./template-editor/utils/common/index.js"),ue=require("./template-editor/utils/constant/index.js"),pe=require("./template-editor/utils/default-data/index.js"),me=require("./template-editor/utils/style-extractor/index.js");exports.NotFound=e.default,exports.PrivateRoute=t.PrivateRoute,exports.Dashboard=r.default,exports.state=o.state,exports.PageView=a.PageView,exports.ganttData=s.default,exports.data=i.data,exports.Landing=d.Landing,exports.CustomForm=n.CustomForm,exports.FormField=l.FormField,exports.FormFields=l.default,exports.CheckboxEditForm=u.CheckboxEditForm,exports.ColumnWidth=p.default,exports.FieldSelect=m.default,exports.SectionEditForm=x.SectionEditForm,exports.SelectEditForm=c.SelectEditForm,exports.TableEditForm=f.default,exports.TextEditForm=b.TextEditForm,exports.Templates=h.default,exports.AddTemplate=j.default,exports.CompanySelectionModal=q.default,exports.EditorCanvas=g.default,exports.EditorHeader=D.default,exports.EditorSection=F.default,exports.EditorSidebar=A.EditorSidebar,exports.SectionFlowEditor=C.default,exports.SectionFormatPanel=P.default,exports.AlignmentControl=S.default,exports.BorderControl=w.default,exports.ButtonControls=E.default,exports.CodeControls=T.default,exports.DividerControls=v.default,exports.ImageControls=y.default,exports.SignatureControls=R.default,exports.TableControls=I.default,exports.EditSectionModal=M.default,exports.HtmlThumbnailPreview=B.HtmlThumbnailPreview,exports.TemplateModal=H.TemplateModal,exports.TemplateNameModal=L.default,exports.dashBoardDrive=O.dashBoardDrive,exports.dashboardSlice=O.default,exports.pinToDashboardList=O.pinToDashboardList,exports.setGrid=O.setGrid,exports.setSharedPage=O.setSharedPage,exports.setUserName=O.setUserName,exports.UsersFetchAction=_.UsersFetchAction,exports.pinToDashboardAction=_.pinToDashboardAction,exports.setPagesAction=_.setPagesAction,exports.setSharedPageAction=_.setSharedPageAction,exports.setUserNameAction=_.setUserNameAction,exports.setdashboardDriveData=_.setdashboardDriveData,exports.formBuilderListSlice=N.default,exports.setFormData=N.setFormData,exports.setPaginationModel=N.setPaginationModel,exports.pageViewSlice=U.default,exports.setColumnOrder=U.setColumnOrder,exports.setRowData=U.setRowData,exports.fetchPage=k.fetchPage,exports.defaultData=V.defaultData,exports.local=G.local,exports.ChangePassword=K.ChangePassword,exports.activityTag=W.activityTag,exports.calendarData=z.calendarData,exports.board=J.board,exports.column=Q.column,exports.tableData=X.tableData,exports.multilineData=Y.multilineData,exports.userRoles=Z.userRoles,exports.sharedPagesData=$.sharedPagesData,exports.tabsData=ee.tabsData,exports.userData=te.userData,exports.ForgotPassword=re.ForgotPassword,exports.ResetPassword=oe.ResetPassword,exports.element=ae.element,exports.getFieldsByFormId=se.getFieldsByFormId,exports.getFormDataById=se.getFormDataById,exports.patchFormDataById=se.patchFormDataById,exports.createDefaultTableColumns=ie.createDefaultTableColumns,exports.extractSections=ie.extractSections,exports.formatText=ie.formatText,exports.generateModulePath=ie.generateModulePath,exports.processMembers=ie.processMembers,exports.processTableColumns=ie.processTableColumns,exports.useFormDataEffect=ie.useFormDataEffect,exports.useFormDataProcessor=ie.useFormDataProcessor,exports.templateEditorRoutes=de.templateEditorRoutes,exports.React=ne.default,exports.extractStyles=le.extractStyles,exports.generateEmailPreview=le.generateEmailPreview,exports.generateHeaderFooterPreview=le.generateHeaderFooterPreview,exports.generateInlineStyles=le.generateInlineStyles,exports.getInitialSectionData=le.getInitialSectionData,exports.templateRoutes=le.templateRoutes,exports.TEMPLATE_EDITOR_PATHS=ue.TEMPLATE_EDITOR_PATHS,exports.initialStyles=ue.initialStyles,exports.emailColumns=pe.emailColumns,exports.textOptions=pe.textOptions,exports.useCKEditorStyleExtractor=me.useCKEditorStyleExtractor;
2
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@erpsquad/common",
3
- "version": "1.8.46",
3
+ "version": "1.8.47",
4
4
  "description": "Shared UI component library for ERP modules",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.esm.js",
@@ -130,6 +130,7 @@
130
130
  "build:validate": "npm run build && node scripts/validate-package.js",
131
131
  "clean": "rimraf dist",
132
132
  "generate:exports": "node scripts/generate-exports.js",
133
+ "fix:exports": "node scripts/fix-all-exports.js",
133
134
  "add:named-exports": "node scripts/add-named-exports.js",
134
135
  "analyze:exports": "node scripts/analyze-exports.js",
135
136
  "type-check": "tsc --noEmit --skipLibCheck",
@@ -1,154 +0,0 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
3
- /* empty css */
4
- import { images } from "../../../images/index.esm.js";
5
- import { Avatar } from "../../avatar/avatar/index.esm.js";
6
- import { Accordion } from "../../accordion/accordion/index.esm.js";
7
- import { useAuth } from "../../../hooks/useAuth/index.esm.js";
8
- import { formatText } from "../../../utils/format-text/index.esm.js";
9
- import { Typography } from "../../typography/typography/index.esm.js";
10
- import TimelineItem from "../../../node_modules/@mui/lab/TimelineItem/TimelineItem/index.esm.js";
11
- import TimelineSeparator from "../../../node_modules/@mui/lab/TimelineSeparator/TimelineSeparator/index.esm.js";
12
- import TimelineDot from "../../../node_modules/@mui/lab/TimelineDot/TimelineDot/index.esm.js";
13
- import TimelineConnector from "../../../node_modules/@mui/lab/TimelineConnector/TimelineConnector/index.esm.js";
14
- import TimelineContent from "../../../node_modules/@mui/lab/TimelineContent/TimelineContent/index.esm.js";
15
- import Timeline from "../../../node_modules/@mui/lab/Timeline/Timeline/index.esm.js";
16
- import styled from "../../../node_modules/@mui/material/styles/styled/index.esm.js";
17
- import TextField from "../../../node_modules/@mui/material/TextField/TextField/index.esm.js";
18
- const StyledTextField = styled(TextField)(({ theme: { palette } }) => {
19
- var _a, _b, _c, _d;
20
- return {
21
- width: "100%",
22
- "& .MuiOutlinedInput-root": {
23
- height: "2rem",
24
- "& fieldset": {
25
- borderColor: (_a = palette.theme) == null ? void 0 : _a.secondary[300],
26
- borderWidth: 2
27
- },
28
- "&:hover fieldset": {
29
- borderColor: (_b = palette.theme) == null ? void 0 : _b.secondary[300]
30
- },
31
- "&.Mui-focused fieldset": {
32
- // borderWidth: "0.0625rem",
33
- // borderStyle: "solid",
34
- borderColor: (_c = palette.theme) == null ? void 0 : _c.primary[700]
35
- },
36
- "&.Mui-error fieldset": {
37
- borderColor: (_d = palette.theme) == null ? void 0 : _d.error[600]
38
- }
39
- }
40
- };
41
- });
42
- const ActivityTag = (props) => {
43
- const {
44
- type,
45
- data,
46
- placeholder,
47
- error = false,
48
- textfield,
49
- textfieldTitle,
50
- onCommentSubmit,
51
- onChange,
52
- containerProps,
53
- accordion = true,
54
- ...rest
55
- } = props;
56
- const { user } = useAuth();
57
- const chatRef = useRef(null);
58
- const scrollToBottom = () => {
59
- if (chatRef.current) {
60
- chatRef.current.scrollTop = chatRef.current.scrollHeight;
61
- }
62
- };
63
- useEffect(() => {
64
- scrollToBottom();
65
- }, [data]);
66
- const formatDateTime = (dateTime) => {
67
- const currentDate = /* @__PURE__ */ new Date();
68
- const commentDate = new Date(dateTime);
69
- const timeDifference = currentDate.getTime() - commentDate.getTime();
70
- const secondsDifference = Math.floor(timeDifference / 1e3);
71
- const minutesDifference = Math.floor(secondsDifference / 60);
72
- const hoursDifference = Math.floor(minutesDifference / 60);
73
- if (secondsDifference < 60) {
74
- return `${secondsDifference} second${secondsDifference !== 1 ? "s" : ""} ago`;
75
- } else if (minutesDifference < 60) {
76
- return `${minutesDifference} minute${minutesDifference !== 1 ? "s" : ""} ago`;
77
- } else if (hoursDifference < 24) {
78
- return `${hoursDifference} hour${hoursDifference !== 1 ? "s" : ""} ago`;
79
- } else {
80
- const optionsDate = {
81
- day: "numeric",
82
- month: "short",
83
- year: "numeric"
84
- };
85
- const optionsTime = {
86
- hour: "numeric",
87
- minute: "numeric",
88
- hour12: false
89
- };
90
- const formattedDate = commentDate.toLocaleString("en-US", optionsDate);
91
- const formattedTime = commentDate.toLocaleString("en-US", optionsTime);
92
- return `${formattedDate} • ${formattedTime}`;
93
- }
94
- };
95
- const handleKeyPress = (event) => {
96
- if (event.key === "Enter") {
97
- const commentValue = event.target.value;
98
- if (commentValue.trim() !== "") {
99
- onCommentSubmit(commentValue);
100
- scrollToBottom();
101
- }
102
- }
103
- };
104
- const timelineItems = type === "activity" ? data == null ? void 0 : data.map((item, index) => /* @__PURE__ */ jsx("div", { className: "Timeline--Activity", children: /* @__PURE__ */ jsxs(TimelineItem, { children: [
105
- /* @__PURE__ */ jsxs(TimelineSeparator, { children: [
106
- /* @__PURE__ */ jsx(TimelineDot, {}),
107
- data.length - 1 !== index && /* @__PURE__ */ jsx(TimelineConnector, {})
108
- ] }),
109
- /* @__PURE__ */ jsx(TimelineContent, { className: "Timeline--Content", children: /* @__PURE__ */ jsxs(Typography, { type: "s4", color: "theme.secondary.800", className: "Timeline--ActivityLogItem", children: [
110
- item.message,
111
- " · ",
112
- formatDateTime(item.created_at)
113
- ] }) })
114
- ] }, index) })) : /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", { className: "Timeline--Chat", ref: chatRef, children: data.map((item, index) => /* @__PURE__ */ jsxs(TimelineItem, { children: [
115
- /* @__PURE__ */ jsxs(TimelineSeparator, { children: [
116
- /* @__PURE__ */ jsx(Avatar, { src: images.chat, size: 17 }),
117
- /* @__PURE__ */ jsx(TimelineConnector, {})
118
- ] }),
119
- /* @__PURE__ */ jsxs(TimelineContent, { children: [
120
- item.name,
121
- " commented this · ",
122
- formatDateTime(item.created_at),
123
- /* @__PURE__ */ jsx("div", { className: "Timeline--CommentWrap", children: /* @__PURE__ */ jsx("p", { className: "Timeline--Comment", children: item.message }) })
124
- ] })
125
- ] }, index)) }) });
126
- return (
127
- // <Box position='relative'>
128
- /* @__PURE__ */ jsx("div", { className: "ActivityContainer", ...containerProps, children: /* @__PURE__ */ jsxs(Timeline, { className: "Timeline", children: [
129
- accordion ? /* @__PURE__ */ jsx(Accordion, { title: "Activities", accordionProps: { defaultExpanded: true }, children: timelineItems }) : /* @__PURE__ */ jsx("div", { className: "Timeline--ActivityBox", children: timelineItems }),
130
- textfield && /* @__PURE__ */ jsxs("div", { className: "Timeline--CommentBox", children: [
131
- textfieldTitle,
132
- /* @__PURE__ */ jsxs("div", { className: "Timeline--CommentText", children: [
133
- /* @__PURE__ */ jsx(Avatar, { size: 32, alt: formatText(user == null ? void 0 : user.full_name), className: "avatar-class" }),
134
- /* @__PURE__ */ jsx(
135
- StyledTextField,
136
- {
137
- error,
138
- placeholder,
139
- className: "textfield",
140
- onKeyDown: handleKeyPress,
141
- onChange,
142
- ...rest
143
- }
144
- )
145
- ] })
146
- ] })
147
- ] }) })
148
- );
149
- };
150
- export {
151
- ActivityTag,
152
- ActivityTag as default
153
- };
154
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../src/components/activity-tag/activity-tag.tsx"],"sourcesContent":["import { useRef, useEffect } from \"react\";\nimport { TextField as MUITextField, styled } from \"@mui/material\";\nimport Timeline from \"@mui/lab/Timeline\";\nimport TimelineItem from \"@mui/lab/TimelineItem\";\nimport TimelineSeparator from \"@mui/lab/TimelineSeparator\";\nimport TimelineConnector from \"@mui/lab/TimelineConnector\";\nimport TimelineContent from \"@mui/lab/TimelineContent\";\nimport TimelineDot from \"@mui/lab/TimelineDot\";\nimport \"./activity-tag.scss\";\nimport images from \"../../assets/images\";\nimport Avatar from \"../avatar/avatar\";\nimport Accordion from \"../accordion/accordion\";\nimport { useAuth } from \"../../hooks/useAuth\";\nimport formatText from \"../../utils/format-text\";\nimport Typography from \"../typography/typography\";\n\nconst StyledTextField = styled(MUITextField)(({ theme: { palette } }) => ({\n width: \"100%\",\n \"& .MuiOutlinedInput-root\": {\n height: '2rem',\n \"& fieldset\": {\n borderColor: palette.theme?.secondary[300],\n borderWidth: 2\n },\n \"&:hover fieldset\": {\n borderColor: palette.theme?.secondary[300],\n },\n \"&.Mui-focused fieldset\": {\n // borderWidth: \"0.0625rem\",\n // borderStyle: \"solid\",\n borderColor: palette.theme?.primary[700],\n },\n \"&.Mui-error fieldset\": {\n borderColor: palette.theme?.error[600],\n },\n },\n}));\n\nexport const ActivityTag = (props: any) => {\n const {\n type,\n data,\n placeholder,\n error = false,\n textfield,\n textfieldTitle,\n onCommentSubmit,\n onChange,\n containerProps,\n accordion = true,\n ...rest\n } = props;\n const { user } = useAuth()\n\n const chatRef = useRef<HTMLDivElement>(null);\n\n const scrollToBottom = () => {\n if (chatRef.current) {\n chatRef.current.scrollTop = chatRef.current.scrollHeight;\n }\n };\n\n useEffect(() => {\n scrollToBottom();\n }, [data]);\n\n const formatDateTime = (dateTime: string) => {\n const currentDate = new Date();\n const commentDate = new Date(dateTime);\n const timeDifference = currentDate.getTime() - commentDate.getTime();\n const secondsDifference = Math.floor(timeDifference / 1000);\n const minutesDifference = Math.floor(secondsDifference / 60);\n const hoursDifference = Math.floor(minutesDifference / 60);\n\n if (secondsDifference < 60) {\n return `${secondsDifference} second${secondsDifference !== 1 ? 's' : ''\n } ago`;\n } else if (minutesDifference < 60) {\n return `${minutesDifference} minute${minutesDifference !== 1 ? 's' : ''\n } ago`;\n } else if (hoursDifference < 24) {\n return `${hoursDifference} hour${hoursDifference !== 1 ? 's' : ''} ago`;\n } else {\n // Format the date in the desired format\n const optionsDate: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n };\n\n const optionsTime: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: false\n };\n\n const formattedDate = commentDate.toLocaleString('en-US', optionsDate);\n const formattedTime = commentDate.toLocaleString('en-US', optionsTime);\n\n return `${formattedDate} • ${formattedTime}`;\n }\n };\n\n const handleKeyPress = (event: any) => {\n if (event.key === 'Enter') {\n const commentValue = (event.target as HTMLInputElement).value;\n if (commentValue.trim() !== '') {\n onCommentSubmit(commentValue);\n scrollToBottom();\n }\n }\n };\n\n const timelineItems =\n type === \"activity\" ? (\n data?.map((item: any, index: number) => (\n <div className=\"Timeline--Activity\">\n <TimelineItem key={index}>\n <TimelineSeparator>\n <TimelineDot />\n {data.length - 1 !== index && <TimelineConnector />}\n </TimelineSeparator>\n <TimelineContent className=\"Timeline--Content\">\n <Typography type=\"s4\" color=\"theme.secondary.800\" className=\"Timeline--ActivityLogItem\">\n {item.message} · {formatDateTime(item.created_at)}\n </Typography>\n </TimelineContent>\n </TimelineItem>\n </div>\n ))\n ) : (\n <>\n <div className=\"Timeline--Chat\" ref={chatRef}>\n {data.map((item: any, index: number) => (\n <TimelineItem key={index}>\n <TimelineSeparator>\n <Avatar src={images.chat} size={17} />\n <TimelineConnector />\n </TimelineSeparator>\n <TimelineContent>\n {item.name} commented this · {formatDateTime(item.created_at)}\n <div className=\"Timeline--CommentWrap\">\n <p className=\"Timeline--Comment\">{item.message}</p>\n </div>\n </TimelineContent>\n </TimelineItem>\n ))}\n </div>\n </>\n );\n\n // const avatarStyle = {\n // borderRadius: '0.5rem',\n // padding: '0.875rem 1.28125rem',\n // textAlign: 'center',\n // backgroundColor: `${randomColor}.200`,\n // color: `${randomColor}.1000`\n // };\n\n return (\n // <Box position='relative'>\n <div className=\"ActivityContainer\" {...containerProps}>\n <Timeline className=\"Timeline\">\n {accordion ? \n <Accordion title='Activities' accordionProps={{ defaultExpanded: true }}>\n {timelineItems}\n </Accordion> : \n <div className=\"Timeline--ActivityBox\">\n {timelineItems}\n </div>\n }\n {textfield && (\n <div className=\"Timeline--CommentBox\">\n {textfieldTitle}\n <div className=\"Timeline--CommentText\">\n <Avatar size={32} alt={formatText(user?.full_name)} className=\"avatar-class\" />\n <StyledTextField\n error={error}\n placeholder={placeholder}\n className=\"textfield\"\n onKeyDown={handleKeyPress}\n onChange={onChange}\n {...rest}\n />\n </div>\n </div>\n )}\n </Timeline>\n </div>\n // </Box>\n );\n};\n\nexport default ActivityTag;\n"],"names":["MUITextField"],"mappings":";;;;;;;;;;;;;;;;;AAgBA,MAAM,kBAAkB,OAAOA,SAAY,EAAE,CAAC,EAAE,OAAO,EAAE,QAAA,QAAU;;AAAO;AAAA,IACxE,OAAO;AAAA,IACP,4BAA4B;AAAA,MAC1B,QAAQ;AAAA,MACR,cAAc;AAAA,QACZ,cAAa,aAAQ,UAAR,mBAAe,UAAU;AAAA,QACtC,aAAa;AAAA,MAAA;AAAA,MAEf,oBAAoB;AAAA,QAClB,cAAa,aAAQ,UAAR,mBAAe,UAAU;AAAA,MAAG;AAAA,MAE3C,0BAA0B;AAAA;AAAA;AAAA,QAGxB,cAAa,aAAQ,UAAR,mBAAe,QAAQ;AAAA,MAAG;AAAA,MAEzC,wBAAwB;AAAA,QACtB,cAAa,aAAQ,UAAR,mBAAe,MAAM;AAAA,MAAG;AAAA,IACvC;AAAA,EAEJ;AAAA,CAAE;AAEK,MAAM,cAAc,CAAC,UAAe;AACzC,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,IACR;AAAA,IACA;AAAA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A,GAViB,KAWnB,CACD,EAAA,CACH,GACF;AAWJ;AAAA;AAAA,IAEE,oBAAC,SAAI,WAAU,qBAAqB,GAAG,gBACrC,UAAA,qBAAC,UAAA,EAAS,WAAU,YACjB,UAAA;AAAA,MAAA,YACC,oBAAC,WAAA,EAAU,OAAM,cAAa,gBAAgB,EAAE,iBAAiB,KAAA,GAChE,yBACH,IACA,oBAAC,OAAA,EAAI,WAAU,yBACZ,UAAA,eACH;AAAA,MAEC,aACC,qBAAC,OAAA,EAAI,WAAU,wBACZ,UAAA;AAAA,QAAA;AAAA,QACD,qBAAC,OAAA,EAAI,WAAU,yBACb,UAAA;AAAA,UAAA,oBAAC,QAAA,EAAO,MAAM,IAAI,KAAK,WAAW,6BAAM,SAAS,GAAG,WAAU,eAAA,CAAe;AAAA,UAC7E;AAAA,YAAC;AAAA,YAAA;AAAA,cACC;AAAA,cACA;AAAA,cACA,WAAU;AAAA,cACV,WAAW;AAAA,cACX;AAAA,cACC,GAAG;AAAA,YAAA;AAAA,UAAA;AAAA,QACN,EAAA,CACF;AAAA,MAAA,EAAA,CACF;AAAA,IAAA,EAAA,CAEJ,EAAA,CACF;AAAA;AAGJ;"}
@@ -1,15 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react");;/* empty css */var r=,/* empty css */t=,/* empty css */n=,/* empty css */l=,/* empty css */s=,/* empty css */a=,/* empty css */o=,/* empty css */d=,/* empty css */m=,/* empty css */u=,/* empty css */c=,/* empty css */x=,/* empty css */h=,/* empty css */j=;/* empty css */const f=h.default(j.default)(({theme:{palette:e}})=>{var i,r,t,n;return{width:"100%","& .MuiOutlinedInput-root":{height:"2rem","& fieldset":{borderColor:null==(i=e.theme)?void 0:i.secondary[300],borderWidth:2},"&:hover fieldset":{borderColor:null==(r=e.theme)?void 0:r.secondary[300]},"&.Mui-focused fieldset":{borderColor:null==(t=e.theme)?void 0:t.primary[700]},"&.Mui-error fieldset":{borderColor:null==(n=e.theme)?void 0:n.error[600]}}}}),v=h=>{const{type:j,data:v,placeholder:T,error:p=!1,textfield:y,textfieldTitle:g,onCommentSubmit:C,onChange:q,containerProps:b,accordion:N=!0,..._}=h,{user:A}=l.useAuth(),$=i.useRef(null),M=()=>{$.current&&($.current.scrollTop=$.current.scrollHeight)};i.useEffect(()=>{M()},[v]);const S=e=>{const i=/* @__PURE__ */new Date,r=new Date(e),t=i.getTime()-r.getTime(),n=Math.floor(t/1e3),l=Math.floor(n/60),s=Math.floor(l/60);if(n<60)return`${n} second${1!==n?"s":""} ago`;if(l<60)return`${l} minute${1!==l?"s":""} ago`;if(s<24)return`${s} hour${1!==s?"s":""} ago`;{const e={day:"numeric",month:"short",year:"numeric"},i={hour:"numeric",minute:"numeric",hour12:!1};return`${r.toLocaleString("en-US",e)} • ${r.toLocaleString("en-US",i)}`}},D="activity"===j?null==v?void 0:v.map((i,r)=>/* @__PURE__ */e.jsx("div",{className:"Timeline--Activity",children:/* @__PURE__ */e.jsxs(o.default,{children:[
2
- /* @__PURE__ */e.jsxs(d.default,{children:[
3
- /* @__PURE__ */e.jsx(m.default,{}),v.length-1!==r&&/* @__PURE__ */e.jsx(u.default,{})]}),
4
- /* @__PURE__ */e.jsx(c.default,{className:"Timeline--Content",children:/* @__PURE__ */e.jsxs(a.Typography,{type:"s4",color:"theme.secondary.800",className:"Timeline--ActivityLogItem",children:[i.message," · ",S(i.created_at)]})})]},r)})):/* @__PURE__ */e.jsx(e.Fragment,{children:/* @__PURE__ */e.jsx("div",{className:"Timeline--Chat",ref:$,children:v.map((i,n)=>/* @__PURE__ */e.jsxs(o.default,{children:[
5
- /* @__PURE__ */e.jsxs(d.default,{children:[
6
- /* @__PURE__ */e.jsx(t.Avatar,{src:r.images.chat,size:17}),
7
- /* @__PURE__ */e.jsx(u.default,{})]}),
8
- /* @__PURE__ */e.jsxs(c.default,{children:[i.name," commented this · ",S(i.created_at),
9
- /* @__PURE__ */e.jsx("div",{className:"Timeline--CommentWrap",children:/* @__PURE__ */e.jsx("p",{className:"Timeline--Comment",children:i.message})})]})]},n))})});
10
- /* @__PURE__ */
11
- return e.jsx("div",{className:"ActivityContainer",...b,children:/* @__PURE__ */e.jsxs(x.default,{className:"Timeline",children:[N?/* @__PURE__ */e.jsx(n.Accordion,{title:"Activities",accordionProps:{defaultExpanded:!0},children:D}):/* @__PURE__ */e.jsx("div",{className:"Timeline--ActivityBox",children:D}),y&&/* @__PURE__ */e.jsxs("div",{className:"Timeline--CommentBox",children:[g,
12
- /* @__PURE__ */e.jsxs("div",{className:"Timeline--CommentText",children:[
13
- /* @__PURE__ */e.jsx(t.Avatar,{size:32,alt:s.formatText(null==A?void 0:A.full_name),className:"avatar-class"}),
14
- /* @__PURE__ */e.jsx(f,{error:p,placeholder:T,className:"textfield",onKeyDown:e=>{if("Enter"===e.key){const i=e.target.value;""!==i.trim()&&(C(i),M())}},onChange:q,..._})]})]})]})})};exports.ActivityTag=v,exports.default=v;
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/activity-tag/activity-tag.tsx"],"sourcesContent":["import { useRef, useEffect } from \"react\";\nimport { TextField as MUITextField, styled } from \"@mui/material\";\nimport Timeline from \"@mui/lab/Timeline\";\nimport TimelineItem from \"@mui/lab/TimelineItem\";\nimport TimelineSeparator from \"@mui/lab/TimelineSeparator\";\nimport TimelineConnector from \"@mui/lab/TimelineConnector\";\nimport TimelineContent from \"@mui/lab/TimelineContent\";\nimport TimelineDot from \"@mui/lab/TimelineDot\";\nimport \"./activity-tag.scss\";\nimport images from \"../../assets/images\";\nimport Avatar from \"../avatar/avatar\";\nimport Accordion from \"../accordion/accordion\";\nimport { useAuth } from \"../../hooks/useAuth\";\nimport formatText from \"../../utils/format-text\";\nimport Typography from \"../typography/typography\";\n\nconst StyledTextField = styled(MUITextField)(({ theme: { palette } }) => ({\n width: \"100%\",\n \"& .MuiOutlinedInput-root\": {\n height: '2rem',\n \"& fieldset\": {\n borderColor: palette.theme?.secondary[300],\n borderWidth: 2\n },\n \"&:hover fieldset\": {\n borderColor: palette.theme?.secondary[300],\n },\n \"&.Mui-focused fieldset\": {\n // borderWidth: \"0.0625rem\",\n // borderStyle: \"solid\",\n borderColor: palette.theme?.primary[700],\n },\n \"&.Mui-error fieldset\": {\n borderColor: palette.theme?.error[600],\n },\n },\n}));\n\nexport const ActivityTag = (props: any) => {\n const {\n type,\n data,\n placeholder,\n error = false,\n textfield,\n textfieldTitle,\n onCommentSubmit,\n onChange,\n containerProps,\n accordion = true,\n ...rest\n } = props;\n const { user } = useAuth()\n\n const chatRef = useRef<HTMLDivElement>(null);\n\n const scrollToBottom = () => {\n if (chatRef.current) {\n chatRef.current.scrollTop = chatRef.current.scrollHeight;\n }\n };\n\n useEffect(() => {\n scrollToBottom();\n }, [data]);\n\n const formatDateTime = (dateTime: string) => {\n const currentDate = new Date();\n const commentDate = new Date(dateTime);\n const timeDifference = currentDate.getTime() - commentDate.getTime();\n const secondsDifference = Math.floor(timeDifference / 1000);\n const minutesDifference = Math.floor(secondsDifference / 60);\n const hoursDifference = Math.floor(minutesDifference / 60);\n\n if (secondsDifference < 60) {\n return `${secondsDifference} second${secondsDifference !== 1 ? 's' : ''\n } ago`;\n } else if (minutesDifference < 60) {\n return `${minutesDifference} minute${minutesDifference !== 1 ? 's' : ''\n } ago`;\n } else if (hoursDifference < 24) {\n return `${hoursDifference} hour${hoursDifference !== 1 ? 's' : ''} ago`;\n } else {\n // Format the date in the desired format\n const optionsDate: Intl.DateTimeFormatOptions = {\n day: 'numeric',\n month: 'short',\n year: 'numeric'\n };\n\n const optionsTime: Intl.DateTimeFormatOptions = {\n hour: 'numeric',\n minute: 'numeric',\n hour12: false\n };\n\n const formattedDate = commentDate.toLocaleString('en-US', optionsDate);\n const formattedTime = commentDate.toLocaleString('en-US', optionsTime);\n\n return `${formattedDate} • ${formattedTime}`;\n }\n };\n\n const handleKeyPress = (event: any) => {\n if (event.key === 'Enter') {\n const commentValue = (event.target as HTMLInputElement).value;\n if (commentValue.trim() !== '') {\n onCommentSubmit(commentValue);\n scrollToBottom();\n }\n }\n };\n\n const timelineItems =\n type === \"activity\" ? (\n data?.map((item: any, index: number) => (\n <div className=\"Timeline--Activity\">\n <TimelineItem key={index}>\n <TimelineSeparator>\n <TimelineDot />\n {data.length - 1 !== index && <TimelineConnector />}\n </TimelineSeparator>\n <TimelineContent className=\"Timeline--Content\">\n <Typography type=\"s4\" color=\"theme.secondary.800\" className=\"Timeline--ActivityLogItem\">\n {item.message} · {formatDateTime(item.created_at)}\n </Typography>\n </TimelineContent>\n </TimelineItem>\n </div>\n ))\n ) : (\n <>\n <div className=\"Timeline--Chat\" ref={chatRef}>\n {data.map((item: any, index: number) => (\n <TimelineItem key={index}>\n <TimelineSeparator>\n <Avatar src={images.chat} size={17} />\n <TimelineConnector />\n </TimelineSeparator>\n <TimelineContent>\n {item.name} commented this · {formatDateTime(item.created_at)}\n <div className=\"Timeline--CommentWrap\">\n <p className=\"Timeline--Comment\">{item.message}</p>\n </div>\n </TimelineContent>\n </TimelineItem>\n ))}\n </div>\n </>\n );\n\n // const avatarStyle = {\n // borderRadius: '0.5rem',\n // padding: '0.875rem 1.28125rem',\n // textAlign: 'center',\n // backgroundColor: `${randomColor}.200`,\n // color: `${randomColor}.1000`\n // };\n\n return (\n // <Box position='relative'>\n <div className=\"ActivityContainer\" {...containerProps}>\n <Timeline className=\"Timeline\">\n {accordion ? \n <Accordion title='Activities' accordionProps={{ defaultExpanded: true }}>\n {timelineItems}\n </Accordion> : \n <div className=\"Timeline--ActivityBox\">\n {timelineItems}\n </div>\n }\n {textfield && (\n <div className=\"Timeline--CommentBox\">\n {textfieldTitle}\n <div className=\"Timeline--CommentText\">\n <Avatar size={32} alt={formatText(user?.full_name)} className=\"avatar-class\" />\n <StyledTextField\n error={error}\n placeholder={placeholder}\n className=\"textfield\"\n onKeyDown={handleKeyPress}\n onChange={onChange}\n {...rest}\n />\n </div>\n </div>\n )}\n </Timeline>\n </div>\n // </Box>\n );\n};\n\nexport default ActivityTag;\n"],"names":["StyledTextField","styled","MUITextField","theme","palette","width","height","borderColor","_a","secondary","borderWidth","_b","_c","primary","_d","error","ActivityTag","props","type","data","placeholder","textfield","textfieldTitle","onCommentSubmit","onChange","containerProps","accordion","rest","user","useAuth","chatRef","useRef","scrollToBottom","current","scrollTop","scrollHeight","useEffect","formatDateTime","dateTime","currentDate","Date","commentDate","timeDifference","getTime","secondsDifference","Math","floor","minutesDifference","hoursDifference","optionsDate","day","month","year","optionsTime","hour","minute","hour12","toLocaleString","timelineItems","map","item","index","jsx","className","children","TimelineItem","jsxs","TimelineSeparator","TimelineDot","length","TimelineConnector","TimelineContent","Typography","color","message","created_at","Fragment","ref","Avatar","src","images","chat","size","name","Timeline","Accordion","title","accordionProps","defaultExpanded","alt","formatText","full_name","onKeyDown","event","key","commentValue","target","value","trim"],"mappings":"ujCAgBA,MAAMA,EAAkBC,EAAAA,QAAOC,UAAPD,CAAqB,EAAGE,OAASC,2BAAiB,MAAA,CACxEC,MAAO,OACP,2BAA4B,CAC1BC,OAAQ,OACR,aAAc,CACZC,YAAa,OAAAC,EAAAJ,EAAQD,YAAR,EAAAK,EAAeC,UAAU,KACtCC,YAAa,GAEf,mBAAoB,CAClBH,YAAa,OAAAI,EAAAP,EAAQD,YAAR,EAAAQ,EAAeF,UAAU,MAExC,yBAA0B,CAGxBF,YAAa,OAAAK,EAAAR,EAAQD,YAAR,EAAAS,EAAeC,QAAQ,MAEtC,uBAAwB,CACtBN,YAAa,OAAAO,EAAAV,EAAQD,YAAR,EAAAW,EAAeC,MAAM,UAK3BC,EAAeC,IAC1B,MAAMC,KACJA,EAAAC,KACAA,EAAAC,YACAA,EAAAL,MACAA,GAAQ,EAAAM,UACRA,EAAAC,eACAA,EAAAC,gBACAA,EAAAC,SACAA,EAAAC,eACAA,EAAAC,UACAA,GAAY,KACTC,GACDV,GACEW,KAAEA,GAASC,YAEXC,EAAUC,EA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0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../../src/components/charts/bar-chart/bar-chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useMemo } from \"react\";\nimport * as d3 from \"d3\";\n\ninterface DataPoint {\n label: string;\n value: number;\n}\n\ninterface BarChartProps {\n data: DataPoint[];\n numOfLines?: number;\n width?: number;\n height?: number;\n line?: boolean;\n}\n\nconst formatNumber = (num: number) => {\n if (num >= 1e9) return (num / 1e9).toFixed(1) + \"B\";\n if (num >= 1e6) return (num / 1e6).toFixed(1) + \"M\";\n if (num >= 1e3) return (num / 1e3).toFixed(1) + \"K\";\n return num;\n};\n\nconst BarChart: React.FC<BarChartProps> = ({\n data,\n numOfLines = 5,\n width = 500,\n height = 300,\n line = false,\n}) => {\n const svgRef = useRef<SVGSVGElement>(null);\n\n const maxValue = useMemo(() => {\n return Math.max(...data.map((d) => d.value));\n }, [data]);\n\n const yAxisMaxValue = useMemo(() => {\n return maxValue * 1.25;\n }, [maxValue]);\n\n const yAxisTicks = useMemo(() => {\n const ticks = [];\n const interval = yAxisMaxValue / numOfLines;\n for (let i = 0; i <= numOfLines; i++) {\n ticks.push(interval * i);\n }\n return ticks;\n }, [yAxisMaxValue, numOfLines]);\n\n useEffect(() => {\n if (!svgRef.current) return;\n\n const svg = d3.select(svgRef.current);\n\n svg.selectAll(\"*\").remove();\n\n const margin = { top: 20, right: 20, bottom: 70, left: 40 };\n const barWidth = width - margin.left - margin.right;\n const barHeight = height - margin.top - margin.bottom;\n\n const mousemove = (event: MouseEvent, d: DataPoint) => {\n let xPosition = event.offsetX + margin.left - 25;\n const yPosition = event.offsetY + margin.top - 40;\n const tooltipWidth = tooltip.node()?.getBoundingClientRect()?.width;\n const rightOffset = tooltipWidth ? xPosition + tooltipWidth : xPosition;\n if (rightOffset > width) {\n xPosition = Math.floor(\n tooltipWidth ? xPosition - tooltipWidth - 20 : xPosition - 20,\n );\n }\n\n const text = `${d.label} - ${d.value}`;\n tooltip\n .attr(\"x\", xPosition)\n .attr(\"y\", yPosition)\n .style(\"opacity\", 9)\n .style(\"height\", text.length >= 16 ? 50 : 35);\n\n tooltipText.html(text);\n };\n\n const mouseleave = () => {\n tooltip.style(\"opacity\", 0);\n };\n\n const x = d3\n .scaleBand()\n .domain(data.map((d) => d.label))\n .range([0, barWidth])\n .padding(0.1);\n\n const y = d3.scaleLinear().domain([0, yAxisMaxValue]).range([barHeight, 0]);\n\n const chart = svg\n .append(\"g\")\n .attr(\"transform\", `translate(${margin.left},${margin.top})`);\n\n if (line) {\n yAxisTicks.slice(1).forEach((tick) => {\n chart\n .append(\"line\")\n .attr(\"class\", \"dotted-line\")\n .attr(\"x1\", 0)\n .attr(\"y1\", y(tick))\n .attr(\"x2\", barWidth)\n .attr(\"y2\", y(tick))\n .style(\"stroke\", \"gray\")\n .style(\"stroke-dasharray\", \"3,3\")\n .style(\"opacity\", 1);\n });\n }\n\n chart\n .selectAll(\".bar\")\n .data(data)\n .enter()\n .append(\"rect\")\n .attr(\"class\", \"bar\")\n //@ts-expect-error not applicable\n .attr(\"x\", (d: any) => x(d.label))\n .attr(\"y\", (d: any) => y(d.value))\n .attr(\"width\", x.bandwidth())\n .attr(\"height\", (d: any) => barHeight - y(d.value))\n .style(\"fill\", \"#357AF6\")\n .style(\"opacity\", \"1\")\n .on(\"mousemove\", mousemove)\n .on(\"mouseleave\", mouseleave);\n\n const xAxis = chart\n .append(\"g\")\n .attr(\"class\", \"x-axis\")\n .attr(\"transform\", `translate(0, ${barHeight})`)\n .call(d3.axisBottom(x) as any);\n\n xAxis.selectAll(\".tick line\").remove();\n\n const yAxis = chart\n .append(\"g\")\n .attr(\"class\", \"y-axis\")\n .call(\n d3\n .axisLeft(y)\n .tickValues(yAxisTicks)\n //@ts-expect-error not applicable\n .tickFormat((d: any) => {\n return formatNumber(d);\n })\n .tickSizeOuter(0) as any,\n );\n\n yAxis.selectAll(\".tick line\").remove();\n\n const tooltip = svg\n .append(\"foreignObject\")\n .attr(\"class\", \"tooltip\")\n .attr(\"width\", 120)\n .attr(\"height\", 20)\n .style(\"opacity\", 0)\n .style(\"position\", \"absolute\")\n .style(\"background-color\", \"white\")\n .style(\"border\", \"none\")\n .style(\"box-shadow\", \"0rem 0rem 0.469rem 0rem rgba(0, 0, 0, 0.15)\")\n .style(\"border-radius\", \"0.313rem\")\n .style(\"padding\", \"0.625rem\")\n .style(\"font-size\", \"0.75rem\");\n\n const tooltipText = tooltip\n .append(\"xhtml:div\")\n .style(\"font-size\", \"0.75rem\")\n .style(\"color\", \"black\");\n }, [data, height, width, line, yAxisMaxValue, yAxisTicks]);\n\n return (\n <>\n <svg ref={svgRef} width={width} height={height}></svg>\n </>\n );\n};\n\nexport { BarChart };\nexport default BarChart;\n"],"names":["d3.select","d3.scaleBand","d3.scaleLinear","d3.axisBottom","d3.axisLeft"],"mappings":";;;;;;AAgBA,MAAM,eAAe,CAAC,QAAgB;AACpC,MAAI,OAAO,IAAK,SAAQ,MAAM,KAAK,QAAQ,CAAC,IAAI;AAChD,MAAI,OAAO,IAAK,SAAQ,MAAM,KAAK,QAAQ,CAAC,IAAI;AAChD,MAAI,OAAO,IAAK,SAAQ,MAAM,KAAK,QAAQ,CAAC,IAAI;AAChD,SAAO;AACT;AAEA,MAAM,WAAoC,CAAC;AAAA,EACzC;AAAA,EACA,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,SAAS;AAAA,EACT,OAAO;AACT,MAAM;AACJ,QAAM,SAAS,OAAsB,IAAI;AAEzC,QAAM,WAAW,QAAQ,MAAM;AAC7B,WAAO,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC;AAAA,EAC7C,GAAG,CAAC,IAAI,CAAC;AAET,QAAM,gBAAgB,QAAQ,MAAM;AAClC,WAAO,WAAW;AAAA,EACpB,GAAG,CAAC,QAAQ,CAAC;AAEb,QAAM,aAAa,QAAQ,MAAM;AAC/B,UAAM,QAAQ,CAAA;AACd,UAAM,WAAW,gBAAgB;AACjC,a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IAAA;AAGtB,UAAM,UAAU,YAAY,EAAE,OAAA;AAE9B,UAAM,UAAU,IACb,OAAO,eAAe,EACtB,KAAK,SAAS,SAAS,EACvB,KAAK,SAAS,GAAG,EACjB,KAAK,UAAU,EAAE,EACjB,MAAM,WAAW,CAAC,EAClB,MAAM,YAAY,UAAU,EAC5B,MAAM,oBAAoB,OAAO,EACjC,MAAM,UAAU,MAAM,EACtB,MAAM,cAAc,6CAA6C,EACjE,MAAM,iBAAiB,UAAU,EACjC,MAAM,WAAW,UAAU,EAC3B,MAAM,aAAa,SAAS;AAE/B,UAAM,cAAc,QACjB,OAAO,WAAW,EAClB,MAAM,aAAa,SAAS,EAC5B,MAAM,SAAS,OAAO;AAAA,EAC3B,GAAG,CAAC,MAAM,QAAQ,OAAO,MAAM,eAAe,UAAU,CAAC;AAEzD,yCAEI,UAAA,oBAAC,OAAA,EAAI,KAAK,QAAQ,OAAc,QAAgB,EAAA,CAClD;AAEJ;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../../../../node_modules/d3-scale/src/band/index.js"),a=require("../../../../node_modules/d3-scale/src/linear/index.js"),s=require("../../../../node_modules/d3-selection/src/select/index.js"),l=require("../../../../node_modules/d3-axis/src/axis/index.js");const o=({data:o,numOfLines:i=5,width:n=500,height:d=300,line:c=!1})=>{const u=t.useRef(null),m=t.useMemo(()=>Math.max(...o.map(e=>e.value)),[o]),y=t.useMemo(()=>1.25*m,[m]),p=t.useMemo(()=>{const e=[],t=y/i;for(let r=0;r<=i;r++)e.push(t*r);return e},[y,i]);return t.useEffect(()=>{if(!u.current)return;const e=s.default(u.current);e.selectAll("*").remove();const t=n-40-20,i=d-20-70,m=r.default().domain(o.map(e=>e.label)).range([0,t]).padding(.1),h=a.default().domain([0,y]).range([i,0]),x=e.append("g").attr("transform","translate(40,20)");c&&p.slice(1).forEach(e=>{x.append("line").attr("class","dotted-line").attr("x1",0).attr("y1",h(e)).attr("x2",t).attr("y2",h(e)).style("stroke","gray").style("stroke-dasharray","3,3").style("opacity",1)}),x.selectAll(".bar").data(o).enter().append("rect").attr("class","bar").attr("x",e=>m(e.label)).attr("y",e=>h(e.value)).attr("width",m.bandwidth()).attr("height",e=>i-h(e.value)).style("fill","#357AF6").style("opacity","1").on("mousemove",(e,t)=>{var r,a;let s=e.offsetX+40-25;const l=e.offsetY+20-40,o=null==(a=null==(r=f.node())?void 0:r.getBoundingClientRect())?void 0:a.width;(o?s+o:s)>n&&(s=Math.floor(o?s-o-20:s-20));const i=`${t.label} - ${t.value}`;f.attr("x",s).attr("y",l).style("opacity",9).style("height",i.length>=16?50:35),g.html(i)}).on("mouseleave",()=>{f.style("opacity",0)}),x.append("g").attr("class","x-axis").attr("transform",`translate(0, ${i})`).call(l.axisBottom(m)).selectAll(".tick line").remove(),x.append("g").attr("class","y-axis").call(l.axisLeft(h).tickValues(p).tickFormat(e=>{return(t=e)>=1e9?(t/1e9).toFixed(1)+"B":t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":t;var t}).tickSizeOuter(0)).selectAll(".tick line").remove();const f=e.append("foreignObject").attr("class","tooltip").attr("width",120).attr("height",20).style("opacity",0).style("position","absolute").style("background-color","white").style("border","none").style("box-shadow","0rem 0rem 0.469rem 0rem rgba(0, 0, 0, 0.15)").style("border-radius","0.313rem").style("padding","0.625rem").style("font-size","0.75rem"),g=f.append("xhtml:div").style("font-size","0.75rem").style("color","black")},[o,d,n,c,y,p]),/* @__PURE__ */e.jsx(e.Fragment,{children:/* @__PURE__ */e.jsx("svg",{ref:u,width:n,height:d})})};exports.BarChart=o,exports.default=o;
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/charts/bar-chart/bar-chart.tsx"],"sourcesContent":["import React, { useRef, useEffect, useMemo } from \"react\";\nimport * as d3 from \"d3\";\n\ninterface DataPoint {\n label: string;\n value: number;\n}\n\ninterface BarChartProps {\n data: DataPoint[];\n numOfLines?: number;\n width?: number;\n height?: number;\n line?: boolean;\n}\n\nconst formatNumber = (num: number) => {\n if (num >= 1e9) return (num / 1e9).toFixed(1) + \"B\";\n if (num >= 1e6) return (num / 1e6).toFixed(1) + \"M\";\n if (num >= 1e3) return (num / 1e3).toFixed(1) + \"K\";\n return num;\n};\n\nconst BarChart: React.FC<BarChartProps> = ({\n data,\n numOfLines = 5,\n width = 500,\n height = 300,\n line = false,\n}) => {\n const svgRef = useRef<SVGSVGElement>(null);\n\n const maxValue = useMemo(() => {\n return Math.max(...data.map((d) => d.value));\n }, [data]);\n\n const yAxisMaxValue = useMemo(() => {\n return maxValue * 1.25;\n }, [maxValue]);\n\n const yAxisTicks = useMemo(() => {\n const ticks = [];\n const interval = yAxisMaxValue / numOfLines;\n for (let i = 0; i <= numOfLines; i++) {\n ticks.push(interval * i);\n }\n return ticks;\n }, [yAxisMaxValue, numOfLines]);\n\n useEffect(() => {\n if (!svgRef.current) return;\n\n const svg = d3.select(svgRef.current);\n\n svg.selectAll(\"*\").remove();\n\n const margin = { top: 20, right: 20, bottom: 70, left: 40 };\n const barWidth = width - margin.left - margin.right;\n const barHeight = height - margin.top - margin.bottom;\n\n const mousemove = (event: MouseEvent, d: DataPoint) => {\n let xPosition = event.offsetX + margin.left - 25;\n const yPosition = event.offsetY + margin.top - 40;\n const tooltipWidth = tooltip.node()?.getBoundingClientRect()?.width;\n const rightOffset = tooltipWidth ? xPosition + tooltipWidth : xPosition;\n if (rightOffset > width) {\n xPosition = Math.floor(\n tooltipWidth ? xPosition - tooltipWidth - 20 : xPosition - 20,\n );\n }\n\n const text = `${d.label} - ${d.value}`;\n tooltip\n .attr(\"x\", xPosition)\n .attr(\"y\", yPosition)\n .style(\"opacity\", 9)\n .style(\"height\", text.length >= 16 ? 50 : 35);\n\n tooltipText.html(text);\n };\n\n const mouseleave = () => {\n tooltip.style(\"opacity\", 0);\n };\n\n const x = d3\n .scaleBand()\n .domain(data.map((d) => d.label))\n .range([0, barWidth])\n .padding(0.1);\n\n const y = d3.scaleLinear().domain([0, yAxisMaxValue]).range([barHeight, 0]);\n\n const chart = svg\n .append(\"g\")\n .attr(\"transform\", `translate(${margin.left},${margin.top})`);\n\n if (line) {\n yAxisTicks.slice(1).forEach((tick) => {\n chart\n .append(\"line\")\n .attr(\"class\", \"dotted-line\")\n .attr(\"x1\", 0)\n .attr(\"y1\", y(tick))\n .attr(\"x2\", barWidth)\n .attr(\"y2\", y(tick))\n .style(\"stroke\", \"gray\")\n .style(\"stroke-dasharray\", \"3,3\")\n .style(\"opacity\", 1);\n });\n }\n\n chart\n .selectAll(\".bar\")\n .data(data)\n .enter()\n .append(\"rect\")\n .attr(\"class\", \"bar\")\n //@ts-expect-error not applicable\n .attr(\"x\", (d: any) => x(d.label))\n .attr(\"y\", (d: any) => y(d.value))\n .attr(\"width\", x.bandwidth())\n .attr(\"height\", (d: any) => barHeight - y(d.value))\n .style(\"fill\", \"#357AF6\")\n .style(\"opacity\", \"1\")\n .on(\"mousemove\", mousemove)\n .on(\"mouseleave\", mouseleave);\n\n const xAxis = chart\n .append(\"g\")\n .attr(\"class\", \"x-axis\")\n .attr(\"transform\", `translate(0, ${barHeight})`)\n .call(d3.axisBottom(x) as any);\n\n xAxis.selectAll(\".tick line\").remove();\n\n const yAxis = chart\n .append(\"g\")\n .attr(\"class\", \"y-axis\")\n .call(\n d3\n .axisLeft(y)\n .tickValues(yAxisTicks)\n //@ts-expect-error not applicable\n .tickFormat((d: any) => {\n return formatNumber(d);\n })\n .tickSizeOuter(0) as any,\n );\n\n yAxis.selectAll(\".tick line\").remove();\n\n const tooltip = svg\n .append(\"foreignObject\")\n .attr(\"class\", \"tooltip\")\n .attr(\"width\", 120)\n .attr(\"height\", 20)\n .style(\"opacity\", 0)\n .style(\"position\", \"absolute\")\n .style(\"background-color\", \"white\")\n .style(\"border\", \"none\")\n .style(\"box-shadow\", \"0rem 0rem 0.469rem 0rem rgba(0, 0, 0, 0.15)\")\n .style(\"border-radius\", \"0.313rem\")\n .style(\"padding\", \"0.625rem\")\n .style(\"font-size\", \"0.75rem\");\n\n const tooltipText = tooltip\n .append(\"xhtml:div\")\n .style(\"font-size\", \"0.75rem\")\n .style(\"color\", \"black\");\n }, [data, height, width, line, yAxisMaxValue, yAxisTicks]);\n\n return (\n <>\n <svg ref={svgRef} width={width} height={height}></svg>\n </>\n );\n};\n\nexport { BarChart };\nexport default BarChart;\n"],"names":["BarChart","data","numOfLines","width","height","line","svgRef","useRef","maxValue","useMemo","Math","max","map","d","value","yAxisMaxValue","yAxisTicks","ticks","interval","i","push","useEffect","current","svg","d3.select","selectAll","remove","barWidth","barHeight","x","d3.scaleBand","domain","label","range","padding","y","d3.scaleLinear","chart","append","attr","slice","forEach","tick","style","enter","bandwidth","on","event","xPosition","offsetX","yPosition","offsetY","tooltipWidth","_b","_a","tooltip","node","getBoundingClientRect","floor","text","length","tooltipText","html","call","d3.axisBottom","d3.axisLeft","tickValues","tickFormat","num","toFixed","tickSizeOuter","children","jsx","ref"],"mappings":"qYAgBA,MAOMA,EAAoC,EACxCC,OACAC,aAAa,EACbC,QAAQ,IACRC,SAAS,IACTC,QAAO,MAEP,MAAMC,EAASC,EAAAA,OAAsB,MAE/BC,EAAWC,EAAAA,QAAQ,IAChBC,KAAKC,OAAOV,EAAKW,IAAKC,GAAMA,EAAEC,QACpC,CAACb,IAEEc,EAAgBN,EAAAA,QAAQ,IACV,KAAXD,EACN,CAACA,IAEEQ,EAAaP,EAAAA,QAAQ,KACzB,MAAMQ,EAAQ,GACRC,EAAWH,EAAgBb,EACjC,IAAA,IAASiB,EAAI,EAAGA,GAAKjB,EAAYiB,IAC/BF,EAAMG,KAAKF,EAAWC,GAExB,OAAOF,GACN,CAACF,EAAeb,IA6HnB,OA3HAmB,EAAAA,UAAU,KACR,IAAKf,EAAOgB,QAAS,OAErB,MAAMC,EAAMC,EAAAA,QAAUlB,EAAOgB,SA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ByC,EACGhB,KAAK,IAAKS,GACVT,KAAK,IAAKW,GACVP,MAAM,UAAW,GACjBA,MAAM,SAAUgB,EAAKC,QAAU,GAAK,GAAK,IAE5CC,EAAYC,KAAKH,KAgDhBb,GAAG,aA7Ca,KACjBS,EAAQZ,MAAM,UAAW,KA8CbN,EACXC,OAAO,KACPC,KAAK,QAAS,UACdA,KAAK,YAAa,gBAAgBX,MAClCmC,KAAKC,EAAAA,WAAcnC,IAEhBJ,UAAU,cAAcC,SAEhBW,EACXC,OAAO,KACPC,KAAK,QAAS,UACdwB,KACCE,EAAAA,SACY9B,GACT+B,WAAWlD,GAEXmD,WAAYtD,IACX,OAjIUuD,EAiIUvD,IAhInB,KAAauD,EAAM,KAAKC,QAAQ,GAAK,IAC5CD,GAAO,KAAaA,EAAM,KAAKC,QAAQ,GAAK,IAC5CD,GAAO,KAAaA,EAAM,KAAKC,QAAQ,GAAK,IACzCD,EAJY,IAACA,IAmIXE,cAAc,IAGf7C,UAAU,cAAcC,SAE9B,MAAM6B,EAAUhC,EACbe,OAAO,iBACPC,KAAK,QAAS,WACdA,KAAK,QAAS,KACdA,KAAK,SAAU,IACfI,MAAM,UAAW,GACjBA,MAAM,WAAY,YAClBA,MAAM,mBAAoB,SAC1BA,MAAM,SAAU,QAChBA,MAAM,aAAc,+CACpBA,MAAM,gBAAiB,YACvBA,MAAM,UAAW,YACjBA,MAAM,YAAa,WAEhBkB,EAAcN,EACjBjB,OAAO,aACPK,MAAM,YAAa,WACnBA,MAAM,QAAS,UACjB,CAAC1C,EAAMG,EAAQD,EAAOE,EAAMU,EAAeC,qCAI1CuD,wBAAAC,EAAAA,IAAC,MAAA,CAAIC,IAAKnE,EAAQH,QAAcC"}
@@ -1,86 +0,0 @@
1
- import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import { useRef, useEffect } from "react";
3
- /* empty css */
4
- import { Typography } from "../../../typography/typography/index.esm.js";
5
- import select from "../../../../node_modules/d3-selection/src/select/index.esm.js";
6
- import pie from "../../../../node_modules/d3-shape/src/pie/index.esm.js";
7
- import arc from "../../../../node_modules/d3-shape/src/arc/index.esm.js";
8
- const defaultColors = [
9
- "#5BCE97",
10
- "#B3D8E2",
11
- "#F5F6F5",
12
- "#AE6B9E",
13
- "#CBD49A",
14
- "#EEE0B3"
15
- ];
16
- const getSingleNumberFromString = (str) => {
17
- if (typeof str === "number") {
18
- return str;
19
- }
20
- const match = (str == null ? void 0 : str.match(/\d.+/)) || null;
21
- return match ? Number(match[0]) : 0;
22
- };
23
- const DonutChart = ({
24
- data,
25
- height = 140,
26
- width = 140,
27
- isUserDashbord,
28
- legend = true,
29
- direction = "horizontal",
30
- totalUsers,
31
- total = isUserDashbord ? totalUsers : "2.4 GB",
32
- colors = defaultColors,
33
- titleProps = {},
34
- valueProps = {}
35
- }) => {
36
- const svgRef = useRef(null);
37
- useEffect(() => {
38
- if (!svgRef.current) return;
39
- const svg = select(svgRef.current);
40
- svg.selectAll("*").remove();
41
- const margin = 6;
42
- const outerRadius = Math.min(width, height) / 2 - margin;
43
- const innerRadius = Math.min(width, height) / 2 - margin * 2;
44
- const g = svg.append("g").attr("transform", `translate(${width / 2}, ${height / 2})`);
45
- const pie$1 = pie().value((d) => getSingleNumberFromString(d.value));
46
- const path = arc().outerRadius(outerRadius).innerRadius(innerRadius);
47
- const pies = g.selectAll(".arc").data(pie$1(data)).enter().append("g").attr("class", "arc");
48
- pies.append("path").attr("d", path).attr("fill", (d, i) => {
49
- return colors[i % colors.length];
50
- });
51
- g.append("text").attr("text-anchor", "middle").attr("font-size", "18px").attr("font-weight", "600").attr("alignment-baseline", `central`).html(total);
52
- }, [colors, data, height, total, width]);
53
- if (!legend) {
54
- return /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height });
55
- }
56
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs("div", { className: `donut-chart-container ${direction}`, children: [
57
- /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("svg", { ref: svgRef, width, height }) }),
58
- /* @__PURE__ */ jsx("div", { className: "donut-chart-legend", children: data && data.map((d, i) => {
59
- return /* @__PURE__ */ jsxs(
60
- "div",
61
- {
62
- className: "legend",
63
- style: { borderLeft: `0.188rem solid ${colors[i]}` },
64
- children: [
65
- /* @__PURE__ */ jsx("div", { className: "legend-title", children: /* @__PURE__ */ jsx(Typography, { type: "s5", color: "theme.secondary.800", ...titleProps, children: d.label }) }),
66
- /* @__PURE__ */ jsx("div", { className: "legend-value", children: /* @__PURE__ */ jsx(
67
- Typography,
68
- {
69
- type: "s5",
70
- weight: "medium",
71
- color: "theme.secondary.1000",
72
- children: /* @__PURE__ */ jsx(Typography, { type: "s5", color: "theme.secondary.1000", weight: "bold", ...valueProps, children: d.value })
73
- }
74
- ) })
75
- ]
76
- },
77
- d.label
78
- );
79
- }) })
80
- ] }) });
81
- };
82
- export {
83
- DonutChart,
84
- DonutChart as default
85
- };
86
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../../src/components/charts/donut-chart/donut-chart.tsx"],"sourcesContent":["import React, { useRef, useEffect } from \"react\";\nimport * as d3 from \"d3\";\nimport \"./donut-chart.scss\";\nimport Typography from \"../../typography/typography\";\n\ninterface DataPoint {\n label: string;\n value: number;\n}\n\ninterface DonutChartProps {\n data: DataPoint[];\n width?: number;\n height?: number;\n legend?: boolean;\n direction?: \"vertical\" | \"horizontal\";\n total?: string;\n colors ?:Array<string>;\n titleProps?:any\n valueProps?:any \n isUserDashbord ?: boolean \n totalUsers ? : any \n}\n\nconst defaultColors = [\n \"#5BCE97\",\n \"#B3D8E2\",\n \"#F5F6F5\",\n \"#AE6B9E\",\n \"#CBD49A\",\n \"#EEE0B3\",\n];\n\nconst getSingleNumberFromString = (str) => {\n if (typeof str === \"number\") {\n return str;\n }\n const match = str?.match(/\\d.+/) || null;\n return match ? Number(match[0]) : 0;\n};\n\nconst DonutChart: React.FC<DonutChartProps> = ({\n\tdata,\n\theight = 140,\n\twidth = 140,\n isUserDashbord , \n\tlegend = true,\n\tdirection = 'horizontal' ,\n totalUsers , \n\ttotal = isUserDashbord ? totalUsers : \"2.4 GB\",\n colors = defaultColors,\n titleProps={},\n valueProps={}, \n\n}) => {\n const svgRef = useRef<SVGSVGElement>(null);\n\n useEffect(() => {\n if (!svgRef.current) return;\n\n const svg = d3.select(svgRef.current);\n\n svg.selectAll(\"*\").remove();\n\n const margin = 6;\n\n const outerRadius = Math.min(width, height) / 2 - margin;\n const innerRadius = Math.min(width, height) / 2 - margin * 2;\n\n const g = svg\n .append(\"g\")\n .attr(\"transform\", `translate(${width / 2}, ${height / 2})`);\n //@ts-expect-error not applicable\n const pie = d3\n .pie()\n .value((d: DataPoint) => getSingleNumberFromString(d.value));\n\n const path = d3.arc().outerRadius(outerRadius).innerRadius(innerRadius);\n\n const pies = g\n .selectAll(\".arc\")\n //@ts-expect-error not applicable\n .data(pie(data))\n .enter()\n .append(\"g\")\n .attr(\"class\", \"arc\");\n\n pies\n .append(\"path\")\n //@ts-expect-error not applicable\n .attr(\"d\", path)\n //@ts-expect-error not applicable\n .attr(\"fill\", (d: DataPoint, i: number) => {\n return colors[i % colors.length]});\n\n\n // const words = total.split(' '); // Split the text into words\n // const lineHeight = 22; // Define the line height\n // const maxCharsPerLine = 15; // Define the maximum number of characters per line\n\n // let currentLine = '';\n // let lineNumber = 0;\n\n // const textElement =\n g.append(\"text\")\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"18px\")\n .attr(\"font-weight\", \"600\")\n .attr(\"alignment-baseline\", `central`)\n .html(total);\n // .text(total);\n\n // words.forEach((word) => {\n // \tconst tempLine = currentLine + word + ' ';\n\n // \t// Check if the line exceeds the max character count\n // \tif (tempLine.length > maxCharsPerLine && currentLine.length > 0) {\n // \t\ttextElement\n // \t\t\t.append('tspan')\n // \t\t\t.attr('x', 0)\n // \t\t\t.attr('y', lineHeight * lineNumber)\n // \t\t\t.text(currentLine.trim());\n\n // \t\tcurrentLine = word + ' ';\n // \t\tlineNumber++;\n // \t} else {\n // \t\tcurrentLine = tempLine;\n // \t}\n // });\n\n // // Add the last line\n // textElement\n // \t.append('tspan')\n // \t.attr('x', 0)\n // \t.attr('y', lineHeight * lineNumber)\n // \t.text(currentLine.trim());\n }, [colors, data, height, total, width]);\n\n if (!legend) {\n return <svg ref={svgRef} width={width} height={height}></svg>;\n }\n\n return (\n <>\n <div className={`donut-chart-container ${direction}`}>\n <div>\n <svg ref={svgRef} width={width} height={height}></svg>\n </div>\n <div className=\"donut-chart-legend\">\n {data && data.map((d: DataPoint, i: number) => {\n return (\n <div\n className=\"legend\"\n key={d.label}\n style={{ borderLeft: `0.188rem solid ${colors[i]}` }}\n >\n <div className=\"legend-title\">\n <Typography type=\"s5\" color=\"theme.secondary.800\" {...titleProps}>\n {d.label}\n </Typography>\n </div>\n <div className=\"legend-value\">\n <Typography\n type=\"s5\"\n weight=\"medium\"\n color=\"theme.secondary.1000\"\n >\n <Typography type=\"s5\" color=\"theme.secondary.1000\" weight=\"bold\" {...valueProps}>\n {d.value}\n </Typography>\n </Typography>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </>\n );\n};\n\nexport { DonutChart };\nexport default DonutChart;\n"],"names":["d3.select","pie","d3.pie","d3.arc"],"mappings":";;;;;;;AAwBA,MAAM,gBAAgB;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAEA,MAAM,4BAA4B,CAAC,QAAQ;AACzC,MAAI,OAAO,QAAQ,UAAU;AAC3B,WAAO;AAAA,EACT;AACA,QAAM,SAAQ,2BAAK,MAAM,YAAW;AACpC,SAAO,QAAQ,OAAO,MAAM,CAAC,CAAC,IAAI;AACpC;AAEA,MAAM,aAAwC,CAAC;AAAA,EAC9C;AAAA,EACA,SAAS;AAAA,EACT,QAAQ;AAAA,EACP;AAAA,EACD,SAAS;AAAA,EACT,YAAY;AAAA,EACX;AAAA,EACD,QA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,UAAA;AAAA,IAAA,oBAAC,SACC,UAAA,oBAAC,OAAA,EAAI,KAAK,QAAQ,OAAc,QAAgB,EAAA,CAClD;AAAA,IACA,oBAAC,SAAI,WAAU,sBACZ,kBAAQ,KAAK,IAAI,CAAC,GAAc,MAAc;AAC7C,aACE;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,WAAU;AAAA,UAEV,OAAO,EAAE,YAAY,kBAAkB,OAAO,CAAC,CAAC,GAAA;AAAA,UAEhD,UAAA;AAAA,YAAA,oBAAC,OAAA,EAAI,WAAU,gBACf,UAAA,oBAAC,YAAA,EAAW,MAAK,MAAK,OAAM,uBAAuB,GAAG,YACnD,UAAA,EAAE,OACL,GACE;AAAA,YACF,oBAAC,OAAA,EAAI,WAAU,gBACb,UAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,MAAK;AAAA,gBACL,QAAO;AAAA,gBACP,OAAM;AAAA,gBAEN,UAAA,oBAAC,YAAA,EAAW,MAAK,MAAK,OAAM,wBAAuB,QAAO,QAAQ,GAAG,YAClE,UAAA,EAAE,MAAA,CACL;AAAA,cAAA;AAAA,YAAA,EACF,CACF;AAAA,UAAA;AAAA,QAAA;AAAA,QAlBK,EAAE;AAAA,MAAA;AAAA,IAqBb,CAAC,EAAA,CACH;AAAA,EAAA,EAAA,CACF,EAAA,CACF;AAEJ;"}
@@ -1,6 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");;/* empty css */var r=,/* empty css */s=,/* empty css */a=,/* empty css */l=;/* empty css */const n=["#5BCE97","#B3D8E2","#F5F6F5","#AE6B9E","#CBD49A","#EEE0B3"],d=({data:d,height:i=140,width:o=140,isUserDashbord:c,legend:h=!0,direction:u="horizontal",totalUsers:p,total:m=(c?p:"2.4 GB"),colors:x=n,titleProps:g={},valueProps:j={}})=>{const y=t.useRef(null);return t.useEffect(()=>{if(!y.current)return;const e=s.default(y.current);e.selectAll("*").remove();const t=Math.min(o,i)/2-6,r=Math.min(o,i)/2-12,n=e.append("g").attr("transform",`translate(${o/2}, ${i/2})`),c=a.default().value(e=>(e=>{if("number"==typeof e)return e;const t=(null==e?void 0:e.match(/\d.+/))||null;return t?Number(t[0]):0})(e.value)),h=l.default().outerRadius(t).innerRadius(r);n.selectAll(".arc").data(c(d)).enter().append("g").attr("class","arc").append("path").attr("d",h).attr("fill",(e,t)=>x[t%x.length]),n.append("text").attr("text-anchor","middle").attr("font-size","18px").attr("font-weight","600").attr("alignment-baseline","central").html(m)},[x,d,i,m,o]),h?/* @__PURE__ */e.jsx(e.Fragment,{children:/* @__PURE__ */e.jsxs("div",{className:`donut-chart-container ${u}`,children:[
2
- /* @__PURE__ */e.jsx("div",{children:/* @__PURE__ */e.jsx("svg",{ref:y,width:o,height:i})}),
3
- /* @__PURE__ */e.jsx("div",{className:"donut-chart-legend",children:d&&d.map((t,s)=>/* @__PURE__ */e.jsxs("div",{className:"legend",style:{borderLeft:`0.188rem solid ${x[s]}`},children:[
4
- /* @__PURE__ */e.jsx("div",{className:"legend-title",children:/* @__PURE__ */e.jsx(r.Typography,{type:"s5",color:"theme.secondary.800",...g,children:t.label})}),
5
- /* @__PURE__ */e.jsx("div",{className:"legend-value",children:/* @__PURE__ */e.jsx(r.Typography,{type:"s5",weight:"medium",color:"theme.secondary.1000",children:/* @__PURE__ */e.jsx(r.Typography,{type:"s5",color:"theme.secondary.1000",weight:"bold",...j,children:t.value})})})]},t.label))})]})}):/* @__PURE__ */e.jsx("svg",{ref:y,width:o,height:i})};exports.DonutChart=d,exports.default=d;
6
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/components/charts/donut-chart/donut-chart.tsx"],"sourcesContent":["import React, { useRef, useEffect } from \"react\";\nimport * as d3 from \"d3\";\nimport \"./donut-chart.scss\";\nimport Typography from \"../../typography/typography\";\n\ninterface DataPoint {\n label: string;\n value: number;\n}\n\ninterface DonutChartProps {\n data: DataPoint[];\n width?: number;\n height?: number;\n legend?: boolean;\n direction?: \"vertical\" | \"horizontal\";\n total?: string;\n colors ?:Array<string>;\n titleProps?:any\n valueProps?:any \n isUserDashbord ?: boolean \n totalUsers ? : any \n}\n\nconst defaultColors = [\n \"#5BCE97\",\n \"#B3D8E2\",\n \"#F5F6F5\",\n \"#AE6B9E\",\n \"#CBD49A\",\n \"#EEE0B3\",\n];\n\nconst getSingleNumberFromString = (str) => {\n if (typeof str === \"number\") {\n return str;\n }\n const match = str?.match(/\\d.+/) || null;\n return match ? Number(match[0]) : 0;\n};\n\nconst DonutChart: React.FC<DonutChartProps> = ({\n\tdata,\n\theight = 140,\n\twidth = 140,\n isUserDashbord , \n\tlegend = true,\n\tdirection = 'horizontal' ,\n totalUsers , \n\ttotal = isUserDashbord ? totalUsers : \"2.4 GB\",\n colors = defaultColors,\n titleProps={},\n valueProps={}, \n\n}) => {\n const svgRef = useRef<SVGSVGElement>(null);\n\n useEffect(() => {\n if (!svgRef.current) return;\n\n const svg = d3.select(svgRef.current);\n\n svg.selectAll(\"*\").remove();\n\n const margin = 6;\n\n const outerRadius = Math.min(width, height) / 2 - margin;\n const innerRadius = Math.min(width, height) / 2 - margin * 2;\n\n const g = svg\n .append(\"g\")\n .attr(\"transform\", `translate(${width / 2}, ${height / 2})`);\n //@ts-expect-error not applicable\n const pie = d3\n .pie()\n .value((d: DataPoint) => getSingleNumberFromString(d.value));\n\n const path = d3.arc().outerRadius(outerRadius).innerRadius(innerRadius);\n\n const pies = g\n .selectAll(\".arc\")\n //@ts-expect-error not applicable\n .data(pie(data))\n .enter()\n .append(\"g\")\n .attr(\"class\", \"arc\");\n\n pies\n .append(\"path\")\n //@ts-expect-error not applicable\n .attr(\"d\", path)\n //@ts-expect-error not applicable\n .attr(\"fill\", (d: DataPoint, i: number) => {\n return colors[i % colors.length]});\n\n\n // const words = total.split(' '); // Split the text into words\n // const lineHeight = 22; // Define the line height\n // const maxCharsPerLine = 15; // Define the maximum number of characters per line\n\n // let currentLine = '';\n // let lineNumber = 0;\n\n // const textElement =\n g.append(\"text\")\n .attr(\"text-anchor\", \"middle\")\n .attr(\"font-size\", \"18px\")\n .attr(\"font-weight\", \"600\")\n .attr(\"alignment-baseline\", `central`)\n .html(total);\n // .text(total);\n\n // words.forEach((word) => {\n // \tconst tempLine = currentLine + word + ' ';\n\n // \t// Check if the line exceeds the max character count\n // \tif (tempLine.length > maxCharsPerLine && currentLine.length > 0) {\n // \t\ttextElement\n // \t\t\t.append('tspan')\n // \t\t\t.attr('x', 0)\n // \t\t\t.attr('y', lineHeight * lineNumber)\n // \t\t\t.text(currentLine.trim());\n\n // \t\tcurrentLine = word + ' ';\n // \t\tlineNumber++;\n // \t} else {\n // \t\tcurrentLine = tempLine;\n // \t}\n // });\n\n // // Add the last line\n // textElement\n // \t.append('tspan')\n // \t.attr('x', 0)\n // \t.attr('y', lineHeight * lineNumber)\n // \t.text(currentLine.trim());\n }, [colors, data, height, total, width]);\n\n if (!legend) {\n return <svg ref={svgRef} width={width} height={height}></svg>;\n }\n\n return (\n <>\n <div className={`donut-chart-container ${direction}`}>\n <div>\n <svg ref={svgRef} width={width} height={height}></svg>\n </div>\n <div className=\"donut-chart-legend\">\n {data && data.map((d: DataPoint, i: number) => {\n return (\n <div\n className=\"legend\"\n key={d.label}\n style={{ borderLeft: `0.188rem solid ${colors[i]}` }}\n >\n <div className=\"legend-title\">\n <Typography type=\"s5\" color=\"theme.secondary.800\" {...titleProps}>\n {d.label}\n </Typography>\n </div>\n <div className=\"legend-value\">\n <Typography\n type=\"s5\"\n weight=\"medium\"\n color=\"theme.secondary.1000\"\n >\n <Typography type=\"s5\" color=\"theme.secondary.1000\" weight=\"bold\" {...valueProps}>\n {d.value}\n </Typography>\n </Typography>\n </div>\n </div>\n );\n })}\n </div>\n </div>\n </>\n );\n};\n\nexport { DonutChart };\nexport default DonutChart;\n"],"names":["defaultColors","DonutChart","data","height","width","isUserDashbord","legend","direction","totalUsers","total","colors","titleProps","valueProps","svgRef","useRef","useEffect","current","svg","d3.select","selectAll","remove","outerRadius","Math","min","innerRadius","margin","g","append","attr","pie","d3.pie","value","d","str","match","Number","getSingleNumberFromString","path","d3.arc","enter","i","length","html","children","jsxs","className","jsx","ref","map","style","borderLeft","Typography","type","color","label","weight"],"mappings":"kaAwBA,MAAMA,EAAgB,CACpB,UACA,UACA,UACA,UACA,UACA,WAWIC,EAAwC,EAC7CC,OACAC,SAAS,IACTC,QAAQ,IACPC,iBACDC,UAAS,EACTC,YAAY,aACXC,aACDC,SAASJ,EAAiBG,EAAa,UACtCE,SAASV,EACTW,aAAW,CAAA,EACXC,aAAW,CAAA,MAGX,MAAMC,EAASC,EAAAA,OAAsB,MAmFrC,OAjFAC,EAAAA,UAAU,KACR,IAAKF,EAAOG,QAAS,OAErB,MAAMC,EAAMC,EAAAA,QAAUL,EAAOG,SAE7BC,EAAIE,UAAU,KAAKC,SAEnB,MAEMC,EAAcC,KAAKC,IAAInB,EAAOD,GAAU,EAF/B,EAGTqB,EAAcF,KAAKC,IAAInB,EAAOD,GAAU,EAAIsB,GAE5CC,EAAIT,EACPU,OAAO,KACPC,KAAK,YAAa,aAAaxB,EAAQ,MAAMD,EAAS,MAEnD0B,EAAMC,EAAAA,UAETC,MAAOC,GA1CoB,CAACC,IACjC,GAAmB,iBAARA,EACT,OAAOA,EAET,MAAMC,GAAQ,MAAAD,OAAA,EAAAA,EAAKC,MAAM,UAAW,KACpC,OAAOA,EAAQC,OAAOD,EAAM,IAAM,GAqCLE,CAA0BJ,EAAED,QAEjDM,EAAOC,EAAAA,UAASjB,YAAYA,GAAaG,YAAYA,GAE9CE,EACVP,UAAU,QAEVjB,KAAK2B,EAAI3B,IACTqC,QACAZ,OAAO,KACPC,KAAK,QAAS,OAGdD,OAAO,QAEPC,KAAK,IAAKS,GAEVT,KAAK,OAAQ,CAACI,EAAcQ,IACpB9B,EAAO8B,EAAI9B,EAAO+B,SAW7Bf,EAAEC,OAAO,QACNC,KAAK,cAAe,UACpBA,KAAK,YAAa,QAClBA,KAAK,cAAe,OACpBA,KAAK,qBAAsB,WAC3Bc,KAAKjC,IA2BP,CAACC,EAAQR,EAAMC,EAAQM,EAAOL,IAE5BE,mCAMDqC,wBAAAC,EAAAA,KAAC,MAAA,CAAIC,UAAW,yBAAyBtC,IACvCoC,SAAA;eAAAG,EAAAA,IAAC,OACCH,wBAAAG,EAAAA,IAAC,MAAA,CAAIC,IAAKlC,EAAQT,QAAcD;eAElC2C,EAAAA,IAAC,OAAID,UAAU,qBACZF,YAAQzC,EAAK8C,IAAI,CAAChB,EAAcQ,mBAE7BI,EAAAA,KAAC,MAAA,CACCC,UAAU,SAEVI,MAAO,CAAEC,WAAY,kBAAkBxC,EAAO8B,MAE9CG,SAAA;eAAAG,EAAAA,IAAC,MAAA,CAAID,UAAU,eACfF,wBAAAG,EAAAA,IAACK,EAAAA,WAAA,CAAWC,KAAK,KAAKC,MAAM,yBAA0B1C,EACnDgC,SAAAX,EAAEsB;iBAGLR,IAAC,MAAA,CAAID,UAAU,eACbF,wBAAAG,EAAAA,IAACK,EAAAA,WAAA,CACCC,KAAK,KACLG,OAAO,SACPF,MAAM,uBAENV,wBAAAG,EAAAA,IAACK,EAAAA,WAAA,CAAWC,KAAK,KAAKC,MAAM,uBAAuBE,OAAO,UAAW3C,EAClE+B,SAAAX,EAAED,cAfJC,EAAEsB,8BAdZR,EAAAA,IAAC,MAAA,CAAIC,IAAKlC,EAAQT,QAAcD"}
@@ -1,95 +0,0 @@
1
- import _extends from "../../../../@babel/runtime/helpers/esm/extends/index.esm.js";
2
- import _objectWithoutPropertiesLoose from "../../../../@babel/runtime/helpers/esm/objectWithoutPropertiesLoose/index.esm.js";
3
- import * as React from "react";
4
- import PropTypes from "../../../../prop-types/index/index.esm.js";
5
- import { clsx } from "../../../../clsx/dist/clsx/index.esm.js";
6
- import TimelineContext from "../TimelineContext/index.esm.js";
7
- import { getTimelineUtilityClass } from "../timelineClasses/index.esm.js";
8
- import convertTimelinePositionToClass from "../../internal/convertTimelinePositionToClass/index.esm.js";
9
- import { jsx } from "react/jsx-runtime";
10
- import useThemeProps from "../../../material/styles/useThemeProps/index.esm.js";
11
- import styled from "../../../material/styles/styled/index.esm.js";
12
- import composeClasses from "../../../utils/esm/composeClasses/composeClasses/index.esm.js";
13
- var define_process_env_default = {};
14
- const _excluded = ["position", "className"];
15
- const useUtilityClasses = (ownerState) => {
16
- const {
17
- position,
18
- classes
19
- } = ownerState;
20
- const slots = {
21
- root: ["root", position && convertTimelinePositionToClass(position)]
22
- };
23
- return composeClasses(slots, getTimelineUtilityClass, classes);
24
- };
25
- const TimelineRoot = styled("ul", {
26
- name: "MuiTimeline",
27
- slot: "Root",
28
- overridesResolver: (props, styles) => {
29
- const {
30
- ownerState
31
- } = props;
32
- return [styles.root, ownerState.position && styles[convertTimelinePositionToClass(ownerState.position)]];
33
- }
34
- })({
35
- display: "flex",
36
- flexDirection: "column",
37
- padding: "6px 16px",
38
- flexGrow: 1
39
- });
40
- const Timeline = /* @__PURE__ */ React.forwardRef(function Timeline2(inProps, ref) {
41
- const props = useThemeProps({
42
- props: inProps,
43
- name: "MuiTimeline"
44
- });
45
- const {
46
- position = "right",
47
- className
48
- } = props, other = _objectWithoutPropertiesLoose(props, _excluded);
49
- const ownerState = _extends({}, props, {
50
- position
51
- });
52
- const classes = useUtilityClasses(ownerState);
53
- const contextValue = React.useMemo(() => ({
54
- position
55
- }), [position]);
56
- return /* @__PURE__ */ jsx(TimelineContext.Provider, {
57
- value: contextValue,
58
- children: /* @__PURE__ */ jsx(TimelineRoot, _extends({
59
- className: clsx(classes.root, className),
60
- ownerState,
61
- ref
62
- }, other))
63
- });
64
- });
65
- define_process_env_default.NODE_ENV !== "production" ? Timeline.propTypes = {
66
- // ┌────────────────────────────── Warning ──────────────────────────────┐
67
- // │ These PropTypes are generated from the TypeScript type definitions. │
68
- // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
69
- // └─────────────────────────────────────────────────────────────────────┘
70
- /**
71
- * The content of the component.
72
- */
73
- children: PropTypes.node,
74
- /**
75
- * Override or extend the styles applied to the component.
76
- */
77
- classes: PropTypes.object,
78
- /**
79
- * className applied to the root element.
80
- */
81
- className: PropTypes.string,
82
- /**
83
- * The position where the TimelineContent should appear relative to the time axis.
84
- * @default 'right'
85
- */
86
- position: PropTypes.oneOf(["alternate-reverse", "alternate", "left", "right"]),
87
- /**
88
- * The system prop that allows defining system overrides as well as additional CSS styles.
89
- */
90
- sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
91
- } : void 0;
92
- export {
93
- Timeline as default
94
- };
95
- //# sourceMappingURL=index.esm.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.esm.js","sources":["../../../../../../node_modules/@mui/lab/Timeline/Timeline.js"],"sourcesContent":["'use client';\n\nimport _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutPropertiesLoose from \"@babel/runtime/helpers/esm/objectWithoutPropertiesLoose\";\nconst _excluded = [\"position\", \"className\"];\nimport * as React from 'react';\nimport PropTypes from 'prop-types';\nimport clsx from 'clsx';\nimport { unstable_composeClasses as composeClasses } from '@mui/base';\nimport { styled, useThemeProps } from '@mui/material/styles';\nimport TimelineContext from './TimelineContext';\nimport { getTimelineUtilityClass } from './timelineClasses';\nimport convertTimelinePositionToClass from '../internal/convertTimelinePositionToClass';\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst useUtilityClasses = ownerState => {\n const {\n position,\n classes\n } = ownerState;\n const slots = {\n root: ['root', position && convertTimelinePositionToClass(position)]\n };\n return composeClasses(slots, getTimelineUtilityClass, classes);\n};\nconst TimelineRoot = styled('ul', {\n name: 'MuiTimeline',\n slot: 'Root',\n overridesResolver: (props, styles) => {\n const {\n ownerState\n } = props;\n return [styles.root, ownerState.position && styles[convertTimelinePositionToClass(ownerState.position)]];\n }\n})({\n display: 'flex',\n flexDirection: 'column',\n padding: '6px 16px',\n flexGrow: 1\n});\n\n/**\n *\n * Demos:\n *\n * - [Timeline](https://mui.com/material-ui/react-timeline/)\n *\n * API:\n *\n * - [Timeline API](https://mui.com/material-ui/api/timeline/)\n */\nconst Timeline = /*#__PURE__*/React.forwardRef(function Timeline(inProps, ref) {\n const props = useThemeProps({\n props: inProps,\n name: 'MuiTimeline'\n });\n const {\n position = 'right',\n className\n } = props,\n other = _objectWithoutPropertiesLoose(props, _excluded);\n const ownerState = _extends({}, props, {\n position\n });\n const classes = useUtilityClasses(ownerState);\n const contextValue = React.useMemo(() => ({\n position\n }), [position]);\n return /*#__PURE__*/_jsx(TimelineContext.Provider, {\n value: contextValue,\n children: /*#__PURE__*/_jsx(TimelineRoot, _extends({\n className: clsx(classes.root, className),\n ownerState: ownerState,\n ref: ref\n }, other))\n });\n});\nprocess.env.NODE_ENV !== \"production\" ? Timeline.propTypes /* remove-proptypes */ = {\n // ┌────────────────────────────── Warning ──────────────────────────────┐\n // │ These PropTypes are generated from the TypeScript type definitions. │\n // │ To update them, edit the TypeScript types and run `pnpm proptypes`. │\n // └─────────────────────────────────────────────────────────────────────┘\n /**\n * The content of the component.\n */\n children: PropTypes.node,\n /**\n * Override or extend the styles applied to the component.\n */\n classes: PropTypes.object,\n /**\n * className applied to the root element.\n */\n className: PropTypes.string,\n /**\n * The position where the TimelineContent should appear relative to the time axis.\n * @default 'right'\n */\n position: PropTypes.oneOf(['alternate-reverse', 'alternate', 'left', 'right']),\n /**\n * The system prop that allows defining system overrides as well as additional CSS styles.\n */\n sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])\n} : void 0;\n\n/**\n *\n * Demos:\n *\n * - [Timeline](https://mui.com/components/timeline/)\n *\n * API:\n *\n * - [Timeline API](https://mui.com/api/timeline/)\n */\nexport default Timeline;"],"names":["Timeline","_jsx"],"mappings":";;;;;;;;;;;;;AAIA,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