@alfalab/core-components-select 14.3.5 → 15.0.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.desktop.d.ts +19 -0
- package/{Component.js → Component.desktop.js} +6 -6
- package/Component.mobile-ebda875c.d.ts +6 -0
- package/Component.mobile-f1f15074.d.ts +387 -0
- package/Component.mobile.d.ts +41 -0
- package/Component.mobile.js +62 -0
- package/Component.modal.mobile.d.ts +60 -0
- package/Component.modal.mobile.js +62 -0
- package/Component.responsive.d.ts +1 -1
- package/Component.responsive.js +26 -25
- package/components/arrow/Component.js +1 -1
- package/components/arrow/index.css +3 -3
- package/components/base-checkmark/Component.js +1 -1
- package/components/base-checkmark/index.css +4 -4
- package/components/base-option/Component.js +1 -1
- package/components/base-option/index.css +13 -13
- package/components/base-select/Component.js +6 -6
- package/components/base-select/index.css +8 -8
- package/components/base-select/index.js +1 -1
- package/components/base-select-mobile/Component.d.ts +3 -3
- package/components/base-select-mobile/Component.js +13 -9
- package/components/base-select-mobile/footer/Component.js +4 -4
- package/components/base-select-mobile/footer/index.css +5 -5
- package/components/base-select-mobile/footer/index.js +1 -1
- package/components/base-select-mobile/index.css +13 -11
- package/components/base-select-mobile/index.js +1 -2
- package/components/checkmark/Component.js +1 -1
- package/components/checkmark/index.css +10 -10
- package/components/checkmark-mobile/Component.js +1 -1
- package/components/checkmark-mobile/index.css +6 -6
- package/components/field/Component.d.ts +8 -1
- package/components/field/Component.js +19 -16
- package/components/field/index.css +38 -11
- package/components/field/index.js +0 -1
- package/components/index.d.ts +0 -2
- package/components/index.js +4 -19
- package/components/optgroup/Component.js +1 -1
- package/components/optgroup/index.css +6 -6
- package/components/option/Component.js +1 -1
- package/components/option/index.css +20 -20
- package/components/options-list/Component.js +1 -1
- package/components/options-list/index.css +9 -9
- package/components/virtual-options-list/Component.js +1 -1
- package/components/virtual-options-list/index.css +15 -15
- package/cssm/Component.desktop.d.ts +19 -0
- package/cssm/{Component.js → Component.desktop.js} +6 -6
- package/cssm/Component.mobile-ebda875c.d.ts +6 -0
- package/cssm/Component.mobile-f1f15074.d.ts +387 -0
- package/cssm/Component.mobile.d.ts +41 -0
- package/cssm/Component.mobile.js +74 -0
- package/cssm/Component.modal.mobile.d.ts +60 -0
- package/cssm/Component.modal.mobile.js +74 -0
- package/cssm/Component.responsive.d.ts +1 -1
- package/cssm/Component.responsive.js +30 -33
- package/cssm/components/base-select/Component.js +5 -5
- package/cssm/components/base-select/index.js +1 -1
- package/cssm/components/base-select-mobile/Component.d.ts +3 -3
- package/cssm/components/base-select-mobile/Component.js +12 -8
- package/cssm/components/base-select-mobile/footer/Component.js +3 -3
- package/cssm/components/base-select-mobile/footer/index.js +1 -1
- package/cssm/components/base-select-mobile/index.js +1 -2
- package/cssm/components/base-select-mobile/index.module.css +4 -2
- package/cssm/components/field/Component.d.ts +8 -1
- package/cssm/components/field/Component.js +18 -15
- package/cssm/components/field/index.js +0 -1
- package/cssm/components/field/index.module.css +31 -4
- package/cssm/components/index.d.ts +0 -2
- package/cssm/components/index.js +7 -28
- package/cssm/desktop-63dec22f.d.ts +6 -0
- package/cssm/desktop.d.ts +2 -0
- package/cssm/desktop.js +44 -0
- package/cssm/hook-97e6e688.d.ts +16 -0
- package/cssm/hook-97e6e688.js +110 -0
- package/{esm/hook-b4e70cb0.d.ts → cssm/hook-9ea9e32c.d.ts} +9 -7
- package/cssm/index-ebda875c.d.ts +20 -60
- package/cssm/index.d.ts +2 -5
- package/cssm/index.js +34 -61
- package/cssm/mobile-96988a65.d.ts +2 -0
- package/cssm/mobile.d.ts +5 -4
- package/cssm/mobile.js +15 -24
- package/cssm/presets/index.d.ts +1 -1
- package/cssm/presets/index.js +9 -36
- package/cssm/presets/useLazyLoading/hook.js +9 -4
- package/cssm/presets/useSelectWithApply/hook.js +9 -48
- package/cssm/presets/useSelectWithApply/options-list-with-apply/Component.js +3 -42
- package/cssm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +3 -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 -49
- package/cssm/shared.d.ts +5 -0
- package/cssm/shared.js +78 -0
- package/cssm/typings-9211a437.d.ts +95 -0
- package/cssm/typings-baf4875b.d.ts +52 -0
- package/desktop-63dec22f.d.ts +6 -0
- package/desktop.d.ts +2 -0
- package/{responsive.js → desktop.js} +5 -19
- package/esm/Component.desktop.d.ts +19 -0
- package/esm/{Component.js → Component.desktop.js} +6 -6
- package/esm/Component.mobile-ebda875c.d.ts +6 -0
- package/esm/Component.mobile-f1f15074.d.ts +387 -0
- package/esm/Component.mobile.d.ts +41 -0
- package/esm/Component.mobile.js +54 -0
- package/esm/Component.modal.mobile.d.ts +60 -0
- package/esm/Component.modal.mobile.js +54 -0
- package/esm/Component.responsive.d.ts +1 -1
- package/esm/Component.responsive.js +26 -25
- package/esm/components/arrow/Component.js +1 -1
- package/esm/components/arrow/index.css +3 -3
- package/esm/components/base-checkmark/Component.js +1 -1
- package/esm/components/base-checkmark/index.css +4 -4
- package/esm/components/base-option/Component.js +1 -1
- package/esm/components/base-option/index.css +13 -13
- package/esm/components/base-select/Component.js +2 -2
- package/esm/components/base-select/index.css +8 -8
- package/esm/components/base-select/index.js +1 -1
- package/esm/components/base-select-mobile/Component.d.ts +3 -3
- package/esm/components/base-select-mobile/Component.js +9 -5
- package/esm/components/base-select-mobile/footer/Component.js +4 -4
- package/esm/components/base-select-mobile/footer/index.css +5 -5
- package/esm/components/base-select-mobile/footer/index.js +1 -1
- package/esm/components/base-select-mobile/index.css +13 -11
- package/esm/components/base-select-mobile/index.js +1 -2
- package/esm/components/checkmark/Component.js +1 -1
- package/esm/components/checkmark/index.css +10 -10
- package/esm/components/checkmark-mobile/Component.js +1 -1
- package/esm/components/checkmark-mobile/index.css +6 -6
- package/esm/components/field/Component.d.ts +8 -1
- package/esm/components/field/Component.js +19 -16
- package/esm/components/field/index.css +38 -11
- package/esm/components/field/index.js +0 -1
- package/esm/components/index.d.ts +0 -2
- package/esm/components/index.js +4 -17
- package/esm/components/optgroup/Component.js +1 -1
- package/esm/components/optgroup/index.css +6 -6
- package/esm/components/option/Component.js +1 -1
- package/esm/components/option/index.css +20 -20
- package/esm/components/options-list/Component.js +1 -1
- package/esm/components/options-list/index.css +9 -9
- package/esm/components/virtual-options-list/Component.js +1 -1
- package/esm/components/virtual-options-list/index.css +15 -15
- package/esm/desktop-63dec22f.d.ts +6 -0
- package/esm/desktop.d.ts +2 -0
- package/esm/{responsive.js → desktop.js} +4 -18
- package/{cssm/hook-b4e70cb0.d.ts → esm/hook-9ea9e32c.d.ts} +9 -7
- package/esm/hook-cb30fc23.d.ts +16 -0
- package/esm/hook-cb30fc23.js +102 -0
- package/esm/index-ebda875c.d.ts +20 -60
- package/esm/index.d.ts +2 -5
- package/esm/index.js +27 -29
- package/esm/mobile-96988a65.d.ts +2 -0
- package/esm/mobile.d.ts +5 -4
- package/esm/mobile.js +12 -16
- package/esm/presets/index.d.ts +1 -1
- package/esm/presets/index.js +7 -25
- package/esm/presets/useLazyLoading/hook.js +9 -5
- package/esm/presets/useSelectWithApply/hook.js +7 -33
- package/esm/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
- package/esm/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/esm/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
- package/esm/presets/useSelectWithLoading/hook.js +1 -1
- package/esm/presets/useSelectWithLoading/index.css +2 -2
- package/esm/shared.d.ts +5 -0
- package/esm/shared.js +38 -0
- package/esm/typings-9211a437.d.ts +95 -0
- package/esm/typings-baf4875b.d.ts +52 -0
- package/hook-3e654f56.d.ts +16 -0
- package/hook-3e654f56.js +110 -0
- package/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +9 -7
- package/index-ebda875c.d.ts +20 -60
- package/index.d.ts +2 -5
- package/index.js +28 -51
- package/mobile-96988a65.d.ts +2 -0
- package/mobile.d.ts +5 -4
- package/mobile.js +14 -18
- package/modern/Component.desktop.d.ts +19 -0
- package/modern/{Component.js → Component.desktop.js} +7 -4
- package/modern/Component.mobile-ebda875c.d.ts +6 -0
- package/modern/Component.mobile-f1f15074.d.ts +387 -0
- package/modern/Component.mobile.d.ts +41 -0
- package/modern/Component.mobile.js +61 -0
- package/modern/Component.modal.mobile.d.ts +60 -0
- package/modern/Component.modal.mobile.js +61 -0
- package/modern/Component.responsive.d.ts +1 -1
- package/modern/Component.responsive.js +26 -25
- package/modern/components/arrow/Component.js +1 -1
- package/modern/components/arrow/index.css +3 -3
- package/modern/components/base-checkmark/Component.js +1 -1
- package/modern/components/base-checkmark/index.css +4 -4
- package/modern/components/base-option/Component.js +1 -1
- package/modern/components/base-option/index.css +13 -13
- package/modern/components/base-select/Component.js +2 -2
- package/modern/components/base-select/index.css +8 -8
- package/modern/components/base-select/index.js +1 -1
- package/modern/components/base-select-mobile/Component.d.ts +3 -3
- package/modern/components/base-select-mobile/Component.js +9 -5
- package/modern/components/base-select-mobile/footer/Component.js +4 -4
- package/modern/components/base-select-mobile/footer/index.css +5 -5
- package/modern/components/base-select-mobile/footer/index.js +1 -1
- package/modern/components/base-select-mobile/index.css +13 -11
- package/modern/components/base-select-mobile/index.js +1 -2
- package/modern/components/checkmark/Component.js +1 -1
- package/modern/components/checkmark/index.css +10 -10
- package/modern/components/checkmark-mobile/Component.js +1 -1
- package/modern/components/checkmark-mobile/index.css +6 -6
- package/modern/components/field/Component.d.ts +8 -1
- package/modern/components/field/Component.js +17 -14
- package/modern/components/field/index.css +38 -11
- package/modern/components/field/index.js +0 -1
- package/modern/components/index.d.ts +0 -2
- package/modern/components/index.js +4 -17
- package/modern/components/optgroup/Component.js +1 -1
- package/modern/components/optgroup/index.css +6 -6
- package/modern/components/option/Component.js +1 -1
- package/modern/components/option/index.css +20 -20
- package/modern/components/options-list/Component.js +1 -1
- package/modern/components/options-list/index.css +9 -9
- package/modern/components/virtual-options-list/Component.js +1 -1
- package/modern/components/virtual-options-list/index.css +15 -15
- package/modern/desktop-63dec22f.d.ts +6 -0
- package/modern/desktop.d.ts +2 -0
- package/modern/{responsive.js → desktop.js} +4 -18
- package/modern/hook-467b4d42.d.ts +16 -0
- package/modern/{Component-5c16a908.js → hook-467b4d42.js} +3 -66
- package/modern/{hook-b4e70cb0.d.ts → hook-9ea9e32c.d.ts} +9 -7
- package/modern/index-ebda875c.d.ts +20 -60
- package/modern/index.d.ts +2 -5
- package/modern/index.js +27 -29
- package/modern/mobile-96988a65.d.ts +2 -0
- package/modern/mobile.d.ts +5 -4
- package/modern/mobile.js +12 -16
- package/modern/presets/index.d.ts +1 -1
- package/modern/presets/index.js +7 -25
- package/modern/presets/useLazyLoading/hook.js +9 -5
- package/modern/presets/useSelectWithApply/hook.js +7 -33
- package/modern/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
- package/modern/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/modern/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
- package/modern/presets/useSelectWithLoading/hook.js +1 -1
- package/modern/presets/useSelectWithLoading/index.css +2 -2
- package/modern/shared.d.ts +5 -0
- package/modern/shared.js +37 -0
- package/modern/typings-9211a437.d.ts +95 -0
- package/modern/typings-baf4875b.d.ts +52 -0
- package/package.json +38 -12
- package/presets/index.d.ts +1 -1
- package/presets/index.js +7 -25
- package/presets/useLazyLoading/hook.js +9 -5
- package/presets/useSelectWithApply/hook.js +7 -33
- package/presets/useSelectWithApply/options-list-with-apply/Component.js +2 -28
- package/presets/useSelectWithApply/options-list-with-apply/footer/Component.js +4 -4
- package/presets/useSelectWithApply/options-list-with-apply/footer/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/header/Component.js +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/header/index.css +3 -3
- package/presets/useSelectWithApply/options-list-with-apply/index.d.ts +1 -1
- package/presets/useSelectWithApply/options-list-with-apply/index.js +8 -34
- package/presets/useSelectWithLoading/hook.js +1 -1
- package/presets/useSelectWithLoading/index.css +2 -2
- package/shared.d.ts +5 -0
- package/shared.js +64 -0
- package/src/Component.desktop.tsx +52 -0
- package/src/Component.mobile.tsx +149 -0
- package/src/Component.modal.mobile.tsx +144 -0
- package/src/Component.responsive.tsx +59 -0
- package/src/components/arrow/Component.tsx +12 -0
- package/src/components/arrow/index.module.css +15 -0
- package/src/components/arrow/index.ts +1 -0
- package/src/components/base-checkmark/Component.tsx +33 -0
- package/src/components/base-checkmark/index.module.css +18 -0
- package/src/components/base-checkmark/index.ts +1 -0
- package/src/components/base-option/Component.tsx +57 -0
- package/src/components/base-option/index.module.css +67 -0
- package/src/components/base-option/index.ts +1 -0
- package/src/components/base-select/Component.tsx +478 -0
- package/src/components/base-select/index.module.css +68 -0
- package/src/components/base-select/index.ts +1 -0
- package/src/components/base-select-mobile/Component.tsx +486 -0
- package/src/components/base-select-mobile/footer/Component.tsx +46 -0
- package/src/components/base-select-mobile/footer/index.module.css +23 -0
- package/src/components/base-select-mobile/footer/index.ts +1 -0
- package/src/components/base-select-mobile/index.module.css +48 -0
- package/src/components/base-select-mobile/index.ts +1 -0
- package/src/components/checkmark/Component.tsx +56 -0
- package/src/components/checkmark/index.module.css +48 -0
- package/src/components/checkmark/index.ts +1 -0
- package/src/components/checkmark-mobile/Component.tsx +18 -0
- package/src/components/checkmark-mobile/index.module.css +28 -0
- package/src/components/checkmark-mobile/index.ts +1 -0
- package/src/components/field/Component.tsx +110 -0
- package/src/components/field/index.module.css +60 -0
- package/src/components/field/index.ts +1 -0
- package/src/components/index.ts +8 -0
- package/src/components/native-select/Component.tsx +60 -0
- package/src/components/native-select/index.ts +1 -0
- package/src/components/optgroup/Component.tsx +15 -0
- package/src/components/optgroup/index.module.css +30 -0
- package/src/components/optgroup/index.ts +1 -0
- package/src/components/option/Component.tsx +65 -0
- package/src/components/option/index.module.css +108 -0
- package/src/components/option/index.ts +1 -0
- package/src/components/options-list/Component.tsx +140 -0
- package/src/components/options-list/index.module.css +40 -0
- package/src/components/options-list/index.ts +1 -0
- package/src/components/virtual-options-list/Component.tsx +217 -0
- package/src/components/virtual-options-list/index.module.css +76 -0
- package/src/components/virtual-options-list/index.ts +1 -0
- package/src/consts.ts +1 -0
- package/src/desktop.ts +1 -0
- package/src/index.ts +4 -0
- package/src/mobile.ts +5 -0
- package/src/presets/index.ts +3 -0
- package/src/presets/useLazyLoading/hook.tsx +309 -0
- package/src/presets/useSelectWithApply/hook.tsx +154 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/Component.tsx +106 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/footer/Component.tsx +37 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/footer/index.module.css +11 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/header/Component.tsx +26 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/header/index.module.css +9 -0
- package/src/presets/useSelectWithApply/options-list-with-apply/index.ts +1 -0
- package/src/presets/useSelectWithLoading/hook.tsx +40 -0
- package/src/shared.ts +5 -0
- package/src/typings.ts +691 -0
- package/src/utils.ts +154 -0
- package/src/vars.css +57 -0
- package/typings-9211a437.d.ts +95 -0
- package/typings-baf4875b.d.ts +52 -0
- package/Component-1e06de61.d.ts +0 -108
- package/Component-1e06de61.js +0 -165
- package/Component-3885b0d7.d.ts +0 -169
- package/Component.d.ts +0 -104
- package/Component.mobile-b2c0420d.d.ts +0 -93
- package/components/select-mobile/Component.d.ts +0 -0
- package/components/select-mobile/Component.js +0 -49
- package/components/select-mobile/index.d.ts +0 -1
- package/components/select-mobile/index.js +0 -49
- package/components/select-modal-mobile/Component.d.ts +0 -0
- package/components/select-modal-mobile/Component.js +0 -49
- package/components/select-modal-mobile/index.d.ts +0 -1
- package/components/select-modal-mobile/index.js +0 -49
- package/cssm/Component-3885b0d7.d.ts +0 -169
- package/cssm/Component-4727d474.d.ts +0 -108
- package/cssm/Component-4727d474.js +0 -175
- package/cssm/Component.d.ts +0 -104
- package/cssm/Component.mobile-b2c0420d.d.ts +0 -93
- package/cssm/components/select-mobile/Component.d.ts +0 -0
- package/cssm/components/select-mobile/Component.js +0 -66
- package/cssm/components/select-mobile/index.d.ts +0 -1
- package/cssm/components/select-mobile/index.js +0 -66
- package/cssm/components/select-modal-mobile/Component.d.ts +0 -0
- package/cssm/components/select-modal-mobile/Component.js +0 -66
- package/cssm/components/select-modal-mobile/index.d.ts +0 -1
- package/cssm/components/select-modal-mobile/index.js +0 -66
- package/cssm/getDataTestId-5c876d98.d.ts +0 -2
- package/cssm/getDataTestId-5c876d98.js +0 -8
- package/cssm/index-3885b0d7.d.ts +0 -3
- package/cssm/intersection-observer-9ec5cf59.d.ts +0 -1
- package/cssm/intersection-observer-9ec5cf59.js +0 -893
- package/cssm/responsive.d.ts +0 -2
- package/cssm/responsive.js +0 -67
- package/cssm/types-ebda875c.d.ts +0 -113
- package/esm/Component-16af9d1e.d.ts +0 -108
- package/esm/Component-16af9d1e.js +0 -155
- package/esm/Component-3885b0d7.d.ts +0 -169
- package/esm/Component.d.ts +0 -104
- package/esm/Component.mobile-b2c0420d.d.ts +0 -93
- package/esm/components/select-mobile/Component.d.ts +0 -0
- package/esm/components/select-mobile/Component.js +0 -41
- package/esm/components/select-mobile/index.d.ts +0 -1
- package/esm/components/select-mobile/index.js +0 -41
- package/esm/components/select-modal-mobile/Component.d.ts +0 -0
- package/esm/components/select-modal-mobile/Component.js +0 -41
- package/esm/components/select-modal-mobile/index.d.ts +0 -1
- package/esm/components/select-modal-mobile/index.js +0 -41
- package/esm/getDataTestId-1a678b16.d.ts +0 -2
- package/esm/getDataTestId-1a678b16.js +0 -6
- package/esm/index-3885b0d7.d.ts +0 -3
- package/esm/intersection-observer-4e5bb99c.d.ts +0 -1
- package/esm/intersection-observer-4e5bb99c.js +0 -891
- package/esm/presets/useLazyLoading/index.css +0 -8
- package/esm/responsive.d.ts +0 -2
- package/esm/types-ebda875c.d.ts +0 -113
- package/getDataTestId-3f974970.d.ts +0 -2
- package/getDataTestId-3f974970.js +0 -8
- package/index-3885b0d7.d.ts +0 -3
- package/intersection-observer-411362a8.d.ts +0 -1
- package/intersection-observer-411362a8.js +0 -893
- package/modern/Component-3885b0d7.d.ts +0 -169
- package/modern/Component-5c16a908.d.ts +0 -108
- package/modern/Component.d.ts +0 -104
- package/modern/Component.mobile-b2c0420d.d.ts +0 -93
- package/modern/components/select-mobile/Component.d.ts +0 -0
- package/modern/components/select-mobile/Component.js +0 -40
- package/modern/components/select-mobile/index.d.ts +0 -1
- package/modern/components/select-mobile/index.js +0 -40
- package/modern/components/select-modal-mobile/Component.d.ts +0 -0
- package/modern/components/select-modal-mobile/Component.js +0 -40
- package/modern/components/select-modal-mobile/index.d.ts +0 -1
- package/modern/components/select-modal-mobile/index.js +0 -40
- package/modern/getDataTestId-c17bfb0c.d.ts +0 -2
- package/modern/getDataTestId-c17bfb0c.js +0 -6
- package/modern/index-3885b0d7.d.ts +0 -3
- package/modern/intersection-observer-4e5bb99c.d.ts +0 -1
- package/modern/intersection-observer-4e5bb99c.js +0 -891
- package/modern/presets/useLazyLoading/index.css +0 -8
- package/modern/responsive.d.ts +0 -2
- package/modern/types-ebda875c.d.ts +0 -113
- package/presets/useLazyLoading/index.css +0 -8
- package/responsive.d.ts +0 -2
- package/types-ebda875c.d.ts +0 -113
- /package/{cssm/presets/useLazyLoading → src/presets/useSelectWithLoading}/index.module.css +0 -0
package/src/utils.ts
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { cloneElement, isValidElement, ReactNode, RefObject, useEffect, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
import { BaseSelectProps, GroupShape, OptionShape } from './typings';
|
|
4
|
+
|
|
5
|
+
export const isGroup = (item: OptionShape | GroupShape): item is GroupShape =>
|
|
6
|
+
Object.prototype.hasOwnProperty.call(item, 'options');
|
|
7
|
+
|
|
8
|
+
export const isOptionShape = (item: OptionShape | string | null): item is OptionShape =>
|
|
9
|
+
!!item && Object.prototype.hasOwnProperty.call(item, 'key');
|
|
10
|
+
|
|
11
|
+
export const joinOptions = ({
|
|
12
|
+
selected,
|
|
13
|
+
selectedMultiple,
|
|
14
|
+
}: {
|
|
15
|
+
selected?: OptionShape;
|
|
16
|
+
selectedMultiple?: OptionShape[];
|
|
17
|
+
}) => {
|
|
18
|
+
const options = selectedMultiple || (selected ? [selected] : []);
|
|
19
|
+
|
|
20
|
+
if (!options.length) return null;
|
|
21
|
+
|
|
22
|
+
return options.reduce((acc: Array<ReactNode | string>, option: OptionShape, index: number) => {
|
|
23
|
+
if (isValidElement(option.content)) {
|
|
24
|
+
acc.push(cloneElement(option.content, { key: option.key }));
|
|
25
|
+
} else {
|
|
26
|
+
acc.push(option.content);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (index < options.length - 1) acc.push(', ');
|
|
30
|
+
|
|
31
|
+
return acc;
|
|
32
|
+
}, []);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// За один проход делает список пунктов меню плоским и находит выбранные пункты по ключу
|
|
36
|
+
export function processOptions(
|
|
37
|
+
options: BaseSelectProps['options'],
|
|
38
|
+
selected: BaseSelectProps['selected'] = [],
|
|
39
|
+
) {
|
|
40
|
+
const flatOptions: OptionShape[] = [];
|
|
41
|
+
|
|
42
|
+
const selectedArray = Array.isArray(selected) ? selected : [selected];
|
|
43
|
+
const selectedOptions = selectedArray.filter(isOptionShape);
|
|
44
|
+
const selectedKeys = selectedArray.filter(
|
|
45
|
+
(option): option is string => typeof option === 'string',
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
const isSelected = (option: OptionShape) => selectedKeys.includes(option.key);
|
|
49
|
+
|
|
50
|
+
const process = (option: OptionShape) => {
|
|
51
|
+
flatOptions.push(option);
|
|
52
|
+
|
|
53
|
+
if (isSelected(option)) {
|
|
54
|
+
selectedOptions.push(option);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
options.forEach((option) => {
|
|
59
|
+
if (isGroup(option)) {
|
|
60
|
+
option.options.forEach(process);
|
|
61
|
+
} else {
|
|
62
|
+
process(option);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return { flatOptions, selectedOptions };
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
70
|
+
type useVisibleOptionsArgs = {
|
|
71
|
+
/**
|
|
72
|
+
* Количество видимых пунктов
|
|
73
|
+
*/
|
|
74
|
+
visibleOptions: number;
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* Реф на контейнер с пунтами меню
|
|
78
|
+
*/
|
|
79
|
+
listRef: RefObject<HTMLElement>;
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Реф на контейнер, которому нужно установить высоту
|
|
83
|
+
*/
|
|
84
|
+
styleTargetRef?: RefObject<HTMLElement>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Флаг открытия меню
|
|
88
|
+
*/
|
|
89
|
+
open?: boolean;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Позволяет вызвать пересчет высоты
|
|
93
|
+
*/
|
|
94
|
+
invalidate?: unknown;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export function useVisibleOptions({
|
|
98
|
+
visibleOptions,
|
|
99
|
+
listRef,
|
|
100
|
+
styleTargetRef = listRef,
|
|
101
|
+
open,
|
|
102
|
+
invalidate,
|
|
103
|
+
}: useVisibleOptionsArgs) {
|
|
104
|
+
useEffect(() => {
|
|
105
|
+
const list = listRef.current;
|
|
106
|
+
const styleTarget = styleTargetRef.current;
|
|
107
|
+
|
|
108
|
+
if (open && list && styleTarget && visibleOptions > 0) {
|
|
109
|
+
const childCount = list.children.length;
|
|
110
|
+
const optionsNodes = ([] as HTMLElement[]).slice.call(
|
|
111
|
+
list.children,
|
|
112
|
+
0,
|
|
113
|
+
visibleOptions + 1,
|
|
114
|
+
);
|
|
115
|
+
|
|
116
|
+
let height = optionsNodes
|
|
117
|
+
.slice(0, visibleOptions)
|
|
118
|
+
.reduce((acc, child) => acc + child.clientHeight, 0);
|
|
119
|
+
|
|
120
|
+
if (visibleOptions < childCount) {
|
|
121
|
+
const lastVisibleOptionHeight = optionsNodes[optionsNodes.length - 1].clientHeight;
|
|
122
|
+
|
|
123
|
+
// Если кол-во опций больше visibleOptions на 1, то показываем все опции, иначе добавляем половинку
|
|
124
|
+
height += Math.round(
|
|
125
|
+
childCount - visibleOptions === 1
|
|
126
|
+
? lastVisibleOptionHeight
|
|
127
|
+
: lastVisibleOptionHeight / 2,
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
styleTarget.style.height = `${height}px`;
|
|
132
|
+
}
|
|
133
|
+
}, [listRef, open, styleTargetRef, visibleOptions, invalidate]);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// TODO: перенести
|
|
137
|
+
export function usePrevious<T>(value: T) {
|
|
138
|
+
const ref = useRef<T>();
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
ref.current = value;
|
|
142
|
+
}, [value]);
|
|
143
|
+
|
|
144
|
+
return ref.current;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// TODO: перенести
|
|
148
|
+
export const lastIndexOf = <T>(array: T[], predicate: (item: T) => boolean) => {
|
|
149
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
150
|
+
if (predicate(array[i])) return i;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return -1;
|
|
154
|
+
};
|
package/src/vars.css
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--select-error-color: var(--color-light-text-negative);
|
|
3
|
+
--select-arrow-color: var(--color-light-graphic-primary);
|
|
4
|
+
--select-arrow-hover-opacity: 0.7;
|
|
5
|
+
|
|
6
|
+
/* options list */
|
|
7
|
+
|
|
8
|
+
--select-options-list-border-radius: var(--border-radius-m);
|
|
9
|
+
--select-options-list-box-shadow: var(--shadow-m);
|
|
10
|
+
--select-options-list-offset: var(--gap-2xs);
|
|
11
|
+
--select-options-list-top-padding: 0;
|
|
12
|
+
--select-options-list-bottom-padding: 0;
|
|
13
|
+
--select-options-list-empty-placeholder-color: var(--color-light-text-secondary);
|
|
14
|
+
--select-option-divider-display: none;
|
|
15
|
+
--select-option-divider-background: var(--color-light-border-primary);
|
|
16
|
+
|
|
17
|
+
/* option */
|
|
18
|
+
|
|
19
|
+
--select-option-left-padding: var(--gap-s);
|
|
20
|
+
--select-option-right-padding: var(--gap-s);
|
|
21
|
+
--select-option-l-left-padding: var(--gap-m);
|
|
22
|
+
--select-option-l-right-padding: var(--gap-m);
|
|
23
|
+
--select-option-background: var(--color-light-bg-primary);
|
|
24
|
+
--select-option-selected-background: var(--color-light-bg-primary);
|
|
25
|
+
--select-option-hover-background: var(--color-light-bg-secondary);
|
|
26
|
+
--select-option-active-background: var(--color-light-bg-tertiary);
|
|
27
|
+
--select-option-disabled-background: var(--color-light-bg-primary);
|
|
28
|
+
--select-option-color: var(--color-light-text-primary);
|
|
29
|
+
--select-option-selected-color: var(--color-light-text-primary);
|
|
30
|
+
--select-option-hover-color: var(--color-light-text-primary);
|
|
31
|
+
--select-option-active-color: var(--color-light-text-primary);
|
|
32
|
+
--select-option-disabled-color: var(--color-light-text-secondary);
|
|
33
|
+
|
|
34
|
+
/* checkmark */
|
|
35
|
+
|
|
36
|
+
--select-checkmark-margin: 0 var(--gap-xs) 0 0;
|
|
37
|
+
--select-checkmark-margin-after: var(--select-checkmark-margin);
|
|
38
|
+
--select-checkmark-size: 4px;
|
|
39
|
+
--select-checkmark-before-display: 'flex';
|
|
40
|
+
--select-checkmark-after-display: none;
|
|
41
|
+
--select-checkmark-before-display-multiple: block;
|
|
42
|
+
--select-checkmark-after-display-single: none;
|
|
43
|
+
--select-checkmark-unselected-opacity: 0;
|
|
44
|
+
--select-checkmark-background: var(--color-light-graphic-primary);
|
|
45
|
+
--select-checkmark-border-radius: var(--border-radius-circle);
|
|
46
|
+
--select-mobile-checkmark-display-icon: block;
|
|
47
|
+
--select-mobile-checkmark-display-badge: none;
|
|
48
|
+
|
|
49
|
+
/* optgroup */
|
|
50
|
+
|
|
51
|
+
--select-optgroup-color: var(--color-light-text-secondary);
|
|
52
|
+
--select-optgroup-background: var(--color-light-bg-primary);
|
|
53
|
+
--select-optgroup-left-padding: var(--gap-s);
|
|
54
|
+
--select-optgroup-right-padding: var(--gap-s);
|
|
55
|
+
--select-optgroup-l-left-padding: var(--gap-m);
|
|
56
|
+
--select-optgroup-l-right-padding: var(--gap-m);
|
|
57
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AnchorHTMLAttributes, ButtonHTMLAttributes, ElementType, ReactNode } from 'react';
|
|
2
|
+
type StyleColors = {
|
|
3
|
+
default: {
|
|
4
|
+
[key: string]: string;
|
|
5
|
+
};
|
|
6
|
+
inverted: {
|
|
7
|
+
[key: string]: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
type ComponentProps = {
|
|
11
|
+
/**
|
|
12
|
+
* Тип кнопки
|
|
13
|
+
* @default secondary
|
|
14
|
+
*/
|
|
15
|
+
view?: 'accent' | 'primary' | 'secondary' | 'tertiary' | 'outlined' | 'filled' | 'transparent' | 'link' | 'ghost';
|
|
16
|
+
/**
|
|
17
|
+
* Слот слева
|
|
18
|
+
*/
|
|
19
|
+
leftAddons?: ReactNode;
|
|
20
|
+
/**
|
|
21
|
+
* Слот справа
|
|
22
|
+
*/
|
|
23
|
+
rightAddons?: ReactNode;
|
|
24
|
+
/**
|
|
25
|
+
* Размер компонента
|
|
26
|
+
* @default m
|
|
27
|
+
*/
|
|
28
|
+
size?: 'xxs' | 'xs' | 's' | 'm' | 'l' | 'xl';
|
|
29
|
+
/**
|
|
30
|
+
* Растягивает компонент на ширину контейнера
|
|
31
|
+
* @default false
|
|
32
|
+
*/
|
|
33
|
+
block?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Дополнительный класс
|
|
36
|
+
*/
|
|
37
|
+
className?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Дополнительный класс для спиннера
|
|
40
|
+
*/
|
|
41
|
+
spinnerClassName?: string;
|
|
42
|
+
/**
|
|
43
|
+
* Выводит ссылку в виде кнопки
|
|
44
|
+
*/
|
|
45
|
+
href?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Позволяет использовать кастомный компонент для кнопки (например Link из роутера)
|
|
48
|
+
*/
|
|
49
|
+
Component?: ElementType;
|
|
50
|
+
/**
|
|
51
|
+
* Идентификатор для систем автоматизированного тестирования
|
|
52
|
+
*/
|
|
53
|
+
dataTestId?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Показать лоадер
|
|
56
|
+
* @default false
|
|
57
|
+
*/
|
|
58
|
+
loading?: boolean;
|
|
59
|
+
/**
|
|
60
|
+
* Не переносить текст кнопки на новую строку
|
|
61
|
+
* @default false
|
|
62
|
+
*/
|
|
63
|
+
nowrap?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Набор цветов для компонента
|
|
66
|
+
*/
|
|
67
|
+
colors?: 'default' | 'inverted';
|
|
68
|
+
/**
|
|
69
|
+
* Дочерние элементы.
|
|
70
|
+
*/
|
|
71
|
+
children?: ReactNode;
|
|
72
|
+
/**
|
|
73
|
+
* Основные стили компонента.
|
|
74
|
+
*/
|
|
75
|
+
styles: {
|
|
76
|
+
[key: string]: string;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Стили компонента для default и inverted режима.
|
|
80
|
+
*/
|
|
81
|
+
colorStylesMap: StyleColors;
|
|
82
|
+
};
|
|
83
|
+
type AnchorBaseButtonProps = ComponentProps & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
84
|
+
type NativeBaseButtonProps = ComponentProps & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
85
|
+
type BaseButtonProps = Partial<AnchorBaseButtonProps | NativeBaseButtonProps>;
|
|
86
|
+
type AnchorButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & AnchorHTMLAttributes<HTMLAnchorElement>;
|
|
87
|
+
type NativeButtonProps = Omit<BaseButtonProps, 'styles' | 'colorStylesMap'> & ButtonHTMLAttributes<HTMLButtonElement>;
|
|
88
|
+
type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps> & {
|
|
89
|
+
/**
|
|
90
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
91
|
+
* @default 1024
|
|
92
|
+
*/
|
|
93
|
+
breakpoint?: number;
|
|
94
|
+
};
|
|
95
|
+
export { StyleColors, ComponentProps, AnchorBaseButtonProps, NativeBaseButtonProps, BaseButtonProps, AnchorButtonProps, NativeButtonProps, ButtonProps };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { BaseModalProps } from "@alfalab/core-components-base-modal";
|
|
3
|
+
type ModalDesktopProps = BaseModalProps & {
|
|
4
|
+
/**
|
|
5
|
+
* Ширина модального окна
|
|
6
|
+
* @default "m"
|
|
7
|
+
*/
|
|
8
|
+
size?: 's' | 'm' | 'l' | 'xl' | 'fullscreen';
|
|
9
|
+
/**
|
|
10
|
+
* Растягивает модальное окно на весь экран
|
|
11
|
+
* @deprecated Используйте размер fullscreen
|
|
12
|
+
*/
|
|
13
|
+
fullscreen?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Фиксирует позицию модального окна после открытия,
|
|
16
|
+
* предотвращая скачки, если контент внутри будет меняться
|
|
17
|
+
*/
|
|
18
|
+
fixedPosition?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Управление наличием закрывающего крестика
|
|
21
|
+
* @default false
|
|
22
|
+
*/
|
|
23
|
+
hasCloser?: boolean;
|
|
24
|
+
};
|
|
25
|
+
type ModalMobileProps = Omit<ModalDesktopProps, 'size' | 'fixedPosition' | 'fullscreen'>;
|
|
26
|
+
type ModalResponsiveProps = ModalDesktopProps & {
|
|
27
|
+
/**
|
|
28
|
+
* Контрольная точка, с нее начинается desktop версия
|
|
29
|
+
* @default 1024
|
|
30
|
+
*/
|
|
31
|
+
breakpoint?: number;
|
|
32
|
+
};
|
|
33
|
+
type View = 'desktop' | 'mobile';
|
|
34
|
+
type TResponsiveModalContext = {
|
|
35
|
+
view: View;
|
|
36
|
+
size: NonNullable<ModalDesktopProps['size']>;
|
|
37
|
+
};
|
|
38
|
+
type ContentProps = {
|
|
39
|
+
/**
|
|
40
|
+
* Контент
|
|
41
|
+
*/
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
/**
|
|
44
|
+
* Дополнительный класс
|
|
45
|
+
*/
|
|
46
|
+
className?: string;
|
|
47
|
+
/**
|
|
48
|
+
* Растягивает контент на всю высоту
|
|
49
|
+
*/
|
|
50
|
+
flex?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export { ModalDesktopProps, ModalMobileProps, ModalResponsiveProps, View, TResponsiveModalContext, ContentProps };
|
package/Component-1e06de61.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ReactNode } from "react";
|
|
4
|
-
import { BottomSheetProps } from "@alfalab/core-components-bottom-sheet";
|
|
5
|
-
import { UseSelectWithApplyProps } from "./hook-b4e70cb0";
|
|
6
|
-
import { BaseSelectProps, OptionShape, OptionsListProps } from "./typings";
|
|
7
|
-
import { FooterProps } from "./presets/useSelectWithApply/options-list-with-apply/footer/Component";
|
|
8
|
-
import { HeaderProps } from "./presets/useSelectWithApply/options-list-with-apply/header/Component";
|
|
9
|
-
import { ModalMobile } from "./Component.mobile-b2c0420d";
|
|
10
|
-
type AdditionalMobileProps = {
|
|
11
|
-
/**
|
|
12
|
-
* Футер
|
|
13
|
-
* @deprecated Используйте bottomSheetProps.actionButton
|
|
14
|
-
*/
|
|
15
|
-
footer?: ReactNode;
|
|
16
|
-
/**
|
|
17
|
-
* Будет ли свайпаться шторка
|
|
18
|
-
* @deprecated Используйте bottomSheetProps.swipeable
|
|
19
|
-
*/
|
|
20
|
-
swipeable?: boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Дополнительные пропсы шторки
|
|
23
|
-
*/
|
|
24
|
-
bottomSheetProps?: Partial<BottomSheetProps>;
|
|
25
|
-
/**
|
|
26
|
-
* Показывать кнопку очистки
|
|
27
|
-
*/
|
|
28
|
-
showClear?: UseSelectWithApplyProps["showClear"];
|
|
29
|
-
/**
|
|
30
|
-
* Показывать пункт "Выбрать все"
|
|
31
|
-
*/
|
|
32
|
-
showSelectAll?: UseSelectWithApplyProps["showSelectAll"];
|
|
33
|
-
/**
|
|
34
|
-
* Показывать пункт "Выбрать все" в заголовке списка
|
|
35
|
-
*/
|
|
36
|
-
showHeaderWithSelectAll?: UseSelectWithApplyProps["showHeaderWithSelectAll"];
|
|
37
|
-
/**
|
|
38
|
-
* Использовать ли хук useSelectWithApply
|
|
39
|
-
*/
|
|
40
|
-
useWithApplyHook?: boolean;
|
|
41
|
-
};
|
|
42
|
-
type SelectMobileProps = Omit<BaseSelectProps, "Checkmark" | "onScroll"> & AdditionalMobileProps;
|
|
43
|
-
declare const SelectMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "Checkmark"> & AdditionalMobileProps & React.RefAttributes<unknown>>;
|
|
44
|
-
declare const OptionsListWithApply: React.ForwardRefExoticComponent<OptionsListProps & {
|
|
45
|
-
showClear?: boolean | undefined;
|
|
46
|
-
onClose?: (() => void) | undefined;
|
|
47
|
-
selectedDraft?: OptionShape[] | undefined;
|
|
48
|
-
OptionsList?: React.FC<OptionsListProps & React.RefAttributes<HTMLDivElement>> | undefined;
|
|
49
|
-
Footer?: React.FC<FooterProps> | undefined;
|
|
50
|
-
Header?: React.FC<HeaderProps> | undefined;
|
|
51
|
-
headerProps?: HeaderProps | undefined;
|
|
52
|
-
showHeaderWithSelectAll?: boolean | undefined;
|
|
53
|
-
} & React.RefAttributes<HTMLDivElement>>;
|
|
54
|
-
type SelectModalMobileProps = Omit<BaseSelectProps, 'Checkmark' | 'onScroll'> & {
|
|
55
|
-
/**
|
|
56
|
-
* Показывать кнопку очистки
|
|
57
|
-
*/
|
|
58
|
-
showClear?: UseSelectWithApplyProps['showClear'];
|
|
59
|
-
/**
|
|
60
|
-
* Показывать пункт "Выбрать все"
|
|
61
|
-
*/
|
|
62
|
-
showSelectAll?: UseSelectWithApplyProps['showSelectAll'];
|
|
63
|
-
/**
|
|
64
|
-
* Дополнительные пропсы шапки модалки
|
|
65
|
-
*/
|
|
66
|
-
modalHeaderProps?: Partial<React.ComponentProps<typeof ModalMobile.Header>>;
|
|
67
|
-
/**
|
|
68
|
-
* Дополнительные пропсы модалки
|
|
69
|
-
*/
|
|
70
|
-
modalProps?: Partial<React.ComponentProps<typeof ModalMobile>>;
|
|
71
|
-
/**
|
|
72
|
-
* Дополнительные пропсы футера модалки
|
|
73
|
-
*/
|
|
74
|
-
modalFooterProps?: Partial<React.ComponentProps<typeof ModalMobile.Footer>>;
|
|
75
|
-
showHeaderWithSelectAll?: UseSelectWithApplyProps['showHeaderWithSelectAll'];
|
|
76
|
-
/**
|
|
77
|
-
* Использовать ли хук useSelectWithApply
|
|
78
|
-
*/
|
|
79
|
-
useWithApplyHook?: boolean;
|
|
80
|
-
};
|
|
81
|
-
declare const SelectModalMobile: React.ForwardRefExoticComponent<Omit<BaseSelectProps, "onScroll" | "Checkmark"> & {
|
|
82
|
-
/**
|
|
83
|
-
* Показывать кнопку очистки
|
|
84
|
-
*/
|
|
85
|
-
showClear?: UseSelectWithApplyProps['showClear'];
|
|
86
|
-
/**
|
|
87
|
-
* Показывать пункт "Выбрать все"
|
|
88
|
-
*/
|
|
89
|
-
showSelectAll?: UseSelectWithApplyProps['showSelectAll'];
|
|
90
|
-
/**
|
|
91
|
-
* Дополнительные пропсы шапки модалки
|
|
92
|
-
*/
|
|
93
|
-
modalHeaderProps?: Partial<import("./Component.mobile-b2c0420d").HeaderProps> | undefined;
|
|
94
|
-
/**
|
|
95
|
-
* Дополнительные пропсы модалки
|
|
96
|
-
*/
|
|
97
|
-
modalProps?: Partial<import("./Component.mobile-b2c0420d").ModalMobileProps & React.RefAttributes<HTMLDivElement>> | undefined;
|
|
98
|
-
/**
|
|
99
|
-
* Дополнительные пропсы футера модалки
|
|
100
|
-
*/
|
|
101
|
-
modalFooterProps?: Partial<import("./Component.mobile-b2c0420d").FooterProps> | undefined;
|
|
102
|
-
showHeaderWithSelectAll?: UseSelectWithApplyProps['showHeaderWithSelectAll'];
|
|
103
|
-
/**
|
|
104
|
-
* Использовать ли хук useSelectWithApply
|
|
105
|
-
*/
|
|
106
|
-
useWithApplyHook?: boolean | undefined;
|
|
107
|
-
} & React.RefAttributes<unknown>>;
|
|
108
|
-
export { AdditionalMobileProps, SelectMobileProps, SelectMobile, OptionsListWithApply, SelectModalMobileProps, SelectModalMobile };
|
package/Component-1e06de61.js
DELETED
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var React = require('react');
|
|
5
|
-
require('./Component.js');
|
|
6
|
-
require('classnames');
|
|
7
|
-
require('@alfalab/icons-glyph/ChevronDownMIcon');
|
|
8
|
-
require('./components/base-select/Component.js');
|
|
9
|
-
var presets_useSelectWithApply_optionsListWithApply_header_Component = require('./presets/useSelectWithApply/options-list-with-apply/header/Component.js');
|
|
10
|
-
var components_arrow_Component = require('./components/arrow/Component.js');
|
|
11
|
-
var components_baseSelectMobile_Component = require('./components/base-select-mobile/Component.js');
|
|
12
|
-
var components_baseSelectMobile_footer_Component = require('./components/base-select-mobile/footer/Component.js');
|
|
13
|
-
var components_field_Component = require('./components/field/Component.js');
|
|
14
|
-
var components_optgroup_Component = require('./components/optgroup/Component.js');
|
|
15
|
-
var components_option_Component = require('./components/option/Component.js');
|
|
16
|
-
var components_optionsList_Component = require('./components/options-list/Component.js');
|
|
17
|
-
var components_virtualOptionsList_Component = require('./components/virtual-options-list/Component.js');
|
|
18
|
-
require('@alfalab/core-components-form-control');
|
|
19
|
-
require('@alfalab/hooks');
|
|
20
|
-
var utils = require('./utils.js');
|
|
21
|
-
require('@alfalab/core-components-badge');
|
|
22
|
-
require('@alfalab/core-components-checkbox');
|
|
23
|
-
require('@alfalab/icons-glyph/CheckmarkCircleMIcon');
|
|
24
|
-
require('@alfalab/icons-glyph/CheckmarkMIcon');
|
|
25
|
-
require('@alfalab/core-components-skeleton');
|
|
26
|
-
require('./intersection-observer-411362a8.js');
|
|
27
|
-
var consts = require('./consts.js');
|
|
28
|
-
var presets_useSelectWithApply_optionsListWithApply_footer_Component = require('./presets/useSelectWithApply/options-list-with-apply/footer/Component.js');
|
|
29
|
-
|
|
30
|
-
function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e : { default: e }; }
|
|
31
|
-
|
|
32
|
-
var React__default = /*#__PURE__*/_interopDefaultCompat(React);
|
|
33
|
-
|
|
34
|
-
var OptionsListWithApply = React.forwardRef(function (_a, ref) {
|
|
35
|
-
var toggleMenu = _a.toggleMenu, defaultGetOptionProps = _a.getOptionProps, _b = _a.showClear, showClear = _b === void 0 ? true : _b, showHeaderWithSelectAll = _a.showHeaderWithSelectAll, _c = _a.selectedDraft, selectedDraft = _c === void 0 ? [] : _c, _d = _a.flatOptions, flatOptions = _d === void 0 ? [] : _d, _e = _a.OptionsList, OptionsList = _e === void 0 ? components_optionsList_Component.OptionsList : _e, _f = _a.onApply, onApply = _f === void 0 ? function () { return null; } : _f, _g = _a.onClear, onClear = _g === void 0 ? function () { return null; } : _g, _h = _a.onClose, onClose = _h === void 0 ? function () { return null; } : _h, _j = _a.visibleOptions, visibleOptions = _j === void 0 ? consts.DEFAULT_VISIBLE_OPTIONS : _j, _k = _a.Footer, Footer = _k === void 0 ? presets_useSelectWithApply_optionsListWithApply_footer_Component.Footer : _k, _l = _a.Header, Header = _l === void 0 ? presets_useSelectWithApply_optionsListWithApply_header_Component.Header : _l, headerProps = _a.headerProps, restProps = tslib.__rest(_a, ["toggleMenu", "getOptionProps", "showClear", "showHeaderWithSelectAll", "selectedDraft", "flatOptions", "OptionsList", "onApply", "onClear", "onClose", "visibleOptions", "Footer", "Header", "headerProps"]);
|
|
36
|
-
var getOptionProps = React.useCallback(function (option, index) {
|
|
37
|
-
var optionProps = defaultGetOptionProps(option, index);
|
|
38
|
-
var selected = option.key === SELECT_ALL_KEY
|
|
39
|
-
? selectedDraft.length === flatOptions.length - 1
|
|
40
|
-
: selectedDraft.includes(option);
|
|
41
|
-
return tslib.__assign(tslib.__assign({}, optionProps), { selected: selected });
|
|
42
|
-
}, [defaultGetOptionProps, flatOptions.length, selectedDraft]);
|
|
43
|
-
var handleApply = React.useCallback(function () {
|
|
44
|
-
onApply();
|
|
45
|
-
toggleMenu();
|
|
46
|
-
}, [onApply, toggleMenu]);
|
|
47
|
-
var handleClear = React.useCallback(function () {
|
|
48
|
-
onClear();
|
|
49
|
-
toggleMenu();
|
|
50
|
-
}, [onClear, toggleMenu]);
|
|
51
|
-
React.useEffect(function () {
|
|
52
|
-
var activeElement = document.activeElement;
|
|
53
|
-
return function () {
|
|
54
|
-
onClose();
|
|
55
|
-
if (activeElement) {
|
|
56
|
-
activeElement.focus();
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
60
|
-
}, []);
|
|
61
|
-
return (React__default.default.createElement(OptionsList, tslib.__assign({}, restProps, { ref: ref, visibleOptions: visibleOptions, toggleMenu: toggleMenu, flatOptions: flatOptions, getOptionProps: getOptionProps, onApply: handleApply, onClear: handleClear, header: showHeaderWithSelectAll ? React__default.default.createElement(Header, tslib.__assign({}, headerProps)) : undefined, footer: React__default.default.createElement(Footer, { handleApply: handleApply, handleClear: handleClear, showClear: showClear, selectedDraft: selectedDraft }) })));
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
var SELECT_ALL_KEY = 'select_all';
|
|
65
|
-
var selectAllOption = { key: SELECT_ALL_KEY, content: 'Выбрать все' };
|
|
66
|
-
function useSelectWithApply(_a) {
|
|
67
|
-
var options = _a.options, selected = _a.selected, _b = _a.onChange, onChange = _b === void 0 ? function () { return null; } : _b, OptionsList = _a.OptionsList, _c = _a.optionsListProps, optionsListProps = _c === void 0 ? {} : _c, _d = _a.showClear, showClear = _d === void 0 ? true : _d, _e = _a.showSelectAll, showSelectAll = _e === void 0 ? false : _e, _f = _a.showHeaderWithSelectAll, showHeaderWithSelectAll = _f === void 0 ? false : _f;
|
|
68
|
-
var _g = React.useMemo(function () { return utils.processOptions(options, selected); }, [options, selected]), flatOptions = _g.flatOptions, selectedOptions = _g.selectedOptions;
|
|
69
|
-
var _h = React.useState(selectedOptions), selectedDraft = _h[0], setSelectedDraft = _h[1];
|
|
70
|
-
var selectedOptionsRef = React.useRef(selectedOptions);
|
|
71
|
-
var handleApply = function () {
|
|
72
|
-
onChange({
|
|
73
|
-
selected: selectedDraft[0],
|
|
74
|
-
selectedMultiple: selectedDraft,
|
|
75
|
-
initiator: null,
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
var handleClear = function () {
|
|
79
|
-
setSelectedDraft([]);
|
|
80
|
-
onChange({
|
|
81
|
-
selected: null,
|
|
82
|
-
selectedMultiple: [],
|
|
83
|
-
initiator: null,
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
var handleToggleAll = function () {
|
|
87
|
-
setSelectedDraft(flatOptions.length === selectedDraft.length ? [] : flatOptions);
|
|
88
|
-
};
|
|
89
|
-
var handleChange = function (_a) {
|
|
90
|
-
var initiator = _a.initiator, restArgs = tslib.__rest(_a, ["initiator"]);
|
|
91
|
-
if (!initiator) {
|
|
92
|
-
onChange(tslib.__assign({ initiator: null }, restArgs));
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
var initiatorSelected = selectedDraft.includes(initiator) ||
|
|
96
|
-
(initiator.key === SELECT_ALL_KEY && selectedDraft.length === flatOptions.length);
|
|
97
|
-
if (initiator.key === SELECT_ALL_KEY) {
|
|
98
|
-
setSelectedDraft(initiatorSelected ? [] : flatOptions);
|
|
99
|
-
}
|
|
100
|
-
else {
|
|
101
|
-
setSelectedDraft(initiatorSelected
|
|
102
|
-
? selectedDraft.filter(function (o) { return o !== initiator; })
|
|
103
|
-
: selectedDraft.concat(initiator));
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
var handleClose = function () { return setSelectedDraft(selectedOptionsRef.current); };
|
|
107
|
-
React.useEffect(function () {
|
|
108
|
-
setSelectedDraft(selectedOptions);
|
|
109
|
-
selectedOptionsRef.current = selectedOptions;
|
|
110
|
-
}, [selectedOptions]);
|
|
111
|
-
var memoizedOptions = React.useMemo(function () { return (showSelectAll ? tslib.__spreadArray([selectAllOption], options, true) : options); }, [options, showSelectAll]);
|
|
112
|
-
return {
|
|
113
|
-
OptionsList: OptionsListWithApply,
|
|
114
|
-
optionsListProps: tslib.__assign(tslib.__assign({}, optionsListProps), { OptionsList: OptionsList, showClear: showClear, onClear: handleClear, onApply: handleApply, onClose: handleClose, selectedDraft: selectedDraft, showHeaderWithSelectAll: showHeaderWithSelectAll, headerProps: {
|
|
115
|
-
indeterminate: !!selectedDraft.length && selectedDraft.length < flatOptions.length,
|
|
116
|
-
checked: selectedDraft.length === flatOptions.length,
|
|
117
|
-
onChange: handleToggleAll,
|
|
118
|
-
} }),
|
|
119
|
-
allowUnselect: true,
|
|
120
|
-
multiple: true,
|
|
121
|
-
options: memoizedOptions,
|
|
122
|
-
onChange: handleChange,
|
|
123
|
-
selected: selected,
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
var VIRTUAL_OPTIONS_LIST_THRESHOLD$1 = 30;
|
|
128
|
-
var SelectMobile = React.forwardRef(function (_a, ref) {
|
|
129
|
-
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.optionsListProps, optionsListProps = _o === void 0 ? {} : _o, _p = _a.Arrow, Arrow = _p === void 0 ? components_arrow_Component.Arrow : _p, _q = _a.Field, Field = _q === void 0 ? components_field_Component.Field : _q, _r = _a.Optgroup, Optgroup = _r === void 0 ? components_optgroup_Component.Optgroup : _r, _s = _a.Option, Option = _s === void 0 ? components_option_Component.Option : _s, selected = _a.selected, options = _a.options, _t = _a.OptionsList, OptionsList = _t === void 0 ? options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD$1
|
|
130
|
-
? components_virtualOptionsList_Component.VirtualOptionsList
|
|
131
|
-
: components_optionsList_Component.OptionsList : _t, onChange = _a.onChange, bottomSheetProps = _a.bottomSheetProps, _u = _a.showClear, showClear = _u === void 0 ? true : _u, showSelectAll = _a.showSelectAll, showHeaderWithSelectAll = _a.showHeaderWithSelectAll, _v = _a.useWithApplyHook, useWithApplyHook = _v === void 0 ? multiple : _v, restProps = tslib.__rest(_a, ["autocomplete", "multiple", "allowUnselect", "disabled", "closeOnSelect", "circularNavigation", "defaultOpen", "open", "size", "optionsSize", "fieldProps", "optionProps", "optionsListProps", "Arrow", "Field", "Optgroup", "Option", "selected", "options", "OptionsList", "onChange", "bottomSheetProps", "showClear", "showSelectAll", "showHeaderWithSelectAll", "useWithApplyHook"]);
|
|
132
|
-
var applyProps = useSelectWithApply({
|
|
133
|
-
optionsListProps: tslib.__assign(tslib.__assign({}, optionsListProps), { Footer: components_baseSelectMobile_footer_Component.Footer }),
|
|
134
|
-
OptionsList: OptionsList,
|
|
135
|
-
selected: selected,
|
|
136
|
-
options: options,
|
|
137
|
-
onChange: onChange,
|
|
138
|
-
showClear: showClear,
|
|
139
|
-
showSelectAll: showSelectAll,
|
|
140
|
-
});
|
|
141
|
-
return (React__default.default.createElement(components_baseSelectMobile_Component.BaseSelectMobile, tslib.__assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: fieldProps, optionProps: optionProps, Arrow: Arrow, Field: Field, Optgroup: Optgroup, Option: Option, isBottomSheet: true, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList, bottomSheetProps: tslib.__assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React__default.default.createElement(presets_useSelectWithApply_optionsListWithApply_header_Component.Header, tslib.__assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, bottomSheetProps), optionsListProps: optionsListProps }, restProps, (useWithApplyHook && applyProps))));
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
var VIRTUAL_OPTIONS_LIST_THRESHOLD = 30;
|
|
145
|
-
var SelectModalMobile = React.forwardRef(function (_a, ref) {
|
|
146
|
-
var _b = _a.autocomplete, autocomplete = _b === void 0 ? false : _b, _c = _a.multiple, multiple = _c === void 0 ? false : _c, _d = _a.allowUnselect, allowUnselect = _d === void 0 ? false : _d, _e = _a.disabled, disabled = _e === void 0 ? false : _e, _f = _a.closeOnSelect, closeOnSelect = _f === void 0 ? !multiple : _f, _g = _a.circularNavigation, circularNavigation = _g === void 0 ? false : _g, _h = _a.defaultOpen, defaultOpen = _h === void 0 ? false : _h, openProp = _a.open, _j = _a.size, size = _j === void 0 ? 'm' : _j, _k = _a.optionsSize, optionsSize = _k === void 0 ? 'm' : _k, _l = _a.fieldProps, fieldProps = _l === void 0 ? {} : _l, _m = _a.optionProps, optionProps = _m === void 0 ? {} : _m, _o = _a.optionsListProps, optionsListProps = _o === void 0 ? {} : _o, _p = _a.Arrow, Arrow = _p === void 0 ? components_arrow_Component.Arrow : _p, _q = _a.Field, Field = _q === void 0 ? components_field_Component.Field : _q, _r = _a.Optgroup, Optgroup = _r === void 0 ? components_optgroup_Component.Optgroup : _r, _s = _a.Option, Option = _s === void 0 ? components_option_Component.Option : _s, selected = _a.selected, options = _a.options, _t = _a.OptionsList, OptionsList = _t === void 0 ? options.length > VIRTUAL_OPTIONS_LIST_THRESHOLD
|
|
147
|
-
? components_virtualOptionsList_Component.VirtualOptionsList
|
|
148
|
-
: components_optionsList_Component.OptionsList : _t, onChange = _a.onChange, _u = _a.showClear, showClear = _u === void 0 ? true : _u, showSelectAll = _a.showSelectAll, _v = _a.useWithApplyHook, useWithApplyHook = _v === void 0 ? multiple : _v, modalHeaderProps = _a.modalHeaderProps, showHeaderWithSelectAll = _a.showHeaderWithSelectAll, restProps = tslib.__rest(_a, ["autocomplete", "multiple", "allowUnselect", "disabled", "closeOnSelect", "circularNavigation", "defaultOpen", "open", "size", "optionsSize", "fieldProps", "optionProps", "optionsListProps", "Arrow", "Field", "Optgroup", "Option", "selected", "options", "OptionsList", "onChange", "showClear", "showSelectAll", "useWithApplyHook", "modalHeaderProps", "showHeaderWithSelectAll"]);
|
|
149
|
-
var applyProps = useSelectWithApply({
|
|
150
|
-
optionsListProps: tslib.__assign(tslib.__assign({}, optionsListProps), { Footer: components_baseSelectMobile_footer_Component.Footer }),
|
|
151
|
-
OptionsList: OptionsList,
|
|
152
|
-
selected: selected,
|
|
153
|
-
options: options,
|
|
154
|
-
onChange: onChange,
|
|
155
|
-
showClear: showClear,
|
|
156
|
-
showSelectAll: showSelectAll,
|
|
157
|
-
});
|
|
158
|
-
return (React__default.default.createElement(components_baseSelectMobile_Component.BaseSelectMobile, tslib.__assign({ ref: ref, autocomplete: autocomplete, multiple: multiple, allowUnselect: allowUnselect, disabled: disabled, closeOnSelect: closeOnSelect, circularNavigation: circularNavigation, defaultOpen: defaultOpen, open: openProp, size: size, optionsSize: optionsSize, fieldProps: fieldProps, optionProps: optionProps, Arrow: Arrow, Field: Field, Optgroup: Optgroup, Option: Option, isBottomSheet: false, options: options, selected: selected, onChange: onChange, OptionsList: OptionsList, optionsListProps: optionsListProps, modalHeaderProps: tslib.__assign({ bottomAddons: useWithApplyHook && showHeaderWithSelectAll && (React__default.default.createElement(presets_useSelectWithApply_optionsListWithApply_header_Component.Header, tslib.__assign({}, applyProps.optionsListProps.headerProps, { mobile: true }))) }, modalHeaderProps) }, restProps, (useWithApplyHook && applyProps))));
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
exports.OptionsListWithApply = OptionsListWithApply;
|
|
162
|
-
exports.SELECT_ALL_KEY = SELECT_ALL_KEY;
|
|
163
|
-
exports.SelectMobile = SelectMobile;
|
|
164
|
-
exports.SelectModalMobile = SelectModalMobile;
|
|
165
|
-
exports.useSelectWithApply = useSelectWithApply;
|