@alfalab/core-components-select 19.1.0 → 19.1.1
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.responsive.d.ts +1 -1
- package/Component.responsive.js.map +1 -1
- package/components/arrow/index.css +4 -4
- package/components/arrow/index.module.css.js +1 -1
- package/components/arrow/index.module.css.js.map +1 -1
- package/components/base-checkmark/index.css +12 -12
- package/components/base-checkmark/index.module.css.js +1 -1
- package/components/base-checkmark/index.module.css.js.map +1 -1
- package/components/base-option/index.css +14 -14
- package/components/base-option/index.module.css.js +1 -1
- package/components/base-option/index.module.css.js.map +1 -1
- package/components/base-select/Component.d.ts +5 -5
- package/components/base-select/Component.js.map +1 -1
- package/components/base-select/index.css +11 -11
- package/components/base-select/index.module.css.js +1 -1
- package/components/base-select/index.module.css.js.map +1 -1
- package/components/base-select/mobile.css +11 -11
- package/components/base-select/mobile.module.css.js +1 -1
- package/components/base-select/mobile.module.css.js.map +1 -1
- package/components/base-select/types/component-types.d.ts +4 -4
- package/components/checkmark/index.css +11 -11
- package/components/checkmark/index.module.css.js +1 -1
- package/components/checkmark/index.module.css.js.map +1 -1
- package/components/checkmark-mobile/index.css +6 -6
- package/components/checkmark-mobile/index.module.css.js +1 -1
- package/components/checkmark-mobile/index.module.css.js.map +1 -1
- package/components/clear-button/index.css +4 -4
- package/components/clear-button/index.module.css.js +1 -1
- package/components/field/Component.d.ts +1 -1
- package/components/field/index.css +13 -13
- package/components/field/index.module.css.js +1 -1
- package/components/field/index.module.css.js.map +1 -1
- package/components/footer/Component.d.ts +1 -1
- package/components/footer/index.css +4 -4
- package/components/footer/index.module.css.js +1 -1
- package/components/footer/index.module.css.js.map +1 -1
- package/components/native-select/Component.d.ts +1 -1
- package/components/optgroup/index.css +4 -4
- package/components/optgroup/index.module.css.js +1 -1
- package/components/optgroup/index.module.css.js.map +1 -1
- package/components/option/Component.d.ts +1 -2
- package/components/option/desktop/index.css +19 -19
- package/components/option/desktop/index.module.css.js +1 -1
- package/components/option/desktop/index.module.css.js.map +1 -1
- package/components/option/mobile/index.css +16 -16
- package/components/option/mobile/index.module.css.js +1 -1
- package/components/option/mobile/index.module.css.js.map +1 -1
- package/components/options-list/Component.d.ts +25 -25
- package/components/options-list/Component.js +3 -3
- package/components/options-list/Component.js.map +1 -1
- package/components/options-list/index.css +13 -13
- package/components/options-list/index.module.css.js +1 -1
- package/components/options-list/index.module.css.js.map +1 -1
- package/components/search/Component.js.map +1 -1
- package/components/search/index.css +1 -1
- package/components/search/index.module.css.js +1 -1
- package/components/search/index.module.css.js.map +1 -1
- package/components/virtual-options-list/Component.d.ts +25 -25
- package/components/virtual-options-list/Component.js.map +1 -1
- package/components/virtual-options-list/index.css +13 -13
- package/components/virtual-options-list/index.module.css.js +1 -1
- package/components/virtual-options-list/index.module.css.js.map +1 -1
- package/cssm/Component.responsive.d.ts +1 -1
- package/cssm/Component.responsive.js.map +1 -1
- package/cssm/components/base-select/Component.d.ts +5 -5
- package/cssm/components/base-select/Component.js.map +1 -1
- package/cssm/components/base-select/types/component-types.d.ts +4 -4
- package/cssm/components/field/Component.d.ts +1 -1
- package/cssm/components/footer/Component.d.ts +1 -1
- package/cssm/components/native-select/Component.d.ts +1 -1
- package/cssm/components/option/Component.d.ts +1 -2
- package/cssm/components/options-list/Component.d.ts +25 -25
- package/cssm/components/options-list/Component.js +3 -3
- package/cssm/components/options-list/Component.js.map +1 -1
- package/cssm/components/search/Component.js.map +1 -1
- package/cssm/components/virtual-options-list/Component.d.ts +25 -25
- package/cssm/components/virtual-options-list/Component.js.map +1 -1
- package/cssm/desktop/Component.desktop.d.ts +1 -1
- package/cssm/hooks/use-native-scrollbar.d.ts +1 -1
- package/cssm/hooks/use-native-scrollbar.js.map +1 -1
- package/cssm/presets/useLazyLoading/hook.d.ts +2 -2
- package/cssm/presets/useLazyLoading/hook.js.map +1 -1
- package/cssm/presets/useSelectWithApply/hook.d.ts +97 -131
- package/cssm/presets/useSelectWithApply/hook.js.map +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +36 -69
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js.map +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/footer/Component.d.ts +1 -1
- package/cssm/presets/useSelectWithApply/options-list-with-apply/header/Component.d.ts +1 -1
- package/cssm/presets/useSelectWithLoading/hook.d.ts +1 -1
- package/cssm/typings.d.ts +21 -21
- package/cssm/utils.d.ts +4 -4
- package/cssm/utils.js.map +1 -1
- package/desktop/Component.desktop.d.ts +1 -1
- package/esm/Component.responsive.d.ts +1 -1
- package/esm/Component.responsive.js.map +1 -1
- package/esm/components/arrow/index.css +4 -4
- package/esm/components/arrow/index.module.css.js +1 -1
- package/esm/components/arrow/index.module.css.js.map +1 -1
- package/esm/components/base-checkmark/index.css +12 -12
- package/esm/components/base-checkmark/index.module.css.js +1 -1
- package/esm/components/base-checkmark/index.module.css.js.map +1 -1
- package/esm/components/base-option/index.css +14 -14
- package/esm/components/base-option/index.module.css.js +1 -1
- package/esm/components/base-option/index.module.css.js.map +1 -1
- package/esm/components/base-select/Component.d.ts +5 -5
- package/esm/components/base-select/Component.js.map +1 -1
- package/esm/components/base-select/index.css +11 -11
- package/esm/components/base-select/index.module.css.js +1 -1
- package/esm/components/base-select/index.module.css.js.map +1 -1
- package/esm/components/base-select/mobile.css +11 -11
- package/esm/components/base-select/mobile.module.css.js +1 -1
- package/esm/components/base-select/mobile.module.css.js.map +1 -1
- package/esm/components/base-select/types/component-types.d.ts +4 -4
- package/esm/components/checkmark/index.css +11 -11
- package/esm/components/checkmark/index.module.css.js +1 -1
- package/esm/components/checkmark/index.module.css.js.map +1 -1
- package/esm/components/checkmark-mobile/index.css +6 -6
- package/esm/components/checkmark-mobile/index.module.css.js +1 -1
- package/esm/components/checkmark-mobile/index.module.css.js.map +1 -1
- package/esm/components/clear-button/index.css +4 -4
- package/esm/components/clear-button/index.module.css.js +1 -1
- package/esm/components/field/Component.d.ts +1 -1
- package/esm/components/field/index.css +13 -13
- package/esm/components/field/index.module.css.js +1 -1
- package/esm/components/field/index.module.css.js.map +1 -1
- package/esm/components/footer/Component.d.ts +1 -1
- package/esm/components/footer/index.css +4 -4
- package/esm/components/footer/index.module.css.js +1 -1
- package/esm/components/footer/index.module.css.js.map +1 -1
- package/esm/components/native-select/Component.d.ts +1 -1
- package/esm/components/optgroup/index.css +4 -4
- package/esm/components/optgroup/index.module.css.js +1 -1
- package/esm/components/optgroup/index.module.css.js.map +1 -1
- package/esm/components/option/Component.d.ts +1 -2
- package/esm/components/option/desktop/index.css +19 -19
- package/esm/components/option/desktop/index.module.css.js +1 -1
- package/esm/components/option/desktop/index.module.css.js.map +1 -1
- package/esm/components/option/mobile/index.css +16 -16
- package/esm/components/option/mobile/index.module.css.js +1 -1
- package/esm/components/option/mobile/index.module.css.js.map +1 -1
- package/esm/components/options-list/Component.d.ts +25 -25
- package/esm/components/options-list/Component.js +3 -3
- package/esm/components/options-list/Component.js.map +1 -1
- package/esm/components/options-list/index.css +13 -13
- package/esm/components/options-list/index.module.css.js +1 -1
- package/esm/components/options-list/index.module.css.js.map +1 -1
- package/esm/components/search/Component.js.map +1 -1
- package/esm/components/search/index.css +1 -1
- package/esm/components/search/index.module.css.js +1 -1
- package/esm/components/search/index.module.css.js.map +1 -1
- package/esm/components/virtual-options-list/Component.d.ts +25 -25
- package/esm/components/virtual-options-list/Component.js.map +1 -1
- package/esm/components/virtual-options-list/index.css +13 -13
- package/esm/components/virtual-options-list/index.module.css.js +1 -1
- package/esm/components/virtual-options-list/index.module.css.js.map +1 -1
- package/esm/desktop/Component.desktop.d.ts +1 -1
- package/esm/hooks/use-native-scrollbar.d.ts +1 -1
- package/esm/hooks/use-native-scrollbar.js.map +1 -1
- package/esm/presets/useLazyLoading/hook.d.ts +2 -2
- package/esm/presets/useLazyLoading/hook.js.map +1 -1
- package/esm/presets/useSelectWithApply/hook.d.ts +97 -131
- package/esm/presets/useSelectWithApply/hook.js.map +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +36 -69
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js.map +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js.map +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js.map +1 -1
- package/esm/presets/useSelectWithLoading/hook.d.ts +1 -1
- package/esm/presets/useSelectWithLoading/index.css +1 -1
- package/esm/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/esm/typings.d.ts +21 -21
- package/esm/utils.d.ts +4 -4
- package/esm/utils.js.map +1 -1
- package/hooks/use-native-scrollbar.d.ts +1 -1
- package/hooks/use-native-scrollbar.js.map +1 -1
- package/modern/Component.responsive.d.ts +1 -1
- package/modern/Component.responsive.js.map +1 -1
- package/modern/components/arrow/index.css +4 -4
- package/modern/components/arrow/index.module.css.js +1 -1
- package/modern/components/arrow/index.module.css.js.map +1 -1
- package/modern/components/base-checkmark/index.css +12 -12
- package/modern/components/base-checkmark/index.module.css.js +1 -1
- package/modern/components/base-checkmark/index.module.css.js.map +1 -1
- package/modern/components/base-option/index.css +14 -14
- package/modern/components/base-option/index.module.css.js +1 -1
- package/modern/components/base-option/index.module.css.js.map +1 -1
- package/modern/components/base-select/Component.d.ts +5 -5
- package/modern/components/base-select/Component.js.map +1 -1
- package/modern/components/base-select/index.css +11 -11
- package/modern/components/base-select/index.module.css.js +1 -1
- package/modern/components/base-select/index.module.css.js.map +1 -1
- package/modern/components/base-select/mobile.css +11 -11
- package/modern/components/base-select/mobile.module.css.js +1 -1
- package/modern/components/base-select/mobile.module.css.js.map +1 -1
- package/modern/components/base-select/types/component-types.d.ts +4 -4
- package/modern/components/checkmark/index.css +11 -11
- package/modern/components/checkmark/index.module.css.js +1 -1
- package/modern/components/checkmark/index.module.css.js.map +1 -1
- package/modern/components/checkmark-mobile/index.css +6 -6
- package/modern/components/checkmark-mobile/index.module.css.js +1 -1
- package/modern/components/checkmark-mobile/index.module.css.js.map +1 -1
- package/modern/components/clear-button/index.css +4 -4
- package/modern/components/clear-button/index.module.css.js +1 -1
- package/modern/components/field/Component.d.ts +1 -1
- package/modern/components/field/index.css +13 -13
- package/modern/components/field/index.module.css.js +1 -1
- package/modern/components/field/index.module.css.js.map +1 -1
- package/modern/components/footer/Component.d.ts +1 -1
- package/modern/components/footer/index.css +4 -4
- package/modern/components/footer/index.module.css.js +1 -1
- package/modern/components/footer/index.module.css.js.map +1 -1
- package/modern/components/native-select/Component.d.ts +1 -1
- package/modern/components/optgroup/index.css +4 -4
- package/modern/components/optgroup/index.module.css.js +1 -1
- package/modern/components/optgroup/index.module.css.js.map +1 -1
- package/modern/components/option/Component.d.ts +1 -2
- package/modern/components/option/desktop/index.css +19 -19
- package/modern/components/option/desktop/index.module.css.js +1 -1
- package/modern/components/option/desktop/index.module.css.js.map +1 -1
- package/modern/components/option/mobile/index.css +16 -16
- package/modern/components/option/mobile/index.module.css.js +1 -1
- package/modern/components/option/mobile/index.module.css.js.map +1 -1
- package/modern/components/options-list/Component.d.ts +25 -25
- package/modern/components/options-list/Component.js +3 -3
- package/modern/components/options-list/Component.js.map +1 -1
- package/modern/components/options-list/index.css +13 -13
- package/modern/components/options-list/index.module.css.js +1 -1
- package/modern/components/options-list/index.module.css.js.map +1 -1
- package/modern/components/search/Component.js.map +1 -1
- package/modern/components/search/index.css +1 -1
- package/modern/components/search/index.module.css.js +1 -1
- package/modern/components/search/index.module.css.js.map +1 -1
- package/modern/components/virtual-options-list/Component.d.ts +25 -25
- package/modern/components/virtual-options-list/Component.js.map +1 -1
- package/modern/components/virtual-options-list/index.css +13 -13
- package/modern/components/virtual-options-list/index.module.css.js +1 -1
- package/modern/components/virtual-options-list/index.module.css.js.map +1 -1
- package/modern/desktop/Component.desktop.d.ts +1 -1
- package/modern/hooks/use-native-scrollbar.d.ts +1 -1
- package/modern/hooks/use-native-scrollbar.js.map +1 -1
- package/modern/presets/useLazyLoading/hook.d.ts +2 -2
- package/modern/presets/useLazyLoading/hook.js.map +1 -1
- package/modern/presets/useSelectWithApply/hook.d.ts +97 -131
- package/modern/presets/useSelectWithApply/hook.js.map +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +36 -69
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js.map +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js.map +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js.map +1 -1
- package/modern/presets/useSelectWithLoading/hook.d.ts +1 -1
- package/modern/presets/useSelectWithLoading/index.css +1 -1
- package/modern/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/modern/typings.d.ts +21 -21
- package/modern/utils.d.ts +4 -4
- package/modern/utils.js.map +1 -1
- package/moderncssm/Component.responsive.d.ts +1 -1
- package/moderncssm/Component.responsive.js.map +1 -1
- package/moderncssm/components/base-select/Component.d.ts +5 -5
- package/moderncssm/components/base-select/Component.js.map +1 -1
- package/moderncssm/components/base-select/types/component-types.d.ts +4 -4
- package/moderncssm/components/field/Component.d.ts +1 -1
- package/moderncssm/components/footer/Component.d.ts +1 -1
- package/moderncssm/components/native-select/Component.d.ts +1 -1
- package/moderncssm/components/option/Component.d.ts +1 -2
- package/moderncssm/components/options-list/Component.d.ts +25 -25
- package/moderncssm/components/options-list/Component.js +3 -3
- package/moderncssm/components/options-list/Component.js.map +1 -1
- package/moderncssm/components/search/Component.js.map +1 -1
- package/moderncssm/components/virtual-options-list/Component.d.ts +25 -25
- package/moderncssm/components/virtual-options-list/Component.js.map +1 -1
- package/moderncssm/desktop/Component.desktop.d.ts +1 -1
- package/moderncssm/hooks/use-native-scrollbar.d.ts +1 -1
- package/moderncssm/hooks/use-native-scrollbar.js.map +1 -1
- package/moderncssm/presets/useLazyLoading/hook.d.ts +2 -2
- package/moderncssm/presets/useLazyLoading/hook.js.map +1 -1
- package/moderncssm/presets/useSelectWithApply/hook.d.ts +97 -131
- package/moderncssm/presets/useSelectWithApply/hook.js.map +1 -1
- package/moderncssm/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +36 -69
- package/moderncssm/presets/useSelectWithApply/options-list-with-apply/Component.js.map +1 -1
- package/moderncssm/presets/useSelectWithApply/options-list-with-apply/footer/Component.d.ts +1 -1
- package/moderncssm/presets/useSelectWithApply/options-list-with-apply/header/Component.d.ts +1 -1
- package/moderncssm/presets/useSelectWithLoading/hook.d.ts +1 -1
- package/moderncssm/typings.d.ts +21 -21
- package/moderncssm/utils.d.ts +4 -4
- package/moderncssm/utils.js.map +1 -1
- package/package.json +14 -14
- package/presets/useLazyLoading/hook.d.ts +2 -2
- package/presets/useLazyLoading/hook.js.map +1 -1
- package/presets/useSelectWithApply/hook.d.ts +97 -130
- package/presets/useSelectWithApply/hook.js.map +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/Component.d.ts +36 -69
- package/presets/useSelectWithApply/options-list-with-apply/Component.js.map +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/Component.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css.js.map +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/Component.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +4 -4
- package/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.module.css.js.map +1 -1
- package/presets/useSelectWithLoading/hook.d.ts +1 -1
- package/presets/useSelectWithLoading/index.css +1 -1
- package/presets/useSelectWithLoading/index.module.css.js +1 -1
- package/src/components/arrow/index.module.css +1 -1
- package/src/components/base-checkmark/index.module.css +1 -1
- package/src/components/base-option/index.module.css +1 -1
- package/src/components/base-select/index.module.css +1 -1
- package/src/components/base-select/mobile.module.css +1 -1
- package/src/components/checkmark/index.module.css +1 -1
- package/src/components/checkmark-mobile/index.module.css +1 -1
- package/src/components/field/index.module.css +1 -1
- package/src/components/footer/index.module.css +1 -1
- package/src/components/optgroup/index.module.css +1 -1
- package/src/components/option/desktop/index.module.css +1 -1
- package/src/components/option/index.module.css +1 -1
- package/src/components/option/mobile/index.module.css +1 -1
- package/src/components/options-list/Component.tsx +3 -3
- package/src/components/options-list/index.module.css +1 -1
- package/src/components/search/index.module.css +1 -1
- package/src/components/virtual-options-list/index.module.css +1 -1
- package/src/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css +1 -1
- package/src/presets/useSelectWithApply/options-list-with-apply/header/index.module.css +1 -1
- package/typings.d.ts +21 -21
- package/utils.d.ts +4 -4
- package/utils.js.map +1 -1
package/cssm/typings.d.ts
CHANGED
|
@@ -7,8 +7,8 @@ import { type ModalProps } from '@alfalab/core-components-modal/cssm';
|
|
|
7
7
|
import { type ModalFooterProps, type ModalHeaderProps } from '@alfalab/core-components-modal/cssm/shared';
|
|
8
8
|
import { type PopoverProps } from '@alfalab/core-components-popover/cssm';
|
|
9
9
|
import { type UseSelectWithApplyProps } from './presets/useSelectWithApply/hook';
|
|
10
|
-
export
|
|
11
|
-
export
|
|
10
|
+
export type AnyObject = Record<string, any>;
|
|
11
|
+
export type OptionShape = {
|
|
12
12
|
/**
|
|
13
13
|
* Текстовое представление пункта
|
|
14
14
|
*/
|
|
@@ -30,7 +30,7 @@ export declare type OptionShape = {
|
|
|
30
30
|
*/
|
|
31
31
|
value?: any;
|
|
32
32
|
};
|
|
33
|
-
export
|
|
33
|
+
export type GroupShape = {
|
|
34
34
|
/**
|
|
35
35
|
* Заголовок группы
|
|
36
36
|
*/
|
|
@@ -40,7 +40,7 @@ export declare type GroupShape = {
|
|
|
40
40
|
*/
|
|
41
41
|
options: OptionShape[];
|
|
42
42
|
};
|
|
43
|
-
export
|
|
43
|
+
export type BaseSelectChangePayload = {
|
|
44
44
|
selected: OptionShape | null;
|
|
45
45
|
selectedMultiple: OptionShape[];
|
|
46
46
|
initiator: OptionShape | null;
|
|
@@ -306,7 +306,7 @@ export interface BaseSelectProps {
|
|
|
306
306
|
*/
|
|
307
307
|
environment?: Environment;
|
|
308
308
|
}
|
|
309
|
-
export
|
|
309
|
+
export type FieldProps = {
|
|
310
310
|
/**
|
|
311
311
|
* Дополнительный класс
|
|
312
312
|
*/
|
|
@@ -390,7 +390,7 @@ export declare type FieldProps = {
|
|
|
390
390
|
*/
|
|
391
391
|
dataTestId?: string;
|
|
392
392
|
} & AnyObject;
|
|
393
|
-
export
|
|
393
|
+
export type ArrowProps = {
|
|
394
394
|
/**
|
|
395
395
|
* Дополнительный класс
|
|
396
396
|
*/
|
|
@@ -409,7 +409,7 @@ export declare type ArrowProps = {
|
|
|
409
409
|
*/
|
|
410
410
|
size?: BaseSelectProps['size'];
|
|
411
411
|
};
|
|
412
|
-
export
|
|
412
|
+
export type OptionsListProps = Pick<SelectProps, 'client'> & {
|
|
413
413
|
/**
|
|
414
414
|
* Дополнительный класс
|
|
415
415
|
*/
|
|
@@ -540,7 +540,7 @@ export declare type OptionsListProps = Pick<SelectProps, 'client'> & {
|
|
|
540
540
|
*/
|
|
541
541
|
limitDynamicOptionGroupSize?: BaseSelectProps['limitDynamicOptionGroupSize'];
|
|
542
542
|
};
|
|
543
|
-
export
|
|
543
|
+
export type OptgroupProps = {
|
|
544
544
|
/**
|
|
545
545
|
* Дополнительный класс для компонента группы пунктов
|
|
546
546
|
*/
|
|
@@ -578,7 +578,7 @@ export declare type OptgroupProps = {
|
|
|
578
578
|
*/
|
|
579
579
|
multiple?: boolean;
|
|
580
580
|
};
|
|
581
|
-
export
|
|
581
|
+
export type OptionCommonProps = {
|
|
582
582
|
/**
|
|
583
583
|
* Дополнительный класс
|
|
584
584
|
*/
|
|
@@ -648,7 +648,7 @@ export interface OptionProps extends OptionCommonProps, AriaAttributes {
|
|
|
648
648
|
*/
|
|
649
649
|
mobile?: boolean;
|
|
650
650
|
}
|
|
651
|
-
export
|
|
651
|
+
export type CheckmarkProps = {
|
|
652
652
|
/**
|
|
653
653
|
* Флаг, данный пункт выбран
|
|
654
654
|
*/
|
|
@@ -682,9 +682,9 @@ export declare type CheckmarkProps = {
|
|
|
682
682
|
*/
|
|
683
683
|
align?: 'start' | 'center';
|
|
684
684
|
};
|
|
685
|
-
export
|
|
686
|
-
export
|
|
687
|
-
export
|
|
685
|
+
export type SearchProps = InputProps & RefAttributes<HTMLInputElement>;
|
|
686
|
+
export type SelectFieldProps = Omit<FormControlProps, 'size'> & Record<string, unknown>;
|
|
687
|
+
export type AdditionalMobileProps = {
|
|
688
688
|
/**
|
|
689
689
|
* Показывать кнопку 'Сбросить' в футере мобильного компонента
|
|
690
690
|
*/
|
|
@@ -707,7 +707,7 @@ export declare type AdditionalMobileProps = {
|
|
|
707
707
|
*/
|
|
708
708
|
checkmarkPosition?: 'before' | 'after';
|
|
709
709
|
};
|
|
710
|
-
export
|
|
710
|
+
export type BottomSheetSelectMobileProps = {
|
|
711
711
|
/**
|
|
712
712
|
* Футер
|
|
713
713
|
* @deprecated Используйте bottomSheetProps.actionButton
|
|
@@ -725,7 +725,7 @@ export declare type BottomSheetSelectMobileProps = {
|
|
|
725
725
|
bottomAddons?: ((flatOptions: OptionShape[]) => ReactNode) | ReactNode;
|
|
726
726
|
};
|
|
727
727
|
};
|
|
728
|
-
export
|
|
728
|
+
export type ModalSelectMobileProps = {
|
|
729
729
|
/**
|
|
730
730
|
* Дополнительные пропсы шапки модалки
|
|
731
731
|
*/
|
|
@@ -741,20 +741,20 @@ export declare type ModalSelectMobileProps = {
|
|
|
741
741
|
*/
|
|
742
742
|
modalFooterProps?: Partial<ModalFooterProps>;
|
|
743
743
|
};
|
|
744
|
-
|
|
744
|
+
type ConditionalMobileProps = ({
|
|
745
745
|
isBottomSheet?: true;
|
|
746
746
|
} & BottomSheetSelectMobileProps) | ({
|
|
747
747
|
isBottomSheet: false;
|
|
748
748
|
} & ModalSelectMobileProps);
|
|
749
|
-
export
|
|
750
|
-
export
|
|
751
|
-
export
|
|
749
|
+
export type SelectModalMobileProps = Omit<BaseSelectProps, 'Checkmark'> & AdditionalMobileProps & ModalSelectMobileProps;
|
|
750
|
+
export type SelectMobileProps = Omit<BaseSelectProps, 'Checkmark'> & AdditionalMobileProps & ConditionalMobileProps;
|
|
751
|
+
export type SelectDesktopProps = Omit<BaseSelectProps, 'fieldProps'> & {
|
|
752
752
|
/**
|
|
753
753
|
* Пропсы, которые будут прокинуты в компонент поля
|
|
754
754
|
*/
|
|
755
755
|
fieldProps?: SelectFieldProps;
|
|
756
756
|
};
|
|
757
|
-
export
|
|
757
|
+
export type SelectProps = BaseSelectProps & AdditionalMobileProps & ConditionalMobileProps & {
|
|
758
758
|
/**
|
|
759
759
|
* Контрольная точка, с нее начинается desktop версия
|
|
760
760
|
* @default 1024
|
|
@@ -770,7 +770,7 @@ export declare type SelectProps = BaseSelectProps & AdditionalMobileProps & Cond
|
|
|
770
770
|
*/
|
|
771
771
|
defaultMatchMediaValue?: boolean | (() => boolean);
|
|
772
772
|
};
|
|
773
|
-
export
|
|
773
|
+
export type ClearButtonProps = {
|
|
774
774
|
/**
|
|
775
775
|
* Обработчик нажатия на крестик для очистки поля
|
|
776
776
|
*/
|
package/cssm/utils.d.ts
CHANGED
|
@@ -3,16 +3,16 @@ import { type BaseSelectProps, type GroupShape, type OptionShape, type OptionsLi
|
|
|
3
3
|
export declare const isGroup: (item: OptionShape | GroupShape) => item is GroupShape;
|
|
4
4
|
export declare const isOptionShape: (item: OptionShape | string | null) => item is OptionShape;
|
|
5
5
|
export declare const joinOptions: ({ selected, selectedMultiple, valueSeparator, }: {
|
|
6
|
-
selected?: OptionShape
|
|
7
|
-
selectedMultiple?: OptionShape[]
|
|
8
|
-
valueSeparator?: string
|
|
6
|
+
selected?: OptionShape;
|
|
7
|
+
selectedMultiple?: OptionShape[];
|
|
8
|
+
valueSeparator?: string;
|
|
9
9
|
}) => ReactNode[] | null;
|
|
10
10
|
export declare function processOptions(options: BaseSelectProps['options'], selected?: BaseSelectProps['selected'], filterFn?: (option: OptionShape | GroupShape) => boolean, filterGroup?: boolean): {
|
|
11
11
|
filteredOptions: (OptionShape | GroupShape)[];
|
|
12
12
|
flatOptions: OptionShape[];
|
|
13
13
|
selectedOptions: OptionShape[];
|
|
14
14
|
};
|
|
15
|
-
|
|
15
|
+
type useVisibleOptionsArgs = {
|
|
16
16
|
/**
|
|
17
17
|
* Количество видимых пунктов
|
|
18
18
|
*/
|
package/cssm/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n type ReactNode,\n type RefObject,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { fnUtils, getDataTestId, useIsMounted } from '@alfalab/core-components-shared';\nimport { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';\n\nimport { DEFAULT_SEPARATOR } from './consts';\nimport {\n type BaseSelectProps,\n type GroupShape,\n type OptionShape,\n type OptionsListProps,\n} from './typings';\n\nexport const isGroup = (item: OptionShape | GroupShape): item is GroupShape =>\n Object.prototype.hasOwnProperty.call(item, 'options');\n\nexport const isOptionShape = (item: OptionShape | string | null): item is OptionShape =>\n !!item && Object.prototype.hasOwnProperty.call(item, 'key');\n\nexport const joinOptions = ({\n selected,\n selectedMultiple,\n valueSeparator = DEFAULT_SEPARATOR,\n}: {\n selected?: OptionShape;\n selectedMultiple?: OptionShape[];\n valueSeparator?: string;\n}) => {\n const options = selectedMultiple || (selected ? [selected] : []);\n\n if (!options.length) return null;\n\n return options.reduce((acc: Array<ReactNode | string>, option: OptionShape, index: number) => {\n if (isValidElement(option.content)) {\n acc.push(cloneElement(option.content, { key: option.key }));\n } else {\n acc.push(option.content);\n }\n\n if (index < options.length - 1) acc.push(valueSeparator);\n\n return acc;\n }, []);\n};\n\n// За один проход делает список пунктов меню плоским и находит выбранные пункты по ключу\nexport function processOptions(\n options: BaseSelectProps['options'],\n selected: BaseSelectProps['selected'] = [],\n filterFn: (option: OptionShape | GroupShape) => boolean = () => true,\n filterGroup = false,\n) {\n const flatOptions: OptionShape[] = [];\n const filteredOptions: BaseSelectProps['options'] = [];\n\n const selectedArray = Array.isArray(selected) ? selected : [selected];\n const selectedOptions = selectedArray.filter(isOptionShape);\n const selectedKeys = selectedArray.filter(\n (option): option is string => typeof option === 'string',\n );\n\n const isSelected = (option: OptionShape) => selectedKeys.includes(option.key);\n\n const process = (option: OptionShape | GroupShape) => {\n const isGroupOption = isGroup(option);\n\n if (!isGroupOption && isSelected(option)) {\n selectedOptions.push(option);\n }\n\n if (!filterFn(option)) return false;\n\n if (isGroupOption) {\n if (filterGroup) {\n Array.prototype.push.apply(flatOptions, option.options);\n }\n } else {\n flatOptions.push(option);\n }\n\n return true;\n };\n\n options.forEach((option) => {\n if (isGroup(option)) {\n const group: GroupShape = {\n ...option,\n options: [],\n };\n\n option.options.forEach((groupOption) => {\n const matched = process(groupOption);\n\n if (matched) group.options.push(groupOption);\n });\n\n if (group.options.length) {\n filteredOptions.push(group);\n\n return;\n }\n\n if (!filterGroup) return;\n }\n const matched = process(option);\n\n if (matched) filteredOptions.push(option);\n });\n\n return { filteredOptions, flatOptions, selectedOptions };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype useVisibleOptionsArgs = {\n /**\n * Количество видимых пунктов\n */\n visibleOptions: number;\n\n /**\n * Реф на контейнер с пунтами меню\n */\n listRef: RefObject<HTMLElement>;\n\n /**\n * Реф на контейнер, которому нужно установить высоту\n */\n styleTargetRef?: RefObject<HTMLElement>;\n\n /**\n * Флаг открытия меню\n */\n open?: boolean;\n\n /**\n * Позволяет вызвать пересчет высоты\n */\n invalidate?: unknown;\n\n /**\n * Список вариантов выбора\n */\n options?: Array<OptionShape | GroupShape>;\n\n /**\n * Максимальный размер варианта выбора\n */\n size?: Extract<OptionsListProps['size'], number>;\n\n /**\n * Учитывать действительное число вариантов выбора\n */\n actualOptionsCount?: boolean;\n};\n\n// copy-paste of original `useVisibleOptions` before https://github.com/core-ds/core-components/pull/1368\nexport function useVirtualVisibleOptions({\n visibleOptions,\n listRef,\n styleTargetRef = listRef,\n open,\n invalidate,\n options,\n size,\n actualOptionsCount,\n}: useVisibleOptionsArgs) {\n useEffect(() => {\n const measureOptionHeight = (element: HTMLElement) =>\n typeof size === 'number' ? Math.min(element.clientHeight, size) : element.clientHeight;\n\n const list = listRef.current;\n const styleTarget = styleTargetRef.current;\n\n if (open && list && styleTarget && visibleOptions > 0) {\n const childCount = list.children.length;\n const optionsNodes = ([] as HTMLElement[]).slice.call(\n list.children,\n 0,\n visibleOptions + 1,\n );\n\n let height = optionsNodes\n .slice(0, visibleOptions)\n .reduce((acc, child) => acc + measureOptionHeight(child), 0);\n\n if (visibleOptions < childCount) {\n const lastVisibleOptionHeight = measureOptionHeight(\n optionsNodes[optionsNodes.length - 1],\n );\n\n // Если кол-во опций больше visibleOptions на 1, то показываем все опции, иначе добавляем половинку\n height += Math.round(\n childCount - visibleOptions === 1\n ? lastVisibleOptionHeight\n : lastVisibleOptionHeight / 2,\n );\n } else if (\n visibleOptions > childCount &&\n actualOptionsCount &&\n typeof size === 'number'\n ) {\n const actualCount = (options ?? []).reduce(\n (sum, option) => sum + 1 + (isGroup(option) ? option.options.length : 0),\n 0,\n );\n\n height =\n Math.min(\n actualCount === 0 ? /** empty placeholder */ 1 : actualCount,\n visibleOptions,\n ) * size;\n\n if (visibleOptions < actualCount) {\n height += size / 2;\n }\n }\n\n styleTarget.style.height = `${height}px`;\n }\n }, [\n actualOptionsCount,\n listRef,\n open,\n options,\n size,\n styleTargetRef,\n visibleOptions,\n invalidate,\n ]);\n}\n\nexport function useVisibleOptions({\n visibleOptions,\n listRef,\n open,\n options,\n size,\n actualOptionsCount,\n}: useVisibleOptionsArgs) {\n const [, runIfMounted] = useIsMounted();\n const [measured, setMeasured] = useState(false);\n const [height, setHeight] = useState<number | undefined>();\n\n useLayoutEffect_SAFE_FOR_SSR(() => {\n const measureOptionHeight = (element: HTMLElement) =>\n typeof size === 'number' ? Math.min(element.clientHeight, size) : element.clientHeight;\n\n const list = listRef.current;\n\n if (open && list && visibleOptions > 0) {\n const childCount = list.children.length;\n const optionsNodes = ([] as HTMLElement[]).slice.call(\n list.children,\n 0,\n visibleOptions + 1,\n );\n\n let measuredHeight = optionsNodes\n .slice(0, visibleOptions)\n .reduce((acc, child) => acc + measureOptionHeight(child), 0);\n\n if (visibleOptions < childCount) {\n const lastVisibleOptionHeight = measureOptionHeight(\n optionsNodes[optionsNodes.length - 1],\n );\n\n // Если кол-во опций больше visibleOptions на 1, то показываем все опции, иначе добавляем половинку\n measuredHeight += Math.round(\n childCount - visibleOptions === 1\n ? lastVisibleOptionHeight\n : lastVisibleOptionHeight / 2,\n );\n } else if (\n visibleOptions > childCount &&\n actualOptionsCount &&\n typeof size === 'number'\n ) {\n const actualCount = (options ?? []).reduce(\n (sum, option) => sum + 1 + (isGroup(option) ? option.options.length : 0),\n 0,\n );\n\n measuredHeight =\n Math.min(\n actualCount === 0 ? /** empty placeholder */ 1 : actualCount,\n visibleOptions,\n ) * size;\n\n if (visibleOptions < actualCount) {\n measuredHeight += size / 2;\n }\n }\n\n setHeight(measuredHeight);\n\n setMeasured(true);\n\n return () => {\n runIfMounted(() => setMeasured(false));\n };\n }\n\n return fnUtils.noop;\n }, [actualOptionsCount, listRef, open, options, size, visibleOptions, runIfMounted]);\n\n return [measured, height] as const;\n}\n\nexport function defaultFilterFn(optionText: string, search: string) {\n if (!search) return true;\n\n return optionText.toLowerCase().includes(search.toLowerCase());\n}\n\nexport function defaultGroupAccessor(option: GroupShape) {\n return option.label;\n}\n\nexport function defaultAccessor(option: OptionShape) {\n if (typeof option.content === 'string') return option.content;\n if (typeof option.value === 'string') return option.value;\n\n return option.key;\n}\n\n// TODO: перенести\nexport function usePrevious<T>(value: T) {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\n// TODO: перенести\nexport const lastIndexOf = <T>(array: T[], predicate: (item: T) => boolean) => {\n for (let i = array.length - 1; i >= 0; i--) {\n if (predicate(array[i])) return i;\n }\n\n return -1;\n};\n\nexport function getSelectTestIds(dataTestId: string) {\n return {\n select: dataTestId,\n option: getDataTestId(dataTestId, 'option'),\n optionsList: getDataTestId(dataTestId, 'options-list'),\n clearButton: getDataTestId(dataTestId, 'options-list-clear'),\n applyButton: getDataTestId(dataTestId, 'options-list-apply'),\n field: getDataTestId(dataTestId, 'field'),\n fieldFormControl: getDataTestId(dataTestId, 'field-form-control'),\n fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),\n fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),\n fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),\n fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),\n fieldClearIcon: getDataTestId(dataTestId, 'field-clear-icon'),\n searchInput: getDataTestId(dataTestId, 'search'),\n searchFormControl: getDataTestId(dataTestId, 'search-form-control'),\n searchInner: getDataTestId(dataTestId, 'search-form-control-inner'),\n searchLeftAddons: getDataTestId(dataTestId, 'search-form-control-left-addons'),\n searchRightAddons: getDataTestId(dataTestId, 'search-form-control-right-addons'),\n searchError: getDataTestId(dataTestId, 'search-form-control-error-message'),\n searchHint: getDataTestId(dataTestId, 'search-form-control-hint'),\n\n bottomSheet: getDataTestId(dataTestId, 'bottom-sheet'),\n bottomSheetHeader: getDataTestId(dataTestId, 'bottom-sheet-header'),\n bottomSheetContent: getDataTestId(dataTestId, 'bottom-sheet-content'),\n\n modal: getDataTestId(dataTestId, 'modal'),\n modalHeader: getDataTestId(dataTestId, 'modal-header'),\n modalContent: getDataTestId(dataTestId, 'modal-content'),\n };\n}\n"],"names":["DEFAULT_SEPARATOR","isValidElement","cloneElement","useEffect","useIsMounted","useState","useLayoutEffect_SAFE_FOR_SSR","fnUtils","useRef","getDataTestId"],"mappings":";;;;;;;;;;AAqBO,IAAM,OAAO,GAAG,UAAC,IAA8B,EAAA;IAClD,OAAA,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC;AAArD;AAEG,IAAM,aAAa,GAAG,UAAC,IAAiC,EAAA;AAC3D,IAAA,OAAA,CAAC,CAAC,IAAI,IAAI,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC;AAA3D;AAEG,IAAM,WAAW,GAAG,UAAC,EAQ3B,EAAA;QAPG,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,gBAAgB,GAAA,EAAA,CAAA,gBAAA,EAChB,sBAAkC,EAAlC,cAAc,GAAG,EAAA,KAAA,MAAA,GAAAA,wBAAiB,GAAA,EAAA;AAMlC,IAAA,IAAM,OAAO,GAAG,gBAAgB,KAAK,QAAQ,GAAG,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC;IAEhE,IAAI,CAAC,OAAO,CAAC,MAAM;AAAE,QAAA,OAAO,IA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U,EAAE,qBAAqB,CAAC;AACnE,QAAA,kBAAkB,EAAEA,kBAAa,CAAC,UAAU,EAAE,sBAAsB,CAAC;AAErE,QAAA,KAAK,EAAEA,kBAAa,CAAC,UAAU,EAAE,OAAO,CAAC;AACzC,QAAA,WAAW,EAAEA,kBAAa,CAAC,UAAU,EAAE,cAAc,CAAC;AACtD,QAAA,YAAY,EAAEA,kBAAa,CAAC,UAAU,EAAE,eAAe,CAAC;KAC3D;AACL;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../src/utils.ts"],"sourcesContent":["import {\n cloneElement,\n isValidElement,\n type ReactNode,\n type RefObject,\n useEffect,\n useRef,\n useState,\n} from 'react';\n\nimport { fnUtils, getDataTestId, useIsMounted } from '@alfalab/core-components-shared';\nimport { useLayoutEffect_SAFE_FOR_SSR } from '@alfalab/hooks';\n\nimport { DEFAULT_SEPARATOR } from './consts';\nimport {\n type BaseSelectProps,\n type GroupShape,\n type OptionShape,\n type OptionsListProps,\n} from './typings';\n\nexport const isGroup = (item: OptionShape | GroupShape): item is GroupShape =>\n Object.prototype.hasOwnProperty.call(item, 'options');\n\nexport const isOptionShape = (item: OptionShape | string | null): item is OptionShape =>\n !!item && Object.prototype.hasOwnProperty.call(item, 'key');\n\nexport const joinOptions = ({\n selected,\n selectedMultiple,\n valueSeparator = DEFAULT_SEPARATOR,\n}: {\n selected?: OptionShape;\n selectedMultiple?: OptionShape[];\n valueSeparator?: string;\n}) => {\n const options = selectedMultiple || (selected ? [selected] : []);\n\n if (!options.length) return null;\n\n return options.reduce((acc: Array<ReactNode | string>, option: OptionShape, index: number) => {\n if (isValidElement(option.content)) {\n acc.push(cloneElement(option.content, { key: option.key }));\n } else {\n acc.push(option.content);\n }\n\n if (index < options.length - 1) acc.push(valueSeparator);\n\n return acc;\n }, []);\n};\n\n// За один проход делает список пунктов меню плоским и находит выбранные пункты по ключу\nexport function processOptions(\n options: BaseSelectProps['options'],\n selected: BaseSelectProps['selected'] = [],\n filterFn: (option: OptionShape | GroupShape) => boolean = () => true,\n filterGroup = false,\n) {\n const flatOptions: OptionShape[] = [];\n const filteredOptions: BaseSelectProps['options'] = [];\n\n const selectedArray = Array.isArray(selected) ? selected : [selected];\n const selectedOptions = selectedArray.filter(isOptionShape);\n const selectedKeys = selectedArray.filter(\n (option): option is string => typeof option === 'string',\n );\n\n const isSelected = (option: OptionShape) => selectedKeys.includes(option.key);\n\n const process = (option: OptionShape | GroupShape) => {\n const isGroupOption = isGroup(option);\n\n if (!isGroupOption && isSelected(option)) {\n selectedOptions.push(option);\n }\n\n if (!filterFn(option)) return false;\n\n if (isGroupOption) {\n if (filterGroup) {\n Array.prototype.push.apply(flatOptions, option.options);\n }\n } else {\n flatOptions.push(option);\n }\n\n return true;\n };\n\n options.forEach((option) => {\n if (isGroup(option)) {\n const group: GroupShape = {\n ...option,\n options: [],\n };\n\n option.options.forEach((groupOption) => {\n const matched = process(groupOption);\n\n if (matched) group.options.push(groupOption);\n });\n\n if (group.options.length) {\n filteredOptions.push(group);\n\n return;\n }\n\n if (!filterGroup) return;\n }\n const matched = process(option);\n\n if (matched) filteredOptions.push(option);\n });\n\n return { filteredOptions, flatOptions, selectedOptions };\n}\n\n// eslint-disable-next-line @typescript-eslint/naming-convention\ntype useVisibleOptionsArgs = {\n /**\n * Количество видимых пунктов\n */\n visibleOptions: number;\n\n /**\n * Реф на контейнер с пунтами меню\n */\n listRef: RefObject<HTMLElement>;\n\n /**\n * Реф на контейнер, которому нужно установить высоту\n */\n styleTargetRef?: RefObject<HTMLElement>;\n\n /**\n * Флаг открытия меню\n */\n open?: boolean;\n\n /**\n * Позволяет вызвать пересчет высоты\n */\n invalidate?: unknown;\n\n /**\n * Список вариантов выбора\n */\n options?: Array<OptionShape | GroupShape>;\n\n /**\n * Максимальный размер варианта выбора\n */\n size?: Extract<OptionsListProps['size'], number>;\n\n /**\n * Учитывать действительное число вариантов выбора\n */\n actualOptionsCount?: boolean;\n};\n\n// copy-paste of original `useVisibleOptions` before https://github.com/core-ds/core-components/pull/1368\nexport function useVirtualVisibleOptions({\n visibleOptions,\n listRef,\n styleTargetRef = listRef,\n open,\n invalidate,\n options,\n size,\n actualOptionsCount,\n}: useVisibleOptionsArgs) {\n useEffect(() => {\n const measureOptionHeight = (element: HTMLElement) =>\n typeof size === 'number' ? Math.min(element.clientHeight, size) : element.clientHeight;\n\n const list = listRef.current;\n const styleTarget = styleTargetRef.current;\n\n if (open && list && styleTarget && visibleOptions > 0) {\n const childCount = list.children.length;\n const optionsNodes = ([] as HTMLElement[]).slice.call(\n list.children,\n 0,\n visibleOptions + 1,\n );\n\n let height = optionsNodes\n .slice(0, visibleOptions)\n .reduce((acc, child) => acc + measureOptionHeight(child), 0);\n\n if (visibleOptions < childCount) {\n const lastVisibleOptionHeight = measureOptionHeight(\n optionsNodes[optionsNodes.length - 1],\n );\n\n // Если кол-во опций больше visibleOptions на 1, то показываем все опции, иначе добавляем половинку\n height += Math.round(\n childCount - visibleOptions === 1\n ? lastVisibleOptionHeight\n : lastVisibleOptionHeight / 2,\n );\n } else if (\n visibleOptions > childCount &&\n actualOptionsCount &&\n typeof size === 'number'\n ) {\n const actualCount = (options ?? []).reduce(\n (sum, option) => sum + 1 + (isGroup(option) ? option.options.length : 0),\n 0,\n );\n\n height =\n Math.min(\n actualCount === 0 ? /** empty placeholder */ 1 : actualCount,\n visibleOptions,\n ) * size;\n\n if (visibleOptions < actualCount) {\n height += size / 2;\n }\n }\n\n styleTarget.style.height = `${height}px`;\n }\n }, [\n actualOptionsCount,\n listRef,\n open,\n options,\n size,\n styleTargetRef,\n visibleOptions,\n invalidate,\n ]);\n}\n\nexport function useVisibleOptions({\n visibleOptions,\n listRef,\n open,\n options,\n size,\n actualOptionsCount,\n}: useVisibleOptionsArgs) {\n const [, runIfMounted] = useIsMounted();\n const [measured, setMeasured] = useState(false);\n const [height, setHeight] = useState<number | undefined>();\n\n useLayoutEffect_SAFE_FOR_SSR(() => {\n const measureOptionHeight = (element: HTMLElement) =>\n typeof size === 'number' ? Math.min(element.clientHeight, size) : element.clientHeight;\n\n const list = listRef.current;\n\n if (open && list && visibleOptions > 0) {\n const childCount = list.children.length;\n const optionsNodes = ([] as HTMLElement[]).slice.call(\n list.children,\n 0,\n visibleOptions + 1,\n );\n\n let measuredHeight = optionsNodes\n .slice(0, visibleOptions)\n .reduce((acc, child) => acc + measureOptionHeight(child), 0);\n\n if (visibleOptions < childCount) {\n const lastVisibleOptionHeight = measureOptionHeight(\n optionsNodes[optionsNodes.length - 1],\n );\n\n // Если кол-во опций больше visibleOptions на 1, то показываем все опции, иначе добавляем половинку\n measuredHeight += Math.round(\n childCount - visibleOptions === 1\n ? lastVisibleOptionHeight\n : lastVisibleOptionHeight / 2,\n );\n } else if (\n visibleOptions > childCount &&\n actualOptionsCount &&\n typeof size === 'number'\n ) {\n const actualCount = (options ?? []).reduce(\n (sum, option) => sum + 1 + (isGroup(option) ? option.options.length : 0),\n 0,\n );\n\n measuredHeight =\n Math.min(\n actualCount === 0 ? /** empty placeholder */ 1 : actualCount,\n visibleOptions,\n ) * size;\n\n if (visibleOptions < actualCount) {\n measuredHeight += size / 2;\n }\n }\n\n setHeight(measuredHeight);\n\n setMeasured(true);\n\n return () => {\n runIfMounted(() => setMeasured(false));\n };\n }\n\n return fnUtils.noop;\n }, [actualOptionsCount, listRef, open, options, size, visibleOptions, runIfMounted]);\n\n return [measured, height] as const;\n}\n\nexport function defaultFilterFn(optionText: string, search: string) {\n if (!search) return true;\n\n return optionText.toLowerCase().includes(search.toLowerCase());\n}\n\nexport function defaultGroupAccessor(option: GroupShape) {\n return option.label;\n}\n\nexport function defaultAccessor(option: OptionShape) {\n if (typeof option.content === 'string') return option.content;\n if (typeof option.value === 'string') return option.value;\n\n return option.key;\n}\n\n// TODO: перенести\nexport function usePrevious<T>(value: T) {\n const ref = useRef<T>();\n\n useEffect(() => {\n ref.current = value;\n }, [value]);\n\n return ref.current;\n}\n\n// TODO: перенести\nexport const lastIndexOf = <T>(array: T[], predicate: (item: T) => boolean) => {\n for (let i = array.length - 1; i >= 0; i--) {\n if (predicate(array[i])) return i;\n }\n\n return -1;\n};\n\nexport function getSelectTestIds(dataTestId: string) {\n return {\n select: dataTestId,\n option: getDataTestId(dataTestId, 'option'),\n optionsList: getDataTestId(dataTestId, 'options-list'),\n clearButton: getDataTestId(dataTestId, 'options-list-clear'),\n applyButton: getDataTestId(dataTestId, 'options-list-apply'),\n field: getDataTestId(dataTestId, 'field'),\n fieldFormControl: getDataTestId(dataTestId, 'field-form-control'),\n fieldLeftAddons: getDataTestId(dataTestId, 'field-form-control-left-addons'),\n fieldRightAddons: getDataTestId(dataTestId, 'field-form-control-right-addons'),\n fieldError: getDataTestId(dataTestId, 'field-form-control-error-message'),\n fieldHint: getDataTestId(dataTestId, 'field-form-control-hint'),\n fieldClearIcon: getDataTestId(dataTestId, 'field-clear-icon'),\n searchInput: getDataTestId(dataTestId, 'search'),\n searchFormControl: getDataTestId(dataTestId, 'search-form-control'),\n searchInner: getDataTestId(dataTestId, 'search-form-control-inner'),\n searchLeftAddons: getDataTestId(dataTestId, 'search-form-control-left-addons'),\n searchRightAddons: getDataTestId(dataTestId, 'search-form-control-right-addons'),\n searchError: getDataTestId(dataTestId, 'search-form-control-error-message'),\n searchHint: getDataTestId(dataTestId, 'search-form-control-hint'),\n\n bottomSheet: getDataTestId(dataTestId, 'bottom-sheet'),\n bottomSheetHeader: getDataTestId(dataTestId, 'bottom-sheet-header'),\n bottomSheetContent: getDataTestId(dataTestId, 'bottom-sheet-content'),\n\n modal: getDataTestId(dataTestId, 'modal'),\n modalHeader: getDataTestId(dataTestId, 'modal-header'),\n modalContent: getDataTestId(dataTestId, 'modal-content'),\n };\n}\n"],"names":["DEFAULT_SEPARATOR","isValidElement","cloneElement","useEffect","useIsMounted","useState","useLayoutEffect_SAFE_FOR_SSR","fnUtils","useRef","getDataTestId"],"mappings":";;;;;;;;;;AAqBO,IAAM,OAAO,GAAG,UAAC,IAA8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EA,kBAAa,CAAC,UAAU,EAAE,QAAQ,CAAC;AAChD,QAAA,iBAAiB,EAAEA,kBAAa,CAAC,UAAU,EAAE,qBAAqB,CAAC;AACnE,QAAA,WAAW,EAAEA,kBAAa,CAAC,UAAU,EAAE,2BAA2B,CAAC;AACnE,QAAA,gBAAgB,EAAEA,kBAAa,CAAC,UAAU,EAAE,iCAAiC,CAAC;AAC9E,QAAA,iBAAiB,EAAEA,kBAAa,CAAC,UAAU,EAAE,kCAAkC,CAAC;AAChF,QAAA,WAAW,EAAEA,kBAAa,CAAC,UAAU,EAAE,mCAAmC,CAAC;AAC3E,QAAA,UAAU,EAAEA,kBAAa,CAAC,UAAU,EAAE,0BAA0B,CAAC;AAEjE,QAAA,WAAW,EAAEA,kBAAa,CAAC,UAAU,EAAE,cAAc,CAAC;AACtD,QAAA,iBAAiB,EAAEA,kBAAa,CAAC,UAAU,EAAE,qBAAqB,CAAC;AACnE,QAAA,kBAAkB,EAAEA,kBAAa,CAAC,UAAU,EAAE,sBAAsB,CAAC;AAErE,QAAA,KAAK,EAAEA,kBAAa,CAAC,UAAU,EAAE,OAAO,CAAC;AACzC,QAAA,WAAW,EAAEA,kBAAa,CAAC,UAAU,EAAE,cAAc,CAAC;AACtD,QAAA,YAAY,EAAEA,kBAAa,CAAC,UAAU,EAAE,eAAe,CAAC;KAC3D;AACL;;;;;;;;;;;;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const SelectDesktop: React.ForwardRefExoticComponent<Omit<import("../typings").BaseSelectProps, "fieldProps"> & {
|
|
3
|
-
fieldProps?: import("../typings").SelectFieldProps
|
|
3
|
+
fieldProps?: import("../typings").SelectFieldProps;
|
|
4
4
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { type SelectProps } from './typings';
|
|
3
3
|
export declare const SelectResponsive: React.ForwardRefExoticComponent<(SelectProps & {
|
|
4
|
-
originalProps?: SelectProps
|
|
4
|
+
originalProps?: SelectProps;
|
|
5
5
|
}) & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Component.responsive.js","sources":["../src/Component.responsive.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { SelectDesktop } from './desktop';\nimport { SelectMobile } from './mobile';\nimport { type SelectFieldProps, type SelectProps } from './typings';\n\nexport const SelectResponsive = forwardRef<\n HTMLDivElement,\n SelectProps & { originalProps?: SelectProps }\n>(\n (\n {\n onScroll,\n fieldProps,\n breakpoint,\n client,\n defaultMatchMediaValue = client === undefined ? undefined : client === 'desktop',\n ...restProps\n },\n ref,\n ) => {\n const isDesktop = useIsDesktop(breakpoint, defaultMatchMediaValue);\n\n if (isDesktop) {\n return (\n <SelectDesktop\n onScroll={onScroll}\n {...restProps}\n ref={ref}\n fieldProps={fieldProps as SelectFieldProps}\n />\n );\n }\n\n const mobileProps = {\n ...restProps,\n /* В мобильную версию хук уже зашит, и это единственный передать в мобилку оригинальные пропсы */\n ...restProps.originalProps,\n };\n\n return <SelectMobile fieldProps={fieldProps} {...mobileProps} ref={ref} />;\n },\n);\n\nSelectResponsive.displayName = 'SelectResponsive';\n"],"names":[],"mappings":";;;;;;;IAQa,gBAAgB,GAAG,UAAU,CAItC,UACI,EAOC,EACD,GAAG,EAAA;AAPC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,UAAU,gBAAA,EACV,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,EAAgF,GAAA,EAAA,CAAA,sBAAA,EAAhF,sBAAsB,GAAG,EAAA,KAAA,MAAA,GAAA,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,MAAM,KAAK,SAAS,GAAA,EAAA,EAC7E,SAAS,GAAA,MAAA,CAAA,EAAA,EANhB,4EAOC,CADe;IAIhB,IAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"Component.responsive.js","sources":["../src/Component.responsive.tsx"],"sourcesContent":["import React, { forwardRef } from 'react';\n\nimport { useIsDesktop } from '@alfalab/core-components-mq';\n\nimport { SelectDesktop } from './desktop';\nimport { SelectMobile } from './mobile';\nimport { type SelectFieldProps, type SelectProps } from './typings';\n\nexport const SelectResponsive = forwardRef<\n HTMLDivElement,\n SelectProps & { originalProps?: SelectProps }\n>(\n (\n {\n onScroll,\n fieldProps,\n breakpoint,\n client,\n defaultMatchMediaValue = client === undefined ? undefined : client === 'desktop',\n ...restProps\n },\n ref,\n ) => {\n const isDesktop = useIsDesktop(breakpoint, defaultMatchMediaValue);\n\n if (isDesktop) {\n return (\n <SelectDesktop\n onScroll={onScroll}\n {...restProps}\n ref={ref}\n fieldProps={fieldProps as SelectFieldProps}\n />\n );\n }\n\n const mobileProps = {\n ...restProps,\n /* В мобильную версию хук уже зашит, и это единственный передать в мобилку оригинальные пропсы */\n ...restProps.originalProps,\n };\n\n return <SelectMobile fieldProps={fieldProps} {...mobileProps} ref={ref} />;\n },\n);\n\nSelectResponsive.displayName = 'SelectResponsive';\n"],"names":[],"mappings":";;;;;;;IAQa,gBAAgB,GAAG,UAAU,CAItC,UACI,EAOC,EACD,GAAG,EAAA;AAPC,IAAA,IAAA,QAAQ,GAAA,EAAA,CAAA,QAAA,EACR,UAAU,gBAAA,EACV,UAAU,GAAA,EAAA,CAAA,UAAA,EACV,MAAM,GAAA,EAAA,CAAA,MAAA,EACN,EAAgF,GAAA,EAAA,CAAA,sBAAA,EAAhF,sBAAsB,GAAG,EAAA,KAAA,MAAA,GAAA,MAAM,KAAK,SAAS,GAAG,SAAS,GAAG,MAAM,KAAK,SAAS,GAAA,EAAA,EAC7E,SAAS,GAAA,MAAA,CAAA,EAAA,EANhB,4EAOC,CADe;IAIhB,IAAM,SAAS,GAAG,YAAY,CAAC,UAAU,EAAE,sBAAsB,CAAC;IAElE,IAAI,SAAS,EAAE;AACX,QAAA,QACI,KAAC,CAAA,aAAA,CAAA,aAAa,aACV,QAAQ,EAAE,QAAQ,EACd,EAAA,SAAS,IACb,GAAG,EAAE,GAAG,EACR,UAAU,EAAE,UAA8B,EAAA,CAAA,CAC5C;;IAIV,IAAM,WAAW,yBACV,SAAS,CAAA,EAET,SAAS,CAAC,aAAa,CAC7B;AAED,IAAA,OAAO,KAAC,CAAA,aAAA,CAAA,YAAY,EAAC,QAAA,CAAA,EAAA,UAAU,EAAE,UAAU,EAAM,EAAA,WAAW,EAAE,EAAA,GAAG,EAAE,GAAG,IAAI;AAC9E,CAAC;AAGL,gBAAgB,CAAC,WAAW,GAAG,kBAAkB;;;;"}
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
--select-arrow-color: var(--color-light-neutral-translucent-700);
|
|
10
10
|
--select-arrow-disabled-color: var(--color-light-neutral-translucent-500);
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.select__arrow_xfrkx {
|
|
13
13
|
display: block;
|
|
14
14
|
width: 24px;
|
|
15
15
|
height: 24px;
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
transform 0.15s ease-in-out,
|
|
20
20
|
opacity 0.2s ease;
|
|
21
21
|
}
|
|
22
|
-
.
|
|
22
|
+
.select__arrow_xfrkx.select__disabled_xfrkx {
|
|
23
23
|
color: var(--select-arrow-disabled-color);
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.select__arrow_xfrkx.select__size-40_xfrkx {
|
|
26
26
|
width: auto;
|
|
27
27
|
width: initial;
|
|
28
28
|
height: auto;
|
|
29
29
|
height: initial;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.select__open_xfrkx {
|
|
32
32
|
transform: var(--arrow-transform);
|
|
33
33
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"arrow":"
|
|
3
|
+
var styles = {"arrow":"select__arrow_xfrkx","disabled":"select__disabled_xfrkx","size-40":"select__size-40_xfrkx","open":"select__open_xfrkx"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/arrow/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/arrow/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../vars.css';\n\n.arrow {\n display: block;\n width: 24px;\n height: 24px;\n color: var(--select-arrow-color);\n\n transition:\n transform 0.15s ease-in-out,\n opacity 0.2s ease;\n\n &.disabled {\n color: var(--select-arrow-disabled-color);\n }\n\n &.size-40 {\n width: unset;\n height: unset;\n }\n}\n\n.open {\n transform: var(--arrow-transform);\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,wBAAwB,CAAC,SAAS,CAAC,uBAAuB,CAAC,MAAM,CAAC,oBAAoB,CAAC;;;;"}
|
|
@@ -2,45 +2,45 @@
|
|
|
2
2
|
--gap-s: 12px;
|
|
3
3
|
--gap-12: var(--gap-s);
|
|
4
4
|
}
|
|
5
|
-
.
|
|
5
|
+
.select__checkmark_15098 {
|
|
6
6
|
flex-shrink: 0;
|
|
7
7
|
box-sizing: border-box;
|
|
8
8
|
}
|
|
9
|
-
.
|
|
9
|
+
.select__checkmark_15098.select__start_15098 {
|
|
10
10
|
align-self: start;
|
|
11
11
|
}
|
|
12
|
-
.
|
|
12
|
+
.select__checkmark_15098.select__center_15098 {
|
|
13
13
|
align-self: center;
|
|
14
14
|
}
|
|
15
|
-
.
|
|
15
|
+
.select__positionAfter_15098 {
|
|
16
16
|
margin-left: 0;
|
|
17
17
|
margin-left: initial;
|
|
18
18
|
}
|
|
19
|
-
.
|
|
19
|
+
.select__container_15098 {
|
|
20
20
|
display: flex;
|
|
21
21
|
align-items: center;
|
|
22
22
|
justify-content: center;
|
|
23
23
|
width: 100%;
|
|
24
24
|
}
|
|
25
|
-
.
|
|
25
|
+
.select__container_15098.select__start_15098 {
|
|
26
26
|
align-items: flex-start;
|
|
27
27
|
}
|
|
28
|
-
.
|
|
28
|
+
.select__container_15098.select__center_15098 {
|
|
29
29
|
align-items: center;
|
|
30
30
|
}
|
|
31
|
-
.
|
|
31
|
+
.select__singleIcon_15098 {
|
|
32
32
|
flex-shrink: 0;
|
|
33
33
|
opacity: 0;
|
|
34
34
|
}
|
|
35
|
-
.
|
|
35
|
+
.select__singleIcon_15098.select__before_15098 {
|
|
36
36
|
margin-right: var(--gap-12);
|
|
37
37
|
}
|
|
38
|
-
.
|
|
38
|
+
.select__singleIcon_15098.select__after_15098 {
|
|
39
39
|
margin-left: var(--gap-12);
|
|
40
40
|
}
|
|
41
|
-
.
|
|
41
|
+
.select__singleIcon_15098.select__selected_15098 {
|
|
42
42
|
opacity: 1;
|
|
43
43
|
}
|
|
44
|
-
.
|
|
44
|
+
.select__content_15098 {
|
|
45
45
|
flex: 1;
|
|
46
46
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"checkmark":"
|
|
3
|
+
var styles = {"checkmark":"select__checkmark_15098","start":"select__start_15098","center":"select__center_15098","positionAfter":"select__positionAfter_15098","container":"select__container_15098","singleIcon":"select__singleIcon_15098","before":"select__before_15098","after":"select__after_15098","selected":"select__selected_15098","content":"select__content_15098"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/base-checkmark/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/base-checkmark/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../vars.css';\n\n.checkmark {\n flex-shrink: 0;\n box-sizing: border-box;\n\n &.start {\n align-self: start;\n }\n\n &.center {\n align-self: center;\n }\n}\n\n.positionAfter {\n margin-left: unset;\n}\n\n.container {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 100%;\n\n &.start {\n align-items: flex-start;\n }\n\n &.center {\n align-items: center;\n }\n}\n\n.singleIcon {\n flex-shrink: 0;\n opacity: 0;\n\n &.before {\n margin-right: var(--gap-12);\n }\n\n &.after {\n margin-left: var(--gap-12);\n }\n\n &.selected {\n opacity: 1;\n }\n}\n\n.content {\n flex: 1;\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,WAAW,CAAC,yBAAyB,CAAC,OAAO,CAAC,qBAAqB,CAAC,QAAQ,CAAC,sBAAsB,CAAC,eAAe,CAAC,6BAA6B,CAAC,WAAW,CAAC,yBAAyB,CAAC,YAAY,CAAC,0BAA0B,CAAC,QAAQ,CAAC,sBAAsB,CAAC,OAAO,CAAC,qBAAqB,CAAC,UAAU,CAAC,wBAAwB,CAAC,SAAS,CAAC,uBAAuB,CAAC;;;;"}
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
--select-option-active-color: var(--color-light-text-primary);
|
|
35
35
|
--select-option-disabled-color: var(--color-light-text-secondary);
|
|
36
36
|
}
|
|
37
|
-
.
|
|
37
|
+
.select__option_1jml1 {
|
|
38
38
|
font-size: 16px;
|
|
39
39
|
line-height: 20px;
|
|
40
40
|
font-weight: 400;
|
|
@@ -50,49 +50,49 @@
|
|
|
50
50
|
cursor: pointer;
|
|
51
51
|
min-height: var(--size-s-height);
|
|
52
52
|
}
|
|
53
|
-
.
|
|
53
|
+
.select__option_1jml1:not(.select__disabled_1jml1):active {
|
|
54
54
|
background: var(--select-option-active-background);
|
|
55
55
|
color: var(--select-option-active-color);
|
|
56
56
|
}
|
|
57
|
-
.
|
|
57
|
+
.select__option_1jml1.select__checkmarkBefore_1jml1 {
|
|
58
58
|
padding: var(--gap-0) var(--gap-0) var(--gap-0) var(--gap-12);
|
|
59
59
|
}
|
|
60
|
-
.
|
|
60
|
+
.select__option_1jml1.select__checkmarkBefore_1jml1.select__mobile_1jml1 {
|
|
61
61
|
padding-left: var(--gap-16);
|
|
62
62
|
}
|
|
63
|
-
.
|
|
63
|
+
.select__option_1jml1.select__checkmarkAfter_1jml1.select__checkmarkAfter_1jml1 {
|
|
64
64
|
padding: var(--gap-0) var(--gap-12) var(--gap-0) var(--gap-0);
|
|
65
65
|
}
|
|
66
|
-
.
|
|
66
|
+
.select__option_1jml1.select__checkmarkAfter_1jml1.select__checkmarkAfter_1jml1.select__size-72_1jml1 {
|
|
67
67
|
padding-right: var(--gap-16);
|
|
68
68
|
}
|
|
69
|
-
.
|
|
69
|
+
.select__option_1jml1.select__checkmarkAfter_1jml1.select__checkmarkAfter_1jml1.select__mobile_1jml1 {
|
|
70
70
|
padding-right: var(--gap-20);
|
|
71
71
|
}
|
|
72
|
-
.
|
|
72
|
+
.select__option_1jml1.select__textContent_1jml1 {
|
|
73
73
|
padding: var(--gap-12);
|
|
74
74
|
}
|
|
75
|
-
.
|
|
75
|
+
.select__option_1jml1.select__textContent_1jml1.select__size-72_1jml1 {
|
|
76
76
|
padding-left: var(--gap-16);
|
|
77
77
|
padding-right: var(--gap-16);
|
|
78
78
|
}
|
|
79
|
-
.
|
|
79
|
+
.select__option_1jml1.select__textContent_1jml1.select__mobile_1jml1 {
|
|
80
80
|
padding: var(--gap-16) var(--gap-20) var(--gap-16) var(--gap-16);
|
|
81
81
|
}
|
|
82
|
-
.
|
|
82
|
+
.select__selected_1jml1 {
|
|
83
83
|
background: var(--select-option-selected-background);
|
|
84
84
|
color: var(--select-option-selected-color);
|
|
85
85
|
cursor: default;
|
|
86
86
|
}
|
|
87
|
-
.
|
|
87
|
+
.select__highlighted_1jml1 {
|
|
88
88
|
background: var(--select-option-hover-background);
|
|
89
89
|
color: var(--select-option-hover-color);
|
|
90
90
|
}
|
|
91
|
-
.
|
|
91
|
+
.select__disabled_1jml1 {
|
|
92
92
|
cursor: var(--disabled-cursor);
|
|
93
93
|
background: var(--select-option-disabled-background);
|
|
94
94
|
color: var(--select-option-disabled-color);
|
|
95
95
|
}
|
|
96
|
-
.
|
|
96
|
+
.select__content_1jml1 {
|
|
97
97
|
flex: 1;
|
|
98
98
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
|
-
var styles = {"option":"
|
|
3
|
+
var styles = {"option":"select__option_1jml1","disabled":"select__disabled_1jml1","checkmarkBefore":"select__checkmarkBefore_1jml1","mobile":"select__mobile_1jml1","checkmarkAfter":"select__checkmarkAfter_1jml1","size-72":"select__size-72_1jml1","textContent":"select__textContent_1jml1","selected":"select__selected_1jml1","highlighted":"select__highlighted_1jml1","content":"select__content_1jml1"};
|
|
4
4
|
|
|
5
5
|
export { styles as default };
|
|
6
6
|
//# sourceMappingURL=index.module.css.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.css.js","sources":["../../src/components/base-option/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/
|
|
1
|
+
{"version":3,"file":"index.module.css.js","sources":["../../src/components/base-option/index.module.css"],"sourcesContent":["@import '@alfalab/core-components-vars/src/index.css';\n@import '../../vars.css';\n\n.option {\n @mixin paragraph_component;\n\n display: flex;\n align-items: center;\n transition: background-color 0.2s ease;\n background: var(--select-option-background);\n color: var(--select-option-color);\n box-sizing: border-box;\n position: relative;\n cursor: pointer;\n min-height: var(--size-s-height);\n\n &:not(.disabled):active {\n background: var(--select-option-active-background);\n color: var(--select-option-active-color);\n }\n\n &.checkmarkBefore {\n padding: var(--gap-0) var(--gap-0) var(--gap-0) var(--gap-12);\n\n &.mobile {\n padding-left: var(--gap-16);\n }\n }\n\n &.checkmarkAfter.checkmarkAfter {\n padding: var(--gap-0) var(--gap-12) var(--gap-0) var(--gap-0);\n\n &.size-72 {\n padding-right: var(--gap-16);\n }\n\n &.mobile {\n padding-right: var(--gap-20);\n }\n }\n\n &.textContent {\n padding: var(--gap-12);\n\n &.size-72 {\n padding-left: var(--gap-16);\n padding-right: var(--gap-16);\n }\n\n &.mobile {\n padding: var(--gap-16) var(--gap-20) var(--gap-16) var(--gap-16);\n }\n }\n}\n\n.selected {\n background: var(--select-option-selected-background);\n color: var(--select-option-selected-color);\n cursor: default;\n}\n\n.highlighted {\n background: var(--select-option-hover-background);\n color: var(--select-option-hover-color);\n}\n\n.disabled {\n cursor: var(--disabled-cursor);\n background: var(--select-option-disabled-background);\n color: var(--select-option-disabled-color);\n}\n\n.content {\n flex: 1;\n}\n"],"names":[],"mappings":";;AAEgB,aAAe,CAAC,QAAQ,CAAC,sBAAsB,CAAC,UAAU,CAAC,wBAAwB,CAAC,iBAAiB,CAAC,+BAA+B,CAAC,QAAQ,CAAC,sBAAsB,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,SAAS,CAAC,uBAAuB,CAAC,aAAa,CAAC,2BAA2B,CAAC,UAAU,CAAC,wBAAwB,CAAC,aAAa,CAAC,2BAA2B,CAAC,SAAS,CAAC,uBAAuB,CAAC;;;;"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
export declare const BaseSelect: React.ForwardRefExoticComponent<import("../../typings").BaseSelectProps & import("../../typings").AdditionalMobileProps & import("../../typings").BottomSheetSelectMobileProps & import("../../typings").ModalSelectMobileProps & {
|
|
3
|
-
isBottomSheet?: boolean
|
|
3
|
+
isBottomSheet?: boolean;
|
|
4
4
|
view: "desktop" | "mobile";
|
|
5
|
-
Popover?: React.ForwardRefExoticComponent<import("@alfalab/core-components-popover").PopoverProps & React.RefAttributes<HTMLDivElement
|
|
6
|
-
BottomSheet?: React.ForwardRefExoticComponent<import("@alfalab/core-components-bottom-sheet").BottomSheetProps & React.RefAttributes<HTMLDivElement
|
|
7
|
-
ModalMobile?:
|
|
5
|
+
Popover?: React.ForwardRefExoticComponent<import("@alfalab/core-components-popover").PopoverProps & React.RefAttributes<HTMLDivElement>>;
|
|
6
|
+
BottomSheet?: React.ForwardRefExoticComponent<import("@alfalab/core-components-bottom-sheet").BottomSheetProps & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
ModalMobile?: React.ForwardRefExoticComponent<import("@alfalab/core-components-modal/typings").ModalMobileProps & React.RefAttributes<HTMLDivElement>> & {
|
|
8
8
|
Header: React.FC<import("@alfalab/core-components-modal/shared").ModalHeaderProps>;
|
|
9
9
|
Footer: React.FC<import("@alfalab/core-components-modal/shared").ModalFooterProps>;
|
|
10
10
|
Content: React.FC<import("@alfalab/core-components-modal/typings").ContentProps>;
|
|
11
|
-
}
|
|
11
|
+
};
|
|
12
12
|
} & React.RefAttributes<unknown>>;
|