@moda/om 18.1.0 → 18.3.0

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.
@@ -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: number;
10
- maxHeight: number;
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: number;
17
- maxHeight: number;
16
+ maxWidth?: number | undefined;
17
+ maxHeight?: number | undefined;
18
18
  outlined?: boolean | undefined;
19
19
  } & React.RefAttributes<HTMLDivElement>>;
@@ -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.1.0",
3
+ "version": "18.3.0",
4
4
  "description": "Moda Operandi design system",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -48,7 +48,7 @@
48
48
  },
49
49
  "dependencies": {
50
50
  "@moda/icons": "^5.18.0",
51
- "@moda/tokens": "^5.5.1",
51
+ "@moda/tokens": "^5.7.0",
52
52
  "@types/classnames": "^2.2.9",
53
53
  "classnames": "^2.2.6",
54
54
  "credit-card-type": "^9.0.0",
@@ -120,7 +120,6 @@
120
120
  "jest-environment-jsdom": "^29.0.0",
121
121
  "jest-matchmedia-mock": "^1.1.0",
122
122
  "lint-staged": "^13.0.0",
123
- "node-sass": "^8.0.0",
124
123
  "node-sass-package-importer": "^5.3.2",
125
124
  "pinst": "^3.0.0",
126
125
  "postcss": "^8.1.10",
@@ -133,8 +132,9 @@
133
132
  "rollup": "^3.2.3",
134
133
  "rollup-plugin-peer-deps-external": "^2.2.4",
135
134
  "rollup-plugin-scss": "^4.0.0",
135
+ "sass": "^1.57.1",
136
136
  "sass-loader": "^13.0.0",
137
- "semantic-release": "^19.0.2",
137
+ "semantic-release": "^20.0.2",
138
138
  "storybook-states": "^1.2.0",
139
139
  "style-loader": "^3.0.0",
140
140
  "ts-jest": "^29.0.1",
@@ -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: number;
15
- maxHeight: number;
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 } = scale({
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 }} />
@@ -18,19 +18,19 @@
18
18
  &--forest-green {
19
19
  background-color: color(forest-green);
20
20
  border-color: transparent;
21
- color: color(snow);
21
+ color: color('snow');
22
22
  }
23
23
 
24
24
  &--klein-blue {
25
25
  background-color: color(klein-blue);
26
26
  border-color: transparent;
27
- color: color(snow);
27
+ color: color('snow');
28
28
  }
29
29
 
30
30
  &--brick {
31
31
  background-color: color(brick);
32
32
  border-color: transparent;
33
- color: color(snow);
33
+ color: color('snow');
34
34
  }
35
35
 
36
36
  &--dark-fuchsia {
@@ -1,7 +1,8 @@
1
+ @use 'sass:math';
1
2
  @import '~om';
2
3
 
3
4
  .Breakpoint {
4
- $onePixel: 1/16;
5
+ $onePixel: math.div(1, 16);
5
6
  $keys: map-keys($breakpoints);
6
7
 
7
8
  display: none;
@@ -22,23 +22,23 @@
22
22
 
23
23
  &,
24
24
  &--primary {
25
- color: color(snow);
25
+ color: color('snow');
26
26
  border-color: color(ink);
27
27
  background-color: color(ink);
28
28
  @include font-smoothing(subpixel);
29
29
 
30
30
  &#{$self}--hover,
31
31
  &:hover {
32
- color: color(snow);
32
+ color: color('snow');
33
33
  border-color: color(fog, 0.32);
34
34
  background: linear-gradient(0deg, color(fog, 0.32), color(fog, 0.32)), color(ink);
35
35
  }
36
36
 
37
37
  &#{$self}--focus,
38
38
  &:focus {
39
- color: color(snow);
39
+ color: color('snow');
40
40
  border-color: color(fog, 0.12);
41
- background: linear-gradient(0deg, color(snow, 0.12), color(snow, 0.12)), color(ink);
41
+ background: linear-gradient(0deg, color('snow', 0.12), color('snow', 0.12)), color(ink);
42
42
  }
43
43
 
44
44
  &#{$self}--disabled,
@@ -54,7 +54,7 @@
54
54
  &--secondary {
55
55
  color: color(ink);
56
56
  border-color: color(ink);
57
- background-color: color(snow);
57
+ background-color: color('snow');
58
58
 
59
59
  &#{$self}--hover,
60
60
  &:hover {
@@ -86,7 +86,7 @@
86
86
  padding: spacing(2, 3);
87
87
  color: color(ink);
88
88
  border-color: color(elephant);
89
- background-color: color(snow);
89
+ background-color: color('snow');
90
90
  text-transform: none;
91
91
  line-height: 1.4;
92
92
 
@@ -2,7 +2,7 @@
2
2
 
3
3
  .Checkbox {
4
4
  $checkbox-size: space(4);
5
- $checkbox-check-offset: space(1) / 2;
5
+ $checkbox-check-offset: calc(space(1) / 2);
6
6
 
7
7
  @include stack(2, $direction: horizontal);
8
8
 
@@ -16,7 +16,7 @@
16
16
  position: relative;
17
17
  width: $checkbox-size;
18
18
  height: $checkbox-size;
19
- margin-top: space(1) / 2;
19
+ margin-top: calc(space(1) / 2);
20
20
  flex-shrink: 0;
21
21
  border: 1px solid;
22
22
 
@@ -33,7 +33,7 @@
33
33
  height: 33%;
34
34
  transform: translate(-50%, -50%);
35
35
  border-radius: 50%;
36
- background-color: color(snow);
36
+ background-color: color('snow');
37
37
  z-index: 1;
38
38
  }
39
39
 
@@ -108,8 +108,8 @@
108
108
  content: '';
109
109
  display: block;
110
110
  position: absolute;
111
- top: -($on-sale-dot-size / 2);
112
- right: -($on-sale-dot-size / 2);
111
+ top: calc(-1 * $on-sale-dot-size / 2);
112
+ right: calc(-1 * $on-sale-dot-size / 2);
113
113
  width: $on-sale-dot-size;
114
114
  height: $on-sale-dot-size;
115
115
  border-radius: 50%;
@@ -26,7 +26,7 @@
26
26
  &:before,
27
27
  &:after {
28
28
  $space-between-lines: 0.175rem;
29
- $offset: $space-between-lines/2;
29
+ $offset: calc($space-between-lines / 2);
30
30
  transform: translateY(calc(-#{$offset}));
31
31
  background-color: color(ink);
32
32
  box-shadow: 0 $space-between-lines 0 0 color(ink);
@@ -85,17 +85,17 @@
85
85
 
86
86
  &--dark-background {
87
87
  border-color: color(cement);
88
- color: color(snow);
88
+ color: color('snow');
89
89
 
90
90
  #{$self}__name {
91
91
  &::before,
92
92
  &::after {
93
- background-color: color(snow);
93
+ background-color: color('snow');
94
94
  }
95
95
  }
96
96
 
97
97
  #{$self}__contents {
98
- color: color(snow);
98
+ color: color('snow');
99
99
  }
100
100
  }
101
101
  }
@@ -3,7 +3,7 @@
3
3
  .LoadingShapes__item--current {
4
4
  // stylelint-disable-next-line plugin/selector-bem-pattern
5
5
  path {
6
- fill: color(snow);
6
+ fill: color('snow');
7
7
  transition: fill 1s;
8
8
  }
9
9
  }
@@ -3,14 +3,14 @@
3
3
  .Popover {
4
4
  $self: &;
5
5
  $caret-size: space(2);
6
- $border-width: 1rem / 16;
6
+ $border-width: calc(1rem / 16);
7
7
  $offset: space(2);
8
8
 
9
9
  position: relative;
10
10
 
11
11
  &__content {
12
12
  position: absolute;
13
- background-color: color(snow);
13
+ background-color: color('snow');
14
14
  border: $border-width solid color(elephant);
15
15
  z-index: 1;
16
16
 
@@ -119,7 +119,7 @@
119
119
  top: auto;
120
120
  bottom: -($border-width + $offset);
121
121
  border-top: none;
122
- border-bottom: $caret-size solid color(snow);
122
+ border-bottom: $caret-size solid color('snow');
123
123
  }
124
124
 
125
125
  &:before {
@@ -137,7 +137,7 @@
137
137
  &:before {
138
138
  top: -($border-width + $offset);
139
139
  bottom: auto;
140
- border-top: $caret-size solid color(snow);
140
+ border-top: $caret-size solid color('snow');
141
141
  border-bottom: none;
142
142
  }
143
143
 
@@ -19,7 +19,7 @@
19
19
  flex-shrink: 0;
20
20
  border: 1px solid;
21
21
  border-radius: 50%;
22
- background-color: color(snow);
22
+ background-color: color('snow');
23
23
 
24
24
  &--checked {
25
25
  background-color: color(ink);
@@ -33,14 +33,14 @@
33
33
  bottom: $radio-button-check-offset;
34
34
  left: $radio-button-check-offset;
35
35
  border-radius: 50%;
36
- background-color: color(snow);
36
+ background-color: color('snow');
37
37
  }
38
38
  }
39
39
 
40
40
  &--disabled {
41
41
  color: color(elephant);
42
42
  pointer-events: none;
43
- background-color: color(snow);
43
+ background-color: color('snow');
44
44
  &::after {
45
45
  background-color: color(elephant);
46
46
  }
@@ -23,7 +23,7 @@
23
23
  &:hover,
24
24
  &:focus {
25
25
  border-color: color(elephant);
26
- background-color: color(snow);
26
+ background-color: color('snow');
27
27
  }
28
28
  }
29
29
  }
@@ -23,7 +23,7 @@
23
23
  cursor: default;
24
24
 
25
25
  &:hover {
26
- background-color: color(snow);
26
+ background-color: color('snow');
27
27
  }
28
28
  }
29
29
  }
@@ -1,7 +1,7 @@
1
1
  @import '~om';
2
2
 
3
3
  .SelectOptions {
4
- background-color: color(snow);
4
+ background-color: color('snow');
5
5
  border: 1px solid color(elephant);
6
6
 
7
7
  &:focus {
@@ -8,7 +8,7 @@
8
8
  left: 0;
9
9
  right: 0;
10
10
  transition: all 500ms ease-out;
11
- background-color: color(snow);
11
+ background-color: color('snow');
12
12
  margin-left: 0;
13
13
 
14
14
  &--active {
@@ -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
 
@@ -1,7 +1,7 @@
1
1
  @import '~om';
2
2
 
3
3
  .Toast {
4
- color: color(snow);
4
+ color: color('snow');
5
5
  padding: spacing(3);
6
6
 
7
7
  &--success {
@@ -11,7 +11,7 @@
11
11
  width: 100%;
12
12
  padding: spacing(3, 4);
13
13
  border: 1px solid color(elephant);
14
- background-color: color(snow);
14
+ background-color: color('snow');
15
15
  border-radius: 0;
16
16
 
17
17
  &::placeholder {