@redneckz/wildless-cms-uni-blocks 0.14.252 → 0.14.253
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/bundle/bundle.umd.js +2 -2
- package/bundle/bundle.umd.min.js +1 -1
- package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +4 -10
- package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
- package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/dist/components/StickyBottomMenu/TopItemMobile.js +1 -1
- package/dist/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
- package/dist/ui-kit/DialogManager/Dialog.js +1 -1
- package/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/lib/common.css +1 -1
- package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +4 -10
- package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js +1 -1
- package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -1
- package/lib/components/StickyBottomMenu/TopItemMobile.js +2 -2
- package/lib/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
- package/lib/ui-kit/DialogManager/Dialog.js +1 -1
- package/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/lib/ui-kit/LocationDialog/renderForeignOffices.d.ts +1 -0
- package/lib/ui-kit/LocationDialog/renderRegion.d.ts +1 -0
- package/lib/ui-kit/LocationDialog/renderRegionGroup.d.ts +1 -0
- package/mobile/bundle/bundle.umd.js +17 -279
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +4 -10
- package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/dist/components/StickyBottomMenu/TopItemMobile.js +1 -1
- package/mobile/dist/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
- package/mobile/dist/ui-kit/DialogManager/Dialog.js +1 -1
- package/mobile/dist/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/mobile/lib/common.css +1 -1
- package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +4 -10
- package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js +1 -1
- package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +1 -1
- package/mobile/lib/components/StickyBottomMenu/TopItemMobile.js +2 -2
- package/mobile/lib/components/StickyBottomMenu/TopItemMobile.js.map +1 -1
- package/mobile/lib/ui-kit/DialogManager/Dialog.js +1 -1
- package/mobile/lib/ui-kit/DialogManager/Dialog.js.map +1 -1
- package/mobile/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +21 -17
- package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +25 -44
- package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.tsx +1 -1
- package/mobile/src/components/StickyBottomMenu/TopItemMobile.tsx +5 -8
- package/mobile/src/ui-kit/DialogManager/Dialog.tsx +1 -1
- package/package.json +1 -1
- package/src/components/StickyBottomMenu/ActiveSubMenuItem.tsx +21 -17
- package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +25 -44
- package/src/components/StickyBottomMenu/StickyBottomMenu.mobile.tsx +1 -1
- package/src/components/StickyBottomMenu/TopItemMobile.tsx +5 -8
- package/src/ui-kit/DialogManager/Dialog.tsx +1 -1
|
@@ -4823,292 +4823,22 @@
|
|
|
4823
4823
|
close();
|
|
4824
4824
|
onClose && onClose();
|
|
4825
4825
|
}, [onClose]);
|
|
4826
|
-
return (jsxs("div", { className: style('relative min-h-full bg-white pt-0 p-
|
|
4826
|
+
return (jsxs("div", { className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
|
|
4827
4827
|
});
|
|
4828
4828
|
|
|
4829
|
-
const groupBy = (list, keyGetter) => {
|
|
4830
|
-
const result = new Map();
|
|
4831
|
-
for (const item of list) {
|
|
4832
|
-
const key = keyGetter(item);
|
|
4833
|
-
const group = result.get(key) || [];
|
|
4834
|
-
result.set(key, [...group, item]);
|
|
4835
|
-
}
|
|
4836
|
-
return result;
|
|
4837
|
-
};
|
|
4838
|
-
|
|
4839
|
-
const JARO_WINKLER_P = 0.1;
|
|
4840
|
-
const JARO_WINKLER_MAX_L = 4;
|
|
4841
|
-
const jaroWinklerDistance = (s1) => (s2) => {
|
|
4842
|
-
if (s1 === s2) {
|
|
4843
|
-
return 1;
|
|
4844
|
-
}
|
|
4845
|
-
if (!s1 || !s2) {
|
|
4846
|
-
return 0;
|
|
4847
|
-
}
|
|
4848
|
-
const { m, s1Matches, s2Matches } = computeM(s1, s2);
|
|
4849
|
-
if (m === 0) {
|
|
4850
|
-
return 0;
|
|
4851
|
-
}
|
|
4852
|
-
const t = computeT(s1, s2, { s1Matches, s2Matches });
|
|
4853
|
-
const jaroWeight = (m / s1.length + m / s2.length + (m - t / 2) / m) / 3;
|
|
4854
|
-
const winklerWeight = jaroWeight > 0.7 ? computePrefixL(s1, s2) * JARO_WINKLER_P : 0;
|
|
4855
|
-
return jaroWeight + winklerWeight * (1 - jaroWeight);
|
|
4856
|
-
};
|
|
4857
|
-
function computeM(s1, s2) {
|
|
4858
|
-
const range = Math.max(0, Math.floor(Math.max(s1.length, s2.length) / 2) - 1);
|
|
4859
|
-
const s1Matches = Array.from({ length: s1.length });
|
|
4860
|
-
const s2Matches = Array.from({ length: s2.length });
|
|
4861
|
-
let m = 0;
|
|
4862
|
-
for (let i = 0; i < s1.length; i++) {
|
|
4863
|
-
const low = Math.max(0, i - range);
|
|
4864
|
-
const high = Math.min(i + range, s2.length - 1);
|
|
4865
|
-
for (let j = low; j <= high; j++) {
|
|
4866
|
-
if (s1Matches[i] || s2Matches[j] || s1[i] !== s2[j]) {
|
|
4867
|
-
continue;
|
|
4868
|
-
}
|
|
4869
|
-
m++;
|
|
4870
|
-
s1Matches[i] = true;
|
|
4871
|
-
s2Matches[j] = true;
|
|
4872
|
-
}
|
|
4873
|
-
}
|
|
4874
|
-
return { m, s1Matches, s2Matches };
|
|
4875
|
-
}
|
|
4876
|
-
function computeT(s1, s2, { s1Matches, s2Matches }) {
|
|
4877
|
-
let t = 0;
|
|
4878
|
-
for (let i = 0, k = 0; i < s1.length; i++) {
|
|
4879
|
-
if (!s1Matches[i]) {
|
|
4880
|
-
continue;
|
|
4881
|
-
}
|
|
4882
|
-
let j = k;
|
|
4883
|
-
for (; j < s2.length; j++) {
|
|
4884
|
-
if (s2Matches[j]) {
|
|
4885
|
-
k = j + 1;
|
|
4886
|
-
break;
|
|
4887
|
-
}
|
|
4888
|
-
}
|
|
4889
|
-
if (s1[i] !== s2[j]) {
|
|
4890
|
-
t++;
|
|
4891
|
-
}
|
|
4892
|
-
}
|
|
4893
|
-
return t;
|
|
4894
|
-
}
|
|
4895
|
-
function computePrefixL(s1, s2) {
|
|
4896
|
-
let prefixL = 0;
|
|
4897
|
-
while (s1[prefixL] === s2[prefixL] && prefixL < JARO_WINKLER_MAX_L) {
|
|
4898
|
-
prefixL++;
|
|
4899
|
-
}
|
|
4900
|
-
return prefixL;
|
|
4901
|
-
}
|
|
4902
|
-
|
|
4903
|
-
const renderForeignOffices = (foreignOffices) => foreignOffices?.length ? (jsxs("div", { className: "sm:border-t sm:border-main-divider mt-2xs pt-2xs", children: [jsx("div", { className: "mb-m", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: "\u041F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0437\u0430 \u0440\u0443\u0431\u0435\u0436\u043E\u043C:" }) }), jsx("div", { className: "flex flex-col sm:flex-row gap-5xl", children: foreignOffices.map((office, i) => (jsx(ForeignOffice, { ...office }, String(i)))) })] })) : null;
|
|
4904
|
-
const ForeignOffice = JSX(({ icon, ...rest }) => {
|
|
4905
|
-
const link = useLink();
|
|
4906
|
-
const { text, target, href, onClick } = link(rest);
|
|
4907
|
-
return (jsxs("div", { className: "flex gap-s items-center", children: [icon ? jsx(Img, { pathPrefix: "/wcms-resources/", image: icon }) : null, text ? (jsx("a", { className: "hover:text-primary-hover", href: href, target: target, onClick: onClick, children: jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text }) })) : null] }));
|
|
4908
|
-
});
|
|
4909
|
-
|
|
4910
|
-
const renderRegion = (onChangeLocation) => (region) => region.name ? (jsx(LinkWrapper, { isRemote: true, href: `/branches/${region.slug}`, className: "mb-xs sm:mb-2xs hover:text-primary-hover", onClick: () => {
|
|
4911
|
-
onChangeLocation && onChangeLocation(region);
|
|
4912
|
-
}, children: jsx(Text, { size: "text-l", font: "font-light", children: region.name }) }, String(region.id))) : null;
|
|
4913
|
-
|
|
4914
|
-
const renderRegionGroup = (onChangeLocation) => ([letter, regions]) => (jsxs("div", { className: "break-inside-avoid mb-2xl w-56", children: [jsx("div", { className: "mb-s", children: jsx(Text, { size: "text-h6", children: letter }) }), regions.map(renderRegion(onChangeLocation))] }, letter));
|
|
4915
|
-
|
|
4916
|
-
const SearchBar$1 = JSX(({ className, searchTerm, onSearch }) => {
|
|
4917
|
-
return (jsxs("form", { className: `font-sans relative ${className}`, children: [jsx("div", { className: "absolute rounded h-full flex items-center justify-center pl-m max-w-44 gap-s pointer-events-none", children: searchTerm ? null : (jsx("label", { htmlFor: "search-bar-input", className: `text-secondary-text `, children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0444\u0438\u043B\u0438\u0430\u043B\u0430\u043C" })) }), jsx("input", { id: "search-bar-input", className: `h-12 pl-m w-full peer text-l text-black border border-solid rounded-md box-border
|
|
4918
|
-
outline-none border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text`, value: searchTerm, onChange: (e) => onSearch(e.target.value.toLowerCase()), type: "text", name: "location-search-bar-input" })] }));
|
|
4919
|
-
});
|
|
4920
|
-
|
|
4921
|
-
const SEARCH_TERM_MIN_LENGTH = 3;
|
|
4922
|
-
const LocationDialog = JSX(({ foreignOffices, defaultLocation }) => {
|
|
4923
|
-
const [currentLocation, selectCurrentLocation] = useLocation(defaultLocation);
|
|
4924
|
-
const link = useLink({ isRemote: true });
|
|
4925
|
-
const { href } = link({ href: `/branches/${currentLocation.slug}` });
|
|
4926
|
-
const [query, setQuery] = useState('');
|
|
4927
|
-
const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
|
|
4928
|
-
const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
|
|
4929
|
-
const { close } = useDialogManager();
|
|
4930
|
-
const handleChangeLocation = useCallback((region) => {
|
|
4931
|
-
selectCurrentLocation(region);
|
|
4932
|
-
close();
|
|
4933
|
-
}, []);
|
|
4934
|
-
return (jsxs(Dialog, { className: "pb-20", head: jsxs("div", { children: [jsx(Text, { size: "text-h4", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B" }), currentLocation ? (jsx("div", { className: "mb-s", children: jsxs(Paragraph, { size: "text-l", color: "text-primary-text", children: ["\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:", jsx(LinkWrapper, { isRemote: true, href: href, className: "inline mx-2xs text-primary-main", children: currentLocation.name })] }) })) : null, jsx(SearchBar$1, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
|
|
4935
|
-
.filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
|
|
4936
|
-
.map(renderRegion(handleChangeLocation)) })) : (jsx("div", { className: "columns-1 sm:columns-5", children: Array.from(regionsGroupByLetter.entries()).map(renderRegionGroup(handleChangeLocation)) })), renderForeignOffices(foreignOffices)] }));
|
|
4937
|
-
});
|
|
4938
|
-
const regionFirstLetter = (region) => region.name?.charAt(0) || '';
|
|
4939
|
-
const cleanUpRegions = (regions) => regions.map((region) => ({
|
|
4940
|
-
...region,
|
|
4941
|
-
name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
|
|
4942
|
-
}));
|
|
4943
|
-
|
|
4944
|
-
const useLocationDialog = (props) => {
|
|
4945
|
-
const { open, close } = useDialogManager();
|
|
4946
|
-
return {
|
|
4947
|
-
open: (options = {}) => open(jsx(LocationDialog, { ...props }), options),
|
|
4948
|
-
close,
|
|
4949
|
-
};
|
|
4950
|
-
};
|
|
4951
|
-
|
|
4952
|
-
const SearchInput = JSX(({ className, value, autoFocus, onChange, onFocus, placeholder = 'Поиск по сайту' }) => {
|
|
4953
|
-
const handleChange = useCallback((ev) => {
|
|
4954
|
-
onChange && onChange(ev.target?.value || '');
|
|
4955
|
-
}, [onChange]);
|
|
4956
|
-
return (jsxs("div", { className: style('font-sans relative', className), role: "form", children: [jsx("div", { className: "absolute h-full flex items-center pl-m pointer-events-none", children: jsx(Img, { image: { icon: 'LoupeIcon', iconVersion: 'black' }, width: "24", height: "24" }) }), jsx("input", { className: style('h-14 w-full px-10 text-l text-black outline-none box-border border border-solid rounded-md', 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'), value: value, type: "text", name: "search-bar-input", placeholder: placeholder, autoFocus: autoFocus, onChange: handleChange, onFocus: onFocus })] }));
|
|
4957
|
-
});
|
|
4958
|
-
|
|
4959
|
-
function useDebouncedEffect(effect, deps, delay = 300) {
|
|
4960
|
-
useEffect(() => {
|
|
4961
|
-
const timerId = globalThis.setTimeout(effect, delay);
|
|
4962
|
-
return () => {
|
|
4963
|
-
globalThis.clearTimeout(timerId);
|
|
4964
|
-
};
|
|
4965
|
-
}, deps);
|
|
4966
|
-
}
|
|
4967
|
-
|
|
4968
|
-
const compareBy = (indexOf) => (a, b) => indexOf(a) - indexOf(b);
|
|
4969
|
-
const desc = (cmp) => (a, b) => -cmp(a, b);
|
|
4970
|
-
|
|
4971
|
-
const joinMaps = (aggregate, emptyVal) => (acc, map) => {
|
|
4972
|
-
for (const [key, b] of map) {
|
|
4973
|
-
acc.set(key, aggregate(acc.get(key) || emptyVal, b));
|
|
4974
|
-
}
|
|
4975
|
-
return acc;
|
|
4976
|
-
};
|
|
4977
|
-
|
|
4978
|
-
const MIN_TERM_LEN = 3;
|
|
4979
|
-
const tokenize = (text) => text
|
|
4980
|
-
.toLowerCase()
|
|
4981
|
-
.split(/[^0-9a-zа-я-]+/)
|
|
4982
|
-
.filter((token) => token.length >= MIN_TERM_LEN && !/[0-9a-z]/.test(token));
|
|
4983
|
-
|
|
4984
|
-
const textRank = (queryTokens) => (text) => {
|
|
4985
|
-
const textTokens = tokenize(text || '');
|
|
4986
|
-
return textTokens.length
|
|
4987
|
-
? sum(queryTokens.map((qToken) => max(textTokens.map(jaroWinklerDistance(qToken)))))
|
|
4988
|
-
: 0;
|
|
4989
|
-
};
|
|
4990
|
-
|
|
4991
|
-
const JW_THRESHOLD = 0.8;
|
|
4992
|
-
const RANK_EPS = 0.001;
|
|
4993
|
-
const search = (query) => (searchIndex) => {
|
|
4994
|
-
const { corpus, dictionary } = searchIndex || {};
|
|
4995
|
-
if (!query || !corpus?.length || !dictionary || !Object.keys(dictionary).length) {
|
|
4996
|
-
return [];
|
|
4997
|
-
}
|
|
4998
|
-
const queryTokens = tokenize(query);
|
|
4999
|
-
if (!queryTokens.length) {
|
|
5000
|
-
return [];
|
|
5001
|
-
}
|
|
5002
|
-
const dictEntries = Object.entries(dictionary);
|
|
5003
|
-
const pagesRanking = queryTokens
|
|
5004
|
-
.map(computePagesRankingPerToken(dictEntries))
|
|
5005
|
-
.reduce(joinMaps((a, b) => a + b, 0), new Map());
|
|
5006
|
-
const relevantPages = [...pagesRanking.entries()]
|
|
5007
|
-
.filter(([, pageRank]) => pageRank >= (JW_THRESHOLD - RANK_EPS) * queryTokens.length) // Multiplication of query tokens
|
|
5008
|
-
.map(([pageIndex]) => corpus[pageIndex]);
|
|
5009
|
-
return sortResultsByRank(queryTokens)(relevantPages);
|
|
5010
|
-
};
|
|
5011
|
-
const computePagesRankingPerToken = (dictEntries) => (qToken) => dictEntries
|
|
5012
|
-
.map(([stem, pageIndices]) => [jaroWinklerDistance(qToken)(stem), pageIndices])
|
|
5013
|
-
.filter(([stemRank]) => stemRank >= JW_THRESHOLD)
|
|
5014
|
-
.map(([stemRank, pageIndices]) => fillMapWith(pageIndices, stemRank))
|
|
5015
|
-
.reduce(joinMaps(Math.max, 0), new Map());
|
|
5016
|
-
const sortResultsByRank = (queryTokens) => (results) => zip(results, results.map(({ title }) => title).map(textRank(queryTokens)))
|
|
5017
|
-
.sort(desc(compareBy(([, pageTitleRank]) => pageTitleRank)))
|
|
5018
|
-
.map(([corpusItem]) => corpusItem);
|
|
5019
|
-
const fillMapWith = (keys, value) => new Map(keys.map((_) => [_, value]));
|
|
5020
|
-
|
|
5021
|
-
const SEARCH_INDEX_FILENAME = 'search.index.json';
|
|
5022
|
-
const useSearch = ({ basePathList, initialQuery = '', }) => {
|
|
5023
|
-
const [query, setQuery] = useState(initialQuery || '');
|
|
5024
|
-
useEffect(() => {
|
|
5025
|
-
if (initialQuery !== undefined && initialQuery !== null) {
|
|
5026
|
-
setQuery(initialQuery);
|
|
5027
|
-
}
|
|
5028
|
-
}, [initialQuery]);
|
|
5029
|
-
const { data } = useAsyncData(basePathList?.length ? basePathList : null, fetchSearchIndex);
|
|
5030
|
-
const [result, setResult] = useState(null);
|
|
5031
|
-
useDebouncedEffect(() => {
|
|
5032
|
-
if (data) {
|
|
5033
|
-
setResult(data.map(search(query)));
|
|
5034
|
-
}
|
|
5035
|
-
}, [data, query]);
|
|
5036
|
-
return [result, { value: query, onChange: setQuery }];
|
|
5037
|
-
};
|
|
5038
|
-
const fetchSearchIndex = async (...basePathList) => (await Promise.allSettled(basePathList.map((basePath) => fetchJSON(joinPath(basePath, '/', SEARCH_INDEX_FILENAME))))).map((_) => (_.status === 'fulfilled' ? _.value : {}));
|
|
5039
|
-
|
|
5040
|
-
const FOOTER_AREA_KEYS = ['all', 'footer'];
|
|
5041
|
-
const Sitemap = JSX(({ className, topItems }) => {
|
|
5042
|
-
const link = useLink({ isRemote: true });
|
|
5043
|
-
return (jsx("div", { className: style('flex items-start justify-between', className), children: topItems?.filter(isVisibleItem).map(link).map(renderColumn) }));
|
|
5044
|
-
});
|
|
5045
|
-
const renderColumn = (menuItem, index) => {
|
|
5046
|
-
const { text, items = [], href, target, onClick } = menuItem;
|
|
5047
|
-
const visibleSubItems = items.filter(isVisibleItem);
|
|
5048
|
-
return (jsxs("div", { className: "flex flex-col gap-s w-1/4", children: [jsx("a", { className: "leading-5 text-l text-primary-text hover:text-primary-main no-underline", href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }), visibleSubItems.map((_, i) => (jsx(ColumnItem, { ..._, basePath: appendSlash(href), index: i }, String(i))))] }, String(index)));
|
|
5049
|
-
};
|
|
5050
|
-
const ColumnItem = JSX(({ text, index, basePath, ...rest }) => {
|
|
5051
|
-
const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
|
|
5052
|
-
const link = useLink({ isRemote: isAnotherPortal, basePath });
|
|
5053
|
-
const { href, target, onClick } = link(rest);
|
|
5054
|
-
return (jsx("a", { className: style('text-l font-light text-secondary-text hover:text-primary-main no-underline', 'overflow-x-hidden overflow-ellipsis whitespace-nowrap'), href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }));
|
|
5055
|
-
});
|
|
5056
|
-
const isVisibleItem = (_) => !_.displayArea || FOOTER_AREA_KEYS.includes(_.displayArea.toLowerCase());
|
|
5057
|
-
|
|
5058
|
-
const SearchDialog = JSX(({ initialQuery, topItems }) => {
|
|
5059
|
-
const basePathList = useMemo(() => topItems?.map((_) => _.href || '/'), [topItems]);
|
|
5060
|
-
const [searchResult, searchInputProps] = useSearch({
|
|
5061
|
-
basePathList,
|
|
5062
|
-
initialQuery,
|
|
5063
|
-
});
|
|
5064
|
-
const searchItems = useMemo(() => combineTopItemsAndSearchResult(topItems)(searchResult), [topItems, searchResult]);
|
|
5065
|
-
return (jsx(Dialog, { head: jsx(SearchInput, { autoFocus: true, ...searchInputProps }), children: jsx(Sitemap, { topItems: searchItems }) }));
|
|
5066
|
-
});
|
|
5067
|
-
const combineTopItemsAndSearchResult = (topItems) => (searchResult) => topItems?.length && searchResult?.length
|
|
5068
|
-
? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
|
|
5069
|
-
..._,
|
|
5070
|
-
items: portalSearchResult?.map(({ title, uri }) => ({ text: title, href: joinPath('/', uri) })),
|
|
5071
|
-
}))
|
|
5072
|
-
: [];
|
|
5073
|
-
|
|
5074
|
-
const useSearchDialog = (initialProps = {}) => {
|
|
5075
|
-
const { open, close } = useDialogManager();
|
|
5076
|
-
return {
|
|
5077
|
-
open: (props = {}, options = {}) => open(jsx(SearchDialog, { ...initialProps, ...props }), options),
|
|
5078
|
-
close,
|
|
5079
|
-
};
|
|
5080
|
-
};
|
|
5081
|
-
|
|
5082
|
-
const MIN_QUERY_LEN = 3;
|
|
5083
|
-
const SearchBar = JSX(({ className, ...rest }) => {
|
|
5084
|
-
const [value, setValue] = useState('');
|
|
5085
|
-
const resetQueryOnDialogClose = useCallback(() => setValue(''), []);
|
|
5086
|
-
const searchDialog = useSearchDialog(rest);
|
|
5087
|
-
const handleInitialInputChange = useCallback((_) => {
|
|
5088
|
-
setValue(_);
|
|
5089
|
-
if (isQueryLongEnough(_)) {
|
|
5090
|
-
searchDialog.open({ initialQuery: _ }, { onClose: resetQueryOnDialogClose });
|
|
5091
|
-
}
|
|
5092
|
-
}, [resetQueryOnDialogClose, searchDialog]);
|
|
5093
|
-
return (jsxs("div", { className: style('relative', className), role: "search", children: [jsx(SearchInput, { value: value, onChange: handleInitialInputChange }), jsx(CloseButton, { className: "absolute top-0 right-0 sm:hidden", onClose: resetQueryOnDialogClose })] }));
|
|
5094
|
-
});
|
|
5095
|
-
const isQueryLongEnough = (_) => _ && _.length >= MIN_QUERY_LEN;
|
|
5096
|
-
|
|
5097
4829
|
const ActiveSubMenuItem = JSX(({ item, basePath }) => {
|
|
5098
4830
|
const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
|
|
5099
4831
|
const link = useLink({ isRemote: isAnotherPortal, basePath });
|
|
5100
4832
|
const { href, target, onClick } = link(item);
|
|
5101
4833
|
const router = useRouter();
|
|
5102
4834
|
const isActive = isHrefActive(router)({ href });
|
|
5103
|
-
return (jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `py-
|
|
4835
|
+
return (jsx("div", { className: "mt-3", children: jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `py-4 px-4 text-h5 font-light flex justify-between cursor-pointer`, 'shadow-main-black', 'rounded-xl'), href: href, target: target, onClick: onClick, children: [item.text, jsx(Img, { image: { icon: 'ArrowRightIcon', iconVersion: 'color' }, width: "24", height: "24", className: "text-secondary-text opacity-30" })] }) }));
|
|
5104
4836
|
});
|
|
5105
4837
|
|
|
5106
|
-
const TopItemMobile = ({ item, isActive, onClick }) => (
|
|
4838
|
+
const TopItemMobile = ({ item, isActive, onClick }) => (jsx("div", { className: style('relative rounded-2xl p-2', isActive ? 'bg-primary-main' : 'bg-main-gray'), children: jsx("button", { type: "button", className: "relative", onClick: onClick, children: jsx("span", { className: style('whitespace-nowrap', isActive ? 'text-white' : ''), children: item.text }) }) }));
|
|
5107
4839
|
|
|
5108
4840
|
const BurgerMenuDialog = JSX((props) => {
|
|
5109
|
-
const { topItems,
|
|
5110
|
-
const [location] = useLocation(defaultLocation);
|
|
5111
|
-
const locationDialog = useLocationDialog(props);
|
|
4841
|
+
const { topItems, officesLink } = props;
|
|
5112
4842
|
const [containerRef, scroll] = useSwipeListScroll({
|
|
5113
4843
|
itemCount: topItems?.length ?? 0,
|
|
5114
4844
|
});
|
|
@@ -5125,11 +4855,10 @@
|
|
|
5125
4855
|
}
|
|
5126
4856
|
}, [activeTopItemIndex, scroll]);
|
|
5127
4857
|
const handleTopItemClick = useCallback((idx) => setActiveTopItemIndex(idx), []);
|
|
5128
|
-
return (jsx(Dialog, { head: jsx("div", { className: "flex items-center", children: jsx(Heading, { as: "h4", title: "\u041C\u0435\u043D\u044E" }) }), children: jsxs("div", { className: "flex flex-col flex-nowrap relative w-full h-auto m-auto bg-white pb-24 box-border rounded-md", children: [jsx("div", { className: "w-full mb-3", children: jsx(SwipeListContainer, { containerRef: containerRef, visibleItemCount: 0, gap:
|
|
4858
|
+
return (jsx(Dialog, { head: jsx("div", { className: "flex items-center", children: jsx(Heading, { as: "h4", title: "\u041C\u0435\u043D\u044E" }) }), children: jsxs("div", { className: "flex flex-col flex-nowrap relative w-full h-auto m-auto bg-white pb-24 box-border rounded-md", children: [jsx("div", { className: "w-full mb-3", children: jsx(SwipeListContainer, { containerRef: containerRef, visibleItemCount: 0, gap: 10, className: "pb-3", children: topItems?.map((item, i) => (jsx(TopItemMobile, { item: item, isActive: activeTopItemIndex === i, onClick: () => handleTopItemClick(i) }, String(i)))) }) }), jsxs("div", { className: "relative grow", children: [renderActiveSubMenu(activeMenuSubItems, activeRoute?.href), renderOfficeLink(officesLink)] })] }) }));
|
|
5129
4859
|
});
|
|
5130
4860
|
const renderActiveSubMenu = (activeMenuSubItems, basePath) => activeMenuSubItems ? (jsx("div", { children: activeMenuSubItems.map((_, i) => (jsx(ActiveSubMenuItem, { item: _, basePath: basePath }, String(i)))) })) : null;
|
|
5131
|
-
const renderOfficeLink = (officesLink) => officesLink ? (jsxs("a", { className:
|
|
5132
|
-
const renderLocation = (location, onClick) => (jsxs("div", { className: "flex items-center text-s cursor-pointer", onClick: onClick, children: [jsx(Img, { image: { icon: 'GeolocationIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-primary-main box-border mr-xs bg-main-divider p-xs rounded-md" }), jsxs("div", { className: "flex flex-col items-start", children: [jsx(Text, { size: "text-h5", children: location.name }), jsx(Text, { color: "text-secondary-text", size: "text-s", children: "\u0412\u0430\u0448\u0430 \u043B\u043E\u043A\u0430\u0446\u0438\u044F" })] })] }));
|
|
4861
|
+
const renderOfficeLink = (officesLink) => officesLink ? (jsx("div", { className: "mt-3", children: jsxs("a", { className: style('text-primary-text', `py-4 px-4 text-h5 font-light flex justify-between cursor-pointer`, 'shadow-main-black', 'rounded-xl'), href: officesLink, rel: "noopener noreferrer", "aria-label": "\u041E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B", children: [jsx("span", { children: "\u041E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" }), jsx(Img, { image: { icon: 'ArrowRightIcon', iconVersion: 'color' }, width: "24", height: "24", className: "text-secondary-text opacity-30" })] }) })) : null;
|
|
5133
4862
|
|
|
5134
4863
|
const BURGER_MENU_DIALOG_ID = 'burgerMenuDialog';
|
|
5135
4864
|
const useBurgerMenuDialog = (props) => {
|
|
@@ -5156,7 +4885,7 @@
|
|
|
5156
4885
|
const middleIdx = Math.floor(menuItems.length / 2);
|
|
5157
4886
|
const leftItems = menuItems.slice(0, middleIdx);
|
|
5158
4887
|
const rightItems = menuItems.slice(middleIdx);
|
|
5159
|
-
return (jsx(BlockWrapper, { className: "h-[74px]", defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }));
|
|
4888
|
+
return (jsx(BlockWrapper, { className: "h-[74px] z-[100] relative", defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }));
|
|
5160
4889
|
});
|
|
5161
4890
|
const renderMenuItem = (activeItem, close) => (_, i) => (jsx(StickyBottomMenuItem, { isActive: _ === activeItem, item: _, onClick: close }, _.href || String(i)));
|
|
5162
4891
|
|
|
@@ -5267,6 +4996,15 @@
|
|
|
5267
4996
|
}, width: "24", height: "24" })) : null, jsxs("div", { className: "border-0", children: [tab?.title ? jsx("div", { className: buttonClassNames.title, children: tab.title }) : null, tab?.description ? jsx("div", { className: buttonClassNames.desc, children: tab.description }) : null] })] }));
|
|
5268
4997
|
});
|
|
5269
4998
|
|
|
4999
|
+
function useDebouncedEffect(effect, deps, delay = 300) {
|
|
5000
|
+
useEffect(() => {
|
|
5001
|
+
const timerId = globalThis.setTimeout(effect, delay);
|
|
5002
|
+
return () => {
|
|
5003
|
+
globalThis.clearTimeout(timerId);
|
|
5004
|
+
};
|
|
5005
|
+
}, deps);
|
|
5006
|
+
}
|
|
5007
|
+
|
|
5270
5008
|
const REDIRECT_DELAY = 0.8 * 1000;
|
|
5271
5009
|
const TabsLayoutRedirectSection = JSX(({ tab }) => {
|
|
5272
5010
|
const link = useLink();
|
|
@@ -5741,7 +5479,7 @@
|
|
|
5741
5479
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
5742
5480
|
});
|
|
5743
5481
|
|
|
5744
|
-
const packageVersion = "0.14.
|
|
5482
|
+
const packageVersion = "0.14.252";
|
|
5745
5483
|
|
|
5746
5484
|
exports.Blocks = Blocks;
|
|
5747
5485
|
exports.ContentPage = ContentPage;
|