@uob-web-and-digital/component-library 0.0.55 → 0.0.56

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 (23) hide show
  1. package/dist/components/atoms/Heading/Heading.d.ts +7 -0
  2. package/dist/components/atoms/Heading/Heading.stories.d.ts +12 -0
  3. package/dist/components/molecules/CardNews/CardNews.d.ts +2 -1
  4. package/dist/components/molecules/CardNews/CardNews.stories.d.ts +2 -0
  5. package/dist/components/molecules/CardNews/defaultProps.d.ts +2 -0
  6. package/dist/components/molecules/CardPromo/CardPromo.d.ts +4 -2
  7. package/dist/components/molecules/CardPromo/CardPromo.stories.d.ts +2 -0
  8. package/dist/components/molecules/CardPromoSignpost/CardPromoSignpost.d.ts +2 -1
  9. package/dist/components/molecules/CardPromoSignpost/CardPromoSignpost.stories.d.ts +1 -0
  10. package/dist/components/molecules/CardVideo/CardVideo.d.ts +2 -1
  11. package/dist/components/molecules/FilterAccordion/FilterAccordion.d.ts +4 -2
  12. package/dist/components/molecules/FilterAccordionSelect/FilterAccordionSelect.d.ts +14 -0
  13. package/dist/components/molecules/FilterAccordionSelect/FilterAccordionSelect.stories.d.ts +10 -0
  14. package/dist/components/molecules/FilterAccordionSelect/defaultProps.d.ts +2 -0
  15. package/dist/components/organisms/Carousel/Carousel.d.ts +3 -2
  16. package/dist/components/organisms/PromoBlock/PromoBlock.d.ts +13 -1
  17. package/dist/components/organisms/StandardListingFilter/StandardListingFilter.d.ts +9 -1
  18. package/dist/components/organisms/StandardListingFilter/StandardListingFilter.stories.d.ts +1 -1
  19. package/dist/index.d.ts +57 -9
  20. package/dist/main.css +1 -1
  21. package/dist/main.js +5 -5
  22. package/dist/module.js +5 -5
  23. package/package.json +1 -1
@@ -0,0 +1,7 @@
1
+ import { ReactElement, ReactNode } from 'react';
2
+ export interface HeadingProps {
3
+ htmlTag: 'h2' | 'h3' | 'h4';
4
+ classNames?: string;
5
+ children?: ReactNode;
6
+ }
7
+ export default function Heading({ htmlTag, classNames, children }: HeadingProps): ReactElement;
@@ -0,0 +1,12 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import Heading from './Heading';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof Heading;
6
+ tags: string[];
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof Heading>;
10
+ export declare const Default: Story;
11
+ export declare const h3: Story;
12
+ export declare const h4: Story;
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ImageProps } from '../../atoms/Image/Image';
3
3
  import { ThemeProps } from '../../../themeProps';
4
4
  import './cardNews.scss';
5
+ import { HeadingProps } from '../../atoms/Heading/Heading';
5
6
  export interface CardNewsProps {
6
7
  theme: ThemeProps;
7
8
  inverse?: boolean;
@@ -10,7 +11,7 @@ export interface CardNewsProps {
10
11
  title: string;
11
12
  href: string;
12
13
  publishDate: string;
13
- titleTag: 'h2' | 'h3';
14
+ titleTag: HeadingProps['htmlTag'];
14
15
  }
15
16
  /**
16
17
  * Primary UI component for user interaction
@@ -11,3 +11,5 @@ declare const meta: {
11
11
  export default meta;
12
12
  type Story = StoryObj<typeof CardNews>;
13
13
  export declare const Light: Story;
14
+ export declare const LightH3Title: Story;
15
+ export declare const LightH4Title: Story;
@@ -0,0 +1,2 @@
1
+ import { CardNewsProps } from './CardNews';
2
+ export declare const cardNewsProps: CardNewsProps;
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ImageProps } from '../../atoms/Image/Image';
3
3
  import { ThemeProps } from '../../../themeProps';
4
4
  import './cardPromo.scss';
5
+ import { HeadingProps } from '../../atoms/Heading/Heading';
5
6
  export interface CardPromoProps {
6
7
  theme: ThemeProps;
7
8
  inverse?: boolean;
@@ -15,9 +16,10 @@ export interface CardPromoProps {
15
16
  location?: string;
16
17
  copy?: string;
17
18
  isSingle?: boolean;
18
- titleTag: 'h2' | 'h3';
19
+ titleTag: HeadingProps['htmlTag'];
20
+ cardCopyIsRichText?: boolean;
19
21
  }
20
22
  /**
21
23
  * Primary UI component for user interaction
22
24
  */
23
- export default function CardPromo({ theme, inverse, image, tag, title, subtitle, href, publishDate, authorString, location, copy, isSingle, titleTag }: CardPromoProps): ReactElement;
25
+ export default function CardPromo({ theme, inverse, image, tag, title, subtitle, href, publishDate, authorString, location, copy, isSingle, titleTag, cardCopyIsRichText }: CardPromoProps): ReactElement;
@@ -12,5 +12,7 @@ export default meta;
12
12
  type Story = StoryObj<typeof CardPromo>;
13
13
  export declare const SinglePromoCardLight: Story;
14
14
  export declare const SinglePromoCardDark: Story;
15
+ export declare const SinglePromoCardLightRichTextCopy: Story;
16
+ export declare const SinglePromoCardDarkRichTextCopy: Story;
15
17
  export declare const CardNoImage: Story;
16
18
  export declare const OneOfManyPromoCards: Story;
@@ -4,6 +4,7 @@ import { ThemeProps } from '../../../themeProps';
4
4
  import { TextButtonProps } from '../../atoms/TextButton/TextButton';
5
5
  import { LinkWithArrowProps } from '../../atoms/LinkWithArrow/LinkWithArrow';
6
6
  import './cardPromoSignpost.scss';
7
+ import { HeadingProps } from '../../atoms/Heading/Heading';
7
8
  export interface CardPromoSignpostProps {
8
9
  theme: ThemeProps;
9
10
  inverse?: boolean;
@@ -20,7 +21,7 @@ export interface CardPromoSignpostProps {
20
21
  buttonPrimary?: TextButtonProps;
21
22
  buttonSecondary?: TextButtonProps;
22
23
  link?: LinkWithArrowProps;
23
- titleTag: 'h2' | 'h3';
24
+ titleTag: HeadingProps['htmlTag'];
24
25
  }
25
26
  /**
26
27
  * Primary UI component for user interaction
@@ -13,3 +13,4 @@ type Story = StoryObj<typeof CardPromoSignpost>;
13
13
  export declare const SinglePromoSignpostCardLight: Story;
14
14
  export declare const SinglePromoSignpostCardsDarkRightImage: Story;
15
15
  export declare const OneOfManyPromoSignpostCardsDark: Story;
16
+ export declare const SinglePromoSignpostCardsDarkRightImageH4Title: Story;
@@ -2,6 +2,7 @@ import { ReactElement } from 'react';
2
2
  import { ImageProps } from '../../atoms/Image/Image';
3
3
  import { ThemeProps } from '../../../themeProps';
4
4
  import './cardVideo.scss';
5
+ import { HeadingProps } from '../../atoms/Heading/Heading';
5
6
  export interface CardVideoProps {
6
7
  theme: ThemeProps;
7
8
  inverse?: boolean;
@@ -9,7 +10,7 @@ export interface CardVideoProps {
9
10
  title: string;
10
11
  youtubeId: string;
11
12
  buttonLabel: string;
12
- titleTag?: 'h2' | 'h3';
13
+ titleTag: HeadingProps['htmlTag'];
13
14
  }
14
15
  /**
15
16
  * Primary UI component for user interaction
@@ -8,7 +8,8 @@ interface CheckboxAccordionProps {
8
8
  theme: ThemeProps;
9
9
  heading: string;
10
10
  type: 'checkbox';
11
- inputs: Omit<CheckboxProps, 'theme'>[];
11
+ inputs?: Omit<CheckboxProps, 'theme'>[];
12
+ selectProps?: null;
12
13
  /**
13
14
  * Whether the accordion is open or closed by default
14
15
  */
@@ -18,7 +19,8 @@ interface RadioButtonAccordionProps {
18
19
  theme: ThemeProps;
19
20
  heading: string;
20
21
  type: 'radio';
21
- inputs: Omit<RadioButtonProps, 'theme'>[];
22
+ inputs?: Omit<RadioButtonProps, 'theme'>[];
23
+ selectProps?: null;
22
24
  /**
23
25
  * Whether the accordion is open or closed by default
24
26
  */
@@ -0,0 +1,14 @@
1
+ import { ReactElement } from 'react';
2
+ import { ThemeProps } from '../../../themeProps';
3
+ import { FormSelectProps } from '../../atoms/FormSelect/FormSelect';
4
+ import './filterAccordionSelect.scss';
5
+ export type FilterAccordionSelectProps = {
6
+ theme: ThemeProps;
7
+ heading: string;
8
+ selectContent: Omit<FormSelectProps, 'theme'>;
9
+ /**
10
+ * Whether the accordion is open or closed by default
11
+ */
12
+ defaultIsOpen?: boolean;
13
+ };
14
+ export default function FilterAccordionSelect({ theme, heading, selectContent, defaultIsOpen }: FilterAccordionSelectProps): ReactElement;
@@ -0,0 +1,10 @@
1
+ import type { StoryObj } from '@storybook/react';
2
+ import FilterAccordionSelect from './FilterAccordionSelect';
3
+ declare const meta: {
4
+ title: string;
5
+ component: typeof FilterAccordionSelect;
6
+ tags: string[];
7
+ };
8
+ export default meta;
9
+ type Story = StoryObj<typeof FilterAccordionSelect>;
10
+ export declare const Select: Story;
@@ -0,0 +1,2 @@
1
+ import { FilterAccordionSelectProps } from './FilterAccordionSelect';
2
+ export declare const selectFilterProps: FilterAccordionSelectProps;
@@ -11,14 +11,15 @@ import { CardImageProps } from '../../molecules/CardImage/CardImage';
11
11
  import { CardFeaturedNewsProps } from '../../molecules/CardFeaturedNews/CardFeaturedNews';
12
12
  import { ThemeProps } from '../../../themeProps';
13
13
  import './carousel.scss';
14
+ import { HeadingProps } from '../../atoms/Heading/Heading';
14
15
  export interface CarouselProps {
15
16
  theme: ThemeProps;
16
17
  inverse?: boolean;
17
18
  type: string;
18
19
  title?: string;
19
- useH3ForCards?: boolean;
20
+ cardTitleTag?: HeadingProps['htmlTag'];
20
21
  setCardInverse?: 'dark' | 'light';
21
22
  cards: Omit<CardNewsProps, 'titleTag'>[] | CardFeaturedProps[] | CardVideoProps[] | CardPromoProps[] | CardPromoSignpostProps[] | CardPromoVideoProps[] | CardStaffProps[] | CardRelatedProps[] | CardImageProps[] | CardFeaturedNewsProps[];
22
23
  exploreMore?: string;
23
24
  }
24
- export default function Carousel({ theme, inverse, type, title, cards, useH3ForCards, setCardInverse, exploreMore }: CarouselProps): ReactElement;
25
+ export default function Carousel({ theme, inverse, type, title, cards, cardTitleTag, setCardInverse, exploreMore }: CarouselProps): ReactElement;
@@ -18,6 +18,14 @@ export interface PromoBlockProps {
18
18
  * Optional title of the component
19
19
  */
20
20
  title?: string;
21
+ /**
22
+ * Optional titleTag of the component
23
+ */
24
+ titleTag?: 'h2' | 'h3';
25
+ /**
26
+ * Optional cardTitleTag of the component
27
+ */
28
+ cardTitleTag?: 'h2' | 'h3' | 'h4';
21
29
  /**
22
30
  * Optional description of the component
23
31
  */
@@ -38,5 +46,9 @@ export interface PromoBlockProps {
38
46
  * Only applies to the signpost card and if there is only one
39
47
  */
40
48
  imageOrientation: 'left' | 'right';
49
+ /**
50
+ * The copy prop of the card may need to be rendered as Rich Text
51
+ */
52
+ cardCopyIsRichText?: boolean;
41
53
  }
42
- export default function PromoBlock({ theme, inverse, type, title, description, link, cards, imageOrientation }: PromoBlockProps): ReactElement | null;
54
+ export default function PromoBlock({ theme, inverse, type, title, description, link, cards, imageOrientation, titleTag, cardTitleTag, cardCopyIsRichText }: PromoBlockProps): ReactElement | null;
@@ -1,4 +1,5 @@
1
1
  import { ChangeEvent, ReactElement } from 'react';
2
+ import { FilterAccordionSelectProps } from '../../molecules/FilterAccordionSelect/FilterAccordionSelect';
2
3
  import { ThemeProps } from '../../../themeProps';
3
4
  import './standardListingFilter.scss';
4
5
  export interface StandardListingFilterProps {
@@ -7,7 +8,7 @@ export interface StandardListingFilterProps {
7
8
  listingGroups: ListingGroup[];
8
9
  onClearFilters: () => void;
9
10
  }
10
- type ListingGroup = DateProps | RadioProps | CheckboxProps;
11
+ type ListingGroup = DateProps | RadioProps | CheckboxProps | SelectProps;
11
12
  export interface RadioProps {
12
13
  type: 'radio';
13
14
  heading: string;
@@ -40,5 +41,12 @@ export interface DateProps {
40
41
  onChange?: (e: ChangeEvent) => void;
41
42
  defaultValue?: string;
42
43
  }
44
+ export interface SelectProps extends FilterAccordionSelectProps {
45
+ type: 'select';
46
+ onChange?: (e: ChangeEvent) => void;
47
+ defaultValue?: string;
48
+ name: string;
49
+ id: string;
50
+ }
43
51
  export default function StandardListingFilter({ theme, heading, listingGroups, onClearFilters }: StandardListingFilterProps): ReactElement;
44
52
  export {};
@@ -8,7 +8,7 @@ declare const meta: {
8
8
  decorators: ((Story: import("@storybook/types").PartialStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
9
9
  theme: import("../../../themeProps").ThemeProps;
10
10
  heading: string;
11
- listingGroups: (import("./StandardListingFilter").DateProps | import("./StandardListingFilter").RadioProps | import("./StandardListingFilter").CheckboxProps)[];
11
+ listingGroups: (import("./StandardListingFilter").DateProps | import("./StandardListingFilter").RadioProps | import("./StandardListingFilter").CheckboxProps | import("./StandardListingFilter").SelectProps)[];
12
12
  onClearFilters: () => void;
13
13
  }>) => JSX.Element)[];
14
14
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import React, { KeyboardEvent, ReactElement, PropsWithChildren, MouseEventHandler, ChangeEvent, ReactNode } from 'react';
1
+ import React, { ReactNode, KeyboardEvent, ReactElement, PropsWithChildren, MouseEventHandler, ChangeEvent } from 'react';
2
2
 
3
3
  type ImageProps = {
4
4
  src: {
@@ -15,6 +15,12 @@ type ImageProps = {
15
15
 
16
16
  type ThemeProps = 'uobmain' | 'redexample';
17
17
 
18
+ interface HeadingProps$1 {
19
+ htmlTag: 'h2' | 'h3' | 'h4';
20
+ classNames?: string;
21
+ children?: ReactNode;
22
+ }
23
+
18
24
  interface CardNewsProps {
19
25
  theme: ThemeProps;
20
26
  inverse?: boolean;
@@ -23,7 +29,7 @@ interface CardNewsProps {
23
29
  title: string;
24
30
  href: string;
25
31
  publishDate: string;
26
- titleTag: 'h2' | 'h3';
32
+ titleTag: HeadingProps$1['htmlTag'];
27
33
  }
28
34
 
29
35
  interface CardFeaturedProps {
@@ -56,7 +62,7 @@ interface CardVideoProps {
56
62
  title: string;
57
63
  youtubeId: string;
58
64
  buttonLabel: string;
59
- titleTag?: 'h2' | 'h3';
65
+ titleTag: HeadingProps$1['htmlTag'];
60
66
  }
61
67
 
62
68
  interface CardPromoProps {
@@ -72,7 +78,8 @@ interface CardPromoProps {
72
78
  location?: string;
73
79
  copy?: string;
74
80
  isSingle?: boolean;
75
- titleTag: 'h2' | 'h3';
81
+ titleTag: HeadingProps$1['htmlTag'];
82
+ cardCopyIsRichText?: boolean;
76
83
  }
77
84
 
78
85
  interface TextButtonProps {
@@ -133,7 +140,7 @@ interface CardPromoSignpostProps {
133
140
  buttonPrimary?: TextButtonProps;
134
141
  buttonSecondary?: TextButtonProps;
135
142
  link?: LinkWithArrowProps;
136
- titleTag: 'h2' | 'h3';
143
+ titleTag: HeadingProps$1['htmlTag'];
137
144
  }
138
145
 
139
146
  interface CardPromoVideoProps {
@@ -202,12 +209,12 @@ interface CarouselProps {
202
209
  inverse?: boolean;
203
210
  type: string;
204
211
  title?: string;
205
- useH3ForCards?: boolean;
212
+ cardTitleTag?: HeadingProps$1['htmlTag'];
206
213
  setCardInverse?: 'dark' | 'light';
207
214
  cards: Omit<CardNewsProps, 'titleTag'>[] | CardFeaturedProps[] | CardVideoProps[] | CardPromoProps[] | CardPromoSignpostProps[] | CardPromoVideoProps[] | CardStaffProps[] | CardRelatedProps[] | CardImageProps[] | CardFeaturedNewsProps[];
208
215
  exploreMore?: string;
209
216
  }
210
- declare function Carousel({ theme, inverse, type, title, cards, useH3ForCards, setCardInverse, exploreMore }: CarouselProps): ReactElement;
217
+ declare function Carousel({ theme, inverse, type, title, cards, cardTitleTag, setCardInverse, exploreMore }: CarouselProps): ReactElement;
211
218
 
212
219
  interface FeaturedContentProps {
213
220
  /**
@@ -411,6 +418,18 @@ interface SelectOptionsProps {
411
418
  value: string;
412
419
  selected?: boolean;
413
420
  }
421
+ interface FormSelectProps {
422
+ theme: ThemeProps;
423
+ inverse?: boolean;
424
+ fieldName: string;
425
+ title: string;
426
+ onChange?: (e: React.ChangeEvent<HTMLSelectElement>) => void;
427
+ ariaControls?: string;
428
+ autoFocus?: boolean;
429
+ selectOptions: SelectOptionsProps[];
430
+ defaultValue: string;
431
+ hiddenLabel?: boolean;
432
+ }
414
433
 
415
434
  interface SearchCoursesProps {
416
435
  /**
@@ -804,6 +823,14 @@ interface PromoBlockProps$1 {
804
823
  * Optional title of the component
805
824
  */
806
825
  title?: string;
826
+ /**
827
+ * Optional titleTag of the component
828
+ */
829
+ titleTag?: 'h2' | 'h3';
830
+ /**
831
+ * Optional cardTitleTag of the component
832
+ */
833
+ cardTitleTag?: 'h2' | 'h3' | 'h4';
807
834
  /**
808
835
  * Optional description of the component
809
836
  */
@@ -824,8 +851,12 @@ interface PromoBlockProps$1 {
824
851
  * Only applies to the signpost card and if there is only one
825
852
  */
826
853
  imageOrientation: 'left' | 'right';
854
+ /**
855
+ * The copy prop of the card may need to be rendered as Rich Text
856
+ */
857
+ cardCopyIsRichText?: boolean;
827
858
  }
828
- declare function PromoBlock({ theme, inverse, type, title, description, link, cards, imageOrientation }: PromoBlockProps$1): ReactElement | null;
859
+ declare function PromoBlock({ theme, inverse, type, title, description, link, cards, imageOrientation, titleTag, cardTitleTag, cardCopyIsRichText }: PromoBlockProps$1): ReactElement | null;
829
860
 
830
861
  type IconType = 'person' | 'people' | 'computer' | 'book' | 'briefcase' | 'notepad';
831
862
  interface CourseDeliveryPillProps {
@@ -976,13 +1007,23 @@ interface ListingResultsProps {
976
1007
  }
977
1008
  declare function ListingResults({ theme, showCategory, cards, headingInfo }: ListingResultsProps): ReactElement;
978
1009
 
1010
+ type FilterAccordionSelectProps = {
1011
+ theme: ThemeProps;
1012
+ heading: string;
1013
+ selectContent: Omit<FormSelectProps, 'theme'>;
1014
+ /**
1015
+ * Whether the accordion is open or closed by default
1016
+ */
1017
+ defaultIsOpen?: boolean;
1018
+ };
1019
+
979
1020
  interface StandardListingFilterProps {
980
1021
  theme: ThemeProps;
981
1022
  heading: string;
982
1023
  listingGroups: ListingGroup[];
983
1024
  onClearFilters: () => void;
984
1025
  }
985
- type ListingGroup = DateProps | RadioProps | CheckboxProps;
1026
+ type ListingGroup = DateProps | RadioProps | CheckboxProps | SelectProps;
986
1027
  interface RadioProps {
987
1028
  type: 'radio';
988
1029
  heading: string;
@@ -1015,6 +1056,13 @@ interface DateProps {
1015
1056
  onChange?: (e: ChangeEvent) => void;
1016
1057
  defaultValue?: string;
1017
1058
  }
1059
+ interface SelectProps extends FilterAccordionSelectProps {
1060
+ type: 'select';
1061
+ onChange?: (e: ChangeEvent) => void;
1062
+ defaultValue?: string;
1063
+ name: string;
1064
+ id: string;
1065
+ }
1018
1066
  declare function StandardListingFilter({ theme, heading, listingGroups, onClearFilters }: StandardListingFilterProps): ReactElement;
1019
1067
 
1020
1068
  interface GeneralSearchFilterProps {