@expressms/smartapp-ui 2.2.5 → 2.2.6
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/build/main/assets/icons/arrow-down.svg +3 -0
- package/build/main/assets/icons/arrow-up.svg +3 -0
- package/build/main/assets/storybook/index.d.ts +1 -0
- package/build/main/assets/storybook/index.js +1 -0
- package/build/main/assets/storybook/index.js.map +1 -1
- package/build/main/constants/constants.d.ts +10 -0
- package/build/main/constants/constants.js +12 -0
- package/build/main/constants/constants.js.map +1 -1
- package/build/main/helpers/index.d.ts +1 -1
- package/build/main/helpers/index.js +2 -2
- package/build/main/helpers/index.js.map +1 -1
- package/build/main/styles/styles.scss +2 -2
- package/build/main//321/201omponents/CustomSelect/CustomSelect.d.ts +1 -1
- package/build/main//321/201omponents/CustomSelect/CustomSelect.js +64 -20
- package/build/main//321/201omponents/CustomSelect/CustomSelect.js.map +1 -1
- package/build/main//321/201omponents/CustomSelect/colors.d.ts +16 -0
- package/build/main//321/201omponents/CustomSelect/colors.js +17 -0
- package/build/main//321/201omponents/CustomSelect/colors.js.map +1 -0
- package/build/main//321/201omponents/CustomSelect/selectStyles.d.ts +14 -0
- package/build/main//321/201omponents/CustomSelect/selectStyles.js +51 -0
- package/build/main//321/201omponents/CustomSelect/selectStyles.js.map +1 -0
- package/build/main//321/201omponents/CustomSelect/types.d.ts +38 -6
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.d.ts +2 -2
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.js +6 -6
- package/build/main//321/201omponents/CustomSelectProfiles/CustomSelectProfiles.js.map +1 -1
- package/build/main//321/201omponents/ListItem/ListItem.d.ts +23 -0
- package/build/main//321/201omponents/ListItem/ListItem.js +195 -0
- package/build/main//321/201omponents/ListItem/ListItem.js.map +1 -0
- package/build/main//321/201omponents/ListItem/index.d.ts +1 -0
- package/build/main//321/201omponents/ListItem/index.js +2 -0
- package/build/main//321/201omponents/ListItem/index.js.map +1 -0
- package/build/main//321/201omponents/ListItem/types.d.ts +37 -0
- package/build/main//321/201omponents/ListItem/types.js.map +1 -0
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.js +16 -6
- package/build/main//321/201omponents/UserDropdown/MultiValueLabel/MultiValueLabel.js.map +1 -1
- package/build/main//321/201omponents/UserDropdown/UserDropdown.js +2 -3
- package/build/main//321/201omponents/UserDropdown/UserDropdown.js.map +1 -1
- package/build/main//321/201omponents/index.d.ts +1 -1
- package/build/main//321/201omponents/index.js +1 -1
- package/build/main//321/201omponents/index.js.map +1 -1
- package/package.json +1 -1
- package/build/main/assets/icons/ellipse.svg +0 -3
- package/build/main//321/201omponents/CustomSelectPriority/CustomSelectPriority.d.ts +0 -4
- package/build/main//321/201omponents/CustomSelectPriority/CustomSelectPriority.js +0 -60
- package/build/main//321/201omponents/CustomSelectPriority/CustomSelectPriority.js.map +0 -1
- package/build/main//321/201omponents/CustomSelectPriority/index.d.ts +0 -1
- package/build/main//321/201omponents/CustomSelectPriority/index.js +0 -2
- package/build/main//321/201omponents/CustomSelectPriority/index.js.map +0 -1
- package/build/main//321/201omponents/CustomSelectPriority/types.d.ts +0 -13
- package/build/main//321/201omponents/CustomSelectPriority/types.js.map +0 -1
- /package/build/main//321/201omponents/{CustomSelectPriority → ListItem}/types.js" +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ICustomSelectProps } from './types';
|
|
2
2
|
import '../../styles/styles.scss';
|
|
3
|
-
declare const CustomSelect: ({
|
|
3
|
+
declare const CustomSelect: ({ theme, isSearchable, isDisabled, fillType, width, menuListMaxHeight, title, placeholder, hint, noOptionsMessage, error, menuPosition, defaultValue, options, onChange, }: ICustomSelectProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
export default CustomSelect;
|
|
@@ -9,30 +9,74 @@ var __assign = (this && this.__assign) || function () {
|
|
|
9
9
|
};
|
|
10
10
|
return __assign.apply(this, arguments);
|
|
11
11
|
};
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useEffect, useLayoutEffect, useRef, useState } from 'react';
|
|
14
|
+
import Select, { components } from 'react-select';
|
|
15
|
+
import { isEmpty, max } from 'lodash';
|
|
16
|
+
import classNames from 'classnames';
|
|
17
|
+
import ListItem from '../ListItem';
|
|
18
|
+
import { getClassNames } from '../../helpers';
|
|
19
|
+
import { FILL_TYPE, MENU_LIST_MAX_HEIGHT, MENU_POSITIONS, THEME } from '../../constants';
|
|
20
|
+
import { DEFAULT_INDICATOR_COLOR, NOT_INTERACTIVE_ELEMENT } from '../ListItem/ListItem';
|
|
21
|
+
import selectStyles from './selectStyles';
|
|
22
|
+
import { ReactComponent as ArrowUpIcon } from '../../assets/icons/arrow-up.svg';
|
|
23
|
+
import { ReactComponent as ArrowDownIcon } from '../../assets/icons/arrow-down.svg';
|
|
14
24
|
import '../../styles/styles.scss';
|
|
25
|
+
var DropdownIndicator = function (props) {
|
|
26
|
+
var menuIsOpen = props.selectProps.menuIsOpen;
|
|
27
|
+
return _jsx(components.DropdownIndicator, __assign({}, props, { children: menuIsOpen ? _jsx(ArrowUpIcon, {}) : _jsx(ArrowDownIcon, {}) }));
|
|
28
|
+
};
|
|
29
|
+
var Option = function (props) {
|
|
30
|
+
var label = props.label, isSelected = props.isSelected, appTheme = props.appTheme, _a = props.data, isDisabled = _a.isDisabled, _b = _a.element, element = _b === void 0 ? NOT_INTERACTIVE_ELEMENT.noElement : _b, secondaryText = _a.secondaryText, secondaryTextColor = _a.secondaryTextColor, color = _a.color;
|
|
31
|
+
return (_jsx(components.Option, __assign({}, props, { children: _jsx(ListItem, { theme: appTheme, type: "not-interactive", element: element, text: label, secondaryText: secondaryText, secondaryTextColor: secondaryTextColor, color: color, isSelected: isSelected, isDisabled: isDisabled }) })));
|
|
32
|
+
};
|
|
33
|
+
var SingleValue = function (props) {
|
|
34
|
+
var isDisabled = props.isDisabled, _a = props.data, _b = _a.element, element = _b === void 0 ? NOT_INTERACTIVE_ELEMENT.noElement : _b, _c = _a.color, color = _c === void 0 ? DEFAULT_INDICATOR_COLOR : _c, children = props.children;
|
|
35
|
+
var renderIndicatorElement = function () {
|
|
36
|
+
var _a;
|
|
37
|
+
var indicatorColorClassName = "smartapp-list-item__indicator--".concat(color);
|
|
38
|
+
var className = classNames('smartapp-list-item__indicator', indicatorColorClassName, (_a = {},
|
|
39
|
+
_a["".concat(indicatorColorClassName, "__disabled")] = isDisabled,
|
|
40
|
+
_a));
|
|
41
|
+
return element === NOT_INTERACTIVE_ELEMENT.indicator ? _jsx("div", { className: className }) : null;
|
|
42
|
+
};
|
|
43
|
+
return (_jsxs(components.SingleValue, __assign({}, props, { children: [renderIndicatorElement(), children] })));
|
|
44
|
+
};
|
|
45
|
+
var MenuList = function (props) {
|
|
46
|
+
var selectWidth = props.selectWidth, optionHeight = props.optionHeight, setOptionHeight = props.setOptionHeight, children = props.children;
|
|
47
|
+
var menuListRef = useRef(null);
|
|
48
|
+
useLayoutEffect(function () {
|
|
49
|
+
var _a;
|
|
50
|
+
if (menuListRef.current && optionHeight === 0) {
|
|
51
|
+
var options = (_a = menuListRef.current) === null || _a === void 0 ? void 0 : _a.querySelectorAll('[role="option"]');
|
|
52
|
+
var optionsHeights = Array.from(options).map(function (option) { return option.getBoundingClientRect().height; });
|
|
53
|
+
setOptionHeight(max(optionsHeights));
|
|
54
|
+
}
|
|
55
|
+
}, [optionHeight, setOptionHeight, selectWidth]);
|
|
56
|
+
return (_jsx(components.MenuList, __assign({}, props, { innerRef: menuListRef }, { children: children })));
|
|
57
|
+
};
|
|
15
58
|
var IndicatorSeparator = function () { return null; };
|
|
16
59
|
var CustomSelect = function (_a) {
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}, '&:hover': {
|
|
23
|
-
background: '#ffffff',
|
|
24
|
-
color: '#4799E3',
|
|
25
|
-
}, ':active': {
|
|
26
|
-
color: '#4799E3',
|
|
27
|
-
background: '#000000',
|
|
28
|
-
} })); },
|
|
29
|
-
control: function (provided) { return (__assign(__assign({}, provided), { width: "".concat(width, "%"), textOverflow: 'ellipsis' })); },
|
|
60
|
+
var _b = _a.theme, theme = _b === void 0 ? THEME.default : _b, _c = _a.isSearchable, isSearchable = _c === void 0 ? false : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.fillType, fillType = _e === void 0 ? FILL_TYPE.primary : _e, _f = _a.width, width = _f === void 0 ? 100 : _f, _g = _a.menuListMaxHeight, menuListMaxHeight = _g === void 0 ? MENU_LIST_MAX_HEIGHT : _g, title = _a.title, placeholder = _a.placeholder, hint = _a.hint, noOptionsMessage = _a.noOptionsMessage, error = _a.error, _h = _a.menuPosition, menuPosition = _h === void 0 ? MENU_POSITIONS.bottom : _h, defaultValue = _a.defaultValue, options = _a.options, onChange = _a.onChange;
|
|
61
|
+
var _j = useState(0), optionHeight = _j[0], setOptionHeight = _j[1];
|
|
62
|
+
useEffect(function () { return setOptionHeight(0); }, [width]);
|
|
63
|
+
var renderTitle = function () {
|
|
64
|
+
return title && (_jsx("div", __assign({ className: "smartapp-custom-select__title" }, { children: _jsx("div", __assign({ className: "smartapp-custom-select__title--text" }, { children: title })) })));
|
|
30
65
|
};
|
|
31
|
-
return
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
66
|
+
var renderHint = function () { return hint && _jsx("div", __assign({ className: "smartapp-custom-select__hint" }, { children: hint })); };
|
|
67
|
+
var renderError = function () { return error && _jsx("div", __assign({ className: "smartapp-custom-select__error" }, { children: error })); };
|
|
68
|
+
var OptionComponent = function (props) { return _jsx(Option, __assign({}, props, { appTheme: theme })); };
|
|
69
|
+
var MenuListComponent = function (props) { return _jsx(MenuList, __assign({}, props, { selectWidth: width, optionHeight: optionHeight, setOptionHeight: setOptionHeight })); };
|
|
70
|
+
var generateStyles = function () { return selectStyles({ isDisabled: isDisabled, isError: !isEmpty(error), theme: theme, fillType: fillType, menuListMaxHeight: menuListMaxHeight, optionHeight: optionHeight }); };
|
|
71
|
+
return (_jsxs("div", __assign({ className: getClassNames({ className: 'smartapp-custom-select', delimiter: '__', additionalClassName: theme }), style: { width: "".concat(width, "%") } }, { children: [renderTitle(), _jsx(Select, { menuPlacement: menuPosition, isDisabled: isDisabled, isSearchable: isSearchable, options: options, defaultValue: defaultValue, styles: generateStyles(), placeholder: placeholder, noOptionsMessage: function () { return noOptionsMessage; },
|
|
72
|
+
/* @ts-ignore */
|
|
73
|
+
onChange: function (option) { return onChange(option); }, components: {
|
|
74
|
+
Option: OptionComponent,
|
|
75
|
+
IndicatorSeparator: IndicatorSeparator,
|
|
76
|
+
DropdownIndicator: DropdownIndicator,
|
|
77
|
+
SingleValue: SingleValue,
|
|
78
|
+
MenuList: MenuListComponent,
|
|
79
|
+
} }), renderHint(), renderError()] })));
|
|
36
80
|
};
|
|
37
81
|
export default CustomSelect;
|
|
38
82
|
//# sourceMappingURL=CustomSelect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSelect.js","sourceRoot":"","sources":["../../../../src/сomponents/CustomSelect/CustomSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"CustomSelect.js","sourceRoot":"","sources":["../../../../src/сomponents/CustomSelect/CustomSelect.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAC3E,OAAO,MAAM,EAAE,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AACrC,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,QAAQ,MAAM,aAAa,CAA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ACxB,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,cAAM,OAAA,gBAAgB,EAAhB,CAAgB;gBACxC,gBAAgB;gBAChB,QAAQ,EAAE,UAAC,MAAM,IAAK,OAAA,QAAQ,CAAC,MAAM,CAAC,EAAhB,CAAgB,EACtC,UAAU,EAAE;oBACV,MAAM,EAAE,eAAe;oBACvB,kBAAkB,oBAAA;oBAClB,iBAAiB,mBAAA;oBACjB,WAAW,aAAA;oBACX,QAAQ,EAAE,iBAAiB;iBAC5B,GACD,EACD,UAAU,EAAE,EACZ,WAAW,EAAE,KACV,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare const blueColor = "rgba(71, 153, 227, 1)";
|
|
2
|
+
export declare const lightGrayColor = "rgba(249, 249, 249, 1)";
|
|
3
|
+
export declare const grayColor = "rgba(183, 183, 183, 1)";
|
|
4
|
+
export declare const darkGrayColor = "rgba(128, 128, 128, 1)";
|
|
5
|
+
export declare const lightBlackColor = "rgba(86, 86, 86, 1)";
|
|
6
|
+
export declare const blackColor = "rgba(26, 26, 26, 1)";
|
|
7
|
+
export declare const whiteBackgroundColor = "rgba(255, 255, 255, 1)";
|
|
8
|
+
export declare const grayBackgroundColor = "rgba(241, 241, 242, 1)";
|
|
9
|
+
export declare const lighterBlackBackgroundColor = "rgba(43, 43, 43, 1)";
|
|
10
|
+
export declare const lightBlackBackgroundColor = "rgba(61, 61, 61, 1)";
|
|
11
|
+
export declare const blackBackgroundColor = "rgba(36, 36, 36, 1)";
|
|
12
|
+
export declare const redBorderColor = "rgba(237, 71, 71, 1)";
|
|
13
|
+
export declare const lightGrayBorderColor = "rgba(0, 0, 0, 0.05)";
|
|
14
|
+
export declare const grayBorderColor = "rgba(232, 233, 238, 1)";
|
|
15
|
+
export declare const boxShadowColor = "rgba(0, 0, 0, 0.1)";
|
|
16
|
+
export declare const transparent = "transparent";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export var blueColor = 'rgba(71, 153, 227, 1)';
|
|
2
|
+
export var lightGrayColor = 'rgba(249, 249, 249, 1)';
|
|
3
|
+
export var grayColor = 'rgba(183, 183, 183, 1)';
|
|
4
|
+
export var darkGrayColor = 'rgba(128, 128, 128, 1)';
|
|
5
|
+
export var lightBlackColor = 'rgba(86, 86, 86, 1)';
|
|
6
|
+
export var blackColor = 'rgba(26, 26, 26, 1)';
|
|
7
|
+
export var whiteBackgroundColor = 'rgba(255, 255, 255, 1)';
|
|
8
|
+
export var grayBackgroundColor = 'rgba(241, 241, 242, 1)';
|
|
9
|
+
export var lighterBlackBackgroundColor = 'rgba(43, 43, 43, 1)';
|
|
10
|
+
export var lightBlackBackgroundColor = 'rgba(61, 61, 61, 1)';
|
|
11
|
+
export var blackBackgroundColor = 'rgba(36, 36, 36, 1)';
|
|
12
|
+
export var redBorderColor = 'rgba(237, 71, 71, 1)';
|
|
13
|
+
export var lightGrayBorderColor = 'rgba(0, 0, 0, 0.05)';
|
|
14
|
+
export var grayBorderColor = 'rgba(232, 233, 238, 1)';
|
|
15
|
+
export var boxShadowColor = 'rgba(0, 0, 0, 0.1)';
|
|
16
|
+
export var transparent = 'transparent';
|
|
17
|
+
//# sourceMappingURL=colors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colors.js","sourceRoot":"","sources":["../../../../src/сomponents/CustomSelect/colors.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,IAAM,SAAS,GAAG,uBAAuB,CAAA;AAChD,MAAM,CAAC,IAAM,cAAc,GAAG,wBAAwB,CAAA;AACtD,MAAM,CAAC,IAAM,SAAS,GAAG,wBAAwB,CAAA;AACjD,MAAM,CAAC,IAAM,aAAa,GAAG,wBAAwB,CAAA;AACrD,MAAM,CAAC,IAAM,eAAe,GAAG,qBAAqB,CAAA;AACpD,MAAM,CAAC,IAAM,UAAU,GAAG,qBAAqB,CAAA;AAE/C,MAAM,CAAC,IAAM,oBAAoB,GAAG,wBAAwB,CAAA;AAC5D,MAAM,CAAC,IAAM,mBAAmB,GAAG,wBAAwB,CAAA;AAC3D,MAAM,CAAC,IAAM,2BAA2B,GAAG,qBAAqB,CAAA;AAChE,MAAM,CAAC,IAAM,yBAAyB,GAAG,qBAAqB,CAAA;AAC9D,MAAM,CAAC,IAAM,oBAAoB,GAAG,qBAAqB,CAAA;AAEzD,MAAM,CAAC,IAAM,cAAc,GAAG,sBAAsB,CAAA;AACpD,MAAM,CAAC,IAAM,oBAAoB,GAAG,qBAAqB,CAAA;AACzD,MAAM,CAAC,IAAM,eAAe,GAAG,wBAAwB,CAAA;AAEvD,MAAM,CAAC,IAAM,cAAc,GAAG,oBAAoB,CAAA;AAElD,MAAM,CAAC,IAAM,WAAW,GAAG,aAAa,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { TSelectStyles } from './types';
|
|
2
|
+
declare const _default: ({ isDisabled, isError, theme, fillType, menuListMaxHeight, optionHeight }: TSelectStyles) => {
|
|
3
|
+
control: (provided: any, { menuIsOpen }: any) => any;
|
|
4
|
+
menu: (provided: any) => any;
|
|
5
|
+
menuList: (provided: any) => any;
|
|
6
|
+
valueContainer: (provided: any) => any;
|
|
7
|
+
dropdownIndicator: (provided: any) => any;
|
|
8
|
+
placeholder: (provided: any) => any;
|
|
9
|
+
input: (provided: any) => any;
|
|
10
|
+
noOptionsMessage: (provided: any) => any;
|
|
11
|
+
singleValue: (provided: any) => any;
|
|
12
|
+
option: (provided: any) => any;
|
|
13
|
+
};
|
|
14
|
+
export default _default;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { isDarkTheme, isPrimaryFillType } from '../../helpers';
|
|
13
|
+
import * as colors from './colors';
|
|
14
|
+
// eslint-disable-next-line import/no-anonymous-default-export
|
|
15
|
+
export default (function (_a) {
|
|
16
|
+
var isDisabled = _a.isDisabled, isError = _a.isError, theme = _a.theme, fillType = _a.fillType, menuListMaxHeight = _a.menuListMaxHeight, optionHeight = _a.optionHeight;
|
|
17
|
+
return ({
|
|
18
|
+
control: function (provided, _a) {
|
|
19
|
+
var menuIsOpen = _a.menuIsOpen;
|
|
20
|
+
var grayBorderColor = isDarkTheme(theme) ? colors.lightBlackBackgroundColor : colors.grayBorderColor;
|
|
21
|
+
var borderColor = menuIsOpen ? colors.blueColor : grayBorderColor;
|
|
22
|
+
var hoverGrayBorderColor = isDarkTheme(theme) ? colors.darkGrayColor : colors.grayColor;
|
|
23
|
+
var hoverBorderColor = menuIsOpen ? colors.blueColor : hoverGrayBorderColor;
|
|
24
|
+
var backgroundDarkTheme = isPrimaryFillType(fillType) ? colors.blackBackgroundColor : colors.lighterBlackBackgroundColor;
|
|
25
|
+
var background = isDarkTheme(theme) ? backgroundDarkTheme : colors.whiteBackgroundColor;
|
|
26
|
+
var disabledBackground = isDarkTheme(theme) ? colors.lightBlackBackgroundColor : colors.grayBackgroundColor;
|
|
27
|
+
return __assign(__assign({}, provided), { background: isDisabled ? disabledBackground : background, borderRadius: '8px', borderColor: isError ? colors.redBorderColor : isDisabled ? disabledBackground : borderColor, boxShadow: 'none', cursor: 'pointer', transition: 'border-color 250ms ease-in-out, background 250ms ease-in-out', '&:hover': {
|
|
28
|
+
borderColor: isError ? colors.redBorderColor : hoverBorderColor,
|
|
29
|
+
} });
|
|
30
|
+
},
|
|
31
|
+
menu: function (provided) { return (__assign(__assign({}, provided), { background: colors.transparent, border: isDarkTheme(theme) ? "1px solid ".concat(colors.lighterBlackBackgroundColor) : "1px solid ".concat(colors.lightGrayBorderColor), borderRadius: '8px', boxShadow: isDarkTheme(theme) ? "0 3px 17px 0 ".concat(colors.boxShadowColor) : "0 4px 10px 0 ".concat(colors.boxShadowColor), margin: '4px 0', zIndex: 2 })); },
|
|
32
|
+
menuList: function (provided) { return (__assign(__assign({}, provided), { maxHeight: "".concat(menuListMaxHeight, "px"), display: 'flex', flexDirection: 'column', gap: '4px', background: isDarkTheme(theme) ? colors.lighterBlackBackgroundColor : colors.whiteBackgroundColor, borderRadius: '8px', padding: '4px' })); },
|
|
33
|
+
valueContainer: function (provided) { return (__assign(__assign({}, provided), { padding: '13px 8px 13px 16px' })); },
|
|
34
|
+
dropdownIndicator: function (provided) { return (__assign(__assign({}, provided), { color: isDarkTheme(theme) ? colors.lightBlackColor : colors.grayColor, padding: '14.5px 16px 14.5px 0' })); },
|
|
35
|
+
placeholder: function (provided) { return (__assign(__assign({}, provided), { fontFamily: "Open Sans, 'sans-serif'", fontSize: '14px', fontWeight: '400', lineHeight: '19px', color: isDarkTheme(theme) ? colors.lightBlackColor : colors.grayColor, margin: 0 })); },
|
|
36
|
+
input: function (provided) { return (__assign(__assign({}, provided), { fontSize: '14px', fontWeight: '400', lineHeight: '19px', color: isDarkTheme(theme) ? colors.lightGrayColor : colors.blackColor, caretColor: colors.blueColor, padding: 0, margin: 0, overflow: 'auto' })); },
|
|
37
|
+
noOptionsMessage: function (provided) { return (__assign(__assign({}, provided), { fontSize: '12px', fontWeight: 400, color: isDarkTheme(theme) ? colors.lightGrayColor : colors.blackColor, padding: '8px 16px' })); },
|
|
38
|
+
singleValue: function (provided) {
|
|
39
|
+
var singleValueColor = isDarkTheme(theme) ? colors.lightGrayColor : colors.blackColor;
|
|
40
|
+
return __assign(__assign({}, provided), { display: 'flex', alignItems: 'center', gap: '8px', fontFamily: "Open Sans, 'sans-serif'", fontSize: '14px', fontWeight: 400, lineHeight: '19px', color: isDisabled ? colors.darkGrayColor : singleValueColor, margin: 0 });
|
|
41
|
+
},
|
|
42
|
+
option: function (provided) { return (__assign(__assign({}, provided), { display: 'flex', alignItems: 'center', minHeight: optionHeight ? "".concat(optionHeight, "px") : 'auto', height: optionHeight ? "".concat(optionHeight, "px") : 'auto', background: "".concat(colors.transparent, " !important"), padding: '0', cursor: 'pointer', '.smartapp-list-item__text': {
|
|
43
|
+
gap: 0,
|
|
44
|
+
'& > div:nth-child(2)': {
|
|
45
|
+
fontSize: '12px',
|
|
46
|
+
lineHeight: '16px',
|
|
47
|
+
},
|
|
48
|
+
} })); },
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
//# sourceMappingURL=selectStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selectStyles.js","sourceRoot":"","sources":["../../../../src/сomponents/CustomSelect/selectStyles.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAA;AAE9D,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAElC,8DAA8D;AAC9D,gBAAe,UAAC,EAAwF;QAAtF,UAAU,gBAAA,EAAE,OAAO,aAAA,EAAE,KAAK,WAAA,EAAE,QAAQ,cAAA,EAAE,iBAAiB,uBAAA,EAAE,YAAY,kBAAA;IAAsB,OAAA,CAAC;QAC5G,OAAO,EAAE,UAAC,QAAa,EAAE,EAAmB;gBAAjB,UAAU,gBAAA;YACnC,IAAM,eAAe,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,yBAAyB,CAAC,CAAC,CAAC,MAAM,CAAC,eAAe,CAAA;YACtG,IAAM,WAAW,GAAG,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAA;YACnE,IAAM,oBAAoB,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CA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CAAC,CAAC,MAAM,EACtD,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,UAAG,YAAY,OAAI,CAAC,CAAC,CAAC,MAAM,EACnD,UAAU,EAAE,UAAG,MAAM,CAAC,WAAW,gBAAa,EAC9C,OAAO,EAAE,GAAG,EACZ,MAAM,EAAE,SAAS,EAEjB,2BAA2B,EAAE;gBAC3B,GAAG,EAAE,CAAC;gBAEN,sBAAsB,EAAE;oBACtB,QAAQ,EAAE,MAAM;oBAChB,UAAU,EAAE,MAAM;iBACnB;aACF,IACD,EAlByB,CAkBzB;KACH,CAAC;AAxH2G,CAwH3G,EAAA"}
|
|
@@ -1,12 +1,44 @@
|
|
|
1
1
|
import { IntRange } from '../types';
|
|
2
|
-
|
|
2
|
+
import { TIndicatorColor } from '../ListItem/types';
|
|
3
|
+
import { IThemeProps } from '../../constants';
|
|
4
|
+
export type TSelectStyles = {
|
|
5
|
+
isDisabled: boolean;
|
|
6
|
+
isError: boolean;
|
|
7
|
+
theme: string;
|
|
8
|
+
fillType: string;
|
|
9
|
+
menuListMaxHeight: number;
|
|
10
|
+
optionHeight: number;
|
|
11
|
+
};
|
|
12
|
+
interface IndicatorCustomSelectOption {
|
|
13
|
+
element: 'indicator';
|
|
14
|
+
color?: TIndicatorColor;
|
|
15
|
+
}
|
|
16
|
+
interface NoElementCustomSelectOption {
|
|
17
|
+
element: 'no-element';
|
|
18
|
+
secondaryText?: string;
|
|
19
|
+
secondaryTextColor?: string;
|
|
20
|
+
}
|
|
21
|
+
interface SimpleCustomSelectOption {
|
|
22
|
+
}
|
|
23
|
+
export type TCustomSelectOption = (NoElementCustomSelectOption | IndicatorCustomSelectOption | SimpleCustomSelectOption) & {
|
|
3
24
|
label: string;
|
|
4
25
|
value: string;
|
|
26
|
+
isDisabled?: boolean;
|
|
5
27
|
};
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
28
|
+
export interface ICustomSelectProps extends IThemeProps {
|
|
29
|
+
isSearchable?: boolean;
|
|
30
|
+
isDisabled?: boolean;
|
|
31
|
+
fillType?: 'primary' | 'secondary';
|
|
32
|
+
width?: IntRange<1, 101>;
|
|
33
|
+
menuListMaxHeight?: number;
|
|
34
|
+
title?: string;
|
|
9
35
|
placeholder: string;
|
|
36
|
+
hint?: string;
|
|
37
|
+
noOptionsMessage?: string;
|
|
38
|
+
error?: string;
|
|
39
|
+
menuPosition?: 'bottom' | 'auto' | 'top';
|
|
10
40
|
defaultValue?: TCustomSelectOption;
|
|
11
|
-
|
|
12
|
-
|
|
41
|
+
options: TCustomSelectOption[];
|
|
42
|
+
onChange: (option: TCustomSelectOption) => void;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { ICustomSelectProfilesProps } from './types';
|
|
2
2
|
import '../../styles/styles.scss';
|
|
3
|
-
declare const
|
|
4
|
-
export default
|
|
3
|
+
declare const CustomSelectProfiles: ({ options, defaultValue, placeholder, onChange, width }: ICustomSelectProfilesProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default CustomSelectProfiles;
|
|
@@ -27,16 +27,16 @@ import '../../styles/styles.scss';
|
|
|
27
27
|
var Control = function (_a) {
|
|
28
28
|
var _b, _c, _d;
|
|
29
29
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
30
|
-
return (_jsxs(components.Control, __assign({}, props, { children: [((_b = props.selectProps) === null || _b === void 0 ? void 0 : _b.value) && (_jsx("div", __assign({ className: "smartapp-custom-
|
|
30
|
+
return (_jsxs(components.Control, __assign({}, props, { children: [((_b = props.selectProps) === null || _b === void 0 ? void 0 : _b.value) && (_jsx("div", __assign({ className: "smartapp-custom-select-profiles__control" }, { children: _jsx("span", { children: _jsx(Avatar, { size: 32, username: (_d = (_c = props === null || props === void 0 ? void 0 : props.selectProps) === null || _c === void 0 ? void 0 : _c.value) === null || _d === void 0 ? void 0 : _d.username }) }) }))), children] })));
|
|
31
31
|
};
|
|
32
32
|
var Option = function (_a) {
|
|
33
33
|
var _b, _c, _d;
|
|
34
34
|
var props = __rest(_a, []);
|
|
35
|
-
return (_jsx(components.Option, __assign({}, props, { children: _jsxs("div", __assign({ className: "smartapp-custom-
|
|
35
|
+
return (_jsx(components.Option, __assign({}, props, { children: _jsxs("div", __assign({ className: "smartapp-custom-select-profiles__option" }, { children: [_jsx("div", __assign({ className: "smartapp-custom-select-profiles__option--avatar" }, { children: _jsx(Avatar, { size: 32, username: (_b = props === null || props === void 0 ? void 0 : props.data) === null || _b === void 0 ? void 0 : _b.username }) })), _jsxs("div", __assign({ className: "smartapp-custom-select-profiles__option--info" }, { children: [_jsxs("p", __assign({ className: "smartapp-custom-select-profiles__option--info__title" }, { children: [(_c = props === null || props === void 0 ? void 0 : props.data) === null || _c === void 0 ? void 0 : _c.username, " "] })), _jsxs("p", __assign({ className: "smartapp-custom-select-profiles__option--info__email" }, { children: [(_d = props === null || props === void 0 ? void 0 : props.data) === null || _d === void 0 ? void 0 : _d.email, " "] }))] }))] })) })));
|
|
36
36
|
};
|
|
37
37
|
var DropdownIndicator = function (props) { return _jsx(components.DropdownIndicator, __assign({}, props)); };
|
|
38
38
|
var IndicatorSeparator = function () { return null; };
|
|
39
|
-
var
|
|
39
|
+
var CustomSelectProfiles = function (_a) {
|
|
40
40
|
var options = _a.options, defaultValue = _a.defaultValue, placeholder = _a.placeholder, onChange = _a.onChange, _b = _a.width, width = _b === void 0 ? 100 : _b;
|
|
41
41
|
var customStyles = {
|
|
42
42
|
option: function (provided, state) { return (__assign(__assign({}, provided), { cursor: 'pointer', color: '#000000', background: state.isSelected ? 'rgba(71, 153, 227, 0.1)' : '#ffffff', display: 'flex', textOverflow: 'ellipsis', width: "".concat(width, "%"), padding: '10px 0', '&:focus': {
|
|
@@ -47,11 +47,11 @@ var CustomSelectPriority = function (_a) {
|
|
|
47
47
|
} })); },
|
|
48
48
|
control: function (provided) { return (__assign(__assign({}, provided), { width: "".concat(width, "%"), textOverflow: 'ellipsis', padding: '5px 0 5px 5px' })); },
|
|
49
49
|
};
|
|
50
|
-
return (_jsx("div", __assign({ className: "smartapp-custom-select" }, { children: _jsx(Select
|
|
50
|
+
return (_jsx("div", __assign({ className: "smartapp-custom-select-profiles" }, { children: _jsx(Select
|
|
51
51
|
/* @ts-ignore */
|
|
52
52
|
, {
|
|
53
53
|
/* @ts-ignore */
|
|
54
|
-
onChange: function (option) { return onChange(option); }, options: options, defaultValue: defaultValue, styles: customStyles, getOptionLabel: function (option) { return option.username; }, getOptionValue: function (option) { return option.email; }, placeholder: _jsx("div", __assign({ className: "smartapp-custom-
|
|
54
|
+
onChange: function (option) { return onChange(option); }, options: options, defaultValue: defaultValue, styles: customStyles, getOptionLabel: function (option) { return option.username; }, getOptionValue: function (option) { return option.email; }, placeholder: _jsx("div", __assign({ className: "smartapp-custom-select-profiles__placeholder" }, { children: placeholder })), components: { Option: Option, Control: Control, DropdownIndicator: DropdownIndicator, IndicatorSeparator: IndicatorSeparator } }) })));
|
|
55
55
|
};
|
|
56
|
-
export default
|
|
56
|
+
export default CustomSelectProfiles;
|
|
57
57
|
//# sourceMappingURL=CustomSelectProfiles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomSelectProfiles.js","sourceRoot":"","sources":["../../../../src/сomponents/CustomSelectProfiles/CustomSelectProfiles.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,MAAM,EAAE,EAAE,UAAU,EAA0B,MAAM,cAAc,CAAA;AACzE,OAAO,MAAM,MAAM,WAAW,CAAA;AAE9B,OAAO,0BAA0B,CAAA;AAEjC,IAAM,OAAO,GAAG,UAAC,EAA2B;;IAAzB,IAAA,QAAQ,cAAA,EAAK,KAAK,cAApB,YAAsB,CAAF;IAAY,OAAA,CAC/C,MAAC,UAAU,CAAC,OAAO,eAAK,KAAK,eAC1B,CAAA,MAAA,KAAK,CAAC,WAAW,0CAAE,KAAK,KAAI,CAC3B,uBAAK,SAAS,EAAC,
|
|
1
|
+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,QAAQ,CAAC,MAAM,CAAC,EAAhB,CAAgB,EACtC,OAAO,EAAE,OAAO,EAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,YAAY,EACpB,cAAc,EAAE,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,QAAQ,EAAf,CAAe,EAC3C,cAAc,EAAE,UAAC,MAAM,IAAK,OAAA,MAAM,CAAC,KAAK,EAAZ,CAAY,EACxC,WAAW,EAAE,uBAAK,SAAS,EAAC,8CAA8C,gBAAE,WAAW,IAAO,EAC9F,UAAU,EAAE,EAAE,MAAM,QAAA,EAAE,OAAO,SAAA,EAAE,iBAAiB,mBAAA,EAAE,kBAAkB,oBAAA,EAAE,GACtE,IACE,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,oBAAoB,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IListItemProps } from './types';
|
|
2
|
+
import '../../styles/styles.scss';
|
|
3
|
+
export declare const LIST_ITEM_TYPE: {
|
|
4
|
+
interactive: string;
|
|
5
|
+
notInteractive: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const INTERACTIVE_ELEMENT: {
|
|
8
|
+
radioButton: string;
|
|
9
|
+
checkbox: string;
|
|
10
|
+
toggle: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const INTERACTIVE_POSITION: {
|
|
13
|
+
left: string;
|
|
14
|
+
right: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const NOT_INTERACTIVE_ELEMENT: {
|
|
17
|
+
icon: string;
|
|
18
|
+
indicator: string;
|
|
19
|
+
noElement: string;
|
|
20
|
+
};
|
|
21
|
+
export declare const DEFAULT_INDICATOR_COLOR = "blue";
|
|
22
|
+
declare const ListItem: (props: IListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
export default ListItem;
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { useCallback, useEffect, useRef } from 'react';
|
|
14
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
15
|
+
import classNames from 'classnames';
|
|
16
|
+
import RadioButton from '../RadioButton';
|
|
17
|
+
import Checkbox from '../Checkbox';
|
|
18
|
+
import Toggle from '../Toggle';
|
|
19
|
+
import '../../styles/styles.scss';
|
|
20
|
+
export var LIST_ITEM_TYPE = {
|
|
21
|
+
interactive: 'interactive',
|
|
22
|
+
notInteractive: 'not-interactive',
|
|
23
|
+
};
|
|
24
|
+
export var INTERACTIVE_ELEMENT = {
|
|
25
|
+
radioButton: 'radio-button',
|
|
26
|
+
checkbox: 'checkbox',
|
|
27
|
+
toggle: 'toggle',
|
|
28
|
+
};
|
|
29
|
+
export var INTERACTIVE_POSITION = {
|
|
30
|
+
left: 'left',
|
|
31
|
+
right: 'right',
|
|
32
|
+
};
|
|
33
|
+
export var NOT_INTERACTIVE_ELEMENT = {
|
|
34
|
+
icon: 'icon',
|
|
35
|
+
indicator: 'indicator',
|
|
36
|
+
noElement: 'no-element',
|
|
37
|
+
};
|
|
38
|
+
var MIN_LIST_ITEM_HEIGHT = 44;
|
|
39
|
+
export var DEFAULT_INDICATOR_COLOR = 'blue';
|
|
40
|
+
var DEFAULT_PRESSED_CLASSNAME = 'smartapp-list-item__not-interactive--pressed';
|
|
41
|
+
var SELECTED_PRESSED_CLASSNAME = 'smartapp-list-item__not-interactive--selected__pressed';
|
|
42
|
+
var TOP_ALIGN_CLASSNAME = 'smartapp-list-item__top-align';
|
|
43
|
+
var getIsType = function (type) {
|
|
44
|
+
var isInteractiveType = type === LIST_ITEM_TYPE.interactive;
|
|
45
|
+
var isNotInteractiveType = type === LIST_ITEM_TYPE.notInteractive;
|
|
46
|
+
return { isInteractiveType: isInteractiveType, isNotInteractiveType: isNotInteractiveType };
|
|
47
|
+
};
|
|
48
|
+
var getIsElement = function (element) {
|
|
49
|
+
var isIndicatorElement = element === NOT_INTERACTIVE_ELEMENT.indicator;
|
|
50
|
+
var isIconElement = element === NOT_INTERACTIVE_ELEMENT.icon;
|
|
51
|
+
var isNoElement = element === NOT_INTERACTIVE_ELEMENT.noElement;
|
|
52
|
+
return { isIndicatorElement: isIndicatorElement, isIconElement: isIconElement, isNoElement: isNoElement };
|
|
53
|
+
};
|
|
54
|
+
var ListItem = function (props) {
|
|
55
|
+
var theme = props.theme, type = props.type, text = props.text, element = props.element, isDisabled = props.isDisabled;
|
|
56
|
+
var listItemRef = useRef(null);
|
|
57
|
+
var _a = getIsType(type), isInteractiveType = _a.isInteractiveType, isNotInteractiveType = _a.isNotInteractiveType;
|
|
58
|
+
var _b = getIsElement(element), isIndicatorElement = _b.isIndicatorElement, isIconElement = _b.isIconElement, isNoElement = _b.isNoElement;
|
|
59
|
+
var isLeftPosition = function (position) { return position === INTERACTIVE_POSITION.left; };
|
|
60
|
+
var isRightPosition = function (position) { return position === INTERACTIVE_POSITION.right; };
|
|
61
|
+
var generatePressedClassName = useCallback(function () {
|
|
62
|
+
var isElementHasSelectedProps = isIndicatorElement || isNoElement;
|
|
63
|
+
if (isNotInteractiveType && !isDisabled) {
|
|
64
|
+
if (isElementHasSelectedProps) {
|
|
65
|
+
var isSelected = props.isSelected;
|
|
66
|
+
return isSelected ? SELECTED_PRESSED_CLASSNAME : DEFAULT_PRESSED_CLASSNAME;
|
|
67
|
+
}
|
|
68
|
+
return DEFAULT_PRESSED_CLASSNAME;
|
|
69
|
+
}
|
|
70
|
+
return '';
|
|
71
|
+
}, [isDisabled, isIndicatorElement, isNoElement, isNotInteractiveType, props]);
|
|
72
|
+
var handleMouseDown = useCallback(function () {
|
|
73
|
+
var _a;
|
|
74
|
+
var pressedClassName = generatePressedClassName();
|
|
75
|
+
pressedClassName && ((_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.classList.add(pressedClassName));
|
|
76
|
+
}, [generatePressedClassName]);
|
|
77
|
+
var handleMouseUp = useCallback(function () {
|
|
78
|
+
var _a;
|
|
79
|
+
var pressedClassName = generatePressedClassName();
|
|
80
|
+
pressedClassName && ((_a = listItemRef.current) === null || _a === void 0 ? void 0 : _a.classList.remove(pressedClassName));
|
|
81
|
+
}, [generatePressedClassName]);
|
|
82
|
+
var renderInteractiveElement = function () {
|
|
83
|
+
var _a = props, _b = _a.isSelected, isSelected = _b === void 0 ? false : _b, onChange = _a.onChange;
|
|
84
|
+
var elementId = uuidv4();
|
|
85
|
+
switch (element) {
|
|
86
|
+
case INTERACTIVE_ELEMENT.radioButton:
|
|
87
|
+
return _jsx(RadioButton, { id: elementId, isChecked: isSelected, isDisabled: isDisabled, onChange: onChange });
|
|
88
|
+
case INTERACTIVE_ELEMENT.checkbox:
|
|
89
|
+
return _jsx(Checkbox, { id: elementId, isChecked: isSelected, isDisabled: isDisabled, onChange: onChange });
|
|
90
|
+
case INTERACTIVE_ELEMENT.toggle:
|
|
91
|
+
return _jsx(Toggle, { id: elementId, isChecked: isSelected, isDisabled: isDisabled, onClick: onChange });
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
var renderNotInteractiveElement = function () {
|
|
95
|
+
switch (element) {
|
|
96
|
+
case NOT_INTERACTIVE_ELEMENT.icon:
|
|
97
|
+
var icon = props.icon;
|
|
98
|
+
return _jsx("div", __assign({ className: classNames('smartapp-list-item__icon', { 'smartapp-list-item__icon--disabled': isDisabled }) }, { children: icon }));
|
|
99
|
+
case NOT_INTERACTIVE_ELEMENT.indicator:
|
|
100
|
+
var color = props.color;
|
|
101
|
+
return renderIndicatorElement({ color: color });
|
|
102
|
+
case NOT_INTERACTIVE_ELEMENT.noElement:
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
var renderIndicatorElement = function (_a) {
|
|
107
|
+
var _b;
|
|
108
|
+
var _c = _a.isIndicator, isIndicator = _c === void 0 ? true : _c, _d = _a.color, color = _d === void 0 ? DEFAULT_INDICATOR_COLOR : _d;
|
|
109
|
+
if (isIndicator) {
|
|
110
|
+
var indicatorColorClassName = "smartapp-list-item__indicator--".concat(color);
|
|
111
|
+
var className = classNames('smartapp-list-item__indicator', indicatorColorClassName, (_b = {},
|
|
112
|
+
_b["".concat(indicatorColorClassName, "__disabled")] = isDisabled,
|
|
113
|
+
_b));
|
|
114
|
+
return _jsx("div", { className: className });
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
};
|
|
118
|
+
var renderLeftElement = function () {
|
|
119
|
+
if (isInteractiveType) {
|
|
120
|
+
var _a = props, _b = _a.position, position = _b === void 0 ? INTERACTIVE_POSITION.right : _b, _c = _a.isIndicator, isIndicator = _c === void 0 ? false : _c, color = _a.color;
|
|
121
|
+
return isLeftPosition(position) ? renderInteractiveElement() : renderIndicatorElement({ isIndicator: isIndicator, color: color });
|
|
122
|
+
}
|
|
123
|
+
if (isNotInteractiveType) {
|
|
124
|
+
return renderNotInteractiveElement();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
var renderRightElement = function () {
|
|
128
|
+
if (isInteractiveType) {
|
|
129
|
+
var _a = props.position, position = _a === void 0 ? INTERACTIVE_POSITION.right : _a;
|
|
130
|
+
return isRightPosition(position) ? renderInteractiveElement() : null;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
var renderSecondaryText = function () {
|
|
134
|
+
if (isNotInteractiveType && isNoElement) {
|
|
135
|
+
var _a = props, secondaryText = _a.secondaryText, secondaryTextColor = _a.secondaryTextColor;
|
|
136
|
+
return secondaryText ? _jsx("div", __assign({ style: { color: secondaryTextColor } }, { children: secondaryText })) : null;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var generateTextClassName = function () {
|
|
140
|
+
var classNames = ['smartapp-list-item__text'];
|
|
141
|
+
if (isInteractiveType) {
|
|
142
|
+
var _a = props, _b = _a.position, position = _b === void 0 ? INTERACTIVE_POSITION.right : _b, isIndicator = _a.isIndicator;
|
|
143
|
+
var isLeftClassNeeded = isLeftPosition(position) || isIndicator;
|
|
144
|
+
isLeftClassNeeded && classNames.push('smartapp-list-item__text--left');
|
|
145
|
+
isRightPosition(position) && classNames.push('smartapp-list-item__text--right');
|
|
146
|
+
isIndicator && isRightPosition(position) && classNames.push('smartapp-list-item__text--ellipse');
|
|
147
|
+
}
|
|
148
|
+
if (isNotInteractiveType && (isIconElement || isIndicatorElement)) {
|
|
149
|
+
classNames.push('smartapp-list-item__text--left');
|
|
150
|
+
}
|
|
151
|
+
isDisabled && classNames.push('smartapp-list-item__text--disabled');
|
|
152
|
+
return classNames;
|
|
153
|
+
};
|
|
154
|
+
var generateClassName = function () {
|
|
155
|
+
var classNames = ['smartapp-list-item', "smartapp-list-item__".concat(type), "smartapp-list-item__".concat(theme)];
|
|
156
|
+
var isElementHasSelectedProps = isIndicatorElement || isNoElement;
|
|
157
|
+
if (isElementHasSelectedProps) {
|
|
158
|
+
var isSelected = props.isSelected;
|
|
159
|
+
isSelected && classNames.push("smartapp-list-item__".concat(type, "--selected"));
|
|
160
|
+
}
|
|
161
|
+
if (isNoElement) {
|
|
162
|
+
var secondaryText = props.secondaryText;
|
|
163
|
+
secondaryText && classNames.push("smartapp-list-item__".concat(type, "--with-secondary-text"));
|
|
164
|
+
}
|
|
165
|
+
isDisabled && classNames.push('smartapp-list-item__disabled');
|
|
166
|
+
return classNames;
|
|
167
|
+
};
|
|
168
|
+
useEffect(function () {
|
|
169
|
+
var listItemRefCurrent = listItemRef.current;
|
|
170
|
+
var listItemRefClassList = listItemRefCurrent === null || listItemRefCurrent === void 0 ? void 0 : listItemRefCurrent.classList;
|
|
171
|
+
var resizeObserver = new ResizeObserver(function () {
|
|
172
|
+
var _a = props.position, position = _a === void 0 ? INTERACTIVE_POSITION.right : _a;
|
|
173
|
+
var height = (listItemRefCurrent === null || listItemRefCurrent === void 0 ? void 0 : listItemRefCurrent.getBoundingClientRect().height) || 0;
|
|
174
|
+
if (isLeftPosition(position)) {
|
|
175
|
+
height > MIN_LIST_ITEM_HEIGHT ? listItemRefClassList === null || listItemRefClassList === void 0 ? void 0 : listItemRefClassList.add(TOP_ALIGN_CLASSNAME) : listItemRefClassList === null || listItemRefClassList === void 0 ? void 0 : listItemRefClassList.remove(TOP_ALIGN_CLASSNAME);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
listItemRefClassList === null || listItemRefClassList === void 0 ? void 0 : listItemRefClassList.remove(TOP_ALIGN_CLASSNAME);
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
if (listItemRefCurrent && isInteractiveType) {
|
|
182
|
+
resizeObserver.observe(listItemRefCurrent);
|
|
183
|
+
}
|
|
184
|
+
return function () { return resizeObserver.disconnect(); };
|
|
185
|
+
}, [isInteractiveType, props]);
|
|
186
|
+
useEffect(function () {
|
|
187
|
+
window.addEventListener('mouseup', handleMouseUp);
|
|
188
|
+
return function () {
|
|
189
|
+
window.removeEventListener('mouseup', handleMouseUp);
|
|
190
|
+
};
|
|
191
|
+
}, [handleMouseUp]);
|
|
192
|
+
return (_jsxs("div", __assign({ ref: listItemRef, className: classNames(generateClassName()), onMouseDown: handleMouseDown }, { children: [renderLeftElement(), _jsxs("div", __assign({ className: classNames(generateTextClassName()) }, { children: [_jsx("div", { children: text }), renderSecondaryText()] })), renderRightElement()] })));
|
|
193
|
+
};
|
|
194
|
+
export default ListItem;
|
|
195
|
+
//# sourceMappingURL=ListItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ListItem.js","sourceRoot":"","sources":["../../../../src/сomponents/ListItem/ListItem.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAc,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AmB,EAAE,KAClB,EACL,kBAAkB,EAAE,KACjB,CACP,CAAA;AACH,CAAC,CAAA;AAED,eAAe,QAAQ,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './ListItem';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/сomponents/ListItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA"}
|