@via-profit/ui-kit 0.1.0-rc.10 → 0.1.0-rc.11

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.
@@ -22,9 +22,7 @@ const Button = (0, styled_1.default)(ButtonBase_1.default) `
22
22
  color: ${({ theme, disabled }) => disabled
23
23
  ? theme.colors.textPrimary.alpha(0.4).toString()
24
24
  : theme.colors.accentPrimaryContrast.toString()};
25
- background-color: ${({ theme, disabled }) => disabled
26
- ? theme.colors.backgroundGrey.darken(30).toString()
27
- : theme.colors.accentPrimary.toString()};
25
+ background-color: ${({ theme, disabled }) => disabled ? theme.colors.surface.darken(30).toString() : theme.colors.accentPrimary.toString()};
28
26
 
29
27
  ${({ disabled, theme }) => !disabled &&
30
28
  (0, react_2.css) `
@@ -5,4 +5,8 @@ declare module '@via-profit/ui-kit/Button/ButtonBase' {
5
5
  readonly startIcon?: JSX.Element;
6
6
  readonly endIcon?: JSX.Element;
7
7
  }
8
+
9
+ const ButtonBase: React.FC<ButtonBaseProps>;
10
+
11
+ export default ButtonBase;
8
12
  }
@@ -26,19 +26,19 @@ const StyledButtonBase = (0, styled_1.default)(ButtonBase_1.default) `
26
26
  ? theme.colors.textPrimary.alpha(0.4).toString()
27
27
  : theme.colors.textPrimary.toString()};
28
28
  background-color: ${({ theme, disabled }) => disabled
29
- ? theme.colors.backgroundGrey.darken(10).toString()
29
+ ? theme.colors.surface.darken(10).toString()
30
30
  : theme.isDark
31
- ? theme.colors.backgroundPrimary.lighten(20).toString()
32
- : theme.colors.backgroundPrimary.toString()};
31
+ ? theme.colors.surface.toString()
32
+ : theme.colors.surface.toString()};
33
33
 
34
34
  ${({ disabled, theme }) => !disabled &&
35
35
  (0, react_2.css) `
36
- box-shadow: 0 2px 12px ${theme.colors.backgroundPrimary.darken(40).alpha(0.6).toString()};
36
+ box-shadow: 0 2px 12px ${theme.colors.surface.darken(40).alpha(0.6).toString()};
37
37
  &:hover {
38
- background-color: ${theme.colors.backgroundPrimary.darken(20).toString()};
38
+ background-color: ${theme.colors.surface.darken(20).toString()};
39
39
  }
40
40
  &:active {
41
- background-color: ${theme.colors.backgroundPrimary.darken(40).toString()};
41
+ background-color: ${theme.colors.surface.darken(40).toString()};
42
42
  }
43
43
  &:focus-visible {
44
44
  outline: 2px solid ${theme.colors.accentPrimary.toString()};
package/Button/index.d.ts CHANGED
@@ -7,4 +7,8 @@ declare module '@via-profit/ui-kit/Button' {
7
7
  }
8
8
 
9
9
  export type ButtonProps = (ButtonStandardProps | ButtonAccentProps) & BaseProps;
10
+
11
+ const Button: React.FC<ButtonProps>;
12
+
13
+ export default Button;
10
14
  }
@@ -28,9 +28,7 @@ const Btn = styled_1.default.button `
28
28
  outline: none;
29
29
  cursor: ${({ $isDisabled }) => ($isDisabled ? 'default' : 'pointer')};
30
30
  border: 1px solid transparent;
31
- background-color: ${({ theme, $isSelected }) => $isSelected
32
- ? theme.colors.accentPrimary.toString()
33
- : theme.colors.backgroundPrimary.toString()};
31
+ background-color: ${({ theme, $isSelected }) => $isSelected ? theme.colors.accentPrimary.toString() : theme.colors.surface.toString()};
34
32
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
35
33
  color: ${({ $isToday, theme, $isSelected, $isDisabled }) => {
36
34
  if ($isDisabled) {
@@ -46,8 +44,8 @@ const Btn = styled_1.default.button `
46
44
  }};
47
45
  &:hover {
48
46
  background-color: ${({ theme, $isSelected }) => $isSelected
49
- ? theme.colors.accentPrimary.darken(0.1).toString()
50
- : theme.colors.backgroundPrimary.darken(0.1).toString()};
47
+ ? theme.colors.accentPrimary.darken(10).toString()
48
+ : theme.colors.surface.darken(10).toString()};
51
49
  }
52
50
  &:focus-visible {
53
51
  border-color: ${({ theme, $isDisabled }) => $isDisabled ? 'transparent' : theme.colors.accentPrimary.toString()};
@@ -31,11 +31,11 @@ const Btn = styled_1.default.button `
31
31
  outline: none;
32
32
  cursor: pointer;
33
33
  border: 1px solid transparent;
34
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
34
+ background-color: ${({ theme }) => theme.colors.surface.toString()};
35
35
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 3}em;
36
36
  color: ${({ theme }) => theme.colors.textPrimary.toString()};
37
37
  &:hover {
38
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.1).toString()};
38
+ background-color: ${({ theme }) => theme.colors.surface.darken(0.1).toString()};
39
39
  }
40
40
  &:focus-visible {
41
41
  border-color: ${({ theme }) => theme.colors.accentPrimary.toString()};
@@ -9,12 +9,11 @@ const CalendarPaper = styled_1.default.div `
9
9
  display: flex;
10
10
  flex-direction: column;
11
11
  justify-content: stretch;
12
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
12
+ background-color: ${({ theme }) => theme.colors.surface.toString()};
13
13
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 1}em;
14
14
  padding: 0.4em;
15
15
  max-width: 17.6em;
16
16
  max-height: 20.4em;
17
- box-shadow: 0 4px 24px
18
- ${({ theme }) => theme.colors.backgroundPrimary.darken(0.5).alpha(0.6).toString()};
17
+ box-shadow: 0 4px 24px ${({ theme }) => theme.colors.surface.darken(50).alpha(0.6).toString()};
19
18
  `;
20
19
  exports.default = CalendarPaper;
@@ -1,4 +1,4 @@
1
- declare module '@via-profit/ui-kit/color' {
1
+ declare module '@via-profit/ui-kit/Color' {
2
2
  export type ParsedColor = {
3
3
  r: number;
4
4
  g: number;
@@ -30,7 +30,7 @@ const InnerContainer = styled_1.default.div `
30
30
  return theme.colors.accentPrimary.toString();
31
31
  }
32
32
  if (hovered) {
33
- return theme.colors.backgroundGrey.darken(0.04).toString();
33
+ return theme.colors.surface.darken(40).toString();
34
34
  }
35
35
  return 'inherit';
36
36
  }};
@@ -25,10 +25,9 @@ const StyledMenuWrapper = styled_1.default.div `
25
25
  transition: visibility 120ms ease-out, opacity 120ms ease-out;
26
26
  opacity: ${props => (props.$isOpen ? 1 : 0)};
27
27
  visibility: ${props => (props.$isOpen ? 'visible' : 'hidden')};
28
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.toString()};
28
+ background-color: ${({ theme }) => theme.colors.surface.toString()};
29
29
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
30
- box-shadow: 0 4px 24px
31
- ${({ theme }) => theme.colors.backgroundPrimary.darken(0.5).alpha(0.6).toString()};
30
+ box-shadow: 0 4px 24px ${({ theme }) => theme.colors.surface.darken(50).alpha(0.6).toString()};
32
31
  &:focus {
33
32
  outline: none;
34
33
  }
@@ -43,14 +42,14 @@ const StyledMenuWrapper = styled_1.default.div `
43
42
 
44
43
  & ::-webkit-scrollbar-track {
45
44
  background: ${({ theme }) => theme.isDark
46
- ? theme.colors.backgroundPrimary.darken(0.1).toString()
47
- : theme.colors.backgroundPrimary.darken(0.05).toString()};
45
+ ? theme.colors.backgroundPrimary.darken(10).toString()
46
+ : theme.colors.backgroundPrimary.darken(5).toString()};
48
47
  }
49
48
 
50
49
  & ::-webkit-scrollbar-thumb {
51
50
  background: ${({ theme }) => theme.isDark
52
- ? theme.colors.backgroundSecondary.lighten(0.3).toString()
53
- : theme.colors.backgroundSecondary.darken(0.3).toString()};
51
+ ? theme.colors.backgroundSecondary.lighten(30).toString()
52
+ : theme.colors.backgroundSecondary.darken(30).toString()};
54
53
  border-radius: 0.3rem;
55
54
  }
56
55
 
@@ -127,7 +127,7 @@ const ModalConfirmBox = (props, ref) => {
127
127
  overflow: auto;
128
128
  -webkit-overflow-scrolling: touch;
129
129
  outline: none;
130
- background: ${theme.colors.backgroundPrimary.toString()};
130
+ background: ${theme.colors.surface.toString()};
131
131
  border-radius: 1em;
132
132
  transform: translate(-50%, -40%);
133
133
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -78,7 +78,7 @@ const ModalDialog = (props, ref) => {
78
78
  overflow: auto;
79
79
  -webkit-overflow-scrolling: touch;
80
80
  outline: none;
81
- background: ${theme.colors.backgroundPrimary.toString()};
81
+ background: ${theme.colors.surface.toString()};
82
82
  border-radius: 1em;
83
83
  transform: translate(-50%, -40%);
84
84
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -131,7 +131,7 @@ const ModalDrawer = (props, ref) => {
131
131
  overflow: auto;
132
132
  -webkit-overflow-scrolling: touch;
133
133
  outline: none;
134
- background: ${theme.colors.backgroundPrimary.toString()};
134
+ background: ${theme.colors.surface.toString()};
135
135
  border-radius: 1em 1em 0 0;
136
136
  transform: translate(0, 100%);
137
137
  transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1) 0ms;
@@ -126,7 +126,7 @@ const ModalMessageBox = (props, ref) => {
126
126
  overflow: auto;
127
127
  -webkit-overflow-scrolling: touch;
128
128
  outline: none;
129
- background: ${theme.colors.backgroundPrimary.toString()};
129
+ background: ${theme.colors.surface.toString()};
130
130
  border-radius: 1em;
131
131
  transform: translate(-50%, -40%);
132
132
  transition: transform 100ms ease-in-out, opacity 100ms ease-in-out;
@@ -28,7 +28,7 @@ const react_1 = require("@emotion/react");
28
28
  const UnknownFlag = (props, ref) => {
29
29
  const { colors } = (0, react_1.useTheme)();
30
30
  return (React.createElement("svg", Object.assign({ xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 512 512", ref: ref }, props),
31
- React.createElement("path", { transform: "translate(78.682 31.951)", d: "m-78.682-31.951h512v512h-512z", fill: colors.backgroundPrimary.toString(), strokeLinejoin: "round", strokeWidth: "2.176" }),
31
+ React.createElement("path", { transform: "translate(78.682 31.951)", d: "m-78.682-31.951h512v512h-512z", fill: colors.surface.toString(), strokeLinejoin: "round", strokeWidth: "2.176" }),
32
32
  React.createElement("path", { transform: "translate(78.682 31.951)", d: "m177.32 288.09q-4.915 0-8.0953-3.1803-3.1803-3.4694-3.1803-8.3844 0-11.854 5.7824-25.153 5.7823-13.299 15.612-22.551l7.2279-6.6497q9.83-9.2518 15.323-15.323 5.4932-6.3606 8.9626-15.034 3.7585-8.9626 3.7585-20.527 0-11.276-5.4932-20.527-5.4932-9.5409-15.612-15.034-10.119-5.4932-23.129-5.4932-21.395 0-34.116 13.01-12.432 12.721-12.432 33.248 0 4.915-3.1803 8.0953-2.8912 2.8912-7.8062 2.8912t-8.0953-2.8912q-3.1803-3.1803-3.1803-8.0953 0-19.66 8.6735-34.983 8.6735-15.323 24.286-23.997 15.612-8.6735 35.851-8.6735 19.082 0 34.116 8.3844 15.323 8.0953 23.708 22.551 8.6735 14.456 8.6735 32.67 0 14.167-4.6259 24.864-4.6259 10.408-11.854 18.503-6.9388 8.0953-19.949 19.949l-5.2041 4.6259q-8.0953 7.2279-11.565 17.058-3.1803 9.5409-3.1803 19.082 0 4.915-3.1803 8.3844-3.1803 3.1803-8.0953 3.1803zm0 51.174q-7.2279 0-12.143-4.915-4.6259-4.915-4.6259-11.854 0-7.2279 4.915-12.143 4.915-4.915 11.854-4.915t11.854 4.915q5.2041 4.915 5.2041 12.143 0 6.9388-5.2041 11.854-4.915 4.915-11.854 4.915z", fill: colors.textPrimary.toString(), strokeWidth: ".72279" })));
33
33
  };
34
34
  exports.default = React.forwardRef(UnknownFlag);
package/README.md CHANGED
@@ -1,17 +1,50 @@
1
+ ## Установка.
1
2
 
3
+ для работы требуются следующие модули:
4
+
5
+ - react
6
+ - react-dom
7
+ - @emotion/styled - CSS In JS
8
+ - @emotion/react - CSS In JS React
9
+ - react-modal - Мобальные окна и дроверы
10
+ - react-popper - Выпадающие меню
11
+ - react-window - Виртуализированный список
2
12
 
3
13
  ```bash
4
14
  $ npm install @emotion/react @emotion/styled react react-dom react-modal react-popper react-window
5
15
 
6
16
  ```
7
17
 
8
- _@types/emotion.d.ts_
18
+ ## Темы
9
19
 
10
- ```ts
11
- import { UITheme } from '@via-profit/ui-kit';
20
+ Для переопределения темы оформления в пакете `@emotion/styled` создайте, например в директории `@types`, файл `emotion.d.ts` со следующим содержимым:
12
21
 
22
+ ```ts
13
23
  declare module '@emotion/react' {
24
+ import { UITheme } from '@via-profit/ui-kit';
25
+
14
26
  export interface Theme extends UITheme {}
15
27
  }
28
+ ```
29
+
30
+ Для переопределения темы оформления в пакете `@via-profit/ui-kit` создайте, например в директории `@types`, файл `ui-kit.d.ts` со следующим содержимым:
16
31
 
17
- ```
32
+ _@types/emotion.d.ts_
33
+
34
+ ```ts
35
+ declare module '@via-profit/ui-kit' {
36
+ import {
37
+ UIThemeOverrideColor as Colors,
38
+ UIThemeOverrideZIndex as ZIndexes,
39
+ } from '@via-profit/ui-kit';
40
+
41
+ export interface UIThemeOverrideColor extends Colors {
42
+ readonly drawer: string;
43
+ readonly drawerContrast: string;
44
+ }
45
+
46
+ export interface UIThemeOverrideZIndex extends ZIndexes {
47
+ readonly notifications: number;
48
+ }
49
+ }
50
+ ```
@@ -35,14 +35,12 @@ const StyledButton = styled_1.default.button `
35
35
  max-width: ${({ $fullWidth }) => ($fullWidth ? '100%' : '16em')};
36
36
  border: 1px solid;
37
37
  border-radius: ${({ theme }) => theme.shape.radiusFactor * 2}em;
38
- border-color: ${({ theme }) => theme.isDark
39
- ? theme.colors.backgroundPrimary.lighten(1.4).toString()
40
- : theme.colors.backgroundPrimary.darken(0.4).toString()};
38
+ border-color: ${({ theme }) => theme.colors.surface.toString()};
41
39
  &:hover {
42
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.05).toString()};
40
+ background-color: ${({ theme }) => theme.colors.surface.darken(5).toString()};
43
41
  }
44
42
  &:active {
45
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.1).toString()};
43
+ background-color: ${({ theme }) => theme.colors.surface.darken(10).toString()};
46
44
  }
47
45
  &:focus-visible {
48
46
  outline: 2px solid ${({ theme }) => theme.colors.accentPrimary.toString()};
@@ -51,14 +51,14 @@ const Wrapper = styled_1.default.div `
51
51
  : theme.colors.textPrimary.lighten(150).toString()};
52
52
  width: ${({ $fullWidth }) => ($fullWidth ? '100%' : 'auto')};
53
53
  font-size: 0.9em;
54
- background-color: ${({ theme }) => theme.colors.backgroundPrimary.darken(0.02).toString()};
54
+ background-color: ${({ theme }) => theme.colors.surface.darken(20).toString()};
55
55
  color: ${({ theme }) => theme.colors.textPrimary.toString()};
56
56
  transition: all 180ms ease-out 0s;
57
57
 
58
58
  ${props => props.$focused &&
59
59
  (0, react_1.css) `
60
- border-color: ${props.theme.colors.accentPrimary.lighten(0.5).toString()};
61
- outline-color: ${props.theme.colors.accentPrimary.lighten(0.5).toString()};
60
+ border-color: ${props.theme.colors.accentPrimary.lighten(10).toString()};
61
+ outline-color: ${props.theme.colors.accentPrimary.lighten(10).toString()};
62
62
  `};
63
63
  ${props => props.$error &&
64
64
  (0, react_1.css) `
@@ -14,15 +14,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- const color_1 = __importDefault(require("../color"));
17
+ const Color_1 = __importDefault(require("../Color"));
18
18
  const createTheme = overrides => {
19
19
  const _a = overrides || {}, { isDark, fontSize, zIndex, colors, shape } = _a, rest = __rest(_a, ["isDark", "fontSize", "zIndex", "colors", "shape"]);
20
20
  const theme = Object.assign(Object.assign({}, rest), { isDark: typeof isDark === 'boolean' ? isDark : false, fontSize: Object.assign({ small: 14, normal: 16, medium: 18, large: 20 }, fontSize), zIndex: Object.assign({ header: 8, mainDrawer: 9, modal: 10 }, zIndex), colors: {}, shape: Object.assign({ radiusFactor: 0.5 }, shape) });
21
21
  const defaultColors = {
22
22
  backgroundPrimary: '#FFFFFF',
23
23
  backgroundSecondary: '#F9F9F9',
24
- backgroundGrey: '#F4F6FA',
25
24
  textPrimary: '#212121',
25
+ surface: '#FFFFFF',
26
26
  textSecondary: '#343434',
27
27
  accentPrimary: '#FFA800',
28
28
  accentPrimaryContrast: '#FFFFFF',
@@ -31,9 +31,9 @@ const createTheme = overrides => {
31
31
  error: '#ff2b2b',
32
32
  };
33
33
  Object.entries(Object.assign(Object.assign({}, defaultColors), colors)).forEach(([colorName, colorValue]) => {
34
- theme.colors[colorName] = new color_1.default(colorValue);
34
+ theme.colors[colorName] = new Color_1.default(colorValue);
35
35
  });
36
- theme.colors.test = new color_1.default('red');
36
+ theme.colors.test = new Color_1.default('red');
37
37
  return theme;
38
38
  };
39
39
  exports.default = createTheme;
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  declare module '@via-profit/ui-kit' {
2
- import type { ColorInterface } from '@via-profit/ui-kit/color';
2
+ import { ColorInterface } from '@via-profit/ui-kit/color';
3
3
 
4
4
  export interface UITheme {
5
5
  readonly isDark: boolean;
@@ -12,7 +12,7 @@ declare module '@via-profit/ui-kit' {
12
12
  export interface UIThemeOverrideColor {
13
13
  readonly backgroundPrimary: string;
14
14
  readonly backgroundSecondary: string;
15
- readonly backgroundGrey: string;
15
+ readonly surface: string;
16
16
  readonly textPrimary: string;
17
17
  readonly textSecondary: string;
18
18
  readonly accentPrimary: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@via-profit/ui-kit",
3
- "version": "0.1.0-rc.10",
3
+ "version": "0.1.0-rc.11",
4
4
  "description": "UI Kit",
5
5
  "repository": {
6
6
  "type": "git",
File without changes
File without changes