@nuskin/foundation-ui-components 1.0.0-develop.1 → 1.0.0-develop.3

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 (147) hide show
  1. package/package.json +1 -1
  2. package/src/common/alert/NsAlert.spec.tsx +17 -16
  3. package/src/common/alert/NsAlert.stories.tsx +15 -14
  4. package/src/common/alert/NsAlert.styled.ts +20 -20
  5. package/src/common/alert/NsAlert.tsx +21 -40
  6. package/src/common/alert/index.ts +2 -2
  7. package/src/common/auth-dropdown/NsAuthDropdown.spec.tsx +1 -1
  8. package/src/common/auth-dropdown/NsAuthDropdown.stories.tsx +1 -1
  9. package/src/common/auth-dropdown/NsAuthDropdown.tsx +1 -1
  10. package/src/common/auth-dropdown/index.ts +1 -1
  11. package/src/common/autocomplete/NsAutocomplete.spec.tsx +5 -5
  12. package/src/common/autocomplete/NsAutocomplete.stories.tsx +2 -2
  13. package/src/common/autocomplete/NsAutocomplete.tsx +1 -1
  14. package/src/common/autocomplete/index.ts +2 -1
  15. package/src/common/banner/NsBanner.spec.tsx +1 -1
  16. package/src/common/banner/NsBanner.stories.tsx +1 -1
  17. package/src/common/banner/NsBanner.styled.tsx +1 -1
  18. package/src/common/banner/NsBanner.tsx +1 -1
  19. package/src/common/banner/index.ts +1 -1
  20. package/src/common/brand-components/NsBrand.stories.tsx +1 -1
  21. package/src/common/brand-components/NsBrandComponent.tsx +1 -1
  22. package/src/common/brand-components/index.ts +1 -1
  23. package/src/common/breadcrumb/NsBreadcrumb.spec.tsx +1 -7
  24. package/src/common/breadcrumb/NsBreadcrumb.stories.tsx +2 -4
  25. package/src/common/breadcrumb/NsBreadcrumb.tsx +1 -1
  26. package/src/common/breadcrumb/data.ts +7 -0
  27. package/src/common/breadcrumb/index.ts +1 -1
  28. package/src/common/button/NsButton.spec.tsx +1 -1
  29. package/src/common/button/NsButton.stories.tsx +1 -1
  30. package/src/common/button/NsButton.styled.tsx +10 -13
  31. package/src/common/button/NsButton.tsx +1 -1
  32. package/src/common/button/index.ts +1 -1
  33. package/src/common/card/NsFfgCard.tsx +1 -1
  34. package/src/common/card/stories/NsBgCard.stories.tsx +1 -3
  35. package/src/common/card/stories/NsBrandProductCard.stories.tsx +1 -1
  36. package/src/common/card/stories/NsFfgCard.stories.tsx +1 -1
  37. package/src/common/card/stories/{data.js → data.ts} +1 -25
  38. package/src/common/carousal/NsScrollingCarousal.tsx +61 -0
  39. package/src/common/carousal/index.ts +3 -0
  40. package/src/common/carousal/stories/NSCarousal.stories.tsx +1 -1
  41. package/src/common/carousal/stories/NsScrollingCarousal.stories.tsx +52 -0
  42. package/src/common/carousal/tests/NsCarousal.spec.tsx +2 -2
  43. package/src/common/carousal/tests/NsScrollingCarousal.spec.tsx +61 -0
  44. package/src/common/carousal/types.d.ts +23 -0
  45. package/src/common/cart-icon/NsCartIcon.spec.tsx +1 -1
  46. package/src/common/cart-icon/NsCartIcon.stories.tsx +1 -1
  47. package/src/common/cart-icon/NsCartIcon.tsx +1 -1
  48. package/src/common/cart-icon/index.ts +1 -1
  49. package/src/common/checkbox/NsCheckbox.spec.tsx +2 -2
  50. package/src/common/checkbox/NsCheckbox.stories.tsx +1 -1
  51. package/src/common/checkbox/NsCheckbox.tsx +1 -1
  52. package/src/common/checkbox/index.ts +1 -1
  53. package/src/common/checkbox/types.d.ts +1 -7
  54. package/src/common/column-control/NsColumnControl.tsx +1 -1
  55. package/src/common/column-control/NsFlexColumns.tsx +22 -0
  56. package/src/common/column-control/NsGridColumns.tsx +22 -0
  57. package/src/common/column-control/index.ts +3 -1
  58. package/src/common/column-control/{NsColumnControl.spec.tsx → specs/NsColumnControl.spec.tsx} +3 -3
  59. package/src/common/column-control/specs/NsFlexColumns.spec.tsx +24 -0
  60. package/src/common/column-control/specs/NsGridColumns.spec.tsx +24 -0
  61. package/src/common/column-control/stories/DivArray.stories.tsx +18 -0
  62. package/src/common/column-control/stories/DivArray.tsx +63 -0
  63. package/src/common/column-control/{NsColumnControl.stories.tsx → stories/NsColumnControl.stories.tsx} +9 -16
  64. package/src/common/column-control/stories/NsFlexColumns.stories.tsx +63 -0
  65. package/src/common/column-control/stories/NsGridColumns.stories.tsx +63 -0
  66. package/src/common/column-control/stories/common.tsx +14 -0
  67. package/src/common/column-control/styled/StyledFlex.tsx +45 -0
  68. package/src/common/column-control/styled/StyledGrid.tsx +40 -0
  69. package/src/common/column-control/styled/common.ts +27 -0
  70. package/src/common/column-control/types.d.ts +15 -16
  71. package/src/common/column-control/utils.ts +1 -1
  72. package/src/common/dropdown/NsDropdown.spec.tsx +1 -1
  73. package/src/common/dropdown/NsDropdown.tsx +1 -1
  74. package/src/common/dropdown/NsDropdownOption.tsx +1 -1
  75. package/src/common/dropdown/index.ts +1 -1
  76. package/src/common/dropdown/stories/NsDropdown.stories.tsx +1 -1
  77. package/src/common/dropdown/stories/NsDropdownCountry.stories.tsx +1 -1
  78. package/src/common/flag/NsFlag.spec.tsx +1 -1
  79. package/src/common/flag/NsFlag.stories.tsx +1 -1
  80. package/src/common/flag/NsFlag.styled.tsx +3 -5
  81. package/src/common/flag/NsFlag.tsx +1 -1
  82. package/src/common/flag/index.ts +1 -1
  83. package/src/common/flag/types.d.ts +0 -2
  84. package/src/common/icon/NsIcon.spec.tsx +1 -1
  85. package/src/common/icon/NsIcon.stories.tsx +1 -1
  86. package/src/common/icon/NsIcon.styled.tsx +1 -1
  87. package/src/common/icon/NsIcon.tsx +1 -1
  88. package/src/common/icon/NsIconVariants.ts +8 -4
  89. package/src/common/icon/icons/AlertErrorIcon.tsx +15 -6
  90. package/src/common/icon/icons/HamburgerIcon.tsx +29 -0
  91. package/src/common/icon/icons/UserIcon.tsx +30 -0
  92. package/src/common/icon/icons/WarningIcon.tsx +14 -5
  93. package/src/common/icon/index.ts +1 -1
  94. package/src/common/image/NsImage.spec.tsx +1 -1
  95. package/src/common/image/NsImage.stories.tsx +1 -1
  96. package/src/common/image/NsImage.tsx +1 -1
  97. package/src/common/image/NsNextImage.spec.tsx +1 -1
  98. package/src/common/image/NsNextImage.stories.tsx +1 -1
  99. package/src/common/image/NsNextImage.tsx +1 -1
  100. package/src/common/image/index.ts +1 -1
  101. package/src/common/index.ts +7 -10
  102. package/src/common/input/InputWrapper.tsx +1 -1
  103. package/src/common/input/NsInputField.stories.tsx +2 -1
  104. package/src/common/input/NsInputField.tsx +1 -1
  105. package/src/common/input/getAdornmentProps.tsx +1 -1
  106. package/src/common/input/index.ts +1 -1
  107. package/src/common/input/types.d.ts +15 -0
  108. package/src/common/label/NsLabel.stories.tsx +2 -0
  109. package/src/common/label/NsLabel.tsx +4 -4
  110. package/src/common/label/index.ts +1 -1
  111. package/src/common/link/NsLink.spec.tsx +1 -1
  112. package/src/common/link/NsLink.stories.tsx +1 -1
  113. package/src/common/link/NsLink.tsx +1 -1
  114. package/src/common/link/index.ts +1 -1
  115. package/src/common/nav-product-card/NsNavProductCard.spec.tsx +1 -1
  116. package/src/common/nav-product-card/NsNavProductCard.stories.tsx +1 -1
  117. package/src/common/nav-product-card/NsNavProductCard.tsx +1 -1
  118. package/src/common/nav-product-card/index.ts +1 -1
  119. package/src/common/nav-tab/NsNavTab.spec.tsx +2 -2
  120. package/src/common/nav-tab/NsNavTab.stories.tsx +1 -1
  121. package/src/common/nav-tab/NsNavTab.tsx +1 -1
  122. package/src/common/nav-tab/index.ts +1 -1
  123. package/src/common/search-bar/NsSeachBar.spec.tsx +1 -1
  124. package/src/common/table/NsTable.spec.tsx +146 -0
  125. package/src/common/table/NsTable.stories.tsx +123 -0
  126. package/src/common/table/NsTable.styled.ts +33 -0
  127. package/src/common/table/NsTable.tsx +161 -0
  128. package/src/common/table/NsTableHeader.tsx +48 -0
  129. package/src/common/table/NsTablePagination.tsx +20 -0
  130. package/src/common/table/helper.ts +33 -0
  131. package/src/common/table/index.ts +2 -0
  132. package/src/common/table/types.d.ts +44 -0
  133. package/src/common/text-strip/NsTextStrip.spec.tsx +30 -0
  134. package/src/common/text-strip/NsTextStrip.stories.tsx +33 -0
  135. package/src/common/text-strip/NsTextStrip.tsx +44 -0
  136. package/src/common/text-strip/index.ts +2 -0
  137. package/src/common/text-strip/types.d.ts +17 -0
  138. package/src/common/typography/NsTypography.stories.tsx +1 -1
  139. package/src/common/typography/NsTypography.tsx +1 -1
  140. package/src/common/typography/Typography.styled.tsx +1 -1
  141. package/src/common/typography/index.ts +1 -1
  142. package/src/common/videos/NsVideo.stories.tsx +1 -1
  143. package/src/common/videos/NsVideo.tsx +1 -1
  144. package/src/common/videos/index.ts +1 -1
  145. package/src/common/column-control/NDivs.story.tsx +0 -35
  146. /package/src/common/autocomplete/{types.ts → types.d.ts} +0 -0
  147. /package/src/common/{common.types.ts → common.types.d.ts} +0 -0
@@ -0,0 +1,63 @@
1
+ import { PropsWithChildren } from 'react';
2
+
3
+ type DivArrayProps = {
4
+ elementsCount: number;
5
+ };
6
+
7
+ const getRandom = (n: number) => (Math.random() * n).toFixed(0);
8
+
9
+ type DivComponentProps = PropsWithChildren<{ style: Record<string, any>; index: number }>;
10
+ export const DivComponent = ({ style, index, children }: DivComponentProps) => {
11
+ const borderWidth = `${getRandom(5)}px`;
12
+ const padding = `${getRandom(20)}px`;
13
+ return (
14
+ <div
15
+ style={{
16
+ padding,
17
+ border: `${borderWidth} solid`,
18
+ borderColor: `hsl(${getRandom(359)},100%, 50%)`,
19
+ background: `hsla(${getRandom(359)},100%, 50%,0.3)`,
20
+ ...style,
21
+ }}
22
+ >
23
+ {index}
24
+ {children}
25
+ </div>
26
+ );
27
+ };
28
+ /**
29
+ * this component return a fragment containing n number of div, with each div numbered as per its index
30
+ * @param n: number of div to render
31
+ * @returns
32
+ */
33
+ export const DivArray = ({ elementsCount }: DivArrayProps) => (
34
+ <>
35
+ {Array(elementsCount)
36
+ .fill(0)
37
+ .map((_, index) => (
38
+ <DivComponent key={index} index={index + 1} style={{}} />
39
+ ))}
40
+ </>
41
+ );
42
+ export const DivArrayRandom = ({ elementsCount }: DivArrayProps) => (
43
+ <>
44
+ {Array(elementsCount)
45
+ .fill(0)
46
+ .map((_, index) => {
47
+ const width = `${getRandom(700)}px`;
48
+ const height = `${getRandom(400)}px`;
49
+ return (
50
+ <DivComponent
51
+ key={index}
52
+ index={index + 1}
53
+ style={{
54
+ width,
55
+ height,
56
+ }}
57
+ >
58
+ item no = {index + 1} with width = {width} and height = {height}
59
+ </DivComponent>
60
+ );
61
+ })}
62
+ </>
63
+ );
@@ -1,25 +1,15 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
3
- import { NsColumnControl } from '.';
4
- import { DivArray } from './NDivs.story';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
+ import { NsColumnControl } from '@/common/index';
4
+ import { DivArray } from './DivArray';
5
+ import { childrenMapping, selectDivOptions } from './common';
5
6
 
6
7
  type ComponentType = typeof NsColumnControl;
7
8
  type Story = StoryObj<ComponentType>;
8
9
  type MetaStory = Meta<ComponentType>;
9
10
 
10
- /* an array from 1 to n */
11
- const selectDivOptions = Array(16)
12
- .fill(0)
13
- .map((e, i) => i + 1);
14
- const childrenMapping = selectDivOptions.reduce((a, c) => {
15
- return {
16
- ...a,
17
- [c]: <DivArray elementsCount={c} />,
18
- };
19
- }, {});
20
-
21
11
  export default {
22
- title: 'Components/NsColumnControl',
12
+ title: 'Components/Column/NsColumnControl',
23
13
  component: NsColumnControl,
24
14
  decorators: [withCenterDecorator],
25
15
  argTypes: {
@@ -42,7 +32,10 @@ export default {
42
32
  },
43
33
  } as MetaStory;
44
34
 
45
- export const SingleColumnControl: Story = {};
35
+ export const ResponsiveColumnControl: Story = {};
36
+ export const SingleColumnControl: Story = {
37
+ args: { columnClass: '' },
38
+ };
46
39
  export const TwoColumn11: Story = {
47
40
  args: { columnClass: 'ns-col-lg-1-1' },
48
41
  };
@@ -0,0 +1,63 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
+ import { NsFlexColumns } from '..';
4
+ import { DivArray, DivArrayRandom } from './DivArray';
5
+ import { childrenMapping, selectDivOptions } from './common';
6
+
7
+ type ComponentType = typeof NsFlexColumns;
8
+ type Story = StoryObj<ComponentType>;
9
+ type MetaStory = Meta<ComponentType>;
10
+
11
+ export default {
12
+ title: 'Components/Column/NsFlexColumns',
13
+ component: NsFlexColumns,
14
+ decorators: [withCenterDecorator],
15
+ argTypes: {
16
+ columnClass: {
17
+ control: 'text',
18
+ defaultValue: 'ns-col-lg-1-1-1 ns-col-md-1-1 ns-col-sm-1',
19
+ },
20
+ gap: {
21
+ control: 'number',
22
+ defaultValue: 16,
23
+ },
24
+ children: {
25
+ control: {
26
+ type: 'select',
27
+ options: selectDivOptions,
28
+ },
29
+ defaultValue: <DivArrayRandom elementsCount={8} />,
30
+ mapping: childrenMapping,
31
+ },
32
+ },
33
+ args: {
34
+ columnClass: '',
35
+ children: <DivArrayRandom elementsCount={12} />,
36
+ },
37
+ } as MetaStory;
38
+
39
+ export const DefaultColumnControl: Story = {
40
+ args: {
41
+ children: <DivArray elementsCount={8} />,
42
+ },
43
+ };
44
+ export const TwoColumn11: Story = {
45
+ args: { columnClass: 'ns-col-lg-1-1' },
46
+ };
47
+ export const TwoColumn21: Story = {
48
+ args: { columnClass: 'ns-col-lg-2-1' },
49
+ };
50
+
51
+ export const ThreeColumn211: Story = {
52
+ args: { columnClass: 'ns-col-lg-2-1-1' },
53
+ };
54
+ export const ThreeColumn121: Story = {
55
+ args: { columnClass: 'ns-col-lg-1-2-1' },
56
+ };
57
+ export const ThreeColumn111: Story = {
58
+ args: { columnClass: 'ns-col-lg-1-1-1' },
59
+ };
60
+
61
+ export const FourColumn1111: Story = {
62
+ args: { columnClass: 'ns-col-lg-1-1-1-1' },
63
+ };
@@ -0,0 +1,63 @@
1
+ import type { StoryObj, Meta } from '@storybook/react';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
+ import { NsGridColumns } from '..';
4
+ import { DivArray, DivArrayRandom } from './DivArray';
5
+ import { childrenMapping, selectDivOptions } from './common';
6
+
7
+ type ComponentType = typeof NsGridColumns;
8
+ type Story = StoryObj<ComponentType>;
9
+ type MetaStory = Meta<ComponentType>;
10
+
11
+ export default {
12
+ title: 'Components/Column/NsGridColumns',
13
+ component: NsGridColumns,
14
+ decorators: [withCenterDecorator],
15
+ argTypes: {
16
+ columnClass: {
17
+ control: 'text',
18
+ defaultValue: 'ns-col-lg-1-1-1 ns-col-md-1-1 ns-col-sm-1',
19
+ },
20
+ gap: {
21
+ control: 'number',
22
+ defaultValue: 16,
23
+ },
24
+ children: {
25
+ control: {
26
+ type: 'select',
27
+ options: selectDivOptions,
28
+ },
29
+ defaultValue: <DivArrayRandom elementsCount={8} />,
30
+ mapping: childrenMapping,
31
+ },
32
+ },
33
+ args: {
34
+ columnClass: '',
35
+ children: <DivArrayRandom elementsCount={12} />,
36
+ },
37
+ } as MetaStory;
38
+
39
+ export const DefaultColumnControl: Story = {
40
+ args: {
41
+ children: <DivArray elementsCount={8} />,
42
+ },
43
+ };
44
+ export const TwoColumn11: Story = {
45
+ args: { columnClass: 'ns-col-lg-1-1' },
46
+ };
47
+ export const TwoColumn21: Story = {
48
+ args: { columnClass: 'ns-col-lg-2-1' },
49
+ };
50
+
51
+ export const ThreeColumn211: Story = {
52
+ args: { columnClass: 'ns-col-lg-2-1-1' },
53
+ };
54
+ export const ThreeColumn121: Story = {
55
+ args: { columnClass: 'ns-col-lg-1-2-1' },
56
+ };
57
+ export const ThreeColumn111: Story = {
58
+ args: { columnClass: 'ns-col-lg-1-1-1' },
59
+ };
60
+
61
+ export const FourColumn1111: Story = {
62
+ args: { columnClass: 'ns-col-lg-1-1-1-1' },
63
+ };
@@ -0,0 +1,14 @@
1
+ import { DivArray } from './DivArray';
2
+
3
+ /* an array from 1 to n */
4
+ export const selectDivOptions = Array(16)
5
+ .fill(0)
6
+ .map((_, index) => index + 1);
7
+
8
+ /* this component is used only as a utility to show column control in storybook */
9
+ export const childrenMapping = selectDivOptions.reduce((childrenMappingObject, elementCount) => {
10
+ return {
11
+ ...childrenMappingObject,
12
+ [elementCount]: <DivArray elementsCount={elementCount} />,
13
+ };
14
+ }, {});
@@ -0,0 +1,45 @@
1
+ import { Box } from '@mui/material';
2
+ import { styled } from '@nuskin/foundation-theme';
3
+ import { sizeObjectType } from '../types';
4
+ import { commonStyles, getPercentArray } from './common';
5
+
6
+ const options = {
7
+ shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
8
+ };
9
+
10
+ type StyledFlexProps = {
11
+ sizes: sizeObjectType;
12
+ gap?: number;
13
+ isFullWidth: boolean;
14
+ };
15
+
16
+ /* main wrapper for column control using css flex */
17
+ export const StyledFlex = styled(
18
+ Box as any,
19
+ options
20
+ )<StyledFlexProps>(({ sizes, gap, isFullWidth }: StyledFlexProps) => {
21
+ const gridGap = gap ? `${gap}px` : '2rem';
22
+ const fraction = getPercentArray(sizes.fractions);
23
+ const flexResponsive = { flexGrow: 1, flexShrink: 1 };
24
+ const maxWidth = isFullWidth ? '100%' : '1200px';
25
+ const style: any = {
26
+ gap: gridGap,
27
+ ...commonStyles,
28
+ maxWidth,
29
+ display: 'flex',
30
+ paddingInline: '20px',
31
+ flexWrap: 'wrap',
32
+ justifyContent: 'center',
33
+ '> *': {
34
+ display: 'flex',
35
+ minWidth: '220px',
36
+ },
37
+ };
38
+ fraction.forEach((f, i) => {
39
+ style[`> :nth-of-type(${fraction.length}n+${i + 1})`] = {
40
+ flexBasis: `calc(${fraction[i]} - ${gridGap})`,
41
+ ...flexResponsive,
42
+ };
43
+ });
44
+ return style;
45
+ });
@@ -0,0 +1,40 @@
1
+ import { Box } from '@mui/material';
2
+ import { styled } from '@nuskin/foundation-theme';
3
+ import { sizeObjectType } from '../types';
4
+ import { commonStyles, getPercentArray } from './common';
5
+
6
+ type StyledGridProps = {
7
+ sizes: sizeObjectType;
8
+ gap?: number;
9
+ isFullWidth: boolean;
10
+ };
11
+ const options = {
12
+ shouldForwardProp: (propKey: string) => !['sizes', 'gap', 'isFullWidth'].includes(propKey),
13
+ };
14
+
15
+ /* main wrapper for column control using css grid */
16
+ export const StyledGrid = styled(
17
+ Box as any,
18
+ options
19
+ )<StyledGridProps>(({ sizes, gap, isFullWidth }: StyledGridProps) => {
20
+ const gridGap = gap ?? '2rem';
21
+ const maxWidth = isFullWidth ? '100%' : '1200px';
22
+ return {
23
+ gap: gridGap,
24
+ ...commonStyles,
25
+ maxWidth,
26
+ display: 'grid',
27
+ /* here we are creating gridTemplateColumns as calc(40% - 20px) calc(40% - 20px), */
28
+ gridTemplateColumns: getPercentArray(sizes.fractions)
29
+ ?.map((fractionPercent) => `calc(${fractionPercent} - 20px)`)
30
+ .join(''),
31
+ justifyContent: 'center',
32
+ '> *': {
33
+ minWidth: '220px',
34
+ width: 'auto !important',
35
+ },
36
+ '.span-2': {
37
+ gridColumn: 'span 2',
38
+ },
39
+ } as any;
40
+ });
@@ -0,0 +1,27 @@
1
+ const mobileBreakPoint = '600px';
2
+
3
+ export const commonStyles = {
4
+ margin: '32px auto',
5
+
6
+ [`@media (max-width: ${mobileBreakPoint})`]: {
7
+ display: 'flex',
8
+ flexDirection: 'column',
9
+ flexWrap: 'wrap',
10
+ margin: '2rem 1rem',
11
+ '> * ': {
12
+ flex: '1 1 0 !important',
13
+ },
14
+ },
15
+ };
16
+ /*
17
+ we have kept extra margin by taking 80% instead of 100%, because margins and padding,
18
+ and gaps also take up space, so we should be left with appropriate space
19
+ example:
20
+ ['1','1'] => ['40%','40%']
21
+ ['1','2'] => ['27%','53%']
22
+ */
23
+ export function getPercentArray(fractionArray?: string[] | number[]) {
24
+ let numbers = fractionArray?.map((numberString) => +numberString)?.filter((num) => 0 < num && num < 10) ?? [];
25
+ const sum = numbers.reduce((currentSum, currentNumber) => currentSum + currentNumber, 0);
26
+ return numbers.map((currentNumber) => ((currentNumber / sum) * 80).toFixed(2) + '%');
27
+ }
@@ -18,22 +18,7 @@ export type NsColumnControlProps = PropsWithChildren<{
18
18
  * ns-col-md-(column-ratio) (for tablet screens >= 600px),
19
19
  * and ns-col-sm-(column-ratio) (for mobile screens i.e < 600px)
20
20
  * sample values
21
- * 'ns-col-lg-2-1',
22
- 'ns-col-lg-1-2',
23
- 'ns-col-lg-1-1',
24
- 'ns-col-lg-1-1-1',
25
- 'ns-col-lg-2-1-1',
26
- 'ns-col-lg-1-1-1-1',
27
- 'ns-col-md-1',
28
- 'ns-col-md-1-1',
29
- 'ns-col-md-1-2',
30
- 'ns-col-md-2-1',
31
- 'ns-col-md-1-1-1',
32
- 'ns-col-md-2-1-1',
33
- 'ns-col-sm-1',
34
- 'ns-col-sm-1-1',
35
- 'ns-col-sm-1-2',
36
- 'ns-col-sm-2-1',
21
+ * 'ns-col-lg-2-1', 'ns-col-lg-1-2', 'ns-col-lg-1-1',
37
22
  */
38
23
  columnClass: string;
39
24
  gap?: number;
@@ -45,3 +30,17 @@ export type sizeObjectType = {
45
30
  tabletFractions?: number[];
46
31
  mobileFractions?: number[];
47
32
  };
33
+
34
+ export type NsFlexColumnsProps = PropsWithChildren<{
35
+ /**
36
+ * follows the convention of ns-col-lg-{column-ratio}
37
+ * sample value for column-ratio = 2-1 ==>ns-col-lg-2-1
38
+ */
39
+ columnClass: string;
40
+ gap: number;
41
+ /* when this boolean is true, column control takes full width of page instead of being restricted to 1200px */
42
+ isFullWidth?: boolean;
43
+ }> &
44
+ AdditionalProps;
45
+
46
+ export type NsGridColumnsProps = NsFlexColumnsProps;
@@ -1,5 +1,5 @@
1
1
  import { ValueOf } from 'next/dist/shared/lib/constants';
2
- import { NsColumnControlProps, sizeObjectType } from './types';
2
+ import { NsColumnControlProps, sizeObjectType } from './types.d';
3
3
 
4
4
  export const columnClasses: NsColumnControlProps['columnClass'][] = [
5
5
  'ns-col-lg-2-1',
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render, fireEvent, screen, waitFor } from '../../../test-utils';
2
+ import { render, fireEvent, screen, waitFor } from '@/test-utils/index';
3
3
  import NsDropdown from './NsDropdown';
4
4
  import NsDropdownOption from './NsDropdownOption';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import { DropdownContainer, DropdownButton, DropdownList, DropdownHead } from './NsDropdown.styled';
3
3
  import { NsIcon } from '../icon';
4
- import { DropdownProps } from './types';
4
+ import { DropdownProps } from './types.d';
5
5
 
6
6
  const NsDropdown: React.FC<DropdownProps> = ({
7
7
  selectedValue,
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { ListItem, ListItemContainer } from './NsDropdown.styled';
3
- import { DropdownOptionProps } from './types';
3
+ import { DropdownOptionProps } from './types.d';
4
4
 
5
5
  export const NsDropdownOption: React.FC<DropdownOptionProps> = ({
6
6
  value,
@@ -1,3 +1,3 @@
1
1
  export { default as NsDropdown } from './NsDropdown';
2
2
  export { default as NsDropdownOption } from './NsDropdownOption';
3
- export type { DropdownOptionProps, DropdownProps } from './types';
3
+ export type { DropdownOptionProps, DropdownProps } from './types.d';
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { NsDropdown, NsDropdownOption } from '../';
4
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
 
6
6
  type ComponentType = typeof NsDropdown;
7
7
  type Story = StoryObj<ComponentType>;
@@ -1,7 +1,7 @@
1
1
  import React, { useState } from 'react';
2
2
  import type { Meta, StoryObj } from '@storybook/react';
3
3
  import { NsDropdown, NsDropdownOption } from '../';
4
- import { withCenterDecorator } from '../../../stories/decorators/withCenterDecorator';
4
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
5
5
 
6
6
  type ComponentType = typeof NsDropdown;
7
7
  type Story = StoryObj<ComponentType>;
@@ -8,7 +8,7 @@
8
8
  import React from 'react';
9
9
  import nuskinTheme from '@nuskin/foundation-theme/src/themes/genome-foundation';
10
10
 
11
- import { render } from '../../../test-utils/index';
11
+ import { render } from '@/test-utils/index';
12
12
  import NsFlag from './NsFlag';
13
13
 
14
14
  const { palette } = nuskinTheme;
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsFlag } from './';
4
4
 
5
5
  type ComponentType = typeof NsFlag;
@@ -7,7 +7,7 @@
7
7
  import { Theme } from '@mui/material';
8
8
  import { styled, ColorUtils, FoundationTheme } from '@nuskin/foundation-theme';
9
9
 
10
- import { NsFlagSize } from './types';
10
+ import { NsFlagSize } from './types.d';
11
11
 
12
12
  type NsFlagThemeParams = {
13
13
  $size: NsFlagSize;
@@ -33,11 +33,9 @@ const makeFlagSize = ({ $size }: { $size: NsFlagSize }) => {
33
33
  return sizeValue / FLAG_SCALE_VALUE;
34
34
  };
35
35
 
36
- const {
37
- getPaletteColor,
38
- } = ColorUtils;
36
+ const { getPaletteColor } = ColorUtils;
39
37
 
40
- const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme}: NsFlagThemeParams) => {
38
+ const makeFlagBorder = ({ $size, $bgColor = 'accentColorA', theme }: NsFlagThemeParams) => {
41
39
  if (theme) {
42
40
  return `${makeFlagSize({ $size })}px solid ${getPaletteColor(theme, $bgColor)}`;
43
41
  }
@@ -8,7 +8,7 @@ import React, { PropsWithChildren } from 'react';
8
8
 
9
9
  import { StyledFlag } from './NsFlag.styled';
10
10
 
11
- import { NsFlagProps } from './types';
11
+ import { NsFlagProps } from './types.d';
12
12
 
13
13
  const NsFlag = (props: PropsWithChildren<NsFlagProps>) => {
14
14
  const { className = '', size = 'small', color = 'accentColorA', message, testId = 'ns-flag-component' } = props;
@@ -1,2 +1,2 @@
1
1
  export { default as NsFlag } from './NsFlag';
2
- export type { NsFlagProps, NsFlagSize } from './types';
2
+ export type { NsFlagProps, NsFlagSize } from './types.d';
@@ -1,6 +1,4 @@
1
1
  /**
2
- * @author [vijayaprathap Kumar] (vpkumar@nuskin.com)
3
- * types.d.ts
4
2
  * @description Extend the FlagProps interface to include message, color and size prop.
5
3
  */
6
4
 
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { render, screen } from '../../../test-utils';
2
+ import { render, screen } from '@/test-utils/index';
3
3
  import { NsIcon, NsIconNameType, NsIconVariants } from './';
4
4
 
5
5
  describe('NsIcon Component', () => {
@@ -1,5 +1,5 @@
1
1
  import type { StoryObj, Meta } from '@storybook/react';
2
- import { withCenterDecorator } from '../../stories/decorators/withCenterDecorator';
2
+ import { withCenterDecorator } from '@/stories/decorators/withCenterDecorator';
3
3
  import { NsIcon, NsIconVariants } from './';
4
4
 
5
5
  type ComponentType = typeof NsIcon;
@@ -1,5 +1,5 @@
1
1
  import { styled } from '@nuskin/foundation-theme';
2
- import { NsIconSizeType } from './types';
2
+ import { NsIconSizeType } from './types.d';
3
3
 
4
4
  const iconSize = {
5
5
  small: '16px',
@@ -1,6 +1,6 @@
1
1
  import { IconContainer } from './NsIcon.styled';
2
2
  import IconVariants from './NsIconVariants';
3
- import { NsIconProps } from './types';
3
+ import { NsIconProps } from './types.d';
4
4
 
5
5
  const NsIcon = ({
6
6
  name,
@@ -17,27 +17,31 @@ import Home from './icons/home';
17
17
  import AlertErrorIcon from './icons/AlertErrorIcon';
18
18
  import WarningIcon from './icons/WarningIcon';
19
19
  import CloseIcon from './icons/CloseIcon';
20
+ import UserIcon from './icons/UserIcon';
21
+ import HamburgerIcon from './icons/HamburgerIcon';
20
22
 
21
23
  const IconVariants = {
22
24
  arrowDown: ArrowDown,
23
25
  arrowUp: ArrowUp,
24
26
  arrowLeft: ArrowLeft,
25
27
  arrowRight: ArrowRight,
28
+ alertError: AlertErrorIcon,
26
29
  cart: Cart,
27
30
  cartBadge: CartBadge,
31
+ close: CloseIcon,
28
32
  checkShield: CheckShield,
29
33
  checkVerified: CheckVerified,
30
34
  error: ErrorIcon,
35
+ hamburgerIcon: HamburgerIcon,
36
+ home: Home,
31
37
  infoFilled: InfoFilled,
32
38
  infoOutlined: InfoOutlined,
33
39
  search: SearchIcon,
34
40
  success: SuccessIcon,
35
- trash: TrashIcon,
36
41
  slash: SlashIcon,
37
- home: Home,
38
- alertError: AlertErrorIcon,
42
+ trash: TrashIcon,
43
+ userIcon: UserIcon,
39
44
  warning: WarningIcon,
40
- close: CloseIcon
41
45
  };
42
46
 
43
47
  export default IconVariants;
@@ -16,17 +16,26 @@ const AlertErrorIcon = (props: SvgIconProps) => {
16
16
  xmlns="http://www.w3.org/2000/svg"
17
17
  {...props}
18
18
  >
19
- <g id="💎-icon/alert/WarningFill-red" transform="translate(1.000000, 1.000000)">
19
+ <g id="icon/alert/WarningFill-red" transform="translate(1.000000, 1.000000)">
20
20
  <g id="Error2" transform="translate(0.000000, 1.200000)">
21
- <path d="M17.9465423,14.8670135 L9.44311247,0.246687943 C9.35049358,0.100809118 9.18936767,0.012383152 9.01617259,0.012383152 C8.84297751,0.012383152 8.68185161,
21
+ <path
22
+ d="M17.9465423,14.8670135 L9.44311247,0.246687943 C9.35049358,0.100809118 9.18936767,0.012383152 9.01617259,0.012383152 C8.84297751,0.012383152 8.68185161,
22
23
  0.100809118 8.58923271,0.246687943 L0.0706452929,14.8670135 C-0.0142965839,15.0216954 -0.0118890438,15.2093943 0.0769925071,15.3618609 C0.165874058,
23
24
  15.5143276 0.328282319,15.6093523 0.505163987,15.6123832 L17.5120236,15.6123832 C17.6889052,15.6093523 17.8513135,15.5143276 17.940195,15.3618609 C18.0290766,
24
- 15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z" id="Shape" fill={props.fill || '#B2140A'} fill-rule="nonzero">
25
- </path>
26
- <path d="M8.19,12.84 C8.16437588,12.6281014 8.2368299,12.4160897 8.38677958,12.2641927 C8.53672927,12.1122956 8.74778837,12.0371121 8.96,12.06 C9.16715704,
25
+ 15.2093943 18.0314841,15.0216954 17.9465423,14.8670135 Z"
26
+ id="Shape"
27
+ fill={props.fill || '#B2140A'}
28
+ fillRule="nonzero"
29
+ ></path>
30
+ <path
31
+ d="M8.19,12.84 C8.16437588,12.6281014 8.2368299,12.4160897 8.38677958,12.2641927 C8.53672927,12.1122956 8.74778837,12.0371121 8.96,12.06 C9.16715704,
27
32
  12.0467652 9.37034806,12.1211477 9.52,12.265 C9.65709398,12.4241339 9.72701115,12.6303 9.715,12.84 C9.72048715,13.0522748 9.64341383,13.2584012 9.5,
28
33
  13.415 C9.35312473,13.5641498 9.1489517,13.6425377 8.94,13.63 C8.72997224,13.6424095 8.52401376,13.5683367 8.37,13.425 C8.23531653,13.2613056 8.17063593,
29
- 13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z" id="Shape" fill={props.fill || '#FFFFFF'} fill-rule="nonzero"></path>
34
+ 13.0510936 8.19,12.84 Z M9.415,11.195 L8.5,11.195 L8.25,5.96 L9.675,5.96 L9.415,11.195 Z"
35
+ id="Shape"
36
+ fill={props.fill || '#FFFFFF'}
37
+ fillRule="nonzero"
38
+ ></path>
30
39
  </g>
31
40
  </g>
32
41
  </SvgIcon>