@nuskin/foundation-ui-components 1.32.0 → 1.32.1-cdb-1.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/foundation-ui-components",
3
- "version": "1.32.0",
3
+ "version": "1.32.1-cdb-1.2",
4
4
  "description": "It is a foundation library written in react, that provides common components to all UI pages",
5
5
  "main": "src/common/index.ts",
6
6
  "repository": {
@@ -51,7 +51,6 @@
51
51
  "@types/react-dom": "^18.2.0",
52
52
  "cliui": "^8.0.1",
53
53
  "framer-motion": "^10.16.4",
54
- "next": "13.5.6",
55
54
  "notistack": "^3.0.1",
56
55
  "react": "^18.2.0",
57
56
  "react-dom": "^18.2.0",
@@ -67,6 +66,7 @@
67
66
  "@babel/preset-react": "^7.22.15",
68
67
  "@babel/preset-typescript": "^7.23.2",
69
68
  "@emotion/jest": "^11.11.0",
69
+ "next": "13.5.6",
70
70
  "@nuskin/eslint-config": "^1.0.0-setup.1",
71
71
  "@storybook/addon-actions": "^7.5.1",
72
72
  "@storybook/addon-essentials": "^7.5.1",
@@ -1,4 +1,3 @@
1
- import { ValueOf } from 'next/dist/shared/lib/constants';
2
1
  import { NsColumnControlProps, sizeObjectType } from './types.d';
3
2
 
4
3
  export const columnClasses: NsColumnControlProps['columnClass'][] = [
@@ -25,6 +24,8 @@ const sizeKeyPrefix = {
25
24
  mobile: 'ns-col-sm-',
26
25
  } as const;
27
26
 
27
+ type ValueOf<T> = T[keyof T];
28
+
28
29
  const sizeKeyMap: Record<ValueOf<typeof sizeKeyPrefix>, string> = {
29
30
  [sizeKeyPrefix.desktop]: 'fractions',
30
31
  [sizeKeyPrefix.tablet]: 'tabletFractions',
@@ -1,3 +1 @@
1
- export { default as NsNextImage } from './NsNextImage';
2
- export type { NsImageProps, NsNextImageProps } from './types';
3
1
  export { default as NsImage } from './NsImage';
@@ -1,23 +1,5 @@
1
1
  /* eslint-disable no-unused-vars */
2
- import { ImageProps } from 'next/image';
3
-
4
- export type NsNextImageProps = Pick<
5
- ImageProps,
6
- | 'src'
7
- | 'height'
8
- | 'width'
9
- | 'alt'
10
- | 'priority'
11
- | 'sizes'
12
- | 'quality'
13
- | 'placeholder'
14
- | 'style'
15
- | 'loading'
16
- | 'blurDataURL'
17
- | 'fill'
18
- | 'unoptimized'
19
- | 'loader'
20
- > & { id?: string; className?: string };
2
+ import React from 'react';
21
3
 
22
4
  export type NsImageProps = {
23
5
  alt: string;
@@ -1,6 +1,5 @@
1
1
  import { styled } from '@nuskin/foundation-theme';
2
2
  import MUILink from '@mui/material/Link';
3
- import NextLink from 'next/link';
4
3
 
5
4
  type StyledProps = {
6
5
  disabled?: boolean;
@@ -47,11 +46,6 @@ const getLinkStyles = ({ disabled, $underlineOnHover = true }: StyledProps) => {
47
46
  return '';
48
47
  };
49
48
 
50
- export const StyledNextLink = styled(NextLink)<StyledProps>`
51
- ${linkDefaultStyles};
52
- ${getLinkStyles}
53
- `;
54
-
55
49
  export const StyledLink = styled(MUILink)<StyledProps>`
56
50
  ${linkDefaultStyles};
57
51
  ${getLinkStyles}
@@ -9,8 +9,7 @@ import React, {
9
9
  } from 'react';
10
10
 
11
11
  import {
12
- StyledLink,
13
- StyledNextLink,
12
+ StyledLink
14
13
  } from './NsLink.styled';
15
14
  import { NsLinkProps } from './types.d';
16
15
 
@@ -20,30 +19,11 @@ const NsLink = (props: PropsWithChildren<NsLinkProps>): ReactElement => {
20
19
  href,
21
20
  underlineOnHover,
22
21
  target,
23
- isSsr = false,
24
22
  additionalProps,
25
23
  children,
26
- passHref,
27
- prefetch,
28
24
  disabled,
29
25
  } = props;
30
26
 
31
- if (isSsr) {
32
- return (
33
- <StyledNextLink
34
- className={className}
35
- href={href}
36
- $underlineOnHover={underlineOnHover}
37
- passHref={passHref}
38
- prefetch={prefetch}
39
- disabled={disabled}
40
- {...additionalProps}
41
- >
42
- {children}
43
- </StyledNextLink>
44
- );
45
- }
46
-
47
27
  return (
48
28
  <StyledLink
49
29
  className={className}
@@ -1,10 +0,0 @@
1
- import { render, screen } from '@/test-utils/index';
2
- import NsNextImage from './NsNextImage';
3
- describe('NsNextImage', () => {
4
- it('test image element renders', () => {
5
- const altText = 'dummy image';
6
- render(<NsNextImage src="https://www.google.com" width="300" height="300" alt={altText} />);
7
- const imgElement = screen.getByAltText(altText);
8
- expect(imgElement).toBeInTheDocument();
9
- });
10
- });
@@ -1,51 +0,0 @@
1
- import { NsNextImage } from '.';
2
- import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
- import type { StoryObj, Meta } from '@storybook/react';
4
-
5
- type ComponentType = typeof NsNextImage;
6
- type Story = StoryObj<ComponentType>;
7
- type MetaStory = Meta<ComponentType>;
8
-
9
- export default {
10
- title: 'Components/Data Display/NsNextImage',
11
- component: NsNextImage,
12
- decorators: [withCenterDecorator],
13
- } as MetaStory;
14
-
15
- export const BrandImage: Story = {
16
- args: {
17
- src: 'https://media.nuskin.com/m/42911c8b05600476/webimage-brand-ageloc-optweb.png',
18
- width: 300,
19
- height: 300,
20
- unoptimized: true,
21
- },
22
- };
23
- export const NavigationImage: Story = {
24
- args: {
25
- src: 'https://www.nuskin.com/content/dam/global/library/aug2022/01130171-lumispa-io-norm-combo.jpg',
26
- width: 200,
27
- height: 200,
28
- alt: 'lumispa-combo',
29
- unoptimized: true,
30
- },
31
- };
32
-
33
- export const NavigationBannerImage: Story = {
34
- args: {
35
- src: 'https://www.nuskin.com/content/dam/global/library/feb2020/Navigation-images-Skin-Carev2.jpg',
36
- width: 340,
37
- height: 610,
38
- alt: 'lumispa-combo',
39
- unoptimized: true,
40
- },
41
- };
42
-
43
- export const AwardImage: Story = {
44
- args: {
45
- src: 'https://media.nuskin.com/m/5a9a99eccfde58c6/webimage-winner-global-makeup-awards-2022.png',
46
- width: 130,
47
- height: 130,
48
- alt: 'global-makeup-award',
49
- unoptimized: true,
50
- },
51
- };
@@ -1,11 +0,0 @@
1
- import { ReactElement } from 'react';
2
-
3
- import Image from 'next/image';
4
-
5
- import { NsNextImageProps } from './types';
6
-
7
- const NsNextImage = ({ src, width, height, alt, fill, priority, ...props }: NsNextImageProps): ReactElement => {
8
- return <Image src={src} width={width} height={height} alt={alt} fill={fill} priority={priority} {...props} />;
9
- };
10
-
11
- export default NsNextImage;