@moda/om 18.2.0 → 18.3.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.
- package/dist/index.cjs.js +1147 -861
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1147 -861
- package/dist/index.esm.js.map +1 -1
- package/dist/src/components/AspectRatioBox/AspectRatioBox.d.ts +4 -4
- package/dist/src/components/Popover/Popover.d.ts +3 -3
- package/dist/src/components/Text/Text.d.ts +1 -1
- package/package.json +13 -13
- package/src/components/AspectRatioBox/AspectRatioBox.tsx +25 -5
- package/src/components/Popover/Popover.tsx +3 -3
- package/src/components/Text/Text.tsx +1 -1
- package/CHANGELOG.md +0 -702
|
@@ -6,14 +6,14 @@ export declare const DEFAULT_PRODUCT_ASPECT_RATIO: number;
|
|
|
6
6
|
export type AspectRatioBoxProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
7
7
|
aspectWidth?: number;
|
|
8
8
|
aspectHeight?: number;
|
|
9
|
-
maxWidth
|
|
10
|
-
maxHeight
|
|
9
|
+
maxWidth?: number;
|
|
10
|
+
maxHeight?: number;
|
|
11
11
|
outlined?: boolean;
|
|
12
12
|
};
|
|
13
13
|
export declare const AspectRatioBox: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
14
14
|
aspectWidth?: number | undefined;
|
|
15
15
|
aspectHeight?: number | undefined;
|
|
16
|
-
maxWidth
|
|
17
|
-
maxHeight
|
|
16
|
+
maxWidth?: number | undefined;
|
|
17
|
+
maxHeight?: number | undefined;
|
|
18
18
|
outlined?: boolean | undefined;
|
|
19
19
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
2
|
import './Popover.scss';
|
|
3
|
-
export type PopoverProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
4
|
-
content:
|
|
3
|
+
export type PopoverProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> & {
|
|
4
|
+
content: ReactNode;
|
|
5
5
|
children: JSX.Element;
|
|
6
6
|
open?: boolean;
|
|
7
7
|
anchor?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactHTML } from 'react';
|
|
2
2
|
import { typography, colors } from '@moda/tokens';
|
|
3
3
|
import './Text.scss';
|
|
4
|
-
export type TextTreatment = keyof typeof typography['text-treatments'];
|
|
4
|
+
export type TextTreatment = keyof (typeof typography)['text-treatments'];
|
|
5
5
|
export type TextColor = keyof typeof colors.all;
|
|
6
6
|
export type TextFontFamily = keyof typeof typography.fonts;
|
|
7
7
|
export type TextProps = React.HTMLAttributes<HTMLSpanElement> & {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moda/om",
|
|
3
|
-
"version": "18.
|
|
3
|
+
"version": "18.3.1",
|
|
4
4
|
"description": "Moda Operandi design system",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.esm.js",
|
|
@@ -71,22 +71,22 @@
|
|
|
71
71
|
"@rollup/plugin-babel": "^6.0.0",
|
|
72
72
|
"@rollup/plugin-commonjs": "^24.0.0",
|
|
73
73
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
74
|
-
"@storybook/addon-actions": "^
|
|
75
|
-
"@storybook/addon-essentials": "^
|
|
76
|
-
"@storybook/addon-links": "^
|
|
74
|
+
"@storybook/addon-actions": "^7.0.2",
|
|
75
|
+
"@storybook/addon-essentials": "^7.0.2",
|
|
76
|
+
"@storybook/addon-links": "^7.0.2",
|
|
77
77
|
"@storybook/addon-postcss": "^2.0.0",
|
|
78
|
-
"@storybook/addon-viewport": "^
|
|
79
|
-
"@storybook/addons": "^
|
|
80
|
-
"@storybook/builder-webpack5": "^
|
|
78
|
+
"@storybook/addon-viewport": "^7.0.2",
|
|
79
|
+
"@storybook/addons": "^7.0.2",
|
|
80
|
+
"@storybook/builder-webpack5": "^7.0.2",
|
|
81
81
|
"@storybook/manager-webpack5": "^6.5.6",
|
|
82
|
-
"@storybook/react": "^
|
|
82
|
+
"@storybook/react": "^7.0.2",
|
|
83
83
|
"@testing-library/jest-dom": "^5.16.4",
|
|
84
|
-
"@testing-library/react": "^
|
|
84
|
+
"@testing-library/react": "^14.0.0",
|
|
85
85
|
"@testing-library/user-event": "^14.1.1",
|
|
86
86
|
"@types/cheerio": "^0.22.22",
|
|
87
87
|
"@types/credit-card-type": "^9.0.0",
|
|
88
88
|
"@types/jest": "^29.0.3",
|
|
89
|
-
"@types/ramda": "^0.
|
|
89
|
+
"@types/ramda": "^0.29.0",
|
|
90
90
|
"@types/react": "^18.0.9",
|
|
91
91
|
"@types/react-dom": "^18.0.1",
|
|
92
92
|
"@types/react-input-mask": "^3.0.2",
|
|
@@ -125,7 +125,7 @@
|
|
|
125
125
|
"postcss": "^8.1.10",
|
|
126
126
|
"postcss-loader": "^7.0.0",
|
|
127
127
|
"prettier": "^2.7.1",
|
|
128
|
-
"ramda": "^0.
|
|
128
|
+
"ramda": "^0.29.0",
|
|
129
129
|
"react": "^18.1.0",
|
|
130
130
|
"react-dom": "^18.1.0",
|
|
131
131
|
"react-router-dom": "^5.1.2",
|
|
@@ -134,11 +134,11 @@
|
|
|
134
134
|
"rollup-plugin-scss": "^4.0.0",
|
|
135
135
|
"sass": "^1.57.1",
|
|
136
136
|
"sass-loader": "^13.0.0",
|
|
137
|
-
"semantic-release": "^
|
|
137
|
+
"semantic-release": "^21.0.0",
|
|
138
138
|
"storybook-states": "^1.2.0",
|
|
139
139
|
"style-loader": "^3.0.0",
|
|
140
140
|
"ts-jest": "^29.0.1",
|
|
141
|
-
"typescript": "^
|
|
141
|
+
"typescript": "^5.0.2",
|
|
142
142
|
"waait": "^1.0.5",
|
|
143
143
|
"webpack": "^5.72.1",
|
|
144
144
|
"webpack-cli": "^5.0.0"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
|
-
import { scale } from 'proportional-scale';
|
|
3
|
+
import { scale, paddingBottom } from 'proportional-scale';
|
|
4
4
|
import './AspectRatioBox.scss';
|
|
5
5
|
|
|
6
6
|
export const DEFAULT_PRODUCT_ASPECT_WIDTH = 128;
|
|
@@ -11,11 +11,31 @@ export const DEFAULT_PRODUCT_ASPECT_RATIO =
|
|
|
11
11
|
export type AspectRatioBoxProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
12
12
|
aspectWidth?: number;
|
|
13
13
|
aspectHeight?: number;
|
|
14
|
-
maxWidth
|
|
15
|
-
maxHeight
|
|
14
|
+
maxWidth?: number;
|
|
15
|
+
maxHeight?: number;
|
|
16
16
|
outlined?: boolean;
|
|
17
17
|
};
|
|
18
18
|
|
|
19
|
+
const scaleDimensions = ({
|
|
20
|
+
width,
|
|
21
|
+
height,
|
|
22
|
+
maxWidth,
|
|
23
|
+
maxHeight
|
|
24
|
+
}: {
|
|
25
|
+
width: number;
|
|
26
|
+
height: number;
|
|
27
|
+
maxWidth?: number;
|
|
28
|
+
maxHeight?: number;
|
|
29
|
+
}) => {
|
|
30
|
+
if (maxWidth && maxHeight) return scale({ width, height, maxWidth, maxHeight });
|
|
31
|
+
|
|
32
|
+
if (maxWidth) return scale({ width, height, maxWidth });
|
|
33
|
+
|
|
34
|
+
if (maxHeight) return scale({ width, height, maxHeight });
|
|
35
|
+
|
|
36
|
+
return { width, height, paddingBottom: paddingBottom({ width, height }), scale: 1 };
|
|
37
|
+
};
|
|
38
|
+
|
|
19
39
|
export const AspectRatioBox = React.forwardRef(
|
|
20
40
|
(
|
|
21
41
|
{
|
|
@@ -30,7 +50,7 @@ export const AspectRatioBox = React.forwardRef(
|
|
|
30
50
|
}: AspectRatioBoxProps,
|
|
31
51
|
forwardedRef: React.Ref<HTMLDivElement>
|
|
32
52
|
) => {
|
|
33
|
-
const { width, paddingBottom } =
|
|
53
|
+
const { width, paddingBottom } = scaleDimensions({
|
|
34
54
|
width: aspectWidth,
|
|
35
55
|
height: aspectHeight,
|
|
36
56
|
maxWidth,
|
|
@@ -47,7 +67,7 @@ export const AspectRatioBox = React.forwardRef(
|
|
|
47
67
|
},
|
|
48
68
|
className
|
|
49
69
|
)}
|
|
50
|
-
style={{ maxWidth: `${width}px` }}
|
|
70
|
+
style={maxWidth || maxHeight ? { maxWidth: `${width}px` } : undefined}
|
|
51
71
|
{...rest}
|
|
52
72
|
>
|
|
53
73
|
<div className='AspectRatioBox__wrapper' style={{ paddingBottom }} />
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import React, { useState, useCallback, useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useState, useCallback, useEffect, useRef, ReactNode } from 'react';
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import './Popover.scss';
|
|
4
4
|
|
|
5
|
-
export type PopoverProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
|
-
content:
|
|
5
|
+
export type PopoverProps = Omit<React.HTMLAttributes<HTMLDivElement>, 'content'> & {
|
|
6
|
+
content: ReactNode;
|
|
7
7
|
children: JSX.Element;
|
|
8
8
|
open?: boolean;
|
|
9
9
|
anchor?: 'topLeft' | 'topCenter' | 'topRight' | 'bottomLeft' | 'bottomCenter' | 'bottomRight';
|
|
@@ -3,7 +3,7 @@ import classNames from 'classnames';
|
|
|
3
3
|
import { typography, colors } from '@moda/tokens';
|
|
4
4
|
import './Text.scss';
|
|
5
5
|
|
|
6
|
-
export type TextTreatment = keyof typeof typography['text-treatments'];
|
|
6
|
+
export type TextTreatment = keyof (typeof typography)['text-treatments'];
|
|
7
7
|
export type TextColor = keyof typeof colors.all;
|
|
8
8
|
export type TextFontFamily = keyof typeof typography.fonts;
|
|
9
9
|
|