@alfalab/core-components-select 13.0.2 → 13.1.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/Component-bfb28123.d.ts +241 -0
- package/{Component-6d167ee5.js → Component-bfb28123.js} +27 -17
- package/{Component-47b7b784.d.ts → Component-ebc21ddc.d.ts} +0 -0
- package/{Component-47b7b784.js → Component-ebc21ddc.js} +2 -2
- package/Component.js +6 -2
- package/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +3 -3
- package/components/base-checkmark/Component.d.ts +4 -0
- package/components/base-checkmark/Component.js +29 -0
- package/components/base-checkmark/index.css +32 -0
- package/components/base-checkmark/index.d.ts +1 -0
- package/components/base-checkmark/index.js +13 -0
- package/components/base-option/Component.d.ts +4 -0
- package/components/base-option/Component.js +46 -0
- package/components/base-option/index.css +95 -0
- package/components/base-option/index.d.ts +1 -0
- package/components/base-option/index.js +15 -0
- package/components/base-select/Component.js +2 -2
- package/components/base-select/index.css +7 -7
- package/components/base-select/index.d.ts +1 -1
- package/components/base-select/index.js +2 -2
- package/components/base-select-mobile/Component.js +10 -5
- package/components/base-select-mobile/checkmark/Component.js +8 -3
- package/components/base-select-mobile/checkmark/index.css +12 -7
- package/components/base-select-mobile/checkmark/index.js +3 -0
- package/components/base-select-mobile/index.css +11 -11
- package/components/base-select-mobile/index.d.ts +1 -1
- package/components/base-select-mobile/index.js +10 -5
- package/components/base-select-mobile/options-list/Component.js +2 -2
- package/components/base-select-mobile/options-list/index.css +9 -9
- package/components/base-select-mobile/options-list/index.js +1 -1
- package/components/checkmark/Component.js +5 -2
- package/components/checkmark/index.css +11 -7
- package/components/checkmark/index.js +2 -0
- package/components/field/Component.js +2 -2
- package/components/field/index.css +9 -9
- package/components/field/index.js +1 -1
- package/components/index.d.ts +1 -0
- package/components/index.js +11 -5
- package/components/native-select/Component.js +1 -1
- package/components/native-select/index.js +1 -1
- package/components/optgroup/Component.js +1 -1
- package/components/optgroup/index.css +8 -8
- package/components/option/Component.js +7 -3
- package/components/option/index.css +20 -20
- package/components/option/index.js +5 -1
- package/components/options-list/Component.js +2 -2
- package/components/options-list/index.css +6 -6
- package/components/options-list/index.js +1 -1
- package/components/select-mobile/Component.js +10 -5
- package/components/select-mobile/index.d.ts +1 -1
- package/components/select-mobile/index.js +10 -5
- package/components/select-modal-mobile/Component.js +10 -5
- package/components/select-modal-mobile/index.d.ts +1 -1
- package/components/select-modal-mobile/index.js +10 -5
- package/components/virtual-options-list/Component.js +2 -2
- package/components/virtual-options-list/index.css +12 -12
- package/components/virtual-options-list/index.js +1 -1
- package/cssm/Component-c7975bd7.d.ts +241 -0
- package/cssm/{Component-095a346d.js → Component-c7975bd7.js} +25 -12
- package/cssm/Component.js +5 -0
- package/cssm/components/base-checkmark/Component.d.ts +4 -0
- package/cssm/components/base-checkmark/Component.js +28 -0
- package/cssm/components/base-checkmark/index.d.ts +1 -0
- package/cssm/components/base-checkmark/index.js +14 -0
- package/cssm/components/base-checkmark/index.module.css +31 -0
- package/cssm/components/base-option/Component.d.ts +4 -0
- package/cssm/components/base-option/Component.js +46 -0
- package/cssm/components/base-option/index.d.ts +1 -0
- package/cssm/components/base-option/index.js +17 -0
- package/cssm/components/base-option/index.module.css +93 -0
- package/cssm/components/base-select-mobile/Component.js +10 -3
- package/cssm/components/base-select-mobile/checkmark/Component.js +7 -2
- package/cssm/components/base-select-mobile/checkmark/index.js +3 -0
- package/cssm/components/base-select-mobile/checkmark/index.module.css +8 -3
- package/cssm/components/base-select-mobile/index.d.ts +1 -1
- package/cssm/components/base-select-mobile/index.js +10 -3
- package/cssm/components/checkmark/Component.js +4 -1
- package/cssm/components/checkmark/index.js +2 -0
- package/cssm/components/checkmark/index.module.css +4 -0
- package/cssm/components/index.d.ts +1 -0
- package/cssm/components/index.js +11 -3
- package/cssm/components/optgroup/index.module.css +2 -2
- package/cssm/components/option/Component.js +6 -1
- package/cssm/components/option/index.js +5 -0
- package/cssm/components/select-mobile/Component.js +10 -3
- package/cssm/components/select-mobile/index.d.ts +1 -1
- package/cssm/components/select-mobile/index.js +10 -3
- package/cssm/components/select-modal-mobile/Component.js +10 -3
- package/cssm/components/select-modal-mobile/index.d.ts +1 -1
- package/cssm/components/select-modal-mobile/index.js +10 -3
- package/cssm/index.js +11 -3
- package/cssm/presets/index.js +10 -3
- package/cssm/presets/useLazyLoading/hook.d.ts +3 -1
- package/cssm/presets/useLazyLoading/hook.js +8 -3
- package/cssm/presets/useSelectWithApply/hook.js +10 -3
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +10 -3
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.js +10 -3
- package/cssm/presets/useSelectWithApply/options-list-with-apply/index.module.css +1 -2
- package/cssm/presets/useSelectWithLoading/hook.d.ts +3 -1
- package/cssm/presets/useSelectWithLoading/hook.js +7 -2
- package/cssm/typings.d.ts +8 -0
- package/esm/{Component-b36e61d9.d.ts → Component-d31180da.d.ts} +0 -0
- package/esm/{Component-b36e61d9.js → Component-d31180da.js} +2 -2
- package/esm/Component-e24906b0.d.ts +241 -0
- package/esm/{Component-dbbe481c.js → Component-e24906b0.js} +27 -17
- package/esm/Component.js +6 -2
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +3 -3
- package/esm/components/base-checkmark/Component.d.ts +4 -0
- package/esm/components/base-checkmark/Component.js +20 -0
- package/esm/components/base-checkmark/index.css +32 -0
- package/esm/components/base-checkmark/index.d.ts +1 -0
- package/esm/components/base-checkmark/index.js +5 -0
- package/esm/components/base-option/Component.d.ts +4 -0
- package/esm/components/base-option/Component.js +37 -0
- package/esm/components/base-option/index.css +95 -0
- package/esm/components/base-option/index.d.ts +1 -0
- package/esm/components/base-option/index.js +7 -0
- package/esm/components/base-select/Component.js +2 -2
- package/esm/components/base-select/index.css +7 -7
- package/esm/components/base-select/index.d.ts +1 -1
- package/esm/components/base-select/index.js +2 -2
- package/esm/components/base-select-mobile/Component.js +10 -5
- package/esm/components/base-select-mobile/checkmark/Component.js +8 -3
- package/esm/components/base-select-mobile/checkmark/index.css +12 -7
- package/esm/components/base-select-mobile/checkmark/index.js +3 -0
- package/esm/components/base-select-mobile/index.css +11 -11
- package/esm/components/base-select-mobile/index.d.ts +1 -1
- package/esm/components/base-select-mobile/index.js +10 -5
- package/esm/components/base-select-mobile/options-list/Component.js +2 -2
- package/esm/components/base-select-mobile/options-list/index.css +9 -9
- package/esm/components/base-select-mobile/options-list/index.js +1 -1
- package/esm/components/checkmark/Component.js +5 -2
- package/esm/components/checkmark/index.css +11 -7
- package/esm/components/checkmark/index.js +2 -0
- package/esm/components/field/Component.js +2 -2
- package/esm/components/field/index.css +9 -9
- package/esm/components/field/index.js +1 -1
- package/esm/components/index.d.ts +1 -0
- package/esm/components/index.js +10 -5
- package/esm/components/native-select/Component.js +1 -1
- package/esm/components/native-select/index.js +1 -1
- package/esm/components/optgroup/Component.js +1 -1
- package/esm/components/optgroup/index.css +8 -8
- package/esm/components/option/Component.js +10 -6
- package/esm/components/option/index.css +20 -20
- package/esm/components/option/index.js +5 -1
- package/esm/components/options-list/Component.js +2 -2
- package/esm/components/options-list/index.css +6 -6
- package/esm/components/options-list/index.js +1 -1
- package/esm/components/select-mobile/Component.js +10 -5
- package/esm/components/select-mobile/index.d.ts +1 -1
- package/esm/components/select-mobile/index.js +10 -5
- package/esm/components/select-modal-mobile/Component.js +10 -5
- package/esm/components/select-modal-mobile/index.d.ts +1 -1
- package/esm/components/select-modal-mobile/index.js +10 -5
- package/esm/components/virtual-options-list/Component.js +2 -2
- package/esm/components/virtual-options-list/index.css +12 -12
- package/esm/components/virtual-options-list/index.js +1 -1
- package/esm/index.js +10 -5
- package/esm/{intersection-observer-f1488f74.d.ts → intersection-observer-75c9afe9.d.ts} +0 -0
- package/esm/{intersection-observer-f1488f74.js → intersection-observer-75c9afe9.js} +0 -0
- package/esm/presets/index.js +10 -5
- package/esm/presets/useLazyLoading/hook.d.ts +3 -1
- package/esm/presets/useLazyLoading/hook.js +10 -6
- package/esm/presets/useLazyLoading/index.css +2 -2
- package/esm/presets/useSelectWithApply/hook.js +10 -5
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +10 -5
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.css +5 -6
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +10 -5
- package/esm/presets/useSelectWithLoading/hook.d.ts +3 -1
- package/esm/presets/useSelectWithLoading/hook.js +9 -5
- package/esm/presets/useSelectWithLoading/index.css +2 -2
- package/esm/{tslib.es6-28e16b18.d.ts → tslib.es6-b639aaa5.d.ts} +0 -0
- package/esm/{tslib.es6-28e16b18.js → tslib.es6-b639aaa5.js} +0 -0
- package/esm/typings.d.ts +8 -0
- package/index.js +11 -5
- package/{intersection-observer-a8302d8a.d.ts → intersection-observer-59773a48.d.ts} +0 -0
- package/{intersection-observer-a8302d8a.js → intersection-observer-59773a48.js} +0 -0
- package/modern/{Component-30d321bc.d.ts → Component-6c794caf.d.ts} +0 -0
- package/modern/{Component-30d321bc.js → Component-6c794caf.js} +1 -1
- package/modern/Component-b2369a4f.d.ts +241 -0
- package/modern/{Component-90abbd87.js → Component-b2369a4f.js} +35 -26
- package/modern/Component.js +5 -1
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +3 -3
- package/modern/components/base-checkmark/Component.d.ts +4 -0
- package/modern/components/base-checkmark/Component.js +18 -0
- package/modern/components/base-checkmark/index.css +32 -0
- package/modern/components/base-checkmark/index.d.ts +1 -0
- package/modern/components/base-checkmark/index.js +5 -0
- package/modern/components/base-option/Component.d.ts +4 -0
- package/modern/components/base-option/Component.js +34 -0
- package/modern/components/base-option/index.css +95 -0
- package/modern/components/base-option/index.d.ts +1 -0
- package/modern/components/base-option/index.js +6 -0
- package/modern/components/base-select/Component.js +1 -1
- package/modern/components/base-select/index.css +7 -7
- package/modern/components/base-select/index.d.ts +1 -1
- package/modern/components/base-select/index.js +1 -1
- package/modern/components/base-select-mobile/Component.js +9 -4
- package/modern/components/base-select-mobile/checkmark/Component.js +8 -3
- package/modern/components/base-select-mobile/checkmark/index.css +12 -7
- package/modern/components/base-select-mobile/checkmark/index.js +3 -0
- package/modern/components/base-select-mobile/index.css +11 -11
- package/modern/components/base-select-mobile/index.d.ts +1 -1
- package/modern/components/base-select-mobile/index.js +9 -4
- package/modern/components/base-select-mobile/options-list/Component.js +1 -1
- package/modern/components/base-select-mobile/options-list/index.css +9 -9
- package/modern/components/checkmark/Component.js +5 -2
- package/modern/components/checkmark/index.css +11 -7
- package/modern/components/checkmark/index.js +2 -0
- package/modern/components/field/Component.js +1 -1
- package/modern/components/field/index.css +9 -9
- package/modern/components/index.d.ts +1 -0
- package/modern/components/index.js +9 -4
- package/modern/components/optgroup/Component.js +1 -1
- package/modern/components/optgroup/index.css +8 -8
- package/modern/components/option/Component.js +9 -5
- package/modern/components/option/index.css +20 -20
- package/modern/components/option/index.js +4 -0
- package/modern/components/options-list/Component.js +1 -1
- package/modern/components/options-list/index.css +6 -6
- package/modern/components/select-mobile/Component.js +9 -4
- package/modern/components/select-mobile/index.d.ts +1 -1
- package/modern/components/select-mobile/index.js +9 -4
- package/modern/components/select-modal-mobile/Component.js +9 -4
- package/modern/components/select-modal-mobile/index.d.ts +1 -1
- package/modern/components/select-modal-mobile/index.js +9 -4
- package/modern/components/virtual-options-list/Component.js +1 -1
- package/modern/components/virtual-options-list/index.css +12 -12
- package/modern/index.js +9 -4
- package/modern/{intersection-observer-f1488f74.d.ts → intersection-observer-75c9afe9.d.ts} +0 -0
- package/modern/{intersection-observer-f1488f74.js → intersection-observer-75c9afe9.js} +0 -0
- package/modern/presets/index.js +9 -4
- package/modern/presets/useLazyLoading/hook.d.ts +3 -1
- package/modern/presets/useLazyLoading/hook.js +8 -4
- package/modern/presets/useLazyLoading/index.css +2 -2
- package/modern/presets/useSelectWithApply/hook.js +9 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +9 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.css +5 -6
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +9 -4
- package/modern/presets/useSelectWithLoading/hook.d.ts +3 -1
- package/modern/presets/useSelectWithLoading/hook.js +8 -4
- package/modern/presets/useSelectWithLoading/index.css +2 -2
- package/modern/typings.d.ts +8 -0
- package/package.json +10 -8
- package/presets/index.js +10 -5
- package/presets/useLazyLoading/hook.d.ts +3 -1
- package/presets/useLazyLoading/hook.js +10 -6
- package/presets/useLazyLoading/index.css +2 -2
- package/presets/useSelectWithApply/hook.js +10 -5
- package/presets/useSelectWithApply/options-list-with-apply/Component.js +10 -5
- package/presets/useSelectWithApply/options-list-with-apply/index.css +5 -6
- package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/index.js +10 -5
- package/presets/useSelectWithLoading/hook.d.ts +3 -1
- package/presets/useSelectWithLoading/hook.js +8 -4
- package/presets/useSelectWithLoading/index.css +2 -2
- package/{tslib.es6-c5796feb.d.ts → tslib.es6-c35337da.d.ts} +0 -0
- package/{tslib.es6-c5796feb.js → tslib.es6-c35337da.js} +0 -0
- package/typings.d.ts +8 -0
- package/Component-6d167ee5.d.ts +0 -114
- package/Component-db573794.d.ts +0 -73
- package/Component.mobile-3fe0d3e6.d.ts +0 -56
- package/Context-c2e6f1b2.d.ts +0 -4
- package/cssm/Component-095a346d.d.ts +0 -114
- package/cssm/Component-db573794.d.ts +0 -73
- package/cssm/Component.mobile-3fe0d3e6.d.ts +0 -56
- package/cssm/Context-c2e6f1b2.d.ts +0 -4
- package/esm/Component-db573794.d.ts +0 -73
- package/esm/Component-dbbe481c.d.ts +0 -114
- package/esm/Component.mobile-3fe0d3e6.d.ts +0 -56
- package/esm/Context-c2e6f1b2.d.ts +0 -4
- package/modern/Component-90abbd87.d.ts +0 -114
- package/modern/Component-db573794.d.ts +0 -73
- package/modern/Component.mobile-3fe0d3e6.d.ts +0 -56
- package/modern/Context-c2e6f1b2.d.ts +0 -4
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import React from 'react';
|
|
2
3
|
import { BaseSelectProps, OptionProps, OptionShape } from "../../typings";
|
|
3
4
|
type useSelectWithLoadingProps = {
|
|
4
5
|
loading?: boolean;
|
|
5
6
|
visibleOptions?: BaseSelectProps['visibleOptions'];
|
|
7
|
+
Option?: React.FC<OptionProps>;
|
|
6
8
|
};
|
|
7
|
-
declare function useSelectWithLoading({ loading, visibleOptions, }: useSelectWithLoadingProps): {
|
|
9
|
+
declare function useSelectWithLoading({ loading, visibleOptions, Option, }: useSelectWithLoadingProps): {
|
|
8
10
|
Option: (props: OptionProps) => JSX.Element;
|
|
9
11
|
options: OptionShape[];
|
|
10
12
|
} | null;
|
|
@@ -5,6 +5,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../../tslib.es6-0857346e.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
require('classnames');
|
|
8
|
+
require('@alfalab/core-components/badge');
|
|
9
|
+
require('@alfalab/icons-glyph/CheckmarkCircleMIcon');
|
|
10
|
+
require('@alfalab/icons-glyph/CheckmarkMIcon');
|
|
11
|
+
require('../../components/base-select-mobile/checkmark/index.module.css');
|
|
12
|
+
require('../../components/base-select-mobile/checkmark/Component.js');
|
|
8
13
|
require('@alfalab/core-components-checkbox/cssm');
|
|
9
14
|
require('../../components/checkmark/index.module.css');
|
|
10
15
|
require('../../components/checkmark/Component.js');
|
|
@@ -19,8 +24,8 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
|
19
24
|
var styles__default = /*#__PURE__*/_interopDefaultLegacy(styles);
|
|
20
25
|
|
|
21
26
|
function useSelectWithLoading(_a) {
|
|
22
|
-
var _b = _a.loading, loading = _b === void 0 ? false : _b, _c = _a.visibleOptions, visibleOptions = _c === void 0 ? 6 : _c;
|
|
23
|
-
var renderOption =
|
|
27
|
+
var _b = _a.loading, loading = _b === void 0 ? false : _b, _c = _a.visibleOptions, visibleOptions = _c === void 0 ? 6 : _c, _d = _a.Option, Option = _d === void 0 ? components_option_Component.Option : _d;
|
|
28
|
+
var renderOption = function (props) { return (React__default['default'].createElement(Option, tslib_es6.__assign({}, props, { Checkmark: null, highlighted: loading ? false : props.highlighted }))); };
|
|
24
29
|
var options = Array(visibleOptions)
|
|
25
30
|
.fill(0)
|
|
26
31
|
.map(function (_, key) { return ({
|
package/cssm/typings.d.ts
CHANGED
|
@@ -516,6 +516,14 @@ type OptionProps = {
|
|
|
516
516
|
* Идентификатор для систем автоматизированного тестирования
|
|
517
517
|
*/
|
|
518
518
|
dataTestId?: string;
|
|
519
|
+
/**
|
|
520
|
+
* Позиция иконки "галочки"
|
|
521
|
+
*/
|
|
522
|
+
checkmarkPosition?: 'before' | 'after';
|
|
523
|
+
/**
|
|
524
|
+
* Мобильная верcия option.
|
|
525
|
+
*/
|
|
526
|
+
mobile?: boolean;
|
|
519
527
|
};
|
|
520
528
|
type CheckmarkProps = {
|
|
521
529
|
/**
|
|
File without changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as __assign, b as __spreadArray } from './tslib.es6-
|
|
1
|
+
import { a as __assign, b as __spreadArray } from './tslib.es6-b639aaa5.js';
|
|
2
2
|
import React, { forwardRef, useRef, useMemo, useCallback, useEffect } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import mergeRefs from 'react-merge-refs';
|
|
@@ -14,7 +14,7 @@ var getDataTestId = function (dataTestId, element) {
|
|
|
14
14
|
return dataTestId ? "" + dataTestId + elementPart : undefined;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
var styles = {"component":"
|
|
17
|
+
var styles = {"component":"select__component_s9fig","popoverInner":"select__popoverInner_s9fig","optionsList":"select__optionsList_s9fig","nativeSelect":"select__nativeSelect_s9fig","block":"select__block_s9fig"};
|
|
18
18
|
require('./components/base-select/index.css')
|
|
19
19
|
|
|
20
20
|
var BaseSelect = forwardRef(function (_a, ref) {
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ReactNode, FC, ButtonHTMLAttributes, ElementType, AnchorHTMLAttributes } from "react";
|
|
4
|
+
import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
|
|
5
|
+
import { BaseSelectProps, OptionShape, OptionsListProps } from "./typings";
|
|
6
|
+
import { BaseModalProps, BaseModalContext } from "@alfalab/core-components-base-modal";
|
|
7
|
+
import { ButtonProps } from "@alfalab/core-components-button";
|
|
8
|
+
type AdditionalMobileProps = {
|
|
9
|
+
/**
|
|
10
|
+
* Футер
|
|
11
|
+
* @deprecated Используйте bottomSheetProps.actionButton
|
|
12
|
+
*/
|
|
13
|
+
footer?: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* Будет ли свайпаться шторка
|
|
16
|
+
* @deprecated Используйте bottomSheetProps.swipeable
|
|
17
|
+
*/
|
|
18
|
+
swipeable?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Дополнительные пропсы шторки
|
|
21
|
+
*/
|
|
22
|
+
bottomSheetProps?: Partial<BottomSheetProps>;
|
|
23
|
+
};
|
|
24
|
+
type SelectMobileProps = Omit<BaseSelectProps, "OptionsList" | "Checkmark" | "onScroll"> & AdditionalMobileProps;
|
|
25
|
+
declare const SelectMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "OptionsList" | "Checkmark"> & AdditionalMobileProps & React.RefAttributes<unknown>>;
|
|
26
|
+
type SelectMobileProps$0 = Omit<BaseSelectProps, "OptionsList" | "Checkmark" | "onScroll"> & {
|
|
27
|
+
/**
|
|
28
|
+
* Футер
|
|
29
|
+
* @deprecated Используйте bottomSheetProps.actionButton
|
|
30
|
+
*/
|
|
31
|
+
footer?: ReactNode;
|
|
32
|
+
/**
|
|
33
|
+
* Будет ли свайпаться шторка
|
|
34
|
+
* @deprecated Используйте bottomSheetProps.swipeable
|
|
35
|
+
*/
|
|
36
|
+
swipeable?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Отображать в BottomSheet
|
|
39
|
+
*/
|
|
40
|
+
isBottomSheet?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Дополнительные пропсы шторки
|
|
43
|
+
*/
|
|
44
|
+
bottomSheetProps?: Partial<BottomSheetProps>;
|
|
45
|
+
};
|
|
46
|
+
declare const BaseSelectMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "OptionsList" | "Checkmark"> & {
|
|
47
|
+
footer?: ReactNode;
|
|
48
|
+
swipeable?: boolean | undefined;
|
|
49
|
+
isBottomSheet?: boolean | undefined;
|
|
50
|
+
bottomSheetProps?: Partial<BottomSheetProps> | undefined;
|
|
51
|
+
} & React.RefAttributes<unknown>>;
|
|
52
|
+
declare const OptionsListWithApply: React.ForwardRefExoticComponent<OptionsListProps & {
|
|
53
|
+
showClear?: boolean | undefined;
|
|
54
|
+
onClose?: (() => void) | undefined;
|
|
55
|
+
selectedDraft?: OptionShape[] | undefined;
|
|
56
|
+
OptionsList?: React.FC<OptionsListProps & React.RefAttributes<unknown>> | undefined;
|
|
57
|
+
} & React.RefAttributes<unknown>>;
|
|
58
|
+
type ModalDesktopProps = BaseModalProps & {
|
|
59
|
+
/**
|
|
60
|
+
* Ширина модального окна
|
|
61
|
+
* @default "m"
|
|
62
|
+
*/
|
|
63
|
+
size?: "s" | "m" | "l" | "xl" | "fullscreen";
|
|
64
|
+
/**
|
|
65
|
+
* Растягивает модальное окно на весь экран
|
|
66
|
+
* @deprecated Используйте размер fullscreen
|
|
67
|
+
*/
|
|
68
|
+
fullscreen?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* Фиксирует позицию модального окна после открытия,
|
|
71
|
+
* предотвращая скачки, если контент внутри будет меняться
|
|
72
|
+
*/
|
|
73
|
+
fixedPosition?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* Управление наличием закрывающего крестика
|
|
76
|
+
* @default false
|
|
77
|
+
*/
|
|
78
|
+
hasCloser?: boolean;
|
|
79
|
+
};
|
|
80
|
+
type ModalMobileProps = Omit<ModalDesktopProps, "size" | "fixedPosition" | "fullscreen">;
|
|
81
|
+
type View = "desktop" | "mobile";
|
|
82
|
+
type TResponsiveModalContext = {
|
|
83
|
+
view: View;
|
|
84
|
+
size: NonNullable<ModalDesktopProps["size"]>;
|
|
85
|
+
};
|
|
86
|
+
type ContentProps = {
|
|
87
|
+
/**
|
|
88
|
+
* Контент
|
|
89
|
+
*/
|
|
90
|
+
children?: ReactNode;
|
|
91
|
+
/**
|
|
92
|
+
* Дополнительный класс
|
|
93
|
+
*/
|
|
94
|
+
className?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Растягивает контент на всю высоту
|
|
97
|
+
*/
|
|
98
|
+
flex?: boolean;
|
|
99
|
+
};
|
|
100
|
+
type HeaderProps = {
|
|
101
|
+
/**
|
|
102
|
+
* Контент шапки
|
|
103
|
+
*/
|
|
104
|
+
children?: ReactNode;
|
|
105
|
+
/**
|
|
106
|
+
* Слот слева
|
|
107
|
+
*/
|
|
108
|
+
leftAddons?: ReactNode;
|
|
109
|
+
/**
|
|
110
|
+
* Наличие компонента крестика
|
|
111
|
+
*/
|
|
112
|
+
hasCloser?: ReactNode;
|
|
113
|
+
/**
|
|
114
|
+
* Дополнительный класс
|
|
115
|
+
*/
|
|
116
|
+
className?: string;
|
|
117
|
+
/**
|
|
118
|
+
* Дополнительный класс для аддонов
|
|
119
|
+
*/
|
|
120
|
+
addonClassName?: string;
|
|
121
|
+
/**
|
|
122
|
+
* Дополнительный класс для контента
|
|
123
|
+
*/
|
|
124
|
+
contentClassName?: string;
|
|
125
|
+
/**
|
|
126
|
+
* Заголовок шапки
|
|
127
|
+
*/
|
|
128
|
+
title?: string;
|
|
129
|
+
/**
|
|
130
|
+
* Выравнивание заголовка
|
|
131
|
+
*/
|
|
132
|
+
align?: "left" | "center";
|
|
133
|
+
/**
|
|
134
|
+
* Обрезать ли заголовок
|
|
135
|
+
*/
|
|
136
|
+
trim?: boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Фиксирует шапку
|
|
139
|
+
*/
|
|
140
|
+
sticky?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
143
|
+
*/
|
|
144
|
+
dataTestId?: string;
|
|
145
|
+
};
|
|
146
|
+
type FooterProps = {
|
|
147
|
+
/**
|
|
148
|
+
* Контент футера
|
|
149
|
+
*/
|
|
150
|
+
children?: ReactNode;
|
|
151
|
+
/**
|
|
152
|
+
* Дополнительный класс
|
|
153
|
+
*/
|
|
154
|
+
className?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Фиксирует футер
|
|
157
|
+
*/
|
|
158
|
+
sticky?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* Выравнивание элементов футера
|
|
161
|
+
*/
|
|
162
|
+
layout?: "start" | "center" | "space-between" | "column";
|
|
163
|
+
/**
|
|
164
|
+
* Отступы между элементами футера
|
|
165
|
+
*/
|
|
166
|
+
gap?: 16 | 24 | 32;
|
|
167
|
+
};
|
|
168
|
+
type IconButtonProps = {
|
|
169
|
+
/**
|
|
170
|
+
* Компонент иконки
|
|
171
|
+
*/
|
|
172
|
+
icon: ElementType<{
|
|
173
|
+
className?: string;
|
|
174
|
+
}>;
|
|
175
|
+
/**
|
|
176
|
+
* Тип кнопки
|
|
177
|
+
*/
|
|
178
|
+
view?: "primary" | "secondary" | "transparent" | "tertiary" | "negative";
|
|
179
|
+
/**
|
|
180
|
+
* Размер компонента
|
|
181
|
+
*/
|
|
182
|
+
size?: "xxs" | "xs" | "s";
|
|
183
|
+
/**
|
|
184
|
+
* Дополнительный класс
|
|
185
|
+
*/
|
|
186
|
+
className?: string;
|
|
187
|
+
/**
|
|
188
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
189
|
+
*/
|
|
190
|
+
dataTestId?: string;
|
|
191
|
+
/**
|
|
192
|
+
* Набор цветов для компонента
|
|
193
|
+
*/
|
|
194
|
+
colors?: "default" | "inverted";
|
|
195
|
+
} & Omit<ButtonHTMLAttributes<HTMLButtonElement>, "size"> & Pick<ButtonProps, "href" | "loading"> & Pick<AnchorHTMLAttributes<HTMLAnchorElement>, "target" | "download">;
|
|
196
|
+
type CloserProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
197
|
+
/**
|
|
198
|
+
* Дополнительный класс
|
|
199
|
+
*/
|
|
200
|
+
className?: string;
|
|
201
|
+
/**
|
|
202
|
+
* Позиция крестика
|
|
203
|
+
*/
|
|
204
|
+
align?: "left" | "right";
|
|
205
|
+
/**
|
|
206
|
+
* Размер кнопки
|
|
207
|
+
*/
|
|
208
|
+
size?: IconButtonProps["size"];
|
|
209
|
+
/**
|
|
210
|
+
* Фиксирует крестик
|
|
211
|
+
*/
|
|
212
|
+
sticky?: boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Иконка
|
|
215
|
+
*/
|
|
216
|
+
icon?: ElementType;
|
|
217
|
+
/**
|
|
218
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
219
|
+
*/
|
|
220
|
+
dataTestId?: string;
|
|
221
|
+
};
|
|
222
|
+
declare const ModalMobile: React.ForwardRefExoticComponent<ModalMobileProps & React.RefAttributes<HTMLDivElement>> & {
|
|
223
|
+
Content: React.FC<ContentProps>;
|
|
224
|
+
Header: React.FC<HeaderProps>;
|
|
225
|
+
Footer: React.FC<FooterProps>;
|
|
226
|
+
Closer: React.FC<CloserProps>;
|
|
227
|
+
};
|
|
228
|
+
declare const Content: FC<ContentProps>;
|
|
229
|
+
declare const Modal: React.ForwardRefExoticComponent<import("@alfalab/core-components-base-modal").BaseModalProps & {
|
|
230
|
+
size?: "s" | "m" | "l" | "xl" | "fullscreen" | undefined;
|
|
231
|
+
fullscreen?: boolean | undefined;
|
|
232
|
+
fixedPosition?: boolean | undefined;
|
|
233
|
+
hasCloser?: boolean | undefined;
|
|
234
|
+
} & {
|
|
235
|
+
view: View;
|
|
236
|
+
} & React.RefAttributes<HTMLDivElement>>;
|
|
237
|
+
declare const ResponsiveContext: React.Context<TResponsiveModalContext>;
|
|
238
|
+
declare const ModalContext: import("react").Context<BaseModalContext>;
|
|
239
|
+
type SelectModalMobileProps = Omit<BaseSelectProps, 'OptionsList' | 'Checkmark' | 'onScroll'>;
|
|
240
|
+
declare const SelectModalMobile: React.ForwardRefExoticComponent<SelectModalMobileProps & React.RefAttributes<unknown>>;
|
|
241
|
+
export { AdditionalMobileProps, SelectMobileProps, SelectMobile, BaseSelectMobile, OptionsListWithApply, ModalMobile, Content, Modal, ResponsiveContext, ModalContext, SelectModalMobileProps, SelectModalMobile };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign, b as __spreadArray } from './tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign, b as __spreadArray } from './tslib.es6-b639aaa5.js';
|
|
2
2
|
import React, { useMemo, useState, useRef, useCallback, useEffect, forwardRef } from 'react';
|
|
3
3
|
import cn from 'classnames';
|
|
4
4
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -6,11 +6,15 @@ import { Arrow } from './components/arrow/Component.js';
|
|
|
6
6
|
import mergeRefs from 'react-merge-refs';
|
|
7
7
|
import { useMultipleSelection, useCombobox } from 'downshift';
|
|
8
8
|
import '@alfalab/hooks';
|
|
9
|
-
import { g as getDataTestId } from './Component-
|
|
9
|
+
import { g as getDataTestId } from './Component-d31180da.js';
|
|
10
10
|
import { processOptions } from './utils.js';
|
|
11
11
|
import '@alfalab/core-components-form-control/esm';
|
|
12
12
|
import { Field } from './components/field/Component.js';
|
|
13
13
|
import { Optgroup } from './components/optgroup/Component.js';
|
|
14
|
+
import '@alfalab/core-components/badge';
|
|
15
|
+
import '@alfalab/icons-glyph/CheckmarkCircleMIcon';
|
|
16
|
+
import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
17
|
+
import { Checkmark } from './components/base-select-mobile/checkmark/Component.js';
|
|
14
18
|
import '@alfalab/core-components-checkbox/esm';
|
|
15
19
|
import { Option } from './components/option/Component.js';
|
|
16
20
|
import '@alfalab/core-components-scrollbar/esm';
|
|
@@ -19,11 +23,12 @@ import './Component.js';
|
|
|
19
23
|
import { BottomSheet } from '@alfalab/core-components-bottom-sheet/esm';
|
|
20
24
|
import { ModalMobile } from '@alfalab/core-components-modal/esm/mobile';
|
|
21
25
|
import { Button } from '@alfalab/core-components-button/esm';
|
|
22
|
-
import {
|
|
26
|
+
import { BaseCheckmark } from './components/base-checkmark/Component.js';
|
|
23
27
|
import { OptionsList as OptionsList$1 } from './components/base-select-mobile/options-list/Component.js';
|
|
24
28
|
import 'react-virtual';
|
|
29
|
+
import { BaseOption } from './components/base-option/Component.js';
|
|
25
30
|
import '@alfalab/core-components-skeleton/esm';
|
|
26
|
-
import './intersection-observer-
|
|
31
|
+
import './intersection-observer-75c9afe9.js';
|
|
27
32
|
|
|
28
33
|
var SELECT_ALL_KEY = 'select_all';
|
|
29
34
|
var selectAllOption = { key: SELECT_ALL_KEY, content: 'Выбрать все' };
|
|
@@ -90,7 +95,7 @@ function useSelectWithApply(_a) {
|
|
|
90
95
|
};
|
|
91
96
|
}
|
|
92
97
|
|
|
93
|
-
var styles = {"footer":"
|
|
98
|
+
var styles = {"footer":"select__footer_1nc94","withBorder":"select__withBorder_1nc94"};
|
|
94
99
|
require('./presets/useSelectWithApply/options-list-with-apply/index.css')
|
|
95
100
|
|
|
96
101
|
var OptionsListWithApply = forwardRef(function (_a, ref) {
|
|
@@ -136,7 +141,7 @@ var OptionsListWithApply = forwardRef(function (_a, ref) {
|
|
|
136
141
|
showClear && (React.createElement(Button, { size: 'xxs', view: 'secondary', onClick: handleClear }, "\u0421\u0431\u0440\u043E\u0441\u0438\u0442\u044C"))) })));
|
|
137
142
|
});
|
|
138
143
|
|
|
139
|
-
var styles$1 = {"component":"
|
|
144
|
+
var styles$1 = {"component":"select__component_uv809","popoverInner":"select__popoverInner_uv809","sheet":"select__sheet_uv809","sheetContent":"select__sheetContent_uv809","sheetContainer":"select__sheetContainer_uv809","block":"select__block_uv809","option":"select__option_uv809","optionGroup":"select__optionGroup_uv809"};
|
|
140
145
|
require('./components/base-select-mobile/index.css')
|
|
141
146
|
|
|
142
147
|
var BaseSelectMobile = forwardRef(function (_a, ref) {
|
|
@@ -279,14 +284,19 @@ var BaseSelectMobile = forwardRef(function (_a, ref) {
|
|
|
279
284
|
openMenu();
|
|
280
285
|
}
|
|
281
286
|
};
|
|
282
|
-
var getOptionProps = function (option, index) {
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
var getOptionProps = function (option, index) {
|
|
288
|
+
var selectedItem = selectedItems.includes(option);
|
|
289
|
+
return __assign(__assign({}, optionProps), { mobile: true, className: cn(styles$1.option, optionClassName), innerProps: getItemProps({
|
|
290
|
+
index: index,
|
|
291
|
+
item: option,
|
|
292
|
+
disabled: option.disabled,
|
|
293
|
+
onMouseDown: function (event) { return event.preventDefault(); },
|
|
294
|
+
}), multiple: multiple, index: index, option: option, size: optionsSize, disabled: option.disabled, highlighted: index === highlightedIndex, selected: selectedItem, dataTestId: getDataTestId(dataTestId, 'option'),
|
|
295
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
296
|
+
Checkmark: function () {
|
|
297
|
+
return Option$1 === BaseOption ? (React.createElement(BaseCheckmark, { selected: selectedItem, multiple: multiple })) : (React.createElement(Checkmark, { selected: selectedItem }));
|
|
298
|
+
} });
|
|
299
|
+
};
|
|
290
300
|
useEffect(function () {
|
|
291
301
|
if (defaultOpen)
|
|
292
302
|
openMenu();
|
|
@@ -328,10 +338,10 @@ var BaseSelectMobile = forwardRef(function (_a, ref) {
|
|
|
328
338
|
}, dataTestId: getDataTestId(dataTestId, 'field') }, fieldProps)),
|
|
329
339
|
name && renderValue(),
|
|
330
340
|
isBottomSheet ? (React.createElement(BottomSheet, __assign({ open: open, onClose: handleClose, className: styles$1.sheet, contentClassName: styles$1.sheetContent, containerClassName: styles$1.sheetContainer, title: placeholder, actionButton: footer, stickyHeader: true, hasCloser: true, swipeable: swipeable }, bottomSheetProps),
|
|
331
|
-
React.createElement("div", __assign({}, menuProps, { className:
|
|
341
|
+
React.createElement("div", __assign({}, menuProps, { className: optionsListClassName }),
|
|
332
342
|
React.createElement(OptionsListWithApply, __assign({}, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, size: size, options: options, OptionsList: OptionsList$1, Optgroup: Optgroup$1, Option: Option$1, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, dataTestId: getDataTestId(dataTestId, 'options-list'), optionGroupClassName: cn(styles$1.optionGroup, optionGroupClassName), showFooter: multiple, onApply: handleApply, onClear: handleClear }))))) : (React.createElement(ModalMobile, { open: open, onClose: handleClose, contentClassName: styles$1.sheetContent, hasCloser: true },
|
|
333
|
-
React.createElement(ModalMobile.Header, { hasCloser: true, title: placeholder, sticky: true
|
|
334
|
-
React.createElement("div", __assign({}, menuProps, { className:
|
|
343
|
+
React.createElement(ModalMobile.Header, { hasCloser: true, title: placeholder, sticky: true }),
|
|
344
|
+
React.createElement("div", __assign({}, menuProps, { className: optionsListClassName }),
|
|
335
345
|
React.createElement(OptionsListWithApply, __assign({}, optionsListProps, { flatOptions: flatOptions, highlightedIndex: highlightedIndex, size: size, options: options, OptionsList: OptionsList$1, Optgroup: Optgroup$1, Option: Option$1, selectedItems: selectedItems, setSelectedItems: setSelectedItems, toggleMenu: toggleMenu, getOptionProps: getOptionProps, dataTestId: getDataTestId(dataTestId, 'options-list'), optionGroupClassName: cn(styles$1.optionGroup, optionGroupClassName), showFooter: multiple, onApply: handleApply, onClear: handleClear })))))));
|
|
336
346
|
});
|
|
337
347
|
|
package/esm/Component.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as __rest, a as __assign } from './tslib.es6-
|
|
1
|
+
import { _ as __rest, a as __assign } from './tslib.es6-b639aaa5.js';
|
|
2
2
|
import React, { forwardRef } from 'react';
|
|
3
3
|
import 'classnames';
|
|
4
4
|
import '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
@@ -8,12 +8,16 @@ import '@juggle/resize-observer';
|
|
|
8
8
|
import 'downshift';
|
|
9
9
|
import '@alfalab/core-components-popover/esm';
|
|
10
10
|
import '@alfalab/hooks';
|
|
11
|
-
import { B as BaseSelect } from './Component-
|
|
11
|
+
import { B as BaseSelect } from './Component-d31180da.js';
|
|
12
12
|
import './utils.js';
|
|
13
13
|
import './components/native-select/Component.js';
|
|
14
14
|
import '@alfalab/core-components-form-control/esm';
|
|
15
15
|
import { Field } from './components/field/Component.js';
|
|
16
16
|
import { Optgroup } from './components/optgroup/Component.js';
|
|
17
|
+
import '@alfalab/core-components/badge';
|
|
18
|
+
import '@alfalab/icons-glyph/CheckmarkCircleMIcon';
|
|
19
|
+
import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
20
|
+
import './components/base-select-mobile/checkmark/Component.js';
|
|
17
21
|
import '@alfalab/core-components-checkbox/esm';
|
|
18
22
|
import './components/checkmark/Component.js';
|
|
19
23
|
import { Option } from './components/option/Component.js';
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import cn from 'classnames';
|
|
3
3
|
import { ChevronDownMIcon } from '@alfalab/icons-glyph/ChevronDownMIcon';
|
|
4
4
|
|
|
5
|
-
var styles = {"arrow":"
|
|
5
|
+
var styles = {"arrow":"select__arrow_14th9","open":"select__open_14th9"};
|
|
6
6
|
require('./index.css')
|
|
7
7
|
|
|
8
8
|
var Arrow = function (_a) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/* hash:
|
|
1
|
+
/* hash: 1wu00 */
|
|
2
2
|
:root {
|
|
3
3
|
--color-light-graphic-primary: #0b1f35;
|
|
4
4
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
|
|
25
25
|
/* optgroup */
|
|
26
26
|
}
|
|
27
|
-
.
|
|
27
|
+
.select__arrow_14th9 {
|
|
28
28
|
display: block;
|
|
29
29
|
width: 24px;
|
|
30
30
|
height: 24px;
|
|
@@ -32,6 +32,6 @@
|
|
|
32
32
|
|
|
33
33
|
transition: transform 0.15s ease-in-out, opacity 0.2s ease;
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
.select__open_14th9 {
|
|
36
36
|
transform: var(--arrow-transform);
|
|
37
37
|
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import cn from 'classnames';
|
|
3
|
+
import { CheckmarkMIcon } from '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
4
|
+
import { Checkbox } from '@alfalab/core-components-checkbox/esm';
|
|
5
|
+
|
|
6
|
+
var styles = {"checkmark":"select__checkmark_1op05","single":"select__single_1op05","selected":"select__selected_1op05"};
|
|
7
|
+
require('./index.css')
|
|
8
|
+
|
|
9
|
+
var BaseCheckmark = function (_a) {
|
|
10
|
+
var _b;
|
|
11
|
+
var selected = _a.selected, _c = _a.disabled, disabled = _c === void 0 ? false : _c, className = _a.className, multiple = _a.multiple;
|
|
12
|
+
var checkmarkClassNames = cn(styles.checkmark, className, (_b = {},
|
|
13
|
+
_b[styles.multiple] = multiple,
|
|
14
|
+
_b[styles.single] = !multiple,
|
|
15
|
+
_b[styles.selected] = selected,
|
|
16
|
+
_b));
|
|
17
|
+
return multiple ? (React.createElement(Checkbox, { checked: selected, disabled: disabled, className: checkmarkClassNames, size: 'm', onClick: function (event) { return event.stopPropagation(); } })) : (React.createElement(CheckmarkMIcon, { className: checkmarkClassNames }));
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export { BaseCheckmark };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* hash: c8r6t */
|
|
2
|
+
:root {
|
|
3
|
+
|
|
4
|
+
/* Hard */
|
|
5
|
+
|
|
6
|
+
/* Up */
|
|
7
|
+
|
|
8
|
+
/* Hard up */
|
|
9
|
+
}
|
|
10
|
+
:root {
|
|
11
|
+
|
|
12
|
+
/* options list */
|
|
13
|
+
|
|
14
|
+
/* option */
|
|
15
|
+
|
|
16
|
+
/* checkmark */
|
|
17
|
+
|
|
18
|
+
/* optgroup */
|
|
19
|
+
}
|
|
20
|
+
.select__checkmark_1op05 {
|
|
21
|
+
flex-shrink: 0;
|
|
22
|
+
box-sizing: border-box;
|
|
23
|
+
}
|
|
24
|
+
.select__single_1op05 {
|
|
25
|
+
display: flex;
|
|
26
|
+
align-items: center;
|
|
27
|
+
justify-content: center;
|
|
28
|
+
opacity: 0
|
|
29
|
+
}
|
|
30
|
+
.select__single_1op05.select__selected_1op05 {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./Component";
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { a as __assign } from '../../tslib.es6-b639aaa5.js';
|
|
2
|
+
import React, { isValidElement } from 'react';
|
|
3
|
+
import cn from 'classnames';
|
|
4
|
+
import '@alfalab/icons-glyph/CheckmarkMIcon';
|
|
5
|
+
import '@alfalab/core-components-checkbox/esm';
|
|
6
|
+
import { BaseCheckmark } from '../base-checkmark/Component.js';
|
|
7
|
+
|
|
8
|
+
var styles = {"option":"select__option_1deip","disabled":"select__disabled_1deip","checkmarkBefore":"select__checkmarkBefore_1deip","checkmarkAfter":"select__checkmarkAfter_1deip","textContent":"select__textContent_1deip","mobileTextContent":"select__mobileTextContent_1deip","selected":"select__selected_1deip","highlighted":"select__highlighted_1deip","content":"select__content_1deip"};
|
|
9
|
+
require('./index.css')
|
|
10
|
+
|
|
11
|
+
var BaseOption = function (_a) {
|
|
12
|
+
var _b;
|
|
13
|
+
var className = _a.className, option = _a.option, children = _a.children, selected = _a.selected, highlighted = _a.highlighted, disabled = _a.disabled, multiple = _a.multiple, _c = _a.Checkmark, Checkmark = _c === void 0 ? BaseCheckmark : _c, _d = _a.checkmarkPosition, checkmarkPosition = _d === void 0 ? multiple ? 'before' : 'after' : _d, innerProps = _a.innerProps, dataTestId = _a.dataTestId, _e = _a.mobile, mobile = _e === void 0 ? false : _e;
|
|
14
|
+
var content = children || option.content || option.key;
|
|
15
|
+
var _f = option.showCheckMark, showCheckMark = _f === void 0 ? true : _f;
|
|
16
|
+
var isTextContent = !isValidElement(content);
|
|
17
|
+
var renderCheckmark = function () {
|
|
18
|
+
if (Checkmark && showCheckMark) {
|
|
19
|
+
return React.createElement(Checkmark, { disabled: disabled, selected: selected, multiple: multiple });
|
|
20
|
+
}
|
|
21
|
+
return null;
|
|
22
|
+
};
|
|
23
|
+
return (React.createElement("div", __assign({}, innerProps, { className: cn(styles.option, className, (_b = {},
|
|
24
|
+
_b[styles.highlighted] = highlighted,
|
|
25
|
+
_b[styles.selected] = selected,
|
|
26
|
+
_b[styles.disabled] = disabled,
|
|
27
|
+
_b[styles.textContent] = isTextContent && !mobile,
|
|
28
|
+
_b[styles.mobileTextContent] = isTextContent && mobile,
|
|
29
|
+
_b[styles.checkmarkAfter] = !isTextContent && checkmarkPosition === 'after',
|
|
30
|
+
_b[styles.checkmarkBefore] = !isTextContent && checkmarkPosition === 'before',
|
|
31
|
+
_b)), "data-test-id": dataTestId }),
|
|
32
|
+
checkmarkPosition === 'before' && renderCheckmark(),
|
|
33
|
+
React.createElement("div", { className: cn(styles.content) }, content),
|
|
34
|
+
checkmarkPosition === 'after' && renderCheckmark()));
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { BaseOption };
|