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,139 +0,0 @@
1
- import {
2
- createContext,
3
- forwardRef,
4
- HTMLAttributes,
5
- useContext,
6
- useMemo,
7
- useRef,
8
- } from 'react';
9
-
10
- import clsx from 'clsx';
11
-
12
- export interface InputContextProps {
13
- autoComplete?: string;
14
- disabled?: boolean;
15
- formId?: string;
16
- height?: string;
17
- maxLength?: number;
18
- minLength?: number;
19
- pattern?: string;
20
- required?: boolean;
21
- readOnly?: boolean;
22
- label?: string;
23
- type?: string;
24
- name?: string;
25
- placeholder?: string;
26
- withValidation?: boolean;
27
- onChange?: (e: any) => void;
28
- onBlur?: () => void;
29
- onFocus?: () => void;
30
- onClick?: () => void;
31
- errors?: string[];
32
- value?: string;
33
- }
34
-
35
- const InputContext = createContext<InputContextProps | null>(null);
36
-
37
- const InputComponent = forwardRef<
38
- HTMLDivElement,
39
- HTMLAttributes<HTMLDivElement> & InputContextProps
40
- >(({ children, errors, placeholder, ...props }, ref) => {
41
- const state = useMemo(
42
- () => ({
43
- errors,
44
- placeholder,
45
- ...props,
46
- }),
47
- [errors, props],
48
- );
49
- return (
50
- <InputContext.Provider value={state}>
51
- <div ref={ref}>{children}</div>
52
- </InputContext.Provider>
53
- );
54
- });
55
-
56
- const InputItem = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
57
- ({ children, ...props }, ref) => {
58
- const btnRef = useRef<any>(null);
59
- return (
60
- <div
61
- className="mt-4 w-full cursor-pointer bg-white"
62
- onClick={() => btnRef.current?.focus()}
63
- ref={ref}
64
- {...props}
65
- >
66
- {children}
67
- </div>
68
- );
69
- },
70
- );
71
-
72
- const InputLabel = forwardRef<
73
- HTMLDivElement,
74
- HTMLAttributes<HTMLDivElement> & { required?: boolean }
75
- >(({ children, required = false }, ref) => {
76
- return (
77
- <div
78
- ref={ref}
79
- className="font-regular absolute -mt-3 ml-3 flex items-center rounded-2xl bg-white px-1 text-sm"
80
- >
81
- <p>{children}</p>
82
- {required && (
83
- <p className="font-semiBold text-lg text-error-default">&nbsp;*</p>
84
- )}
85
- </div>
86
- );
87
- });
88
-
89
- const InputBox = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
90
- ({ ...props }) => {
91
- const { errors, placeholder } = useContext(InputContext) || {};
92
-
93
- return (
94
- <input
95
- placeholder={placeholder}
96
- className={clsx(
97
- 'text-ink text-md w-full cursor-pointer rounded-md border border-black bg-white py-2 pl-4',
98
- {
99
- 'border-error border-2': errors != null,
100
- },
101
- )}
102
- {...props}
103
- />
104
- );
105
- },
106
- );
107
-
108
- const InputValidation = forwardRef<
109
- HTMLDivElement,
110
- HTMLAttributes<HTMLDivElement>
111
- >(({ children, ...props }, ref) => {
112
- const { errors } = useContext(InputContext) || {};
113
- return (
114
- <div
115
- ref={ref}
116
- className="font-regular gap-y-2 text-sm text-error-default"
117
- {...props}
118
- >
119
- {errors?.map((error, i) => {
120
- return <p key={`error-msg-${i + 1}`}>{error}</p>;
121
- })}
122
- </div>
123
- );
124
- });
125
-
126
- InputComponent.displayName = 'Input';
127
- InputItem.displayName = 'Input.Item';
128
- InputLabel.displayName = 'Input.Label';
129
- InputBox.displayName = 'Input.Box';
130
- InputValidation.displayName = 'Input.Validation';
131
-
132
- const Input = Object.assign(InputComponent, {
133
- Item: InputItem,
134
- Label: InputLabel,
135
- Box: InputBox,
136
- Validation: InputValidation,
137
- });
138
-
139
- export { Input };
@@ -1,46 +0,0 @@
1
- import { action } from '@storybook/addon-actions';
2
- import { Meta, StoryObj } from '@storybook/react';
3
- import { idAndClassName } from '@utils/controls';
4
-
5
- import { MenuButton } from '.';
6
-
7
- const meta = {
8
- title: 'Components/Menu Button',
9
- component: MenuButton,
10
- argTypes: {
11
- ...idAndClassName,
12
- backgroundColour: {
13
- type: { name: 'string', required: false },
14
- options: ['primary', 'secondary', 'white', 'black', 'gold'],
15
- description: 'The background colour of the component',
16
- table: {
17
- type: { summary: 'string' },
18
- },
19
- defaultValue: 'primary',
20
- control: 'select',
21
- },
22
-
23
- menuItems: {
24
- description: 'The items to show in the menu',
25
- control: 'array',
26
- table: {
27
- type: { summary: 'array' },
28
- },
29
- },
30
- },
31
- args: {
32
- backgroundColour: 'white',
33
- onClick: action('clicked'),
34
- menuItems: [
35
- { name: 'Menu Item 1', href: '#' },
36
- { name: 'Menu Item 2', href: '#' },
37
- { name: 'Menu Item 3', href: '#' },
38
- { name: 'Menu Item 4', href: '#' },
39
- ],
40
- },
41
- };
42
- export default meta;
43
-
44
- type Story = StoryObj<typeof MenuButton>;
45
-
46
- export const Default: Story = {};
@@ -1,66 +0,0 @@
1
- import React, { useState } from 'react';
2
-
3
- import { Dropdown } from '@components/Dropdown';
4
- import { Image } from '@components/Image';
5
- import { type Colours } from '@utils/controls';
6
- import classNames from 'classnames';
7
-
8
- export interface Props {
9
- id?: string;
10
- className?: string;
11
- backgroundColour?: Colours;
12
-
13
- menuItems: Array<{ name: string; href: string }>;
14
- onClick?: React.MouseEventHandler;
15
- }
16
-
17
- export const MenuButton = ({
18
- id,
19
- className,
20
- backgroundColour = 'white',
21
-
22
- menuItems,
23
- onClick,
24
- }: Props) => {
25
- const [showMenu, setShowMenu] = useState(false);
26
- const classList = classNames(
27
- className,
28
- 'h-[45px] w-[80px] overflow-hidden rounded-full border-2 border-lightest-grey my-auto flex cursor-pointer justify-between pl-2 text-center hover:shadow-md',
29
- );
30
-
31
- if (!menuItems) return <></>;
32
-
33
- return (
34
- <div>
35
- <div
36
- id={id}
37
- className={classList}
38
- onClick={() => {
39
- setShowMenu(!showMenu);
40
- }}
41
- >
42
- <div className="mx-auto my-auto" onClick={(e) => onClick?.(e)}>
43
- <svg
44
- width="18"
45
- height="24"
46
- viewBox="0 0 24 15"
47
- xmlns="http://www.w3.org/2000/svg"
48
- >
49
- <path d="M0 1.5C0 0.947715 0.447715 0.5 1 0.5H21C21.5523 0.5 22 0.947715 22 1.5C22 2.05228 21.5523 2.5 21 2.5H1C0.447716 2.5 0 2.05228 0 1.5Z" />
50
- <path d="M0 7.5C0 6.94772 0.447715 6.5 1 6.5H21C21.5523 6.5 22 6.94772 22 7.5C22 8.05228 21.5523 8.5 21 8.5H1C0.447716 8.5 0 8.05228 0 7.5Z" />
51
- <path d="M0 13.5C0 12.9477 0.447715 12.5 1 12.5H21C21.5523 12.5 22 12.9477 22 13.5C22 14.0523 21.5523 14.5 21 14.5H1C0.447716 14.5 0 14.0523 0 13.5Z" />
52
- </svg>
53
- </div>
54
- <Image
55
- src="https://picsum.photos/300/300"
56
- className="mx-auto my-auto h-8 w-8 rounded-full object-contain"
57
- />
58
- </div>
59
- {showMenu && (
60
- <div>
61
- <Dropdown />
62
- </div>
63
- )}
64
- </div>
65
- );
66
- };
@@ -1,82 +0,0 @@
1
- import React, { useState } from 'react';
2
-
3
- import classNames from 'classnames';
4
-
5
- import { Modal } from '.';
6
-
7
- const meta = {
8
- title: 'Components/Modal',
9
- component: Modal,
10
- parameters: {
11
- docs: {
12
- description: {
13
- component: 'A Modal component',
14
- },
15
- },
16
- },
17
- argTypes: {
18
- id: {
19
- type: { name: 'string', required: false },
20
- description: 'HTML id attribute',
21
- table: { type: { summary: 'string' } },
22
- },
23
- className: {
24
- type: { name: 'string', required: false },
25
- description: 'Additional classes to be appended to the component',
26
- table: { type: { summary: 'string' } },
27
- },
28
- children: {
29
- type: { name: 'other', value: 'string | React.ReactNode' },
30
- description: 'The elements to show in the component',
31
- table: {
32
- type: {
33
- summary: 'Array',
34
- },
35
- defaultValue: { summary: 'undefined' },
36
- },
37
- },
38
- onOverlayClick: {
39
- type: { name: 'function', required: false },
40
- description: 'Specifies the action to take when the overlay is clicked',
41
- },
42
- },
43
- args: {
44
- visible: true,
45
- children: (
46
- <div style={{ maxWidth: '609px' }} className="rounded-2xl bg-white p-4">
47
- <p className="py-4">
48
- This is a child of the modal component, add any child to this
49
- component to show in this location.
50
- </p>
51
- <p className="py-4">
52
- Clicking outside of this child, will close the modal
53
- </p>
54
- <p className="py-4">
55
- To bring me back up, just toggle the &apos;visible&apos; control in
56
- storybook&apos;s controls
57
- </p>
58
- </div>
59
- ),
60
- },
61
- };
62
-
63
- const Template = (args: any): React.ReactElement => {
64
- const [visible, setVisible] = useState<boolean>(false);
65
-
66
- return (
67
- <div style={{ height: '350vh' }}>
68
- <Modal
69
- visible={visible}
70
- mobileGutter
71
- onOverlayClick={() => {
72
- setVisible(false);
73
- }}
74
- {...args}
75
- />
76
- </div>
77
- );
78
- };
79
-
80
- export const _Modal = Template.bind({});
81
-
82
- export default meta;
@@ -1,71 +0,0 @@
1
- import React, { useState, useEffect } from 'react';
2
-
3
- import classNames from 'classnames';
4
-
5
- export interface Props extends Partial<Pick<HTMLElement, 'className' | 'id'>> {
6
- children?: React.ReactNode;
7
- visible?: boolean;
8
- onOverlayClick?: () => void;
9
- mobileGutter?: boolean;
10
- animationStyle?: 'fade' | 'slideBottom';
11
- }
12
-
13
- export const Modal = ({
14
- id,
15
- className,
16
- children,
17
- visible = false,
18
- onOverlayClick,
19
- mobileGutter,
20
- animationStyle = 'fade',
21
- }: Props) => {
22
- const [hidden, setHidden] = useState(!visible);
23
- const [showModal, setShowModal] = useState(visible);
24
-
25
- useEffect(() => {
26
- let timeoutId: ReturnType<typeof setTimeout>;
27
-
28
- if (visible) {
29
- setHidden(false);
30
- timeoutId = setTimeout(() => {
31
- setShowModal(true);
32
- }, 100);
33
- } else {
34
- setShowModal(false);
35
- timeoutId = setTimeout(() => {
36
- setHidden(true);
37
- }, 300);
38
- }
39
-
40
- return () => {
41
- clearTimeout(timeoutId);
42
- };
43
- }, [visible]);
44
-
45
- const classList = classNames(
46
- {
47
- 'opacity-100': !hidden && showModal,
48
- },
49
- 'block h-screen w-screen fixed right-0 top-0 z-50 opacity-0 transition-opacity duration-300 ease-linear ease-out',
50
- className,
51
- );
52
-
53
- const childrenClassList = classNames(
54
- {
55
- 'opacity-100': showModal,
56
- 'px-4 md:px-0': mobileGutter,
57
- 'transition-transform duration-300 ease-linear ease-out opacity-100 translate-y-full':
58
- animationStyle === 'slideBottom',
59
- },
60
- ' mx-auto flex w-full md:w-auto fixed left-1/2 top-1/2 z-50 block -translate-x-1/2 -translate-y-1/2 transform opacity-0 transition-opacity duration-300 ease-linear ease-out',
61
- );
62
-
63
- if (hidden) return <></>;
64
-
65
- return (
66
- <>
67
- <div id={id} className={classList} onClick={onOverlayClick} />
68
- {children && <div className={childrenClassList}>{children}</div>}
69
- </>
70
- );
71
- };
@@ -1,80 +0,0 @@
1
- import { Meta, StoryObj } from '@storybook/react';
2
-
3
- import { Nav, NavItem } from '..';
4
-
5
- const meta = {
6
- title: 'V2Components/Nav',
7
- component: Nav,
8
- parameters: {
9
- docs: {
10
- story: { iframe: '1300px' },
11
- },
12
- },
13
- args: {
14
- children: [
15
- <Nav.Header logo="https://picsum.photos/300/300">
16
- <Nav.DesktopHeader>
17
- <Nav.LeftSection>
18
- <Nav.Folder label="about">
19
- <NavItem href="">
20
- <NavItem.Label>Item 1.1</NavItem.Label>
21
- </NavItem>
22
- <NavItem href="">
23
- <NavItem.Label>Item 1.2</NavItem.Label>
24
- </NavItem>
25
- </Nav.Folder>
26
- <NavItem href="">
27
- <NavItem.Label>Item 2</NavItem.Label>
28
- </NavItem>
29
- <NavItem href="">
30
- <NavItem.Label>Item 3</NavItem.Label>
31
- </NavItem>
32
- </Nav.LeftSection>
33
- <Nav.Logo src="https://picsum.photos/300/300" />
34
- <Nav.RightSection>
35
- <NavItem href="">
36
- <NavItem.Label>Item 4</NavItem.Label>
37
- </NavItem>
38
- <NavItem href="">
39
- <NavItem.Label>Item 5</NavItem.Label>
40
- </NavItem>
41
- <NavItem href="">
42
- <NavItem.Label>Item 6</NavItem.Label>
43
- </NavItem>
44
- </Nav.RightSection>
45
- </Nav.DesktopHeader>
46
- </Nav.Header>,
47
- <Nav.Body>
48
- <Nav.Folder label="about">
49
- <NavItem href="">
50
- <NavItem.Label>Item 1.1</NavItem.Label>
51
- </NavItem>
52
- <NavItem href="">
53
- <NavItem.Label>Item 1.2</NavItem.Label>
54
- </NavItem>
55
- </Nav.Folder>
56
- <NavItem href="">
57
- <NavItem.Label>Item 2</NavItem.Label>
58
- </NavItem>
59
- <NavItem href="">
60
- <NavItem.Label>Item 3</NavItem.Label>
61
- </NavItem>
62
- <NavItem href="">
63
- <NavItem.Label>Item 4</NavItem.Label>
64
- </NavItem>
65
- <NavItem href="">
66
- <NavItem.Label>Item 5</NavItem.Label>
67
- </NavItem>
68
- <NavItem href="">
69
- <NavItem.Label>Item 6</NavItem.Label>
70
- </NavItem>
71
- </Nav.Body>,
72
- ],
73
- },
74
- } satisfies Meta<typeof Nav>;
75
-
76
- export default meta;
77
-
78
- type Story = StoryObj<typeof Nav>;
79
-
80
- export const Default: Story = {};
@@ -1,171 +0,0 @@
1
- import {
2
- createContext,
3
- forwardRef,
4
- HTMLAttributes,
5
- useContext,
6
- useMemo,
7
- useRef,
8
- useState,
9
- } from 'react';
10
-
11
- import { useClickOutside } from '@components/Dropdown/utils';
12
- import { HamburgerIcon } from '@components/HamburgerIcon';
13
- import { faChevronDown } from '@fortawesome/fontawesome-free-solid';
14
- import clsx from 'clsx';
15
-
16
- import { Icon, NavItem } from '..';
17
- import { ImageProps } from '../Image';
18
-
19
- export interface NavContextProps {
20
- expanded?: boolean;
21
- setExpanded?: (val: boolean) => void;
22
- }
23
-
24
- const NavContext = createContext<NavContextProps | null>(null);
25
-
26
- const NavComponent = forwardRef<
27
- HTMLDivElement,
28
- HTMLAttributes<HTMLDivElement> & NavContextProps
29
- >(({ children }, ref) => {
30
- const [expanded, setExpanded] = useState(false);
31
-
32
- const state = useMemo(
33
- () => ({
34
- expanded,
35
- setExpanded,
36
- }),
37
- [expanded, setExpanded],
38
- );
39
-
40
- return (
41
- <NavContext.Provider value={state}>
42
- <div>{children}</div>
43
- </NavContext.Provider>
44
- );
45
- });
46
-
47
- const NavHeader = forwardRef<
48
- HTMLDivElement,
49
- HTMLAttributes<HTMLDivElement> & { logo: string }
50
- >(({ children, logo }, ref) => {
51
- const { setExpanded, expanded } = useContext(NavContext) || {};
52
- return (
53
- <div ref={ref} className={clsx('relative h-20 w-full bg-nav px-2 py-2')}>
54
- <div className="flex h-full md:hidden">
55
- <div className="my-auto">
56
- <HamburgerIcon
57
- onClick={() => setExpanded?.(!expanded)}
58
- className="aspect-square"
59
- />
60
- </div>
61
- <div className="absolute left-1/2 top-full w-28 -translate-x-1/2 -translate-y-1/2 transform">
62
- <NavLogo src={logo} />
63
- </div>
64
- </div>
65
- {children}
66
- </div>
67
- );
68
- });
69
-
70
- const NavBody = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(
71
- ({ children }, ref) => {
72
- const { expanded } = useContext(NavContext) || {};
73
- if (!expanded) return <></>;
74
- return (
75
- <div className="h-screen bg-nav px-8 pb-12 pt-20 md:hidden">
76
- <div className="grid grid-cols-1 gap-4 md:hidden">{children}</div>
77
- </div>
78
- );
79
- },
80
- );
81
-
82
- const NavDesktopHeader = forwardRef<
83
- HTMLDivElement,
84
- HTMLAttributes<HTMLDivElement>
85
- >(({ children }, ref) => {
86
- return <div className="hidden grid-cols-7 gap-8 md:grid">{children}</div>;
87
- });
88
-
89
- const NavLeftSection = forwardRef<
90
- HTMLDivElement,
91
- HTMLAttributes<HTMLDivElement>
92
- >(({ children }, ref) => {
93
- return (
94
- <div className="col-span-3 my-4 justify-between text-center md:flex">
95
- {children}
96
- </div>
97
- );
98
- });
99
-
100
- const NavFolder = forwardRef<
101
- HTMLDivElement,
102
- HTMLAttributes<HTMLDivElement> & { label: string }
103
- >(({ label, children }) => {
104
- const [expanded, setExpanded] = useState(false);
105
- const ref = useRef<HTMLDivElement>(null);
106
-
107
- return (
108
- <div
109
- ref={ref}
110
- onClick={() => setExpanded(true)}
111
- onMouseLeave={() => setExpanded(false)}
112
- className="mx-auto text-xl font-normal tracking-wider text-white hover:cursor-pointer"
113
- >
114
- <div className="flex items-center gap-2">
115
- <p>{label}</p>
116
- <Icon icon={faChevronDown} />
117
- </div>
118
- {expanded && (
119
- <div className="mb:pb-2 grid grid-cols-1 bg-nav md:gap-5 md:pt-8">
120
- {children}
121
- </div>
122
- )}
123
- </div>
124
- );
125
- });
126
-
127
- const NavLogo = forwardRef<
128
- HTMLImageElement,
129
- HTMLAttributes<HTMLImageElement> & ImageProps
130
- >(({ className, src, ...props }, ref) => (
131
- <div className="flex-none">
132
- <img
133
- className={clsx('rounded-full', className)}
134
- ref={ref}
135
- src={src}
136
- {...props}
137
- />
138
- </div>
139
- ));
140
-
141
- const NavRightSection = forwardRef<
142
- HTMLDivElement,
143
- HTMLAttributes<HTMLDivElement>
144
- >(({ children }, ref) => {
145
- return (
146
- <div className="col-span-3 my-4 justify-between text-center md:flex">
147
- {children}
148
- </div>
149
- );
150
- });
151
-
152
- NavComponent.displayName = 'Nav';
153
- NavHeader.displayName = 'Nav.Header';
154
- NavDesktopHeader.displayName = 'Nav.DesktopHeader';
155
- NavLogo.displayName = 'Nav.Logo';
156
- NavLeftSection.displayName = 'Nav.LeftSection';
157
- NavRightSection.displayName = 'Nav.RightSection';
158
- NavBody.displayName = 'Nav.Body';
159
- NavFolder.displayName = 'Nav.Folder';
160
-
161
- const Nav = Object.assign(NavComponent, {
162
- Header: NavHeader,
163
- DesktopHeader: NavDesktopHeader,
164
- LeftSection: NavLeftSection,
165
- RightSection: NavRightSection,
166
- Logo: NavLogo,
167
- Body: NavBody,
168
- Folder: NavFolder,
169
- });
170
-
171
- export { Nav };
@@ -1,17 +0,0 @@
1
- import { NavItem } from './';
2
- import { Meta, StoryObj } from '@storybook/react';
3
-
4
- const meta = {
5
- title: 'V2Components/Nav Item',
6
- component: NavItem,
7
- args: {
8
- className: 'text-primary after:border-primary',
9
- children: [<NavItem.Label>Nav Item 1</NavItem.Label>],
10
- },
11
- } satisfies Meta<typeof NavItem>;
12
-
13
- export default meta;
14
-
15
- type Story = StoryObj<typeof NavItem>;
16
-
17
- export const Default: Story = {};