@lumx/react 2.2.12-alpha.1 → 2.2.12-alpha.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
@@ -7,8 +7,8 @@
7
7
  },
8
8
  "dependencies": {
9
9
  "@juggle/resize-observer": "^3.2.0",
10
- "@lumx/core": "^2.2.12-alpha.1",
11
- "@lumx/icons": "^2.2.12-alpha.1",
10
+ "@lumx/core": "^2.2.12-alpha.2",
11
+ "@lumx/icons": "^2.2.12-alpha.2",
12
12
  "@popperjs/core": "^2.5.4",
13
13
  "body-scroll-lock": "^3.1.5",
14
14
  "classnames": "^2.2.6",
@@ -120,6 +120,6 @@
120
120
  "build:storybook": "cd storybook && ./build"
121
121
  },
122
122
  "sideEffects": false,
123
- "version": "2.2.12-alpha.1",
124
- "gitHead": "85d4c80e91aabae08a93cd09e001768730bd1012"
123
+ "version": "2.2.12-alpha.2",
124
+ "gitHead": "bca1497272a2a835b2563128fd558bf088f28444"
125
125
  }
@@ -42,6 +42,18 @@ const TemplateColorVariants = ({ hasShape, theme }: any) => {
42
42
  <br />
43
43
  {withUndefined(Object.values(ColorVariant).reverse()).map((colorVariant) => (
44
44
  <Fragment key={`${colorVariant}`}>
45
+ {!colorVariant && (
46
+ <>
47
+ <small>No theme</small>
48
+ <Icon
49
+ icon={mdiEmail}
50
+ color={color}
51
+ colorVariant={colorVariant}
52
+ size="m"
53
+ hasShape={hasShape}
54
+ />
55
+ </>
56
+ )}
45
57
  <small>Variant: {colorVariant || 'undefined'}</small>
46
58
  <Icon
47
59
  icon={mdiEmail}
@@ -56,46 +56,25 @@ const DEFAULT_PROPS: Partial<IconProps> = {};
56
56
  export const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {
57
57
  const { className, color, colorVariant, hasShape, icon, size, theme, alt, ...forwardedProps } = props;
58
58
 
59
- let iconColor;
60
- let iconColorVariant;
61
- let iconTheme;
62
- if (color) {
63
- iconColor = color;
64
- iconTheme = theme;
59
+ // Color
60
+ let iconColor = color;
61
+ if (!iconColor && (hasShape || theme)) {
62
+ iconColor = theme === Theme.dark ? ColorPalette.light : ColorPalette.dark;
65
63
  }
66
64
 
67
- if (hasShape) {
68
- if (theme === Theme.dark && !iconColor) {
69
- iconColor = ColorPalette.light;
70
- iconTheme = theme;
71
- } else {
72
- iconColor = iconColor || ColorPalette.dark;
73
- }
74
- } else if (!iconColor && theme) {
75
- iconTheme = theme;
76
- iconColor = iconColor || theme === Theme.light ? ColorPalette.dark : ColorPalette.light;
77
- }
78
-
79
- if (!iconColorVariant) {
80
- if (hasShape && iconColor === ColorPalette.dark) {
81
- iconColorVariant = colorVariant || 'L2';
82
- } else {
83
- iconColorVariant = colorVariant || (theme === Theme.dark ? 'N' : 'L1');
84
- }
65
+ // Color variant
66
+ let iconColorVariant = colorVariant;
67
+ if (!iconColorVariant && hasShape && iconColor === ColorPalette.dark) {
68
+ iconColorVariant = 'L2';
85
69
  }
86
70
 
87
- let iconSize;
88
- if (size) {
89
- if (hasShape) {
90
- if (size === Size.xxs || size === Size.xs) {
91
- iconSize = Size.s;
92
- } else if (size === Size.xxl) {
93
- iconSize = Size.xl;
94
- } else {
95
- iconSize = size;
96
- }
97
- } else {
98
- iconSize = size;
71
+ // Size
72
+ let iconSize = size;
73
+ if (size && hasShape) {
74
+ if (size === Size.xxs || size === Size.xs) {
75
+ iconSize = Size.s;
76
+ } else if (size === Size.xxl) {
77
+ iconSize = Size.xl;
99
78
  }
100
79
  } else if (hasShape) {
101
80
  iconSize = Size.m;
@@ -112,7 +91,7 @@ export const Icon: Comp<IconProps, HTMLElement> = forwardRef((props, ref) => {
112
91
  colorVariant: iconColorVariant,
113
92
  hasShape,
114
93
  prefix: CLASSNAME,
115
- theme: iconTheme,
94
+ theme,
116
95
  size: iconSize,
117
96
  }),
118
97
  !hasShape && `${CLASSNAME}--no-shape`,
@@ -26,7 +26,7 @@ exports[`<Icon> Snapshots and structure should render color & color variant 1`]
26
26
 
27
27
  exports[`<Icon> Snapshots and structure should render correctly 1`] = `
28
28
  <i
29
- className="lumx-icon lumx-icon--color-variant-L1 lumx-icon--no-shape lumx-icon--path"
29
+ className="lumx-icon lumx-icon--no-shape lumx-icon--path"
30
30
  >
31
31
  <svg
32
32
  aria-hidden="true"