@blateral/b.kit 2.8.0 → 2.8.2

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,17 +345,24 @@ 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 border-radius: ", ";\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 border-radius: ", ";\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;
363
+ }, function (_a) {
364
+ var theme = _a.theme;
365
+ return theme.globals.sections.edgeRadius;
355
366
  }, spacings.nudge * 5, mq.medium);
356
367
 
357
368
  var PointOfInterestOverview = function (_a) {
@@ -380,12 +391,27 @@ var PointOfInterestOverview = function (_a) {
380
391
  filters = _d[0],
381
392
  setFilters = _d[1];
382
393
 
394
+ var categories = useMemo(function () {
395
+ return pois === null || pois === void 0 ? void 0 : pois.reduce(function (acc, poi) {
396
+ var newCategories = __spreadArray([], acc, true);
397
+
398
+ for (var _i = 0, _a = poi.facts || []; _i < _a.length; _i++) {
399
+ var fact = _a[_i];
400
+
401
+ if (!newCategories.includes(fact)) {
402
+ newCategories.push(fact);
403
+ }
404
+ }
405
+
406
+ return newCategories;
407
+ }, []);
408
+ }, [pois]);
383
409
  var poiMatches = useMemo(function () {
384
410
  var matches = getFilterMatches((filters === null || filters === void 0 ? void 0 : filters.textFilter) || '', (filters === null || filters === void 0 ? void 0 : filters.categoryFilter) || [], pois || []) || pois;
385
411
  return Array.from(matches).map(function (m) {
386
412
  return m[1];
387
413
  });
388
- }, [pois, filters]);
414
+ }, [filters === null || filters === void 0 ? void 0 : filters.textFilter, filters === null || filters === void 0 ? void 0 : filters.categoryFilter, pois]);
389
415
  useEffect(function () {
390
416
  if (filters.textFilter) {
391
417
  setUrlParam(filterName, filters.textFilter);
@@ -399,7 +425,7 @@ var PointOfInterestOverview = function (_a) {
399
425
  deleteUrlParam(factFiltername);
400
426
  }
401
427
  }, [filterName, factFiltername, filters.textFilter, filters.categoryFilter]);
402
- return React__default.createElement(Section, {
428
+ return React__default.createElement(POISection, {
403
429
  addSeperation: true,
404
430
  anchorId: anchorId,
405
431
  bgColor: isInverted ? colors.sectionBg.dark : hasBg ? colors.sectionBg.medium : colors.sectionBg.light,
@@ -417,10 +443,10 @@ var PointOfInterestOverview = function (_a) {
417
443
  onChange: setFilters,
418
444
  textFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.textFilter) || undefined,
419
445
  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) {
446
+ items: categories === null || categories === void 0 ? void 0 : categories.map(function (cat) {
421
447
  return {
422
- value: poi.id,
423
- label: poi.name
448
+ value: cat,
449
+ label: cat
424
450
  } || [];
425
451
  })
426
452
  }) : undefined,
@@ -428,7 +454,8 @@ var PointOfInterestOverview = function (_a) {
428
454
  closeIcon: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.closeIcon,
429
455
  toggleLabel: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.toggleLabel,
430
456
  filterIcon: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.filterIcon,
431
- indicator: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.indicator
457
+ indicator: poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.indicator,
458
+ isInverted: isInverted
432
459
  }) : null, React__default.createElement(Content, null, (_b = poiMatches === null || poiMatches === void 0 ? void 0 : poiMatches.sort(function (a, b) {
433
460
  return a.priority - b.priority;
434
461
  })) === null || _b === void 0 ? void 0 : _b.map(function (poi, i) {
@@ -440,7 +467,7 @@ var PointOfInterestOverview = function (_a) {
440
467
  }))));
441
468
  };
442
469
  var PointOfInterestOverview$1 = withLibTheme(PointOfInterestOverview);
443
- var templateObject_1$1, templateObject_2$1;
470
+ var templateObject_1$1, templateObject_2$1, templateObject_3$1;
444
471
 
445
472
  var genHeightStyles = function () {
446
473
  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 +645,27 @@ var PointOfInterestMap = function (_a) {
618
645
  filters = _k[0],
619
646
  setFilters = _k[1];
620
647
 
648
+ var categories = useMemo(function () {
649
+ return pois === null || pois === void 0 ? void 0 : pois.reduce(function (acc, poi) {
650
+ var newCategories = __spreadArray([], acc, true);
651
+
652
+ for (var _i = 0, _a = poi.facts || []; _i < _a.length; _i++) {
653
+ var fact = _a[_i];
654
+
655
+ if (!newCategories.includes(fact)) {
656
+ newCategories.push(fact);
657
+ }
658
+ }
659
+
660
+ return newCategories;
661
+ }, []);
662
+ }, [pois]);
621
663
  var activePois = useMemo(function () {
622
- // text matches
623
664
  var matches = getFilterMatches((filters === null || filters === void 0 ? void 0 : filters.textFilter) || '', (filters === null || filters === void 0 ? void 0 : filters.categoryFilter) || [], pois || []) || pois;
624
665
  return Array.from(matches).map(function (m) {
625
666
  return m[1].item;
626
667
  });
627
- }, [pois, filters]);
668
+ }, [filters === null || filters === void 0 ? void 0 : filters.textFilter, filters === null || filters === void 0 ? void 0 : filters.categoryFilter, pois]);
628
669
  var activePOI = useMemo(function () {
629
670
  return activePois === null || activePois === void 0 ? void 0 : activePois.find(function (poi) {
630
671
  return poi.id === activePoiId;
@@ -825,10 +866,10 @@ var PointOfInterestMap = function (_a) {
825
866
  onChange: setFilters,
826
867
  textFilter: (poiFilters === null || poiFilters === void 0 ? void 0 : poiFilters.textFilter) || undefined,
827
868
  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) {
869
+ items: categories === null || categories === void 0 ? void 0 : categories.map(function (cat) {
829
870
  return {
830
- value: poi.id,
831
- label: poi.name
871
+ value: cat,
872
+ label: cat
832
873
  } || [];
833
874
  })
834
875
  }) : undefined,