trepur_components 2.3.9 → 2.3.10

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 (282) hide show
  1. package/lib/_virtual/react.js +4 -0
  2. package/lib/components/Accordion/Accordion.stories.d.ts +47 -0
  3. package/lib/components/Accordion/const.d.ts +31 -0
  4. package/lib/components/Accordion/index.d.ts +5 -0
  5. package/lib/components/Accordion/index.js +9 -0
  6. package/lib/components/AlertBar/AlertBar.stories.d.ts +24 -0
  7. package/lib/components/AlertBar/index.d.ts +16 -0
  8. package/lib/components/AlertBar/index.js +36 -0
  9. package/lib/components/Avatar/Avatar.stories.d.ts +10 -0
  10. package/lib/components/Avatar/index.d.ts +3 -0
  11. package/lib/components/Breadcrumbs/Breadcrumbs.stories.d.ts +18 -0
  12. package/lib/components/Breadcrumbs/index.d.ts +17 -0
  13. package/lib/components/Breadcrumbs/index.js +16 -0
  14. package/lib/components/Button/Button.stories.d.ts +20 -0
  15. package/lib/components/Button/index.d.ts +13 -0
  16. package/lib/components/Button/index.js +30 -0
  17. package/lib/components/Calendar/Calendar.stories.d.ts +11 -0
  18. package/lib/components/Calendar/index.d.ts +14 -0
  19. package/lib/components/Calendar/index.js +49 -0
  20. package/lib/components/Calendar/style.css.js +1 -0
  21. package/lib/components/Card/Card.stories.d.ts +11 -0
  22. package/lib/components/Card/index.d.ts +2 -0
  23. package/lib/components/Card/index.js +25 -0
  24. package/lib/components/Carousel/Carousel.stories.d.ts +23 -0
  25. package/lib/components/Carousel/index.d.ts +70 -0
  26. package/lib/components/Carousel/index.js +159 -0
  27. package/lib/components/Carousel/utils.d.ts +1 -0
  28. package/lib/components/Carousel/utils.js +38 -0
  29. package/lib/components/CarouselThumbnail/CarouselThumbnail.stories.d.ts +22 -0
  30. package/lib/components/CarouselThumbnail/const.d.ts +1 -0
  31. package/lib/components/CarouselThumbnail/const.js +20 -0
  32. package/lib/components/CarouselThumbnail/index.d.ts +51 -0
  33. package/lib/components/CarouselThumbnail/index.js +74 -0
  34. package/lib/components/CarouselThumbnail/utils.d.ts +2 -0
  35. package/lib/components/CarouselThumbnail/utils.js +65 -0
  36. package/lib/components/Checkbox/Checkbox.stories.d.ts +17 -0
  37. package/lib/components/Checkbox/index.d.ts +11 -0
  38. package/lib/components/Checkbox/index.js +28 -0
  39. package/lib/components/Collapsible/Collapsible.stories.d.ts +57 -0
  40. package/lib/components/Collapsible/index.d.ts +19 -0
  41. package/lib/components/Collapsible/index.js +87 -0
  42. package/lib/components/Counter/Counter.stories.d.ts +17 -0
  43. package/lib/components/Counter/index.d.ts +14 -0
  44. package/lib/components/Counter/index.js +49 -0
  45. package/lib/components/DetailUpdater/DetailUpdater.stories.d.ts +20 -0
  46. package/lib/components/DetailUpdater/index.d.ts +18 -0
  47. package/lib/components/DetailUpdater/index.js +63 -0
  48. package/lib/components/Dialog/Dialog.stories.d.ts +15 -0
  49. package/lib/components/Dialog/index.d.ts +12 -0
  50. package/lib/components/Dialog/index.js +16 -0
  51. package/lib/components/Dropdown/Dropdown.stories.d.ts +17 -0
  52. package/lib/components/Dropdown/index.d.ts +13 -0
  53. package/lib/components/Dropdown/index.js +66 -0
  54. package/lib/components/Dropdown/utils.d.ts +1 -0
  55. package/lib/components/Dropdown/utils.js +14 -0
  56. package/lib/components/FileUploader/FilePreview.d.ts +8 -0
  57. package/lib/components/FileUploader/FileUploader.stories.d.ts +52 -0
  58. package/lib/components/FileUploader/index.d.ts +15 -0
  59. package/lib/components/Footer/Footer.stories.d.ts +19 -0
  60. package/lib/components/Footer/index.d.ts +16 -0
  61. package/lib/components/Footer/index.js +36 -0
  62. package/lib/components/FooterNav/FooterNav.stories.d.ts +22 -0
  63. package/lib/components/FooterNav/index.d.ts +15 -0
  64. package/lib/components/FooterNav/index.js +38 -0
  65. package/lib/components/Form/Form.stories.d.ts +117 -0
  66. package/lib/components/Form/index.d.ts +13 -0
  67. package/lib/components/Form/index.js +17 -0
  68. package/lib/components/Gallery/Gallery.stories.d.ts +16 -0
  69. package/lib/components/Gallery/index.d.ts +7 -0
  70. package/lib/components/Greeting/Greeting.stories.d.ts +13 -0
  71. package/lib/components/Greeting/index.d.ts +7 -0
  72. package/lib/components/Greeting/index.js +20 -0
  73. package/lib/components/HamburgerIcon/HamburgerIcon.stories.d.ts +10 -0
  74. package/lib/components/HamburgerIcon/index.d.ts +2 -0
  75. package/lib/components/HamburgerIcon/index.js +78 -0
  76. package/lib/components/Icon/Icon.stories.d.ts +16 -0
  77. package/lib/components/Icon/index.d.ts +10 -0
  78. package/lib/components/Icon/index.js +23 -0
  79. package/lib/components/Image/Image.stories.d.ts +13 -0
  80. package/lib/components/Image/index.d.ts +5 -0
  81. package/lib/components/Image/index.js +17 -0
  82. package/lib/components/ImageCard/ImageCard.stories.d.ts +19 -0
  83. package/lib/components/ImageCard/index.d.ts +11 -0
  84. package/lib/components/ImageCard/index.js +32 -0
  85. package/lib/components/Input/Input.stories.d.ts +22 -0
  86. package/lib/components/Input/index.d.ts +33 -0
  87. package/lib/components/Input/index.js +83 -0
  88. package/lib/components/MenuButton/MenuButton.stories.d.ts +76 -0
  89. package/lib/components/MenuButton/index.d.ts +14 -0
  90. package/lib/components/MenuButton/index.js +56 -0
  91. package/lib/components/Modal/Modal.stories.d.ts +67 -0
  92. package/lib/components/Modal/index.d.ts +10 -0
  93. package/lib/components/Modal/index.js +45 -0
  94. package/lib/components/Nav/Nav.stories.d.ts +32 -0
  95. package/lib/components/Nav/index.d.ts +21 -0
  96. package/lib/components/Nav/index.js +82 -0
  97. package/lib/components/NavItem/NavItem.stories.d.ts +18 -0
  98. package/lib/components/NavItem/index.d.ts +8 -0
  99. package/lib/components/NavItem/index.js +24 -0
  100. package/lib/components/Pill/Pill.stories.d.ts +22 -0
  101. package/lib/components/Pill/index.d.ts +17 -0
  102. package/lib/components/Pill/index.js +31 -0
  103. package/lib/components/Search/Search.stories.d.ts +86 -0
  104. package/lib/components/Search/index.d.ts +12 -0
  105. package/lib/components/Search/index.js +42 -0
  106. package/lib/components/Select/Select.stories.d.ts +56 -0
  107. package/lib/components/Select/index.d.ts +11 -0
  108. package/lib/components/Select/index.js +68 -0
  109. package/lib/components/Showcase/Showcase.stories.d.ts +55 -0
  110. package/lib/components/Showcase/index.d.ts +15 -0
  111. package/lib/components/SideNav/SideNav.stories.d.ts +80 -0
  112. package/lib/components/SideNav/index.d.ts +12 -0
  113. package/lib/components/SocialButton/SocialButton.stories.d.ts +130 -0
  114. package/lib/components/SocialButton/index.d.ts +12 -0
  115. package/lib/components/SplitCard/SplitCard.stories.d.ts +21 -0
  116. package/lib/components/SplitCard/index.d.ts +14 -0
  117. package/lib/components/Stars/Star.stories.d.ts +14 -0
  118. package/lib/components/Stars/index.d.ts +8 -0
  119. package/lib/components/Stars/index.js +22 -0
  120. package/lib/components/Testimonial/Testimonial.stories.d.ts +21 -0
  121. package/lib/components/Testimonial/index.d.ts +13 -0
  122. package/lib/components/Testimonial/index.js +42 -0
  123. package/lib/components/TextArea/TextArea.stories.d.ts +21 -0
  124. package/lib/components/TextArea/index.d.ts +33 -0
  125. package/lib/components/TextArea/index.js +76 -0
  126. package/lib/components/Timeline/Timeline.stories.d.ts +21 -0
  127. package/lib/components/Timeline/index.d.ts +11 -0
  128. package/lib/components/Timeline/index.js +31 -0
  129. package/lib/components/Tubestops/Tubestops.stories.d.ts +19 -0
  130. package/lib/components/Tubestops/index.d.ts +15 -0
  131. package/lib/components/Tubestops/index.js +77 -0
  132. package/lib/components/Video/Video.stories.d.ts +23 -0
  133. package/lib/components/Video/index.d.ts +18 -0
  134. package/lib/components/Video/index.js +32 -0
  135. package/{src/components/index.ts → lib/components/index.d.ts} +35 -71
  136. package/lib/documentation/assets/index.d.ts +3 -0
  137. package/lib/documentation/typography/Fonts/Fonts.d.ts +2 -0
  138. package/lib/documentation/typography/Fonts/Fonts.stories.d.ts +10 -0
  139. package/lib/index.js +72 -0
  140. package/lib/node_modules/keen-slider/keen-slider.min.css.js +1 -0
  141. package/lib/node_modules/keen-slider/react.js +591 -0
  142. package/lib/style.css +1 -0
  143. package/lib/utils/controls.d.ts +36 -0
  144. package/lib/utils/matchMedia.d.ts +2 -0
  145. package/lib/utils/screens.d.ts +7 -0
  146. package/package.json +4 -1
  147. package/.eslintrc.cjs +0 -72
  148. package/.husky/pre-commit +0 -4
  149. package/.prettierignore +0 -10
  150. package/.prettierrc.json +0 -22
  151. package/postcss.config.js +0 -8
  152. package/src/components/Accordion/Accordion.stories.tsx +0 -39
  153. package/src/components/Accordion/const.tsx +0 -34
  154. package/src/components/Accordion/index.tsx +0 -22
  155. package/src/components/AlertBar/AlertBar.stories.tsx +0 -89
  156. package/src/components/AlertBar/index.tsx +0 -82
  157. package/src/components/Avatar/Avatar.stories.tsx +0 -14
  158. package/src/components/Avatar/index.tsx +0 -492
  159. package/src/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -29
  160. package/src/components/Breadcrumbs/index.tsx +0 -89
  161. package/src/components/Button/Button.stories.tsx +0 -24
  162. package/src/components/Button/index.tsx +0 -59
  163. package/src/components/Calendar/Calendar.stories.tsx +0 -21
  164. package/src/components/Calendar/index.tsx +0 -92
  165. package/src/components/Calendar/style.css +0 -233
  166. package/src/components/Card/Card.stories.tsx +0 -14
  167. package/src/components/Card/index.tsx +0 -39
  168. package/src/components/Carousel/Carousel.stories.tsx +0 -44
  169. package/src/components/Carousel/index.tsx +0 -301
  170. package/src/components/Carousel/utils.ts +0 -53
  171. package/src/components/CarouselThumbnail/CarouselThumbnail.stories.tsx +0 -29
  172. package/src/components/CarouselThumbnail/const.ts +0 -17
  173. package/src/components/CarouselThumbnail/index.tsx +0 -169
  174. package/src/components/CarouselThumbnail/utils.ts +0 -87
  175. package/src/components/Checkbox/Checkbox.mdx +0 -33
  176. package/src/components/Checkbox/Checkbox.stories.tsx +0 -27
  177. package/src/components/Checkbox/index.tsx +0 -44
  178. package/src/components/Collapsible/Collapsible.stories.tsx +0 -67
  179. package/src/components/Collapsible/index.tsx +0 -169
  180. package/src/components/Counter/Counter.stories.tsx +0 -20
  181. package/src/components/Counter/index.tsx +0 -98
  182. package/src/components/DetailUpdater/DetailUpdater.stories.tsx +0 -37
  183. package/src/components/DetailUpdater/index.tsx +0 -107
  184. package/src/components/Dialog/Dialog.stories.tsx +0 -65
  185. package/src/components/Dialog/index.tsx +0 -29
  186. package/src/components/Dropdown/Dropdown.stories.tsx +0 -22
  187. package/src/components/Dropdown/index.tsx +0 -117
  188. package/src/components/Dropdown/utils.ts +0 -15
  189. package/src/components/FileUploader/FilePreview.tsx +0 -45
  190. package/src/components/FileUploader/FileUploader.stories.tsx +0 -28
  191. package/src/components/FileUploader/index.tsx +0 -177
  192. package/src/components/Footer/Footer.stories.tsx +0 -47
  193. package/src/components/Footer/index.tsx +0 -96
  194. package/src/components/FooterNav/FooterNav.stories.tsx +0 -32
  195. package/src/components/FooterNav/index.tsx +0 -75
  196. package/src/components/Form/Form.stories.tsx +0 -86
  197. package/src/components/Form/index.tsx +0 -41
  198. package/src/components/Gallery/Gallery.stories.tsx +0 -39
  199. package/src/components/Gallery/index.tsx +0 -31
  200. package/src/components/Greeting/Greeting.stories.tsx +0 -16
  201. package/src/components/Greeting/index.tsx +0 -49
  202. package/src/components/HamburgerIcon/HamburgerIcon.stories.tsx +0 -14
  203. package/src/components/HamburgerIcon/index.tsx +0 -75
  204. package/src/components/Icon/Icon.stories.tsx +0 -41
  205. package/src/components/Icon/index.tsx +0 -33
  206. package/src/components/Image/Image.stories.tsx +0 -17
  207. package/src/components/Image/index.tsx +0 -25
  208. package/src/components/ImageCard/ImageCard.stories.tsx +0 -29
  209. package/src/components/ImageCard/index.tsx +0 -75
  210. package/src/components/Input/Input.stories.tsx +0 -25
  211. package/src/components/Input/index.tsx +0 -139
  212. package/src/components/MenuButton/MenuButton.stories.tsx +0 -46
  213. package/src/components/MenuButton/index.tsx +0 -66
  214. package/src/components/Modal/Modal.stories.tsx +0 -82
  215. package/src/components/Modal/index.tsx +0 -71
  216. package/src/components/Nav/Nav.stories.tsx +0 -80
  217. package/src/components/Nav/index.tsx +0 -171
  218. package/src/components/NavItem/NavItem.stories.tsx +0 -17
  219. package/src/components/NavItem/index.tsx +0 -39
  220. package/src/components/Pill/Pill.stories.tsx +0 -51
  221. package/src/components/Pill/index.tsx +0 -69
  222. package/src/components/Search/Search.stories.tsx +0 -63
  223. package/src/components/Search/index.tsx +0 -64
  224. package/src/components/Select/Select.stories.tsx +0 -55
  225. package/src/components/Select/index.tsx +0 -97
  226. package/src/components/Showcase/Showcase.stories.tsx +0 -31
  227. package/src/components/Showcase/index.tsx +0 -62
  228. package/src/components/SideNav/SideNav.stories.tsx +0 -50
  229. package/src/components/SideNav/index.tsx +0 -39
  230. package/src/components/SocialButton/SocialButton.stories.tsx +0 -88
  231. package/src/components/SocialButton/index.tsx +0 -63
  232. package/src/components/SplitCard/SplitCard.stories.tsx +0 -34
  233. package/src/components/SplitCard/index.tsx +0 -132
  234. package/src/components/Stars/Star.stories.tsx +0 -18
  235. package/src/components/Stars/index.tsx +0 -38
  236. package/src/components/Testimonial/Testimonial.stories.tsx +0 -37
  237. package/src/components/Testimonial/index.tsx +0 -123
  238. package/src/components/TextArea/TextArea.stories.tsx +0 -24
  239. package/src/components/TextArea/index.tsx +0 -133
  240. package/src/components/Timeline/Timeline.stories.tsx +0 -45
  241. package/src/components/Timeline/index.tsx +0 -65
  242. package/src/components/Tubestops/Tubestops.stories.tsx +0 -22
  243. package/src/components/Tubestops/index.tsx +0 -132
  244. package/src/components/Video/Video.stories.tsx +0 -58
  245. package/src/components/Video/assets/example.mp4 +0 -0
  246. package/src/components/Video/assets/example.ogv +0 -0
  247. package/src/components/Video/assets/example.webm +0 -0
  248. package/src/components/Video/index.tsx +0 -92
  249. package/src/custom.d.ts +0 -14
  250. package/src/documentation/Colours.mdx +0 -192
  251. package/src/documentation/Introduction.mdx +0 -13
  252. package/src/documentation/assets/index.ts +0 -3
  253. package/src/documentation/assets/trepurComponentsLogo.svg +0 -32
  254. package/src/documentation/typography/Fonts/Fonts.stories.tsx +0 -14
  255. package/src/documentation/typography/Fonts/Fonts.tsx +0 -73
  256. package/src/fonts/Sora/OFL.txt +0 -93
  257. package/src/fonts/Sora/README.txt +0 -70
  258. package/src/fonts/Sora/Sora-VariableFont_wght.ttf +0 -0
  259. package/src/fonts/Sora/static/Sora-Bold.ttf +0 -0
  260. package/src/fonts/Sora/static/Sora-ExtraBold.ttf +0 -0
  261. package/src/fonts/Sora/static/Sora-ExtraLight.ttf +0 -0
  262. package/src/fonts/Sora/static/Sora-Light.ttf +0 -0
  263. package/src/fonts/Sora/static/Sora-Medium.ttf +0 -0
  264. package/src/fonts/Sora/static/Sora-Regular.ttf +0 -0
  265. package/src/fonts/Sora/static/Sora-SemiBold.ttf +0 -0
  266. package/src/fonts/Sora/static/Sora-Thin.ttf +0 -0
  267. package/src/utils/controls.ts +0 -44
  268. package/src/utils/matchMedia.ts +0 -9
  269. package/src/utils/screens.ts +0 -7
  270. package/tailwind.config.ts +0 -13
  271. package/tsconfig.json +0 -49
  272. package/tsconfig.node.json +0 -12
  273. package/vite.config.mjs +0 -64
  274. /package/{src/index.ts → lib/index.d.ts} +0 -0
  275. /package/{src → lib}/styles/global.css +0 -0
  276. /package/{src → lib}/styles/themes/local.css +0 -0
  277. /package/{src → lib}/styles/themes/test.css +0 -0
  278. /package/{tailwind → lib/tailwind}/boxShadow.ts +0 -0
  279. /package/{tailwind → lib/tailwind}/colors.ts +0 -0
  280. /package/{tailwind → lib/tailwind}/container.ts +0 -0
  281. /package/{tailwind → lib/tailwind}/preset.ts +0 -0
  282. /package/{tailwind → lib/tailwind}/spacing.ts +0 -0
@@ -1,117 +0,0 @@
1
- import {
2
- useState,
3
- forwardRef,
4
- HTMLAttributes,
5
- useContext,
6
- createContext,
7
- useMemo,
8
- useRef,
9
- } from 'react';
10
-
11
- import { Button } from '../';
12
- import { ButtonProps } from '@components/Button';
13
- import { faChevronDown } from '@fortawesome/fontawesome-free-solid';
14
-
15
- import { useClickOutside } from './utils';
16
-
17
- export interface DropdownContextProps {
18
- showDropdown?: boolean;
19
- setShowDropdown?: (val: boolean) => void;
20
- }
21
-
22
- const DropdownContext = createContext<DropdownContextProps | null>(null);
23
-
24
- const DropdownComponent = forwardRef<
25
- HTMLDivElement,
26
- HTMLAttributes<HTMLDivElement>
27
- >(({ children }) => {
28
- const [showDropdown, setShowDropdown] = useState(false);
29
- const ref = useRef<HTMLDivElement>(null);
30
-
31
- const state = useMemo(
32
- () => ({
33
- showDropdown,
34
- setShowDropdown,
35
- }),
36
- [showDropdown, setShowDropdown],
37
- );
38
-
39
- useClickOutside(ref, () => {
40
- setShowDropdown(false);
41
- });
42
-
43
- return (
44
- <DropdownContext.Provider value={state}>
45
- <div ref={ref} className="relative inline-block text-left">
46
- {children}
47
- </div>
48
- </DropdownContext.Provider>
49
- );
50
- });
51
-
52
- const DropdownLabel = forwardRef<
53
- HTMLButtonElement,
54
- HTMLAttributes<HTMLButtonElement> & ButtonProps
55
- >(({ children }) => {
56
- const { showDropdown, setShowDropdown } = useContext(DropdownContext) || {};
57
- return (
58
- <Button onClick={() => setShowDropdown?.(!showDropdown)}>
59
- {children}
60
- <Button.Icon icon={faChevronDown} />
61
- </Button>
62
- );
63
- });
64
-
65
- const DropdownList = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
66
- ({ children }) => {
67
- const { showDropdown } = useContext(DropdownContext) || {};
68
- if (!showDropdown) return <div></div>;
69
- return (
70
- <div
71
- className="z-50 mt-2 w-48 rounded-lg border-2 bg-primary text-white"
72
- role="menu"
73
- aria-orientation="vertical"
74
- aria-labelledby="menu-button"
75
- >
76
- <ul className="py-1 text-sm">{children}</ul>
77
- </div>
78
- );
79
- },
80
- );
81
-
82
- const DropdownItem = forwardRef<HTMLLIElement, HTMLAttributes<HTMLLIElement>>(
83
- ({ children, onClick }) => {
84
- const { showDropdown, setShowDropdown } = useContext(DropdownContext) || {};
85
- return (
86
- <li
87
- className="px-4 py-2"
88
- onClick={(e) => {
89
- const target = e?.target as HTMLElement;
90
- // onClick?.(target?.parentNode?.textContent ?? '');
91
- setShowDropdown?.(false);
92
- }}
93
- onKeyDown={(e) => {
94
- if (e.key === 'Enter') {
95
- const target = e?.target as HTMLElement;
96
- // onClick?.(target?.parentNode?.textContent ?? '');
97
- }
98
- }}
99
- >
100
- {children}
101
- </li>
102
- );
103
- },
104
- );
105
-
106
- DropdownComponent.displayName = 'Dropdown';
107
- DropdownLabel.displayName = 'Dropdown.Label';
108
- DropdownList.displayName = 'Dropdown.List';
109
- DropdownItem.displayName = 'Dropdown.Item';
110
-
111
- const Dropdown = Object.assign(DropdownComponent, {
112
- Label: DropdownLabel,
113
- List: DropdownList,
114
- Item: DropdownItem,
115
- });
116
-
117
- export { Dropdown };
@@ -1,15 +0,0 @@
1
- import { useEffect } from 'react';
2
-
3
- export function useClickOutside(ref: any, onClickOutside: () => void) {
4
- useEffect(() => {
5
- function handleClickOutside(event: MouseEvent) {
6
- if (ref.current && !ref.current.contains(event.target)) {
7
- onClickOutside();
8
- }
9
- }
10
- document.addEventListener('mousedown', handleClickOutside);
11
- return () => {
12
- document.removeEventListener('mousedown', handleClickOutside);
13
- };
14
- }, [ref, onClickOutside]);
15
- }
@@ -1,45 +0,0 @@
1
- import classNames from 'classnames';
2
-
3
- interface FilePreviewProps {
4
- id?: string;
5
- className?: string;
6
- fileData?: any;
7
- onDismiss?: (e: any) => void;
8
- }
9
-
10
- export const FilePreview = ({
11
- id,
12
- className,
13
- fileData,
14
- onDismiss,
15
- }: FilePreviewProps) => {
16
- const handleDismiss = (fileName: string): void => {
17
- onDismiss?.(fileName);
18
- };
19
-
20
- return (
21
- <ul
22
- id={id}
23
- className={classNames(className, 'flex w-full flex-wrap px-8 pt-4')}
24
- >
25
- {fileData?.map((file: any) => {
26
- return (
27
- <li
28
- key={file.lastModified}
29
- className="mx-2 cursor-pointer rounded-2xl border bg-secondary text-white hover:bg-primary"
30
- >
31
- <div
32
- className="flex w-full justify-between px-4 py-1"
33
- onClick={() => {
34
- handleDismiss(file.name);
35
- }}
36
- >
37
- <p>{file.name}</p>
38
- <p className="ml-2 cursor-pointer">x</p>
39
- </div>
40
- </li>
41
- );
42
- })}
43
- </ul>
44
- );
45
- };
@@ -1,28 +0,0 @@
1
- import { FileUploader } from './';
2
- import { action } from '@storybook/addon-actions';
3
- import { Meta, StoryObj } from '@storybook/react';
4
- import { idAndClassName } from '@utils/controls';
5
-
6
- const meta = {
7
- title: 'V2Components/FileUploader',
8
- component: FileUploader,
9
- argTypes: {
10
- ...idAndClassName,
11
- },
12
- args: {
13
- children: [
14
- <FileUploader.Input>You can select multiple Files</FileUploader.Input>,
15
- <FileUploader.Text>or drag & drop your files here</FileUploader.Text>,
16
- <FileUploader.FilePreview />,
17
- ],
18
- onDrop: (files: any) => {
19
- action('files:')(files[0].name);
20
- },
21
- },
22
- } satisfies Meta<typeof FileUploader>;
23
-
24
- export default meta;
25
-
26
- type Story = StoryObj<typeof FileUploader>;
27
-
28
- export const Default: Story = {};
@@ -1,177 +0,0 @@
1
- import {
2
- createContext,
3
- forwardRef,
4
- HTMLAttributes,
5
- useContext,
6
- useMemo,
7
- useState,
8
- } from 'react';
9
-
10
- import { FilePreview } from './FilePreview';
11
-
12
- export interface FileUploaderContextProps {
13
- fileList?: any;
14
- setFileList: (open: any) => void;
15
- inDropZone?: boolean;
16
- setInDropZone?: (val: boolean) => void;
17
- onDrop: React.DragEventHandler<HTMLDivElement> | undefined;
18
- }
19
-
20
- const FileUploaderContext = createContext<FileUploaderContextProps | null>(
21
- null,
22
- );
23
-
24
- const FileUploaderComponent = forwardRef<
25
- HTMLDivElement,
26
- HTMLAttributes<HTMLDivElement> & FileUploaderContextProps
27
- >(({ children, onDrop }, ref) => {
28
- const [inDropZone, setInDropZone] = useState(false);
29
- const [fileList, setFileList] = useState<any>([]);
30
-
31
- const state = useMemo(
32
- () => ({
33
- onDrop,
34
- inDropZone,
35
- setInDropZone,
36
- fileList,
37
- setFileList,
38
- }),
39
- [inDropZone, setInDropZone, fileList, setFileList, onDrop],
40
- );
41
-
42
- const handleDragEnter = (e: any): void => {
43
- e.preventDefault();
44
- e.stopPropagation();
45
- setInDropZone(true);
46
- };
47
-
48
- const handleDragLeave = (e: any): void => {
49
- e.preventDefault();
50
- e.stopPropagation();
51
- setInDropZone(false);
52
- };
53
-
54
- const handleDragOver = (e: any): void => {
55
- e.preventDefault();
56
- e.stopPropagation();
57
- setInDropZone(true);
58
- };
59
-
60
- const handleDrop = (e: any): void => {
61
- e.preventDefault();
62
- e.stopPropagation();
63
-
64
- let files = [...e.dataTransfer.files];
65
-
66
- if (files?.length > 0) {
67
- const existingFiles = fileList?.fileList?.map((f: any) => f.name);
68
- files = files.filter((f) => !existingFiles?.includes(f.name));
69
-
70
- setFileList(files);
71
- setInDropZone(false);
72
- }
73
- onDrop?.(files[0]);
74
- };
75
-
76
- return (
77
- <FileUploaderContext.Provider value={state}>
78
- <div
79
- ref={ref}
80
- className="flex flex-col items-center justify-center rounded-2xl border-4 border-dashed border-primary py-8"
81
- onDragEnter={(e) => {
82
- handleDragEnter(e);
83
- }}
84
- onDragOver={(e) => {
85
- handleDragOver(e);
86
- }}
87
- onDragLeave={(e) => {
88
- handleDragLeave(e);
89
- }}
90
- onDrop={(e) => {
91
- handleDrop(e);
92
- }}
93
- >
94
- {children}
95
- </div>
96
- </FileUploaderContext.Provider>
97
- );
98
- });
99
-
100
- const FileUploaderInput = forwardRef<
101
- HTMLDivElement,
102
- HTMLAttributes<HTMLDivElement>
103
- >(({ children }, ref) => {
104
- const { onDrop, fileList, setFileList } =
105
- useContext(FileUploaderContext) || {};
106
-
107
- const handleFileSelect = (e: any): void => {
108
- let files = [...e.target.files];
109
-
110
- if (files?.length > 0) {
111
- const existingFiles = fileList?.fileList?.map((f: any) => f.name);
112
- files = files.filter((f) => !existingFiles?.includes(f.name));
113
- setFileList?.(files);
114
- onDrop?.(files[0]);
115
- }
116
- };
117
-
118
- return (
119
- <div ref={ref}>
120
- <input
121
- id="fileSelect"
122
- type="file"
123
- multiple
124
- className="absolute mb-2 mt-4 inline-block h-px w-px cursor-pointer overflow-hidden whitespace-nowrap border-none p-0 text-center"
125
- onChange={(e) => {
126
- handleFileSelect(e);
127
- }}
128
- />
129
- <label
130
- className="mb-2 mt-4 inline-block cursor-pointer text-center"
131
- htmlFor="fileSelect"
132
- >
133
- {children}
134
- </label>
135
- </div>
136
- );
137
- });
138
-
139
- const FileUploaderFilePreview = forwardRef<
140
- HTMLDivElement,
141
- HTMLAttributes<HTMLDivElement>
142
- >(() => {
143
- const { fileList, setFileList } = useContext(FileUploaderContext) || {};
144
-
145
- const handleDismiss = (fileName: string): void => {
146
- setFileList?.(fileList.filter((file: any) => file.name !== fileName));
147
- };
148
-
149
- return (
150
- <FilePreview
151
- fileData={fileList}
152
- onDismiss={(e: any) => {
153
- handleDismiss(e);
154
- }}
155
- />
156
- );
157
- });
158
-
159
- const FileUploaderText = forwardRef<
160
- HTMLParagraphElement,
161
- HTMLAttributes<HTMLParagraphElement>
162
- >(({ ...props }, ref) => (
163
- <p className="md:text-md truncate text-sm" ref={ref} {...props} />
164
- ));
165
-
166
- FileUploaderComponent.displayName = 'FileUploader';
167
- FileUploaderInput.displayName = 'FileUploader.Input';
168
- FileUploaderText.displayName = 'FileUploader.Text';
169
- FileUploaderFilePreview.displayName = 'FileUploader.FilePreview';
170
-
171
- const FileUploader = Object.assign(FileUploaderComponent, {
172
- Input: FileUploaderInput,
173
- Text: FileUploaderText,
174
- FilePreview: FileUploaderFilePreview,
175
- });
176
-
177
- export { FileUploader };
@@ -1,47 +0,0 @@
1
- import { Footer } from './';
2
- import { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta = {
5
- title: 'V2Components/Footer',
6
- component: Footer,
7
- args: {
8
- children: [
9
- <Footer.Section>
10
- <Footer.Column>
11
- <Footer.Title>Title</Footer.Title>
12
- <Footer.Text>
13
- Lorem ipsum dolor sit, amet consectetur adipisicing elit. Iure hic
14
- itaque dolore doloribus ducimus iste qui totam. Adipisci recusandae
15
- sed voluptatum odio consequuntur, amet sint totam libero quasi
16
- tenetur expedita?
17
- </Footer.Text>
18
- </Footer.Column>
19
- <Footer.Column>
20
- <Footer.Title>Title</Footer.Title>
21
- <Footer.Text>
22
- Lorem ipsum dolor sit, amet consectetur adipisicing elit. Iure hic
23
- itaque dolore doloribus ducimus iste qui totam. Adipisci recusandae
24
- sed voluptatum odio consequuntur, amet sint totam libero quasi
25
- tenetur expedita?
26
- </Footer.Text>
27
- </Footer.Column>
28
- <Footer.Column>
29
- <Footer.Title>Title</Footer.Title>
30
- <Footer.Text>
31
- Lorem ipsum dolor sit, amet consectetur adipisicing elit. Iure hic
32
- itaque dolore doloribus ducimus iste qui totam. Adipisci recusandae
33
- sed voluptatum odio consequuntur, amet sint totam libero quasi
34
- tenetur expedita?
35
- </Footer.Text>
36
- </Footer.Column>
37
- </Footer.Section>,
38
- <Footer.Bar>All right reserved</Footer.Bar>,
39
- ],
40
- },
41
- } satisfies Meta<typeof Footer>;
42
-
43
- export default meta;
44
-
45
- type Story = StoryObj<typeof Footer>;
46
-
47
- export const Default: Story = {};
@@ -1,96 +0,0 @@
1
- import { forwardRef, HTMLAttributes } from 'react';
2
-
3
- import clsx from 'clsx';
4
-
5
- export interface Props {
6
- id?: string;
7
- className?: string;
8
- text?: string;
9
- variant?: 'light' | 'dark';
10
- }
11
-
12
- const FooterComponent = forwardRef<
13
- HTMLDivElement,
14
- HTMLAttributes<HTMLDivElement>
15
- >(({ children, className }, ref) => {
16
- return (
17
- <div
18
- ref={ref}
19
- className={clsx(
20
- 'grid grid-cols-1 gap-y-12 bg-footer-bg p-8 text-footer-text',
21
- className,
22
- )}
23
- >
24
- {children}
25
- </div>
26
- );
27
- });
28
-
29
- const FooterBar = forwardRef<
30
- HTMLParagraphElement,
31
- HTMLAttributes<HTMLParagraphElement>
32
- >(({ children, className }, ref) => {
33
- return (
34
- <p ref={ref} className={clsx('text-center', className)}>
35
- {children}
36
- </p>
37
- );
38
- });
39
-
40
- const FooterSection = forwardRef<
41
- HTMLDivElement,
42
- HTMLAttributes<HTMLDivElement>
43
- >(({ children, className }, ref) => {
44
- return (
45
- <div ref={ref} className={clsx('grid grid-cols-3 gap-12', className)}>
46
- {children}
47
- </div>
48
- );
49
- });
50
-
51
- const FooterColumn = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
52
- ({ children, className }, ref) => {
53
- return (
54
- <div ref={ref} className={className}>
55
- {children}
56
- </div>
57
- );
58
- },
59
- );
60
-
61
- const FooterTitle = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
62
- ({ children, className }, ref) => {
63
- return (
64
- <div ref={ref} className={className}>
65
- {children}
66
- </div>
67
- );
68
- },
69
- );
70
-
71
- const FooterText = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
72
- ({ children, className }, ref) => {
73
- return (
74
- <div ref={ref} className={className}>
75
- {children}
76
- </div>
77
- );
78
- },
79
- );
80
-
81
- FooterComponent.displayName = 'Footer';
82
- FooterBar.displayName = 'Footer.Bar';
83
- FooterSection.displayName = 'Footer.Section';
84
- FooterColumn.displayName = 'Footer.Column';
85
- FooterTitle.displayName = 'Footer.Title';
86
- FooterText.displayName = 'Footer.Text';
87
-
88
- const Footer = Object.assign(FooterComponent, {
89
- Bar: FooterBar,
90
- Section: FooterSection,
91
- Column: FooterColumn,
92
- Title: FooterTitle,
93
- Text: FooterText,
94
- });
95
-
96
- export { Footer };
@@ -1,32 +0,0 @@
1
- import { FooterNav } from './';
2
- import {
3
- faHeart,
4
- faMoon,
5
- faSnowflake,
6
- faStar,
7
- faSun,
8
- } from '@fortawesome/fontawesome-free-solid';
9
- import { action } from '@storybook/addon-actions';
10
- import { Meta, StoryObj } from '@storybook/react';
11
-
12
- const meta = {
13
- title: 'V2Components/Footer Nav',
14
- component: FooterNav,
15
- args: {
16
- children: [
17
- <FooterNav.Item>
18
- <FooterNav.Label>Item 1</FooterNav.Label>
19
- <FooterNav.Icon icon={faHeart} />
20
- </FooterNav.Item>,
21
- <FooterNav.Item>
22
- <FooterNav.Label>Item 2</FooterNav.Label>
23
- <FooterNav.Icon icon={faMoon} />
24
- </FooterNav.Item>,
25
- ],
26
- },
27
- } satisfies Meta<typeof FooterNav>;
28
- export default meta;
29
-
30
- type Story = StoryObj<typeof FooterNav>;
31
-
32
- export const Default: Story = {};
@@ -1,75 +0,0 @@
1
- import { forwardRef, HTMLAttributes } from 'react';
2
-
3
- import { IconDefinition } from '@fortawesome/fontawesome-free-solid';
4
- import { IconProp } from '@fortawesome/fontawesome-svg-core';
5
- import clsx from 'clsx';
6
-
7
- import { Icon } from '..';
8
-
9
- const FooterNavComponent = forwardRef<
10
- HTMLDivElement,
11
- HTMLAttributes<HTMLDivElement>
12
- >(({ className, children, ...props }, ref) => {
13
- return (
14
- <div
15
- className={clsx(
16
- 'border-lightest-grey fixed bottom-0 flex w-full justify-between border-t px-4',
17
- className,
18
- )}
19
- ref={ref}
20
- {...props}
21
- >
22
- {children}
23
- </div>
24
- );
25
- });
26
-
27
- const FooterNavItem = forwardRef<
28
- HTMLDivElement,
29
- HTMLAttributes<HTMLDivElement> & { href?: string; onClick?: any }
30
- >(({ className, children, href, onClick, ...props }) => {
31
- return (
32
- <div
33
- className={clsx(
34
- 'group w-full cursor-pointer py-2 text-center transition-all duration-500',
35
- className,
36
- )}
37
- {...props}
38
- >
39
- <a href={href} onClick={onClick}>
40
- {children}
41
- </a>
42
- </div>
43
- );
44
- });
45
-
46
- const FooterNavLabel = forwardRef<
47
- HTMLDivElement,
48
- HTMLAttributes<HTMLDivElement>
49
- >(({ className, children, ...props }, ref) => {
50
- return (
51
- <p className={(clsx('font-regular pt-0.5 text-xs'), className)} {...props}>
52
- {children}
53
- </p>
54
- );
55
- });
56
-
57
- const FooterNavIcon = forwardRef<
58
- HTMLDivElement,
59
- HTMLAttributes<HTMLDivElement> & { icon: IconDefinition | IconProp }
60
- >(({ className, icon, ...props }) => {
61
- return <Icon icon={icon} {...props} />;
62
- });
63
-
64
- FooterNavComponent.displayName = 'FooterNav';
65
- FooterNavItem.displayName = 'FooterNav.Item';
66
- FooterNavIcon.displayName = 'FooterNav.Icon';
67
- FooterNavLabel.displayName = 'FooterNav.Label';
68
-
69
- const FooterNav = Object.assign(FooterNavComponent, {
70
- Item: FooterNavItem,
71
- Label: FooterNavLabel,
72
- Icon: FooterNavIcon,
73
- });
74
-
75
- export { FooterNav };