@hh.ru/magritte-ui-select 12.9.26 → 13.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ApplyChangesButton.d.ts +17 -0
- package/ApplyChangesButton.js +55 -0
- package/ApplyChangesButton.js.map +1 -0
- package/ClearButton.d.ts +15 -0
- package/ClearButton.js +42 -0
- package/ClearButton.js.map +1 -0
- package/ClearCard.d.ts +5 -0
- package/ClearCard.js +28 -0
- package/ClearCard.js.map +1 -0
- package/Select.d.ts +47 -6
- package/Select.js +77 -283
- package/Select.js.map +1 -1
- package/SelectBottomSheet.d.ts +6 -5
- package/SelectBottomSheet.js +62 -167
- package/SelectBottomSheet.js.map +1 -1
- package/SelectBottomSheetHeader.d.ts +10 -0
- package/SelectBottomSheetHeader.js +35 -0
- package/SelectBottomSheetHeader.js.map +1 -0
- package/SelectDrop.d.ts +16 -6
- package/SelectDrop.js +90 -139
- package/SelectDrop.js.map +1 -1
- package/SelectEmptyHint.d.ts +26 -3
- package/SelectEmptyHint.js +13 -4
- package/SelectEmptyHint.js.map +1 -1
- package/SelectOptions.d.ts +30 -0
- package/SelectOptions.js +104 -0
- package/SelectOptions.js.map +1 -0
- package/SelectPickerCloseIcon.d.ts +6 -0
- package/SelectPickerCloseIcon.js +31 -0
- package/SelectPickerCloseIcon.js.map +1 -0
- package/SelectPickerContext.d.ts +33 -0
- package/SelectPickerContext.js +106 -0
- package/SelectPickerContext.js.map +1 -0
- package/SelectSearchInput.d.ts +8 -0
- package/SelectSearchInput.js +20 -0
- package/SelectSearchInput.js.map +1 -0
- package/SelectSearchTrigger.d.ts +4 -0
- package/SelectSearchTrigger.js +71 -0
- package/SelectSearchTrigger.js.map +1 -0
- package/SelectTrigger.d.ts +4 -0
- package/SelectTrigger.js +48 -0
- package/SelectTrigger.js.map +1 -0
- package/UncontrolledSelect.d.ts +1 -1
- package/UncontrolledSelect.js +56 -28
- package/UncontrolledSelect.js.map +1 -1
- package/index.css +116 -102
- package/index.d.ts +16 -5
- package/index.js +60 -26
- package/index.js.map +1 -1
- package/index.mock.d.ts +46 -4
- package/index.mock.js +63 -7
- package/index.mock.js.map +1 -1
- package/internal/ConfigContext.d.ts +27 -0
- package/internal/ConfigContext.js +51 -0
- package/internal/ConfigContext.js.map +1 -0
- package/internal/NavigationManagement.d.ts +9 -0
- package/internal/NavigationManagement.js +65 -0
- package/internal/NavigationManagement.js.map +1 -0
- package/internal/Option.d.ts +26 -0
- package/internal/Option.js +70 -0
- package/internal/Option.js.map +1 -0
- package/internal/OptionControl.d.ts +18 -0
- package/internal/OptionControl.js +17 -0
- package/internal/OptionControl.js.map +1 -0
- package/internal/SearchStateContext.d.ts +9 -0
- package/internal/SearchStateContext.js +25 -0
- package/internal/SearchStateContext.js.map +1 -0
- package/internal/SelectDataProvider.d.ts +11 -0
- package/internal/SelectDataProvider.js +28 -0
- package/internal/SelectDataProvider.js.map +1 -0
- package/internal/SelectError.d.ts +3 -0
- package/internal/SelectError.js +41 -0
- package/internal/SelectError.js.map +1 -0
- package/internal/SelectReloadButton.d.ts +4 -0
- package/internal/SelectReloadButton.js +22 -0
- package/internal/SelectReloadButton.js.map +1 -0
- package/internal/SelectStateContext.d.ts +19 -0
- package/internal/SelectStateContext.js +61 -0
- package/internal/SelectStateContext.js.map +1 -0
- package/internal/SelectStore.d.ts +16 -0
- package/internal/SelectStore.js +59 -0
- package/internal/SelectStore.js.map +1 -0
- package/internal/VisibilityContext.d.ts +13 -0
- package/internal/VisibilityContext.js +17 -0
- package/internal/VisibilityContext.js.map +1 -0
- package/internal/focusOrchestrator.d.ts +26 -0
- package/internal/focusOrchestrator.js +67 -0
- package/internal/focusOrchestrator.js.map +1 -0
- package/internal/slots.d.ts +40 -0
- package/internal/slots.js +8 -0
- package/internal/slots.js.map +1 -0
- package/internal/useDataProvider.d.ts +11 -0
- package/internal/useDataProvider.js +116 -0
- package/internal/useDataProvider.js.map +1 -0
- package/internal/useFocusWithin.d.ts +1 -0
- package/internal/useFocusWithin.js +54 -0
- package/internal/useFocusWithin.js.map +1 -0
- package/internal/utils.d.ts +18 -0
- package/internal/utils.js +70 -0
- package/internal/utils.js.map +1 -0
- package/legacy/SelectLegacy.d.ts +10 -0
- package/legacy/SelectLegacy.js +122 -0
- package/legacy/SelectLegacy.js.map +1 -0
- package/legacy/UncontrolledSelectLegacy.d.ts +9 -0
- package/legacy/UncontrolledSelectLegacy.js +88 -0
- package/legacy/UncontrolledSelectLegacy.js.map +1 -0
- package/legacy/internal/BottomSheetHeaderLegacy.d.ts +11 -0
- package/legacy/internal/BottomSheetHeaderLegacy.js +66 -0
- package/legacy/internal/BottomSheetHeaderLegacy.js.map +1 -0
- package/legacy/internal/ContentBeforeLegacy.d.ts +10 -0
- package/legacy/internal/ContentBeforeLegacy.js +42 -0
- package/legacy/internal/ContentBeforeLegacy.js.map +1 -0
- package/legacy/internal/FooterLegacy.d.ts +14 -0
- package/legacy/internal/FooterLegacy.js +59 -0
- package/legacy/internal/FooterLegacy.js.map +1 -0
- package/legacy/internal/OptionLayoutLegacy.d.ts +12 -0
- package/legacy/internal/OptionLayoutLegacy.js +42 -0
- package/legacy/internal/OptionLayoutLegacy.js.map +1 -0
- package/legacy/internal/TriggerLegacy.d.ts +12 -0
- package/legacy/internal/TriggerLegacy.js +60 -0
- package/legacy/internal/TriggerLegacy.js.map +1 -0
- package/legacy/internal/UnsavedChangesAlertLegacy.d.ts +8 -0
- package/legacy/internal/UnsavedChangesAlertLegacy.js +27 -0
- package/legacy/internal/UnsavedChangesAlertLegacy.js.map +1 -0
- package/legacy/types.d.ts +191 -0
- package/legacy/types.js +3 -0
- package/legacy/types.js.map +1 -0
- package/package.json +17 -16
- package/types.d.ts +57 -291
- package/useDataProvider.d.ts +5 -0
- package/useDataProvider.js +19 -0
- package/useDataProvider.js.map +1 -0
- package/usePickerRef.d.ts +3 -0
- package/usePickerRef.js +14 -0
- package/usePickerRef.js.map +1 -0
- package/useSearchState.d.ts +4 -0
- package/useSearchState.js +15 -0
- package/useSearchState.js.map +1 -0
- package/useSelectConfig.d.ts +3 -0
- package/useSelectConfig.js +13 -0
- package/useSelectConfig.js.map +1 -0
- package/useSelectContentState.d.ts +16 -0
- package/useSelectContentState.js +43 -0
- package/useSelectContentState.js.map +1 -0
- package/useSelectError.d.ts +3 -0
- package/useSelectError.js +13 -0
- package/useSelectError.js.map +1 -0
- package/useSelectHint.d.ts +3 -0
- package/useSelectHint.js +13 -0
- package/useSelectHint.js.map +1 -0
- package/useSelectTrigger.d.ts +12 -0
- package/useSelectTrigger.js +137 -0
- package/useSelectTrigger.js.map +1 -0
- package/useVisibility.d.ts +3 -0
- package/useVisibility.js +13 -0
- package/useVisibility.js.map +1 -0
- package/SelectError.d.ts +0 -6
- package/SelectError.js +0 -21
- package/SelectError.js.map +0 -1
- package/SelectModal.d.ts +0 -4
- package/SelectModal.js +0 -155
- package/SelectModal.js.map +0 -1
- package/SelectOption.d.ts +0 -4
- package/SelectOption.js +0 -88
- package/SelectOption.js.map +0 -1
- package/getChecked.d.ts +0 -2
- package/getChecked.js +0 -7
- package/getChecked.js.map +0 -1
- package/isArraysEquals.d.ts +0 -1
- package/isArraysEquals.js +0 -5
- package/isArraysEquals.js.map +0 -1
- package/useSelectOptionsList.d.ts +0 -11
- package/useSelectOptionsList.js +0 -48
- package/useSelectOptionsList.js.map +0 -1
- package/useSelectSearch.d.ts +0 -3
- package/useSelectSearch.js +0 -131
- package/useSelectSearch.js.map +0 -1
- package/useSelectState.d.ts +0 -3
- package/useSelectState.js +0 -122
- package/useSelectState.js.map +0 -1
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import './../index.css';
|
|
2
|
+
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useMemo } from 'react';
|
|
4
|
+
import { Select } from '../Select.js';
|
|
5
|
+
import { BottomSheetHeaderLegacy } from './internal/BottomSheetHeaderLegacy.js';
|
|
6
|
+
import { ContentBeforeLegacy } from './internal/ContentBeforeLegacy.js';
|
|
7
|
+
import { FooterLegacy } from './internal/FooterLegacy.js';
|
|
8
|
+
import { makeLegacyOptionLayout } from './internal/OptionLayoutLegacy.js';
|
|
9
|
+
import { TriggerLegacy } from './internal/TriggerLegacy.js';
|
|
10
|
+
import { UnsavedChangesAlertLegacy } from './internal/UnsavedChangesAlertLegacy.js';
|
|
11
|
+
import { VSpacing } from '@hh.ru/magritte-ui-spacing';
|
|
12
|
+
import '../ApplyChangesButton.js';
|
|
13
|
+
import '@hh.ru/magritte-common-use-translation';
|
|
14
|
+
import '@hh.ru/magritte-ui-breakpoint';
|
|
15
|
+
import '../SelectPickerContext.js';
|
|
16
|
+
import '../internal/SelectStateContext.js';
|
|
17
|
+
import '../internal/SelectStore.js';
|
|
18
|
+
import '../internal/utils.js';
|
|
19
|
+
import '../useSelectConfig.js';
|
|
20
|
+
import '../internal/ConfigContext.js';
|
|
21
|
+
import '../internal/slots.js';
|
|
22
|
+
import '@hh.ru/magritte-internal-slot-registry';
|
|
23
|
+
import '../useVisibility.js';
|
|
24
|
+
import '../internal/VisibilityContext.js';
|
|
25
|
+
import '../useDataProvider.js';
|
|
26
|
+
import '../internal/SelectDataProvider.js';
|
|
27
|
+
import '@hh.ru/magritte-common-data-provider';
|
|
28
|
+
import '../internal/useDataProvider.js';
|
|
29
|
+
import '../useSearchState.js';
|
|
30
|
+
import '../internal/SearchStateContext.js';
|
|
31
|
+
import '../ClearButton.js';
|
|
32
|
+
import '../ClearCard.js';
|
|
33
|
+
import '@hh.ru/magritte-ui-card';
|
|
34
|
+
import '@hh.ru/magritte-ui-cell';
|
|
35
|
+
import '@hh.ru/magritte-ui-icon/icon';
|
|
36
|
+
import '../SelectBottomSheet.js';
|
|
37
|
+
import 'classnames';
|
|
38
|
+
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
39
|
+
import '@hh.ru/magritte-ui-action-bar';
|
|
40
|
+
import '@hh.ru/magritte-ui-bottom-sheet';
|
|
41
|
+
import '@hh.ru/magritte-ui-loader';
|
|
42
|
+
import '../internal/SelectError.js';
|
|
43
|
+
import '../internal/SelectReloadButton.js';
|
|
44
|
+
import '@hh.ru/magritte-ui-button';
|
|
45
|
+
import '../useSelectError.js';
|
|
46
|
+
import '@hh.ru/magritte-ui-title';
|
|
47
|
+
import '@hh.ru/magritte-ui-typography';
|
|
48
|
+
import '../usePickerRef.js';
|
|
49
|
+
import '../useSelectContentState.js';
|
|
50
|
+
import '../useSelectHint.js';
|
|
51
|
+
import '../SelectBottomSheetHeader.js';
|
|
52
|
+
import '@hh.ru/magritte-ui-nav-bar';
|
|
53
|
+
import '../SelectPickerCloseIcon.js';
|
|
54
|
+
import '../SelectSearchInput.js';
|
|
55
|
+
import '@hh.ru/magritte-ui-input';
|
|
56
|
+
import '../SelectDrop.js';
|
|
57
|
+
import '@hh.ru/magritte-ui-drop';
|
|
58
|
+
import '../SelectEmptyHint.js';
|
|
59
|
+
import '../SelectOptions.js';
|
|
60
|
+
import '../internal/Option.js';
|
|
61
|
+
import '@hh.ru/magritte-common-keyboard';
|
|
62
|
+
import '@hh.ru/magritte-common-use-disabled';
|
|
63
|
+
import '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';
|
|
64
|
+
import '../internal/OptionControl.js';
|
|
65
|
+
import '@hh.ru/magritte-ui-checkbox-radio';
|
|
66
|
+
import '../internal/focusOrchestrator.js';
|
|
67
|
+
import '../SelectSearchTrigger.js';
|
|
68
|
+
import '@hh.ru/magritte-ui-input/BaseInput';
|
|
69
|
+
import '../internal/NavigationManagement.js';
|
|
70
|
+
import '../internal/useFocusWithin.js';
|
|
71
|
+
import '../useSelectTrigger.js';
|
|
72
|
+
import '@hh.ru/magritte-ui-trigger';
|
|
73
|
+
import '../SelectTrigger.js';
|
|
74
|
+
|
|
75
|
+
const DEFAULT_DATA_QA = 'magritte-select-activator';
|
|
76
|
+
const DEFAULT_TRIGGER_PROPS = { size: 'medium' };
|
|
77
|
+
const SelectLegacyComponent = ({ type, multiple, value, maxSelectedOptions, loading, error, searchable, bottomSheetHeight = 'full-screen', onChange, renderTrigger, triggerProps = DEFAULT_TRIGGER_PROPS, renderMobileItem, renderDesktopItem, name, maxWidth, maxHeight = 460, renderAlertOnExitWithoutSaving, renderButtonsContainer, renderHeader, headerTitle, clearButton, applyChangesButton, forceDropVisibleWithEmptyOptions, plain = false, widthEqualToActivator = true, renderContentBefore, onBlur, onFocus, onDropOpen, onDropClose, onBottomSheetClose, onBottomSheetOpen, onSearchSubmit, onApply, onClear, onSelectOption, pickerRef, dataProvider, emptyOptionsHint, emptyOptionsSearchHint, onOptionsChange, innerErrorTrls, optionDataQa, dropWidth, applyOnClear = true, }, activatorRef) => {
|
|
78
|
+
const optionLayoutComponent = useMemo(() => renderDesktopItem || renderMobileItem
|
|
79
|
+
? makeLegacyOptionLayout({
|
|
80
|
+
renderDesktopItem,
|
|
81
|
+
renderMobileItem,
|
|
82
|
+
name,
|
|
83
|
+
dataQa: optionDataQa,
|
|
84
|
+
})
|
|
85
|
+
: undefined, [renderDesktopItem, renderMobileItem, name, optionDataQa]);
|
|
86
|
+
const options = (jsx(Select.Options, { type: type, plain: plain, optionLayoutComponent: optionLayoutComponent, "data-qa": optionDataQa, onOptionSelect: onSelectOption ? (values) => onSelectOption([...values]) : undefined }));
|
|
87
|
+
// aria-атрибуты связи с пикером новый селект считает сам
|
|
88
|
+
const { 'aria-haspopup': _, 'aria-controls': __, ...restTriggerProps } = triggerProps;
|
|
89
|
+
const newTriggerProps = restTriggerProps;
|
|
90
|
+
const dataQa = triggerProps['data-qa'] ?? DEFAULT_DATA_QA;
|
|
91
|
+
const trigger = renderTrigger ? (jsx(TriggerLegacy, { renderTrigger: renderTrigger, triggerProps: triggerProps, dataQa: dataQa, activatorRef: activatorRef, searchable: searchable })) : (jsx(Fragment, { children: searchable ? (jsx(Select.SearchTrigger, { ...newTriggerProps, ref: activatorRef, "data-qa": dataQa })) : (jsx(Select.Trigger, { ...newTriggerProps, ref: activatorRef, "data-qa": dataQa })) }));
|
|
92
|
+
const hasFooterContent = (buttons) => Boolean(renderButtonsContainer) || (!loading && buttons.some(Boolean));
|
|
93
|
+
const renderFooter = (withClearButton) => (jsx(FooterLegacy, { applyChangesButton: applyChangesButton, clearButton: clearButton, withClearButton: withClearButton, applyOnClear: applyOnClear, onApply: onApply, onClear: onClear, renderButtonsContainer: renderButtonsContainer }));
|
|
94
|
+
const dropFooter = hasFooterContent([applyChangesButton])
|
|
95
|
+
? renderFooter(Boolean(renderButtonsContainer))
|
|
96
|
+
: undefined;
|
|
97
|
+
const bottomSheetFooter = hasFooterContent([applyChangesButton, clearButton]) ? renderFooter(true) : undefined;
|
|
98
|
+
const content = (jsxs(Fragment, { children: [trigger, jsxs(Select.Drop, { ref: pickerRef, footer: dropFooter, forceDropVisibleWithEmptyOptions: forceDropVisibleWithEmptyOptions, maxWidth: maxWidth, width: dropWidth, maxHeight: maxHeight, widthEqualToActivator: widthEqualToActivator, onAppear: onDropOpen, onAfterExit: onDropClose, children: [renderContentBefore && (jsxs(Fragment, { children: [jsx(ContentBeforeLegacy, { renderContentBefore: renderContentBefore, applyOnClear: applyOnClear, onClear: onClear }), jsx(VSpacing, { default: 8 })] })), options] }), jsxs(Select.BottomSheet, { ref: pickerRef, height: searchable || Boolean(error) || loading ? 'full-screen' : bottomSheetHeight, header: jsx(BottomSheetHeaderLegacy, { headerTitle: headerTitle || triggerProps.label, searchable: searchable, renderHeader: renderHeader, onSearchSubmit: onSearchSubmit }), footer: bottomSheetFooter, onAppear: onBottomSheetOpen, onAfterExit: onBottomSheetClose, children: [options, renderAlertOnExitWithoutSaving && (jsx(UnsavedChangesAlertLegacy, { renderAlertOnExitWithoutSaving: renderAlertOnExitWithoutSaving }))] })] }));
|
|
99
|
+
const commonProps = {
|
|
100
|
+
dataProvider,
|
|
101
|
+
name,
|
|
102
|
+
loading,
|
|
103
|
+
error,
|
|
104
|
+
maxSelectedOptions,
|
|
105
|
+
onBlur,
|
|
106
|
+
onFocus,
|
|
107
|
+
onOptionsChange,
|
|
108
|
+
providerError: innerErrorTrls,
|
|
109
|
+
emptyHint: emptyOptionsHint,
|
|
110
|
+
emptySearchHint: emptyOptionsSearchHint,
|
|
111
|
+
};
|
|
112
|
+
if (multiple) {
|
|
113
|
+
return (jsx(Select, { ...commonProps, multiple: true, value: value, onChange: onChange, children: content }));
|
|
114
|
+
}
|
|
115
|
+
return (jsx(Select, { ...commonProps, value: value, onChange: onChange, children: content }));
|
|
116
|
+
};
|
|
117
|
+
/** @deprecated Компонент SelectLegacy deprecated, используйте Select */
|
|
118
|
+
const SelectLegacy = forwardRef(SelectLegacyComponent);
|
|
119
|
+
SelectLegacy.displayName = 'SelectLegacy';
|
|
120
|
+
|
|
121
|
+
export { SelectLegacy };
|
|
122
|
+
//# sourceMappingURL=SelectLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectLegacy.js","sources":["src/legacy/SelectLegacy.tsx"],"sourcesContent":["import { ReactElement, ReactNode, forwardRef, ForwardedRef, useMemo } from 'react';\n\nimport { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';\nimport { Select } from '@hh.ru/magritte-ui-select/Select';\nimport { BottomSheetHeaderLegacy } from '@hh.ru/magritte-ui-select/legacy/internal/BottomSheetHeaderLegacy';\nimport { ContentBeforeLegacy } from '@hh.ru/magritte-ui-select/legacy/internal/ContentBeforeLegacy';\nimport { FooterLegacy } from '@hh.ru/magritte-ui-select/legacy/internal/FooterLegacy';\nimport { makeLegacyOptionLayout } from '@hh.ru/magritte-ui-select/legacy/internal/OptionLayoutLegacy';\nimport { TriggerLegacy } from '@hh.ru/magritte-ui-select/legacy/internal/TriggerLegacy';\nimport { UnsavedChangesAlertLegacy } from '@hh.ru/magritte-ui-select/legacy/internal/UnsavedChangesAlertLegacy';\nimport type { SelectProps, TriggerExternalProps } from '@hh.ru/magritte-ui-select/legacy/types';\nimport type { SelectUncontrolledTriggerProps } from '@hh.ru/magritte-ui-select/types';\nimport { VSpacing } from '@hh.ru/magritte-ui-spacing';\n\nconst DEFAULT_DATA_QA = 'magritte-select-activator';\nconst DEFAULT_TRIGGER_PROPS = { size: 'medium' } as TriggerExternalProps;\n\nconst SelectLegacyComponent = <MultipleType extends boolean, DataType extends StaticDataFetcherItem>(\n {\n type,\n multiple,\n value,\n maxSelectedOptions,\n loading,\n error,\n searchable,\n bottomSheetHeight = 'full-screen',\n onChange,\n renderTrigger,\n triggerProps = DEFAULT_TRIGGER_PROPS,\n renderMobileItem,\n renderDesktopItem,\n name,\n maxWidth,\n maxHeight = 460,\n renderAlertOnExitWithoutSaving,\n renderButtonsContainer,\n renderHeader,\n headerTitle,\n clearButton,\n applyChangesButton,\n forceDropVisibleWithEmptyOptions,\n plain = false,\n widthEqualToActivator = true,\n renderContentBefore,\n onBlur,\n onFocus,\n onDropOpen,\n onDropClose,\n onBottomSheetClose,\n onBottomSheetOpen,\n onSearchSubmit,\n onApply,\n onClear,\n onSelectOption,\n pickerRef,\n dataProvider,\n emptyOptionsHint,\n emptyOptionsSearchHint,\n onOptionsChange,\n innerErrorTrls,\n optionDataQa,\n dropWidth,\n applyOnClear = true,\n }: SelectProps<MultipleType, DataType>,\n activatorRef: ForwardedRef<HTMLElement>\n): ReactElement => {\n const optionLayoutComponent = useMemo(\n () =>\n renderDesktopItem || renderMobileItem\n ? makeLegacyOptionLayout<DataType>({\n renderDesktopItem,\n renderMobileItem,\n name,\n dataQa: optionDataQa,\n })\n : undefined,\n [renderDesktopItem, renderMobileItem, name, optionDataQa]\n );\n const options = (\n <Select.Options<DataType>\n type={type}\n plain={plain}\n optionLayoutComponent={optionLayoutComponent}\n data-qa={optionDataQa}\n onOptionSelect={onSelectOption ? (values) => onSelectOption([...values]) : undefined}\n />\n );\n\n // aria-атрибуты связи с пикером новый селект считает сам\n const { 'aria-haspopup': _, 'aria-controls': __, ...restTriggerProps } = triggerProps;\n const newTriggerProps = restTriggerProps as SelectUncontrolledTriggerProps;\n const dataQa = triggerProps['data-qa'] ?? DEFAULT_DATA_QA;\n const trigger = renderTrigger ? (\n <TriggerLegacy\n renderTrigger={renderTrigger}\n triggerProps={triggerProps}\n dataQa={dataQa}\n activatorRef={activatorRef}\n searchable={searchable}\n />\n ) : (\n <>\n {searchable ? (\n <Select.SearchTrigger {...newTriggerProps} ref={activatorRef} data-qa={dataQa} />\n ) : (\n <Select.Trigger {...newTriggerProps} ref={activatorRef} data-qa={dataQa} />\n )}\n </>\n );\n\n const hasFooterContent = (buttons: ReactNode[]) =>\n Boolean(renderButtonsContainer) || (!loading && buttons.some(Boolean));\n\n const renderFooter = (withClearButton: boolean) => (\n <FooterLegacy\n applyChangesButton={applyChangesButton}\n clearButton={clearButton}\n withClearButton={withClearButton}\n applyOnClear={applyOnClear}\n onApply={onApply}\n onClear={onClear}\n renderButtonsContainer={renderButtonsContainer}\n />\n );\n\n const dropFooter = hasFooterContent([applyChangesButton])\n ? renderFooter(Boolean(renderButtonsContainer))\n : undefined;\n const bottomSheetFooter = hasFooterContent([applyChangesButton, clearButton]) ? renderFooter(true) : undefined;\n\n const content = (\n <>\n {trigger}\n <Select.Drop\n ref={pickerRef}\n footer={dropFooter}\n forceDropVisibleWithEmptyOptions={forceDropVisibleWithEmptyOptions}\n maxWidth={maxWidth}\n width={dropWidth}\n maxHeight={maxHeight}\n widthEqualToActivator={widthEqualToActivator}\n onAppear={onDropOpen}\n onAfterExit={onDropClose}\n >\n {renderContentBefore && (\n <>\n <ContentBeforeLegacy\n renderContentBefore={renderContentBefore}\n applyOnClear={applyOnClear}\n onClear={onClear}\n />\n <VSpacing default={8} />\n </>\n )}\n {options}\n </Select.Drop>\n <Select.BottomSheet\n ref={pickerRef}\n height={searchable || Boolean(error) || loading ? 'full-screen' : bottomSheetHeight}\n header={\n <BottomSheetHeaderLegacy\n headerTitle={headerTitle || triggerProps.label}\n searchable={searchable}\n renderHeader={renderHeader}\n onSearchSubmit={onSearchSubmit}\n />\n }\n footer={bottomSheetFooter}\n onAppear={onBottomSheetOpen}\n onAfterExit={onBottomSheetClose}\n >\n {options}\n {renderAlertOnExitWithoutSaving && (\n <UnsavedChangesAlertLegacy renderAlertOnExitWithoutSaving={renderAlertOnExitWithoutSaving} />\n )}\n </Select.BottomSheet>\n </>\n );\n\n const commonProps = {\n dataProvider,\n name,\n loading,\n error,\n maxSelectedOptions,\n onBlur,\n onFocus,\n onOptionsChange,\n providerError: innerErrorTrls,\n emptyHint: emptyOptionsHint,\n emptySearchHint: emptyOptionsSearchHint,\n };\n\n if (multiple) {\n return (\n <Select<true, DataType>\n {...commonProps}\n multiple\n value={value as DataType[] | undefined}\n onChange={onChange as (value: DataType[]) => void}\n >\n {content}\n </Select>\n );\n }\n\n return (\n <Select<false, DataType>\n {...commonProps}\n value={value as DataType | undefined}\n onChange={onChange as (value: DataType) => void}\n >\n {content}\n </Select>\n );\n};\n\n/** @deprecated Компонент SelectLegacy deprecated, используйте Select */\nconst SelectLegacy = forwardRef(SelectLegacyComponent) as (<\n MultipleType extends boolean,\n DataType extends StaticDataFetcherItem,\n>(\n props: SelectProps<MultipleType, DataType> & { ref?: ForwardedRef<HTMLElement> }\n) => ReactElement | null) & { displayName: string };\n\nSelectLegacy.displayName = 'SelectLegacy';\n\nexport { SelectLegacy };\n"],"names":["_jsx","_Fragment","_jsxs"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,MAAM,eAAe,GAAG,2BAA2B,CAAC;AACpD,MAAM,qBAAqB,GAAG,EAAE,IAAI,EAAE,QAAQ,EAA0B,CAAC;AAEzE,MAAM,qBAAqB,GAAG,CAC1B,EACI,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,kBAAkB,EAClB,OAAO,EACP,KAAK,EACL,UAAU,EACV,iBAAiB,GAAG,aAAa,EACjC,QAAQ,EACR,aAAa,EACb,YAAY,GAAG,qBAAqB,EACpC,gBAAgB,EAChB,iBAAiB,EACjB,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K;QACL,kBAAkB;QAClB,MAAM;QACN,OAAO;QACP,eAAe;AACf,QAAA,aAAa,EAAE,cAAc;AAC7B,QAAA,SAAS,EAAE,gBAAgB;AAC3B,QAAA,eAAe,EAAE,sBAAsB;KAC1C,CAAC;IAEF,IAAI,QAAQ,EAAE;AACV,QAAA,QACIA,GAAC,CAAA,MAAM,OACC,WAAW,EACf,QAAQ,EACR,IAAA,EAAA,KAAK,EAAE,KAA+B,EACtC,QAAQ,EAAE,QAAuC,YAEhD,OAAO,EAAA,CACH,EACX;KACL;AAED,IAAA,QACIA,GAAC,CAAA,MAAM,EACC,EAAA,GAAA,WAAW,EACf,KAAK,EAAE,KAA6B,EACpC,QAAQ,EAAE,QAAqC,YAE9C,OAAO,EAAA,CACH,EACX;AACN,CAAC,CAAC;AAEF;AACA,MAAM,YAAY,GAAG,UAAU,CAAC,qBAAqB,EAKD;AAEpD,YAAY,CAAC,WAAW,GAAG,cAAc;;;;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ReactElement } from 'react';
|
|
2
|
+
import { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';
|
|
3
|
+
import type { UncontrolledSelectProps } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
4
|
+
/** @deprecated Компонент UncontrolledSelectLegacy deprecated, используйте UncontrolledSelect */
|
|
5
|
+
declare const UncontrolledSelectLegacy: {
|
|
6
|
+
<MultipleType extends boolean, DataType extends StaticDataFetcherItem>({ name, onChange, ...props }: UncontrolledSelectProps<MultipleType, DataType>): ReactElement;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
export { UncontrolledSelectLegacy };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import './../index.css';
|
|
2
|
+
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { SelectLegacy } from './SelectLegacy.js';
|
|
5
|
+
import '../Select.js';
|
|
6
|
+
import '../ApplyChangesButton.js';
|
|
7
|
+
import '@hh.ru/magritte-common-use-translation';
|
|
8
|
+
import '@hh.ru/magritte-ui-breakpoint';
|
|
9
|
+
import '../SelectPickerContext.js';
|
|
10
|
+
import '../internal/SelectStateContext.js';
|
|
11
|
+
import '../internal/SelectStore.js';
|
|
12
|
+
import '../internal/utils.js';
|
|
13
|
+
import '../useSelectConfig.js';
|
|
14
|
+
import '../internal/ConfigContext.js';
|
|
15
|
+
import '../internal/slots.js';
|
|
16
|
+
import '@hh.ru/magritte-internal-slot-registry';
|
|
17
|
+
import '../useVisibility.js';
|
|
18
|
+
import '../internal/VisibilityContext.js';
|
|
19
|
+
import '../useDataProvider.js';
|
|
20
|
+
import '../internal/SelectDataProvider.js';
|
|
21
|
+
import '@hh.ru/magritte-common-data-provider';
|
|
22
|
+
import '../internal/useDataProvider.js';
|
|
23
|
+
import '../useSearchState.js';
|
|
24
|
+
import '../internal/SearchStateContext.js';
|
|
25
|
+
import '../ClearButton.js';
|
|
26
|
+
import '../ClearCard.js';
|
|
27
|
+
import '@hh.ru/magritte-ui-card';
|
|
28
|
+
import '@hh.ru/magritte-ui-cell';
|
|
29
|
+
import '@hh.ru/magritte-ui-icon/icon';
|
|
30
|
+
import '../SelectBottomSheet.js';
|
|
31
|
+
import 'classnames';
|
|
32
|
+
import '@hh.ru/magritte-common-use-multiple-refs';
|
|
33
|
+
import '@hh.ru/magritte-ui-action-bar';
|
|
34
|
+
import '@hh.ru/magritte-ui-bottom-sheet';
|
|
35
|
+
import '@hh.ru/magritte-ui-loader';
|
|
36
|
+
import '../internal/SelectError.js';
|
|
37
|
+
import '../internal/SelectReloadButton.js';
|
|
38
|
+
import '@hh.ru/magritte-ui-button';
|
|
39
|
+
import '../useSelectError.js';
|
|
40
|
+
import '@hh.ru/magritte-ui-spacing';
|
|
41
|
+
import '@hh.ru/magritte-ui-title';
|
|
42
|
+
import '@hh.ru/magritte-ui-typography';
|
|
43
|
+
import '../usePickerRef.js';
|
|
44
|
+
import '../useSelectContentState.js';
|
|
45
|
+
import '../useSelectHint.js';
|
|
46
|
+
import '../SelectBottomSheetHeader.js';
|
|
47
|
+
import '@hh.ru/magritte-ui-nav-bar';
|
|
48
|
+
import '../SelectPickerCloseIcon.js';
|
|
49
|
+
import '../SelectSearchInput.js';
|
|
50
|
+
import '@hh.ru/magritte-ui-input';
|
|
51
|
+
import '../SelectDrop.js';
|
|
52
|
+
import '@hh.ru/magritte-ui-drop';
|
|
53
|
+
import '../SelectEmptyHint.js';
|
|
54
|
+
import '../SelectOptions.js';
|
|
55
|
+
import '../internal/Option.js';
|
|
56
|
+
import '@hh.ru/magritte-common-keyboard';
|
|
57
|
+
import '@hh.ru/magritte-common-use-disabled';
|
|
58
|
+
import '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';
|
|
59
|
+
import '../internal/OptionControl.js';
|
|
60
|
+
import '@hh.ru/magritte-ui-checkbox-radio';
|
|
61
|
+
import '../internal/focusOrchestrator.js';
|
|
62
|
+
import '../SelectSearchTrigger.js';
|
|
63
|
+
import '@hh.ru/magritte-ui-input/BaseInput';
|
|
64
|
+
import '../internal/NavigationManagement.js';
|
|
65
|
+
import '../internal/useFocusWithin.js';
|
|
66
|
+
import '../useSelectTrigger.js';
|
|
67
|
+
import '@hh.ru/magritte-ui-trigger';
|
|
68
|
+
import '../SelectTrigger.js';
|
|
69
|
+
import './internal/BottomSheetHeaderLegacy.js';
|
|
70
|
+
import './internal/ContentBeforeLegacy.js';
|
|
71
|
+
import './internal/FooterLegacy.js';
|
|
72
|
+
import './internal/OptionLayoutLegacy.js';
|
|
73
|
+
import './internal/TriggerLegacy.js';
|
|
74
|
+
import './internal/UnsavedChangesAlertLegacy.js';
|
|
75
|
+
|
|
76
|
+
/** @deprecated Компонент UncontrolledSelectLegacy deprecated, используйте UncontrolledSelect */
|
|
77
|
+
const UncontrolledSelectLegacy = ({ name, onChange, ...props }) => {
|
|
78
|
+
const { value } = props;
|
|
79
|
+
const [controlledValue, setValue] = useState(value);
|
|
80
|
+
return (jsxs(Fragment, { children: [jsx(SelectLegacy, { ...props, onChange: (values) => {
|
|
81
|
+
setValue(values);
|
|
82
|
+
onChange?.(values);
|
|
83
|
+
}, value: controlledValue, name: name }), Array.isArray(controlledValue) ? (controlledValue.map((value) => (jsx("input", { type: "hidden", name: name, value: value.value, onChange: () => null }, value.value)))) : (jsx("input", { type: "hidden", name: name, value: controlledValue?.value ?? '', onChange: () => null }))] }));
|
|
84
|
+
};
|
|
85
|
+
UncontrolledSelectLegacy.displayName = 'UncontrolledSelectLegacy';
|
|
86
|
+
|
|
87
|
+
export { UncontrolledSelectLegacy };
|
|
88
|
+
//# sourceMappingURL=UncontrolledSelectLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UncontrolledSelectLegacy.js","sources":["src/legacy/UncontrolledSelectLegacy.tsx"],"sourcesContent":["import { type ReactElement, useState } from 'react';\n\nimport { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';\nimport { SelectLegacy } from '@hh.ru/magritte-ui-select/legacy/SelectLegacy';\nimport type { UncontrolledSelectProps } from '@hh.ru/magritte-ui-select/legacy/types';\n\n/** @deprecated Компонент UncontrolledSelectLegacy deprecated, используйте UncontrolledSelect */\nconst UncontrolledSelectLegacy = <MultipleType extends boolean, DataType extends StaticDataFetcherItem>({\n name,\n onChange,\n ...props\n}: UncontrolledSelectProps<MultipleType, DataType>): ReactElement => {\n const { value } = props;\n const [controlledValue, setValue] = useState(value);\n return (\n <>\n <SelectLegacy\n {...props}\n onChange={(values) => {\n setValue(values);\n onChange?.(values);\n }}\n value={controlledValue}\n name={name}\n />\n {Array.isArray(controlledValue) ? (\n controlledValue.map((value) => (\n <input type=\"hidden\" name={name} value={value.value} key={value.value} onChange={() => null} />\n ))\n ) : (\n <input type=\"hidden\" name={name} value={controlledValue?.value ?? ''} onChange={() => null} />\n )}\n </>\n );\n};\n\nUncontrolledSelectLegacy.displayName = 'UncontrolledSelectLegacy';\n\n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Element, ReactNode } from 'react';
|
|
2
|
+
import type { RenderHeader, SearchSubmitType } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
3
|
+
interface BottomSheetHeaderLegacyProps {
|
|
4
|
+
headerTitle?: ReactNode;
|
|
5
|
+
searchable?: boolean;
|
|
6
|
+
renderHeader?: RenderHeader;
|
|
7
|
+
onSearchSubmit?: SearchSubmitType;
|
|
8
|
+
}
|
|
9
|
+
/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.BottomSheetHeader */
|
|
10
|
+
export declare const BottomSheetHeaderLegacy: ({ headerTitle, searchable, renderHeader, onSearchSubmit, }: BottomSheetHeaderLegacyProps) => ReactElement | null;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import './../../index.css';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { useCallback, isValidElement } from 'react';
|
|
4
|
+
import { keyboardMatches, keyboardKeys } from '@hh.ru/magritte-common-keyboard';
|
|
5
|
+
import { useTranslation } from '@hh.ru/magritte-common-use-translation';
|
|
6
|
+
import { SelectBottomSheetHeader } from '../../SelectBottomSheetHeader.js';
|
|
7
|
+
import { useSelectPicker } from '../../SelectPickerContext.js';
|
|
8
|
+
import { useDataProvider } from '../../useDataProvider.js';
|
|
9
|
+
import { useSearchState } from '../../useSearchState.js';
|
|
10
|
+
import '@hh.ru/magritte-ui-nav-bar';
|
|
11
|
+
import '../../SelectPickerCloseIcon.js';
|
|
12
|
+
import '@hh.ru/magritte-ui-icon/icon';
|
|
13
|
+
import '../../SelectSearchInput.js';
|
|
14
|
+
import '@hh.ru/magritte-ui-input';
|
|
15
|
+
import '../../internal/slots.js';
|
|
16
|
+
import '@hh.ru/magritte-internal-slot-registry';
|
|
17
|
+
import '../../internal/SelectStateContext.js';
|
|
18
|
+
import '../../internal/SelectStore.js';
|
|
19
|
+
import '../../internal/utils.js';
|
|
20
|
+
import '../../useSelectConfig.js';
|
|
21
|
+
import '../../internal/ConfigContext.js';
|
|
22
|
+
import '../../useVisibility.js';
|
|
23
|
+
import '../../internal/VisibilityContext.js';
|
|
24
|
+
import '../../internal/SelectDataProvider.js';
|
|
25
|
+
import '@hh.ru/magritte-common-data-provider';
|
|
26
|
+
import '../../internal/useDataProvider.js';
|
|
27
|
+
import '../../internal/SearchStateContext.js';
|
|
28
|
+
|
|
29
|
+
/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.BottomSheetHeader */
|
|
30
|
+
const BottomSheetHeaderLegacy = ({ headerTitle, searchable, renderHeader, onSearchSubmit, }) => {
|
|
31
|
+
const searchTrl = useTranslation('Select', 'search');
|
|
32
|
+
const closeTrl = useTranslation('Select', 'close');
|
|
33
|
+
const { searchValue, setSearchValue } = useSearchState();
|
|
34
|
+
const { optionList } = useDataProvider();
|
|
35
|
+
const { applyChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();
|
|
36
|
+
const onCloseBottomSheet = useCallback(() => onCloseRequestWithUnsavedChanges(), [onCloseRequestWithUnsavedChanges]);
|
|
37
|
+
const onCloseBottomSheetWithUpdateValues = useCallback(() => {
|
|
38
|
+
applyChanges();
|
|
39
|
+
onCloseRequestWithUnsavedChanges();
|
|
40
|
+
}, [applyChanges, onCloseRequestWithUnsavedChanges]);
|
|
41
|
+
const onSearchInputKeyDown = useCallback((event) => {
|
|
42
|
+
if (!onSearchSubmit || !keyboardMatches(event.nativeEvent, [keyboardKeys.Enter])) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
onSearchSubmit(event, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues);
|
|
46
|
+
}, [onSearchSubmit, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues]);
|
|
47
|
+
if (renderHeader) {
|
|
48
|
+
const header = renderHeader({
|
|
49
|
+
searchValue,
|
|
50
|
+
setSearchValue,
|
|
51
|
+
optionsCount: optionList.length,
|
|
52
|
+
onCloseBottomSheet,
|
|
53
|
+
onCloseBottomSheetWithUpdateValues,
|
|
54
|
+
searchable,
|
|
55
|
+
headerTitle,
|
|
56
|
+
onSearchSubmit,
|
|
57
|
+
searchTrl,
|
|
58
|
+
closeTrl,
|
|
59
|
+
});
|
|
60
|
+
return isValidElement(header) ? header : null;
|
|
61
|
+
}
|
|
62
|
+
return (jsx(SelectBottomSheetHeader, { headerTitle: headerTitle, onSearchInputKeyDown: onSearchSubmit ? onSearchInputKeyDown : undefined }));
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export { BottomSheetHeaderLegacy };
|
|
66
|
+
//# sourceMappingURL=BottomSheetHeaderLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheetHeaderLegacy.js","sources":["src/legacy/internal/BottomSheetHeaderLegacy.tsx"],"sourcesContent":["import { KeyboardEvent, KeyboardEventHandler, ReactElement, ReactNode, isValidElement, useCallback } from 'react';\n\nimport { keyboardKeys, keyboardMatches } from '@hh.ru/magritte-common-keyboard';\nimport { useTranslation } from '@hh.ru/magritte-common-use-translation';\nimport { SelectBottomSheetHeader } from '@hh.ru/magritte-ui-select/SelectBottomSheetHeader';\nimport { useSelectPicker } from '@hh.ru/magritte-ui-select/SelectPickerContext';\nimport type { RenderHeader, SearchSubmitType } from '@hh.ru/magritte-ui-select/legacy/types';\nimport { useDataProvider } from '@hh.ru/magritte-ui-select/useDataProvider';\nimport { useSearchState } from '@hh.ru/magritte-ui-select/useSearchState';\n\ninterface BottomSheetHeaderLegacyProps {\n headerTitle?: ReactNode;\n searchable?: boolean;\n renderHeader?: RenderHeader;\n onSearchSubmit?: SearchSubmitType;\n}\n\n/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.BottomSheetHeader */\nexport const BottomSheetHeaderLegacy = ({\n headerTitle,\n searchable,\n renderHeader,\n onSearchSubmit,\n}: BottomSheetHeaderLegacyProps): ReactElement | null => {\n const searchTrl = useTranslation('Select', 'search');\n const closeTrl = useTranslation('Select', 'close');\n const { searchValue, setSearchValue } = useSearchState();\n const { optionList } = useDataProvider();\n const { applyChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();\n\n const onCloseBottomSheet = useCallback(\n () => onCloseRequestWithUnsavedChanges(),\n [onCloseRequestWithUnsavedChanges]\n );\n\n const onCloseBottomSheetWithUpdateValues = useCallback(() => {\n applyChanges();\n onCloseRequestWithUnsavedChanges();\n }, [applyChanges, onCloseRequestWithUnsavedChanges]);\n\n const onSearchInputKeyDown = useCallback<KeyboardEventHandler<HTMLInputElement>>(\n (event) => {\n if (!onSearchSubmit || !keyboardMatches(event.nativeEvent, [keyboardKeys.Enter])) {\n return;\n }\n onSearchSubmit(\n event as KeyboardEvent<HTMLElement>,\n onCloseBottomSheet,\n optionList.length,\n onCloseBottomSheetWithUpdateValues\n );\n },\n [onSearchSubmit, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues]\n );\n\n if (renderHeader) {\n const header = renderHeader({\n searchValue,\n setSearchValue,\n optionsCount: optionList.length,\n onCloseBottomSheet,\n onCloseBottomSheetWithUpdateValues,\n searchable,\n headerTitle,\n onSearchSubmit,\n searchTrl,\n closeTrl,\n });\n return isValidElement(header) ? header : null;\n }\n\n return (\n <SelectBottomSheetHeader\n headerTitle={headerTitle}\n onSearchInputKeyDown={onSearchSubmit ? onSearchInputKeyDown : undefined}\n />\n );\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAiBA;AACO,MAAM,uBAAuB,GAAG,CAAC,EACpC,WAAW,EACX,UAAU,EACV,YAAY,EACZ,cAAc,GACa,KAAyB;IACpD,MAAM,SAAS,GAAG,cAAc,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IACrD,MAAM,QAAQ,GAAG,cAAc,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IACnD,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;AACzD,IAAA,MAAM,EAAE,UA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@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import type { RenderContentBefore } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
3
|
+
interface ContentBeforeLegacyProps {
|
|
4
|
+
renderContentBefore: RenderContentBefore;
|
|
5
|
+
applyOnClear: boolean;
|
|
6
|
+
onClear?: VoidFunction;
|
|
7
|
+
}
|
|
8
|
+
/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.Drop */
|
|
9
|
+
export declare const ContentBeforeLegacy: ({ renderContentBefore, applyOnClear, onClear, }: ContentBeforeLegacyProps) => ReactElement;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import './../../index.css';
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { useSelectPicker } from '../../SelectPickerContext.js';
|
|
4
|
+
import { useDataProvider } from '../../useDataProvider.js';
|
|
5
|
+
import { useSearchState } from '../../useSearchState.js';
|
|
6
|
+
import 'react/jsx-runtime';
|
|
7
|
+
import '../../internal/SelectStateContext.js';
|
|
8
|
+
import '../../internal/SelectStore.js';
|
|
9
|
+
import '../../internal/utils.js';
|
|
10
|
+
import '../../useSelectConfig.js';
|
|
11
|
+
import '../../internal/ConfigContext.js';
|
|
12
|
+
import '../../internal/slots.js';
|
|
13
|
+
import '@hh.ru/magritte-internal-slot-registry';
|
|
14
|
+
import '../../useVisibility.js';
|
|
15
|
+
import '../../internal/VisibilityContext.js';
|
|
16
|
+
import '../../internal/SelectDataProvider.js';
|
|
17
|
+
import '@hh.ru/magritte-common-data-provider';
|
|
18
|
+
import '../../internal/useDataProvider.js';
|
|
19
|
+
import '../../internal/SearchStateContext.js';
|
|
20
|
+
|
|
21
|
+
/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.Drop */
|
|
22
|
+
const ContentBeforeLegacy = ({ renderContentBefore, applyOnClear, onClear, }) => {
|
|
23
|
+
const { searchValue, setSearchValue } = useSearchState();
|
|
24
|
+
const { optionList } = useDataProvider();
|
|
25
|
+
const { clearChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();
|
|
26
|
+
const clearSelectedValuesAndClose = useCallback(() => {
|
|
27
|
+
clearChanges(applyOnClear);
|
|
28
|
+
if (applyOnClear) {
|
|
29
|
+
onCloseRequestWithUnsavedChanges();
|
|
30
|
+
}
|
|
31
|
+
onClear?.();
|
|
32
|
+
}, [clearChanges, applyOnClear, onCloseRequestWithUnsavedChanges, onClear]);
|
|
33
|
+
return renderContentBefore({
|
|
34
|
+
searchValue,
|
|
35
|
+
setSearchValue,
|
|
36
|
+
optionsCount: optionList.length,
|
|
37
|
+
clearSelectedValuesAndClose,
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { ContentBeforeLegacy };
|
|
42
|
+
//# sourceMappingURL=ContentBeforeLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentBeforeLegacy.js","sources":["src/legacy/internal/ContentBeforeLegacy.tsx"],"sourcesContent":["import { ReactElement, useCallback } from 'react';\n\nimport { useSelectPicker } from '@hh.ru/magritte-ui-select/SelectPickerContext';\nimport type { RenderContentBefore } from '@hh.ru/magritte-ui-select/legacy/types';\nimport { useDataProvider } from '@hh.ru/magritte-ui-select/useDataProvider';\nimport { useSearchState } from '@hh.ru/magritte-ui-select/useSearchState';\n\ninterface ContentBeforeLegacyProps {\n renderContentBefore: RenderContentBefore;\n applyOnClear: boolean;\n onClear?: VoidFunction;\n}\n\n/** @deprecated Компонент BottomSheetHeaderLegacy deprecated, используйте Select.Drop */\nexport const ContentBeforeLegacy = ({\n renderContentBefore,\n applyOnClear,\n onClear,\n}: ContentBeforeLegacyProps): ReactElement => {\n const { searchValue, setSearchValue } = useSearchState();\n const { optionList } = useDataProvider();\n const { clearChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();\n\n const clearSelectedValuesAndClose = useCallback(() => {\n clearChanges(applyOnClear);\n if (applyOnClear) {\n onCloseRequestWithUnsavedChanges();\n }\n onClear?.();\n }, [clearChanges, applyOnClear, onCloseRequestWithUnsavedChanges, onClear]);\n\n return renderContentBefore({\n searchValue,\n setSearchValue,\n optionsCount: optionList.length,\n clearSelectedValuesAndClose,\n });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaA;AACO,MAAM,mBAAmB,GAAG,CAAC,EAChC,mBAAmB,EACnB,YAAY,EACZ,OAAO,GACgB,KAAkB;IACzC,MAAM,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,cAAc,EAAE,CAAC;AACzD,IAAA,MAAM,EAAE,UAAU,EAAE,GAAG,eAAe,EAAE,CAAC;IACzC,MAAM,EAAE,YAAY,EAAE,gCAAgC,EAAE,GAAG,eAAe,EAAE,CAAC;AAE7E,IAAA,MAAM,2BAA2B,GAAG,WAAW,CAAC,MAAK;QACjD,YAAY,CAAC,YAAY,CAAC,CAAC;QAC3B,IAAI,YAAY,EAAE;AACd,YAAA,gCAAgC,EAAE,CAAC;SACtC;QACD,OAAO,IAAI,CAAC;KACf,EAAE,CAAC,YAAY,EAAE,YAAY,EAAE,gCAAgC,EAAE,OAAO,CAAC,CAAC,CAAC;AAE5E,IAAA,OAAO,mBAAmB,CAAC;QACvB,WAAW;QACX,cAAc;QACd,YAAY,EAAE,UAAU,CAAC,MAAM;QAC/B,2BAA2B;AAC9B,KAAA,CAAC,CAAC;AACP;;;;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ReactElement, ReactNode } from 'react';
|
|
2
|
+
import type { OnApplyCallback, RenderButtonsContainer } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
3
|
+
interface FooterLegacyProps {
|
|
4
|
+
clearButton?: ReactNode;
|
|
5
|
+
applyChangesButton?: ReactNode;
|
|
6
|
+
withClearButton: boolean;
|
|
7
|
+
applyOnClear: boolean;
|
|
8
|
+
onApply?: OnApplyCallback;
|
|
9
|
+
onClear?: VoidFunction;
|
|
10
|
+
renderButtonsContainer?: RenderButtonsContainer;
|
|
11
|
+
}
|
|
12
|
+
/** @deprecated Компонент FooterLegacy deprecated, используйте Select.ApplyChangesButton/Select.ClearButton/ActionBar */
|
|
13
|
+
export declare const FooterLegacy: ({ clearButton, applyChangesButton, withClearButton, applyOnClear, onApply, onClear, renderButtonsContainer, }: FooterLegacyProps) => ReactElement | null;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import './../../index.css';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
|
+
import { ActionBar } from '@hh.ru/magritte-ui-action-bar';
|
|
5
|
+
import { ApplyChangesButton } from '../../ApplyChangesButton.js';
|
|
6
|
+
import { ClearButton } from '../../ClearButton.js';
|
|
7
|
+
import { useDataProvider } from '../../useDataProvider.js';
|
|
8
|
+
import { useSearchState } from '../../useSearchState.js';
|
|
9
|
+
import { useSelectConfig } from '../../useSelectConfig.js';
|
|
10
|
+
import { useSelectContentState } from '../../useSelectContentState.js';
|
|
11
|
+
import '@hh.ru/magritte-common-use-translation';
|
|
12
|
+
import '@hh.ru/magritte-ui-breakpoint';
|
|
13
|
+
import '../../SelectPickerContext.js';
|
|
14
|
+
import '../../internal/SelectStateContext.js';
|
|
15
|
+
import '../../internal/SelectStore.js';
|
|
16
|
+
import '../../internal/utils.js';
|
|
17
|
+
import '../../internal/slots.js';
|
|
18
|
+
import '@hh.ru/magritte-internal-slot-registry';
|
|
19
|
+
import '../../useVisibility.js';
|
|
20
|
+
import '../../internal/VisibilityContext.js';
|
|
21
|
+
import '../../internal/SelectDataProvider.js';
|
|
22
|
+
import '@hh.ru/magritte-common-data-provider';
|
|
23
|
+
import '../../internal/useDataProvider.js';
|
|
24
|
+
import '../../internal/SearchStateContext.js';
|
|
25
|
+
import '../../internal/ConfigContext.js';
|
|
26
|
+
|
|
27
|
+
/** @deprecated Компонент FooterLegacy deprecated, используйте Select.ApplyChangesButton/Select.ClearButton/ActionBar */
|
|
28
|
+
const FooterLegacy = ({ clearButton, applyChangesButton, withClearButton, applyOnClear, onApply, onClear, renderButtonsContainer, }) => {
|
|
29
|
+
const { optionList, isError } = useDataProvider();
|
|
30
|
+
const { searchValue } = useSearchState();
|
|
31
|
+
const { loading } = useSelectConfig();
|
|
32
|
+
const contentState = useSelectContentState();
|
|
33
|
+
const actions = [];
|
|
34
|
+
if (withClearButton && isValidElement(clearButton)) {
|
|
35
|
+
actions.push(jsx(ClearButton, { applyOnClear: applyOnClear, onClear: onClear, children: clearButton }, "clearButton"));
|
|
36
|
+
}
|
|
37
|
+
if (isValidElement(applyChangesButton)) {
|
|
38
|
+
actions.push(jsx(ApplyChangesButton, { onApply: onApply, children: applyChangesButton }, "applyChangesButton"));
|
|
39
|
+
}
|
|
40
|
+
if (renderButtonsContainer) {
|
|
41
|
+
const footer = renderButtonsContainer({
|
|
42
|
+
clearButton: actions.find((action) => isValidElement(action) && action.key === 'clearButton'),
|
|
43
|
+
applyChangesButton: actions.find((action) => isValidElement(action) && action.key === 'applyChangesButton'),
|
|
44
|
+
optionsCount: optionList.length,
|
|
45
|
+
searchValue,
|
|
46
|
+
loading,
|
|
47
|
+
isError,
|
|
48
|
+
emptyOptionsHintVisible: contentState === 'empty-hint' || contentState === 'empty-search-hint',
|
|
49
|
+
});
|
|
50
|
+
return isValidElement(footer) ? footer : null;
|
|
51
|
+
}
|
|
52
|
+
if (actions.length === 0 || loading) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
return jsx(ActionBar, { primaryActions: actions });
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { FooterLegacy };
|
|
59
|
+
//# sourceMappingURL=FooterLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FooterLegacy.js","sources":["src/legacy/internal/FooterLegacy.tsx"],"sourcesContent":["import { ComponentProps, ReactElement, ReactNode, isValidElement } from 'react';\n\nimport { ActionBar } from '@hh.ru/magritte-ui-action-bar';\nimport { Button } from '@hh.ru/magritte-ui-button';\nimport { ApplyChangesButton } from '@hh.ru/magritte-ui-select/ApplyChangesButton';\nimport { ClearButton } from '@hh.ru/magritte-ui-select/ClearButton';\nimport type { OnApplyCallback, RenderButtonsContainer } from '@hh.ru/magritte-ui-select/legacy/types';\nimport { useDataProvider } from '@hh.ru/magritte-ui-select/useDataProvider';\nimport { useSearchState } from '@hh.ru/magritte-ui-select/useSearchState';\nimport { useSelectConfig } from '@hh.ru/magritte-ui-select/useSelectConfig';\nimport { useSelectContentState } from '@hh.ru/magritte-ui-select/useSelectContentState';\n\ninterface FooterLegacyProps {\n clearButton?: ReactNode;\n applyChangesButton?: ReactNode;\n withClearButton: boolean;\n applyOnClear: boolean;\n onApply?: OnApplyCallback;\n onClear?: VoidFunction;\n renderButtonsContainer?: RenderButtonsContainer;\n}\n\n/** @deprecated Компонент FooterLegacy deprecated, используйте Select.ApplyChangesButton/Select.ClearButton/ActionBar */\nexport const FooterLegacy = ({\n clearButton,\n applyChangesButton,\n withClearButton,\n applyOnClear,\n onApply,\n onClear,\n renderButtonsContainer,\n}: FooterLegacyProps): ReactElement | null => {\n const { optionList, isError } = useDataProvider();\n const { searchValue } = useSearchState();\n const { loading } = useSelectConfig();\n const contentState = useSelectContentState();\n\n const actions: ReactNode[] = [];\n if (withClearButton && isValidElement<ComponentProps<typeof Button>>(clearButton)) {\n actions.push(\n <ClearButton key=\"clearButton\" applyOnClear={applyOnClear} onClear={onClear}>\n {clearButton}\n </ClearButton>\n );\n }\n if (isValidElement(applyChangesButton)) {\n actions.push(\n <ApplyChangesButton key=\"applyChangesButton\" onApply={onApply}>\n {applyChangesButton}\n </ApplyChangesButton>\n );\n }\n\n if (renderButtonsContainer) {\n const footer = renderButtonsContainer({\n clearButton: actions.find((action) => isValidElement(action) && action.key === 'clearButton'),\n applyChangesButton: actions.find((action) => isValidElement(action) && action.key === 'applyChangesButton'),\n optionsCount: optionList.length,\n searchValue,\n loading,\n isError,\n emptyOptionsHintVisible: contentState === 'empty-hint' || contentState === 'empty-search-hint',\n });\n return isValidElement(footer) ? footer : null;\n }\n\n if (actions.length === 0 || loading) {\n return null;\n }\n\n return <ActionBar primaryActions={actions} />;\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAsBA;MACa,YAAY,GAAG,CAAC,EACzB,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,YAAY,EACZ,OAAO,EACP,OAAO,EACP,sBAAsB,GACN,KAAyB;IACzC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;AAClD,IAAA,MAAM,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CAAC;AACzC,IAAA,MAAM,EAAE,OAAO,EAAE,GAAG,eAAe,EAAE,CAAC;AACtC,IAAA,MAAM,YAAY,GAAG,qBAAqB,EAAE,CAAC;IAE7C,MAAM,OAAO,GAAgB,EAAE,CAAC;AAChC,IAAA,IAAI,eAAe,IAAI,cAAc,CAAgC,WAAW,CAAC,EAAE;AAC/E,QAAA,OAAO,CAAC,IAAI,CACRA,IAAC,WAAW,EAAA,EAAmB,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EACtE,QAAA,EAAA,WAAW,IADC,aAAa,CAEhB,CACjB,CAAC;KACL;AACD,IAAA,IAAI,cAAc,CAAC,kBAAkB,CAAC,EAAE;AACpC,QAAA,OAAO,CAAC,IAAI,CACRA,GAAA,CAAC,kBAAkB,EAA0B,EAAA,OAAO,EAAE,OAAO,YACxD,kBAAkB,EAAA,EADC,oBAAoB,CAEvB,CACxB,CAAC;KACL;IAED,IAAI,sBAAsB,EAAE;QACxB,MAAM,MAAM,GAAG,sBAAsB,CAAC;YAClC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,aAAa,CAAC;YAC7F,kBAAkB,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,cAAc,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,oBAAoB,CAAC;YAC3G,YAAY,EAAE,UAAU,CAAC,MAAM;YAC/B,WAAW;YACX,OAAO;YACP,OAAO;AACP,YAAA,uBAAuB,EAAE,YAAY,KAAK,YAAY,IAAI,YAAY,KAAK,mBAAmB;AACjG,SAAA,CAAC,CAAC;AACH,QAAA,OAAO,cAAc,CAAC,MAAM,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;KACjD;IAED,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,EAAE;AACjC,QAAA,OAAO,IAAI,CAAC;KACf;AAED,IAAA,OAAOA,IAAC,SAAS,EAAA,EAAC,cAAc,EAAE,OAAO,GAAI,CAAC;AAClD;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';
|
|
2
|
+
import type { OptionCustomLayoutComponent } from '@hh.ru/magritte-ui-select/SelectOptions';
|
|
3
|
+
import type { RenderOptionType } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
4
|
+
interface LegacyOptionLayoutParams<DataType extends StaticDataFetcherItem> {
|
|
5
|
+
renderDesktopItem?: RenderOptionType<DataType>;
|
|
6
|
+
renderMobileItem?: RenderOptionType<DataType>;
|
|
7
|
+
name?: string;
|
|
8
|
+
dataQa?: string;
|
|
9
|
+
}
|
|
10
|
+
/** @deprecated Компонент makeLegacyOptionLayout deprecated, используйте Select.Options */
|
|
11
|
+
export declare const makeLegacyOptionLayout: <DataType extends StaticDataFetcherItem>({ renderDesktopItem, renderMobileItem, name, dataQa, }: LegacyOptionLayoutParams<DataType>) => OptionCustomLayoutComponent<DataType>;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import './../../index.css';
|
|
2
|
+
import { jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { OptionLayoutComponentDefault } from '../../internal/Option.js';
|
|
4
|
+
import 'react';
|
|
5
|
+
import 'classnames';
|
|
6
|
+
import '@hh.ru/magritte-common-keyboard';
|
|
7
|
+
import '@hh.ru/magritte-common-use-disabled';
|
|
8
|
+
import '@hh.ru/magritte-ui-cell';
|
|
9
|
+
import '@hh.ru/magritte-ui-checkable-card/CheckableCardElement';
|
|
10
|
+
import '@hh.ru/magritte-ui-icon/icon';
|
|
11
|
+
import '../../internal/OptionControl.js';
|
|
12
|
+
import '@hh.ru/magritte-ui-checkbox-radio';
|
|
13
|
+
import '@hh.ru/magritte-ui-typography';
|
|
14
|
+
|
|
15
|
+
/** @deprecated Компонент makeLegacyOptionLayout deprecated, используйте Select.Options */
|
|
16
|
+
const makeLegacyOptionLayout = ({ renderDesktopItem, renderMobileItem, name, dataQa, }) => {
|
|
17
|
+
const LegacyOptionLayout = (props) => {
|
|
18
|
+
const { data, type, input, checked, disabled, plain, multiple, isMobile, onChange } = props;
|
|
19
|
+
const render = isMobile ? renderMobileItem : renderDesktopItem;
|
|
20
|
+
if (!render) {
|
|
21
|
+
return jsx(OptionLayoutComponentDefault, { ...props });
|
|
22
|
+
}
|
|
23
|
+
return render({
|
|
24
|
+
data,
|
|
25
|
+
type,
|
|
26
|
+
input: input,
|
|
27
|
+
checked,
|
|
28
|
+
disabled,
|
|
29
|
+
plain,
|
|
30
|
+
multiple,
|
|
31
|
+
isMobile,
|
|
32
|
+
name,
|
|
33
|
+
'data-qa': dataQa,
|
|
34
|
+
render,
|
|
35
|
+
onChange: (value) => onChange(value),
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return LegacyOptionLayout;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export { makeLegacyOptionLayout };
|
|
42
|
+
//# sourceMappingURL=OptionLayoutLegacy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OptionLayoutLegacy.js","sources":["src/legacy/internal/OptionLayoutLegacy.tsx"],"sourcesContent":["import { ReactElement } from 'react';\n\nimport { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';\nimport type { OptionCustomLayoutComponent } from '@hh.ru/magritte-ui-select/SelectOptions';\nimport { OptionLayoutComponentDefault } from '@hh.ru/magritte-ui-select/internal/Option';\nimport type { RenderOptionType } from '@hh.ru/magritte-ui-select/legacy/types';\n\ninterface LegacyOptionLayoutParams<DataType extends StaticDataFetcherItem> {\n renderDesktopItem?: RenderOptionType<DataType>;\n renderMobileItem?: RenderOptionType<DataType>;\n name?: string;\n dataQa?: string;\n}\n\n/** @deprecated Компонент makeLegacyOptionLayout deprecated, используйте Select.Options */\nexport const makeLegacyOptionLayout = <DataType extends StaticDataFetcherItem>({\n renderDesktopItem,\n renderMobileItem,\n name,\n dataQa,\n}: LegacyOptionLayoutParams<DataType>): OptionCustomLayoutComponent<DataType> => {\n const LegacyOptionLayout: OptionCustomLayoutComponent<DataType> = (props): ReactElement => {\n const { data, type, input, checked, disabled, plain, multiple, isMobile, onChange } = props;\n const render = isMobile ? renderMobileItem : renderDesktopItem;\n\n if (!render) {\n return <OptionLayoutComponentDefault<DataType> {...props} />;\n }\n\n return render({\n data,\n type,\n input: input as ReactElement,\n checked,\n disabled,\n plain,\n multiple,\n isMobile,\n name,\n 'data-qa': dataQa,\n render,\n onChange: (value) => onChange(value),\n });\n };\n\n return LegacyOptionLayout;\n};\n"],"names":["_jsx"],"mappings":";;;;;;;;;;;;;AAcA;AACO,MAAM,sBAAsB,GAAG,CAAyC,EAC3E,iBAAiB,EACjB,gBAAgB,EAChB,IAAI,EACJ,MAAM,GAC2B,KAA2C;AAC5E,IAAA,MAAM,kBAAkB,GAA0C,CAAC,KAAK,KAAkB;QACtF,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,KAAK,CAAC;QAC5F,MAAM,MAAM,GAAG,QAAQ,GAAG,gBAAgB,GAAG,iBAAiB,CAAC;QAE/D,IAAI,CAAC,MAAM,EAAE;AACT,YAAA,OAAOA,GAAC,CAAA,4BAA4B,EAAe,EAAA,GAAA,KAAK,GAAI,CAAC;SAChE;AAED,QAAA,OAAO,MAAM,CAAC;YACV,IAAI;YACJ,IAAI;AACJ,YAAA,KAAK,EAAE,KAAqB;YAC5B,OAAO;YACP,QAAQ;YACR,KAAK;YACL,QAAQ;YACR,QAAQ;YACR,IAAI;AACJ,YAAA,SAAS,EAAE,MAAM;YACjB,MAAM;YACN,QAAQ,EAAE,CAAC,KAAK,KAAK,QAAQ,CAAC,KAAK,CAAC;AACvC,SAAA,CAAC,CAAC;AACP,KAAC,CAAC;AAEF,IAAA,OAAO,kBAAkB,CAAC;AAC9B;;;;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
+
import type { RenderTrigger, TriggerExternalProps } from '@hh.ru/magritte-ui-select/legacy/types';
|
|
3
|
+
interface TriggerLegacyProps {
|
|
4
|
+
renderTrigger: RenderTrigger;
|
|
5
|
+
triggerProps?: TriggerExternalProps;
|
|
6
|
+
dataQa?: string;
|
|
7
|
+
activatorRef: ForwardedRef<HTMLElement>;
|
|
8
|
+
searchable?: boolean;
|
|
9
|
+
}
|
|
10
|
+
/** @deprecated Компонент TriggerLegacy deprecated, используйте Select.Trigger/Select.SearchTrigger */
|
|
11
|
+
export declare const TriggerLegacy: ({ renderTrigger, triggerProps, dataQa, activatorRef: activatorRefExternal, searchable, }: TriggerLegacyProps) => ReactElement;
|
|
12
|
+
export {};
|