@blateral/b.kit 2.8.0 → 2.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { a as __makeTemplateObject, _ as __assign, h as Magnifier, ab as CrossBubble, f as Cross, ac as Filter, L as LocationPin, a9 as CurrentLocation, $ as MyLocation, k as __awaiter, l as __generator } from './Filter-19220970.js';
1
+ import { a as __makeTemplateObject, _ as __assign, h as Magnifier, ab as CrossBubble, f as Cross, ac as Filter, e as __spreadArray, L as LocationPin, a9 as CurrentLocation, $ as MyLocation, k as __awaiter, l as __generator } from './Filter-19220970.js';
2
2
  import React__default, { useMemo, useState, useEffect } from 'react';
3
3
  import styled, { css } from 'styled-components';
4
4
  import { S as Section, m as mapToBgMode } from './Section-bd61eb2f.js';
@@ -9,7 +9,7 @@ import { s as spacings, m as mq, g as getColors, w as withRange, c as getGlobals
9
9
  import { w as withLibTheme, u as useLibTheme } from './LibThemeProvider-fb1d35ac.js';
10
10
  import { G as Grid } from './Grid-7b33e271.js';
11
11
  import { I as InfoList } from './InfoList-b6980a42.js';
12
- import { P as POIFacts, F as FilterBar, a as POICard } from './FilterBar-f9e957c1.js';
12
+ import { P as POIFacts, F as FilterBar, a as POICard } from './FilterBar-2a2a09b7.js';
13
13
  import { i as isValidArray } from './arrays-65b644ef.js';
14
14
  import { s as setUrlParam, d as deleteUrlParam } from './urlParams-9cfdaf71.js';
15
15
  import './useScroll-881c7b04.js';
@@ -22,7 +22,7 @@ import './concat-ab3c66f2.js';
22
22
  import './clamp-12d37b65.js';
23
23
  import './FilterField-bec061bc.js';
24
24
  import './useLazyInput-0b6932aa.js';
25
- import './MultiselectDropdown-10ab18cf.js';
25
+ import './MultiselectDropdown-a97be6bc.js';
26
26
  import './formFieldText-f4188e55.js';
27
27
  import './useMounted-1e4cc87b.js';
28
28
  import './Checkbox-1957067a.js';
@@ -44,7 +44,7 @@ var Facts = styled(POIFacts).withConfig({
44
44
  var PoiTitle = styled(Heading).withConfig({
45
45
  displayName: "PointOfInterestDetail__PoiTitle",
46
46
  componentId: "sc-hksryh-2"
47
- })(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n max-width: 880px;\n\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; /* number of lines to show */\n line-clamp: 2;\n -webkit-box-orient: vertical;\n\n &:not(:first-child) {\n margin-top: ", "px;\n }\n"], ["\n max-width: 880px;\n\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; /* number of lines to show */\n line-clamp: 2;\n -webkit-box-orient: vertical;\n\n &:not(:first-child) {\n margin-top: ", "px;\n }\n"])), spacings.nudge * 3);
47
+ })(templateObject_3$2 || (templateObject_3$2 = __makeTemplateObject(["\n max-width: 880px;\n\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; /* number of lines to show */\n line-clamp: 2;\n -webkit-box-orient: vertical;\n\n &:not(:first-child) {\n margin-top: ", "px;\n }\n"], ["\n max-width: 880px;\n\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2; /* number of lines to show */\n line-clamp: 2;\n -webkit-box-orient: vertical;\n\n &:not(:first-child) {\n margin-top: ", "px;\n }\n"])), spacings.nudge * 3);
48
48
  var PoiText = styled(Copy).withConfig({
49
49
  displayName: "PointOfInterestDetail__PoiText",
50
50
  componentId: "sc-hksryh-3"
@@ -114,7 +114,7 @@ var PointOfInterestDetail = function (_a) {
114
114
  })))));
115
115
  };
116
116
  var PointOfInterestDetail$1 = withLibTheme(PointOfInterestDetail);
117
- var templateObject_1$2, templateObject_2$2, templateObject_3$1, templateObject_4$1;
117
+ var templateObject_1$2, templateObject_2$2, templateObject_3$2, templateObject_4$1;
118
118
 
119
119
  var poiExactNameFilter = function (filterQuery) {
120
120
  return function (value) {
@@ -249,10 +249,12 @@ var filterPois = function (filterQuery, pois) {
249
249
  return prioList;
250
250
  };
251
251
 
252
- var getFilterMatches = function (filterQuery, includeIds, items) {
252
+ var getFilterMatches = function (filterQuery, categoryFilters, items) {
253
+ var _a;
254
+
253
255
  var searchMatches = new Map();
254
256
 
255
- if (!filterQuery && !includeIds.length) {
257
+ if (!filterQuery && !categoryFilters.length) {
256
258
  for (var _i = 0, items_1 = items; _i < items_1.length; _i++) {
257
259
  var item = items_1[_i];
258
260
  searchMatches.set(item.id, {
@@ -262,10 +264,12 @@ var getFilterMatches = function (filterQuery, includeIds, items) {
262
264
  }
263
265
  }
264
266
 
265
- for (var _a = 0, items_2 = items; _a < items_2.length; _a++) {
266
- var item = items_2[_a];
267
+ for (var _b = 0, items_2 = items; _b < items_2.length; _b++) {
268
+ var item = items_2[_b];
267
269
 
268
- if (includeIds.includes(item.id)) {
270
+ if ((_a = item.facts) === null || _a === void 0 ? void 0 : _a.some(function (fact) {
271
+ return categoryFilters.includes(fact);
272
+ })) {
269
273
  searchMatches.set(item.id, {
270
274
  item: item,
271
275
  priority: 1
@@ -276,8 +280,8 @@ var getFilterMatches = function (filterQuery, includeIds, items) {
276
280
 
277
281
  var matches = filterQuery ? filterPois(escapeRegExp(filterQuery), items || []) : [];
278
282
 
279
- for (var _b = 0, matches_1 = matches; _b < matches_1.length; _b++) {
280
- var match = matches_1[_b];
283
+ for (var _c = 0, matches_1 = matches; _c < matches_1.length; _c++) {
284
+ var match = matches_1[_c];
281
285
  if (searchMatches.has(match.item.id)) continue;
282
286
  searchMatches.set(match.item.id, match);
283
287
  }
@@ -341,14 +345,18 @@ var index = /*#__PURE__*/Object.freeze({
341
345
  PoiFilterBar: PoiFilterBar
342
346
  });
343
347
 
348
+ var POISection = styled(Section).withConfig({
349
+ displayName: "PointOfInterestOverview__POISection",
350
+ componentId: "sc-epctuk-0"
351
+ })(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n overflow: visible;\n"], ["\n overflow: visible;\n"])));
344
352
  var Content = styled.div.withConfig({
345
353
  displayName: "PointOfInterestOverview__Content",
346
- componentId: "sc-epctuk-0"
347
- })(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n & > * + * {\n margin-top: ", "px;\n }\n\n @media ", " {\n & > * + * {\n margin-top: ", "px;\n }\n }\n"], ["\n & > * + * {\n margin-top: ", "px;\n }\n\n @media ", " {\n & > * + * {\n margin-top: ", "px;\n }\n }\n"])), spacings.nudge * 5, mq.large, spacings.nudge * 3);
354
+ componentId: "sc-epctuk-1"
355
+ })(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n & > * + * {\n margin-top: ", "px;\n }\n\n @media ", " {\n & > * + * {\n margin-top: ", "px;\n }\n }\n"], ["\n & > * + * {\n margin-top: ", "px;\n }\n\n @media ", " {\n & > * + * {\n margin-top: ", "px;\n }\n }\n"])), spacings.nudge * 5, mq.large, spacings.nudge * 3);
348
356
  var PoiOverviewFilterBar = styled(PoiFilterBar).withConfig({
349
357
  displayName: "PointOfInterestOverview__PoiOverviewFilterBar",
350
- componentId: "sc-epctuk-1"
351
- })(templateObject_2$1 || (templateObject_2$1 = __makeTemplateObject(["\n // margin to show prevent section overflow outline\n margin-top: 2px;\n border: solid 1px\n ", ";\n\n &:not(:last-child) {\n margin-bottom: ", "px;\n }\n\n @media ", " {\n border: none;\n }\n"], ["\n // margin to show prevent section overflow outline\n margin-top: 2px;\n border: solid 1px\n ", ";\n\n &:not(:last-child) {\n margin-bottom: ", "px;\n }\n\n @media ", " {\n border: none;\n }\n"])), function (_a) {
358
+ componentId: "sc-epctuk-2"
359
+ })(templateObject_3$1 || (templateObject_3$1 = __makeTemplateObject(["\n // margin to show prevent section overflow outline\n margin-top: 2px;\n border: solid 1px\n ", ";\n\n &:not(:last-child) {\n margin-bottom: ", "px;\n }\n\n @media ", " {\n border: none;\n }\n"], ["\n // margin to show prevent section overflow outline\n margin-top: 2px;\n border: solid 1px\n ", ";\n\n &:not(:last-child) {\n margin-bottom: ", "px;\n }\n\n @media ", " {\n border: none;\n }\n"])), function (_a) {
352
360
  var theme = _a.theme,
353
361
  isInverted = _a.isInverted;
354
362
  return isInverted ? getColors(theme).elementBg.light : getColors(theme).elementBg.dark;
@@ -380,12 +388,27 @@ var PointOfInterestOverview = function (_a) {
380
388
  filters = _d[0],
381
389
  setFilters = _d[1];
382
390
 
391
+ var categories = useMemo(function () {
392
+ return pois === null || pois === void 0 ? void 0 : pois.reduce(function (acc, poi) {
393
+ var newCategories = __spreadArray([], acc, true);
394
+
395
+ for (var _i = 0, _a = poi.facts || []; _i < _a.length; _i++) {
396
+ var fact = _a[_i];
397
+
398
+ if (!newCategories.includes(fact)) {
399
+ newCategories.push(fact);
400
+ }
401
+ }
402
+
403
+ return newCategories;
404
+ }, []);
405
+ }, [pois]);
383
406
  var poiMatches = useMemo(function () {
384
407
  var matches = getFilterMatches((filters === null || filters === void 0 ? void 0 : filters.textFilter) || '', (filters === null || filters === void 0 ? void 0 : filters.categoryFilter) || [], pois || []) || pois;
385
408
  return Array.from(matches).map(function (m) {
386
409
  return m[1];
387
410
  });
388
- }, [pois, filters]);
411
+ }, [filters === null || filters === void 0 ? void 0 : filters.textFilter, filters === null || filters === void 0 ? void 0 : filters.categoryFilter, pois]);
389
412
  useEffect(function () {
390
413
  if (filters.textFilter) {
391
414
  setUrlParam(filterName, filters.textFilter);
@@ -399,7 +422,7 @@ var PointOfInterestOverview = function (_a) {
399
422
  deleteUrlParam(factFiltername);
400
423
  }
401
424
  }, [filterName, factFiltername, filters.textFilter, filters.categoryFilter]);
402
- return React__default.createElement(Section, {
425
+ return React__default.createElement(POISection, {
403
426
  addSeperation: true,
404
427
  anchorId: anchorId,
405
428
  bgColor: isInverted ? colors.sectionBg.dark : hasBg ? colors.sectionBg.medium : colors.sectionBg.light,
@@ -417,10 +440,10 @@ var PointOfInterestOverview = function (_a) {
417
440
  onChange: setFilters,
418
441
  textFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.textFilter) || undefined,
419
442
  categoryFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.categoryFilter) ? __assign(__assign({}, poiFilters.categoryFilter), {
420
- items: pois === null || pois === void 0 ? void 0 : pois.map(function (poi) {
443
+ items: categories === null || categories === void 0 ? void 0 : categories.map(function (cat) {
421
444
  return {
422
- value: poi.id,
423
- label: poi.name
445
+ value: cat,
446
+ label: cat
424
447
  } || [];
425
448
  })
426
449
  }) : undefined,
@@ -428,7 +451,8 @@ var PointOfInterestOverview = function (_a) {
428
451
  closeIcon: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.closeIcon,
429
452
  toggleLabel: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.toggleLabel,
430
453
  filterIcon: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.filterIcon,
431
- indicator: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.indicator
454
+ indicator: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.indicator,
455
+ isInverted: isInverted
432
456
  }) : null, React__default.createElement(Content, null, (_b = poiMatches === null || poiMatches === void 0 ? void 0 : poiMatches.sort(function (a, b) {
433
457
  return a.priority - b.priority;
434
458
  })) === null || _b === void 0 ? void 0 : _b.map(function (poi, i) {
@@ -440,7 +464,7 @@ var PointOfInterestOverview = function (_a) {
440
464
  }))));
441
465
  };
442
466
  var PointOfInterestOverview$1 = withLibTheme(PointOfInterestOverview);
443
- var templateObject_1$1, templateObject_2$1;
467
+ var templateObject_1$1, templateObject_2$1, templateObject_3$1;
444
468
 
445
469
  var genHeightStyles = function () {
446
470
  return css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Doing some crazy shit to calculate curent navbar height in CSS\n ", "\n"], ["\n // Doing some crazy shit to calculate curent navbar height in CSS\n ", "\n"])), function (_a) {
@@ -618,13 +642,27 @@ var PointOfInterestMap = function (_a) {
618
642
  filters = _k[0],
619
643
  setFilters = _k[1];
620
644
 
645
+ var categories = useMemo(function () {
646
+ return pois === null || pois === void 0 ? void 0 : pois.reduce(function (acc, poi) {
647
+ var newCategories = __spreadArray([], acc, true);
648
+
649
+ for (var _i = 0, _a = poi.facts || []; _i < _a.length; _i++) {
650
+ var fact = _a[_i];
651
+
652
+ if (!newCategories.includes(fact)) {
653
+ newCategories.push(fact);
654
+ }
655
+ }
656
+
657
+ return newCategories;
658
+ }, []);
659
+ }, [pois]);
621
660
  var activePois = useMemo(function () {
622
- // text matches
623
661
  var matches = getFilterMatches((filters === null || filters === void 0 ? void 0 : filters.textFilter) || '', (filters === null || filters === void 0 ? void 0 : filters.categoryFilter) || [], pois || []) || pois;
624
662
  return Array.from(matches).map(function (m) {
625
663
  return m[1].item;
626
664
  });
627
- }, [pois, filters]);
665
+ }, [filters === null || filters === void 0 ? void 0 : filters.textFilter, filters === null || filters === void 0 ? void 0 : filters.categoryFilter, pois]);
628
666
  var activePOI = useMemo(function () {
629
667
  return activePois === null || activePois === void 0 ? void 0 : activePois.find(function (poi) {
630
668
  return poi.id === activePoiId;
@@ -825,10 +863,10 @@ var PointOfInterestMap = function (_a) {
825
863
  onChange: setFilters,
826
864
  textFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.textFilter) || undefined,
827
865
  categoryFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.categoryFilter) ? __assign(__assign({}, poiFilters.categoryFilter), {
828
- items: pois === null || pois === void 0 ? void 0 : pois.map(function (poi) {
866
+ items: categories === null || categories === void 0 ? void 0 : categories.map(function (cat) {
829
867
  return {
830
- value: poi.id,
831
- label: poi.name
868
+ value: cat,
869
+ label: cat
832
870
  } || [];
833
871
  })
834
872
  }) : undefined,