groundfloor-react-ui 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +20 -0
  2. package/assets/fonts/Averta/Averta-Black.woff2 +0 -0
  3. package/assets/fonts/Averta/Averta-BlackItalic.woff2 +0 -0
  4. package/assets/fonts/Averta/Averta-Bold.woff2 +0 -0
  5. package/assets/fonts/Averta/Averta-BoldItalic.woff2 +0 -0
  6. package/assets/fonts/Averta/Averta-ExtraBold.woff2 +0 -0
  7. package/assets/fonts/Averta/Averta-ExtraBoldItalic.woff2 +0 -0
  8. package/assets/fonts/Averta/Averta-ExtraThin.woff2 +0 -0
  9. package/assets/fonts/Averta/Averta-ExtraThinItalic.woff2 +0 -0
  10. package/assets/fonts/Averta/Averta-Light.woff2 +0 -0
  11. package/assets/fonts/Averta/Averta-LightItalic.woff2 +0 -0
  12. package/assets/fonts/Averta/Averta-Regular.woff2 +0 -0
  13. package/assets/fonts/Averta/Averta-RegularItalic.woff2 +0 -0
  14. package/assets/fonts/Averta/Averta-SemiBold.woff2 +0 -0
  15. package/assets/fonts/Averta/Averta-SemiBoldItalic.woff2 +0 -0
  16. package/assets/fonts/Averta/Averta-Thin.woff2 +0 -0
  17. package/assets/fonts/Averta/Averta-ThinItalic.woff2 +0 -0
  18. package/assets/fonts/Beauty/BeautyDemo.woff +0 -0
  19. package/assets/icons/app-logo.svg +3 -0
  20. package/assets/icons/arrow-down.svg +3 -0
  21. package/assets/icons/arrow-rotate.svg +1 -0
  22. package/assets/icons/arrow-up.svg +3 -0
  23. package/assets/icons/bell.svg +3 -0
  24. package/assets/icons/check.svg +3 -0
  25. package/assets/icons/checkmark.svg +3 -0
  26. package/assets/icons/chevron-down.svg +3 -0
  27. package/assets/icons/chevron-left.svg +3 -0
  28. package/assets/icons/chevron-right.svg +3 -0
  29. package/assets/icons/cloud-icon.svg +3 -0
  30. package/assets/icons/connection.svg +3 -0
  31. package/assets/icons/cross-icon.svg +3 -0
  32. package/assets/icons/door-internal-active.svg +1 -0
  33. package/assets/icons/edit-icon.svg +3 -0
  34. package/assets/icons/ellipses-horizontal.svg +3 -0
  35. package/assets/icons/ellipses.svg +3 -0
  36. package/assets/icons/email.svg +3 -0
  37. package/assets/icons/eye-hide-view.svg +1 -0
  38. package/assets/icons/eye-hide.svg +1 -0
  39. package/assets/icons/file-attach-white.svg +3 -0
  40. package/assets/icons/file-attach.svg +3 -0
  41. package/assets/icons/functional-equation-regular.svg +147 -0
  42. package/assets/icons/hamburger-menu.svg +3 -0
  43. package/assets/icons/heart.svg +18 -0
  44. package/assets/icons/image.svg +3 -0
  45. package/assets/icons/info.svg +3 -0
  46. package/assets/icons/jpg-icon.svg +3 -0
  47. package/assets/icons/magnifier.svg +3 -0
  48. package/assets/icons/menu-ellipse-two.svg +1 -0
  49. package/assets/icons/menu-ellipse.svg +53 -0
  50. package/assets/icons/pause-all.svg +1 -0
  51. package/assets/icons/pdf-icon.svg +3 -0
  52. package/assets/icons/pen-icon.svg +3 -0
  53. package/assets/icons/plus-outlined.svg +3 -0
  54. package/assets/icons/resume.svg +1 -0
  55. package/assets/icons/sign-icon.svg +3 -0
  56. package/assets/icons/star.svg +3 -0
  57. package/assets/icons/trash-icon.svg +59 -0
  58. package/assets/icons/triangle-down.svg +3 -0
  59. package/assets/icons/users.svg +11 -0
  60. package/assets/icons/view.svg +3 -0
  61. package/assets/icons/watcher.svg +3 -0
  62. package/assets/icons/zoom-in-white.svg +1 -0
  63. package/assets/styles/global.css +0 -0
  64. package/assets/styles/global.scss +0 -0
  65. package/components/Accordion/Accordion.js +114 -0
  66. package/components/Accordion/AccordionSB.js +168 -0
  67. package/components/Accordion/AccordionSBfooter.js +171 -0
  68. package/components/Accordion/index.js +4 -0
  69. package/components/ArrowBar/ArrowBar.js +293 -0
  70. package/components/ArrowBar/index.js +2 -0
  71. package/components/Avatar/Avatar.js +167 -0
  72. package/components/Avatar/AvatarSB.js +226 -0
  73. package/components/Avatar/AvatarSBfooter.js +226 -0
  74. package/components/Avatar/index.js +4 -0
  75. package/components/Banner/Banner.js +65 -0
  76. package/components/Banner/index.js +2 -0
  77. package/components/Breadcrumb/Breadcrumb.js +192 -0
  78. package/components/Breadcrumb/index.js +2 -0
  79. package/components/Button/PrimaryButton.js +125 -0
  80. package/components/Button/SecondaryButton.js +114 -0
  81. package/components/Button/TinyButton.js +94 -0
  82. package/components/Button/index.js +6 -0
  83. package/components/Cards/Card.js +48 -0
  84. package/components/Cards/CardRef.js +64 -0
  85. package/components/Cards/DocumentCard.js +221 -0
  86. package/components/Cards/index.js +5 -0
  87. package/components/Content/Content.js +51 -0
  88. package/components/Content/index.js +1 -0
  89. package/components/Divider/Divider.js +63 -0
  90. package/components/Divider/index.js +2 -0
  91. package/components/Drawer/Drawer.js +93 -0
  92. package/components/Drawer/index.js +2 -0
  93. package/components/ErrorBoundary/ErrorBoundary.js +44 -0
  94. package/components/ErrorBoundary/index.js +1 -0
  95. package/components/FilterChip/FilterChip.js +68 -0
  96. package/components/FilterChip/index.js +1 -0
  97. package/components/Footer/Footer.js +58 -0
  98. package/components/Footer/FooterContentLev3.js +96 -0
  99. package/components/Footer/index.js +2 -0
  100. package/components/Form/FormComponent.js +273 -0
  101. package/components/Form/HeaderComponent.js +39 -0
  102. package/components/Form/StyledComponent.js +323 -0
  103. package/components/Form/SubmitComponent.js +63 -0
  104. package/components/Form/index.js +4 -0
  105. package/components/GroupAvatars/GroupAvatars.js +143 -0
  106. package/components/GroupAvatars/index.js +1 -0
  107. package/components/GroupButtons/ButtonPopup.js +192 -0
  108. package/components/GroupButtons/GroupButtons.js +150 -0
  109. package/components/GroupButtons/GroupButtonsPopup.js +169 -0
  110. package/components/GroupButtons/index.js +3 -0
  111. package/components/GroupStatusCircle/GroupStatusCircle.js +135 -0
  112. package/components/GroupStatusCircle/index.js +1 -0
  113. package/components/Header/Header.js +58 -0
  114. package/components/Header/index.js +1 -0
  115. package/components/HyperLink/HyperLink.js +114 -0
  116. package/components/HyperLink/index.js +1 -0
  117. package/components/Icon/Icon.js +161 -0
  118. package/components/Icon/index.js +1 -0
  119. package/components/Images/Image.js +112 -0
  120. package/components/Images/index.js +2 -0
  121. package/components/Inputs/CheckBoxEditableInput.js +352 -0
  122. package/components/Inputs/CheckBoxInput.js +195 -0
  123. package/components/Inputs/CheckBoxInputMS.js +160 -0
  124. package/components/Inputs/DateSelect.js +411 -0
  125. package/components/Inputs/DropdownSelect.js +466 -0
  126. package/components/Inputs/DropzoneInput.js +335 -0
  127. package/components/Inputs/NumericInput.js +155 -0
  128. package/components/Inputs/RadioInput.js +205 -0
  129. package/components/Inputs/SearchInput.js +18 -0
  130. package/components/Inputs/Signature.js +278 -0
  131. package/components/Inputs/TextArea.js +196 -0
  132. package/components/Inputs/TextInput.js +182 -0
  133. package/components/Inputs/TextInputClicable.js +198 -0
  134. package/components/Inputs/TextInputClicableMS.js +255 -0
  135. package/components/Inputs/TimeInput.js +181 -0
  136. package/components/Inputs/ToggleSwitch.js +123 -0
  137. package/components/Inputs/index.js +13 -0
  138. package/components/Label/Label.js +48 -0
  139. package/components/Label/index.js +1 -0
  140. package/components/Loaders/Loader.js +179 -0
  141. package/components/Loaders/index.js +2 -0
  142. package/components/Modal/Modal.js +116 -0
  143. package/components/Modal/ModalComp.js +158 -0
  144. package/components/Modal/index.js +2 -0
  145. package/components/Overlay/Overlay.js +159 -0
  146. package/components/Overlay/index.js +1 -0
  147. package/components/Pagination/Pagination.js +83 -0
  148. package/components/Pagination/index.js +1 -0
  149. package/components/ProgressBar/ProgressBar.js +84 -0
  150. package/components/ProgressBar/index.js +1 -0
  151. package/components/ProgressSteps/ProgressSteps.js +121 -0
  152. package/components/ProgressSteps/index.js +1 -0
  153. package/components/Rating/Rating.js +264 -0
  154. package/components/Rating/index.js +1 -0
  155. package/components/SecondaryLink/DarkSecondaryLink.js +97 -0
  156. package/components/SecondaryLink/LightSecondaryLink.js +93 -0
  157. package/components/SecondaryLink/index.js +3 -0
  158. package/components/Sidebar/Navbar.js +328 -0
  159. package/components/Sidebar/Sidebar.js +180 -0
  160. package/components/Sidebar/index.js +3 -0
  161. package/components/StatusChip/PrimaryStatusChip.js +78 -0
  162. package/components/StatusChip/SecondaryStatusChip.js +78 -0
  163. package/components/StatusChip/SlimPrimaryStatusChip.js +92 -0
  164. package/components/StatusChip/SlimSecondaryStatusChip.js +93 -0
  165. package/components/StatusChip/index.js +6 -0
  166. package/components/StatusCircle/StatusCircle.js +64 -0
  167. package/components/StatusCircle/index.js +1 -0
  168. package/components/Tables/Table.js +156 -0
  169. package/components/Tables/index.js +1 -0
  170. package/components/Tooltip/Tooltip.js +479 -0
  171. package/components/Tooltip/index.js +1 -0
  172. package/components/Typography/Typography.js +78 -0
  173. package/components/Typography/index.js +2 -0
  174. package/components/constants/colors.js +33 -0
  175. package/components/constants/defaultStyle.js +781 -0
  176. package/components/constants/defaultThemeColor.js +15 -0
  177. package/components/constants/index.js +7 -0
  178. package/components/constants/utils.js +31 -0
  179. package/components/global/FontStyle.js +131 -0
  180. package/components/global/index.js +1 -0
  181. package/dist/index.es.js +2302 -0
  182. package/dist/index.js +2302 -0
  183. package/index.js +40 -0
  184. package/package.json +67 -0
  185. package/rollup.config.js +53 -0
@@ -0,0 +1,3 @@
1
+ <svg width="9" height="7" viewBox="0 0 9 7" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.271484 0.153671H8.27148L4.27148 6.15367L0.271484 0.153671Z" fill="#081348"/>
3
+ </svg>
@@ -0,0 +1,11 @@
1
+ <svg width="22" height="23" viewBox="0 0 22 23" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <g clip-path="url(#clip0_230_6893)">
3
+ <path d="M10.9998 0.923828C5.45056 0.923828 0.916504 5.4581 0.916504 11.0072C0.916504 16.5562 5.42782 21.0905 10.9998 21.0905C16.5719 21.0905 21.0832 16.5792 21.0832 11.0072C21.0832 5.43515 16.5489 0.923828 10.9998 0.923828ZM5.78904 18.0004C6.87183 16.1504 8.87931 14.9552 11.0449 14.9552C13.2105 14.9552 15.1958 16.1057 16.2786 17.9556C14.8127 19.0613 12.9854 19.738 11.0228 19.738C9.0374 19.7371 7.23304 19.0833 5.78904 18.0005V18.0004ZM17.2936 17.053C15.9402 14.9103 13.6165 13.6245 11.0449 13.6245C8.496 13.6245 6.10478 14.978 4.77404 17.0987C3.24038 15.5193 2.29294 13.3765 2.29294 11.008C2.2701 6.20241 6.1953 2.27731 11.0001 2.27731C15.8048 2.27731 19.7299 6.20241 19.7299 11.0072C19.7299 13.3529 18.8053 15.4737 17.2936 17.053V17.053Z" fill="#2E56F4"/>
4
+ <path d="M10.9997 5.07471C9.03716 5.07471 7.41309 6.67604 7.41309 8.66133C7.41309 10.6239 9.01442 12.2479 10.9997 12.2479C12.985 12.2479 14.5863 10.6466 14.5863 8.66133C14.5863 6.67604 12.9621 5.07471 10.9997 5.07471ZM10.9997 10.8719C9.78157 10.8719 8.76657 9.87968 8.76657 8.6388C8.76657 7.42067 9.75883 6.40567 10.9997 6.40567C12.2406 6.40567 13.2328 7.39793 13.2328 8.6388C13.2328 9.87968 12.2177 10.8719 10.9997 10.8719Z" fill="#2E56F4"/>
5
+ </g>
6
+ <defs>
7
+ <clipPath id="clip0_230_6893">
8
+ <rect width="22" height="22" fill="white" transform="translate(0 0.00714111)"/>
9
+ </clipPath>
10
+ </defs>
11
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="17" viewBox="0 0 20 17" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M19.6519 8.31959C17.7015 3.79111 14.0323 0.981323 10.0735 0.981323C6.11473 0.981323 2.44559 3.79111 0.49516 8.31959C0.441993 8.44141 0.414551 8.5729 0.414551 8.70581C0.414551 8.83873 0.441993 8.97022 0.49516 9.09204C2.44559 13.6205 6.11473 16.4303 10.0735 16.4303C14.0323 16.4303 17.7015 13.6205 19.6519 9.09204C19.7051 8.97022 19.7325 8.83873 19.7325 8.70581C19.7325 8.5729 19.7051 8.44141 19.6519 8.31959ZM10.0735 14.4992C7.0127 14.4992 4.11602 12.288 2.44559 8.70581C4.11602 5.12358 7.0127 2.91245 10.0735 2.91245C13.1344 2.91245 16.031 5.12358 17.7015 8.70581C16.031 12.288 13.1344 14.4992 10.0735 14.4992ZM10.0735 4.84357C9.30965 4.84357 8.56292 5.07009 7.92778 5.49447C7.29264 5.91886 6.7976 6.52206 6.50528 7.2278C6.21296 7.93353 6.13647 8.7101 6.2855 9.4593C6.43452 10.2085 6.80236 10.8967 7.34251 11.4368C7.88265 11.977 8.57084 12.3448 9.32004 12.4938C10.0692 12.6429 10.8458 12.5664 11.5515 12.2741C12.2573 11.9817 12.8605 11.4867 13.2849 10.8516C13.7093 10.2164 13.9358 9.4697 13.9358 8.70581C13.9358 7.68148 13.5289 6.69911 12.8045 5.97479C12.0802 5.25048 11.0979 4.84357 10.0735 4.84357ZM10.0735 10.6369C9.69159 10.6369 9.31823 10.5237 9.00066 10.3115C8.68308 10.0993 8.43557 9.79769 8.2894 9.44482C8.14324 9.09196 8.105 8.70367 8.17951 8.32907C8.25403 7.95447 8.43795 7.61038 8.70802 7.34031C8.97809 7.07023 9.32218 6.88631 9.69679 6.8118C10.0714 6.73728 10.4597 6.77553 10.8125 6.92169C11.1654 7.06785 11.467 7.31537 11.6792 7.63294C11.8914 7.95051 12.0047 8.32387 12.0047 8.70581C12.0047 9.21798 11.8012 9.70917 11.439 10.0713C11.0769 10.4335 10.5857 10.6369 10.0735 10.6369Z" fill="#2A50FD"/>
3
+ </svg>
@@ -0,0 +1,3 @@
1
+ <svg width="20" height="13" viewBox="0 0 20 13" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M0.656738 6.70582C0.656738 6.70582 4.63454 0.455765 10.3157 0.455765C16.0544 0.455765 19.9747 6.70582 19.9747 6.70582C19.9747 6.70582 17.1336 12.9559 10.3157 12.9559C3.55432 12.9559 0.656738 6.70582 0.656738 6.70582ZM6.33889 6.70581C6.33889 8.92161 8.0998 10.6825 10.3156 10.6825C12.5314 10.6825 14.2923 8.92161 14.2923 6.70581C14.2923 4.49001 12.5314 2.7291 10.3156 2.7291C8.0998 2.7291 6.33889 4.49001 6.33889 6.70581ZM10.3157 8.41028C11.2574 8.41028 12.0201 7.64753 12.0201 6.70582C12.0201 5.76411 11.2574 5.00136 10.3157 5.00136C9.37395 5.00136 8.6112 5.76411 8.6112 6.70582C8.6112 7.64753 9.37395 8.41028 10.3157 8.41028Z" fill="#2A50FD"/>
3
+ </svg>
@@ -0,0 +1 @@
1
+ <svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><defs><style>.cls-1{fill:#fff;}</style></defs><path class="cls-1" d="M22.6,10.6H13.4V1.4a1.4,1.4,0,1,0-2.8,0v9.2H1.4a1.4,1.4,0,1,0,0,2.8h9.2v9.2a1.4,1.4,0,1,0,2.8,0V13.4h9.2a1.4,1.4,0,0,0,0-2.8Z" transform="translate(0 0)"/></svg>
File without changes
File without changes
@@ -0,0 +1,114 @@
1
+ import React, { useState, useRef } from "react";
2
+ import PropTypes from 'prop-types';
3
+ import defaultStyles from '../constants/defaultStyle';
4
+ import { Card, CardRef } from "../Cards";
5
+
6
+ /**
7
+ * Primary UI component for user interaction
8
+ */
9
+
10
+ export const Accordion = ({
11
+ theme,
12
+ customStylesAccordionContainer,
13
+ customStylesAccordionTogggle,
14
+ customStylesAccordionIcon,
15
+ customStylesAccordionContent,
16
+ toggleIconAnimation,
17
+ icon,
18
+ content,
19
+ contentToggle,
20
+ ...props }) => {
21
+
22
+ const [contentIsOpen, setContentIsOpen] = useState(false);
23
+ const contentRef = useRef(null); //Used to get the height of the content
24
+
25
+ return (
26
+ <Card
27
+ theme={theme}
28
+ customStyles={customStylesAccordionContainer}
29
+ type={'accordionContainer'}
30
+ {...props}
31
+ header={
32
+ <Card
33
+ theme={theme}
34
+ customStyles={customStylesAccordionTogggle}
35
+ type={'accordionToggle'}
36
+ {...props}
37
+ onClick={() => { setContentIsOpen(!contentIsOpen) }}
38
+ header={contentToggle} //Label of the toggle
39
+ content={ //Icon of the toggle
40
+ <div
41
+ theme={theme}
42
+ style={
43
+ toggleIconAnimation &&
44
+ contentIsOpen ? { transform: 'rotate(180deg)', transition: 'transform ease 95ms', background: 'transparent' } :
45
+ { transform: 'rotate(0deg)', background: 'transparent' }
46
+ }
47
+ >
48
+ {icon}
49
+ </div>}
50
+ />
51
+ }
52
+ content={
53
+ <CardRef
54
+ theme={theme}
55
+ customStyles={customStylesAccordionContent}
56
+ type={'accordionContent'}
57
+ ref={contentRef}
58
+ // contentIsOpen={contentIsOpen}
59
+ {...props}
60
+ style={
61
+ contentIsOpen ? { height: contentRef.current.scrollHeight + 'px', } : { height: '0px', borderBottom: 'none' }
62
+ }
63
+ content={content}
64
+ />}
65
+ />
66
+ );
67
+ };
68
+
69
+ Accordion.propTypes = {
70
+ /**
71
+ * Theme object
72
+ */
73
+ theme: PropTypes.object,
74
+ /**
75
+ * Custom style for the Container
76
+ */
77
+ customStylesAccordionContainer: PropTypes.object,
78
+ /**
79
+ * Custom style for the Toggle
80
+ */
81
+ customStylesAccordionTogggle: PropTypes.object,
82
+ /**
83
+ * Custom style for the Icon
84
+ */
85
+ customStylesAccordionIcon: PropTypes.object,
86
+ /**
87
+ * Custom style for the Content
88
+ */
89
+ customStylesAccordionContent: PropTypes.object,
90
+ /**
91
+ * Toggle icon animation if false the icon does not rotate
92
+ */
93
+ toggleIconAnimation: PropTypes.bool,
94
+ /**
95
+ * Icon to apply rotation animation when toggle accordion
96
+ */
97
+ icon: PropTypes.any,
98
+ /**
99
+ * Element to be inside the content of the accordion
100
+ */
101
+ content: PropTypes.any,
102
+ /**
103
+ * String or element to be display in the header of the accordion
104
+ */
105
+ contentToggle: PropTypes.any,
106
+ };
107
+
108
+ Accordion.defaultProps = {
109
+ theme: defaultStyles,
110
+ contentToggle: 'Toggle',
111
+ content: 'Content'
112
+
113
+ };
114
+
@@ -0,0 +1,168 @@
1
+ import React, { useState, useEffect, useRef, useMemo } from "react";
2
+ import PropTypes from 'prop-types';
3
+ import styled from 'styled-components';
4
+ import defaultStyles from '../constants/defaultStyle';
5
+ import { Card, CardRef } from "../Cards";
6
+
7
+ /**
8
+ * Primary UI component for user interaction
9
+ */
10
+
11
+ export const AccordionSB = ({
12
+ theme,
13
+ customStylesAccordionContainer,
14
+ customStylesAccordionTogggle,
15
+ customStylesAccordionIcon,
16
+ customStylesAccordionContent,
17
+ toggleIconAnimation,
18
+ icon,
19
+ content,
20
+ contentToggle,
21
+ isSelected,
22
+ index,
23
+ handleClick,
24
+ isAccordionOpen,
25
+ ...props }) => {
26
+
27
+ const [contentIsOpen, setContentIsOpen] = useState(false);
28
+ const contentRef = useRef(null); //Used to get the height of the content
29
+
30
+ const [customStylesContainer, setCustomStylesContainer] = useState({})
31
+ const [customStylesTogggle, setCustomStylesTogggle] = useState({})
32
+
33
+
34
+ useEffect(() => {
35
+ if (isSelected) {
36
+ setCustomStylesContainer((prev) => {
37
+ return {
38
+ ...prev,
39
+ backgroundColor: '#2444d8',
40
+ marginBottom: '15.5px',
41
+ marginTop: index !== 0 ? '15.5px' : '0px',
42
+
43
+ }
44
+ })
45
+ setCustomStylesTogggle((prev) => {
46
+ return {
47
+ ...prev,
48
+ backgroundColor: '#2444d8',
49
+ paddingTop: '14px',
50
+ paddingBottom: '14px',
51
+ paddingLeft: '14px',
52
+ }
53
+ })
54
+
55
+
56
+ } else {
57
+ setCustomStylesContainer({})
58
+ setCustomStylesTogggle({})
59
+ }
60
+ }, [isSelected])
61
+
62
+ useEffect(() => {
63
+ if (isAccordionOpen) {
64
+ setContentIsOpen(true)
65
+ } else {
66
+ setContentIsOpen(false)
67
+ }
68
+
69
+ }, [isAccordionOpen])
70
+
71
+ return (
72
+ <Card
73
+ theme={theme}
74
+ customStyles={{ ...customStylesAccordionContainer, ...customStylesContainer }}
75
+ type={'accordionContainer'}
76
+ {...props}
77
+ header={ //Header of Accordion
78
+ <Card
79
+ theme={theme}
80
+ customStyles={{ ...customStylesAccordionTogggle, ...customStylesTogggle }}
81
+ type={'accordionToggle'}
82
+ {...props}
83
+ // onClick={() => { setContentIsOpen(!contentIsOpen) }}
84
+ onClick={() => {
85
+ if (!contentIsOpen) {
86
+ handleClick(index)
87
+ }
88
+ setContentIsOpen(!contentIsOpen)
89
+
90
+
91
+ }}
92
+ header={contentToggle} //Label of the toggle
93
+ content={ //Icon of the toggle
94
+ <div
95
+ theme={theme}
96
+ style={
97
+ toggleIconAnimation &&
98
+ contentIsOpen ? { transform: 'rotate(180deg)', transition: 'transform ease 95ms', background: 'transparent' } :
99
+ { transform: 'rotate(0deg)', background: 'transparent' }
100
+ }
101
+ >
102
+ {icon}
103
+ </div>}
104
+ />
105
+ }
106
+ content={ //Body of Accordion
107
+ <CardRef
108
+ theme={theme}
109
+ customStyles={customStylesAccordionContent}
110
+ type={'accordionContent'}
111
+ ref={contentRef}
112
+ // contentIsOpen={contentIsOpen}
113
+ {...props}
114
+ style={
115
+ contentIsOpen ? { height: contentRef.current.scrollHeight + 'px', } : { height: '0px', borderBottom: 'none' }
116
+ }
117
+ content={content}
118
+ />}
119
+ />
120
+ );
121
+ };
122
+
123
+ AccordionSB.propTypes = {
124
+ /**
125
+ * Theme object
126
+ */
127
+ theme: PropTypes.object,
128
+ /**
129
+ * Custom style for the Container
130
+ */
131
+ customStylesAccordionContainer: PropTypes.object,
132
+ /**
133
+ * Custom style for the Toggle
134
+ */
135
+ customStylesAccordionTogggle: PropTypes.object,
136
+ /**
137
+ * Custom style for the Icon
138
+ */
139
+ customStylesAccordionIcon: PropTypes.object,
140
+ /**
141
+ * Custom style for the Content
142
+ */
143
+ customStylesAccordionContent: PropTypes.object,
144
+ /**
145
+ * Toggle icon animation if false the icon does not rotate
146
+ */
147
+ toggleIconAnimation: PropTypes.bool,
148
+ /**
149
+ * Icon to apply rotation animation when toggle accordion
150
+ */
151
+ icon: PropTypes.any,
152
+ /**
153
+ * Element to be inside the content of the accordion
154
+ */
155
+ content: PropTypes.any,
156
+ /**
157
+ * String or element to be display in the header of the accordion
158
+ */
159
+ contentToggle: PropTypes.any,
160
+ };
161
+
162
+ AccordionSB.defaultProps = {
163
+ theme: defaultStyles,
164
+ contentToggle: 'Toggle',
165
+ content: 'Content'
166
+
167
+ };
168
+
@@ -0,0 +1,171 @@
1
+ import React, { useState, useEffect, useRef, useMemo } from "react";
2
+ import PropTypes from 'prop-types';
3
+ import defaultStyles from '../constants/defaultStyle';
4
+ import { Card, CardRef } from "../Cards";
5
+
6
+ /**
7
+ * Primary UI component for user interaction
8
+ */
9
+
10
+ export const AccordionSBfooter = ({
11
+ theme,
12
+ customStylesAccordionContainer,
13
+ customStylesAccordionTogggle,
14
+ customStylesAccordionIcon,
15
+ customStylesAccordionContent,
16
+ toggleIconAnimation,
17
+ icon,
18
+ content,
19
+ contentToggle,
20
+ isSelected,
21
+ index,
22
+ handleClick,
23
+ isAccordionOpen,
24
+ disable,
25
+ ...props }) => {
26
+
27
+ const [contentIsOpen, setContentIsOpen] = useState(false);
28
+ const contentRef = useRef(null); //Used to get the height of the content
29
+
30
+ const [customStylesContainer, setCustomStylesContainer] = useState({})
31
+ const [customStylesTogggle, setCustomStylesTogggle] = useState({})
32
+
33
+
34
+ useEffect(() => {
35
+ if (isSelected) {
36
+ setCustomStylesContainer((prev) => {
37
+ return {
38
+ ...prev,
39
+ backgroundColor: '#2444d8',
40
+ marginBottom: '15.5px',
41
+ marginTop: index !== 0 ? '15.5px' : '0px',
42
+
43
+ }
44
+ })
45
+ setCustomStylesTogggle((prev) => {
46
+ return {
47
+ ...prev,
48
+ backgroundColor: '#2444d8',
49
+ paddingTop: '14px',
50
+ paddingBottom: '14px',
51
+ paddingLeft: '14px',
52
+
53
+ }
54
+ })
55
+
56
+
57
+ } else {
58
+ setCustomStylesContainer({})
59
+ setCustomStylesTogggle({})
60
+ }
61
+ }, [isSelected])
62
+ // console.log("customStylesContainer", customStylesContainer)
63
+
64
+ useEffect(() => {
65
+ if (isAccordionOpen) {
66
+ setContentIsOpen(true)
67
+ } else {
68
+ setContentIsOpen(false)
69
+ }
70
+
71
+ }, [isAccordionOpen])
72
+
73
+ return (
74
+ <Card
75
+ theme={theme}
76
+ customStyles={{ ...customStylesAccordionContainer, ...customStylesContainer }}
77
+ type={'accordionContainer'}
78
+ {...props}
79
+ header={ //Header of Accordion
80
+ <Card
81
+ theme={theme}
82
+ customStyles={{ ...customStylesAccordionTogggle, ...customStylesTogggle }}
83
+ type={'accordionToggle'}
84
+ {...props}
85
+ // onClick={() => { setContentIsOpen(!contentIsOpen) }}
86
+ onClick={() => {
87
+ if (disable) return
88
+ if (!contentIsOpen) {
89
+ handleClick(index)
90
+ }
91
+ setContentIsOpen(!contentIsOpen)
92
+
93
+
94
+ }}
95
+ header={contentToggle} //Label of the toggle
96
+ content={ //Icon of the toggle
97
+ <div
98
+ theme={theme}
99
+ style={
100
+ toggleIconAnimation &&
101
+ contentIsOpen ? { transform: 'rotate(180deg)', transition: 'transform ease 95ms', background: 'transparent' } :
102
+ { transform: 'rotate(0deg)', background: 'transparent' }
103
+ }
104
+ >
105
+ {icon}
106
+ </div>}
107
+ />
108
+ }
109
+ content={ //Body of Accordion
110
+ <CardRef
111
+ theme={theme}
112
+ customStyles={customStylesAccordionContent}
113
+ type={'accordionContent'}
114
+ ref={contentRef}
115
+ // contentIsOpen={contentIsOpen}
116
+ {...props}
117
+ style={
118
+ contentIsOpen ? { height: contentRef.current.scrollHeight + 'px', } : { height: '0px', borderBottom: 'none' }
119
+ }
120
+ content={content}
121
+ />}
122
+ />
123
+ );
124
+ };
125
+
126
+ AccordionSBfooter.propTypes = {
127
+ /**
128
+ * Theme object
129
+ */
130
+ theme: PropTypes.object,
131
+ /**
132
+ * Custom style for the Container
133
+ */
134
+ customStylesAccordionContainer: PropTypes.object,
135
+ /**
136
+ * Custom style for the Toggle
137
+ */
138
+ customStylesAccordionTogggle: PropTypes.object,
139
+ /**
140
+ * Custom style for the Icon
141
+ */
142
+ customStylesAccordionIcon: PropTypes.object,
143
+ /**
144
+ * Custom style for the Content
145
+ */
146
+ customStylesAccordionContent: PropTypes.object,
147
+ /**
148
+ * Toggle icon animation if false the icon does not rotate
149
+ */
150
+ toggleIconAnimation: PropTypes.bool,
151
+ /**
152
+ * Icon to apply rotation animation when toggle accordion
153
+ */
154
+ icon: PropTypes.any,
155
+ /**
156
+ * Element to be inside the content of the accordion
157
+ */
158
+ content: PropTypes.any,
159
+ /**
160
+ * String or element to be display in the header of the accordion
161
+ */
162
+ contentToggle: PropTypes.any,
163
+ };
164
+
165
+ AccordionSBfooter.defaultProps = {
166
+ theme: defaultStyles,
167
+ contentToggle: 'Toggle',
168
+ content: 'Content'
169
+
170
+ };
171
+
@@ -0,0 +1,4 @@
1
+ export * from './Accordion';
2
+ export * from './AccordionSB';
3
+ export * from './AccordionSBfooter';
4
+