@hellobetterdigitalnz/betterui 0.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 (230) hide show
  1. package/.editorconfig +17 -0
  2. package/.eslintrc.cjs +14 -0
  3. package/.storybook/main.ts +23 -0
  4. package/.storybook/preview.ts +17 -0
  5. package/README.md +30 -0
  6. package/index.html +13 -0
  7. package/package.json +45 -0
  8. package/public/image/table-image.png +0 -0
  9. package/public/vite.svg +1 -0
  10. package/src/App.tsx +30 -0
  11. package/src/Components/DataDisplay/Accordion/Accordion.stories.tsx +57 -0
  12. package/src/Components/DataDisplay/Accordion/Accordion.tsx +14 -0
  13. package/src/Components/DataDisplay/Accordion/AccordionContext.tsx +11 -0
  14. package/src/Components/DataDisplay/Accordion/AccordionContextInterface.tsx +8 -0
  15. package/src/Components/DataDisplay/Accordion/AccordionItem.tsx +62 -0
  16. package/src/Components/DataDisplay/Accordion/AccordionItemProps.tsx +12 -0
  17. package/src/Components/DataDisplay/Accordion/AccordionProps.tsx +8 -0
  18. package/src/Components/DataDisplay/Accordion/AccordionProvider.tsx +65 -0
  19. package/src/Components/DataDisplay/Accordion/AccordionProviderInterface.tsx +8 -0
  20. package/src/Components/DataDisplay/Accordion/accordion.module.scss +56 -0
  21. package/src/Components/DataDisplay/Badge/Badge.stories.tsx +44 -0
  22. package/src/Components/DataDisplay/Badge/Badge.tsx +32 -0
  23. package/src/Components/DataDisplay/Badge/BadgeProps.tsx +6 -0
  24. package/src/Components/DataDisplay/Badge/badge.module.scss +42 -0
  25. package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.stories.tsx +26 -0
  26. package/src/Components/DataDisplay/Cards/BannerCard/BannerCard.tsx +47 -0
  27. package/src/Components/DataDisplay/Cards/BannerCard/BannerCardInterface.tsx +15 -0
  28. package/src/Components/DataDisplay/Cards/BannerCard/banner-card.scss +54 -0
  29. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.stories.tsx +31 -0
  30. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCard.tsx +53 -0
  31. package/src/Components/DataDisplay/Cards/PathwayCard/PathwayCardInterface.tsx +17 -0
  32. package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card-stories.scss +3 -0
  33. package/src/Components/DataDisplay/Cards/PathwayCard/pathway-card.scss +62 -0
  34. package/src/Components/DataDisplay/Media/Media.tsx +26 -0
  35. package/src/Components/DataDisplay/Media/MediaProps.tsx +9 -0
  36. package/src/Components/DataDisplay/Media/media.scss +0 -0
  37. package/src/Components/DataDisplay/Modal/Modal.tsx +5 -0
  38. package/src/Components/DataDisplay/Modal/ModalActions.tsx +5 -0
  39. package/src/Components/DataDisplay/Modal/ModalActionsLeft.tsx +5 -0
  40. package/src/Components/DataDisplay/Modal/ModalActionsRight.tsx +5 -0
  41. package/src/Components/DataDisplay/Modal/ModalBody.tsx +5 -0
  42. package/src/Components/DataDisplay/Modal/ModalCurtain.tsx +5 -0
  43. package/src/Components/DataDisplay/Modal/ModalHeader.tsx +5 -0
  44. package/src/Components/DataDisplay/NotificationsBell/NotificationBell.stories.tsx +27 -0
  45. package/src/Components/DataDisplay/NotificationsBell/NotificationsBell.tsx +51 -0
  46. package/src/Components/DataDisplay/NotificationsBell/NotificationsBellProps.tsx +9 -0
  47. package/src/Components/DataDisplay/NotificationsBell/notificationBell.module.scss +48 -0
  48. package/src/Components/DataDisplay/NotificationsPanel/Notification.stories.tsx +128 -0
  49. package/src/Components/DataDisplay/NotificationsPanel/Notification.tsx +59 -0
  50. package/src/Components/DataDisplay/NotificationsPanel/NotificationProps.tsx +11 -0
  51. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroup.tsx +17 -0
  52. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupProps.tsx +8 -0
  53. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroups.tsx +42 -0
  54. package/src/Components/DataDisplay/NotificationsPanel/NotificationsGroupsProps.tsx +7 -0
  55. package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeader.tsx +27 -0
  56. package/src/Components/DataDisplay/NotificationsPanel/NotificationsHeaderProps.tsx +9 -0
  57. package/src/Components/DataDisplay/NotificationsPanel/NotificationsNone.tsx +11 -0
  58. package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanel.tsx +8 -0
  59. package/src/Components/DataDisplay/NotificationsPanel/NotificationsPanelProps.tsx +7 -0
  60. package/src/Components/DataDisplay/NotificationsPanel/notificationPanel.module.scss +196 -0
  61. package/src/Components/DataDisplay/Tab/Tab.stories.tsx +72 -0
  62. package/src/Components/DataDisplay/Tab/Tab.tsx +20 -0
  63. package/src/Components/DataDisplay/Tab/TabBody.tsx +6 -0
  64. package/src/Components/DataDisplay/Tab/TabBodyContent.tsx +15 -0
  65. package/src/Components/DataDisplay/Tab/TabBodyContentProps.tsx +9 -0
  66. package/src/Components/DataDisplay/Tab/TabBodyProps.tsx +8 -0
  67. package/src/Components/DataDisplay/Tab/TabContext.tsx +9 -0
  68. package/src/Components/DataDisplay/Tab/TabContextProps.tsx +6 -0
  69. package/src/Components/DataDisplay/Tab/TabNav.tsx +6 -0
  70. package/src/Components/DataDisplay/Tab/TabNavItem.tsx +49 -0
  71. package/src/Components/DataDisplay/Tab/TabNavItemProps.tsx +9 -0
  72. package/src/Components/DataDisplay/Tab/TabNavProps.tsx +8 -0
  73. package/src/Components/DataDisplay/Tab/TabProps.tsx +8 -0
  74. package/src/Components/DataDisplay/Tab/tab.module.scss +35 -0
  75. package/src/Components/DataDisplay/Tab/tab.stories.scss +3 -0
  76. package/src/Components/DataDisplay/Table/Table.stories.tsx +64 -0
  77. package/src/Components/DataDisplay/Table/Table.tsx +10 -0
  78. package/src/Components/DataDisplay/Table/TableBody.tsx +13 -0
  79. package/src/Components/DataDisplay/Table/TableBodyProps.tsx +8 -0
  80. package/src/Components/DataDisplay/Table/TableCell.tsx +30 -0
  81. package/src/Components/DataDisplay/Table/TableCellAction.tsx +27 -0
  82. package/src/Components/DataDisplay/Table/TableCellActionProps.tsx +11 -0
  83. package/src/Components/DataDisplay/Table/TableCellProps.tsx +11 -0
  84. package/src/Components/DataDisplay/Table/TableCellWithDesc.tsx +21 -0
  85. package/src/Components/DataDisplay/Table/TableCellWithDescProps.tsx +9 -0
  86. package/src/Components/DataDisplay/Table/TableCellWithImage.tsx +39 -0
  87. package/src/Components/DataDisplay/Table/TableCellWithImageProps.tsx +10 -0
  88. package/src/Components/DataDisplay/Table/TableFooter.tsx +5 -0
  89. package/src/Components/DataDisplay/Table/TableHead.tsx +11 -0
  90. package/src/Components/DataDisplay/Table/TableHeadProps.tsx +8 -0
  91. package/src/Components/DataDisplay/Table/TableHeaderCell.tsx +17 -0
  92. package/src/Components/DataDisplay/Table/TableHeaderCellProps.tsx +10 -0
  93. package/src/Components/DataDisplay/Table/TableProps.tsx +8 -0
  94. package/src/Components/DataDisplay/Table/TableRow.tsx +9 -0
  95. package/src/Components/DataDisplay/Table/TableRowProps.tsx +8 -0
  96. package/src/Components/DataDisplay/Table/table.module.scss +103 -0
  97. package/src/Components/Form/Button/Button.stories.tsx +66 -0
  98. package/src/Components/Form/Button/Button.tsx +64 -0
  99. package/src/Components/Form/Button/ButtonProps.tsx +18 -0
  100. package/src/Components/Form/Button/button.module.scss +142 -0
  101. package/src/Components/Form/Checkbox/Checkbox.stories.tsx +49 -0
  102. package/src/Components/Form/Checkbox/Checkbox.tsx +85 -0
  103. package/src/Components/Form/Checkbox/CheckboxProps.tsx +22 -0
  104. package/src/Components/Form/Checkbox/checkbox.module.scss +63 -0
  105. package/src/Components/Form/CheckboxSelect/CheckboxSelect.tsx +5 -0
  106. package/src/Components/Form/CheckboxSelect/CheckboxSelectItem.tsx +5 -0
  107. package/src/Components/Form/CheckboxSet/CheckboxSet.stories.tsx +93 -0
  108. package/src/Components/Form/CheckboxSet/CheckboxSet.tsx +14 -0
  109. package/src/Components/Form/CheckboxSet/CheckboxSetItem.tsx +88 -0
  110. package/src/Components/Form/CheckboxSet/CheckboxSetProps.tsx +9 -0
  111. package/src/Components/Form/CheckboxSet/checkboxSet.module.scss +13 -0
  112. package/src/Components/Form/CurrencyField/CurrenctField.stories.tsx +22 -0
  113. package/src/Components/Form/CurrencyField/CurrencyField.tsx +59 -0
  114. package/src/Components/Form/CurrencyField/CurrencyFieldProps.tsx +8 -0
  115. package/src/Components/Form/DateField/DateField.stories.tsx +22 -0
  116. package/src/Components/Form/DateField/DateField.tsx +58 -0
  117. package/src/Components/Form/DropdownBadge/DropdownBadge.stories.tsx +49 -0
  118. package/src/Components/Form/DropdownBadge/DropdownBadge.tsx +160 -0
  119. package/src/Components/Form/DropdownBadge/DropdownBadgeItem.tsx +40 -0
  120. package/src/Components/Form/DropdownBadge/DropdownBadgeItemProps.tsx +10 -0
  121. package/src/Components/Form/DropdownBadge/DropdownBadgeProps.tsx +31 -0
  122. package/src/Components/Form/DropdownBadge/DropdownBadgeSelector.tsx +11 -0
  123. package/src/Components/Form/DropdownBadge/DropdownBadgeSelectorProps.tsx +7 -0
  124. package/src/Components/Form/DropdownBadge/dropdownBadge.module.scss +105 -0
  125. package/src/Components/Form/DropdownField/DropdownField.stories.tsx +50 -0
  126. package/src/Components/Form/DropdownField/DropdownField.tsx +118 -0
  127. package/src/Components/Form/DropdownField/DropdownFieldItem.tsx +26 -0
  128. package/src/Components/Form/DropdownField/DropdownFieldItemProps.tsx +9 -0
  129. package/src/Components/Form/DropdownField/DropdownFieldProps.tsx +33 -0
  130. package/src/Components/Form/DropdownField/DropdownFieldSelector.tsx +15 -0
  131. package/src/Components/Form/DropdownField/DropdownFieldSelectorProps.tsx +7 -0
  132. package/src/Components/Form/DropdownField/dropdown.module.scss +79 -0
  133. package/src/Components/Form/EmailField/EmailField.stories.ts +23 -0
  134. package/src/Components/Form/EmailField/EmailField.tsx +51 -0
  135. package/src/Components/Form/ErrorMessage/ErrorMessage.tsx +5 -0
  136. package/src/Components/Form/FormFieldHolder/FormFieldHolder.tsx +5 -0
  137. package/src/Components/Form/IconButton/IconButton.stories.tsx +45 -0
  138. package/src/Components/Form/IconButton/IconButton.tsx +58 -0
  139. package/src/Components/Form/IconButton/IconButtonProps.tsx +15 -0
  140. package/src/Components/Form/IconButton/iconButton.module.scss +111 -0
  141. package/src/Components/Form/InputProps.tsx +25 -0
  142. package/src/Components/Form/MultiSelectField/MultiSelectField.tsx +5 -0
  143. package/src/Components/Form/MultiSelectField/MultiSelectFieldItem.tsx +5 -0
  144. package/src/Components/Form/MultiSelectField/MultiSelectFieldTag.tsx +5 -0
  145. package/src/Components/Form/PasswordField/PasswordField.stories.tsx +22 -0
  146. package/src/Components/Form/PasswordField/PasswordField.tsx +70 -0
  147. package/src/Components/Form/RadioButtons/RadioButton.tsx +70 -0
  148. package/src/Components/Form/RadioButtons/RadioButtonProps.tsx +22 -0
  149. package/src/Components/Form/RadioButtons/RadioButtons.stories.tsx +64 -0
  150. package/src/Components/Form/RadioButtons/RadioButtons.tsx +18 -0
  151. package/src/Components/Form/RadioButtons/RadioButtonsProps.tsx +10 -0
  152. package/src/Components/Form/RadioButtons/radioButton.stories.scss +3 -0
  153. package/src/Components/Form/RadioButtons/radiobutton.module.scss +63 -0
  154. package/src/Components/Form/TextField/TextField.stories.ts +23 -0
  155. package/src/Components/Form/TextField/TextField.tsx +52 -0
  156. package/src/Components/Form/Textarea/Textarea.stories.ts +31 -0
  157. package/src/Components/Form/Textarea/Textarea.tsx +71 -0
  158. package/src/Components/Form/Textarea/TextareaProps.tsx +27 -0
  159. package/src/Components/Form/Textarea/textarea.module.scss +49 -0
  160. package/src/Components/Form/TimeField/TimeField.stories.tsx +22 -0
  161. package/src/Components/Form/TimeField/TimeField.tsx +58 -0
  162. package/src/Components/Form/ToggleSwitch/ToggleSwitch.stories.tsx +49 -0
  163. package/src/Components/Form/ToggleSwitch/ToggleSwitch.tsx +87 -0
  164. package/src/Components/Form/ToggleSwitch/ToggleSwitchProps.tsx +22 -0
  165. package/src/Components/Form/ToggleSwitch/toggleSwitch.module.scss +82 -0
  166. package/src/Components/Form/inputs.module.scss +121 -0
  167. package/src/Components/Icons/Arrows/CaretDown/CaretDown.tsx +49 -0
  168. package/src/Components/Icons/Arrows/CaretUp/CaretUp.tsx +49 -0
  169. package/src/Components/Icons/Commerce/CurrencyDollarSimple/CurrencyDollarSimple.tsx +105 -0
  170. package/src/Components/Icons/Communication/AddressBook/AddressBook.stories.ts +28 -0
  171. package/src/Components/Icons/Communication/AddressBook/AddressBook.tsx +50 -0
  172. package/src/Components/Icons/Communication/Asterick/Asterisk.stories.ts +28 -0
  173. package/src/Components/Icons/Communication/Asterick/Asterisk.tsx +50 -0
  174. package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.stories.ts +28 -0
  175. package/src/Components/Icons/Communication/AsterickSimple/AsteriskSimple.tsx +49 -0
  176. package/src/Components/Icons/Communication/At/At.stories.ts +28 -0
  177. package/src/Components/Icons/Communication/At/At.tsx +49 -0
  178. package/src/Components/Icons/Communication/Broadcast/Broadcast.stories.ts +27 -0
  179. package/src/Components/Icons/Communication/Broadcast/Broadcast.tsx +49 -0
  180. package/src/Components/Icons/Communication/Chat/Chat.stories.ts +28 -0
  181. package/src/Components/Icons/Communication/Chat/Chat.tsx +49 -0
  182. package/src/Components/Icons/Design/Eye/Eye.tsx +105 -0
  183. package/src/Components/Icons/Design/EyeSlash/EyeSlash.tsx +105 -0
  184. package/src/Components/Icons/IconProps.tsx +5 -0
  185. package/src/Components/Icons/MathAndFinance/XIcon/XIcon.tsx +107 -0
  186. package/src/Components/Icons/SystemAndDevice/Bell/Bell.tsx +49 -0
  187. package/src/Components/Icons/Time/CalendarBank/CalendarBank.tsx +105 -0
  188. package/src/Components/Icons/Time/Clock/Clock.tsx +105 -0
  189. package/src/Components/Layout/CalloutPopup/CalloutPopup.tsx +5 -0
  190. package/src/Components/Layout/Header/Header.tsx +5 -0
  191. package/src/Components/Layout/Header/HeaderLeft.tsx +5 -0
  192. package/src/Components/Layout/Header/HeaderRight.tsx +5 -0
  193. package/src/Components/Layout/Pagination/Pagination.tsx +5 -0
  194. package/src/Components/Layout/Pagination/PaginationFirst.tsx +5 -0
  195. package/src/Components/Layout/Pagination/PaginationLast.tsx +5 -0
  196. package/src/Components/Layout/Pagination/PaginationNext.tsx +5 -0
  197. package/src/Components/Layout/Pagination/PaginationNumber.tsx +5 -0
  198. package/src/Components/Layout/Pagination/PaginationPrevious.tsx +5 -0
  199. package/src/Components/Layout/ProfileAvatar/ProfileAvatar.tsx +5 -0
  200. package/src/Components/Layout/ProfileAvatar/ProfileAvatarProps.tsx +4 -0
  201. package/src/Components/Layout/ProfileDropdown/ProfileDropdown.tsx +5 -0
  202. package/src/Components/Layout/ProfileDropdown/ProfileHeader.tsx +5 -0
  203. package/src/Components/Layout/ProfileDropdown/ProfileLink.tsx +5 -0
  204. package/src/Components/Layout/ProfileDropdown/ProfileLinks.tsx +5 -0
  205. package/src/Components/Layout/ProfileDropdown/ProfileNavigationItem.tsx +5 -0
  206. package/src/Components/Layout/ProfileDropdown/ProfileSwitchPanel.tsx +5 -0
  207. package/src/Components/Layout/ProfileDropdown/ProfileSwitchUser.tsx +5 -0
  208. package/src/Components/Layout/Sidebar/Sidebar.tsx +5 -0
  209. package/src/Components/Layout/Sidebar/SidebarChevron.tsx +5 -0
  210. package/src/Components/Layout/Sidebar/SidebarNavigation.tsx +5 -0
  211. package/src/Components/Layout/Sidebar/SidebarNavigationItem.tsx +5 -0
  212. package/src/Components/Layout/Sidebar/SidebarSubNavigation.tsx +5 -0
  213. package/src/Notification/Notification.tsx +83 -0
  214. package/src/Notification/NotificationInterface.tsx +9 -0
  215. package/src/Notification/NotificationList.tsx +29 -0
  216. package/src/Notification/NotificationListHolder.tsx +14 -0
  217. package/src/Notification/NotificationListHolderInterface.tsx +8 -0
  218. package/src/Notification/NotificationListInterface.tsx +11 -0
  219. package/src/Notification/notification.scss +225 -0
  220. package/src/global.scss +231 -0
  221. package/src/main.tsx +9 -0
  222. package/src/variables.scss +2 -0
  223. package/src/vite-env.d.ts +1 -0
  224. package/tokens/color/color.mdx +82 -0
  225. package/tokens/shadow/shadow-panel.scss +12 -0
  226. package/tokens/shadow/shadow.mdx +34 -0
  227. package/tokens/typography/typography.mdx +31 -0
  228. package/tsconfig.json +25 -0
  229. package/tsconfig.node.json +10 -0
  230. package/vite.config.ts +7 -0
@@ -0,0 +1,59 @@
1
+ import XIcon from "../../Icons/MathAndFinance/XIcon/XIcon.tsx";
2
+ import styles from "./notificationPanel.module.scss";
3
+ import NotificationProps from "./NotificationProps.tsx";
4
+
5
+ const Notification = (props: NotificationProps) => {
6
+ const {
7
+ notificationInitials,
8
+ boldText,
9
+ summaryText,
10
+ notificatonItemOnClick,
11
+ regularText,
12
+ extraClass,
13
+ closeOnClick,
14
+ } = props;
15
+ return (
16
+ <>
17
+ <li
18
+ onClick={notificatonItemOnClick}
19
+ className={`${styles.notificationList} ${extraClass}`}
20
+ >
21
+ <div className={styles.notificationListWrapper}>
22
+ <div className={styles.notificationListIcon}>
23
+ <div className={styles.notificationListPip}></div>
24
+ <div
25
+ onClick={closeOnClick}
26
+ className={styles.notificationListCloseIcon}
27
+ >
28
+ <XIcon />
29
+ </div>
30
+ </div>
31
+ <div className={styles.notificationListContent}>
32
+ {notificationInitials && (
33
+ <div className={styles.notificationListInitial}>
34
+ <div className={styles.notificationListInitialWrapper}>
35
+ {notificationInitials}
36
+ </div>
37
+ </div>
38
+ )}
39
+ <div className={styles.notificationListDesc}>
40
+ <p>
41
+ {boldText && (
42
+ <span className={styles.boldText}> {boldText}</span>
43
+ )}
44
+ {regularText && (
45
+ <span className={styles.regularText}> {regularText}</span>
46
+ )}
47
+ {summaryText && (
48
+ <span className={styles.summaryText}> {summaryText}</span>
49
+ )}
50
+ </p>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ </li>
55
+ </>
56
+ );
57
+ };
58
+
59
+ export default Notification;
@@ -0,0 +1,11 @@
1
+ interface NotificationProps {
2
+ notificationInitials?: string;
3
+ extraClass?: string;
4
+ boldText?: string;
5
+ regularText?: string;
6
+ summaryText?: string;
7
+ notificatonItemOnClick?: () => void;
8
+ closeOnClick?: () => void;
9
+ }
10
+
11
+ export default NotificationProps;
@@ -0,0 +1,17 @@
1
+ import NotificationsGroupProps from "./NotificationsGroupProps";
2
+ import styles from "./notificationPanel.module.scss";
3
+
4
+ const NotificationsGroup = ({ children, title }: NotificationsGroupProps) => {
5
+ return (
6
+ <>
7
+ {title && (
8
+ <div className={styles.notificationGroup}>
9
+ <h6>{title}</h6>
10
+ </div>
11
+ )}
12
+ <div>{children}</div>
13
+ </>
14
+ );
15
+ };
16
+
17
+ export default NotificationsGroup;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface NotificationsGroupProps {
4
+ children?: ReactNode;
5
+ title: string;
6
+ }
7
+
8
+ export default NotificationsGroupProps;
@@ -0,0 +1,42 @@
1
+ import { useEffect, useState } from "react";
2
+ import NotificationsGroupsProps from "./NotificationsGroupsProps";
3
+ import styles from "./notificationPanel.module.scss";
4
+
5
+ const NotificationsGroups = (props: NotificationsGroupsProps) => {
6
+ const { children } = props;
7
+ const [isScrollbarVisible, setIsScrollbarVisible] = useState(false);
8
+
9
+ useEffect(() => {
10
+ const listContainer = document.getElementById("listContainer");
11
+
12
+ if (listContainer) {
13
+ const handleResize = () => {
14
+ const updatedScrollbarVisible =
15
+ listContainer.scrollHeight > listContainer.clientHeight;
16
+ setIsScrollbarVisible(updatedScrollbarVisible);
17
+ };
18
+
19
+ window.addEventListener("resize", handleResize);
20
+
21
+ handleResize();
22
+
23
+ // Cleanup the event listener on component unmount
24
+ return () => {
25
+ window.removeEventListener("resize", handleResize);
26
+ };
27
+ }
28
+ }, []);
29
+
30
+ return (
31
+ <div
32
+ id={"listContainer"}
33
+ className={`${styles.notificationGrouplistHolder} ${
34
+ isScrollbarVisible ? styles.spacing : ""
35
+ }`}
36
+ >
37
+ <ul className={`${styles.notificationGrouplist}`}>{children}</ul>
38
+ </div>
39
+ );
40
+ };
41
+
42
+ export default NotificationsGroups;
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface NotificationsGroupsProps {
4
+ children?: ReactNode;
5
+ }
6
+
7
+ export default NotificationsGroupsProps;
@@ -0,0 +1,27 @@
1
+ import NotificationsHeaderProps from "./NotificationsHeaderProps";
2
+ import styles from "./notificationPanel.module.scss";
3
+ const NotificationsHeader = (props: NotificationsHeaderProps) => {
4
+ const { extraClass, markAllAsReadOnClick, showMarkAllAsRead } = props;
5
+
6
+ return (
7
+ <div className={`${styles.notificationheader} ${extraClass}`}>
8
+ <div className={styles.notificationHeaderWrapper}>
9
+ <div>
10
+ <h5>Notifications</h5>
11
+ </div>
12
+ <div>
13
+ {showMarkAllAsRead && (
14
+ <div
15
+ onClick={markAllAsReadOnClick}
16
+ className={styles.notificationMarkAllAction}
17
+ >
18
+ <h6>Mark all as Read</h6>
19
+ </div>
20
+ )}
21
+ </div>
22
+ </div>
23
+ </div>
24
+ );
25
+ };
26
+
27
+ export default NotificationsHeader;
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface NotificationsHeaderProps {
4
+ extraClass?: string;
5
+ markAllAsReadOnClick?: () => void;
6
+ showMarkAllAsRead?: boolean;
7
+ }
8
+
9
+ export default NotificationsHeaderProps;
@@ -0,0 +1,11 @@
1
+ import styles from "./notificationPanel.module.scss";
2
+
3
+ const NotificationsNone = () => {
4
+ return (
5
+ <li className={styles.notificationNone}>
6
+ <h6>No notifications.</h6>
7
+ </li>
8
+ );
9
+ };
10
+
11
+ export default NotificationsNone;
@@ -0,0 +1,8 @@
1
+ import NotificationsPanelProps from "./NotificationsPanelProps";
2
+ import styles from "./notificationPanel.module.scss";
3
+
4
+ const NotificationsPanel = ({ children }: NotificationsPanelProps) => {
5
+ return <div className={styles.notificationPanel}>{children}</div>;
6
+ };
7
+
8
+ export default NotificationsPanel;
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from "react"
2
+
3
+ interface NotificationsPanelProps{
4
+ children?:ReactNode
5
+ }
6
+
7
+ export default NotificationsPanelProps
@@ -0,0 +1,196 @@
1
+ .notificationPanel {
2
+ border-radius: 8px;
3
+ width: 100%;
4
+ background: white;
5
+ box-shadow: var(--drop-shadow-default);
6
+ min-width: 320px;
7
+ max-width: 320px;
8
+ }
9
+
10
+ .notificationheader {
11
+ border-bottom: 1px solid var(--color-gray-200);
12
+
13
+ .notificationHeaderWrapper {
14
+ display: flex;
15
+ align-items: center;
16
+ justify-content: space-between;
17
+ padding: var(--spacing-1-1\/2) var(--spacing-2);
18
+
19
+ h5 {
20
+ font-size: var(--font-size-h5);
21
+ font-weight: var(--font-weight-h5);
22
+ line-height: var(--line-height-h5);
23
+ }
24
+
25
+ .notificationMarkAllAction {
26
+ h6 {
27
+ font-size: var(--font-size-body-sm);
28
+ font-weight: var(--font-weight-body-sm);
29
+ line-height: var(--line-height-body-sm);
30
+ cursor: pointer;
31
+ transition: all 0.3s;
32
+
33
+ &:hover {
34
+ text-decoration: underline;
35
+ }
36
+ }
37
+ }
38
+ }
39
+ }
40
+
41
+ .notificationGrouplistHolder {
42
+ overflow-y: auto;
43
+ max-height: 500px;
44
+
45
+ &.spacing {
46
+ margin-right: 4px;
47
+ }
48
+
49
+ &::-webkit-scrollbar {
50
+ width: 4px;
51
+ }
52
+
53
+ &::-webkit-scrollbar-track {
54
+ background: none;
55
+ }
56
+
57
+ &::-webkit-scrollbar-thumb {
58
+ border-radius: 2px;
59
+ background: rgba(0, 0, 0, 0.1);
60
+ }
61
+
62
+ &::-webkit-scrollbar-thumb:hover {
63
+ background: rgba(0, 0, 0, 0.15);
64
+ }
65
+ }
66
+
67
+ .notificationGrouplist {
68
+ min-height: 70px;
69
+ list-style: none;
70
+ }
71
+
72
+ .notificationGroup {
73
+ padding: var(--spacing-1-1\/2) var(--spacing-2) var(--spacing-1\/2)
74
+ var(--spacing-2);
75
+ h6 {
76
+ color: var(--color-gray-600);
77
+ font-size: 12px;
78
+ font-style: normal;
79
+ font-weight: 600;
80
+ line-height: 22px;
81
+ }
82
+ }
83
+
84
+ .notificationNone {
85
+ min-height: 70px;
86
+ list-style: none;
87
+ display: flex;
88
+ align-items: center;
89
+ justify-content: center;
90
+
91
+ h6 {
92
+ color: var(--color-gray-600);
93
+ font-size: var(--font-size-body-sm);
94
+ font-weight: var(--font-weight-body-sm);
95
+ line-height: var(--line-height-body-sm);
96
+ }
97
+ }
98
+
99
+ .notificationList {
100
+ padding: var(--spacing-1) var(--spacing-2) var(--spacing-1)
101
+ var(--spacing-3\/4);
102
+ transition: background-color 0.2s linear;
103
+ cursor: pointer;
104
+
105
+ &:hover {
106
+ background: var(--color-gray-100);
107
+ }
108
+
109
+ &:hover .notificationListPip {
110
+ opacity: 0;
111
+ }
112
+
113
+ &:hover .notificationListCloseIcon {
114
+ opacity: 1;
115
+ }
116
+
117
+ .notificationListWrapper {
118
+ display: flex;
119
+ align-items: center;
120
+ }
121
+
122
+ .notificationListPip {
123
+ width: 8px;
124
+ height: 8px;
125
+ border-radius: 100%;
126
+ background: var(--color-primary-500);
127
+ position: absolute;
128
+ top: 50%;
129
+ left: 50%;
130
+ opacity: 1;
131
+ transform: translate(-50%, -50%);
132
+ transition: opacity 0.2s linear;
133
+ }
134
+
135
+ .notificationListCloseIcon {
136
+ display: flex;
137
+ align-items: center;
138
+ justify-content: center;
139
+ opacity: 0;
140
+
141
+ svg {
142
+ width: 12px;
143
+ height: 12px;
144
+ }
145
+ }
146
+
147
+ .notificationListIcon {
148
+ cursor: pointer;
149
+ position: relative;
150
+ display: flex;
151
+ align-items: center;
152
+ justify-content: center;
153
+ margin-right: var(--spacing-3\/4);
154
+ transition: opacity 0.2s linear;
155
+ }
156
+
157
+ .notificationListContent {
158
+ display: flex;
159
+ align-items: center;
160
+ justify-content: center;
161
+ }
162
+
163
+ .notificationListInitial {
164
+ flex-shrink: 0;
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: center;
168
+ width: 32px;
169
+ height: 32px;
170
+ background: var(--color-primary-700);
171
+ color: var(--color-lite);
172
+ border-radius: 100%;
173
+ margin-right: var(--spacing-3\/4);
174
+
175
+ .notificationListInitialWrapper {
176
+ --font-size-body-sm: 600;
177
+ font-size: var(--font-size-body-sm);
178
+ font-weight: var(--font-weight-body-sm);
179
+ line-height: var(--line-height-body-sm);
180
+ }
181
+ }
182
+
183
+ .notificationListDesc {
184
+ font-size: var(--font-size-body-xsm);
185
+ font-weight: var(--font-size-body-xsm);
186
+ line-height: var(--line-height-body-xsm);
187
+
188
+ .boldText {
189
+ font-weight: 600;
190
+ }
191
+
192
+ .summaryText {
193
+ color: var(--color-primary-500);
194
+ }
195
+ }
196
+ }
@@ -0,0 +1,72 @@
1
+ import {Meta, StoryObj} from '@storybook/react';
2
+ import {Tab} from './Tab.tsx';
3
+ import {TabNav} from './TabNav.tsx';
4
+ import {TabNavItem} from "./TabNavItem.tsx";
5
+ import {TabBody} from "./TabBody.tsx";
6
+ import {TabBodyContent} from "./TabBodyContent.tsx";
7
+ import './tab.stories.scss'
8
+
9
+ const meta: Meta = {
10
+ title: 'Data Display/Tab',
11
+ component: Tab,
12
+ tags: ['autodocs'],
13
+ };
14
+
15
+ export default meta;
16
+
17
+ type Story = StoryObj<typeof meta>;
18
+
19
+ const TabTemplate: Story = {
20
+ render: ({items}) => {
21
+ return (
22
+ <Tab>
23
+ <TabNav>
24
+ {items.map((item: any) => (
25
+ <TabNavItem tabIndex={item.index} title={`${item.title} ${item.index}`}/>
26
+ ))}
27
+ </TabNav>
28
+ <TabBody extraClass={'tab-body--pd'}>
29
+ {items.map((item: any) => (
30
+ <TabBodyContent tabIndex={item.index}>
31
+ <div className={`typography`}>
32
+ <h3>Tab {item.index} content</h3>
33
+ <p>
34
+ {item.desc}
35
+ </p>
36
+ </div>
37
+ </TabBodyContent>
38
+ ))}
39
+ </TabBody>
40
+ </Tab>
41
+ );
42
+ },
43
+ };
44
+
45
+ export const Example = {
46
+ ...TabTemplate,
47
+ args: {
48
+ items: [
49
+ {
50
+ index:0,
51
+ title: 'Item',
52
+ desc: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincindexunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus index et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
53
+ },
54
+ {
55
+ index:1,
56
+ title: 'Item',
57
+ desc: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincindexunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus index et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
58
+ },
59
+ {
60
+ index:2,
61
+ title: 'Item',
62
+ desc: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincindexunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus index et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
63
+ },
64
+ {
65
+ index:3,
66
+ title: 'Item',
67
+ desc: 'Sed fringilla magna facilisis auctor venenatis. Duis ut vestibulum risus. Nunc a finibus dui. Donec hendrerit tristique odio, ac porta dui maximus et. Duis vestibulum velit eget erat fermentum, fermentum mollis tortor tincindexunt. Integer lacinia lacinia urna scelerisque mattis. Fusce vestibulum felis eget magna placerat faucibus index et tellus. Sed rutrum mi sed leo viverra tempus. Nunc eu congue tellus, sed dapibus dui.'
68
+ },
69
+ ],
70
+ },
71
+ };
72
+
@@ -0,0 +1,20 @@
1
+ import { useState } from "react";
2
+
3
+ import TabContext from "./TabContext";
4
+ import TabInterface from "./TabProps.tsx";
5
+ import styles from "./tab.module.scss";
6
+
7
+ export const Tab = ({ children, extraClass }: TabInterface) => {
8
+ const [index, setIndex] = useState(0);
9
+
10
+ return (
11
+ <TabContext.Provider
12
+ value={{
13
+ currentIndex: index,
14
+ setCurrentIndex: setIndex,
15
+ }}
16
+ >
17
+ <div className={`${styles.tab} ${extraClass}`}>{children}</div>
18
+ </TabContext.Provider>
19
+ );
20
+ };
@@ -0,0 +1,6 @@
1
+ import TabBodyProps from "./TabBodyProps.tsx";
2
+ import styles from "./tab.module.scss";
3
+
4
+ export const TabBody = ({ children, extraClass }: TabBodyProps) => {
5
+ return <div className={`${styles.tabBody} ${extraClass}`}>{children}</div>;
6
+ };
@@ -0,0 +1,15 @@
1
+ import { useContext } from "react";
2
+ import TabContext from "./TabContext";
3
+ import TabBodyContentProps from "./TabBodyContentProps.tsx";
4
+
5
+ export const TabBodyContent = ({
6
+ children,
7
+ tabIndex,
8
+ extraClass,
9
+ }: TabBodyContentProps) => {
10
+ const tabContext = useContext(TabContext);
11
+ if (tabIndex === tabContext.currentIndex) {
12
+ return <div className={`${extraClass}`}>{children}</div>;
13
+ }
14
+ return <></>;
15
+ };
@@ -0,0 +1,9 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface TabBodyContentProps {
4
+ children: ReactNode;
5
+ tabIndex: any;
6
+ extraClass?: string;
7
+ }
8
+
9
+ export default TabBodyContentProps;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface TabBodyProps {
4
+ children: ReactNode;
5
+ extraClass?: string;
6
+ }
7
+
8
+ export default TabBodyProps;
@@ -0,0 +1,9 @@
1
+ import { createContext } from "react";
2
+ import TabContextProps from "./TabContextProps.tsx";
3
+
4
+ const TabContext = createContext<TabContextProps>({
5
+ currentIndex: 0,
6
+ setCurrentIndex: Function,
7
+ });
8
+
9
+ export default TabContext;
@@ -0,0 +1,6 @@
1
+ interface TabContextProps {
2
+ currentIndex: any;
3
+ setCurrentIndex: Function;
4
+ }
5
+
6
+ export default TabContextProps;
@@ -0,0 +1,6 @@
1
+ import TabNavProps from "./TabNavProps.tsx";
2
+ import styles from "./tab.module.scss";
3
+
4
+ export const TabNav = ({ children, extraClass }: TabNavProps) => {
5
+ return <div className={`${styles.tabNav} ${extraClass}`}>{children}</div>;
6
+ };
@@ -0,0 +1,49 @@
1
+ import { useContext } from "react";
2
+ import TabContext from "./TabContext";
3
+ import TabNavItemProps from "./TabNavItemProps.tsx";
4
+ import styles from "./tab.module.scss";
5
+
6
+ export const TabNavItem = (props: TabNavItemProps) => {
7
+ const {
8
+ title,
9
+ tabIndex,
10
+ onBeforeOpen = null,
11
+ onAfterOpened = null,
12
+ extraClass,
13
+ } = props;
14
+ const tabContext = useContext(TabContext);
15
+
16
+ let className = ` ${styles.tabNavItem}`;
17
+ if (tabContext.currentIndex === tabIndex) {
18
+ className += ` ${styles.active}`;
19
+ }
20
+
21
+ const setActive = (key: any) => {
22
+ let proceed = true;
23
+ if (onBeforeOpen) {
24
+ const ret = onBeforeOpen();
25
+ if (typeof ret === "boolean") {
26
+ proceed = ret;
27
+ }
28
+ }
29
+ if (proceed) {
30
+ tabContext.setCurrentIndex(key);
31
+ if (onAfterOpened) {
32
+ onAfterOpened();
33
+ }
34
+ }
35
+ };
36
+
37
+ return (
38
+ <>
39
+ <div
40
+ className={className}
41
+ onClick={() => {
42
+ setActive(tabIndex);
43
+ }}
44
+ >
45
+ <span className={`${styles.item} ${extraClass}`}> {title}</span>
46
+ </div>
47
+ </>
48
+ );
49
+ };
@@ -0,0 +1,9 @@
1
+ interface TabNavItemProps {
2
+ title: string;
3
+ tabIndex: any;
4
+ onBeforeOpen?: Function;
5
+ onAfterOpened?: Function;
6
+ extraClass?: string;
7
+ }
8
+
9
+ export default TabNavItemProps;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface TabNavProps {
4
+ children: ReactNode;
5
+ extraClass?: string;
6
+ }
7
+
8
+ export default TabNavProps;
@@ -0,0 +1,8 @@
1
+ import { ReactNode } from "react";
2
+
3
+ interface TabProps {
4
+ children: ReactNode;
5
+ extraClass?: string;
6
+ }
7
+
8
+ export default TabProps;