@elastic/eui-theme-common 0.0.3 → 0.0.5

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 (41) hide show
  1. package/lib/cjs/global_styling/functions/index.d.ts +1 -0
  2. package/lib/cjs/global_styling/functions/index.d.ts.map +1 -1
  3. package/lib/cjs/global_styling/functions/index.js +11 -0
  4. package/lib/cjs/global_styling/functions/index.js.map +1 -1
  5. package/lib/cjs/global_styling/functions/math.d.ts +13 -0
  6. package/lib/cjs/global_styling/functions/math.d.ts.map +1 -0
  7. package/lib/cjs/global_styling/functions/math.js +64 -0
  8. package/lib/cjs/global_styling/functions/math.js.map +1 -0
  9. package/lib/cjs/global_styling/functions/math.test.js +110 -0
  10. package/lib/cjs/global_styling/functions/math.test.js.map +1 -0
  11. package/lib/cjs/global_styling/variables/colors.d.ts +7 -2
  12. package/lib/cjs/global_styling/variables/colors.d.ts.map +1 -1
  13. package/lib/cjs/global_styling/variables/colors.js.map +1 -1
  14. package/lib/cjs/global_styling/variables/components.d.ts +6 -2
  15. package/lib/cjs/global_styling/variables/components.d.ts.map +1 -1
  16. package/lib/cjs/global_styling/variables/components.js.map +1 -1
  17. package/lib/cjs/global_styling/variables/forms.d.ts +3 -0
  18. package/lib/cjs/global_styling/variables/forms.d.ts.map +1 -1
  19. package/lib/cjs/global_styling/variables/forms.js.map +1 -1
  20. package/lib/esm/global_styling/functions/index.d.ts +1 -0
  21. package/lib/esm/global_styling/functions/index.js +1 -0
  22. package/lib/esm/global_styling/functions/index.js.map +1 -1
  23. package/lib/esm/global_styling/functions/math.d.ts +12 -0
  24. package/lib/esm/global_styling/functions/math.js +45 -0
  25. package/lib/esm/global_styling/functions/math.js.map +1 -0
  26. package/lib/esm/global_styling/functions/math.test.d.ts +1 -0
  27. package/lib/esm/global_styling/functions/math.test.js +67 -0
  28. package/lib/esm/global_styling/functions/math.test.js.map +1 -0
  29. package/lib/esm/global_styling/variables/colors.d.ts +7 -2
  30. package/lib/esm/global_styling/variables/components.d.ts +6 -2
  31. package/lib/esm/global_styling/variables/forms.d.ts +3 -0
  32. package/package.json +1 -1
  33. package/src/global_styling/index.scss +0 -3
  34. package/src/global_styling/mixins/_helpers.scss +0 -9
  35. package/src/global_styling/mixins/_shadow.scss +0 -8
  36. package/src/global_styling/variables/_size.scss +0 -2
  37. package/src/global_styling/react_date_picker/_date_picker.scss +0 -772
  38. package/src/global_styling/react_date_picker/_index.scss +0 -2
  39. package/src/global_styling/react_date_picker/_variables.scss +0 -1
  40. package/src/global_styling/utility/_animations.scss +0 -55
  41. package/src/global_styling/utility/_index.scss +0 -1
@@ -0,0 +1,67 @@
1
+ /*
2
+ * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3
+ * or more contributor license agreements. Licensed under the Elastic License
4
+ * 2.0 and the Server Side Public License, v 1; you may not use this file except
5
+ * in compliance with, at your election, the Elastic License 2.0 or the Server
6
+ * Side Public License, v 1.
7
+ */
8
+ import { mathWithUnits } from './math';
9
+ describe('mathWithUnits', () => {
10
+ describe('extracts numerical values from CSS strings with units, performs math callbacks, and returns units as is', () => {
11
+ test('px and multiplication', () => {
12
+ expect(mathWithUnits('10px', (x) => x * 10)).toEqual('100px');
13
+ });
14
+ test('em and division', () => {
15
+ expect(mathWithUnits('40%', (x) => x / 2)).toEqual('20%');
16
+ });
17
+ test('rem and addition', () => {
18
+ expect(mathWithUnits('1rem', (x) => x + 2)).toEqual('3rem');
19
+ });
20
+ test('unitless and negative values', () => {
21
+ expect(mathWithUnits('-5.5', (x) => x - 1.2)).toEqual('-6.7');
22
+ });
23
+ test('allows passing an optional unit if none is passed', () => {
24
+ expect(mathWithUnits('0', (x) => x, 'vh')).toEqual('0vh');
25
+ });
26
+ });
27
+ describe('handles numeric input types', () => {
28
+ test('unitless', () => {
29
+ expect(mathWithUnits(6, (x) => Math.pow(x, 2))).toEqual('36');
30
+ });
31
+ test('allows passing an optional unit', () => {
32
+ expect(mathWithUnits(3.5, (x) => x % 1.5, 'px')).toEqual('0.5px');
33
+ });
34
+ });
35
+ describe('multiple inputs', () => {
36
+ it('accepts an array of inputs, parses each input, and returns them as a separate arg to the callback', () => {
37
+ expect(mathWithUnits(['3px', '4px', '5px'], (x, y, z) => x + y + z)).toEqual('12px');
38
+ });
39
+ it('allows mixing strings and numbers', () => {
40
+ expect(mathWithUnits(['6px', 3], (x, y) => x / y)).toEqual('2px');
41
+ });
42
+ it('throws on multiple different unit types', () => {
43
+ expect(() => mathWithUnits(['1px', '1em'], (x, y) => x + y)).toThrow('Multiple units found');
44
+ });
45
+ it('allows different unit types if an override unit is passed', () => {
46
+ expect(mathWithUnits(['50%', '5rem'], (x, y) => x / y, 'px')).toEqual('10px');
47
+ });
48
+ });
49
+ describe('weird edge cases', () => {
50
+ it('throws on undefined', () => {
51
+ expect(() => mathWithUnits(undefined, (x) => x * 3)).toThrow('Invalid value type');
52
+ });
53
+ it('throws on strings that do not contain numbers', () => {
54
+ expect(() => mathWithUnits('no number', (x) => x * 3)).toThrow('No valid numeric value found');
55
+ });
56
+ it('throws on strings with numbers that are actually NaNs', () => {
57
+ expect(() => mathWithUnits('34.23.12', (x) => x * 3)).toThrow('No valid numeric value found');
58
+ });
59
+ it('ignores multiple values/units, only using the first match', () => {
60
+ expect(mathWithUnits('10px 20px', (x) => x)).toEqual('10px');
61
+ });
62
+ it('ignores multiple percentage signs', () => {
63
+ expect(mathWithUnits('100%%%', (x) => x)).toEqual('100%');
64
+ });
65
+ });
66
+ });
67
+ //# sourceMappingURL=math.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"math.test.js","sourceRoot":"","sources":["../../../../src/global_styling/functions/math.test.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AAEvC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,yGAAyG,EAAE,GAAG,EAAE;QACvH,IAAI,C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CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAC5D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -67,7 +67,7 @@ export declare type _EuiThemeBrandTextColors = {
67
67
  export declare type _EuiThemeShadeColors = {
68
68
  /**
69
69
  * Used as the background color of primary **page content and panels** including modals and flyouts.
70
- * @deprecated - use `white`
70
+ * @deprecated - use specific semantic color tokens instead
71
71
  */
72
72
  emptyShade: ColorModeSwitch;
73
73
  /**
@@ -97,7 +97,7 @@ export declare type _EuiThemeShadeColors = {
97
97
  darkestShade: ColorModeSwitch;
98
98
  /**
99
99
  * The opposite of `emptyShade`
100
- * @deprecated - use`black`
100
+ * @deprecated - use specific semantic color tokens instead
101
101
  */
102
102
  fullShade: ColorModeSwitch;
103
103
  };
@@ -165,6 +165,7 @@ export declare type _EuiThemeBackgroundColors = {
165
165
  backgroundBaseSubdued: ColorModeSwitch;
166
166
  backgroundBasePlain: ColorModeSwitch;
167
167
  backgroundBaseDisabled: ColorModeSwitch;
168
+ backgroundBaseHighlighted: ColorModeSwitch;
168
169
  backgroundBaseFormsPrepend: ColorModeSwitch;
169
170
  backgroundBaseFormsControlDisabled: ColorModeSwitch;
170
171
  backgroundBaseInteractiveHover: ColorModeSwitch;
@@ -206,6 +207,8 @@ export declare type _EuiThemeTransparentBackgroundColors = {
206
207
  /** @deprecated */
207
208
  backgroundTransparentSubdued: ColorModeSwitch;
208
209
  /** @deprecated */
210
+ backgroundTransparentHighlighted: ColorModeSwitch;
211
+ /** @deprecated */
209
212
  backgroundTransparentPlain: ColorModeSwitch;
210
213
  };
211
214
  export declare type _EuiThemeBorderColors = {
@@ -283,6 +286,8 @@ export declare type _EuiThemeConstantColors = {
283
286
  * @deprecated
284
287
  */
285
288
  ink: string;
289
+ plainLight: string;
290
+ plainDark: string;
286
291
  vis: _EuiThemeVisColors;
287
292
  };
288
293
  export declare type _EuiThemeColorsMode = _EuiThemeBrandColors & _EuiThemeBrandTextColors & _EuiThemeShadeColors & _EuiThemeSpecialColors & _EuiThemeTextColors & _EuiThemeBackgroundColors & _EuiThemeTransparentBackgroundColors & _EuiThemeBorderColors;
@@ -1,10 +1,11 @@
1
1
  import { ColorModeSwitch, StrictColorModeSwitch } from '../types';
2
2
  import { _EuiThemeButtonColors } from './buttons';
3
- import { _EuiThemeFormColors } from './forms';
3
+ import { _EuiThemeForm, _EuiThemeFormColors } from './forms';
4
4
  export declare type _EuiThemeComponentColors = {
5
5
  buttonGroupBorderColor: ColorModeSwitch;
6
6
  buttonGroupBorderColorSelected: ColorModeSwitch;
7
7
  buttonGroupFocusColor: ColorModeSwitch;
8
+ badgeBackground: ColorModeSwitch;
8
9
  badgeBackgroundSubdued: ColorModeSwitch;
9
10
  badgeBorderColorHollow: ColorModeSwitch;
10
11
  badgeIconButtonBackgroundHover: ColorModeSwitch;
@@ -36,9 +37,11 @@ export declare type _EuiThemeComponentColors = {
36
37
  codeSelectorIdColor: ColorModeSwitch;
37
38
  collapsibleNavGroupBackground: ColorModeSwitch;
38
39
  collapsibleNavGroupBackgroundDark: ColorModeSwitch;
40
+ dataGridBorderColor: ColorModeSwitch;
39
41
  dataGridVerticalLineBorderColor: ColorModeSwitch;
40
42
  dataGridRowBackgroundStriped: ColorModeSwitch;
41
43
  dataGridRowBackgroundHover: ColorModeSwitch;
44
+ dataGridRowBackgroundSelect: ColorModeSwitch;
42
45
  dragDropDraggingBackground: ColorModeSwitch;
43
46
  dragDropDraggingOverBackground: ColorModeSwitch;
44
47
  headerBackground: ColorModeSwitch;
@@ -46,6 +49,7 @@ export declare type _EuiThemeComponentColors = {
46
49
  headerDarkSearchBorderColor: ColorModeSwitch;
47
50
  headerDarkSectionItemBackgroundFocus: ColorModeSwitch;
48
51
  filterSelectItemBackgroundFocusDisabled: ColorModeSwitch;
52
+ flyoutFooterBackground: ColorModeSwitch;
49
53
  flyoutCloseButtonInsideBackground: ColorModeSwitch;
50
54
  keyPadMenuItemBackgroundDisabledSelect: ColorModeSwitch;
51
55
  listGroupItemBackgroundPrimaryActive: ColorModeSwitch;
@@ -87,7 +91,7 @@ export declare type _EuiThemeComponentColors = {
87
91
  };
88
92
  export declare type _EuiThemeComponents = {
89
93
  buttons: StrictColorModeSwitch<_EuiThemeButtonColors>;
90
- forms: StrictColorModeSwitch<_EuiThemeFormColors>;
94
+ forms: _EuiThemeForm & StrictColorModeSwitch<_EuiThemeFormColors>;
91
95
  /**
92
96
  * internal-only key that holds temporary tokens used while migrating themes
93
97
  */
@@ -1,4 +1,7 @@
1
1
  import { ColorModeSwitch } from '../types';
2
+ export declare type _EuiThemeForm = {
3
+ maxWidth: string;
4
+ };
2
5
  export declare type _EuiThemeFormColors = {
3
6
  background: ColorModeSwitch;
4
7
  backgroundDisabled: ColorModeSwitch;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elastic/eui-theme-common",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "EUI theme common",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "scripts": {
@@ -9,7 +9,4 @@
9
9
  // Mixins provide generic code expansion through helpers
10
10
  @import 'mixins/index';
11
11
 
12
- // Utility classes provide one-off selectors for common css problems
13
- @import 'utility/index';
14
-
15
12
  // The reset file has moved to global_styles.tsx
@@ -81,15 +81,6 @@
81
81
  @include euiOverflowShadow('x');
82
82
  }
83
83
 
84
- /**
85
- * For quickly applying a full-height element whether using flex or not
86
- */
87
- @mixin euiFullHeight {
88
- height: 100%;
89
- flex: 1 1 auto;
90
- overflow: hidden;
91
- }
92
-
93
84
  // Hiding elements offscreen to only be read by screen reader
94
85
  // See https://github.com/elastic/eui/pull/5130 and https://github.com/elastic/eui/pull/5152 for more info
95
86
  @mixin euiScreenReaderOnly {
@@ -63,14 +63,6 @@
63
63
  }
64
64
  }
65
65
 
66
- @mixin euiSlightShadowHover($color: $euiShadowColor) {
67
- box-shadow:
68
- 0 1px 5px rgba($color, shadowOpacity(.1)),
69
- 0 3.6px 13px rgba($color, shadowOpacity(.07)),
70
- 0 8.4px 23px rgba($color, shadowOpacity(.06)),
71
- 0 23px 35px rgba($color, shadowOpacity(.05));
72
- }
73
-
74
66
  // stylelint-disable color-named
75
67
  @mixin euiOverflowShadow($direction: 'y', $side: 'both') {
76
68
  $hideHeight: $euiScrollBarCornerThin * 1.25;
@@ -7,8 +7,6 @@ $euiSizeL: $euiSize * 1.5 !default;
7
7
  $euiSizeXL: $euiSize * 2 !default;
8
8
  $euiSizeXXL: $euiSize * 2.5 !default;
9
9
 
10
- $euiButtonMinWidth: $euiSize * 7 !default;
11
-
12
10
  $euiScrollBar: $euiSize !default;
13
11
  // Corner sizes are used as an inset border and therefore a smaller corner size means a larger thumb
14
12
  $euiScrollBarCorner: $euiSizeXS !default;