@orfium/ictinus 4.21.0 → 4.23.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.
- package/dist/components/Avatar/Avatar.js +3 -2
- package/dist/components/Avatar/Avatar.style.js +1 -3
- package/dist/components/ButtonBase/ButtonBase.d.ts +2 -1
- package/dist/components/ButtonBase/ButtonBase.style.d.ts +22 -16
- package/dist/components/ButtonBase/ButtonBase.style.js +39 -42
- package/dist/components/ButtonBase/config.d.ts +28 -0
- package/dist/components/ButtonBase/config.js +38 -0
- package/dist/components/ButtonBase/utils.d.ts +1 -8
- package/dist/components/ButtonBase/utils.js +4 -29
- package/dist/components/CheckBox/CheckBox.js +4 -3
- package/dist/components/Chip/Chip.d.ts +3 -1
- package/dist/components/Chip/Chip.js +13 -6
- package/dist/components/Chip/Chip.style.d.ts +1 -1
- package/dist/components/Chip/Chip.style.js +32 -22
- package/dist/components/Chip/components/Badge/Badge.style.js +1 -3
- package/dist/components/DatePicker/Day/Day.style.js +3 -5
- package/dist/components/Drawer/Navigation/MenuItem/MenuItem.js +1 -1
- package/dist/components/Filter/Filter.style.d.ts +6 -4
- package/dist/components/Filter/Filter.style.js +43 -11
- package/dist/components/Filter/utils.d.ts +3 -3
- package/dist/components/Filter/utils.js +9 -32
- package/dist/components/IconButton/IconButton.js +1 -3
- package/dist/components/Menu/Menu.js +1 -3
- package/dist/components/Overlay/Overlay.d.ts +18 -0
- package/dist/components/Overlay/Overlay.js +84 -0
- package/dist/components/Overlay/Overlay.style.d.ts +13 -0
- package/dist/components/Overlay/Overlay.style.js +138 -0
- package/dist/components/Overlay/index.d.ts +1 -0
- package/dist/components/Overlay/index.js +10 -0
- package/dist/components/Radio/Radio.d.ts +2 -4
- package/dist/components/Radio/Radio.js +11 -15
- package/dist/components/Radio/Radio.style.js +10 -10
- package/dist/components/Select/Select.js +0 -3
- package/dist/components/Select/Select.style.d.ts +2 -7
- package/dist/components/Select/Select.style.js +4 -7
- package/dist/components/TextInputBase/TextInputBase.d.ts +2 -1
- package/dist/components/TextInputBase/TextInputBase.js +1 -13
- package/dist/components/TextInputBase/TextInputBase.style.d.ts +2 -1
- package/dist/components/TextInputBase/TextInputBase.style.js +92 -42
- package/dist/components/TextInputBase/config.d.ts +22 -0
- package/dist/components/TextInputBase/config.js +36 -0
- package/dist/components/Tooltip/Tooltip.style.js +1 -3
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/dist/theme/index.d.ts +2 -34
- package/dist/theme/index.js +14 -26
- package/dist/theme/palette.d.ts +21 -4
- package/dist/theme/palette.js +44 -23
- package/dist/theme/states/disabled.d.ts +12 -0
- package/dist/theme/states/disabled.js +25 -0
- package/dist/theme/states/focus.d.ts +16 -0
- package/dist/theme/states/focus.js +31 -0
- package/dist/theme/states/hover.d.ts +15 -0
- package/dist/theme/states/hover.js +31 -0
- package/dist/theme/states/index.d.ts +5 -0
- package/dist/theme/states/index.js +19 -0
- package/dist/theme/states/pressed.d.ts +15 -0
- package/dist/theme/states/pressed.js +31 -0
- package/dist/theme/states/statesConfig.d.ts +34 -0
- package/dist/theme/states/statesConfig.js +36 -0
- package/dist/theme/states/utils.d.ts +7 -0
- package/dist/theme/states/utils.js +24 -0
- package/dist/theme/types.d.ts +28 -0
- package/dist/theme/types.js +3 -0
- package/package.json +1 -1
package/dist/theme/index.d.ts
CHANGED
|
@@ -1,36 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Overrides } from './overrides';
|
|
3
|
-
import { colorShades, flatColors, mainTypes, paleColors, Palette } from './palette';
|
|
4
|
-
import { PaletteConfig } from './palette.config';
|
|
5
|
-
import { Spacing } from './spacing';
|
|
6
|
-
import { Typography } from './typography';
|
|
7
|
-
declare type TextColorTypes = 'primary' | 'secondary' | 'light';
|
|
8
|
-
export declare type ThemeConfig = {
|
|
9
|
-
palette: PaletteConfig;
|
|
10
|
-
typography: Typography;
|
|
11
|
-
spacing: Spacing;
|
|
12
|
-
elevation: Elevation;
|
|
13
|
-
overrides: Overrides;
|
|
14
|
-
isDark: boolean;
|
|
15
|
-
};
|
|
16
|
-
declare type GetColor = {
|
|
17
|
-
(color: typeof flatColors[number], variant: typeof colorShades[number]): string;
|
|
18
|
-
(color: typeof flatColors[number], variant: typeof colorShades[number], scope: 'flat'): string;
|
|
19
|
-
(color: TextColorTypes, variant: typeof colorShades[number], scope: 'text'): string;
|
|
20
|
-
(color: typeof mainTypes[number], variant: typeof colorShades[number], scope: 'normal'): string;
|
|
21
|
-
(color: typeof paleColors[number], variant: null, scope: 'pale'): string;
|
|
22
|
-
};
|
|
23
|
-
export declare type Theme = {
|
|
24
|
-
palette: Palette;
|
|
25
|
-
typography: Typography;
|
|
26
|
-
spacing: Spacing;
|
|
27
|
-
elevation: Elevation;
|
|
28
|
-
isDark: boolean;
|
|
29
|
-
overrides: Overrides;
|
|
30
|
-
utils: {
|
|
31
|
-
getColor: GetColor;
|
|
32
|
-
};
|
|
33
|
-
};
|
|
34
|
-
export declare const getColor: (palette: Palette) => GetColor;
|
|
1
|
+
import { TextColorTypes, Theme, ThemeConfig } from './types';
|
|
35
2
|
declare const defaultTheme: (theming: 'dark' | 'light') => Theme;
|
|
3
|
+
export { TextColorTypes, Theme, ThemeConfig };
|
|
36
4
|
export default defaultTheme;
|
package/dist/theme/index.js
CHANGED
|
@@ -1,44 +1,32 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports["default"] =
|
|
4
|
+
exports["default"] = void 0;
|
|
5
5
|
|
|
6
6
|
var _elevation = _interopRequireDefault(require("./elevation"));
|
|
7
7
|
|
|
8
8
|
var _overrides = _interopRequireDefault(require("./overrides"));
|
|
9
9
|
|
|
10
|
-
var _palette = require("./palette
|
|
10
|
+
var _palette = require("./palette");
|
|
11
|
+
|
|
12
|
+
var _palette2 = require("./palette.config");
|
|
11
13
|
|
|
12
14
|
var _spacing = _interopRequireDefault(require("./spacing"));
|
|
13
15
|
|
|
16
|
+
var _types = require("./types");
|
|
17
|
+
|
|
18
|
+
exports.TextColorTypes = _types.TextColorTypes;
|
|
19
|
+
exports.Theme = _types.Theme;
|
|
20
|
+
exports.ThemeConfig = _types.ThemeConfig;
|
|
21
|
+
|
|
14
22
|
var _typography = _interopRequireDefault(require("./typography"));
|
|
15
23
|
|
|
16
24
|
var _utils = require("./utils");
|
|
17
25
|
|
|
18
26
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
27
|
|
|
20
|
-
var getColor = function getColor(palette) {
|
|
21
|
-
return function (color, variant, scope) {
|
|
22
|
-
var _palette$scope, _palette$scope2, _palette$scope2$color;
|
|
23
|
-
|
|
24
|
-
if (scope === void 0) {
|
|
25
|
-
scope = 'flat';
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
var endColor = variant === null ? palette == null ? void 0 : (_palette$scope = palette[scope]) == null ? void 0 : _palette$scope[color] : scope === 'normal' ? palette[color][variant] : palette == null ? void 0 : (_palette$scope2 = palette[scope]) == null ? void 0 : (_palette$scope2$color = _palette$scope2[color]) == null ? void 0 : _palette$scope2$color[variant];
|
|
29
|
-
|
|
30
|
-
if (!endColor) {
|
|
31
|
-
throw new Error('No color found with that name');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
return endColor;
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
exports.getColor = getColor;
|
|
39
|
-
|
|
40
28
|
var defaultTheme = function defaultTheme(theming) {
|
|
41
|
-
var palette = theming === 'light' ? (0, _utils.enhancePaletteWithShades)(
|
|
29
|
+
var palette = theming === 'light' ? (0, _utils.enhancePaletteWithShades)(_palette2.lightPaletteConfig) : (0, _utils.enhancePaletteWithShades)(_palette2.darkPaletteConfig);
|
|
42
30
|
return {
|
|
43
31
|
palette: palette,
|
|
44
32
|
typography: _typography["default"],
|
|
@@ -47,12 +35,12 @@ var defaultTheme = function defaultTheme(theming) {
|
|
|
47
35
|
isDark: false,
|
|
48
36
|
overrides: _overrides["default"],
|
|
49
37
|
utils: {
|
|
50
|
-
getColor: getColor(palette)
|
|
38
|
+
getColor: (0, _palette.getColor)(palette),
|
|
39
|
+
getAAColorFromSwatches: (0, _palette.getAAColorFromSwatches)(palette),
|
|
40
|
+
getAAColor: (0, _palette.getAAColor)(palette)
|
|
51
41
|
}
|
|
52
42
|
};
|
|
53
43
|
};
|
|
54
|
-
/* Declare any static variables here e.g. $gray: #888; */
|
|
55
|
-
|
|
56
44
|
|
|
57
45
|
var _default = defaultTheme;
|
|
58
46
|
exports["default"] = _default;
|
package/dist/theme/palette.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { TextColorTypes } from './index';
|
|
1
2
|
export declare const neutralColors: readonly ["neutralWhite", "neutralBlack"];
|
|
2
|
-
export declare const BASE_SHADE = 500;
|
|
3
3
|
/**
|
|
4
4
|
* Here are listed all the colors available for our project
|
|
5
5
|
* Flat colors are the actual colors of the system
|
|
@@ -18,6 +18,9 @@ export declare const paleColors: readonly ["greyScale", "darkGrey", "lightGrey",
|
|
|
18
18
|
* default variation: 500
|
|
19
19
|
**/
|
|
20
20
|
export declare const colorShades: readonly [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950];
|
|
21
|
+
export declare const MIN_SHADE = 50;
|
|
22
|
+
export declare const BASE_SHADE = 500;
|
|
23
|
+
export declare const MAX_SHADE = 950;
|
|
21
24
|
/**
|
|
22
25
|
* mainTypes are not colors per se but a type of color
|
|
23
26
|
* for example error is red but also defines a state that's why is listed here and not in flat colors
|
|
@@ -42,9 +45,23 @@ export declare type Palette = {
|
|
|
42
45
|
black: string;
|
|
43
46
|
} & Record<typeof mainTypes[number], generatedColorShades>;
|
|
44
47
|
export declare type formFieldStyles = 'filled' | 'outlined' | 'elevated';
|
|
48
|
+
export declare type GetColor = {
|
|
49
|
+
(color: typeof flatColors[number], variant: typeof colorShades[number]): string;
|
|
50
|
+
(color: typeof flatColors[number], variant: typeof colorShades[number], scope: 'flat'): string;
|
|
51
|
+
(color: TextColorTypes, variant: typeof colorShades[number], scope: 'text'): string;
|
|
52
|
+
(color: typeof mainTypes[number], variant: typeof colorShades[number], scope: 'normal'): string;
|
|
53
|
+
(color: typeof paleColors[number], variant: null, scope: 'pale'): string;
|
|
54
|
+
};
|
|
55
|
+
export declare const getColor: (palette: Palette) => GetColor;
|
|
45
56
|
/**
|
|
46
57
|
* this function picks either white or black color based on the background that is passed
|
|
47
|
-
* swatches are calculated based on accessibility by
|
|
58
|
+
* swatches are calculated based on accessibility by getAAColor function and splited to those two colors
|
|
48
59
|
**/
|
|
49
|
-
export declare
|
|
50
|
-
|
|
60
|
+
export declare type GetAAColorFromSwatches = {
|
|
61
|
+
(color: typeof flatColors[number], variant: typeof colorShades[number]): string;
|
|
62
|
+
};
|
|
63
|
+
export declare const getAAColorFromSwatches: (palette: Palette) => GetAAColorFromSwatches;
|
|
64
|
+
export declare type GetAAColor = {
|
|
65
|
+
(color: string): string;
|
|
66
|
+
};
|
|
67
|
+
export declare const getAAColor: (palette: Palette) => GetAAColor;
|
package/dist/theme/palette.js
CHANGED
|
@@ -1,25 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.__esModule = true;
|
|
4
|
-
exports.
|
|
4
|
+
exports.getAAColor = exports.getAAColorFromSwatches = exports.getColor = exports.mainTypes = exports.MAX_SHADE = exports.BASE_SHADE = exports.MIN_SHADE = exports.colorShades = exports.paleColors = exports.flatColors = exports.neutralColors = void 0;
|
|
5
5
|
|
|
6
6
|
var _polished = require("polished");
|
|
7
7
|
|
|
8
|
-
var _index = require("./index");
|
|
9
|
-
|
|
10
|
-
var _palette = require("./palette.config");
|
|
11
|
-
|
|
12
|
-
var _utils = require("./utils");
|
|
13
|
-
|
|
14
8
|
var neutralColors = ['neutralWhite', 'neutralBlack'];
|
|
15
|
-
exports.neutralColors = neutralColors;
|
|
16
|
-
var BASE_SHADE = 500;
|
|
17
9
|
/**
|
|
18
10
|
* Here are listed all the colors available for our project
|
|
19
11
|
* Flat colors are the actual colors of the system
|
|
20
12
|
**/
|
|
21
13
|
|
|
22
|
-
exports.
|
|
14
|
+
exports.neutralColors = neutralColors;
|
|
23
15
|
var flatColors = ['greyScale', 'darkGrey', 'lightGrey', 'red', 'magenta', 'purple', 'darkBlue', 'blue', 'lightBlue', 'teal', 'green', 'yellow', 'orange', 'darkOrange'].concat(neutralColors);
|
|
24
16
|
/**
|
|
25
17
|
* Here are listed all the colors available for our project
|
|
@@ -38,33 +30,62 @@ var paleColors = ['greyScale', 'darkGrey', 'lightGrey', 'red', 'magenta', 'purpl
|
|
|
38
30
|
|
|
39
31
|
exports.paleColors = paleColors;
|
|
40
32
|
var colorShades = [50, 100, 150, 200, 250, 300, 350, 400, 450, 500, 550, 600, 650, 700, 750, 800, 850, 900, 950];
|
|
33
|
+
exports.colorShades = colorShades;
|
|
34
|
+
var MIN_SHADE = 50;
|
|
35
|
+
exports.MIN_SHADE = MIN_SHADE;
|
|
36
|
+
var BASE_SHADE = 500;
|
|
37
|
+
exports.BASE_SHADE = BASE_SHADE;
|
|
38
|
+
var MAX_SHADE = 950;
|
|
41
39
|
/**
|
|
42
40
|
* mainTypes are not colors per se but a type of color
|
|
43
41
|
* for example error is red but also defines a state that's why is listed here and not in flat colors
|
|
44
42
|
* Each color has again the above variations (shades)
|
|
45
43
|
**/
|
|
46
44
|
|
|
47
|
-
exports.
|
|
45
|
+
exports.MAX_SHADE = MAX_SHADE;
|
|
48
46
|
var mainTypes = ['primary', 'secondary', 'success', 'error', 'warning', 'info', 'light', 'link'];
|
|
49
47
|
exports.mainTypes = mainTypes;
|
|
50
48
|
|
|
49
|
+
var getColor = function getColor(palette) {
|
|
50
|
+
return function (color, variant, scope) {
|
|
51
|
+
var _palette$scope, _palette$scope2, _palette$scope2$color;
|
|
52
|
+
|
|
53
|
+
if (scope === void 0) {
|
|
54
|
+
scope = 'flat';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var endColor = variant === null ? palette == null ? void 0 : (_palette$scope = palette[scope]) == null ? void 0 : _palette$scope[color] : scope === 'normal' ? palette[color][variant] : palette == null ? void 0 : (_palette$scope2 = palette[scope]) == null ? void 0 : (_palette$scope2$color = _palette$scope2[color]) == null ? void 0 : _palette$scope2$color[variant];
|
|
58
|
+
|
|
59
|
+
if (!endColor) {
|
|
60
|
+
throw new Error('No color found with that name');
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return endColor;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
51
66
|
/**
|
|
52
67
|
* this function picks either white or black color based on the background that is passed
|
|
53
|
-
* swatches are calculated based on accessibility by
|
|
68
|
+
* swatches are calculated based on accessibility by getAAColor function and splited to those two colors
|
|
54
69
|
**/
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
exports.getColor = getColor;
|
|
73
|
+
|
|
74
|
+
var getAAColorFromSwatches = function getAAColorFromSwatches(palette) {
|
|
75
|
+
return function (color, shade) {
|
|
76
|
+
var hexColorCode = getColor(palette)(color, shade);
|
|
77
|
+
return getAAColor(palette)(hexColorCode);
|
|
78
|
+
};
|
|
59
79
|
};
|
|
60
80
|
|
|
61
|
-
exports.
|
|
81
|
+
exports.getAAColorFromSwatches = getAAColorFromSwatches;
|
|
62
82
|
|
|
63
|
-
var
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
83
|
+
var getAAColor = function getAAColor(palette) {
|
|
84
|
+
return function (color) {
|
|
85
|
+
var white = palette.white;
|
|
86
|
+
var black = palette.black;
|
|
87
|
+
return (0, _polished.getContrast)(color, black) > (0, _polished.getContrast)(color, white) ? black : white;
|
|
88
|
+
};
|
|
68
89
|
};
|
|
69
90
|
|
|
70
|
-
exports.
|
|
91
|
+
exports.getAAColor = getAAColor;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare type GetDisabled = {
|
|
2
|
+
style: {
|
|
3
|
+
opacity: number;
|
|
4
|
+
cursor: string;
|
|
5
|
+
};
|
|
6
|
+
opacity: number;
|
|
7
|
+
cursor: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* On disabled opacity is dropped in half and cursor is 'not-allowed'
|
|
11
|
+
* **/
|
|
12
|
+
export declare const getDisabled: () => GetDisabled;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getDisabled = void 0;
|
|
5
|
+
|
|
6
|
+
var _statesConfig = require("./statesConfig");
|
|
7
|
+
|
|
8
|
+
var opacityAmount = _statesConfig.statesConfig.disabled.opacity.amount;
|
|
9
|
+
var cursor = _statesConfig.statesConfig.disabled.cursor.name;
|
|
10
|
+
/**
|
|
11
|
+
* On disabled opacity is dropped in half and cursor is 'not-allowed'
|
|
12
|
+
* **/
|
|
13
|
+
|
|
14
|
+
var getDisabled = function getDisabled() {
|
|
15
|
+
return {
|
|
16
|
+
style: {
|
|
17
|
+
opacity: opacityAmount,
|
|
18
|
+
cursor: cursor
|
|
19
|
+
},
|
|
20
|
+
opacity: opacityAmount,
|
|
21
|
+
cursor: cursor
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
exports.getDisabled = getDisabled;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Theme } from '../index';
|
|
2
|
+
export declare type Props = {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
borderWidth?: number;
|
|
5
|
+
};
|
|
6
|
+
export declare type GetFocus = {
|
|
7
|
+
borderWidth: string;
|
|
8
|
+
focusColor: string;
|
|
9
|
+
styleBorder: string;
|
|
10
|
+
styleOutline: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* On focus border is darken by one step in shade.
|
|
14
|
+
* If we exceed the maximum value then we lighten it.
|
|
15
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
16
|
+
export declare const getFocus: ({ theme, borderWidth }: Props) => GetFocus;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getFocus = void 0;
|
|
5
|
+
|
|
6
|
+
var _utils = require("../utils");
|
|
7
|
+
|
|
8
|
+
var _statesConfig = require("./statesConfig");
|
|
9
|
+
|
|
10
|
+
var borderWidthStep = _statesConfig.statesConfig.focus.border.width.step;
|
|
11
|
+
var borderColor = _statesConfig.statesConfig.focus.border.color;
|
|
12
|
+
/**
|
|
13
|
+
* On focus border is darken by one step in shade.
|
|
14
|
+
* If we exceed the maximum value then we lighten it.
|
|
15
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
16
|
+
|
|
17
|
+
var getFocus = function getFocus(_ref) {
|
|
18
|
+
var theme = _ref.theme,
|
|
19
|
+
_ref$borderWidth = _ref.borderWidth,
|
|
20
|
+
borderWidth = _ref$borderWidth === void 0 ? 0 : _ref$borderWidth;
|
|
21
|
+
var calculatedBorderWidth = borderWidth + borderWidthStep;
|
|
22
|
+
var focusColor = theme.utils.getColor(borderColor.name, borderColor.shade);
|
|
23
|
+
return {
|
|
24
|
+
borderWidth: (0, _utils.rem)(calculatedBorderWidth),
|
|
25
|
+
focusColor: focusColor,
|
|
26
|
+
styleBorder: (0, _utils.rem)(calculatedBorderWidth) + " solid " + focusColor,
|
|
27
|
+
styleOutline: focusColor + " auto " + (0, _utils.rem)(calculatedBorderWidth)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getFocus = getFocus;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Theme } from '../index';
|
|
2
|
+
import { colorShades, flatColors } from '../palette';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
color?: typeof flatColors[number];
|
|
6
|
+
shade?: typeof colorShades[number] | 0;
|
|
7
|
+
};
|
|
8
|
+
export declare type GetHover = {
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* On hover background is darken by one step in shade.
|
|
13
|
+
* If we exceed the maximum value then we lighten it.
|
|
14
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
15
|
+
export declare const getHover: ({ theme, color, shade }: Props) => GetHover;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getHover = void 0;
|
|
5
|
+
|
|
6
|
+
var _statesConfig = require("./statesConfig");
|
|
7
|
+
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
|
|
10
|
+
var backgroundColorStep = _statesConfig.statesConfig.hover.backgroundColor.step;
|
|
11
|
+
/**
|
|
12
|
+
* On hover background is darken by one step in shade.
|
|
13
|
+
* If we exceed the maximum value then we lighten it.
|
|
14
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
15
|
+
|
|
16
|
+
var getHover = function getHover(_ref) {
|
|
17
|
+
var theme = _ref.theme,
|
|
18
|
+
_ref$color = _ref.color,
|
|
19
|
+
color = _ref$color === void 0 ? 'lightGrey' : _ref$color,
|
|
20
|
+
_ref$shade = _ref.shade,
|
|
21
|
+
shade = _ref$shade === void 0 ? 0 : _ref$shade;
|
|
22
|
+
var calculatedShade = (0, _utils.getShadeWithStep)({
|
|
23
|
+
shade: shade,
|
|
24
|
+
step: backgroundColorStep
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
backgroundColor: theme.utils.getColor(color, calculatedShade)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getHover = getHover;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
|
|
5
|
+
var _disabled = require("./disabled");
|
|
6
|
+
|
|
7
|
+
exports.getDisabled = _disabled.getDisabled;
|
|
8
|
+
|
|
9
|
+
var _focus = require("./focus");
|
|
10
|
+
|
|
11
|
+
exports.getFocus = _focus.getFocus;
|
|
12
|
+
|
|
13
|
+
var _hover = require("./hover");
|
|
14
|
+
|
|
15
|
+
exports.getHover = _hover.getHover;
|
|
16
|
+
|
|
17
|
+
var _pressed = require("./pressed");
|
|
18
|
+
|
|
19
|
+
exports.getPressed = _pressed.getPressed;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Theme } from '../index';
|
|
2
|
+
import { colorShades, flatColors } from '../palette';
|
|
3
|
+
export declare type Props = {
|
|
4
|
+
theme: Theme;
|
|
5
|
+
color?: typeof flatColors[number];
|
|
6
|
+
shade?: typeof colorShades[number] | 0;
|
|
7
|
+
};
|
|
8
|
+
export declare type GetPressed = {
|
|
9
|
+
backgroundColor: string;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* On pressed background is darken by two steps in shade.
|
|
13
|
+
* If we exceed the maximum value then we lighten it by two steps.
|
|
14
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
15
|
+
export declare const getPressed: ({ theme, color, shade }: Props) => GetPressed;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getPressed = void 0;
|
|
5
|
+
|
|
6
|
+
var _statesConfig = require("./statesConfig");
|
|
7
|
+
|
|
8
|
+
var _utils = require("./utils");
|
|
9
|
+
|
|
10
|
+
var backgroundColorStep = _statesConfig.statesConfig.pressed.backgroundColor.step;
|
|
11
|
+
/**
|
|
12
|
+
* On pressed background is darken by two steps in shade.
|
|
13
|
+
* If we exceed the maximum value then we lighten it by two steps.
|
|
14
|
+
* This will be reviewed when dark theme is implemented. **/
|
|
15
|
+
|
|
16
|
+
var getPressed = function getPressed(_ref) {
|
|
17
|
+
var theme = _ref.theme,
|
|
18
|
+
_ref$color = _ref.color,
|
|
19
|
+
color = _ref$color === void 0 ? 'lightGrey' : _ref$color,
|
|
20
|
+
_ref$shade = _ref.shade,
|
|
21
|
+
shade = _ref$shade === void 0 ? 0 : _ref$shade;
|
|
22
|
+
var calculatedShade = (0, _utils.getShadeWithStep)({
|
|
23
|
+
shade: shade,
|
|
24
|
+
step: backgroundColorStep
|
|
25
|
+
});
|
|
26
|
+
return {
|
|
27
|
+
backgroundColor: theme.utils.getColor(color, calculatedShade)
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
exports.getPressed = getPressed;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { colorShades, flatColors } from '../palette';
|
|
2
|
+
declare type StatesConfig = {
|
|
3
|
+
hover: {
|
|
4
|
+
backgroundColor: {
|
|
5
|
+
step: number;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
8
|
+
focus: {
|
|
9
|
+
border: {
|
|
10
|
+
width: {
|
|
11
|
+
step: number;
|
|
12
|
+
};
|
|
13
|
+
color: {
|
|
14
|
+
name: typeof flatColors[number];
|
|
15
|
+
shade: typeof colorShades[number];
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
pressed: {
|
|
20
|
+
backgroundColor: {
|
|
21
|
+
step: number;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
disabled: {
|
|
25
|
+
opacity: {
|
|
26
|
+
amount: number;
|
|
27
|
+
};
|
|
28
|
+
cursor: {
|
|
29
|
+
name: string;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
export declare const statesConfig: StatesConfig;
|
|
34
|
+
export {};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.statesConfig = void 0;
|
|
5
|
+
var statesConfig = {
|
|
6
|
+
hover: {
|
|
7
|
+
backgroundColor: {
|
|
8
|
+
step: 50
|
|
9
|
+
}
|
|
10
|
+
},
|
|
11
|
+
focus: {
|
|
12
|
+
border: {
|
|
13
|
+
width: {
|
|
14
|
+
step: 1
|
|
15
|
+
},
|
|
16
|
+
color: {
|
|
17
|
+
name: 'magenta',
|
|
18
|
+
shade: 500
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
pressed: {
|
|
23
|
+
backgroundColor: {
|
|
24
|
+
step: 100
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
disabled: {
|
|
28
|
+
opacity: {
|
|
29
|
+
amount: 0.5
|
|
30
|
+
},
|
|
31
|
+
cursor: {
|
|
32
|
+
name: 'not-allowed'
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
exports.statesConfig = statesConfig;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
exports.__esModule = true;
|
|
4
|
+
exports.getShadeWithStep = void 0;
|
|
5
|
+
|
|
6
|
+
var _palette = require("../palette");
|
|
7
|
+
|
|
8
|
+
var getShadeWithStep = function getShadeWithStep(_ref) {
|
|
9
|
+
var _ref$shade = _ref.shade,
|
|
10
|
+
shade = _ref$shade === void 0 ? 0 : _ref$shade,
|
|
11
|
+
_ref$step = _ref.step,
|
|
12
|
+
step = _ref$step === void 0 ? 50 : _ref$step;
|
|
13
|
+
var calculatedShade = shade;
|
|
14
|
+
|
|
15
|
+
if (shade + step > _palette.MAX_SHADE) {
|
|
16
|
+
calculatedShade -= step;
|
|
17
|
+
} else {
|
|
18
|
+
calculatedShade += step;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return calculatedShade;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
exports.getShadeWithStep = getShadeWithStep;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Elevation } from './elevation';
|
|
2
|
+
import { Overrides } from './overrides';
|
|
3
|
+
import { GetAAColor, GetAAColorFromSwatches, GetColor, Palette } from './palette';
|
|
4
|
+
import { PaletteConfig } from './palette.config';
|
|
5
|
+
import { Spacing } from './spacing';
|
|
6
|
+
import { Typography } from './typography';
|
|
7
|
+
export declare type TextColorTypes = 'primary' | 'secondary' | 'light';
|
|
8
|
+
export declare type ThemeConfig = {
|
|
9
|
+
palette: PaletteConfig;
|
|
10
|
+
typography: Typography;
|
|
11
|
+
spacing: Spacing;
|
|
12
|
+
elevation: Elevation;
|
|
13
|
+
overrides: Overrides;
|
|
14
|
+
isDark: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare type Theme = {
|
|
17
|
+
palette: Palette;
|
|
18
|
+
typography: Typography;
|
|
19
|
+
spacing: Spacing;
|
|
20
|
+
elevation: Elevation;
|
|
21
|
+
isDark: boolean;
|
|
22
|
+
overrides: Overrides;
|
|
23
|
+
utils: {
|
|
24
|
+
getColor: GetColor;
|
|
25
|
+
getAAColorFromSwatches: GetAAColorFromSwatches;
|
|
26
|
+
getAAColor: GetAAColor;
|
|
27
|
+
};
|
|
28
|
+
};
|