@nuskin/foundation-ui-components 1.8.1 → 1.9.1

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 (46) hide show
  1. package/package.json +1 -1
  2. package/src/common/accordion/NsAccordionHeader.tsx +2 -7
  3. package/src/common/accordion/NsCollapse.tsx +35 -42
  4. package/src/common/alert/NsAlert.tsx +7 -5
  5. package/src/common/auth-dropdown/NsAuthDropdown.styled.ts +1 -5
  6. package/src/common/autocomplete/helper/AutoCompleteButton.tsx +1 -1
  7. package/src/common/autocomplete/helper/renderGroupName.tsx +1 -1
  8. package/src/common/autocomplete/mock/MockUI.tsx +1 -1
  9. package/src/common/banner/NsBanner.stories.tsx +1 -1
  10. package/src/common/button/NsButton.styled.tsx +40 -45
  11. package/src/common/card/NsAwardCard.tsx +71 -0
  12. package/src/common/card/NsBgCard.tsx +2 -1
  13. package/src/common/card/NsLargeCard.tsx +14 -9
  14. package/src/common/card/NsMediumCard.tsx +21 -6
  15. package/src/common/card/NsPost.tsx +4 -7
  16. package/src/common/card/index.ts +1 -0
  17. package/src/common/card/stories/NsAwardCard.stories.tsx +26 -0
  18. package/src/common/card/stories/NsLargeCard.stories.tsx +5 -4
  19. package/src/common/card/stories/NsMediumCard.stories.tsx +7 -3
  20. package/src/common/card/stories/NsPost.stories.tsx +2 -2
  21. package/src/common/carousal/NsCarousal.tsx +6 -5
  22. package/src/common/carousal/NsScrollingCarousal.tsx +4 -8
  23. package/src/common/checkbox/NsCheckbox.tsx +1 -1
  24. package/src/common/column-control/NsColumnControl.tsx +6 -3
  25. package/src/common/column-control/styled/StyledFlex.tsx +5 -4
  26. package/src/common/column-control/styled/StyledGrid.tsx +2 -1
  27. package/src/common/icon/NsIcon.stories.tsx +42 -0
  28. package/src/common/icon/NsIcon.styled.tsx +5 -3
  29. package/src/common/icon/NsIcon.tsx +9 -1
  30. package/src/common/icon/types.d.ts +37 -0
  31. package/src/common/input/InputWrapper.tsx +3 -10
  32. package/src/common/link/NsLink.stories.tsx +2 -2
  33. package/src/common/link/NsLink.styled.tsx +2 -12
  34. package/src/common/link/NsLink.tsx +4 -7
  35. package/src/common/modal/helper-component/NsModalContentBox.tsx +1 -1
  36. package/src/common/modal/stories/mock.tsx +1 -1
  37. package/src/common/nav-product-card/NsNavProductCard.tsx +1 -1
  38. package/src/common/progress/NsProgress.tsx +1 -1
  39. package/src/common/radiogroup/NsRadioGroup.styled.tsx +6 -7
  40. package/src/common/text-strip/NsTextStrip.tsx +1 -1
  41. package/src/common/typography/HtmlTagVariantMap.tsx +24 -0
  42. package/src/common/typography/NsTypography.stories.tsx +1 -0
  43. package/src/common/typography/NsTypography.tsx +7 -2
  44. package/src/common/typography/Typography.styled.tsx +12 -10
  45. package/src/common/typography/types.d.ts +15 -8
  46. package/src/common/util.ts +3 -1
@@ -15,8 +15,8 @@ export default {
15
15
  decorators: [withCenterDecorator],
16
16
  } as MetaStory;
17
17
 
18
- const text = 'Heading';
19
- const body = 'Date';
18
+ const text = '38 New Beauty Products Our Editors Are Loving';
19
+ const body = 'SPA & BEAUTY TODAY';
20
20
  const host = 'https://media.nuskin.com/';
21
21
 
22
22
  export const Default: Story = {
@@ -1,11 +1,13 @@
1
1
  import Box from '@mui/material/Box';
2
2
  import { styled } from '@nuskin/foundation-theme';
3
- import { useRef, useCallback, ReactNode } from 'react';
3
+ import { ReactNode, useCallback, useRef } from 'react';
4
4
  import Slider from 'react-slick';
5
- import 'slick-carousel/slick/slick.css';
6
- import 'slick-carousel/slick/slick-theme.css';
7
- import defaultCarousalSettings from './slickSetting';
5
+
8
6
  import CarousalControl from './CarousalControl';
7
+ import defaultCarousalSettings from './slickSetting';
8
+
9
+ import 'slick-carousel/slick/slick-theme.css';
10
+ import 'slick-carousel/slick/slick.css';
9
11
 
10
12
  const SlickContainer = styled(Box)(() => {
11
13
  return {
@@ -18,7 +20,6 @@ const SlickContainer = styled(Box)(() => {
18
20
  });
19
21
  interface CarousalProps<T = any> {
20
22
  entries: T[];
21
- // eslint-disable-next-line no-unused-vars
22
23
  renderEntry(entry: T, index: number): ReactNode;
23
24
  allEntryLink: string;
24
25
  settings: any;
@@ -3,16 +3,11 @@ import Slider from 'react-slick';
3
3
  import { NsScrollingCarousalProps } from '../';
4
4
  import { styled } from '@nuskin/foundation-theme';
5
5
 
6
- const options = {
7
- shouldForwardProp: (prop: string) => prop !== 'dotsBottomPixel',
6
+ type StyledType = {
7
+ dotsBottomPixel?: number;
8
8
  };
9
9
 
10
- const StyledDiv = styled(
11
- 'div',
12
- options
13
- )<{
14
- dotsBottomPixel?: number;
15
- }>(({ dotsBottomPixel }) => {
10
+ const StyledDiv = styled('div')<StyledType>(({ dotsBottomPixel }) => {
16
11
  return {
17
12
  '.slick-dots': {
18
13
  zIndex: 9,
@@ -50,6 +45,7 @@ const NsScrollingCarousal = ({
50
45
  }, [stillSeconds, scrollSeconds, settings]);
51
46
  return (
52
47
  <StyledDiv
48
+ className="scrolling-carousal-wrapper"
53
49
  dotsBottomPixel={dotsBottomPixel}
54
50
  data-testid={additionalProps?.testid ?? 'scrolling-carousal-test-id'}
55
51
  >
@@ -52,7 +52,7 @@ const NsCheckbox = (props: PropsWithChildren<NsCheckboxProps>) => {
52
52
 
53
53
  const renderCheckboxLabel = useCallback(
54
54
  () => (
55
- <NsTypography variant="p-l">
55
+ <NsTypography variant="body-l">
56
56
  <StyledFlagLabel {...flag} size={size} testId={`${name}-flag-label`} />
57
57
  <StyledLabel className="checkbox-label-text" isDisabled={disabled}>
58
58
  {label}
@@ -3,14 +3,17 @@ import { Box } from '@mui/material';
3
3
  import { styled } from '@nuskin/foundation-theme';
4
4
  import { NsColumnControlProps, sizeObjectType } from './types.d';
5
5
  import { getColumnSizes } from './utils';
6
+ import { shouldNotForwardPropsWithKeys } from '../util';
6
7
 
7
- const options = {
8
- shouldForwardProp: (propKey: string) => propKey !== 'sizes',
9
- };
10
8
  type StyledDivProps = {
11
9
  sizes: sizeObjectType;
12
10
  gap?: number;
13
11
  };
12
+
13
+ const options = {
14
+ shouldForwardProp: shouldNotForwardPropsWithKeys<StyledDivProps>(['sizes']),
15
+ };
16
+
14
17
  const descMaxWidthBreakpoints = [960, 600];
15
18
 
16
19
  /* media queries */
@@ -2,10 +2,7 @@ import { Box } from '@mui/material';
2
2
  import { styled } from '@nuskin/foundation-theme';
3
3
  import { sizeObjectType } from '../types';
4
4
  import { commonStyles, getPercentArray } from './common';
5
-
6
- const options = {
7
- shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
8
- };
5
+ import { shouldNotForwardPropsWithKeys } from '../../../common/util';
9
6
 
10
7
  type StyledFlexProps = {
11
8
  sizes: sizeObjectType;
@@ -13,6 +10,10 @@ type StyledFlexProps = {
13
10
  isFullWidth: boolean;
14
11
  };
15
12
 
13
+ const options = {
14
+ shouldForwardProp: shouldNotForwardPropsWithKeys<StyledFlexProps>(['sizes']),
15
+ };
16
+
16
17
  /* main wrapper for column control using css flex */
17
18
  export const StyledFlex = styled(
18
19
  Box as any,
@@ -2,6 +2,7 @@ import { Box } from '@mui/material';
2
2
  import { styled } from '@nuskin/foundation-theme';
3
3
  import { sizeObjectType } from '../types';
4
4
  import { commonStyles, getPercentArray } from './common';
5
+ import { shouldNotForwardPropsWithKeys } from '../../../common/util';
5
6
 
6
7
  type StyledGridProps = {
7
8
  sizes: sizeObjectType;
@@ -9,7 +10,7 @@ type StyledGridProps = {
9
10
  isFullWidth: boolean;
10
11
  };
11
12
  const options = {
12
- shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
13
+ shouldForwardProp: shouldNotForwardPropsWithKeys<StyledGridProps>(['sizes']),
13
14
  };
14
15
 
15
16
  /* main wrapper for column control using css grid */
@@ -1,4 +1,5 @@
1
1
  import { PaletteColors } from '@nuskin/foundation-theme';
2
+
2
3
  import type { StoryObj, Meta } from '@storybook/react';
3
4
  import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
4
5
  import { NsIcon, NsIconVariants } from './';
@@ -24,6 +25,47 @@ export default {
24
25
  colorOverride: {
25
26
  control: 'color',
26
27
  },
28
+ cursor: {
29
+ control: 'select',
30
+ options: [
31
+ 'auto',
32
+ 'default',
33
+ 'none',
34
+ 'context-menu',
35
+ 'help',
36
+ 'pointer',
37
+ 'progress',
38
+ 'wait',
39
+ 'cell',
40
+ 'crosshair',
41
+ 'text',
42
+ 'vertical-text',
43
+ 'alias',
44
+ 'copy',
45
+ 'move',
46
+ 'no-drop',
47
+ 'not-allowed',
48
+ 'grab',
49
+ 'grabbing',
50
+ 'e-resize',
51
+ 'n-resize',
52
+ 'ne-resize',
53
+ 'nw-resize',
54
+ 's-resize',
55
+ 'se-resize',
56
+ 'sw-resize',
57
+ 'w-resize',
58
+ 'ew-resize',
59
+ 'ns-resize',
60
+ 'nesw-resize',
61
+ 'nwse-resize',
62
+ 'col-resize',
63
+ 'row-resize',
64
+ 'all-scroll',
65
+ 'zoom-in',
66
+ 'zoom-out',
67
+ ],
68
+ },
27
69
  },
28
70
  args: {
29
71
  size: 'large',
@@ -1,5 +1,6 @@
1
1
  import { styled } from '@nuskin/foundation-theme';
2
- import { NsIconSizeType } from './types.d';
2
+
3
+ import { NsIconProps, NsIconSizeType } from './types.d';
3
4
 
4
5
  export const iconSize: Record<NsIconSizeType, string> = {
5
6
  small: '16px',
@@ -7,13 +8,14 @@ export const iconSize: Record<NsIconSizeType, string> = {
7
8
  large: '24px',
8
9
  xLarge: '30px',
9
10
  };
10
- type IconWrapperType = { size: NsIconSizeType };
11
+ type IconWrapperType = { size: NsIconSizeType; cursor: NsIconProps['cursor'] };
11
12
 
12
- export const IconWrapper = styled('div')<IconWrapperType>(({ size }) => {
13
+ export const IconWrapper = styled('div')<IconWrapperType>(({ size, cursor }) => {
13
14
  return {
14
15
  display: 'flex',
15
16
  placeContent: 'center',
16
17
  placeItems: 'center',
18
+ cursor,
17
19
  svg: {
18
20
  width: iconSize[size],
19
21
  height: iconSize[size],
@@ -15,6 +15,7 @@ const NsIcon = ({
15
15
  className,
16
16
  colorOverride,
17
17
  onClick = () => {},
18
+ cursor = 'pointer',
18
19
  ...rest
19
20
  }: NsIconProps) => {
20
21
  const Icon = IconVariants[name as NsIconNameType];
@@ -25,7 +26,14 @@ const NsIcon = ({
25
26
  }
26
27
 
27
28
  return (
28
- <IconWrapper {...rest} data-testid={testId} size={size || 'large'} className={className} onClick={onClick}>
29
+ <IconWrapper
30
+ {...rest}
31
+ data-testid={testId}
32
+ size={size || 'large'}
33
+ className={className}
34
+ onClick={onClick}
35
+ cursor={cursor}
36
+ >
29
37
  <Icon color={colorOverride ? colorOverride : (iconColor as any)} />
30
38
  </IconWrapper>
31
39
  );
@@ -13,4 +13,41 @@ export type NsIconProps = HTMLProps & {
13
13
  color?: FoundationTheme.PaletteColors;
14
14
  testId?: string;
15
15
  colorOverride?: string;
16
+ cursor?:
17
+ | 'auto'
18
+ | 'default'
19
+ | 'none'
20
+ | 'context-menu'
21
+ | 'help'
22
+ | 'pointer'
23
+ | 'progress'
24
+ | 'wait'
25
+ | 'cell'
26
+ | 'crosshair'
27
+ | 'text'
28
+ | 'vertical-text'
29
+ | 'alias'
30
+ | 'copy'
31
+ | 'move'
32
+ | 'no-drop'
33
+ | 'not-allowed'
34
+ | 'grab'
35
+ | 'grabbing'
36
+ | 'e-resize'
37
+ | 'n-resize'
38
+ | 'ne-resize'
39
+ | 'nw-resize'
40
+ | 's-resize'
41
+ | 'se-resize'
42
+ | 'sw-resize'
43
+ | 'w-resize'
44
+ | 'ew-resize'
45
+ | 'ns-resize'
46
+ | 'nesw-resize'
47
+ | 'nwse-resize'
48
+ | 'col-resize'
49
+ | 'row-resize'
50
+ | 'all-scroll'
51
+ | 'zoom-in'
52
+ | 'zoom-out';
16
53
  };
@@ -5,8 +5,8 @@ import { fieldStateType } from './types.d';
5
5
  const { isDarkMode } = ColorUtils;
6
6
  const { colors } = nuskinTheme;
7
7
 
8
- const options = {
9
- shouldForwardProp: (propKey: string) => propKey !== 'fieldState',
8
+ type InputWrapperType = {
9
+ fieldState: fieldStateType;
10
10
  };
11
11
 
12
12
  const getInputBorderColor = (
@@ -23,14 +23,7 @@ const getInputBorderColor = (
23
23
  }
24
24
  };
25
25
 
26
- type InputWrapperType = {
27
- fieldState: fieldStateType;
28
- };
29
-
30
- const InputWrapper = styled(
31
- Box,
32
- options
33
- )<InputWrapperType>(({ theme, fieldState }) => {
26
+ const InputWrapper = styled(Box)<InputWrapperType>(({ theme, fieldState }) => {
34
27
  /* default value added so that unit tests do not fail */
35
28
  const { palette = { primary: { main: '', contrastText: '' } } } = theme;
36
29
  const isLight = isDarkMode({ theme });
@@ -36,7 +36,7 @@ export default {
36
36
 
37
37
  export const Links: Story = {
38
38
  render: (args: any) => (
39
- <NsTypography variant="sub-h-l">
39
+ <NsTypography variant="title-l">
40
40
  <NsLink {...args} href={args.href} />
41
41
  </NsTypography>
42
42
  ),
@@ -45,7 +45,7 @@ export const Links: Story = {
45
45
  export const ReactComponentLink: Story = {
46
46
  render: (args: any) => (
47
47
  <NsLink {...args} href={args.href} passHref>
48
- <NsTypography variant="sub-h-l">Test Link</NsTypography>
48
+ <NsTypography variant="title-l">Test Link</NsTypography>
49
49
  </NsLink>
50
50
  ),
51
51
  };
@@ -1,14 +1,7 @@
1
- /**
2
- * @author [Vijayaprathap Kumar] (vpkumar@nuskin.com)
3
- * NsLink.styled.tsx
4
- * @description Styled Components for NsLink are defined here
5
- */
6
-
7
1
  import { styled } from '@nuskin/foundation-theme';
8
2
  import MUILink from '@mui/material/Link';
9
3
  import NextLink from 'next/link';
10
4
 
11
- /** Prop Types doe Styled components */
12
5
  type StyledProps = {
13
6
  disabled?: boolean;
14
7
  $underlineOnHover?: boolean;
@@ -53,16 +46,13 @@ const getLinkStyles = ({ disabled, $underlineOnHover = true }: StyledProps) => {
53
46
  }
54
47
  return '';
55
48
  };
56
- const options = {
57
- shouldForwardProp: (propKey: string) => propKey !== '$underlineOnHover',
58
- };
59
49
 
60
- export const StyledNextLink = styled(NextLink, options)<StyledProps>`
50
+ export const StyledNextLink = styled(NextLink)<StyledProps>`
61
51
  ${linkDefaultStyles};
62
52
  ${getLinkStyles}
63
53
  `;
64
54
 
65
- export const StyledLink = styled(MUILink, options)<StyledProps>`
55
+ export const StyledLink = styled(MUILink)<StyledProps>`
66
56
  ${linkDefaultStyles};
67
57
  ${getLinkStyles}
68
58
  `;
@@ -8,12 +8,6 @@ import React, { PropsWithChildren } from 'react';
8
8
  import { StyledLink, StyledNextLink } from './NsLink.styled';
9
9
  import { NsLinkProps } from './types.d';
10
10
 
11
- /**
12
- * @component NsLink
13
- *
14
- * Component for displaying an Link tag
15
- *
16
- */
17
11
  const NsLink = (props: PropsWithChildren<NsLinkProps>) => {
18
12
  const {
19
13
  className,
@@ -25,6 +19,7 @@ const NsLink = (props: PropsWithChildren<NsLinkProps>) => {
25
19
  children,
26
20
  passHref,
27
21
  prefetch,
22
+ disabled,
28
23
  } = props;
29
24
 
30
25
  if (isSsr) {
@@ -33,9 +28,10 @@ const NsLink = (props: PropsWithChildren<NsLinkProps>) => {
33
28
  className={className}
34
29
  href={href}
35
30
  $underlineOnHover={underlineOnHover}
36
- {...additionalProps}
37
31
  passHref={passHref}
38
32
  prefetch={prefetch}
33
+ disabled={disabled}
34
+ {...additionalProps}
39
35
  >
40
36
  {children}
41
37
  </StyledNextLink>
@@ -46,6 +42,7 @@ const NsLink = (props: PropsWithChildren<NsLinkProps>) => {
46
42
  <StyledLink
47
43
  className={className}
48
44
  href={href}
45
+ disabled={disabled}
49
46
  $underlineOnHover={underlineOnHover}
50
47
  target={target}
51
48
  {...additionalProps}
@@ -23,7 +23,7 @@ const NsModalContentBox = ({ handleClose, statusInfo }: NsModalComponentProps) =
23
23
  <div>
24
24
  <NsModalTitle header={header} handleClose={handleClose} />
25
25
  <DialogContent>
26
- <NsTypography variant="p-xs">{description}</NsTypography>
26
+ <NsTypography variant="body-xs">{description}</NsTypography>
27
27
  </DialogContent>
28
28
  </div>
29
29
  );
@@ -18,7 +18,7 @@ export const NsModalData = {
18
18
  body: {
19
19
  show: true,
20
20
  children: (
21
- <NsTypography variant="p-s">
21
+ <NsTypography variant="body-s">
22
22
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquet sed odio donec tellus nibh dictum quis.
23
23
  Dis tempus aliquam tristique auctor justo, lacus in pellentesque. Quam semper facilisi posuere hendrerit
24
24
  scelerisque sed.
@@ -18,7 +18,7 @@ export const NsNavProductCard = ({
18
18
  <NsTypography variant="h5" color="primary" className="mt-11 mb-3.5 underline-hover" weight="bold">
19
19
  {productName}
20
20
  </NsTypography>
21
- <NsTypography variant="p-s" color="primary" weight="light">
21
+ <NsTypography variant="body-s" color="primary" weight="light">
22
22
  {productDescription}
23
23
  </NsTypography>
24
24
  </div>
@@ -7,7 +7,7 @@ const NsProgress = (props: NsProgressProps) => {
7
7
  const { barColor, backgroundColor, height, value, body } = props;
8
8
  return (
9
9
  <StyledProgress className="ns-progress">
10
- <ProgressInfo variant="p-xs" className="progress-info">
10
+ <ProgressInfo variant="body-xs" className="progress-info">
11
11
  {value}
12
12
  <span>{body ?? ' % Complete'}</span>
13
13
  </ProgressInfo>
@@ -1,6 +1,5 @@
1
1
  import { Radio, FormControlLabel, FormLabel, RadioGroup } from '@mui/material';
2
2
  import { ColorUtils, FoundationTheme, styled } from '@nuskin/foundation-theme';
3
- import { skipDarkModeEnabled } from '../util';
4
3
 
5
4
  const { paletteColor, isDarkMode, color } = ColorUtils;
6
5
 
@@ -36,13 +35,13 @@ export const StyledFormControlLabel = styled(FormControlLabel)<{ darkModeEnabled
36
35
  },
37
36
  };
38
37
  });
39
- const options = {
40
- shouldForwardProp: skipDarkModeEnabled,
38
+
39
+ type StyledRadioPropsType = {
40
+ color: FoundationTheme.PaletteColors;
41
+ darkModeEnabled?: boolean;
41
42
  };
42
- export const StyledRadioGroup = styled(
43
- RadioGroup,
44
- options
45
- )<{ color: FoundationTheme.PaletteColors; darkModeEnabled?: boolean }>(({ theme, color, darkModeEnabled }) => {
43
+
44
+ export const StyledRadioGroup = styled(RadioGroup)<StyledRadioPropsType>(({ theme, color, darkModeEnabled }) => {
46
45
  return {
47
46
  marginTop: '10px',
48
47
  '.MuiRadio-root.custom-radio.Mui-checked': {
@@ -36,7 +36,7 @@ const NsTextStrip = (props: NsTextStripProps) => {
36
36
  <NsTypography variant="h5" weight="bold">
37
37
  {text}
38
38
  </NsTypography>
39
- <NsTypography variant="p-xs">
39
+ <NsTypography variant="body-xs">
40
40
  {description}&nbsp;
41
41
  {link?.href ? <NsLink href={link.href}>{link.title}</NsLink> : ''}
42
42
  </NsTypography>
@@ -0,0 +1,24 @@
1
+ import { HtmlTagVariant } from './types';
2
+
3
+ const HtmlTagVariantMapping: Record<string, HtmlTagVariant> = {
4
+ h1: 'h1',
5
+ h2: 'h2',
6
+ h3: 'h3',
7
+ h4: 'h4',
8
+ h5: 'h5',
9
+ h6: 'h6',
10
+ CTA: 'span',
11
+ 'title-l': 'h3',
12
+ 'title-m': 'h5',
13
+ 'title-s': 'h6',
14
+ 'label-l': 'label',
15
+ 'label-m': 'label',
16
+ 'label-s': 'label',
17
+ 'body-xl': 'p',
18
+ 'body-l': 'p',
19
+ 'body-m': 'p',
20
+ 'body-s': 'p',
21
+ 'body-xs': 'p',
22
+ };
23
+
24
+ export default HtmlTagVariantMapping;
@@ -20,6 +20,7 @@ export default {
20
20
  args: {
21
21
  children: 'NsTypography',
22
22
  color: 'primary',
23
+ renderHTMLNode:true
23
24
  },
24
25
  } as MetaStory;
25
26
 
@@ -1,20 +1,25 @@
1
1
  import React, { PropsWithChildren } from 'react';
2
- import { NsTypographyProps } from './types.d';
2
+ import { HtmlTagVariant, NsTypographyProps } from './types.d';
3
3
  import { StyledTypography } from './Typography.styled';
4
+ import HtmlTagVariantMapping from './HtmlTagVariantMap';
4
5
 
5
6
  const NsTypography = ({
6
7
  children,
7
8
  fontStyle = 'normal',
8
9
  weight = 'normal',
9
10
  className = '',
10
- variant = 'p-l',
11
+ variant = 'body-l',
11
12
  decoration = 'none',
12
13
  color = 'primary',
13
14
  additionalProps = {},
14
15
  colorOverride = '',
16
+ renderHTMLNode,
15
17
  }: PropsWithChildren<NsTypographyProps>) => {
18
+ const htmlTagVariant: HtmlTagVariant | undefined = renderHTMLNode ? HtmlTagVariantMapping[variant] : undefined;
19
+
16
20
  return (
17
21
  <StyledTypography
22
+ as={htmlTagVariant}
18
23
  fontStyle={fontStyle}
19
24
  className={className}
20
25
  weight={weight}
@@ -10,14 +10,17 @@ const variantStyles = {
10
10
  h4: 'font-size: 18px; line-height: 26px',
11
11
  h5: 'font-size: 16px; line-height: 22px',
12
12
  h6: 'font-size: 14px; line-height: 20px',
13
- 'sub-h-l': 'font-size: 18px; line-height: 22px; text-transform: uppercase; letter-spacing: 0.05em;',
14
- 'sub-h-m': 'font-size: 16px; line-height: 20px; text-transform: uppercase; letter-spacing: 0.05em;',
15
- 'sub-h-s': 'font-size: 14px; line-height: 18px; text-transform: uppercase; letter-spacing: 0.05em;',
16
- 'p-l': 'font-size: 18px; line-height: 24px',
17
- 'p-m': 'font-size: 16px; line-height: 22px',
18
- 'p-s': 'font-size: 14px; line-height: 20px',
19
- 'p-xs': 'font-size: 12px; line-height: 16px',
20
- 'p-xxs': 'font-size: 11px; line-height: 14px',
13
+ 'title-l': 'font-size: 22px; line-height: 28px; font-weight:bold',
14
+ 'title-m': 'font-size: 16px; line-height: 20px; font-weight:bold',
15
+ 'title-s': 'font-size: 16px; line-height: 16px; font-weight:bold',
16
+ 'label-l': 'font-size: 20px; line-height: 26px; font-weight:600',
17
+ 'label-m': 'font-size: 16px; line-height: 22px; font-weight:600',
18
+ 'label-s': 'font-size: 14px; line-height: 20px; font-weight:700',
19
+ 'body-xl': 'font-size: 18px; line-height: 22px',
20
+ 'body-l': 'font-size: 16px; line-height: 22px',
21
+ 'body-m': 'font-size: 14px; line-height: 20px',
22
+ 'body-s': 'font-size: 12px; line-height: 16px',
23
+ 'body-xs': 'font-size: 10px; line-height: 15px',
21
24
  CTA: 'font-size: 11px; line-height: 16px',
22
25
  };
23
26
 
@@ -29,8 +32,7 @@ const fontWeightMap = {
29
32
 
30
33
  export const StyledTypography = styled.div<NsTypographyProps>`
31
34
  font-family: Inter;
32
- color: ${({ color, colorOverride }) =>
33
- colorOverride?.startsWith('#') ? colorOverride : paletteColor(color)};
35
+ color: ${({ color, colorOverride }) => (colorOverride?.startsWith('#') ? colorOverride : paletteColor(color))};
34
36
  font-weight: ${({ weight = 'normal' }) => fontWeightMap[weight]};
35
37
  font-style: ${({ fontStyle }) => fontStyle};
36
38
  ${({ variant = 'h1' }) => variantStyles[variant]};
@@ -8,16 +8,21 @@ export type Variants =
8
8
  | 'h4'
9
9
  | 'h5'
10
10
  | 'h6'
11
- | 'sub-h-l'
12
- | 'sub-h-m'
13
- | 'sub-h-s'
14
- | 'p-l'
15
- | 'p-m'
16
- | 'p-s'
17
- | 'p-xs'
18
- | 'p-xxs'
11
+ | 'title-l'
12
+ | 'title-m'
13
+ | 'title-s'
14
+ | 'label-l'
15
+ | 'label-m'
16
+ | 'label-s'
17
+ | 'body-xl'
18
+ | 'body-l'
19
+ | 'body-m'
20
+ | 'body-s'
21
+ | 'body-xs'
19
22
  | 'CTA';
20
23
 
24
+ export type HtmlTagVariant = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'p' | 'label';
25
+
21
26
  export type NsTypographyProps = {
22
27
  variant: Variants;
23
28
  decoration?: 'underline' | 'none';
@@ -25,6 +30,8 @@ export type NsTypographyProps = {
25
30
  weight?: 'bold' | 'normal' | 'light';
26
31
  color?: FoundationTheme.PaletteColors;
27
32
  component?: 'div' | 'span' | 'p';
33
+ as?: HtmlTagVariant;
28
34
  className?: string;
29
35
  colorOverride?: string;
36
+ renderHTMLNode?: boolean;
30
37
  } & AdditionalProps;
@@ -1 +1,3 @@
1
- export const skipDarkModeEnabled = (key: string) => key !== 'darkModeEnabled';
1
+ export function shouldNotForwardPropsWithKeys<T>(propArray: Array<keyof T>) {
2
+ return (propName: string) => !propArray.includes(propName as keyof T);
3
+ }