mimir-ui-kit 1.18.0 → 1.19.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +62 -62
- package/dist/assets/Checkbox.css +0 -0
- package/dist/assets/Steps.css +1 -1
- package/dist/assets/Vote.css +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +23 -0
- package/dist/components/Checkbox/Checkbox.js +24 -0
- package/dist/components/Checkbox/constants.d.ts +0 -0
- package/dist/components/Checkbox/constants.js +1 -0
- package/dist/components/Checkbox/index.d.ts +1 -0
- package/dist/components/Checkbox/index.js +4 -0
- package/dist/components/Checkbox/types.d.ts +0 -0
- package/dist/components/Checkbox/types.js +1 -0
- package/dist/components/Steps/Steps.d.ts +9 -9
- package/dist/components/Steps/Steps.js +18 -34
- package/dist/components/Steps/constants.d.ts +6 -13
- package/dist/components/Steps/constants.js +9 -20
- package/dist/components/Steps/index.d.ts +2 -2
- package/dist/components/Steps/index.js +2 -3
- package/dist/components/Steps/types.d.ts +5 -1
- package/dist/components/Vote/Vote.d.ts +19 -13
- package/dist/components/Vote/Vote.js +43 -64
- package/dist/components/index.d.ts +1 -1
- package/dist/components/index.js +2 -3
- package/dist/index.js +2 -3
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,62 +1,62 @@
|
|
1
|
-
# Mimir-ui
|
2
|
-
|
3
|
-
## Установка и запуск проекта
|
4
|
-
|
5
|
-
1. Установите зависимости:
|
6
|
-
```bash
|
7
|
-
npm install
|
8
|
-
```
|
9
|
-
2. Запуск storybook
|
10
|
-
```bash
|
11
|
-
npm run storybook
|
12
|
-
```
|
13
|
-
|
14
|
-
## Сборка проекта
|
15
|
-
|
16
|
-
1. Скрипт для сборки
|
17
|
-
```bash
|
18
|
-
npm run build
|
19
|
-
```
|
20
|
-
|
21
|
-
## Создание нового компонента
|
22
|
-
|
23
|
-
```bash
|
24
|
-
npm run create-component <ComponentName>
|
25
|
-
```
|
26
|
-
|
27
|
-
## Поднятие версии для публикации на npm
|
28
|
-
|
29
|
-
Для поднятия версии пакета перед публикацией на npm используем следующие скрипты:
|
30
|
-
|
31
|
-
1. `patch`: Этот скрипт увеличивает версию пакета на один патч (например, с версии 1.0.0 до 1.0.1). Он автоматически обновляет версию в файле package.json и создает коммит с обновленной версией.
|
32
|
-
|
33
|
-
```bash
|
34
|
-
npm version patch
|
35
|
-
```
|
36
|
-
|
37
|
-
2. `minor`: Этот скрипт увеличивает версию пакета на один минорный уровень (например, с версии 1.0.0 до 1.1.0). Также обновляет версию в package.json и создает коммит.
|
38
|
-
```bash
|
39
|
-
npm version minor
|
40
|
-
```
|
41
|
-
3. `major`: Этот скрипт увеличивает версию пакета на один мажорный уровень (например, с версии 1.0.0 до 2.0.0). Он также обновляет версию в package.json и создает коммит.
|
42
|
-
```bash
|
43
|
-
npm version major
|
44
|
-
```
|
45
|
-
|
46
|
-
## Публикация на npm
|
47
|
-
|
48
|
-
1. Скрипт для публикации на npm:
|
49
|
-
```bash
|
50
|
-
npm publish
|
51
|
-
```
|
52
|
-
|
53
|
-
## Ручная Генерация иконок
|
54
|
-
|
55
|
-
1. Экспортируем с фигмы иконку.
|
56
|
-
2. Добавляем ее в папку svgs.
|
57
|
-
3. Запускаем скрипт:
|
58
|
-
```bash
|
59
|
-
npm run icons
|
60
|
-
```
|
61
|
-
4. Смотрим в папку `icons/components`
|
62
|
-
5. Готово.
|
1
|
+
# Mimir-ui
|
2
|
+
|
3
|
+
## Установка и запуск проекта
|
4
|
+
|
5
|
+
1. Установите зависимости:
|
6
|
+
```bash
|
7
|
+
npm install
|
8
|
+
```
|
9
|
+
2. Запуск storybook
|
10
|
+
```bash
|
11
|
+
npm run storybook
|
12
|
+
```
|
13
|
+
|
14
|
+
## Сборка проекта
|
15
|
+
|
16
|
+
1. Скрипт для сборки
|
17
|
+
```bash
|
18
|
+
npm run build
|
19
|
+
```
|
20
|
+
|
21
|
+
## Создание нового компонента
|
22
|
+
|
23
|
+
```bash
|
24
|
+
npm run create-component <ComponentName>
|
25
|
+
```
|
26
|
+
|
27
|
+
## Поднятие версии для публикации на npm
|
28
|
+
|
29
|
+
Для поднятия версии пакета перед публикацией на npm используем следующие скрипты:
|
30
|
+
|
31
|
+
1. `patch`: Этот скрипт увеличивает версию пакета на один патч (например, с версии 1.0.0 до 1.0.1). Он автоматически обновляет версию в файле package.json и создает коммит с обновленной версией.
|
32
|
+
|
33
|
+
```bash
|
34
|
+
npm version patch
|
35
|
+
```
|
36
|
+
|
37
|
+
2. `minor`: Этот скрипт увеличивает версию пакета на один минорный уровень (например, с версии 1.0.0 до 1.1.0). Также обновляет версию в package.json и создает коммит.
|
38
|
+
```bash
|
39
|
+
npm version minor
|
40
|
+
```
|
41
|
+
3. `major`: Этот скрипт увеличивает версию пакета на один мажорный уровень (например, с версии 1.0.0 до 2.0.0). Он также обновляет версию в package.json и создает коммит.
|
42
|
+
```bash
|
43
|
+
npm version major
|
44
|
+
```
|
45
|
+
|
46
|
+
## Публикация на npm
|
47
|
+
|
48
|
+
1. Скрипт для публикации на npm:
|
49
|
+
```bash
|
50
|
+
npm publish
|
51
|
+
```
|
52
|
+
|
53
|
+
## Ручная Генерация иконок
|
54
|
+
|
55
|
+
1. Экспортируем с фигмы иконку.
|
56
|
+
2. Добавляем ее в папку svgs.
|
57
|
+
3. Запускаем скрипт:
|
58
|
+
```bash
|
59
|
+
npm run icons
|
60
|
+
```
|
61
|
+
4. Смотрим в папку `icons/components`
|
62
|
+
5. Готово.
|
File without changes
|
package/dist/assets/Steps.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._container_1qg9i_2{display:flex;width:-webkit-max-content;width:-moz-max-content;width:max-content}._container_1qg9i_2 ._step_1qg9i_6{pointer-events:none}._container_1qg9i_2 ._step_1qg9i_6._editable_1qg9i_9{pointer-events:all}
|
package/dist/assets/Vote.css
CHANGED
@@ -1 +1 @@
|
|
1
|
-
.
|
1
|
+
._container_1akd9_2{display:flex;flex-direction:column;gap:var(--space-m);align-items:center;width:-webkit-max-content;width:-moz-max-content;width:max-content}._container_1akd9_2 ._title_1akd9_9{color:var(--black-100);font-weight:var(--font-weight-text-medium);font-size:var(--size-text-l);font-family:var(--font-inter),sans-serif;line-height:var(--line-height-text-s1)}._container_1akd9_2 ._score_1akd9_16{display:flex;align-items:center;justify-content:center;width:50px;height:50px;color:var(--white);font-weight:var(--font-weight-text-medium);font-size:var(--size-text-2xl);font-family:var(--font-montserrat),sans-serif;letter-spacing:-.03em;border-radius:50%}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
export type TProps = {
|
2
|
+
/**
|
3
|
+
* Класс, применяемый к корневому элемент
|
4
|
+
*/
|
5
|
+
rootClassName?: string;
|
6
|
+
/**
|
7
|
+
* Текст метки для чекбокса
|
8
|
+
*/
|
9
|
+
label: string;
|
10
|
+
/**
|
11
|
+
* Состояние выбранности чекбокса
|
12
|
+
*/
|
13
|
+
checked?: boolean;
|
14
|
+
/**
|
15
|
+
* Обработчик изменения состояния чекбокса
|
16
|
+
*/
|
17
|
+
onChange: () => void;
|
18
|
+
/**
|
19
|
+
* Название поля чекбокса
|
20
|
+
*/
|
21
|
+
name: string;
|
22
|
+
};
|
23
|
+
export declare const Checkbox: import('react').ForwardRefExoticComponent<TProps & import('react').RefAttributes<HTMLLabelElement>>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
2
|
+
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
|
+
import { forwardRef } from "react";
|
4
|
+
import '../../assets/Checkbox.css';const cls = {};
|
5
|
+
const Checkbox = forwardRef(
|
6
|
+
(props, ref) => {
|
7
|
+
const { rootClassName, label, checked, onChange, name } = props;
|
8
|
+
return /* @__PURE__ */ jsxs("label", { className: classNames(cls.container, rootClassName), ref, children: [
|
9
|
+
/* @__PURE__ */ jsx(
|
10
|
+
"input",
|
11
|
+
{
|
12
|
+
type: "checkbox",
|
13
|
+
checked,
|
14
|
+
onChange,
|
15
|
+
name
|
16
|
+
}
|
17
|
+
),
|
18
|
+
label
|
19
|
+
] });
|
20
|
+
}
|
21
|
+
);
|
22
|
+
export {
|
23
|
+
Checkbox
|
24
|
+
};
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
export { Checkbox } from './Checkbox';
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { EStepsPrimaryColor, EStepsSecondaryColor } from './constants';
|
2
1
|
import { TCommonStepsProps } from './types';
|
2
|
+
import { TStepsZone } from './types.ts';
|
3
3
|
|
4
4
|
export type TProps = TCommonStepsProps & {
|
5
5
|
/**
|
@@ -31,13 +31,13 @@ export type TProps = TCommonStepsProps & {
|
|
31
31
|
*/
|
32
32
|
disabled?: boolean;
|
33
33
|
/**
|
34
|
-
* Цвет
|
34
|
+
* Цвет оставшихся шагов
|
35
35
|
*/
|
36
|
-
|
36
|
+
zones?: TStepsZone[];
|
37
37
|
/**
|
38
|
-
* Цвет
|
38
|
+
* Цвет шага, если он не выбран
|
39
39
|
*/
|
40
|
-
|
40
|
+
unselectedColor?: string;
|
41
41
|
};
|
42
42
|
export declare const Steps: import('react').ForwardRefExoticComponent<TCommonStepsProps & {
|
43
43
|
/**
|
@@ -69,11 +69,11 @@ export declare const Steps: import('react').ForwardRefExoticComponent<TCommonSte
|
|
69
69
|
*/
|
70
70
|
disabled?: boolean;
|
71
71
|
/**
|
72
|
-
* Цвет
|
72
|
+
* Цвет оставшихся шагов
|
73
73
|
*/
|
74
|
-
|
74
|
+
zones?: TStepsZone[];
|
75
75
|
/**
|
76
|
-
* Цвет
|
76
|
+
* Цвет шага, если он не выбран
|
77
77
|
*/
|
78
|
-
|
78
|
+
unselectedColor?: string;
|
79
79
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
@@ -1,33 +1,15 @@
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
3
|
import { forwardRef, useId, useState, useRef, useEffect } from "react";
|
4
|
-
import { ZERO_STEP, EStepsSize,
|
4
|
+
import { ZERO_STEP, EStepsSize, ID_SEPARATOR, StepSize, DIFF_BETWEEN_STEP_AND_INDEX } from "./constants.js";
|
5
5
|
import { Icon } from "../../icons/Icon.js";
|
6
|
-
import '../../assets/Steps.css';const container = "
|
7
|
-
const step = "
|
8
|
-
const editable = "
|
9
|
-
const PRIMARY = "_PRIMARY_j31xr_12";
|
10
|
-
const GRAY = "_GRAY_j31xr_12";
|
11
|
-
const CITRINE = "_CITRINE_j31xr_15";
|
12
|
-
const SAPPHIRE = "_SAPPHIRE_j31xr_18";
|
13
|
-
const SECONDARY = "_SECONDARY_j31xr_21";
|
14
|
-
const WHITE = "_WHITE_j31xr_21";
|
15
|
-
const LIGHT_SAPPHIRE = "_LIGHT_SAPPHIRE_j31xr_24";
|
16
|
-
const LIGHT_GRAY = "_LIGHT_GRAY_j31xr_27";
|
17
|
-
const disabled = "_disabled_j31xr_27";
|
6
|
+
import '../../assets/Steps.css';const container = "_container_1qg9i_2";
|
7
|
+
const step = "_step_1qg9i_6";
|
8
|
+
const editable = "_editable_1qg9i_9";
|
18
9
|
const cls = {
|
19
10
|
container,
|
20
11
|
step,
|
21
|
-
editable
|
22
|
-
PRIMARY,
|
23
|
-
GRAY,
|
24
|
-
CITRINE,
|
25
|
-
SAPPHIRE,
|
26
|
-
SECONDARY,
|
27
|
-
WHITE,
|
28
|
-
LIGHT_SAPPHIRE,
|
29
|
-
LIGHT_GRAY,
|
30
|
-
disabled
|
12
|
+
editable
|
31
13
|
};
|
32
14
|
const Steps = forwardRef(
|
33
15
|
(props, ref) => {
|
@@ -39,9 +21,9 @@ const Steps = forwardRef(
|
|
39
21
|
editable: editable2 = false,
|
40
22
|
size = EStepsSize.M,
|
41
23
|
onClick,
|
42
|
-
disabled
|
43
|
-
|
44
|
-
|
24
|
+
disabled = false,
|
25
|
+
zones = [{ color: "#ff0000", to: quantity }],
|
26
|
+
unselectedColor = "#ffffff"
|
45
27
|
} = props;
|
46
28
|
const idPrefix = useId();
|
47
29
|
const [step2, setStep] = useState(current);
|
@@ -69,23 +51,24 @@ const Steps = forwardRef(
|
|
69
51
|
setHoveredStep(null);
|
70
52
|
};
|
71
53
|
const buttons = Array.from({ length: quantity }, (_, idx) => {
|
72
|
-
|
73
|
-
|
54
|
+
var _a, _b;
|
55
|
+
let currentZone = 0;
|
56
|
+
while (currentZone < zones.length && zones[currentZone].to <= idx) {
|
57
|
+
currentZone++;
|
58
|
+
}
|
59
|
+
const color = hoveredStep !== null && idx <= hoveredStep ? (_a = zones[currentZone]) == null ? void 0 : _a.color : step2 > idx && hoveredStep === null ? (_b = zones[currentZone]) == null ? void 0 : _b.color : unselectedColor;
|
74
60
|
return /* @__PURE__ */ jsx(
|
75
61
|
"button",
|
76
62
|
{
|
77
63
|
id: `${idPrefix}${ID_SEPARATOR}${idx}`,
|
78
64
|
className: classNames(cls.step, cls[size], stepClassName, {
|
79
|
-
[cls.editable]: editable2 && !
|
80
|
-
[cls.disabled]:
|
81
|
-
[cls[EStepsColorType.PRIMARY]]: isPrimary,
|
82
|
-
[cls[EStepsColorType.SECONDARY]]: isSecondary,
|
83
|
-
[cls[primaryColor]]: isPrimary,
|
84
|
-
[cls[secondaryColor]]: isSecondary
|
65
|
+
[cls.editable]: editable2 && !disabled,
|
66
|
+
[cls.disabled]: disabled || !editable2 && idx + 1 > step2
|
85
67
|
}),
|
86
68
|
onClick: () => handleClick(idx),
|
87
69
|
onMouseEnter: handleMouseEnter,
|
88
70
|
onMouseLeave: handleMouseLeave,
|
71
|
+
style: { color },
|
89
72
|
children: /* @__PURE__ */ jsx(Icon, { iconName: "Step", ...StepSize[size] })
|
90
73
|
},
|
91
74
|
idx
|
@@ -94,6 +77,7 @@ const Steps = forwardRef(
|
|
94
77
|
return /* @__PURE__ */ jsx("div", { className: classNames(cls.container, rootClassName), ref, children: buttons });
|
95
78
|
}
|
96
79
|
);
|
80
|
+
Steps.displayName = "Steps";
|
97
81
|
export {
|
98
82
|
Steps
|
99
83
|
};
|
@@ -25,17 +25,10 @@ export declare const StepSize: {
|
|
25
25
|
height: number;
|
26
26
|
};
|
27
27
|
};
|
28
|
-
export declare enum
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
CITRINE = "CITRINE",
|
35
|
-
SAPPHIRE = "SAPPHIRE"
|
36
|
-
}
|
37
|
-
export declare enum EStepsSecondaryColor {
|
38
|
-
LIGHT_GRAY = "LIGHT_GRAY",
|
39
|
-
LIGHT_SAPPHIRE = "LIGHT_SAPPHIRE",
|
40
|
-
WHITE = "WHITE"
|
28
|
+
export declare enum EStepColor {
|
29
|
+
ASPHALT = "#333333",
|
30
|
+
CITRINE = "#ff7900",
|
31
|
+
SAPPHIRE = "#2355d7",
|
32
|
+
GREEN = "#1b770c",
|
33
|
+
DISABLED = "#b2b2b2"
|
41
34
|
}
|
@@ -26,28 +26,17 @@ const StepSize = {
|
|
26
26
|
height: 28
|
27
27
|
}
|
28
28
|
};
|
29
|
-
var
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
EStepsPrimaryColor2["SAPPHIRE"] = "SAPPHIRE";
|
38
|
-
return EStepsPrimaryColor2;
|
39
|
-
})(EStepsPrimaryColor || {});
|
40
|
-
var EStepsSecondaryColor = /* @__PURE__ */ ((EStepsSecondaryColor2) => {
|
41
|
-
EStepsSecondaryColor2["LIGHT_GRAY"] = "LIGHT_GRAY";
|
42
|
-
EStepsSecondaryColor2["LIGHT_SAPPHIRE"] = "LIGHT_SAPPHIRE";
|
43
|
-
EStepsSecondaryColor2["WHITE"] = "WHITE";
|
44
|
-
return EStepsSecondaryColor2;
|
45
|
-
})(EStepsSecondaryColor || {});
|
29
|
+
var EStepColor = /* @__PURE__ */ ((EStepColor2) => {
|
30
|
+
EStepColor2["ASPHALT"] = "#333333";
|
31
|
+
EStepColor2["CITRINE"] = "#ff7900";
|
32
|
+
EStepColor2["SAPPHIRE"] = "#2355d7";
|
33
|
+
EStepColor2["GREEN"] = "#1b770c";
|
34
|
+
EStepColor2["DISABLED"] = "#b2b2b2";
|
35
|
+
return EStepColor2;
|
36
|
+
})(EStepColor || {});
|
46
37
|
export {
|
47
38
|
DIFF_BETWEEN_STEP_AND_INDEX,
|
48
|
-
|
49
|
-
EStepsPrimaryColor,
|
50
|
-
EStepsSecondaryColor,
|
39
|
+
EStepColor,
|
51
40
|
EStepsSize,
|
52
41
|
ID_SEPARATOR,
|
53
42
|
StepSize,
|
@@ -1,3 +1,3 @@
|
|
1
1
|
export { Steps } from './Steps';
|
2
|
-
export {
|
3
|
-
export type { TCommonStepsProps } from './types';
|
2
|
+
export { EStepColor, EStepsSize } from './constants';
|
3
|
+
export type { TCommonStepsProps, TStepsZone } from './types';
|
@@ -1,8 +1,7 @@
|
|
1
1
|
import { Steps } from "./Steps.js";
|
2
|
-
import {
|
2
|
+
import { EStepColor, EStepsSize } from "./constants.js";
|
3
3
|
export {
|
4
|
-
|
5
|
-
EStepsSecondaryColor,
|
4
|
+
EStepColor,
|
6
5
|
EStepsSize,
|
7
6
|
Steps
|
8
7
|
};
|
@@ -1,6 +1,10 @@
|
|
1
|
-
import { EStepsSize } from './constants';
|
1
|
+
import { EStepColor, EStepsSize } from './constants';
|
2
2
|
|
3
3
|
export type TSize = `${EStepsSize}` | EStepsSize;
|
4
4
|
export type TCommonStepsProps = {
|
5
5
|
size?: TSize;
|
6
6
|
};
|
7
|
+
export type TStepsZone = {
|
8
|
+
color: EStepColor | string;
|
9
|
+
to: number;
|
10
|
+
};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { TCommonVoteProps } from './types';
|
2
|
-
import {
|
2
|
+
import { TStepsZone } from '../Steps/types.ts';
|
3
3
|
|
4
4
|
export type TProps = TCommonVoteProps & {
|
5
5
|
/**
|
@@ -47,17 +47,20 @@ export type TProps = TCommonVoteProps & {
|
|
47
47
|
*/
|
48
48
|
disabled?: boolean;
|
49
49
|
/**
|
50
|
-
*
|
50
|
+
* Зоны для рахделения шагов по цветам
|
51
51
|
*/
|
52
|
-
|
52
|
+
zones?: TStepsZone[];
|
53
53
|
/**
|
54
|
-
* Цвет
|
54
|
+
* Цвет круга шага с баллом, если оценка не установлена и шага, если он не выбран
|
55
55
|
*/
|
56
|
-
|
56
|
+
unselectedColor?: string;
|
57
57
|
/**
|
58
|
-
*
|
58
|
+
* Цвет текста в круге с баллом
|
59
59
|
*/
|
60
|
-
|
60
|
+
scoreTextColor?: {
|
61
|
+
unselected: string;
|
62
|
+
selected: string;
|
63
|
+
};
|
61
64
|
};
|
62
65
|
export declare const Vote: import('react').ForwardRefExoticComponent<TCommonVoteProps & {
|
63
66
|
/**
|
@@ -105,15 +108,18 @@ export declare const Vote: import('react').ForwardRefExoticComponent<TCommonVote
|
|
105
108
|
*/
|
106
109
|
disabled?: boolean;
|
107
110
|
/**
|
108
|
-
*
|
111
|
+
* Зоны для рахделения шагов по цветам
|
109
112
|
*/
|
110
|
-
|
113
|
+
zones?: TStepsZone[];
|
111
114
|
/**
|
112
|
-
* Цвет
|
115
|
+
* Цвет круга шага с баллом, если оценка не установлена и шага, если он не выбран
|
113
116
|
*/
|
114
|
-
|
117
|
+
unselectedColor?: string;
|
115
118
|
/**
|
116
|
-
*
|
119
|
+
* Цвет текста в круге с баллом
|
117
120
|
*/
|
118
|
-
|
121
|
+
scoreTextColor?: {
|
122
|
+
unselected: string;
|
123
|
+
selected: string;
|
124
|
+
};
|
119
125
|
} & import('react').RefAttributes<HTMLDivElement>>;
|
@@ -1,32 +1,19 @@
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
2
2
|
import { c as classNames } from "../../index-CweZ_OcN.js";
|
3
3
|
import { forwardRef, useState, useEffect } from "react";
|
4
|
-
import { DEFAULT_TITLE, EVoteSize,
|
5
|
-
import { ZERO_STEP, EStepsPrimaryColor, EStepsSecondaryColor } from "../Steps/constants.js";
|
4
|
+
import { DEFAULT_TITLE, EVoteSize, ZERO_VALUE } from "./constants.js";
|
6
5
|
import { Steps } from "../Steps/Steps.js";
|
7
|
-
import
|
8
|
-
const
|
9
|
-
const
|
10
|
-
const
|
11
|
-
const LIGHT_GRAY = "_LIGHT_GRAY_4roqw_29";
|
12
|
-
const WHITE = "_WHITE_4roqw_32";
|
13
|
-
const LIGHT_SAPPHIRE = "_LIGHT_SAPPHIRE_4roqw_36";
|
14
|
-
const GRAY = "_GRAY_4roqw_39";
|
15
|
-
const CITRINE = "_CITRINE_4roqw_42";
|
16
|
-
const SAPPHIRE = "_SAPPHIRE_4roqw_45";
|
6
|
+
import { ZERO_STEP } from "../Steps/constants.js";
|
7
|
+
import '../../assets/Vote.css';const container = "_container_1akd9_2";
|
8
|
+
const title = "_title_1akd9_9";
|
9
|
+
const score = "_score_1akd9_16";
|
17
10
|
const cls = {
|
18
11
|
container,
|
19
12
|
title,
|
20
|
-
score
|
21
|
-
zero,
|
22
|
-
LIGHT_GRAY,
|
23
|
-
WHITE,
|
24
|
-
LIGHT_SAPPHIRE,
|
25
|
-
GRAY,
|
26
|
-
CITRINE,
|
27
|
-
SAPPHIRE
|
13
|
+
score
|
28
14
|
};
|
29
15
|
const Vote = forwardRef((props, ref) => {
|
16
|
+
var _a;
|
30
17
|
const {
|
31
18
|
rootClassName,
|
32
19
|
titleClassName,
|
@@ -40,12 +27,14 @@ const Vote = forwardRef((props, ref) => {
|
|
40
27
|
size = EVoteSize.M,
|
41
28
|
onClick,
|
42
29
|
disabled = false,
|
43
|
-
|
44
|
-
|
45
|
-
|
30
|
+
zones = [{ color: "#ff0000", to: quantity }],
|
31
|
+
unselectedColor = "#ffffff",
|
32
|
+
scoreTextColor = {
|
33
|
+
unselected: "#000000",
|
34
|
+
selected: "#ffffff"
|
35
|
+
}
|
46
36
|
} = props;
|
47
37
|
const [score2, setScore] = useState(current);
|
48
|
-
const [color, setColor] = useState(primaryColor);
|
49
38
|
const isZeroStep = score2 === ZERO_STEP;
|
50
39
|
useEffect(() => {
|
51
40
|
setScore(current);
|
@@ -54,46 +43,36 @@ const Vote = forwardRef((props, ref) => {
|
|
54
43
|
setScore(step);
|
55
44
|
onClick && onClick(step);
|
56
45
|
};
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
editable: true,
|
88
|
-
disabled,
|
89
|
-
onClick: handleStepsClick,
|
90
|
-
primaryColor: color,
|
91
|
-
secondaryColor
|
92
|
-
}
|
93
|
-
)
|
94
|
-
]
|
95
|
-
}
|
96
|
-
);
|
46
|
+
const backgroundColor = isZeroStep ? unselectedColor : ((_a = zones == null ? void 0 : zones.find((zone) => score2 <= zone.to)) == null ? void 0 : _a.color) || unselectedColor;
|
47
|
+
return /* @__PURE__ */ jsxs("div", { className: classNames(cls.container, rootClassName), ref, children: [
|
48
|
+
!withoutTitle && /* @__PURE__ */ jsx("p", { className: classNames(cls.title, titleClassName), children: title2 }),
|
49
|
+
/* @__PURE__ */ jsx(
|
50
|
+
"div",
|
51
|
+
{
|
52
|
+
className: classNames(cls.score, scoreClassName),
|
53
|
+
style: {
|
54
|
+
backgroundColor,
|
55
|
+
color: isZeroStep ? scoreTextColor.unselected : scoreTextColor.selected
|
56
|
+
},
|
57
|
+
children: isZeroStep ? ZERO_VALUE : score2
|
58
|
+
}
|
59
|
+
),
|
60
|
+
/* @__PURE__ */ jsx(
|
61
|
+
Steps,
|
62
|
+
{
|
63
|
+
rootClassName: stepsRootClassName,
|
64
|
+
stepClassName: stepsStepClassName,
|
65
|
+
quantity,
|
66
|
+
size,
|
67
|
+
current: score2,
|
68
|
+
editable: true,
|
69
|
+
disabled,
|
70
|
+
onClick: handleStepsClick,
|
71
|
+
zones,
|
72
|
+
unselectedColor
|
73
|
+
}
|
74
|
+
)
|
75
|
+
] });
|
97
76
|
});
|
98
77
|
export {
|
99
78
|
Vote
|
@@ -19,7 +19,7 @@ export { Loader } from './Loader';
|
|
19
19
|
export { Slider } from './Slider';
|
20
20
|
export { Drawer } from './Drawer';
|
21
21
|
export { EDrawerPosition } from './Drawer';
|
22
|
-
export { Steps,
|
22
|
+
export { Steps, EStepsSize, EStepColor, type TCommonStepsProps } from './Steps';
|
23
23
|
export { Vote, EVoteSize, type TCommonVoteProps } from './Vote';
|
24
24
|
export { SelectSearch, ESelectSearchSize } from './SelectSearch';
|
25
25
|
export type { TSelectSearchProps, TSelectOption } from './SelectSearch';
|
package/dist/components/index.js
CHANGED
@@ -17,7 +17,7 @@ import { Slider } from "./Slider/Slider.js";
|
|
17
17
|
import { Drawer } from "./Drawer/Drawer.js";
|
18
18
|
import { EDrawerPosition } from "./Drawer/constants.js";
|
19
19
|
import { Steps } from "./Steps/Steps.js";
|
20
|
-
import {
|
20
|
+
import { EStepColor, EStepsSize } from "./Steps/constants.js";
|
21
21
|
import { Vote } from "./Vote/Vote.js";
|
22
22
|
import { EVoteSize } from "./Vote/constants.js";
|
23
23
|
import { SelectSearch } from "./SelectSearch/SelectSearch.js";
|
@@ -61,8 +61,7 @@ export {
|
|
61
61
|
EMergedButtonVariantRound,
|
62
62
|
ENotificationBadgeSize,
|
63
63
|
ESelectSearchSize,
|
64
|
-
|
65
|
-
EStepsSecondaryColor,
|
64
|
+
EStepColor,
|
66
65
|
EStepsSize,
|
67
66
|
ETabTrailSize,
|
68
67
|
ETagSize,
|
package/dist/index.js
CHANGED
@@ -17,7 +17,7 @@ import { Slider } from "./components/Slider/Slider.js";
|
|
17
17
|
import { Drawer } from "./components/Drawer/Drawer.js";
|
18
18
|
import { EDrawerPosition } from "./components/Drawer/constants.js";
|
19
19
|
import { Steps } from "./components/Steps/Steps.js";
|
20
|
-
import {
|
20
|
+
import { EStepColor, EStepsSize } from "./components/Steps/constants.js";
|
21
21
|
import { Vote } from "./components/Vote/Vote.js";
|
22
22
|
import { EVoteSize } from "./components/Vote/constants.js";
|
23
23
|
import { SelectSearch } from "./components/SelectSearch/SelectSearch.js";
|
@@ -72,8 +72,7 @@ import './assets/index.css';export {
|
|
72
72
|
EMinMediaQuery,
|
73
73
|
ENotificationBadgeSize,
|
74
74
|
ESelectSearchSize,
|
75
|
-
|
76
|
-
EStepsSecondaryColor,
|
75
|
+
EStepColor,
|
77
76
|
EStepsSize,
|
78
77
|
ETabTrailSize,
|
79
78
|
ETagSize,
|