@hh.ru/magritte-ui-select 13.0.23 → 13.0.25
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 +1 -1
- package/ApplyChangesButton.js +30 -29
- package/ApplyChangesButton.js.map +1 -1
- package/ClearButton.js +18 -21
- package/ClearButton.js.map +1 -1
- package/ClearCard.d.ts +1 -1
- package/ClearCard.js +2 -3
- package/ClearCard.js.map +1 -1
- package/Select.d.ts +14 -14
- package/Select.js +46 -8
- package/Select.js.map +1 -1
- package/SelectBottomSheet.js +56 -33
- package/SelectBottomSheet.js.map +1 -1
- package/SelectBottomSheetHeader.js +16 -9
- package/SelectBottomSheetHeader.js.map +1 -1
- package/SelectDrop.js +93 -57
- package/SelectDrop.js.map +1 -1
- package/SelectEmptyHint.js +22 -11
- package/SelectEmptyHint.js.map +1 -1
- package/SelectOptions.d.ts +4 -4
- package/SelectOptions.js +103 -67
- package/SelectOptions.js.map +1 -1
- package/SelectPickerCloseIcon.js +21 -11
- package/SelectPickerCloseIcon.js.map +1 -1
- package/SelectPickerContext.js +82 -82
- package/SelectPickerContext.js.map +1 -1
- package/SelectSearchInput.d.ts +1 -1
- package/SelectSearchInput.js +14 -4
- package/SelectSearchInput.js.map +1 -1
- package/SelectSearchTrigger.d.ts +1 -1
- package/SelectSearchTrigger.js +108 -37
- package/SelectSearchTrigger.js.map +1 -1
- package/SelectTrigger.d.ts +1 -1
- package/SelectTrigger.js +45 -17
- package/SelectTrigger.js.map +1 -1
- package/UncontrolledSelect.d.ts +5 -5
- package/UncontrolledSelect.js +43 -9
- package/UncontrolledSelect.js.map +1 -1
- package/index.css +50 -50
- package/index.d.ts +16 -16
- package/index.mock.d.ts +12 -12
- package/index.mock.js +33 -34
- package/index.mock.js.map +1 -1
- package/internal/ConfigContext.d.ts +1 -1
- package/internal/ConfigContext.js +52 -38
- package/internal/ConfigContext.js.map +1 -1
- package/internal/NavigationManagement.js +46 -44
- package/internal/NavigationManagement.js.map +1 -1
- package/internal/Option.d.ts +3 -3
- package/internal/Option.js +108 -43
- package/internal/Option.js.map +1 -1
- package/internal/OptionControl.d.ts +5 -5
- package/internal/OptionControl.js +37 -8
- package/internal/OptionControl.js.map +1 -1
- package/internal/SearchStateContext.js +19 -13
- package/internal/SearchStateContext.js.map +1 -1
- package/internal/SelectDataProvider.d.ts +2 -2
- package/internal/SelectDataProvider.js +17 -12
- package/internal/SelectDataProvider.js.map +1 -1
- package/internal/SelectError.js +21 -14
- package/internal/SelectError.js.map +1 -1
- package/internal/SelectReloadButton.js +12 -2
- package/internal/SelectReloadButton.js.map +1 -1
- package/internal/SelectStateContext.d.ts +2 -2
- package/internal/SelectStateContext.js +34 -43
- package/internal/SelectStateContext.js.map +1 -1
- package/internal/SelectStore.js +40 -45
- package/internal/SelectStore.js.map +1 -1
- package/internal/VisibilityContext.js +17 -8
- package/internal/VisibilityContext.js.map +1 -1
- package/internal/focusOrchestrator.d.ts +2 -2
- package/internal/focusOrchestrator.js +50 -50
- package/internal/focusOrchestrator.js.map +1 -1
- package/internal/slots.d.ts +1 -1
- package/internal/slots.js +5 -2
- package/internal/slots.js.map +1 -1
- package/internal/useDataProvider.d.ts +1 -1
- package/internal/useDataProvider.js +91 -95
- package/internal/useDataProvider.js.map +1 -1
- package/internal/useFocusWithin.js +32 -47
- package/internal/useFocusWithin.js.map +1 -1
- package/internal/utils.d.ts +1 -1
- package/internal/utils.js +39 -46
- package/internal/utils.js.map +1 -1
- package/legacy/SelectLegacy.d.ts +1 -1
- package/legacy/SelectLegacy.js +201 -61
- package/legacy/SelectLegacy.js.map +1 -1
- package/legacy/UncontrolledSelectLegacy.d.ts +5 -5
- package/legacy/UncontrolledSelectLegacy.js +24 -10
- package/legacy/UncontrolledSelectLegacy.js.map +1 -1
- package/legacy/internal/BottomSheetHeaderLegacy.d.ts +1 -1
- package/legacy/internal/BottomSheetHeaderLegacy.js +49 -33
- package/legacy/internal/BottomSheetHeaderLegacy.js.map +1 -1
- package/legacy/internal/ContentBeforeLegacy.d.ts +1 -1
- package/legacy/internal/ContentBeforeLegacy.js +21 -18
- package/legacy/internal/ContentBeforeLegacy.js.map +1 -1
- package/legacy/internal/FooterLegacy.d.ts +1 -1
- package/legacy/internal/FooterLegacy.js +58 -38
- package/legacy/internal/FooterLegacy.js.map +1 -1
- package/legacy/internal/OptionLayoutLegacy.d.ts +2 -2
- package/legacy/internal/OptionLayoutLegacy.js +28 -24
- package/legacy/internal/OptionLayoutLegacy.js.map +1 -1
- package/legacy/internal/TriggerLegacy.d.ts +1 -1
- package/legacy/internal/TriggerLegacy.js +36 -31
- package/legacy/internal/TriggerLegacy.js.map +1 -1
- package/legacy/internal/UnsavedChangesAlertLegacy.d.ts +1 -1
- package/legacy/internal/UnsavedChangesAlertLegacy.js +10 -9
- package/legacy/internal/UnsavedChangesAlertLegacy.js.map +1 -1
- package/legacy/types.d.ts +2 -2
- package/package.json +19 -19
- package/types.d.ts +1 -1
- package/useDataProvider.d.ts +1 -1
- package/useDataProvider.js +4 -2
- package/useDataProvider.js.map +1 -1
- package/usePickerRef.js +3 -4
- package/usePickerRef.js.map +1 -1
- package/useSearchState.d.ts +1 -1
- package/useSearchState.js +1 -2
- package/useSearchState.js.map +1 -1
- package/useSelectConfig.d.ts +1 -1
- package/useSelectConfig.js +1 -2
- package/useSelectConfig.js.map +1 -1
- package/useSelectContentState.js +25 -23
- package/useSelectContentState.js.map +1 -1
- package/useSelectError.d.ts +1 -1
- package/useSelectError.js +1 -2
- package/useSelectError.js.map +1 -1
- package/useSelectHint.d.ts +1 -1
- package/useSelectHint.js +1 -2
- package/useSelectHint.js.map +1 -1
- package/useSelectTrigger.d.ts +1 -1
- package/useSelectTrigger.js +99 -108
- package/useSelectTrigger.js.map +1 -1
- package/useVisibility.d.ts +1 -1
- package/useVisibility.js +1 -2
- package/useVisibility.js.map +1 -1
|
@@ -26,40 +26,56 @@ import '@hh.ru/magritte-common-data-provider';
|
|
|
26
26
|
import '../../internal/useDataProvider.js';
|
|
27
27
|
import '../../internal/SearchStateContext.js';
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
29
|
+
const BottomSheetHeaderLegacy = ({
|
|
30
|
+
headerTitle,
|
|
31
|
+
searchable,
|
|
32
|
+
renderHeader,
|
|
33
|
+
onSearchSubmit
|
|
34
|
+
}) => {
|
|
35
|
+
const searchTrl = useTranslation("Select", "search");
|
|
36
|
+
const closeTrl = useTranslation("Select", "close");
|
|
37
|
+
const { searchValue, setSearchValue } = useSearchState();
|
|
38
|
+
const { optionList } = useDataProvider();
|
|
39
|
+
const { applyChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();
|
|
40
|
+
const onCloseBottomSheet = useCallback(
|
|
41
|
+
() => onCloseRequestWithUnsavedChanges(),
|
|
42
|
+
[onCloseRequestWithUnsavedChanges]
|
|
43
|
+
);
|
|
44
|
+
const onCloseBottomSheetWithUpdateValues = useCallback(() => {
|
|
45
|
+
applyChanges();
|
|
46
|
+
onCloseRequestWithUnsavedChanges();
|
|
47
|
+
}, [applyChanges, onCloseRequestWithUnsavedChanges]);
|
|
48
|
+
const onSearchInputKeyDown = useCallback(
|
|
49
|
+
(event) => {
|
|
50
|
+
if (!onSearchSubmit || !keyboardMatches(event.nativeEvent, [keyboardKeys.Enter])) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
onSearchSubmit(event, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues);
|
|
54
|
+
},
|
|
55
|
+
[onSearchSubmit, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues]
|
|
56
|
+
);
|
|
57
|
+
if (renderHeader) {
|
|
58
|
+
const header = renderHeader({
|
|
59
|
+
searchValue,
|
|
60
|
+
setSearchValue,
|
|
61
|
+
optionsCount: optionList.length,
|
|
62
|
+
onCloseBottomSheet,
|
|
63
|
+
onCloseBottomSheetWithUpdateValues,
|
|
64
|
+
searchable,
|
|
65
|
+
headerTitle,
|
|
66
|
+
onSearchSubmit,
|
|
67
|
+
searchTrl,
|
|
68
|
+
closeTrl
|
|
69
|
+
});
|
|
70
|
+
return isValidElement(header) ? header : null;
|
|
71
|
+
}
|
|
72
|
+
return /* @__PURE__ */ jsx(
|
|
73
|
+
SelectBottomSheetHeader,
|
|
74
|
+
{
|
|
75
|
+
headerTitle,
|
|
76
|
+
onSearchInputKeyDown: onSearchSubmit ? onSearchInputKeyDown : void 0
|
|
61
77
|
}
|
|
62
|
-
|
|
78
|
+
);
|
|
63
79
|
};
|
|
64
80
|
|
|
65
81
|
export { BottomSheetHeaderLegacy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BottomSheetHeaderLegacy.js","sources":["src/legacy/internal/BottomSheetHeaderLegacy.tsx"],"sourcesContent":["import { 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(event, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues);\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":[
|
|
1
|
+
{"version":3,"file":"BottomSheetHeaderLegacy.js","sources":["src/legacy/internal/BottomSheetHeaderLegacy.tsx"],"sourcesContent":["import { 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(event, onCloseBottomSheet, optionList.length, onCloseBottomSheetWithUpdateValues);\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,0BAA0B,CAAC;AAAA,EACpC,WAAA;AAAA,EACA,UAAA;AAAA,EACA,YAAA;AAAA,EACA,cAAA;AACJ,CAAyD,KAAA;AACrD,EAAM,MAAA,SAAA,GAAY,cAAe,CAAA,QAAA,EAAU,QAAQ,CAAA,CAAA;AACnD,EAAM,MAAA,QAAA,GAAW,cAAe,CAAA,QAAA,EAAU,OAAO,CAAA,CAAA;AACjD,EAAA,MAAM,EAAE,WAAA,EAAa,cAAe,EAAA,GAAI,cAAe,EAAA,CAAA;AACvD,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAA,MAAM,EAAE,YAAA,EAAc,gCAAiC,EAAA,GAAI,eAAgB,EAAA,CAAA;AAE3E,EAAA,MAAM,kBAAqB,GAAA,WAAA;AAAA,IACvB,MAAM,gCAAiC,EAAA;AAAA,IACvC,CAAC,gCAAgC,CAAA;AAAA,GACrC,CAAA;AAEA,EAAM,MAAA,kCAAA,GAAqC,YAAY,MAAM;AACzD,IAAa,YAAA,EAAA,CAAA;AACb,IAAiC,gCAAA,EAAA,CAAA;AAAA,GAClC,EAAA,CAAC,YAAc,EAAA,gCAAgC,CAAC,CAAA,CAAA;AAEnD,EAAA,MAAM,oBAAuB,GAAA,WAAA;AAAA,IACzB,CAAC,KAAU,KAAA;AACP,MAAI,IAAA,CAAC,cAAkB,IAAA,CAAC,eAAgB,CAAA,KAAA,CAAM,aAAa,CAAC,YAAA,CAAa,KAAK,CAAC,CAAG,EAAA;AAC9E,QAAA,OAAA;AAAA,OACJ;AACA,MAAA,cAAA,CAAe,KAAO,EAAA,kBAAA,EAAoB,UAAW,CAAA,MAAA,EAAQ,kCAAkC,CAAA,CAAA;AAAA,KACnG;AAAA,IACA,CAAC,cAAA,EAAgB,kBAAoB,EAAA,UAAA,CAAW,QAAQ,kCAAkC,CAAA;AAAA,GAC9F,CAAA;AAEA,EAAA,IAAI,YAAc,EAAA;AACd,IAAA,MAAM,SAAS,YAAa,CAAA;AAAA,MACxB,WAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAc,UAAW,CAAA,MAAA;AAAA,MACzB,kBAAA;AAAA,MACA,kCAAA;AAAA,MACA,UAAA;AAAA,MACA,WAAA;AAAA,MACA,cAAA;AAAA,MACA,SAAA;AAAA,MACA,QAAA;AAAA,KACH,CAAA,CAAA;AACD,IAAO,OAAA,cAAA,CAAe,MAAM,CAAA,GAAI,MAAS,GAAA,IAAA,CAAA;AAAA,GAC7C;AAEA,EACI,uBAAA,GAAA;AAAA,IAAC,uBAAA;AAAA,IAAA;AAAA,MACG,WAAA;AAAA,MACA,oBAAA,EAAsB,iBAAiB,oBAAuB,GAAA,KAAA,CAAA;AAAA,KAAA;AAAA,GAClE,CAAA;AAER;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import type { RenderContentBefore } from '
|
|
2
|
+
import type { RenderContentBefore } from '../../legacy/types';
|
|
3
3
|
interface ContentBeforeLegacyProps {
|
|
4
4
|
renderContentBefore: RenderContentBefore;
|
|
5
5
|
applyOnClear: boolean;
|
|
@@ -18,24 +18,27 @@ import '@hh.ru/magritte-common-data-provider';
|
|
|
18
18
|
import '../../internal/useDataProvider.js';
|
|
19
19
|
import '../../internal/SearchStateContext.js';
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
const ContentBeforeLegacy = ({
|
|
22
|
+
renderContentBefore,
|
|
23
|
+
applyOnClear,
|
|
24
|
+
onClear
|
|
25
|
+
}) => {
|
|
26
|
+
const { searchValue, setSearchValue } = useSearchState();
|
|
27
|
+
const { optionList } = useDataProvider();
|
|
28
|
+
const { clearChanges, onCloseRequestWithUnsavedChanges } = useSelectPicker();
|
|
29
|
+
const clearSelectedValuesAndClose = useCallback(() => {
|
|
30
|
+
clearChanges(applyOnClear);
|
|
31
|
+
if (applyOnClear) {
|
|
32
|
+
onCloseRequestWithUnsavedChanges();
|
|
33
|
+
}
|
|
34
|
+
onClear?.();
|
|
35
|
+
}, [clearChanges, applyOnClear, onCloseRequestWithUnsavedChanges, onClear]);
|
|
36
|
+
return renderContentBefore({
|
|
37
|
+
searchValue,
|
|
38
|
+
setSearchValue,
|
|
39
|
+
optionsCount: optionList.length,
|
|
40
|
+
clearSelectedValuesAndClose
|
|
41
|
+
});
|
|
39
42
|
};
|
|
40
43
|
|
|
41
44
|
export { ContentBeforeLegacy };
|
|
@@ -1 +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":";;;;;;;;;;;;;;;;;;;
|
|
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":";;;;;;;;;;;;;;;;;;;AAcO,MAAM,sBAAsB,CAAC;AAAA,EAChC,mBAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AACJ,CAA8C,KAAA;AAC1C,EAAA,MAAM,EAAE,WAAA,EAAa,cAAe,EAAA,GAAI,cAAe,EAAA,CAAA;AACvD,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,eAAgB,EAAA,CAAA;AACvC,EAAA,MAAM,EAAE,YAAA,EAAc,gCAAiC,EAAA,GAAI,eAAgB,EAAA,CAAA;AAE3E,EAAM,MAAA,2BAAA,GAA8B,YAAY,MAAM;AAClD,IAAA,YAAA,CAAa,YAAY,CAAA,CAAA;AACzB,IAAA,IAAI,YAAc,EAAA;AACd,MAAiC,gCAAA,EAAA,CAAA;AAAA,KACrC;AACA,IAAU,OAAA,IAAA,CAAA;AAAA,KACX,CAAC,YAAA,EAAc,YAAc,EAAA,gCAAA,EAAkC,OAAO,CAAC,CAAA,CAAA;AAE1E,EAAA,OAAO,mBAAoB,CAAA;AAAA,IACvB,WAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAc,UAAW,CAAA,MAAA;AAAA,IACzB,2BAAA;AAAA,GACH,CAAA,CAAA;AACL;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactNode } from 'react';
|
|
2
2
|
import { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';
|
|
3
|
-
import type { OnApplyCallback, RenderButtonsContainer } from '
|
|
3
|
+
import type { OnApplyCallback, RenderButtonsContainer } from '../../legacy/types';
|
|
4
4
|
interface FooterLegacyProps<DataType extends StaticDataFetcherItem> {
|
|
5
5
|
clearButton?: ReactNode;
|
|
6
6
|
applyChangesButton?: ReactNode;
|
|
@@ -24,45 +24,65 @@ import '../../internal/SearchStateContext.js';
|
|
|
24
24
|
import '../../internal/ConfigContext.js';
|
|
25
25
|
import '../../internal/VisibilityContext.js';
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
27
|
+
const FooterLegacy = ({
|
|
28
|
+
clearButton,
|
|
29
|
+
applyChangesButton,
|
|
30
|
+
withClearButton,
|
|
31
|
+
applyOnClear,
|
|
32
|
+
onApply: onApplyExternal,
|
|
33
|
+
onChangeWithLastEmittedCheck,
|
|
34
|
+
onPickerOpen,
|
|
35
|
+
onClear,
|
|
36
|
+
renderButtonsContainer
|
|
37
|
+
}) => {
|
|
38
|
+
const selectDraftStore = useSelectStore();
|
|
39
|
+
const { showOptions } = useVisibility();
|
|
40
|
+
const { optionList, isError } = useDataProvider();
|
|
41
|
+
const { searchValue } = useSearchState();
|
|
42
|
+
const { loading } = useSelectConfig();
|
|
43
|
+
const contentState = useSelectContentState();
|
|
44
|
+
useEffect(() => {
|
|
45
|
+
if (showOptions) {
|
|
46
|
+
onPickerOpen?.();
|
|
43
47
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
48
|
+
}, [showOptions, onPickerOpen]);
|
|
49
|
+
const actions = [];
|
|
50
|
+
if (withClearButton && isValidElement(clearButton)) {
|
|
51
|
+
actions.push(
|
|
52
|
+
/* @__PURE__ */ jsx(ClearButton, { applyOnClear, onClear, children: clearButton }, "clearButton")
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
if (isValidElement(applyChangesButton)) {
|
|
56
|
+
actions.push(
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
ApplyChangesButton,
|
|
59
|
+
{
|
|
60
|
+
onApply: (props) => {
|
|
61
|
+
onChangeWithLastEmittedCheck?.(selectDraftStore.getSnapshot());
|
|
62
|
+
onApplyExternal?.(props);
|
|
63
|
+
},
|
|
64
|
+
children: applyChangesButton
|
|
65
|
+
},
|
|
66
|
+
"applyChangesButton"
|
|
67
|
+
)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
if (renderButtonsContainer) {
|
|
71
|
+
const footer = renderButtonsContainer({
|
|
72
|
+
clearButton: actions.find((action) => isValidElement(action) && action.key === "clearButton"),
|
|
73
|
+
applyChangesButton: actions.find((action) => isValidElement(action) && action.key === "applyChangesButton"),
|
|
74
|
+
optionsCount: optionList.length,
|
|
75
|
+
searchValue,
|
|
76
|
+
loading,
|
|
77
|
+
isError,
|
|
78
|
+
emptyOptionsHintVisible: contentState === "empty-hint" || contentState === "empty-search-hint"
|
|
79
|
+
});
|
|
80
|
+
return isValidElement(footer) ? footer : null;
|
|
81
|
+
}
|
|
82
|
+
if (actions.length === 0 || loading) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
return /* @__PURE__ */ jsx(ActionBar, { primaryActions: actions });
|
|
66
86
|
};
|
|
67
87
|
|
|
68
88
|
export { FooterLegacy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FooterLegacy.js","sources":["src/legacy/internal/FooterLegacy.tsx"],"sourcesContent":["import { ComponentProps, ReactElement, ReactNode, isValidElement, useEffect } from 'react';\n\nimport { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';\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 { useSelectStore } from '@hh.ru/magritte-ui-select/internal/SelectStateContext';\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';\nimport { useVisibility } from '@hh.ru/magritte-ui-select/useVisibility';\n\ninterface FooterLegacyProps<DataType extends StaticDataFetcherItem> {\n clearButton?: ReactNode;\n applyChangesButton?: ReactNode;\n withClearButton: boolean;\n applyOnClear: boolean;\n onApply?: OnApplyCallback;\n onClear?: VoidFunction;\n onChangeWithLastEmittedCheck?: (values: readonly DataType[]) => void;\n onPickerOpen?: VoidFunction;\n renderButtonsContainer?: RenderButtonsContainer;\n}\n\n/** @deprecated Компонент FooterLegacy deprecated, используйте Select.ApplyChangesButton/Select.ClearButton/ActionBar */\nexport const FooterLegacy = <DataType extends StaticDataFetcherItem>({\n clearButton,\n applyChangesButton,\n withClearButton,\n applyOnClear,\n onApply: onApplyExternal,\n onChangeWithLastEmittedCheck,\n onPickerOpen,\n onClear,\n renderButtonsContainer,\n}: FooterLegacyProps<DataType>): ReactElement | null => {\n const selectDraftStore = useSelectStore<DataType>();\n const { showOptions } = useVisibility();\n const { optionList, isError } = useDataProvider();\n const { searchValue } = useSearchState();\n const { loading } = useSelectConfig();\n const contentState = useSelectContentState();\n\n useEffect(() => {\n if (showOptions) {\n onPickerOpen?.();\n }\n }, [showOptions, onPickerOpen]);\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\n key=\"applyChangesButton\"\n onApply={(props) => {\n onChangeWithLastEmittedCheck?.(selectDraftStore.getSnapshot());\n onApplyExternal?.(props);\n }}\n >\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":[
|
|
1
|
+
{"version":3,"file":"FooterLegacy.js","sources":["src/legacy/internal/FooterLegacy.tsx"],"sourcesContent":["import { ComponentProps, ReactElement, ReactNode, isValidElement, useEffect } from 'react';\n\nimport { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';\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 { useSelectStore } from '@hh.ru/magritte-ui-select/internal/SelectStateContext';\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';\nimport { useVisibility } from '@hh.ru/magritte-ui-select/useVisibility';\n\ninterface FooterLegacyProps<DataType extends StaticDataFetcherItem> {\n clearButton?: ReactNode;\n applyChangesButton?: ReactNode;\n withClearButton: boolean;\n applyOnClear: boolean;\n onApply?: OnApplyCallback;\n onClear?: VoidFunction;\n onChangeWithLastEmittedCheck?: (values: readonly DataType[]) => void;\n onPickerOpen?: VoidFunction;\n renderButtonsContainer?: RenderButtonsContainer;\n}\n\n/** @deprecated Компонент FooterLegacy deprecated, используйте Select.ApplyChangesButton/Select.ClearButton/ActionBar */\nexport const FooterLegacy = <DataType extends StaticDataFetcherItem>({\n clearButton,\n applyChangesButton,\n withClearButton,\n applyOnClear,\n onApply: onApplyExternal,\n onChangeWithLastEmittedCheck,\n onPickerOpen,\n onClear,\n renderButtonsContainer,\n}: FooterLegacyProps<DataType>): ReactElement | null => {\n const selectDraftStore = useSelectStore<DataType>();\n const { showOptions } = useVisibility();\n const { optionList, isError } = useDataProvider();\n const { searchValue } = useSearchState();\n const { loading } = useSelectConfig();\n const contentState = useSelectContentState();\n\n useEffect(() => {\n if (showOptions) {\n onPickerOpen?.();\n }\n }, [showOptions, onPickerOpen]);\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\n key=\"applyChangesButton\"\n onApply={(props) => {\n onChangeWithLastEmittedCheck?.(selectDraftStore.getSnapshot());\n onApplyExternal?.(props);\n }}\n >\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":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,MAAM,eAAe,CAAyC;AAAA,EACjE,WAAA;AAAA,EACA,kBAAA;AAAA,EACA,eAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAS,EAAA,eAAA;AAAA,EACT,4BAAA;AAAA,EACA,YAAA;AAAA,EACA,OAAA;AAAA,EACA,sBAAA;AACJ,CAAwD,KAAA;AACpD,EAAA,MAAM,mBAAmB,cAAyB,EAAA,CAAA;AAClD,EAAM,MAAA,EAAE,WAAY,EAAA,GAAI,aAAc,EAAA,CAAA;AACtC,EAAA,MAAM,EAAE,UAAA,EAAY,OAAQ,EAAA,GAAI,eAAgB,EAAA,CAAA;AAChD,EAAM,MAAA,EAAE,WAAY,EAAA,GAAI,cAAe,EAAA,CAAA;AACvC,EAAM,MAAA,EAAE,OAAQ,EAAA,GAAI,eAAgB,EAAA,CAAA;AACpC,EAAA,MAAM,eAAe,qBAAsB,EAAA,CAAA;AAE3C,EAAA,SAAA,CAAU,MAAM;AACZ,IAAA,IAAI,WAAa,EAAA;AACb,MAAe,YAAA,IAAA,CAAA;AAAA,KACnB;AAAA,GACD,EAAA,CAAC,WAAa,EAAA,YAAY,CAAC,CAAA,CAAA;AAE9B,EAAA,MAAM,UAAuB,EAAC,CAAA;AAC9B,EAAI,IAAA,eAAA,IAAmB,cAA8C,CAAA,WAAW,CAAG,EAAA;AAC/E,IAAQ,OAAA,CAAA,IAAA;AAAA,sBACH,GAAA,CAAA,WAAA,EAAA,EAA8B,YAA4B,EAAA,OAAA,EACtD,yBADY,aAEjB,CAAA;AAAA,KACJ,CAAA;AAAA,GACJ;AACA,EAAI,IAAA,cAAA,CAAe,kBAAkB,CAAG,EAAA;AACpC,IAAQ,OAAA,CAAA,IAAA;AAAA,sBACJ,GAAA;AAAA,QAAC,kBAAA;AAAA,QAAA;AAAA,UAEG,OAAA,EAAS,CAAC,KAAU,KAAA;AAChB,YAA+B,4BAAA,GAAA,gBAAA,CAAiB,aAAa,CAAA,CAAA;AAC7D,YAAA,eAAA,GAAkB,KAAK,CAAA,CAAA;AAAA,WAC3B;AAAA,UAEC,QAAA,EAAA,kBAAA;AAAA,SAAA;AAAA,QANG,oBAAA;AAAA,OAOR;AAAA,KACJ,CAAA;AAAA,GACJ;AAEA,EAAA,IAAI,sBAAwB,EAAA;AACxB,IAAA,MAAM,SAAS,sBAAuB,CAAA;AAAA,MAClC,WAAA,EAAa,OAAQ,CAAA,IAAA,CAAK,CAAC,MAAA,KAAW,eAAe,MAAM,CAAA,IAAK,MAAO,CAAA,GAAA,KAAQ,aAAa,CAAA;AAAA,MAC5F,kBAAA,EAAoB,OAAQ,CAAA,IAAA,CAAK,CAAC,MAAA,KAAW,eAAe,MAAM,CAAA,IAAK,MAAO,CAAA,GAAA,KAAQ,oBAAoB,CAAA;AAAA,MAC1G,cAAc,UAAW,CAAA,MAAA;AAAA,MACzB,WAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,uBAAA,EAAyB,YAAiB,KAAA,YAAA,IAAgB,YAAiB,KAAA,mBAAA;AAAA,KAC9E,CAAA,CAAA;AACD,IAAO,OAAA,cAAA,CAAe,MAAM,CAAA,GAAI,MAAS,GAAA,IAAA,CAAA;AAAA,GAC7C;AAEA,EAAI,IAAA,OAAA,CAAQ,MAAW,KAAA,CAAA,IAAK,OAAS,EAAA;AACjC,IAAO,OAAA,IAAA,CAAA;AAAA,GACX;AAEA,EAAO,uBAAA,GAAA,CAAC,SAAU,EAAA,EAAA,cAAA,EAAgB,OAAS,EAAA,CAAA,CAAA;AAC/C;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { StaticDataFetcherItem } from '@hh.ru/magritte-common-data-provider';
|
|
2
|
-
import type { OptionCustomLayoutComponent } from '
|
|
3
|
-
import type { RenderOptionType } from '
|
|
2
|
+
import type { OptionCustomLayoutComponent } from '../../SelectOptions';
|
|
3
|
+
import type { RenderOptionType } from '../../legacy/types';
|
|
4
4
|
interface LegacyOptionLayoutParams<DataType extends StaticDataFetcherItem> {
|
|
5
5
|
renderDesktopItem?: RenderOptionType<DataType>;
|
|
6
6
|
renderMobileItem?: RenderOptionType<DataType>;
|
|
@@ -12,30 +12,34 @@ import '../../internal/OptionControl.js';
|
|
|
12
12
|
import '@hh.ru/magritte-ui-checkbox-radio';
|
|
13
13
|
import '@hh.ru/magritte-ui-typography';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
15
|
+
const makeLegacyOptionLayout = ({
|
|
16
|
+
renderDesktopItem,
|
|
17
|
+
renderMobileItem,
|
|
18
|
+
name,
|
|
19
|
+
dataQa
|
|
20
|
+
}) => {
|
|
21
|
+
const LegacyOptionLayout = (props) => {
|
|
22
|
+
const { data, type, input, checked, disabled, plain, multiple, isMobile, onChange } = props;
|
|
23
|
+
const render = isMobile ? renderMobileItem : renderDesktopItem;
|
|
24
|
+
if (!render) {
|
|
25
|
+
return /* @__PURE__ */ jsx(OptionLayoutComponentDefault, { ...props });
|
|
26
|
+
}
|
|
27
|
+
return render({
|
|
28
|
+
data,
|
|
29
|
+
type,
|
|
30
|
+
input,
|
|
31
|
+
checked,
|
|
32
|
+
disabled,
|
|
33
|
+
plain,
|
|
34
|
+
multiple,
|
|
35
|
+
isMobile,
|
|
36
|
+
name,
|
|
37
|
+
"data-qa": dataQa,
|
|
38
|
+
render,
|
|
39
|
+
onChange: (value) => onChange(value)
|
|
40
|
+
});
|
|
41
|
+
};
|
|
42
|
+
return LegacyOptionLayout;
|
|
39
43
|
};
|
|
40
44
|
|
|
41
45
|
export { makeLegacyOptionLayout };
|
|
@@ -1 +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":[
|
|
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":[],"mappings":";;;;;;;;;;;;;AAeO,MAAM,yBAAyB,CAAyC;AAAA,EAC3E,iBAAA;AAAA,EACA,gBAAA;AAAA,EACA,IAAA;AAAA,EACA,MAAA;AACJ,CAAiF,KAAA;AAC7E,EAAM,MAAA,kBAAA,GAA4D,CAAC,KAAwB,KAAA;AACvF,IAAM,MAAA,EAAE,IAAM,EAAA,IAAA,EAAM,KAAO,EAAA,OAAA,EAAS,UAAU,KAAO,EAAA,QAAA,EAAU,QAAU,EAAA,QAAA,EAAa,GAAA,KAAA,CAAA;AACtF,IAAM,MAAA,MAAA,GAAS,WAAW,gBAAmB,GAAA,iBAAA,CAAA;AAE7C,IAAA,IAAI,CAAC,MAAQ,EAAA;AACT,MAAO,uBAAA,GAAA,CAAC,4BAAwC,EAAA,EAAA,GAAG,KAAO,EAAA,CAAA,CAAA;AAAA,KAC9D;AAEA,IAAA,OAAO,MAAO,CAAA;AAAA,MACV,IAAA;AAAA,MACA,IAAA;AAAA,MACA,KAAA;AAAA,MACA,OAAA;AAAA,MACA,QAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,QAAA;AAAA,MACA,IAAA;AAAA,MACA,SAAW,EAAA,MAAA;AAAA,MACX,MAAA;AAAA,MACA,QAAU,EAAA,CAAC,KAAU,KAAA,QAAA,CAAS,KAAK,CAAA;AAAA,KACtC,CAAA,CAAA;AAAA,GACL,CAAA;AAEA,EAAO,OAAA,kBAAA,CAAA;AACX;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ForwardedRef, ReactElement } from 'react';
|
|
2
|
-
import type { RenderTrigger, TriggerExternalProps } from '
|
|
2
|
+
import type { RenderTrigger, TriggerExternalProps } from '../../legacy/types';
|
|
3
3
|
interface TriggerLegacyProps {
|
|
4
4
|
renderTrigger: RenderTrigger;
|
|
5
5
|
triggerProps?: TriggerExternalProps;
|
|
@@ -23,37 +23,42 @@ import '@hh.ru/magritte-internal-slot-registry';
|
|
|
23
23
|
import '../../useSelectContentState.js';
|
|
24
24
|
import '../../internal/VisibilityContext.js';
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
26
|
+
const TriggerLegacy = ({
|
|
27
|
+
renderTrigger,
|
|
28
|
+
triggerProps,
|
|
29
|
+
dataQa,
|
|
30
|
+
activatorRef: activatorRefExternal,
|
|
31
|
+
searchable
|
|
32
|
+
}) => {
|
|
33
|
+
const activatorRef = useTriggerRef();
|
|
34
|
+
const activatorRefCallback = useMultipleRefs(activatorRef, activatorRefExternal);
|
|
35
|
+
const forceDisabled = useDisabled();
|
|
36
|
+
const disabled = triggerProps?.disabled || forceDisabled;
|
|
37
|
+
const { values, expanded, onChange, onBlur, onClear, onKeyDown, onFocus, ...a11yProps } = useSelectTrigger({
|
|
38
|
+
disabled,
|
|
39
|
+
searchable
|
|
40
|
+
});
|
|
41
|
+
const { toggleListVisibility } = useVisibility();
|
|
42
|
+
const { setSearchValue } = useSearchState();
|
|
43
|
+
const { optionList } = useDataProvider();
|
|
44
|
+
return renderTrigger({
|
|
45
|
+
values,
|
|
46
|
+
expanded,
|
|
47
|
+
onChange,
|
|
48
|
+
onBlur,
|
|
49
|
+
onClear,
|
|
50
|
+
onKeyDown,
|
|
51
|
+
onFocus,
|
|
52
|
+
...a11yProps,
|
|
53
|
+
toggleExpanded: toggleListVisibility,
|
|
54
|
+
setSearchValue,
|
|
55
|
+
optionsCount: optionList.length,
|
|
56
|
+
ref: activatorRefCallback,
|
|
57
|
+
role: "combobox",
|
|
58
|
+
"data-qa": dataQa,
|
|
59
|
+
...triggerProps,
|
|
60
|
+
disabled
|
|
61
|
+
});
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
export { TriggerLegacy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TriggerLegacy.js","sources":["src/legacy/internal/TriggerLegacy.tsx"],"sourcesContent":["import { ForwardedRef, ReactElement } from 'react';\n\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport type { RenderTrigger, TriggerExternalProps } 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 { useSelectTrigger, useTriggerRef } from '@hh.ru/magritte-ui-select/useSelectTrigger';\nimport { useVisibility } from '@hh.ru/magritte-ui-select/useVisibility';\n\ninterface TriggerLegacyProps {\n renderTrigger: RenderTrigger;\n triggerProps?: TriggerExternalProps;\n dataQa?: string;\n activatorRef: ForwardedRef<HTMLElement>;\n searchable?: boolean;\n}\n\n/** @deprecated Компонент TriggerLegacy deprecated, используйте Select.Trigger/Select.SearchTrigger */\nexport const TriggerLegacy = ({\n renderTrigger,\n triggerProps,\n dataQa,\n activatorRef: activatorRefExternal,\n searchable,\n}: TriggerLegacyProps): ReactElement => {\n const activatorRef = useTriggerRef();\n const activatorRefCallback = useMultipleRefs(activatorRef, activatorRefExternal);\n const forceDisabled = useDisabled();\n const disabled = triggerProps?.disabled || forceDisabled;\n\n const { values, expanded, onChange, onBlur, onClear, onKeyDown, onFocus, ...a11yProps } = useSelectTrigger({\n disabled,\n searchable,\n });\n const { toggleListVisibility } = useVisibility();\n const { setSearchValue } = useSearchState();\n const { optionList } = useDataProvider();\n\n return renderTrigger({\n values,\n expanded,\n onChange,\n onBlur,\n onClear,\n onKeyDown,\n onFocus,\n ...a11yProps,\n toggleExpanded: toggleListVisibility,\n setSearchValue,\n optionsCount: optionList.length,\n ref: activatorRefCallback,\n role: 'combobox',\n 'data-qa': dataQa,\n ...triggerProps,\n disabled,\n } as Parameters<RenderTrigger>[0]);\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"TriggerLegacy.js","sources":["src/legacy/internal/TriggerLegacy.tsx"],"sourcesContent":["import { ForwardedRef, ReactElement } from 'react';\n\nimport { useDisabled } from '@hh.ru/magritte-common-use-disabled';\nimport { useMultipleRefs } from '@hh.ru/magritte-common-use-multiple-refs';\nimport type { RenderTrigger, TriggerExternalProps } 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 { useSelectTrigger, useTriggerRef } from '@hh.ru/magritte-ui-select/useSelectTrigger';\nimport { useVisibility } from '@hh.ru/magritte-ui-select/useVisibility';\n\ninterface TriggerLegacyProps {\n renderTrigger: RenderTrigger;\n triggerProps?: TriggerExternalProps;\n dataQa?: string;\n activatorRef: ForwardedRef<HTMLElement>;\n searchable?: boolean;\n}\n\n/** @deprecated Компонент TriggerLegacy deprecated, используйте Select.Trigger/Select.SearchTrigger */\nexport const TriggerLegacy = ({\n renderTrigger,\n triggerProps,\n dataQa,\n activatorRef: activatorRefExternal,\n searchable,\n}: TriggerLegacyProps): ReactElement => {\n const activatorRef = useTriggerRef();\n const activatorRefCallback = useMultipleRefs(activatorRef, activatorRefExternal);\n const forceDisabled = useDisabled();\n const disabled = triggerProps?.disabled || forceDisabled;\n\n const { values, expanded, onChange, onBlur, onClear, onKeyDown, onFocus, ...a11yProps } = useSelectTrigger({\n disabled,\n searchable,\n });\n const { toggleListVisibility } = useVisibility();\n const { setSearchValue } = useSearchState();\n const { optionList } = useDataProvider();\n\n return renderTrigger({\n values,\n expanded,\n onChange,\n onBlur,\n onClear,\n onKeyDown,\n onFocus,\n ...a11yProps,\n toggleExpanded: toggleListVisibility,\n setSearchValue,\n optionsCount: optionList.length,\n ref: activatorRefCallback,\n role: 'combobox',\n 'data-qa': dataQa,\n ...triggerProps,\n disabled,\n } as Parameters<RenderTrigger>[0]);\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAmBO,MAAM,gBAAgB,CAAC;AAAA,EAC1B,aAAA;AAAA,EACA,YAAA;AAAA,EACA,MAAA;AAAA,EACA,YAAc,EAAA,oBAAA;AAAA,EACd,UAAA;AACJ,CAAwC,KAAA;AACpC,EAAA,MAAM,eAAe,aAAc,EAAA,CAAA;AACnC,EAAM,MAAA,oBAAA,GAAuB,eAAgB,CAAA,YAAA,EAAc,oBAAoB,CAAA,CAAA;AAC/E,EAAA,MAAM,gBAAgB,WAAY,EAAA,CAAA;AAClC,EAAM,MAAA,QAAA,GAAW,cAAc,QAAY,IAAA,aAAA,CAAA;AAE3C,EAAM,MAAA,EAAE,MAAQ,EAAA,QAAA,EAAU,QAAU,EAAA,MAAA,EAAQ,OAAS,EAAA,SAAA,EAAW,OAAS,EAAA,GAAG,SAAU,EAAA,GAAI,gBAAiB,CAAA;AAAA,IACvG,QAAA;AAAA,IACA,UAAA;AAAA,GACH,CAAA,CAAA;AACD,EAAM,MAAA,EAAE,oBAAqB,EAAA,GAAI,aAAc,EAAA,CAAA;AAC/C,EAAM,MAAA,EAAE,cAAe,EAAA,GAAI,cAAe,EAAA,CAAA;AAC1C,EAAM,MAAA,EAAE,UAAW,EAAA,GAAI,eAAgB,EAAA,CAAA;AAEvC,EAAA,OAAO,aAAc,CAAA;AAAA,IACjB,MAAA;AAAA,IACA,QAAA;AAAA,IACA,QAAA;AAAA,IACA,MAAA;AAAA,IACA,OAAA;AAAA,IACA,SAAA;AAAA,IACA,OAAA;AAAA,IACA,GAAG,SAAA;AAAA,IACH,cAAgB,EAAA,oBAAA;AAAA,IAChB,cAAA;AAAA,IACA,cAAc,UAAW,CAAA,MAAA;AAAA,IACzB,GAAK,EAAA,oBAAA;AAAA,IACL,IAAM,EAAA,UAAA;AAAA,IACN,SAAW,EAAA,MAAA;AAAA,IACX,GAAG,YAAA;AAAA,IACH,QAAA;AAAA,GAC6B,CAAA,CAAA;AACrC;;;;"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import type { RenderAlertOnExitWithoutSaving } from '
|
|
2
|
+
import type { RenderAlertOnExitWithoutSaving } from '../../legacy/types';
|
|
3
3
|
interface UnsavedChangesAlertLegacyProps {
|
|
4
4
|
renderAlertOnExitWithoutSaving: RenderAlertOnExitWithoutSaving;
|
|
5
5
|
}
|
|
@@ -12,15 +12,16 @@ import '@hh.ru/magritte-internal-slot-registry';
|
|
|
12
12
|
import '../../useVisibility.js';
|
|
13
13
|
import '../../internal/VisibilityContext.js';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
const UnsavedChangesAlertLegacy = ({
|
|
16
|
+
renderAlertOnExitWithoutSaving
|
|
17
|
+
}) => {
|
|
18
|
+
const { alertVisible, onCloseAlert } = useSelectUnsavedChangesAlert();
|
|
19
|
+
const { onCloseRequestWithUnsavedChanges, discardChanges } = useSelectPicker();
|
|
20
|
+
const onClosePickerAndAlert = useCallback(() => {
|
|
21
|
+
discardChanges();
|
|
22
|
+
onCloseRequestWithUnsavedChanges();
|
|
23
|
+
}, [discardChanges, onCloseRequestWithUnsavedChanges]);
|
|
24
|
+
return renderAlertOnExitWithoutSaving({ alertVisible, onCloseAlert, onClosePickerAndAlert });
|
|
24
25
|
};
|
|
25
26
|
|
|
26
27
|
export { UnsavedChangesAlertLegacy };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnsavedChangesAlertLegacy.js","sources":["src/legacy/internal/UnsavedChangesAlertLegacy.tsx"],"sourcesContent":["import { ReactElement, useCallback } from 'react';\n\nimport { useSelectPicker, useSelectUnsavedChangesAlert } from '@hh.ru/magritte-ui-select/SelectPickerContext';\nimport type { RenderAlertOnExitWithoutSaving } from '@hh.ru/magritte-ui-select/legacy/types';\n\ninterface UnsavedChangesAlertLegacyProps {\n renderAlertOnExitWithoutSaving: RenderAlertOnExitWithoutSaving;\n}\n\n/** @deprecated Компонент UnsavedChangesAlertLegacy deprecated, используйте useSelectUnsavedChangesAlert */\nexport const UnsavedChangesAlertLegacy = ({\n renderAlertOnExitWithoutSaving,\n}: UnsavedChangesAlertLegacyProps): ReactElement => {\n const { alertVisible, onCloseAlert } = useSelectUnsavedChangesAlert();\n const { onCloseRequestWithUnsavedChanges, discardChanges } = useSelectPicker();\n\n const onClosePickerAndAlert = useCallback(() => {\n discardChanges();\n onCloseRequestWithUnsavedChanges();\n }, [discardChanges, onCloseRequestWithUnsavedChanges]);\n\n return renderAlertOnExitWithoutSaving({ alertVisible, onCloseAlert, onClosePickerAndAlert });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"UnsavedChangesAlertLegacy.js","sources":["src/legacy/internal/UnsavedChangesAlertLegacy.tsx"],"sourcesContent":["import { ReactElement, useCallback } from 'react';\n\nimport { useSelectPicker, useSelectUnsavedChangesAlert } from '@hh.ru/magritte-ui-select/SelectPickerContext';\nimport type { RenderAlertOnExitWithoutSaving } from '@hh.ru/magritte-ui-select/legacy/types';\n\ninterface UnsavedChangesAlertLegacyProps {\n renderAlertOnExitWithoutSaving: RenderAlertOnExitWithoutSaving;\n}\n\n/** @deprecated Компонент UnsavedChangesAlertLegacy deprecated, используйте useSelectUnsavedChangesAlert */\nexport const UnsavedChangesAlertLegacy = ({\n renderAlertOnExitWithoutSaving,\n}: UnsavedChangesAlertLegacyProps): ReactElement => {\n const { alertVisible, onCloseAlert } = useSelectUnsavedChangesAlert();\n const { onCloseRequestWithUnsavedChanges, discardChanges } = useSelectPicker();\n\n const onClosePickerAndAlert = useCallback(() => {\n discardChanges();\n onCloseRequestWithUnsavedChanges();\n }, [discardChanges, onCloseRequestWithUnsavedChanges]);\n\n return renderAlertOnExitWithoutSaving({ alertVisible, onCloseAlert, onClosePickerAndAlert });\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;AAUO,MAAM,4BAA4B,CAAC;AAAA,EACtC,8BAAA;AACJ,CAAoD,KAAA;AAChD,EAAA,MAAM,EAAE,YAAA,EAAc,YAAa,EAAA,GAAI,4BAA6B,EAAA,CAAA;AACpE,EAAA,MAAM,EAAE,gCAAA,EAAkC,cAAe,EAAA,GAAI,eAAgB,EAAA,CAAA;AAE7E,EAAM,MAAA,qBAAA,GAAwB,YAAY,MAAM;AAC5C,IAAe,cAAA,EAAA,CAAA;AACf,IAAiC,gCAAA,EAAA,CAAA;AAAA,GAClC,EAAA,CAAC,cAAgB,EAAA,gCAAgC,CAAC,CAAA,CAAA;AAErD,EAAA,OAAO,8BAA+B,CAAA,EAAE,YAAc,EAAA,YAAA,EAAc,uBAAuB,CAAA,CAAA;AAC/F;;;;"}
|