@uob-web-and-digital/component-library 0.0.8 → 0.0.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 (31) hide show
  1. package/README.md +3 -2
  2. package/dist/components/CardFeatured/CardFeatured.d.ts +2 -3
  3. package/dist/components/CardFeatured/CardFeatured.stories.d.ts +1 -1
  4. package/dist/components/FeaturedSignpost/FeaturedSignpost.d.ts +27 -0
  5. package/dist/components/FeaturedSignpost/FeaturedSignpost.stories.d.ts +13 -0
  6. package/dist/components/FeaturedSignpost/animationProperties.d.ts +104 -0
  7. package/dist/components/FeaturedSignpost/components/LinesOfIntent.d.ts +8 -0
  8. package/dist/components/FeaturedSignpost/components/SignpostImage.d.ts +14 -0
  9. package/dist/components/FeaturedSignpost/defaultProps.d.ts +2 -0
  10. package/dist/components/FeaturedVideo/FeaturedVideo.d.ts +18 -0
  11. package/dist/components/FeaturedVideo/FeaturedVideo.stories.d.ts +21 -0
  12. package/dist/components/FeaturedVideo/defaultProps.d.ts +2 -0
  13. package/dist/components/FullModal/FullModal.d.ts +29 -0
  14. package/dist/components/Header/Header.d.ts +3 -1
  15. package/dist/components/Header/Header.stories.d.ts +1 -1
  16. package/dist/components/Header/components/SearchMenu.d.ts +42 -0
  17. package/dist/components/Header/types.d.ts +1 -1
  18. package/dist/components/IconButton/IconButton.d.ts +0 -1
  19. package/dist/components/Icons/Icons.d.ts +1 -1
  20. package/dist/components/Parallax/Parallax.d.ts +7 -0
  21. package/dist/components/TextButtonWithIcon/TextButtonWithIcon.d.ts +34 -0
  22. package/dist/components/TextButtonWithIcon/TextButtonWithIcon.stories.d.ts +14 -0
  23. package/dist/components/Video/Video.d.ts +10 -0
  24. package/dist/components/Video/Video.stories.d.ts +15 -0
  25. package/dist/components/Video/defaultProps.d.ts +2 -0
  26. package/dist/hooks/useFocusTrap.d.ts +5 -0
  27. package/dist/index.d.ts +162 -29
  28. package/dist/main.css +1 -1
  29. package/dist/main.js +5 -5
  30. package/dist/module.js +5 -5
  31. package/package.json +20 -14
package/README.md CHANGED
@@ -13,9 +13,10 @@ This is the frontend component library for the University of Birmingham website
13
13
 
14
14
  ## Installation and setup
15
15
 
16
- ### Node Compatibility
16
+ ### Compatibility
17
17
 
18
- **Node:** ^18.18.0
18
+ - **Node:** ^18.18.0
19
+ - **React:** ^17.0.2
19
20
 
20
21
  ### Setting up the project locally
21
22
 
@@ -14,7 +14,6 @@ export interface CardFeaturedProps {
14
14
  introText: string;
15
15
  link: string;
16
16
  linkText: string;
17
- externalLink?: boolean;
18
17
  cardOrder?: number;
19
18
  activeVariant?: string;
20
19
  leftInitialPositionTablet?: string;
@@ -28,6 +27,6 @@ export interface CardFeaturedProps {
28
27
  /**
29
28
  * Primary UI component for user interaction
30
29
  */
31
- type CTARef = HTMLAnchorElement | null;
32
- export declare const CardFeatured: React.ForwardRefExoticComponent<CardFeaturedProps & React.RefAttributes<CTARef>>;
30
+ type CardRef = HTMLDivElement | null;
31
+ export declare const CardFeatured: React.ForwardRefExoticComponent<CardFeaturedProps & React.RefAttributes<CardRef>>;
33
32
  export default CardFeatured;
@@ -3,7 +3,7 @@ import type { StoryObj } from '@storybook/react';
3
3
  import CardFeatured from './CardFeatured';
4
4
  declare const meta: {
5
5
  title: string;
6
- component: import("react").ForwardRefExoticComponent<import("./CardFeatured").CardFeaturedProps & import("react").RefAttributes<HTMLAnchorElement | null>>;
6
+ component: import("react").ForwardRefExoticComponent<import("./CardFeatured").CardFeaturedProps & import("react").RefAttributes<HTMLDivElement | null>>;
7
7
  tags: string[];
8
8
  };
9
9
  export default meta;
@@ -0,0 +1,27 @@
1
+ import { ReactElement } from 'react';
2
+ import { ThemeProps } from '../../themeProps';
3
+ import './featuredSignpost.scss';
4
+ export interface FeaturedSignpostProps {
5
+ /**
6
+ * The theme to use
7
+ */
8
+ theme: ThemeProps;
9
+ /**
10
+ * Whether to inverse the colours
11
+ */
12
+ inverse?: boolean;
13
+ position: 'left' | 'right';
14
+ category?: string;
15
+ title: string;
16
+ description?: string;
17
+ linkUrl: string;
18
+ linkLabel: string;
19
+ linkIsExternal?: boolean;
20
+ imageSrc: {
21
+ small?: string;
22
+ medium?: string;
23
+ default: string;
24
+ };
25
+ imageAlt: string;
26
+ }
27
+ export default function FeaturedSignpost({ theme, inverse, position, category, title, description, linkUrl, linkLabel, linkIsExternal, imageAlt, imageSrc }: FeaturedSignpostProps): ReactElement;
@@ -0,0 +1,13 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import FeaturedSignpost from './FeaturedSignpost';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof FeaturedSignpost;
6
+ tags: string[];
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof FeaturedSignpost>;
10
+ export declare const LeftDark: Story;
11
+ export declare const RightDark: Story;
12
+ export declare const LeftLight: Story;
13
+ export declare const RightLight: Story;
@@ -0,0 +1,104 @@
1
+ export declare const mobileOriginClipPath: {
2
+ left: string;
3
+ right: string;
4
+ };
5
+ export declare const mobileBackgroundClipPath: {
6
+ left: string;
7
+ right: string;
8
+ };
9
+ export declare const mobileImageClipPath: {
10
+ left: string;
11
+ right: string;
12
+ };
13
+ export declare const tabletAndDesktopOriginClipPath: {
14
+ left: string;
15
+ right: string;
16
+ };
17
+ export declare const tabletBackgroundClipPath: {
18
+ left: string;
19
+ right: string;
20
+ };
21
+ export declare const tabletImageClipPath: {
22
+ left: string;
23
+ right: string;
24
+ };
25
+ export declare const desktopBackgroundClipPath: {
26
+ left: string;
27
+ right: string;
28
+ };
29
+ export declare const desktopImageClipPath: {
30
+ left: string;
31
+ right: string;
32
+ };
33
+ export declare const mobileLineOnePosition: {
34
+ left: {
35
+ left: string;
36
+ bottom: string;
37
+ transform: string;
38
+ };
39
+ right: {
40
+ left: string;
41
+ top: string;
42
+ transform: string;
43
+ };
44
+ };
45
+ export declare const mobileLineTwoPosition: {
46
+ left: {
47
+ left: string;
48
+ bottom: string;
49
+ transform: string;
50
+ };
51
+ right: {
52
+ left: string;
53
+ top: string;
54
+ transform: string;
55
+ };
56
+ };
57
+ export declare const tabletLineOnePosition: {
58
+ left: {
59
+ left: string;
60
+ top: string;
61
+ transform: string;
62
+ };
63
+ right: {
64
+ left: string;
65
+ top: string;
66
+ transform: string;
67
+ };
68
+ };
69
+ export declare const tabletLineTwoPosition: {
70
+ left: {
71
+ left: string;
72
+ top: string;
73
+ transform: string;
74
+ };
75
+ right: {
76
+ left: string;
77
+ top: string;
78
+ transform: string;
79
+ };
80
+ };
81
+ export declare const desktopLineOnePosition: {
82
+ left: {
83
+ left: string;
84
+ top: string;
85
+ transform: string;
86
+ };
87
+ right: {
88
+ left: string;
89
+ top: string;
90
+ transform: string;
91
+ };
92
+ };
93
+ export declare const desktopLineTwoPosition: {
94
+ left: {
95
+ left: string;
96
+ top: string;
97
+ transform: string;
98
+ };
99
+ right: {
100
+ left: string;
101
+ top: string;
102
+ transform: string;
103
+ };
104
+ };
@@ -0,0 +1,8 @@
1
+ import { ReactElement } from 'react';
2
+ interface Props {
3
+ isMobile: boolean;
4
+ isTablet: boolean;
5
+ position: 'left' | 'right';
6
+ }
7
+ export default function LinesOfIntent({ isMobile, isTablet, position }: Props): ReactElement;
8
+ export {};
@@ -0,0 +1,14 @@
1
+ import { ReactElement } from 'react';
2
+ interface Props {
3
+ isMobile: boolean;
4
+ isTablet: boolean;
5
+ position: 'left' | 'right';
6
+ imageSrc: {
7
+ small?: string;
8
+ medium?: string;
9
+ default: string;
10
+ };
11
+ imageAlt: string;
12
+ }
13
+ export default function SignpostImage({ isMobile, isTablet, position, imageSrc, imageAlt }: Props): ReactElement;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import { FeaturedSignpostProps } from './FeaturedSignpost';
2
+ export declare const featuredSignpostProps: FeaturedSignpostProps;
@@ -0,0 +1,18 @@
1
+ import { ReactElement } from 'react';
2
+ import { ThemeProps } from '../../themeProps';
3
+ import './featuredVideo.scss';
4
+ import { ImageProps } from '../Image/Image';
5
+ export interface FeaturedVideoProps {
6
+ theme: ThemeProps;
7
+ inverse?: boolean;
8
+ image: ImageProps;
9
+ title: string;
10
+ youtubeId: string;
11
+ audioYoutubeId?: string;
12
+ youtubeButtonLabel?: string;
13
+ audioYoutubeButtonLabel?: string;
14
+ }
15
+ /**
16
+ * Primary UI component for user interaction
17
+ */
18
+ export default function FeaturedVideo({ theme, title, image, youtubeId, youtubeButtonLabel, audioYoutubeButtonLabel, audioYoutubeId }: FeaturedVideoProps): ReactElement | null;
@@ -0,0 +1,21 @@
1
+ /// <reference types="react" />
2
+ import type { StoryObj } from '@storybook/react';
3
+ import FeaturedVideo from './FeaturedVideo';
4
+ declare const meta: {
5
+ title: string;
6
+ component: typeof FeaturedVideo;
7
+ decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
8
+ theme: import("../../themeProps").ThemeProps;
9
+ inverse?: boolean | undefined;
10
+ image: import("../Image/Image").ImageProps;
11
+ title: string;
12
+ youtubeId: string;
13
+ audioYoutubeId?: string | undefined;
14
+ youtubeButtonLabel?: string | undefined;
15
+ audioYoutubeButtonLabel?: string | undefined;
16
+ }>) => JSX.Element)[];
17
+ tags: string[];
18
+ };
19
+ export default meta;
20
+ type Story = StoryObj<typeof FeaturedVideo>;
21
+ export declare const Dark: Story;
@@ -0,0 +1,2 @@
1
+ import { FeaturedVideoProps } from './FeaturedVideo';
2
+ export declare const featuredVideoProps: FeaturedVideoProps;
@@ -0,0 +1,29 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ import { ThemeProps } from '../../themeProps';
3
+ import './fullModal.scss';
4
+ export interface FullModalProps {
5
+ /**
6
+ * The theme to use
7
+ */
8
+ theme: ThemeProps;
9
+ /**
10
+ * Whether to inverse the colours
11
+ */
12
+ inverse?: boolean;
13
+ /**
14
+ * Contents of the modal
15
+ */
16
+ children: ReactNode;
17
+ /**
18
+ * Handler for closing the modal
19
+ */
20
+ closeModal: () => void;
21
+ /**
22
+ * Pass in the is open state
23
+ */
24
+ isOpen: boolean;
25
+ }
26
+ /**
27
+ * Primary UI component for user interaction
28
+ */
29
+ export declare const FullModal: ({ theme, isOpen, closeModal, children }: FullModalProps) => ReactElement;
@@ -1,6 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ThemeProps } from '../../themeProps';
3
3
  import { HeaderLink } from './types';
4
+ import { SearchMenuProps } from './components/SearchMenu';
4
5
  import './header.scss';
5
6
  export interface HeaderProps {
6
7
  /**
@@ -19,5 +20,6 @@ export interface HeaderProps {
19
20
  dubaiUrl: string;
20
21
  ukUrl: string;
21
22
  activeCampus?: 'uk' | 'dubai';
23
+ searchProps: SearchMenuProps;
22
24
  }
23
- export declare const Header: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus }: HeaderProps) => ReactElement;
25
+ export declare const Header: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus, searchProps }: HeaderProps) => ReactElement;
@@ -3,7 +3,7 @@ import type { StoryObj } from '@storybook/react';
3
3
  import { Header } from './Header';
4
4
  declare const meta: {
5
5
  title: string;
6
- component: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus }: import("./Header").HeaderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
6
+ component: ({ theme, primaryLinks, secondaryLinks, homepageUrl, dubaiUrl, ukUrl, activeCampus, searchProps }: import("./Header").HeaderProps) => import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>>;
7
7
  tags: string[];
8
8
  };
9
9
  export default meta;
@@ -0,0 +1,42 @@
1
+ import React, { ReactElement } from 'react';
2
+ import { ThemeProps } from '../../../themeProps';
3
+ export interface SearchMenuProps {
4
+ /**
5
+ * The theme to use
6
+ */
7
+ theme: ThemeProps;
8
+ /**
9
+ * Whether to inverse the colours
10
+ */
11
+ inverse?: boolean;
12
+ /**
13
+ * Title for module
14
+ */
15
+ title?: string;
16
+ /**
17
+ * Placeholder text
18
+ */
19
+ placeholder?: string;
20
+ /**
21
+ * Results url
22
+ */
23
+ resultsUrl?: string;
24
+ /**
25
+ * Introductory text
26
+ */
27
+ introText?: string;
28
+ /**
29
+ * On change event
30
+ */
31
+ handleSearchChange?: (e: React.ChangeEvent<HTMLInputElement>) => void;
32
+ /**
33
+ * On search submit event
34
+ */
35
+ handleSearchSubmit?: (e: React.SyntheticEvent) => void;
36
+ onClickGoBack?: () => void;
37
+ backLinkLabel?: string;
38
+ }
39
+ /**
40
+ * Search component
41
+ */
42
+ export declare const SearchMenu: ({ title, placeholder, introText, handleSearchChange, handleSearchSubmit, theme, inverse, onClickGoBack, backLinkLabel }: SearchMenuProps) => ReactElement;
@@ -4,4 +4,4 @@ export interface HeaderLink {
4
4
  description?: string;
5
5
  children?: HeaderLink[];
6
6
  }
7
- export type MenuLevel = 0 | 1 | 2;
7
+ export type MenuLevel = 0 | 1 | 2 | 3;
@@ -11,7 +11,6 @@ export interface IconButtonProps {
11
11
  externalLink?: boolean;
12
12
  onClick?: () => void;
13
13
  ariaControls?: string;
14
- autoFocus?: boolean;
15
14
  isSubmit?: boolean;
16
15
  disabled?: boolean;
17
16
  }
@@ -1,7 +1,7 @@
1
1
  import { ReactElement } from 'react';
2
2
  import { ThemeProps } from '../../themeProps';
3
3
  import './icons.scss';
4
- export type IconType = 'twitter' | 'facebook' | 'wechat' | 'weibo' | 'youtube' | 'instagram' | 'linkedin' | 'chevron-down' | 'chevron-right' | 'arrow-right' | 'arrow-right-large' | 'location' | 'hamburger' | 'cross' | 'arrow-left' | 'search' | 'arrow-down';
4
+ export type IconType = 'twitter' | 'facebook' | 'wechat' | 'weibo' | 'youtube' | 'instagram' | 'linkedin' | 'chevron-down' | 'chevron-right' | 'arrow-right' | 'arrow-right-large' | 'location' | 'hamburger' | 'cross' | 'arrow-left' | 'search' | 'arrow-down' | 'play';
5
5
  export type IconProps = {
6
6
  /**
7
7
  * The theme to use
@@ -0,0 +1,7 @@
1
+ import { ReactNode } from 'react';
2
+ type ParallaxProps = {
3
+ children: ReactNode;
4
+ offset: number;
5
+ };
6
+ export declare const Parallax: ({ children, offset }: ParallaxProps) => JSX.Element;
7
+ export {};
@@ -0,0 +1,34 @@
1
+ import { MouseEventHandler, ReactElement } from 'react';
2
+ import { IconType } from '../Icons/Icons';
3
+ import { ThemeProps } from '../../themeProps';
4
+ import './textButtonWithIcon.scss';
5
+ export interface TextButtonWithIconProps {
6
+ /**
7
+ * The theme to use
8
+ */
9
+ theme: ThemeProps;
10
+ /**
11
+ * Whether to inverse the colours
12
+ */
13
+ inverse?: boolean;
14
+ label: string;
15
+ /**
16
+ * Handler to use if it's a <button />
17
+ */
18
+ onClick?: MouseEventHandler;
19
+ url?: string;
20
+ externalLink?: boolean;
21
+ /**
22
+ * Whether the button has a background color or is hollow
23
+ */
24
+ hollow?: boolean;
25
+ /**
26
+ * Whether the button is used as a submit button in a form
27
+ */
28
+ isSubmit?: boolean;
29
+ /**
30
+ * The icon to be used
31
+ */
32
+ icon: IconType;
33
+ }
34
+ export default function TextButtonWithIcon({ theme, inverse, label, onClick, url, externalLink, hollow, isSubmit, icon }: TextButtonWithIconProps): ReactElement;
@@ -0,0 +1,14 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import TextButtonWithIcon from './TextButtonWithIcon';
3
+ import './textButtonWithIcon.scss';
4
+ declare const meta: {
5
+ title: string;
6
+ component: typeof TextButtonWithIcon;
7
+ tags: string[];
8
+ };
9
+ export default meta;
10
+ type Story = StoryObj<typeof meta>;
11
+ export declare const DarkFilled: Story;
12
+ export declare const DarkHollow: Story;
13
+ export declare const Light: Story;
14
+ export declare const LightHollow: Story;
@@ -0,0 +1,10 @@
1
+ import { ReactElement } from 'react';
2
+ import { ThemeProps } from '../../themeProps';
3
+ import './video.scss';
4
+ export interface VideoProps {
5
+ theme: ThemeProps;
6
+ id?: string;
7
+ url?: string;
8
+ autoPlay?: boolean;
9
+ }
10
+ export default function Video({ theme, id, url, autoPlay }: VideoProps): ReactElement;
@@ -0,0 +1,15 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import Video from './Video';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Video;
6
+ tags: string[];
7
+ parameters: {
8
+ backgrounds: {
9
+ default: string;
10
+ };
11
+ };
12
+ };
13
+ export default meta;
14
+ type Story = StoryObj<typeof Video>;
15
+ export declare const Dark: Story;
@@ -0,0 +1,2 @@
1
+ import { VideoProps } from './Video';
2
+ export declare const videoProps: VideoProps;
@@ -0,0 +1,5 @@
1
+ import { ReactNode, ReactElement } from 'react';
2
+ export interface FocusTrapProps {
3
+ children: ReactNode;
4
+ }
5
+ export default function FocusTrap(props: FocusTrapProps): ReactElement;